summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-09-20 09:04:54 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-09-20 16:34:56 +0000
commitf1611d52cc49e51b770c56e902857c76e3c51eb2 (patch)
tree0e7751db181bcff9dc3cceebf9914aac6dc3ac9e /sc
parent20b7959ab980310119232fd2395008a89d6ea581 (diff)
convert SC_FILL constants to scoped enum
Change-Id: Ib5399440c4f63ec6b3753ffafd243626aef65d49 Reviewed-on: https://gerrit.libreoffice.org/18723 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/viewdata.hxx23
-rw-r--r--sc/source/ui/view/gridwin.cxx8
-rw-r--r--sc/source/ui/view/select.cxx14
-rw-r--r--sc/source/ui/view/tabview4.cxx2
-rw-r--r--sc/source/ui/view/viewdata.cxx10
5 files changed, 30 insertions, 27 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 3cecc6eea274..180103ac783d 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -30,11 +30,14 @@
#define SC_SIZE_NONE 65535
const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
-#define SC_FILL_NONE 0
-#define SC_FILL_FILL 1
-#define SC_FILL_EMBED_LT 2
-#define SC_FILL_EMBED_RB 3
-#define SC_FILL_MATRIX 4
+enum class ScFillMode
+{
+ NONE = 0,
+ FILL = 1,
+ EMBED_LT = 2,
+ EMBED_RB = 3,
+ MATRIX = 4,
+};
enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
@@ -203,7 +206,7 @@ private:
ScPasteFlags nPasteFlags;
ScSplitPos eEditActivePart; // the part that was active when edit mode was started
- sal_uInt8 nFillMode;
+ ScFillMode nFillMode;
bool bEditActive[4]; // Active?
bool bActive:1; // Active Window ?
bool bIsRefMode:1; // Reference input
@@ -336,13 +339,13 @@ public:
void SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
void SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
- sal_uInt8 nMode );
+ ScFillMode nMode );
void GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
SCCOL& rEndCol, SCROW& rEndRow );
void ResetFillMode();
- bool IsAnyFillMode() { return nFillMode != SC_FILL_NONE; }
- bool IsFillMode() { return nFillMode == SC_FILL_FILL; }
- sal_uInt8 GetFillMode() { return nFillMode; }
+ bool IsAnyFillMode() { return nFillMode != ScFillMode::NONE; }
+ bool IsFillMode() { return nFillMode == ScFillMode::FILL; }
+ ScFillMode GetFillMode() { return nFillMode; }
// TRUE: Cell is merged
bool GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 1068aad3c711..d8bbe92c54f7 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1601,7 +1601,7 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction )
if ( lcl_IsEditableMatrix( pViewData->GetDocument(), aMarkRange ) )
pViewData->SetDragMode(
- aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), nX, nY, SC_FILL_MATRIX );
+ aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), nX, nY, ScFillMode::MATRIX );
else
pViewData->SetFillMode(
aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), nX, nY );
@@ -1640,7 +1640,7 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction )
SetPointer( Pointer( PointerStyle::Cross ) );
if (bAction)
{
- sal_uInt8 nMode = bTop ? SC_FILL_EMBED_LT : SC_FILL_EMBED_RB;
+ ScFillMode nMode = bTop ? ScFillMode::EMBED_LT : ScFillMode::EMBED_RB;
pViewData->SetDragMode(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), nMode );
@@ -2215,7 +2215,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
SetPointer( Pointer( PointerStyle::Arrow ) );
if (pViewData->IsFillMode() ||
- ( pViewData->GetFillMode() == SC_FILL_MATRIX && rMEvt.IsMod1() ))
+ ( pViewData->GetFillMode() == ScFillMode::MATRIX && rMEvt.IsMod1() ))
{
nScFillModeMouseModifier = rMEvt.GetModifier();
SCCOL nStartCol;
@@ -2249,7 +2249,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
else
pViewData->GetDispatcher().Execute( FID_FILL_AUTO, SfxCallMode::SLOT | SfxCallMode::RECORD );
}
- else if (pViewData->GetFillMode() == SC_FILL_MATRIX)
+ else if (pViewData->GetFillMode() == ScFillMode::MATRIX)
{
SCTAB nTab = pViewData->GetTabNo();
SCCOL nStartCol;
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index fe1ffff7063b..b9830d1eee98 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -326,7 +326,7 @@ bool ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool /* bDon
// for Autofill switch in the center of cell
// thereby don't prevent scrolling to bottom/right
- if ( pViewData->IsFillMode() || pViewData->GetFillMode() == SC_FILL_MATRIX )
+ if ( pViewData->IsFillMode() || pViewData->GetFillMode() == ScFillMode::MATRIX )
{
bool bLeft, bTop;
pViewData->GetMouseQuadrant( aEffPos, GetWhich(), nPosX, nPosY, bLeft, bTop );
@@ -450,7 +450,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, bool bScrol
}
}
else if (pViewData->IsFillMode() ||
- (pViewData->GetFillMode() == SC_FILL_MATRIX && (nScFillModeMouseModifier & KEY_MOD1) ))
+ (pViewData->GetFillMode() == ScFillMode::MATRIX && (nScFillModeMouseModifier & KEY_MOD1) ))
{
// If a matrix got touched, switch back to Autofill is possible with Ctrl
@@ -575,16 +575,16 @@ bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, bool bScrol
}
else if (pViewData->IsAnyFillMode())
{
- sal_uInt8 nMode = pViewData->GetFillMode();
- if ( nMode == SC_FILL_EMBED_LT || nMode == SC_FILL_EMBED_RB )
+ ScFillMode nMode = pViewData->GetFillMode();
+ if ( nMode == ScFillMode::EMBED_LT || nMode == ScFillMode::EMBED_RB )
{
OSL_ENSURE( pDoc->IsEmbedded(), "!pDoc->IsEmbedded()" );
ScRange aRange;
pDoc->GetEmbedded( aRange);
- ScRefType eRefMode = (nMode == SC_FILL_EMBED_LT) ? SC_REFTYPE_EMBED_LT : SC_REFTYPE_EMBED_RB;
+ ScRefType eRefMode = (nMode == ScFillMode::EMBED_LT) ? SC_REFTYPE_EMBED_LT : SC_REFTYPE_EMBED_RB;
if (pViewData->GetRefType() != eRefMode)
{
- if ( nMode == SC_FILL_EMBED_LT )
+ if ( nMode == ScFillMode::EMBED_LT )
pView->InitRefMode( aRange.aEnd.Col(), aRange.aEnd.Row(), nTab, eRefMode );
else
pView->InitRefMode( aRange.aStart.Col(), aRange.aStart.Row(), nTab, eRefMode );
@@ -593,7 +593,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, bool bScrol
pView->UpdateRef( nPosX, nPosY, nTab );
}
- else if ( nMode == SC_FILL_MATRIX )
+ else if ( nMode == ScFillMode::MATRIX )
{
SCCOL nStartX, nEndX;
SCROW nStartY, nEndY; // Block
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 3c47c9bd7f89..1067f7f9354c 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -254,7 +254,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
SCCOL nEndX = aViewData.GetRefEndX();
SCROW nEndY = aViewData.GetRefEndY();
ScRange aDelRange;
- if ( aViewData.GetFillMode() == SC_FILL_MATRIX && !(nScFillModeMouseModifier & KEY_MOD1) )
+ if ( aViewData.GetFillMode() == ScFillMode::MATRIX && !(nScFillModeMouseModifier & KEY_MOD1) )
{
aHelpStr = ScGlobal::GetRscString( STR_TIP_RESIZEMATRIX );
SCCOL nCols = nEndX + 1 - aViewData.GetRefStartX(); // Reihenfolge ist richtig
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index a789d7c69ce9..9e6b151acc1d 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -321,7 +321,7 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
nFillEndY(0),
nPasteFlags ( SC_PASTE_NONE ),
eEditActivePart( SC_SPLIT_BOTTOMLEFT ),
- nFillMode ( SC_FILL_NONE ),
+ nFillMode ( ScFillMode::NONE ),
bActive ( true ), // how to initialize?
bIsRefMode ( false ),
bDelMarkValid( false ),
@@ -409,7 +409,7 @@ ScViewData::ScViewData( const ScViewData& rViewData ) :
nFillEndY(0),
nPasteFlags ( SC_PASTE_NONE ),
eEditActivePart( rViewData.eEditActivePart ),
- nFillMode ( SC_FILL_NONE ),
+ nFillMode ( ScFillMode::NONE ),
bActive ( true ), // how to initialize?
bIsRefMode ( false ),
bDelMarkValid( false ),
@@ -841,7 +841,7 @@ bool ScViewData::IsMultiMarked()
void ScViewData::SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
- nFillMode = SC_FILL_FILL;
+ nFillMode = ScFillMode::FILL;
nFillStartX = nStartCol;
nFillStartY = nStartRow;
nFillEndX = nEndCol;
@@ -849,7 +849,7 @@ void ScViewData::SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S
}
void ScViewData::SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
- sal_uInt8 nMode )
+ ScFillMode nMode )
{
nFillMode = nMode;
nFillStartX = nStartCol;
@@ -860,7 +860,7 @@ void ScViewData::SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S
void ScViewData::ResetFillMode()
{
- nFillMode = SC_FILL_NONE;
+ nFillMode = ScFillMode::NONE;
}
void ScViewData::GetFillData( SCCOL& rStartCol, SCROW& rStartRow,