[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Mar 23 09:40:26 UTC 2017
sc/inc/scabstdlg.hxx | 3 ++-
sc/source/ui/attrdlg/scdlgfact.cxx | 2 +-
sc/source/ui/attrdlg/scdlgfact.hxx | 2 +-
sc/source/ui/inc/inscodlg.hxx | 2 +-
sc/source/ui/inc/scui_def.hxx | 10 ++++++++--
sc/source/ui/miscdlgs/inscodlg.cxx | 6 +++---
sc/source/ui/view/cellsh1.cxx | 12 ++++++------
7 files changed, 22 insertions(+), 15 deletions(-)
New commits:
commit a61c4ae9cef23a53ea88f957e090bd5ee9b28ca6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Mar 22 14:36:53 2017 +0200
convert SC_CELL_SHIFT_DISABLE to o3tl::typed_flags enum
Change-Id: Iae4358828edc6bad26ef5c769a8ff42fe63ade7b
Reviewed-on: https://gerrit.libreoffice.org/35556
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 3370b5d58e70..aaffffb57122 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -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;
};
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 872f9a4aeed6..25da277cffc8 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -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 );
}
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index f7db969cbdca..c6e33120e670 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -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;
};
diff --git a/sc/source/ui/inc/inscodlg.hxx b/sc/source/ui/inc/inscodlg.hxx
index 0e6378c9c828..ca46964b8dad 100644
--- a/sc/source/ui/inc/inscodlg.hxx
+++ b/sc/source/ui/inc/inscodlg.hxx
@@ -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;
diff --git a/sc/source/ui/inc/scui_def.hxx b/sc/source/ui/inc/scui_def.hxx
index d2507a81eaac..c2bc095b8162 100644
--- a/sc/source/ui/inc/scui_def.hxx
+++ b/sc/source/ui/inc/scui_def.hxx
@@ -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,
diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx
index 5a29e9c7a528..190d108e9e63 100644
--- a/sc/source/ui/miscdlgs/inscodlg.cxx
+++ b/sc/source/ui/miscdlgs/inscodlg.cxx
@@ -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;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index b718994db6ae..fd31875848fe 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -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 );
}
}
More information about the Libreoffice-commits
mailing list