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

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Jul 26 08:15:52 UTC 2016


 sc/inc/document.hxx                           |   16 ++--
 sc/inc/global.hxx                             |   22 +++---
 sc/inc/scabstdlg.hxx                          |    4 -
 sc/inc/table.hxx                              |    8 +-
 sc/source/core/data/documen3.cxx              |   10 +-
 sc/source/core/data/table1.cxx                |    2 
 sc/source/core/data/table2.cxx                |   20 ++---
 sc/source/filter/excel/exctools.cxx           |    5 +
 sc/source/filter/xcl97/xcl97rec.cxx           |    4 -
 sc/source/filter/xml/xmlexprt.cxx             |   12 +--
 sc/source/filter/xml/xmlsceni.cxx             |   12 +--
 sc/source/ui/Accessibility/AccessibleCell.cxx |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx            |    4 -
 sc/source/ui/attrdlg/scdlgfact.hxx            |    4 -
 sc/source/ui/dbgui/scendlg.cxx                |   22 +++---
 sc/source/ui/docshell/docfunc.cxx             |    2 
 sc/source/ui/docshell/docsh4.cxx              |    2 
 sc/source/ui/docshell/docsh5.cxx              |   20 ++---
 sc/source/ui/inc/docsh.hxx                    |   10 +-
 sc/source/ui/inc/scendlg.hxx                  |    8 +-
 sc/source/ui/inc/undotab.hxx                  |   10 +-
 sc/source/ui/inc/viewfunc.hxx                 |    4 -
 sc/source/ui/undo/undoblk.cxx                 |    6 -
 sc/source/ui/undo/undotab.cxx                 |   18 ++---
 sc/source/ui/unoobj/cellsuno.cxx              |   92 +++++++++++++-------------
 sc/source/ui/unoobj/docuno.cxx                |    3 
 sc/source/ui/view/cellsh.cxx                  |    6 -
 sc/source/ui/view/cellsh3.cxx                 |    4 -
 sc/source/ui/view/gridwin.cxx                 |    2 
 sc/source/ui/view/gridwin4.cxx                |    4 -
 sc/source/ui/view/viewfun2.cxx                |   10 +-
 31 files changed, 180 insertions(+), 168 deletions(-)

New commits:
commit 60f36bb7cd5956fa30b3f7ebe8a1489ed0f98685
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Mon Jul 25 14:53:18 2016 +0200

    sc: convert SC_SCENARIO_.. defines typed flags ..
    
    ScScenarioFlags
    add ScScenarioFlags::NONE for 0.
    replace uses of '-= flag' with '&= ~flag'.
    
    Change-Id: I003c0ca1f59b060f52935fec8bb6282fd9981805
    Reviewed-on: https://gerrit.libreoffice.org/27464
    Tested-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f860dbc..5d03418 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -825,14 +825,14 @@ public:
     SC_DLLPUBLIC bool           IsNegativePage( SCTAB nTab ) const;
     SC_DLLPUBLIC void           SetScenario( SCTAB nTab, bool bFlag );
     SC_DLLPUBLIC bool           IsScenario( SCTAB nTab ) const;
-    SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, OUString& rComment,
-                                       Color& rColor, sal_uInt16& rFlags ) const;
-    SC_DLLPUBLIC void           SetScenarioData( SCTAB nTab, const OUString& rComment,
-                                        const Color& rColor, sal_uInt16 nFlags );
+    SC_DLLPUBLIC void           GetScenarioData(SCTAB nTab, OUString& rComment,
+                                                Color& rColor, ScScenarioFlags &rFlags) const;
+    SC_DLLPUBLIC void           SetScenarioData(SCTAB nTab, const OUString& rComment,
+                                          const Color& rColor, ScScenarioFlags nFlags);
     SC_DLLPUBLIC Color GetTabBgColor( SCTAB nTab ) const;
     SC_DLLPUBLIC void SetTabBgColor( SCTAB nTab, const Color& rColor );
     SC_DLLPUBLIC bool IsDefaultTabBgColor( SCTAB nTab ) const;
-    void            GetScenarioFlags( SCTAB nTab, sal_uInt16& rFlags ) const;
+    void                        GetScenarioFlags(SCTAB nTab, ScScenarioFlags &rFlags) const;
     SC_DLLPUBLIC bool           IsActiveScenario( SCTAB nTab ) const;
     SC_DLLPUBLIC void           SetActiveScenario( SCTAB nTab, bool bActive );      // only for Undo etc.
     SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
@@ -1502,9 +1502,9 @@ public:
 
     void            CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario = false );
     bool            TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const;
-    void            MarkScenario( SCTAB nSrcTab, SCTAB nDestTab,
-                                    ScMarkData& rDestMark, bool bResetMark = true,
-                                    sal_uInt16 nNeededBits = 0 ) const;
+    void            MarkScenario(SCTAB nSrcTab, SCTAB nDestTab,
+                                ScMarkData& rDestMark, bool bResetMark = true,
+                                ScScenarioFlags nNeededBits = ScScenarioFlags::NONE) const;
     bool            HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const;
     SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const;
 
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 4af5cf1..073d2ab2 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -206,14 +206,20 @@ enum class ScEnterMode {
                                         //  step = 10pt, max. indention = 100 steps
 #define SC_INDENT_STEP      200
 
-                                        //  scenario flags
-#define SC_SCENARIO_COPYALL     1
-#define SC_SCENARIO_SHOWFRAME   2
-#define SC_SCENARIO_PRINTFRAME  4
-#define SC_SCENARIO_TWOWAY      8
-#define SC_SCENARIO_ATTRIB      16
-#define SC_SCENARIO_VALUE       32
-#define SC_SCENARIO_PROTECT     64
+enum class ScScenarioFlags{             //  scenario flags
+    NONE       = 0,
+    CopyAll    = 1,
+    ShowFrame  = 2,
+    PrintFrame = 4,
+    TwoWay     = 8,
+    Attrib     = 16,
+    Value      = 32,
+    Protected  = 64
+};
+namespace o3tl
+{
+    template<> struct typed_flags<ScScenarioFlags> : is_typed_flags<ScScenarioFlags, 127> {};
+}
 
 #define SUBTOTAL_IGN_NESTED_ST_AG  0x08
 #define SUBTOTAL_IGN_ERR_VAL       0x04
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 8c6c6c5..76e4387 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -275,10 +275,10 @@ class AbstractScNewScenarioDlg : public VclAbstractDialog
 public:
 
     virtual void SetScenarioData( const OUString& rName, const OUString& rComment,
-                            const Color& rColor, sal_uInt16 nFlags ) = 0;
+                            const Color& rColor, ScScenarioFlags nFlags ) = 0;
 
     virtual void GetScenarioData( OUString& rName, OUString& rComment,
-                            Color& rColor, sal_uInt16& rFlags ) const = 0;
+                            Color& rColor, ScScenarioFlags& rFlags ) const = 0;
 };
 
 class AbstractScShowTabDlg : public VclAbstractDialog
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0450f6b..bd63446 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -184,7 +184,7 @@ private:
     ScRangeList*    pScenarioRanges;
     Color           aScenarioColor;
     Color           aTabBgColor;
