Kaydet (Commit) a61c4ae9 authored tarafından Noel Grandin's avatar Noel Grandin

convert SC_CELL_SHIFT_DISABLE to o3tl::typed_flags enum

Change-Id: Iae4358828edc6bad26ef5c769a8ff42fe63ade7b
Reviewed-on: https://gerrit.libreoffice.org/35556Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 88ec24a2
......@@ -49,6 +49,7 @@ class ScTabViewShell;
class ScConditionalFormat;
class ScConditionalFormatList;
enum class CreateNameFlags;
enum class CellShiftDisabledFlags;
namespace com { namespace sun { namespace star { namespace sheet {
struct DataPilotFieldReference;
......@@ -195,7 +196,7 @@ public:
virtual void SetOtherDoc( bool bSet ) = 0;
virtual bool IsTranspose() const = 0;
virtual void SetChangeTrack( bool bSet ) = 0;
virtual void SetCellShiftDisabled( int nDisable ) = 0;
virtual void SetCellShiftDisabled( CellShiftDisabledFlags nDisable ) = 0;
virtual InsCellCmd GetMoveMode() = 0;
};
......
......@@ -335,7 +335,7 @@ void AbstractScInsertContentsDlg_Impl::SetChangeTrack( bool bSet )
pDlg->SetChangeTrack( bSet );
}
void AbstractScInsertContentsDlg_Impl::SetCellShiftDisabled( int nDisable )
void AbstractScInsertContentsDlg_Impl::SetCellShiftDisabled( CellShiftDisabledFlags nDisable )
{
pDlg->SetCellShiftDisabled( nDisable );
}
......
......@@ -233,7 +233,7 @@ class AbstractScInsertContentsDlg_Impl : public AbstractScInsertContentsDlg
virtual void SetOtherDoc( bool bSet ) override;
virtual bool IsTranspose() const override;
virtual void SetChangeTrack( bool bSet ) override;
virtual void SetCellShiftDisabled( int nDisable ) override;
virtual void SetCellShiftDisabled( CellShiftDisabledFlags nDisable ) override;
virtual InsCellCmd GetMoveMode() override;
};
......
......@@ -46,7 +46,7 @@ public:
void SetOtherDoc( bool bSet );
void SetFillMode( bool bSet );
void SetChangeTrack( bool bSet );
void SetCellShiftDisabled( int nDisable );
void SetCellShiftDisabled( CellShiftDisabledFlags nDisable );
private:
VclPtr<CheckBox> mpBtnInsAll;
......
......@@ -39,8 +39,14 @@ namespace o3tl {
template<> struct typed_flags<InsertContentsFlags> : is_typed_flags<InsertContentsFlags, 0x07> {};
}
#define SC_CELL_SHIFT_DISABLE_DOWN 0x01 //from inscodlg.hxx
#define SC_CELL_SHIFT_DISABLE_RIGHT 0x02 //from inscodlg.hxx
enum class CellShiftDisabledFlags {
NONE = 0x00,
Down = 0x01, //from inscodlg.hxx
Right = 0x02 //from inscodlg.hxx
};
namespace o3tl {
template<> struct typed_flags<CellShiftDisabledFlags> : is_typed_flags<CellShiftDisabledFlags, 0x3> {};
}
enum class CreateNameFlags {
NONE = 0,
......
......@@ -287,10 +287,10 @@ void ScInsertContentsDlg::SetChangeTrack( bool bSet )
}
}
void ScInsertContentsDlg::SetCellShiftDisabled( int nDisable )
void ScInsertContentsDlg::SetCellShiftDisabled( CellShiftDisabledFlags nDisable )
{
bool bDown = ((nDisable & SC_CELL_SHIFT_DISABLE_DOWN) != 0);
bool bRight = ((nDisable & SC_CELL_SHIFT_DISABLE_RIGHT) != 0);
bool bDown(nDisable & CellShiftDisabledFlags::Down);
bool bRight(nDisable & CellShiftDisabledFlags::Right);
if ( bDown != bMoveDownDisabled || bRight != bMoveRightDisabled )
{
bMoveDownDisabled = bDown;
......
......@@ -1435,28 +1435,28 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScRange aDest( nStartX, nStartY, nStartTab,
nStartX + nRangeSizeX, nStartY + nRangeSizeY, nStartTab );
if ( pOwnClip->GetDocument()->IsCutMode() && aSource.Intersects( aDest ) )
pDlg->SetCellShiftDisabled( SC_CELL_SHIFT_DISABLE_DOWN | SC_CELL_SHIFT_DISABLE_RIGHT );
pDlg->SetCellShiftDisabled( CellShiftDisabledFlags::Down | CellShiftDisabledFlags::Right );
else
{
//no conflict with intersecting ranges,
//check if paste plus shift will fit on sheet
//and disable shift-option if no fit
int nDisableShiftX = 0;
int nDisableShiftY = 0;
CellShiftDisabledFlags nDisableShiftX = CellShiftDisabledFlags::NONE;
CellShiftDisabledFlags nDisableShiftY = CellShiftDisabledFlags::NONE;
//check if horizontal shift will fit
if ( !pData->GetDocument()->IsBlockEmpty( nStartTab,
MAXCOL - nRangeSizeX, nStartY,
MAXCOL, nStartY + nRangeSizeY ) )
nDisableShiftX = SC_CELL_SHIFT_DISABLE_RIGHT;
nDisableShiftX = CellShiftDisabledFlags::Right;
//check if vertical shift will fit
if ( !pData->GetDocument()->IsBlockEmpty( nStartTab,
nStartX, MAXROW - nRangeSizeY,
nStartX + nRangeSizeX, MAXROW ) )
nDisableShiftY = SC_CELL_SHIFT_DISABLE_DOWN;
nDisableShiftY = CellShiftDisabledFlags::Down;
if ( nDisableShiftX || nDisableShiftY )
if ( nDisableShiftX != CellShiftDisabledFlags::NONE || nDisableShiftY != CellShiftDisabledFlags::NONE)
pDlg->SetCellShiftDisabled( nDisableShiftX | nDisableShiftY );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment