[Libreoffice-commits] core.git: sc/source

Noel Grandin noelgrandin at gmail.com
Sun Sep 20 09:35:24 PDT 2015


 sc/source/ui/inc/viewdata.hxx  |   23 +++++++++++++----------
 sc/source/ui/view/gridwin.cxx  |    8 ++++----
 sc/source/ui/view/select.cxx   |   14 +++++++-------
 sc/source/ui/view/tabview4.cxx |    2 +-
 sc/source/ui/view/viewdata.cxx |   10 +++++-----
 5 files changed, 30 insertions(+), 27 deletions(-)

New commits:
commit f1611d52cc49e51b770c56e902857c76e3c51eb2
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Sep 20 09:04:54 2015 +0200

    convert SC_FILL constants to scoped enum
    
    Change-Id: Ib5399440c4f63ec6b3753ffafd243626aef65d49
    Reviewed-on: https://gerrit.libreoffice.org/18723
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 3cecc6e..180103a 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 1068aad..d8bbe92 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 fe1ffff..b9830d1 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 3c47c9b..1067f7f 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 a789d7c..9e6b151 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,


More information about the Libreoffice-commits mailing list