-    sal_uInt16          nScenarioFlags;
+    ScScenarioFlags nScenarioFlags;
     ScDBData*       pDBDataNoName;
     mutable ScRangeName* mpRangeName;
 
@@ -279,8 +279,8 @@ public:
     void         SetScenarioColor(const Color& rNew)         { aScenarioColor = rNew; }
     const Color& GetTabBgColor() const                       { return aTabBgColor; }
     void         SetTabBgColor(const Color& rColor);
-    sal_uInt16  GetScenarioFlags() const                     { return nScenarioFlags; }
-    void        SetScenarioFlags(sal_uInt16 nNew)            { nScenarioFlags = nNew; }
+    ScScenarioFlags GetScenarioFlags() const                 { return nScenarioFlags; }
+    void        SetScenarioFlags(ScScenarioFlags nNew)       { nScenarioFlags = nNew; }
     void        SetActiveScenario(bool bSet)                 { bActiveScenario = bSet; }
     bool        IsActiveScenario() const                     { return bActiveScenario; }
 
@@ -475,7 +475,7 @@ public:
     void        CopyScenarioFrom( const ScTable* pSrcTab );
     void        CopyScenarioTo( ScTable* pDestTab ) const;
     bool        TestCopyScenarioTo( const ScTable* pDestTab ) const;
-    void        MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
+    void        MarkScenarioIn(ScMarkData& rMark, ScScenarioFlags nNeededBits) const;
     bool        HasScenarioRange( const ScRange& rRange ) const;
     void        InvalidateScenarioRanges();
     const ScRangeList* GetScenarioRanges() const;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index e9f7111..374561c 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -418,7 +418,7 @@ bool ScDocument::IsScenario( SCTAB nTab ) const
 }
 
 void ScDocument::SetScenarioData( SCTAB nTab, const OUString& rComment,
-                                        const Color& rColor, sal_uInt16 nFlags )
+                                        const Color& rColor, ScScenarioFlags nFlags )
 {
     if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] && maTabs[nTab]->IsScenario())
     {
@@ -449,7 +449,7 @@ bool ScDocument::IsDefaultTabBgColor( SCTAB nTab ) const
 }
 
 void ScDocument::GetScenarioData( SCTAB nTab, OUString& rComment,
-                                        Color& rColor, sal_uInt16& rFlags ) const
+                                        Color& rColor, ScScenarioFlags& rFlags ) const
 {
     if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] && maTabs[nTab]->IsScenario())
     {
@@ -459,7 +459,7 @@ void ScDocument::GetScenarioData( SCTAB nTab, OUString& rComment,
     }
 }
 
-void ScDocument::GetScenarioFlags( SCTAB nTab, sal_uInt16& rFlags ) const
+void ScDocument::GetScenarioFlags( SCTAB nTab, ScScenarioFlags& rFlags ) const
 {
     if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] && maTabs[nTab]->IsScenario())
         rFlags = maTabs[nTab]->GetScenarioFlags();
@@ -813,7 +813,7 @@ void ScDocument::CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario
                 if (bTouched)
                 {
                     maTabs[nTab]->SetActiveScenario(false);
-                    if ( maTabs[nTab]->GetScenarioFlags() & SC_SCENARIO_TWOWAY )
+                    if ( maTabs[nTab]->GetScenarioFlags() & ScScenarioFlags::TwoWay )
                         maTabs[nTab]->CopyScenarioFrom( maTabs[nDestTab] );
                 }
             }
@@ -832,7 +832,7 @@ void ScDocument::CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario
 }
 
 void ScDocument::MarkScenario( SCTAB nSrcTab, SCTAB nDestTab, ScMarkData& rDestMark,
-                                bool bResetMark, sal_uInt16 nNeededBits ) const
+                                bool bResetMark, ScScenarioFlags nNeededBits ) const
 {
     if (bResetMark)
         rDestMark.ResetMark();
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 0eb5b19..0d21592 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -260,7 +260,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
     pScenarioRanges( nullptr ),
     aScenarioColor( COL_LIGHTGRAY ),
     aTabBgColor( COL_AUTO ),
-    nScenarioFlags( 0 ),
+    nScenarioFlags(ScScenarioFlags::NONE),
     pDBDataNoName(nullptr),
     mpRangeName(nullptr),
     mpCondFormatList( new ScConditionalFormatList() ),
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 1f9ac65..ef1a0ce 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1289,7 +1289,7 @@ void ScTable::CopyScenarioFrom( const ScTable* pSrcTab )
         aCol[i].CopyScenarioFrom( pSrcTab->aCol[i] );
 }
 
-void ScTable::MarkScenarioIn( ScMarkData& rDestMark, sal_uInt16 nNeededBits ) const
+void ScTable::MarkScenarioIn( ScMarkData& rDestMark, ScScenarioFlags nNeededBits ) const
 {
     OSL_ENSURE( bScenario, "bScenario == FALSE" );
 
@@ -1337,7 +1337,7 @@ const ScRangeList* ScTable::GetScenarioRanges() const
     {
         const_cast<ScTable*>(this)->pScenarioRanges = new ScRangeList;
         ScMarkData aMark;
-        MarkScenarioIn( aMark, 0 );     // always
+        MarkScenarioIn( aMark, ScScenarioFlags::NONE );     // always
         aMark.FillRangeListWithMarks( pScenarioRanges, false );
     }
     return pScenarioRanges;
@@ -2239,9 +2239,9 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
                 ScRange aEditRange(nCol1, nRow1, nScenTab, nCol2, nRow2, nScenTab);
                 if(pDocument->IsActiveScenario(nScenTab) && pDocument->HasScenarioRange(nScenTab, aEditRange))
                 {
-                    sal_uInt16 nFlags;
+                    ScScenarioFlags nFlags;
                     pDocument->GetScenarioFlags(nScenTab,nFlags);
-                    bIsEditable = !((nFlags & SC_SCENARIO_PROTECT) && (nFlags & SC_SCENARIO_TWOWAY));
+                    bIsEditable = !((nFlags & ScScenarioFlags::Protected) && (nFlags & ScScenarioFlags::TwoWay));
                     break;
                 }
                 nScenTab++;
@@ -2263,9 +2263,9 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
             ScRange aEditRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab);
             if(pDocument->HasScenarioRange(nTab, aEditRange))
             {
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 pDocument->GetScenarioFlags(nTab,nFlags);
-                bIsEditable = !(nFlags & SC_SCENARIO_PROTECT);
+                bIsEditable = !(nFlags & ScScenarioFlags::Protected);
             }
         }
     }
@@ -2317,9 +2317,9 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
                         ScRange aRange = *aRanges[ i ];
                         if(pDocument->HasScenarioRange(nScenTab, aRange))
                         {
-                            sal_uInt16 nFlags;
+                            ScScenarioFlags nFlags;
                             pDocument->GetScenarioFlags(nScenTab,nFlags);
-                            bIsEditable = !((nFlags & SC_SCENARIO_PROTECT) && (nFlags & SC_SCENARIO_TWOWAY));
+                            bIsEditable = !((nFlags & ScScenarioFlags::Protected) && (nFlags & ScScenarioFlags::TwoWay));
                         }
                     }
                 }
@@ -2346,9 +2346,9 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
                 ScRange aRange = *aRanges[ i ];
                 if(pDocument->HasScenarioRange(nTab, aRange))
                 {
-                    sal_uInt16 nFlags;
+                    ScScenarioFlags nFlags;
                     pDocument->GetScenarioFlags(nTab,nFlags);
-                    bIsEditable = !(nFlags & SC_SCENARIO_PROTECT);
+                    bIsEditable = !(nFlags & ScScenarioFlags::Protected);
                 }
             }
         }
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index d4876fe..2fd9e6d 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -229,7 +229,10 @@ void ExcScenario::Apply( const XclImpRoot& rRoot, const bool bLast )
 
     r.SetScenario( nNewTab, true );
     // do not show scenario frames
-    r.SetScenarioData( nNewTab, aComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) );
+    const ScScenarioFlags nFlags = ScScenarioFlags::CopyAll
+                                 | (nProtected ? ScScenarioFlags::Protected : ScScenarioFlags::NONE);
+                              /* | ScScenarioFlags::ShowFrame*/
+    r.SetScenarioData( nNewTab, aComment, COL_LIGHTGRAY, nFlags);
 
     std::vector<ExcScenarioCell>::const_iterator iter;
     for (iter = aEntries.begin(); iter != aEntries.end(); ++iter)
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 0366626..daac9e2 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1330,7 +1330,7 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
     OUString  sTmpComm;
     OUString aTmp;
     Color   aDummyCol;
-    sal_uInt16  nFlags;
+    ScScenarioFlags nFlags;
 
     ScDocument& rDoc = rRoot.GetDoc();
     rDoc.GetName(nTab, aTmp);
@@ -1343,7 +1343,7 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
     sComment.Assign( sTmpComm, EXC_STR_DEFAULT, 255 );
     if( sComment.Len() )
         nRecLen += sComment.GetSize();
-    bProtected = (nFlags & SC_SCENARIO_PROTECT);
+    bProtected = (nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE;
 
     sUserName.Assign( rRoot.GetUserName(), EXC_STR_DEFAULT, 255 );
     nRecLen += sUserName.GetSize();
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 5a11935..12e68ad 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3905,20 +3905,20 @@ void ScXMLExport::WriteScenario()
     {
         OUString sComment;
         Color       aColor;
-        sal_uInt16  nFlags;
+        ScScenarioFlags nFlags;
         pDoc->GetScenarioData(static_cast<SCTAB>(nCurrentTable), sComment, aColor, nFlags);
-        if (!(nFlags & SC_SCENARIO_SHOWFRAME))
+        if (!(nFlags & ScScenarioFlags::ShowFrame))
             AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_BORDER, XML_FALSE);
         OUStringBuffer aBuffer;
         ::sax::Converter::convertColor(aBuffer, aColor.GetColor());
         AddAttribute(XML_NAMESPACE_TABLE, XML_BORDER_COLOR, aBuffer.makeStringAndClear());
-        if (!(nFlags & SC_SCENARIO_TWOWAY))
+        if (!(nFlags & ScScenarioFlags::TwoWay))
             AddAttribute(XML_NAMESPACE_TABLE, XML_COPY_BACK, XML_FALSE);
-        if (!(nFlags & SC_SCENARIO_ATTRIB))
+        if (!(nFlags & ScScenarioFlags::Attrib))
             AddAttribute(XML_NAMESPACE_TABLE, XML_COPY_STYLES, XML_FALSE);
-        if (nFlags & SC_SCENARIO_VALUE)
+        if (nFlags & ScScenarioFlags::Value)
             AddAttribute(XML_NAMESPACE_TABLE, XML_COPY_FORMULAS, XML_FALSE);
-        if (nFlags & SC_SCENARIO_PROTECT)
+        if (nFlags & ScScenarioFlags::Protected)
             AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE);
         ::sax::Converter::convertBool(aBuffer,
                 pDoc->IsActiveScenario(static_cast<SCTAB>(nCurrentTable)));
diff --git a/sc/source/filter/xml/xmlsceni.cxx b/sc/source/filter/xml/xmlsceni.cxx
index 6259b93..4fab801 100644
--- a/sc/source/filter/xml/xmlsceni.cxx
+++ b/sc/source/filter/xml/xmlsceni.cxx
@@ -133,17 +133,17 @@ void ScXMLTableScenarioContext::EndElement()
     if (pDoc)
     {
         pDoc->SetScenario( nCurrTable, true );
-        sal_uInt16 nFlags( 0 );
+        ScScenarioFlags nFlags( ScScenarioFlags::NONE );
         if( bDisplayBorder )
-            nFlags |= SC_SCENARIO_SHOWFRAME;
+            nFlags |= ScScenarioFlags::ShowFrame;
         if( bCopyBack )
-            nFlags |= SC_SCENARIO_TWOWAY;
+            nFlags |= ScScenarioFlags::TwoWay;
         if( bCopyStyles )
-            nFlags |= SC_SCENARIO_ATTRIB;
+            nFlags |= ScScenarioFlags::Attrib;
         if( !bCopyFormulas )
-            nFlags |= SC_SCENARIO_VALUE;
+            nFlags |= ScScenarioFlags::Value;
         if( bProtected )
-            nFlags |= SC_SCENARIO_PROTECT;
+            nFlags |= ScScenarioFlags::Protected;
         pDoc->SetScenarioData( nCurrTable, OUString( sComment ), aBorderColor, nFlags );
         for( size_t i = 0; i < aScenarioRanges.size(); ++i )
         {
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 4e55196..460a1f7 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -602,7 +602,7 @@ bool ScAccessibleCell::IsDropdown()
             SCTAB i;
             ScMarkData aMarks;
             for (i=nTab+1; i<nTabCount && mpDoc->IsScenario(i); i++)
-                mpDoc->MarkScenario( i, nTab, aMarks, false, SC_SCENARIO_SHOWFRAME );
+                mpDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
             ScRangeList aRanges;
             aMarks.FillRangeListWithMarks( &aRanges, false );
             bool bHasScenario;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index af6b1cd..ae79ff7 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -528,13 +528,13 @@ OUString AbstractScDPShowDetailDlg_Impl::GetDimensionName() const
 }
 
 void AbstractScNewScenarioDlg_Impl::SetScenarioData(
-    const OUString& rName, const OUString& rComment, const Color& rColor, sal_uInt16 nFlags )
+    const OUString& rName, const OUString& rComment, const Color& rColor, ScScenarioFlags nFlags )
 {
     pDlg->SetScenarioData(rName, rComment, rColor, nFlags);
 }
 
 void AbstractScNewScenarioDlg_Impl::GetScenarioData(
-    OUString& rName, OUString& rComment, Color& rColor, sal_uInt16& rFlags ) const
+    OUString& rName, OUString& rComment, Color& rColor, ScScenarioFlags& rFlags ) const
 {
     pDlg->GetScenarioData(rName, rComment, rColor, rFlags);
 }
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 95294ae..90d73cd 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -321,10 +321,10 @@ class AbstractScNewScenarioDlg_Impl : public AbstractScNewScenarioDlg
 {
     DECL_ABSTDLG_BASE( AbstractScNewScenarioDlg_Impl, ScNewScenarioDlg )
     virtual void SetScenarioData( const OUString& rName, const OUString& rComment,
-                            const Color& rColor, sal_uInt16 nFlags ) override;
+                            const Color& rColor, ScScenarioFlags nFlags ) override;
 
     virtual void GetScenarioData( OUString& rName, OUString& rComment,
-                            Color& rColor, sal_uInt16& rFlags ) const override;
+                            Color& rColor, ScScenarioFlags& rFlags ) const override;
 };
 
 class AbstractScShowTabDlg_Impl : public AbstractScShowTabDlg
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index fe3514d..6d40b20 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -127,7 +127,7 @@ void ScNewScenarioDlg::dispose()
 }
 
 void ScNewScenarioDlg::GetScenarioData( OUString& rName, OUString& rComment,
-                                        Color& rColor, sal_uInt16& rFlags ) const
+                                        Color& rColor, ScScenarioFlags& rFlags ) const
 {
     rComment = m_pEdComment->GetText();
     rName    = m_pEdName->GetText();
@@ -136,30 +136,30 @@ void ScNewScenarioDlg::GetScenarioData( OUString& rName, OUString& rComment,
         rName = aDefScenarioName;
 
     rColor = m_pLbColor->GetSelectEntryColor();
-    sal_uInt16 nBits = 0;
+    ScScenarioFlags nBits = ScScenarioFlags::NONE;
     if (m_pCbShowFrame->IsChecked())
-        nBits |= SC_SCENARIO_SHOWFRAME;
+        nBits |= ScScenarioFlags::ShowFrame;
     if (m_pCbTwoWay->IsChecked())
-        nBits |= SC_SCENARIO_TWOWAY;
+        nBits |= ScScenarioFlags::TwoWay;
     if (m_pCbCopyAll->IsChecked())
-        nBits |= SC_SCENARIO_COPYALL;
+        nBits |= ScScenarioFlags::CopyAll;
     if (m_pCbProtect->IsChecked())
-        nBits |= SC_SCENARIO_PROTECT;
+        nBits |= ScScenarioFlags::Protected;
     rFlags = nBits;
 }
 
-void ScNewScenarioDlg::SetScenarioData( const OUString& rName, const OUString& rComment,
-                                        const Color& rColor, sal_uInt16 nFlags )
+void ScNewScenarioDlg::SetScenarioData(const OUString& rName, const OUString& rComment,
+                                        const Color& rColor, ScScenarioFlags nFlags)
 {
     m_pEdComment->SetText(rComment);
     m_pEdName->SetText(rName);
     m_pLbColor->SelectEntry(rColor);
 
-    m_pCbShowFrame->Check ( (nFlags & SC_SCENARIO_SHOWFRAME)  != 0 );
+    m_pCbShowFrame->Check ( (nFlags & ScScenarioFlags::ShowFrame) != ScScenarioFlags::NONE );
     EnableHdl(m_pCbShowFrame);
-    m_pCbTwoWay->Check    ( (nFlags & SC_SCENARIO_TWOWAY)     != 0 );
+    m_pCbTwoWay->Check    ( (nFlags & ScScenarioFlags::TwoWay)    != ScScenarioFlags::NONE );
     //  CopyAll nicht
-    m_pCbProtect->Check    ( (nFlags & SC_SCENARIO_PROTECT)     != 0 );
+    m_pCbProtect->Check   ( (nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE );
 }
 
 IMPL_LINK_NOARG_TYPED(ScNewScenarioDlg, OkHdl, Button*, void)
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 6f923ba..97ab8fe 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3095,7 +3095,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
             pUndoDoc->SetScenario( nTab, true );
             OUString aComment;
             Color  aColor;
-            sal_uInt16 nScenFlags;
+            ScScenarioFlags nScenFlags;
             rDoc.GetScenarioData( nTab, aComment, aColor, nScenFlags );
             pUndoDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
             bool bActive = rDoc.IsActiveScenario( nTab );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index cc1e338..0b611f9 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -844,7 +844,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                             {
                                 OUString aComment;
                                 Color aColor;
-                                sal_uInt16 nFlags;
+                                ScScenarioFlags nFlags;
                                 aDocument.GetScenarioData( nTab, aComment, aColor, nFlags );
 
                                 // Determine if the Sheet that the Scenario was created on
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 84760f5..a438bda 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -686,13 +686,13 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
                         pUndoDoc->SetScenario( i, true );
                         OUString aComment;
                         Color  aColor;
-                        sal_uInt16 nScenFlags;
+                        ScScenarioFlags nScenFlags;
                         aDocument.GetScenarioData( i, aComment, aColor, nScenFlags );
                         pUndoDoc->SetScenarioData( i, aComment, aColor, nScenFlags );
                         bool bActive = aDocument.IsActiveScenario( i );
                         pUndoDoc->SetActiveScenario( i, bActive );
                         //  Bei Zurueckkopier-Szenarios auch Inhalte
-                        if ( nScenFlags & SC_SCENARIO_TWOWAY )
+                        if ( nScenFlags & ScScenarioFlags::TwoWay )
                             aDocument.CopyToDocument( 0,0,i, MAXCOL,MAXROW,i,
                                                         InsertDeleteFlags::ALL,false, pUndoDoc );
                     }
@@ -735,19 +735,19 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
 }
 
 void ScDocShell::ModifyScenario( SCTAB nTab, const OUString& rName, const OUString& rComment,
-                                    const Color& rColor, sal_uInt16 nFlags )
+                                    const Color& rColor, ScScenarioFlags nFlags )
 {
     //  Undo
     OUString aOldName;
     aDocument.GetName( nTab, aOldName );
     OUString aOldComment;
     Color aOldColor;
-    sal_uInt16 nOldFlags;
+    ScScenarioFlags nOldFlags;
     aDocument.GetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
     GetUndoManager()->AddUndoAction(
-        new ScUndoScenarioFlags( this, nTab,
+        new ScUndoScenarioFlags(this, nTab,
                 aOldName, rName, aOldComment, rComment,
-                aOldColor, rColor, nOldFlags, nFlags ) );
+                aOldColor, rColor, nOldFlags, nFlags) );
 
     //  ausfuehren
     ScDocShellModificator aModificator( *this );
@@ -765,7 +765,7 @@ void ScDocShell::ModifyScenario( SCTAB nTab, const OUString& rName, const OUStri
 }
 
 SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUString& rComment,
-                                    const Color& rColor, sal_uInt16 nFlags,
+                                    const Color& rColor, ScScenarioFlags nFlags,
                                     ScMarkData& rMark, bool bRecord )
 {
     rMark.MarkToMulti();
@@ -775,7 +775,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin
         while (aDocument.IsScenario(nNewTab))
             ++nNewTab;
 
-        bool bCopyAll = ( (nFlags & SC_SCENARIO_COPYALL) != 0 );
+        bool bCopyAll = ( (nFlags & ScScenarioFlags::CopyAll) != ScScenarioFlags::NONE );
         const ScMarkData* pCopyMark = nullptr;
         if (!bCopyAll)
             pCopyMark = &rMark;
@@ -818,7 +818,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin
             //  dies ist dann das aktive Szenario
             aDocument.CopyScenario( nNewTab, nTab, true );  // sal_True - nicht aus Szenario kopieren
 
-            if (nFlags & SC_SCENARIO_SHOWFRAME)
+            if (nFlags & ScScenarioFlags::ShowFrame)
                 PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );  // Rahmen painten
             PostPaintExtras();                                          // Tabellenreiter
             aModificator.SetDocumentModified();
@@ -854,7 +854,7 @@ sal_uLong ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
     {
         OUString aComment;
         Color  aColor;
-        sal_uInt16 nFlags;
+        ScScenarioFlags nFlags;
 
         rSrcDoc.GetScenarioData( nSrcPos, aComment,aColor, nFlags);
         aDocument.SetScenario(nDestPos,true);
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 7cb00e4..2f09dde 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -278,11 +278,11 @@ public:
     void            RefreshPivotTables( const ScRange& rSource );
     void            DoConsolidate( const ScConsolidateParam& rParam, bool bRecord = true );
     void            UseScenario( SCTAB nTab, const OUString& rName, bool bRecord = true );
-    SCTAB           MakeScenario( SCTAB nTab, const OUString& rName, const OUString& rComment,
-                                    const Color& rColor, sal_uInt16 nFlags,
-                                    ScMarkData& rMark, bool bRecord = true );
-    void            ModifyScenario( SCTAB nTab, const OUString& rName, const OUString& rComment,
-                                    const Color& rColor, sal_uInt16 nFlags );
+    SCTAB           MakeScenario(SCTAB nTab, const OUString& rName, const OUString& rComment,
+                                    const Color& rColor, ScScenarioFlags nFlags,
+                                    ScMarkData& rMark, bool bRecord = true);
+    void            ModifyScenario(SCTAB nTab, const OUString& rName, const OUString& rComment,
+                                    const Color& rColor, ScScenarioFlags nFlags);
     sal_uLong TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
                                 SCTAB nDestPos, bool bInsertNew,
                                 bool bNotifyAndPaint );
diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx
index 15a9f2c..8726cf5 100644
--- a/sc/source/ui/inc/scendlg.hxx
+++ b/sc/source/ui/inc/scendlg.hxx
@@ -27,6 +27,8 @@
 #include <svtools/svmedit.hxx>
 #include <svtools/ctrlbox.hxx>
 
+enum class ScScenarioFlags;
+
 class ScNewScenarioDlg : public ModalDialog
 {
 public:
@@ -34,10 +36,10 @@ public:
     virtual ~ScNewScenarioDlg();
     virtual void dispose() override;
     void SetScenarioData( const OUString& rName, const OUString& rComment,
-                          const Color& rColor, sal_uInt16 nFlags );
+                          const Color& rColor, ScScenarioFlags nFlags );
 
-    void GetScenarioData( OUString& rName, OUString& rComment,
-                          Color& rColor, sal_uInt16& rFlags ) const;
+    void GetScenarioData(OUString& rName, OUString& rComment,
+                          Color& rColor, ScScenarioFlags &rFlags) const;
 
 private:
     VclPtr<Edit>               m_pEdName;
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
index 455689f..70a420e 100644
--- a/sc/source/ui/inc/undotab.hxx
+++ b/sc/source/ui/inc/undotab.hxx
@@ -231,7 +231,7 @@ public:
                             ScDocShell* pNewDocShell,
                             SCTAB nSrc, SCTAB nDest,
                             const OUString& rN, const OUString& rC,
-                            const Color& rCol, sal_uInt16 nF,
+                            const Color& rCol, ScScenarioFlags nF,
                             const ScMarkData& rMark );
     virtual         ~ScUndoMakeScenario();
 
@@ -249,7 +249,7 @@ private:
     OUString    aName;
     OUString    aComment;
     Color       aColor;
-    sal_uInt16      nFlags;
+    ScScenarioFlags nFlags;
     SdrUndoAction* pDrawUndo;
 };
 
@@ -402,7 +402,7 @@ public:
                             const OUString& rON, const OUString& rNN,
                             const OUString& rOC, const OUString& rNC,
                             const Color& rOCol, const Color& rNCol,
-                            sal_uInt16 nOF, sal_uInt16 nNF );
+                            ScScenarioFlags nOF, ScScenarioFlags nNF);
 
     virtual         ~ScUndoScenarioFlags();
 
@@ -421,8 +421,8 @@ private:
     OUString    aNewComment;
     Color       aOldColor;
     Color       aNewColor;
-    sal_uInt16  nOldFlags;
-    sal_uInt16  nNewFlags;
+    ScScenarioFlags nOldFlags;
+    ScScenarioFlags nNewFlags;
 };
 
 class ScUndoRenameObject: public ScSimpleUndo
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0b74142..d270886 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -270,8 +270,8 @@ public:
     void            ShowTable( const std::vector<OUString>& rNames );
     void            HideTable( const ScMarkData& rMark );
 
-    void            MakeScenario( const OUString& rName, const OUString& rComment,
-                                    const Color& rColor, sal_uInt16 nFlags );
+    void            MakeScenario(const OUString& rName, const OUString& rComment,
+                                 const Color& rColor, ScScenarioFlags nFlags);
     void            ExtendScenario();
     void            UseScenario( const OUString& rName );
 
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 97d7e6f..fe6a3bc 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1594,18 +1594,18 @@ void ScUndoUseScenario::Undo()
         // Flags always
         OUString aComment;
         Color  aColor;
-        sal_uInt16 nScenFlags;
+        ScScenarioFlags nScenFlags;
         pUndoDoc->GetScenarioData( i, aComment, aColor, nScenFlags );
         rDoc.SetScenarioData( i, aComment, aColor, nScenFlags );
         bool bActive = pUndoDoc->IsActiveScenario( i );
         rDoc.SetActiveScenario( i, bActive );
         //  For copy-back scenario also consider content
-        if ( nScenFlags & SC_SCENARIO_TWOWAY )
+        if ( nScenFlags & ScScenarioFlags::TwoWay )
         {
             rDoc.DeleteAreaTab( 0,0, MAXCOL,MAXROW, i, InsertDeleteFlags::ALL );
             pUndoDoc->CopyToDocument( 0,0,i, MAXCOL,MAXROW,i, InsertDeleteFlags::ALL,false, &rDoc );
         }
-        if ( nScenFlags & SC_SCENARIO_SHOWFRAME )
+        if ( nScenFlags & ScScenarioFlags::ShowFrame )
             bFrame = true;
     }
 
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 877d38d..216070b 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -331,7 +331,7 @@ void ScUndoDeleteTab::Undo()
                 rDoc.SetScenario( nTab, true );
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nScenFlags;
+                ScScenarioFlags nScenFlags;
                 pRefUndoDoc->GetScenarioData( nTab, aComment, aColor, nScenFlags );
                 rDoc.SetScenarioData( nTab, aComment, aColor, nScenFlags );
                 bool bActive = pRefUndoDoc->IsActiveScenario( nTab );
@@ -670,7 +670,7 @@ void ScUndoCopyTab::Redo()
             rDoc.SetScenario(nNewTab, true );
             OUString aComment;
             Color  aColor;
-            sal_uInt16 nScenFlags;
+            ScScenarioFlags nScenFlags;
             rDoc.GetScenarioData(nAdjSource, aComment, aColor, nScenFlags );
             rDoc.SetScenarioData(nNewTab, aComment, aColor, nScenFlags );
             bool bActive = rDoc.IsActiveScenario(nAdjSource);
@@ -776,7 +776,7 @@ bool ScUndoTabColor::CanRepeat(SfxRepeatTarget& /* rTarget */) const
 ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
                         SCTAB nSrc, SCTAB nDest,
                         const OUString& rN, const OUString& rC,
-                        const Color& rCol, sal_uInt16 nF,
+                        const Color& rCol, ScScenarioFlags nF,
                         const ScMarkData& rMark ) :
     ScSimpleUndo( pNewDocShell ),
     mpMarkData(new ScMarkData(rMark)),
@@ -931,7 +931,7 @@ void ScUndoImportTab::Undo()
                 pRedoDoc->SetScenario(nTabPos, true );
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nScenFlags;
+                ScScenarioFlags nScenFlags;
                 rDoc.GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
                 pRedoDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
                 bool bActive = rDoc.IsActiveScenario(nTabPos);
@@ -986,7 +986,7 @@ void ScUndoImportTab::Redo()
             rDoc.SetScenario(nTabPos, true );
             OUString aComment;
             Color  aColor;
-            sal_uInt16 nScenFlags;
+            ScScenarioFlags nScenFlags;
             pRedoDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
             rDoc.SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
             bool bActive = pRedoDoc->IsActiveScenario(nTabPos);
@@ -1361,9 +1361,9 @@ OUString ScUndoPrintRange::GetComment() const
     return ScGlobal::GetRscString( STR_UNDO_PRINTRANGES );
 }
 
-ScUndoScenarioFlags::ScUndoScenarioFlags( ScDocShell* pNewDocShell, SCTAB nT,
+ScUndoScenarioFlags::ScUndoScenarioFlags(ScDocShell* pNewDocShell, SCTAB nT,
                     const OUString& rON, const OUString& rNN, const OUString& rOC, const OUString& rNC,
-                    const Color& rOCol, const Color& rNCol, sal_uInt16 nOF, sal_uInt16 nNF ) :
+                    const Color& rOCol, const Color& rNCol, ScScenarioFlags nOF, ScScenarioFlags nNF) :
     ScSimpleUndo( pNewDocShell ),
     nTab        ( nT ),
     aOldName    ( rON ),
@@ -1372,8 +1372,8 @@ ScUndoScenarioFlags::ScUndoScenarioFlags( ScDocShell* pNewDocShell, SCTAB nT,
     aNewComment ( rNC ),
     aOldColor   ( rOCol ),
     aNewColor   ( rNCol ),
-    nOldFlags   ( nOF ),
-    nNewFlags   ( nNF )
+    nOldFlags   (nOF),
+    nNewFlags   (nNF)
 {
 }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 3801f5b..76a64ec 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7947,7 +7947,7 @@ OUString SAL_CALL ScTableSheetObj::getScenarioComment() throw(uno::RuntimeExcept
     {
         OUString aComment;
         Color  aColor;
-        sal_uInt16 nFlags;
+        ScScenarioFlags nFlags;
         pDocSh->GetDocument().GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
         return aComment;
     }
@@ -7967,7 +7967,7 @@ void SAL_CALL ScTableSheetObj::setScenarioComment( const OUString& aScenarioComm
         OUString aName;
         OUString aComment;
         Color  aColor;
-        sal_uInt16 nFlags;
+        ScScenarioFlags nFlags;
         rDoc.GetName( nTab, aName );
         rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
@@ -8184,7 +8184,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                     OUString aName;
                     OUString aComment;
                     Color  aColor;
-                    sal_uInt16 nFlags;
+                    ScScenarioFlags nFlags;
                     rDoc.GetName( nTab, aName );
                     rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
@@ -8201,24 +8201,24 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 OUString aName;
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetName( nTab, aName );
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
                 bool bModify(false);
 
                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
                 {
-                    if (!(nFlags & SC_SCENARIO_PROTECT))
+                    if (!(nFlags & ScScenarioFlags::Protected))
                     {
-                        nFlags |= SC_SCENARIO_PROTECT;
+                        nFlags |= ScScenarioFlags::Protected;
                         bModify = true;
                     }
                 }
                 else
                 {
-                    if (nFlags & SC_SCENARIO_PROTECT)
+                    if (nFlags & ScScenarioFlags::Protected)
                     {
-                        nFlags -= SC_SCENARIO_PROTECT;
+                        nFlags &= ~ScScenarioFlags::Protected;
                         bModify = true;
                     }
                 }
@@ -8234,24 +8234,24 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 OUString aName;
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetName( nTab, aName );
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
                 bool bModify(false);
 
                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
                 {
-                    if (!(nFlags & SC_SCENARIO_SHOWFRAME))
+                    if (!(nFlags & ScScenarioFlags::ShowFrame))
                     {
-                        nFlags |= SC_SCENARIO_SHOWFRAME;
+                        nFlags |= ScScenarioFlags::ShowFrame;
                         bModify = true;
                     }
                 }
                 else
                 {
-                    if (nFlags & SC_SCENARIO_SHOWFRAME)
+                    if (nFlags & ScScenarioFlags::ShowFrame)
                     {
-                        nFlags -= SC_SCENARIO_SHOWFRAME;
+                        nFlags &= ~ScScenarioFlags::ShowFrame;
                         bModify = true;
                     }
                 }
@@ -8267,24 +8267,24 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 OUString aName;
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetName( nTab, aName );
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
                 bool bModify(false);
 
                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
                 {
-                    if (!(nFlags & SC_SCENARIO_PRINTFRAME))
+                    if (!(nFlags & ScScenarioFlags::PrintFrame))
                     {
-                        nFlags |= SC_SCENARIO_PRINTFRAME;
+                        nFlags |= ScScenarioFlags::PrintFrame;
                         bModify = true;
                     }
                 }
                 else
                 {
-                    if (nFlags & SC_SCENARIO_PRINTFRAME)
+                    if (nFlags & ScScenarioFlags::PrintFrame)
                     {
-                        nFlags -= SC_SCENARIO_PRINTFRAME;
+                        nFlags &= ~ScScenarioFlags::PrintFrame;
                         bModify = true;
                     }
                 }
@@ -8300,24 +8300,24 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 OUString aName;
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetName( nTab, aName );
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
                 bool bModify(false);
 
                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
                 {
-                    if (!(nFlags & SC_SCENARIO_TWOWAY))
+                    if (!(nFlags & ScScenarioFlags::TwoWay))
                     {
-                        nFlags |= SC_SCENARIO_TWOWAY;
+                        nFlags |= ScScenarioFlags::TwoWay;
                         bModify = true;
                     }
                 }
                 else
                 {
-                    if (nFlags & SC_SCENARIO_TWOWAY)
+                    if (nFlags & ScScenarioFlags::TwoWay)
                     {
-                        nFlags -= SC_SCENARIO_TWOWAY;
+                        nFlags &= ~ScScenarioFlags::TwoWay;
                         bModify = true;
                     }
                 }
@@ -8333,24 +8333,24 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 OUString aName;
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetName( nTab, aName );
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
                 bool bModify(false);
 
                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
                 {
-                    if (!(nFlags & SC_SCENARIO_ATTRIB))
+                    if (!(nFlags & ScScenarioFlags::Attrib))
                     {
-                        nFlags |= SC_SCENARIO_ATTRIB;
+                        nFlags |= ScScenarioFlags::Attrib;
                         bModify = true;
                     }
                 }
                 else
                 {
-                    if (nFlags & SC_SCENARIO_ATTRIB)
+                    if (nFlags & ScScenarioFlags::Attrib)
                     {
-                        nFlags -= SC_SCENARIO_ATTRIB;
+                        nFlags &= ~ScScenarioFlags::Attrib;
                         bModify = true;
                     }
                 }
@@ -8366,24 +8366,24 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 OUString aName;
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetName( nTab, aName );
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
                 bool bModify(false);
 
                 if (ScUnoHelpFunctions::GetBoolFromAny( aValue ))
                 {
-                    if (nFlags & SC_SCENARIO_VALUE)
+                    if (nFlags & ScScenarioFlags::Value)
                     {
-                        nFlags -= SC_SCENARIO_VALUE;
+                        nFlags &= ~ScScenarioFlags::Value;
                         bModify = true;
                     }
                 }
                 else
                 {
-                    if (!(nFlags & SC_SCENARIO_VALUE))
+                    if (!(nFlags & ScScenarioFlags::Value))
                     {
-                        nFlags |= SC_SCENARIO_VALUE;
+                        nFlags |= ScScenarioFlags::Value;
                         bModify = true;
                     }
                 }
@@ -8493,7 +8493,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
                 rAny <<= static_cast<sal_Int32>(aColor.GetColor());
@@ -8505,10 +8505,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
-                rAny <<= ((nFlags & SC_SCENARIO_PROTECT) != 0);
+                rAny <<= ((nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
@@ -8517,10 +8517,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
-                rAny <<= ((nFlags & SC_SCENARIO_SHOWFRAME) != 0);
+                rAny <<= ((nFlags & ScScenarioFlags::ShowFrame) != ScScenarioFlags::NONE);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
@@ -8529,10 +8529,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
-                rAny <<= ((nFlags & SC_SCENARIO_PRINTFRAME) != 0);
+                rAny <<= ((nFlags & ScScenarioFlags::PrintFrame) != ScScenarioFlags::NONE);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
@@ -8541,10 +8541,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
-                rAny <<= ((nFlags & SC_SCENARIO_TWOWAY) != 0);
+                rAny <<= ((nFlags & ScScenarioFlags::TwoWay) != ScScenarioFlags::NONE);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
@@ -8553,10 +8553,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
-                rAny <<= ((nFlags & SC_SCENARIO_ATTRIB) != 0);
+                rAny <<= ((nFlags & ScScenarioFlags::Attrib) != ScScenarioFlags::NONE);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
@@ -8565,10 +8565,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
 
-                rAny <<= !(nFlags & SC_SCENARIO_VALUE);
+                rAny <<= !(nFlags & ScScenarioFlags::Value);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 212d701..509d22e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4320,7 +4320,8 @@ void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName,
         }
 
         Color aColor( COL_LIGHTGRAY );  // Default
-        sal_uInt16 nFlags = SC_SCENARIO_SHOWFRAME | SC_SCENARIO_PRINTFRAME | SC_SCENARIO_TWOWAY | SC_SCENARIO_PROTECT;
+        ScScenarioFlags nFlags = ScScenarioFlags::ShowFrame | ScScenarioFlags::PrintFrame
+                               | ScScenarioFlags::TwoWay    | ScScenarioFlags::Protected;
 
         pDocShell->MakeScenario( nTab, aName, aComment, aColor, nFlags, aMarkData );
     }
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 667c869..96b8262 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -839,7 +839,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
                     if ( !pDoc->IsScenario(nTab) )
                     {
                         OUString aStr;
-                        sal_uInt16 nFlags;
+                        ScScenarioFlags nFlags;
                         SCTAB nScTab = nTab + 1;
                         bool bSheetProtected = pDoc->IsTabProtected(nTab);
 
@@ -850,14 +850,14 @@ void ScCellShell::GetState(SfxItemSet &rSet)
                             pDoc->GetScenarioData( nScTab, aStr, aDummyCol, nFlags );
                             aList.push_back(aStr);
                             // Protection is sal_True if both Sheet and Scenario are protected
-                            aList.push_back((bSheetProtected && (nFlags & SC_SCENARIO_PROTECT)) ? OUString("1") : OUString("0"));
+                            aList.push_back((bSheetProtected && (nFlags & ScScenarioFlags::Protected)) ? OUString("1") : OUString("0"));
                             ++nScTab;
                         }
                     }
                     else
                     {
                         OUString aComment;
-                        sal_uInt16  nDummyFlags;
+                        ScScenarioFlags nDummyFlags;
                         pDoc->GetScenarioData( nTab, aComment, aDummyCol, nDummyFlags );
                         OSL_ENSURE( aList.empty(), "List not empty!" );
                         aList.push_back(aComment);
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 8ce210d..e8766a0 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -455,7 +455,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
                         OUString aName;
                         OUString aComment;
                         Color  aColor;
-                        sal_uInt16 nFlags;
+                        ScScenarioFlags nFlags;
 
                         OUString aTmp;
                         pDoc->GetName(nTab, aTmp);
@@ -496,7 +496,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
                                 aArgComment = static_cast<const SfxStringItem*>(pItem)->GetValue();
 
                             aColor = Color( COL_LIGHTGRAY );        // Default
-                            nFlags = 0;                             // not-TwoWay
+                            nFlags = ScScenarioFlags::NONE;         // not TwoWay
 
                             pTabViewShell->MakeScenario( aArgName, aArgComment, aColor, nFlags );
                             if( ! rReq.IsAPI() )
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2a91ffc..89837d0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5416,7 +5416,7 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang
 
         ScMarkData aMarks;
         for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++)
-            pDoc->MarkScenario( i, nTab, aMarks, false, SC_SCENARIO_SHOWFRAME );
+            pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
         ScRangeList aRanges;
         aMarks.FillRangeListWithMarks( &aRanges, false );
 
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e3531bd..83459f1 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -196,7 +196,7 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S
 
         ScMarkData aMarks;
         for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++)
-            pDoc->MarkScenario( i, nTab, aMarks, false, SC_SCENARIO_SHOWFRAME );
+            pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
         ScRangeListRef xRanges = new ScRangeList;
         aMarks.FillRangeListWithMarks( xRanges, false );
 
@@ -232,7 +232,7 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S
                     if ( pDoc->IsActiveScenario(nAct) && pDoc->HasScenarioRange(nAct,aRange) )
                     {
                         OUString aDummyComment;
-                        sal_uInt16 nDummyFlags;
+                        ScScenarioFlags nDummyFlags;
                         pDoc->GetName( nAct, aCurrent );
                         pDoc->GetScenarioData( nAct, aDummyComment, aColor, nDummyFlags );
                     }
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 1970e04..6a7a7e8 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2013,15 +2013,15 @@ void ScViewFunc::TabOp( const ScTabOpParam& rParam, bool bRecord )
 }
 
 void ScViewFunc::MakeScenario( const OUString& rName, const OUString& rComment,
-                                    const Color& rColor, sal_uInt16 nFlags )
+                                    const Color& rColor, ScScenarioFlags nFlags )
 {
     ScDocShell* pDocSh  = GetViewData().GetDocShell();
     ScMarkData& rMark   = GetViewData().GetMarkData();
     SCTAB       nTab    = GetViewData().GetTabNo();
 
     SCTAB nNewTab = pDocSh->MakeScenario( nTab, rName, rComment, rColor, nFlags, rMark );
-    if (nFlags & SC_SCENARIO_COPYALL)
-        SetTabNo( nNewTab, true );          // SC_SCENARIO_COPYALL -> visible
+    if (nFlags & ScScenarioFlags::CopyAll)
+        SetTabNo( nNewTab, true );          // ScScenarioFlags::CopyAll -> visible
     else
     {
         SfxBindings& rBindings = GetViewData().GetBindings();
@@ -2253,7 +2253,7 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord )
                 pUndoDoc->SetScenario( nTab, true );
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nScenFlags;
+                ScScenarioFlags nScenFlags;
                 rDoc.GetScenarioData( nTab, aComment, aColor, nScenFlags );
                 pUndoDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
                 bool bActive = rDoc.IsActiveScenario( nTab );
@@ -2807,7 +2807,7 @@ void ScViewFunc::MoveTable(
             {
                 OUString aComment;
                 Color  aColor;
-                sal_uInt16 nFlags;
+                ScScenarioFlags nFlags;
 
                 pDoc->GetScenarioData(nMovTab, aComment,aColor, nFlags);
                 pDoc->SetScenario(nDestTab1,true);


More information about the Libreoffice-commits mailing list