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

Noel Grandin noel at peralex.com
Mon Sep 26 07:46:04 UTC 2016


 sc/inc/global.hxx                                              |   22 +-
 sc/inc/hints.hxx                                               |   10 -
 sc/source/core/tool/chgtrack.cxx                               |    2 
 sc/source/core/tool/hints.cxx                                  |    2 
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |    2 
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx              |    2 
 sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx |    2 
 sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx |    2 
 sc/source/ui/docshell/arealink.cxx                             |    2 
 sc/source/ui/docshell/dbdocfun.cxx                             |   16 -
 sc/source/ui/docshell/dbdocimp.cxx                             |    2 
 sc/source/ui/docshell/docfunc.cxx                              |   82 +++++-----
 sc/source/ui/docshell/docsh3.cxx                               |   26 +--
 sc/source/ui/docshell/docsh4.cxx                               |    2 
 sc/source/ui/docshell/docsh5.cxx                               |   14 -
 sc/source/ui/docshell/docsh6.cxx                               |    8 
 sc/source/ui/docshell/impex.cxx                                |    2 
 sc/source/ui/docshell/olinefun.cxx                             |   30 +--
 sc/source/ui/docshell/pntlock.cxx                              |    4 
 sc/source/ui/docshell/tablink.cxx                              |    2 
 sc/source/ui/inc/docsh.hxx                                     |    4 
 sc/source/ui/inc/pntlock.hxx                                   |    6 
 sc/source/ui/miscdlgs/crnrdlg.cxx                              |    2 
 sc/source/ui/undo/undobase.cxx                                 |    6 
 sc/source/ui/undo/undoblk.cxx                                  |   80 ++++-----
 sc/source/ui/undo/undoblk2.cxx                                 |    6 
 sc/source/ui/undo/undoblk3.cxx                                 |   24 +-
 sc/source/ui/undo/undocell.cxx                                 |    2 
 sc/source/ui/undo/undoconvert.cxx                              |    2 
 sc/source/ui/undo/undodat.cxx                                  |   50 +++---
 sc/source/ui/undo/undosort.cxx                                 |    2 
 sc/source/ui/undo/undostyl.cxx                                 |    2 
 sc/source/ui/undo/undotab.cxx                                  |    8 
 sc/source/ui/undo/undoutil.cxx                                 |    2 
 sc/source/ui/unoobj/cellsuno.cxx                               |   12 -
 sc/source/ui/unoobj/confuno.cxx                                |    2 
 sc/source/ui/unoobj/datauno.cxx                                |    2 
 sc/source/ui/unoobj/defltuno.cxx                               |    2 
 sc/source/ui/unoobj/docuno.cxx                                 |    4 
 sc/source/ui/unoobj/nameuno.cxx                                |    6 
 sc/source/ui/unoobj/styleuno.cxx                               |    8 
 sc/source/ui/vba/vbaworksheet.cxx                              |    2 
 sc/source/ui/view/dbfunc.cxx                                   |    4 
 sc/source/ui/view/dbfunc3.cxx                                  |    4 
 sc/source/ui/view/gridwin.cxx                                  |   12 -
 sc/source/ui/view/prevwsh2.cxx                                 |    8 
 sc/source/ui/view/printfun.cxx                                 |    2 
 sc/source/ui/view/tabview3.cxx                                 |    2 
 sc/source/ui/view/tabvwsh5.cxx                                 |   35 ++--
 sc/source/ui/view/viewdata.cxx                                 |    2 
 sc/source/ui/view/viewfun2.cxx                                 |   24 +-
 sc/source/ui/view/viewfun3.cxx                                 |   24 +-
 sc/source/ui/view/viewfun4.cxx                                 |    2 
 sc/source/ui/view/viewfunc.cxx                                 |   24 +-
 54 files changed, 307 insertions(+), 304 deletions(-)

New commits:
commit 93160bcb2dce54bbccb5935cd0a71b52ad5e5461
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Sep 26 09:41:14 2016 +0200

    convert PAINT constants to typed_flags
    
    Change-Id: Ie0a02c87ca225ee7a8b8e76a2498836836e79c82

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index df030e7..a94b855 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -109,14 +109,20 @@ namespace sc
 
 
                                     // repaint flags (for messages)
-#define PAINT_GRID          1
-#define PAINT_TOP           2
-#define PAINT_LEFT          4
-#define PAINT_EXTRAS        8
-#define PAINT_MARKS         16
-#define PAINT_OBJECTS       32
-#define PAINT_SIZE          64
-#define PAINT_ALL           ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE )
+enum class PaintPartFlags {
+    NONE          = 0x00,
+    Grid          = 0x01,
+    Top           = 0x02,
+    Left          = 0x04,
+    Extras        = 0x08,
+    Marks         = 0x10,
+    Objects       = 0x20,
+    Size          = 0x40,
+    All           = Grid | Top | Left | Extras | Objects | Size,
+};
+namespace o3tl {
+    template<> struct typed_flags<PaintPartFlags> : is_typed_flags<PaintPartFlags, 0x07f> {};
+}
 
                                     // flags for columns / rows
 enum class CRFlags : sal_uInt8 {
diff --git a/sc/inc/hints.hxx b/sc/inc/hints.hxx
index d36e5a2..bb08e31 100644
--- a/sc/inc/hints.hxx
+++ b/sc/inc/hints.hxx
@@ -26,13 +26,13 @@
 
 class ScPaintHint : public SfxHint
 {
-    ScRange     aRange;
-    sal_uInt16  nParts;
-    bool        bPrint;     //  flag indicating whether print/preview if affected
+    ScRange         aRange;
+    PaintPartFlags  nParts;
+    bool            bPrint;     //  flag indicating whether print/preview if affected
 
 public:
                     ScPaintHint() = delete;
-                    ScPaintHint( const ScRange& rRng, sal_uInt16 nPaint = PAINT_ALL );
+                    ScPaintHint( const ScRange& rRng, PaintPartFlags nPaint = PaintPartFlags::All );
                     virtual ~ScPaintHint() override;
 
     void            SetPrintFlag(bool bSet) { bPrint = bSet; }
@@ -42,7 +42,7 @@ public:
     SCCOL           GetEndCol() const       { return aRange.aEnd.Col(); }
     SCROW           GetEndRow() const       { return aRange.aEnd.Row(); }
     SCTAB           GetEndTab() const       { return aRange.aEnd.Tab(); }
-    sal_uInt16      GetParts() const        { return nParts; }
+    PaintPartFlags  GetParts() const        { return nParts; }
     bool            GetPrintFlag() const    { return bPrint; }
 };
 
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 30a8f07..b8da399 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2267,7 +2267,7 @@ void ScChangeTrack::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uI
 
             SfxObjectShell* pDocSh = pDoc->GetDocumentShell();
             if (pDocSh)
-                pDocSh->Broadcast( ScPaintHint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB), PAINT_GRID ) );
+                pDocSh->Broadcast( ScPaintHint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB), PaintPartFlags::Grid ) );
         }
     }
 }
diff --git a/sc/source/core/tool/hints.cxx b/sc/source/core/tool/hints.cxx
index d48b735..b69fd76 100644
--- a/sc/source/core/tool/hints.cxx
+++ b/sc/source/core/tool/hints.cxx
@@ -21,7 +21,7 @@
 
 // ScPaintHint - info what has to be repainted
 
-ScPaintHint::ScPaintHint( const ScRange& rRng, sal_uInt16 nPaint ) :
+ScPaintHint::ScPaintHint( const ScRange& rRng, PaintPartFlags nPaint ) :
     aRange( rRng ),
     nParts( nPaint ),
     bPrint( true )
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index eaf10fa..7fdad4b 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -323,7 +323,7 @@ void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG& randomGenerator, const
 
     pUndoManager->LeaveListAction();
 
-    pDocShell->PostPaint( maInputRange, PAINT_GRID );
+    pDocShell->PostPaint( maInputRange, PaintPartFlags::Grid );
 }
 
 IMPL_LINK_NOARG_TYPED( ScRandomNumberGeneratorDialog, OkClicked, Button*, void )
diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 417de9e..035327d 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -285,7 +285,7 @@ void ScSamplingDialog::PerformSampling()
     }
 
     pUndoManager->LeaveListAction();
-    pDocShell->PostPaint(aModifiedRange, PAINT_GRID);
+    pDocShell->PostPaint(aModifiedRange, PaintPartFlags::Grid);
 }
 
 IMPL_LINK_NOARG_TYPED( ScSamplingDialog, OkClicked, Button*, void )
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
index 61a426a..80dd457 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
@@ -292,7 +292,7 @@ void ScStatisticsInputOutputDialog::CalculateInputAndWriteToOutput()
     ScRange aOutputRange = ApplyOutput(pDocShell);
 
     pUndoManager->LeaveListAction();
-    pDocShell->PostPaint( aOutputRange, PAINT_GRID );
+    pDocShell->PostPaint( aOutputRange, PaintPartFlags::Grid );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
index cc4334e..1277a8e 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
@@ -331,7 +331,7 @@ void ScStatisticsTwoVariableDialog::CalculateInputAndWriteToOutput()
     ScRange aOutputRange = ApplyOutput(pDocShell);
 
     pUndoManager->LeaveListAction();
-    pDocShell->PostPaint( aOutputRange, PAINT_GRID );
+    pDocShell->PostPaint( aOutputRange, PaintPartFlags::Grid );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index 006cac2..423c063 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -443,7 +443,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
         if ( !pImpl->m_pDocSh->AdjustRowHeight( aDestPos.Row(), nPaintEndY, nDestTab ) )
             pImpl->m_pDocSh->PostPaint(
                 ScRange(aDestPos.Col(), aDestPos.Row(), nDestTab, nPaintEndX, nPaintEndY, nDestTab),
-                PAINT_GRID);
+                PaintPartFlags::Grid);
         aModificator.SetDocumentModified();
     }
     else
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index ee3f8e6..2dfee90 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -265,7 +265,7 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve
     rDoc.SetDBCollection( new ScDBCollection( rNewColl ) );
     rDoc.CompileHybridFormula();
     pOldColl = nullptr;
-    rDocShell.PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID);
+    rDocShell.PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PaintPartFlags::Grid);
     aModificator.SetDocumentModified();
     SfxGetpApp()->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) );
 
@@ -450,7 +450,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed,
             }
 
             rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab),
-                                PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE);
+                                PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size);
             bDone = true;
         }
         else if (!bApi)     // "Keine Operationen auszufuehren"
@@ -585,14 +585,14 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
 
     if (bPaint)
     {
-        sal_uInt16 nPaint = PAINT_GRID;
+        PaintPartFlags nPaint = PaintPartFlags::Grid;
         SCCOL nStartX = aLocalParam.nCol1;
         SCROW nStartY = aLocalParam.nRow1;
         SCCOL nEndX = aLocalParam.nCol2;
         SCROW nEndY = aLocalParam.nRow2;
         if ( bRepeatQuery )
         {
-            nPaint |= PAINT_LEFT;
+            nPaint |= PaintPartFlags::Left;
             nStartX = 0;
             nEndX = MAXCOL;
         }
@@ -938,12 +938,12 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
             nEndY = MAXROW;
         rDocShell.PostPaint(
             ScRange(aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, nEndX, nEndY, nDestTab),
-            PAINT_GRID);
+            PaintPartFlags::Grid);
     }
     else
         rDocShell.PostPaint(
             ScRange(0, rQueryParam.nRow1, nTab, MAXCOL, MAXROW, nTab),
-            PAINT_GRID | PAINT_LEFT);
+            PaintPartFlags::Grid | PaintPartFlags::Left);
     aModificator.SetDocumentModified();
 
     return true;
@@ -1103,7 +1103,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
         rDoc.CompileDBFormula();
 
         rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL,MAXROW,nTab),
-                            PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE);
+                            PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size);
         aModificator.SetDocumentModified();
     }
 }
@@ -1345,7 +1345,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
     rDoc.GetDPCollection()->FreeTable(&rDPObj);  // object is deleted here
 
     rDocShell.PostPaintGridAll();   //! only necessary parts
-    rDocShell.PostPaint(aRange, PAINT_GRID);
+    rDocShell.PostPaint(aRange, PaintPartFlags::Grid);
 
     if (bRecord)
     {
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 7c91d1d..22f07c4 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -592,7 +592,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
 
         sc::SetFormulaDirtyContext aCxt;
         rDoc.SetAllFormulasDirty(aCxt);
-        rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
+        rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PaintPartFlags::Grid);
         aModificator.SetDocumentModified();
 
         ScDBRangeRefreshedHint aHint( rParam );
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 721084d..833f637 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -125,7 +125,7 @@ static void lcl_PaintAbove( ScDocShell& rDocShell, const ScRange& rRange )
     {
         SCTAB nTab = rRange.aStart.Tab();   //! alle?
         --nRow;
-        rDocShell.PostPaint( ScRange(0,nRow,nTab, MAXCOL,nRow,nTab), PAINT_GRID );
+        rDocShell.PostPaint( ScRange(0,nRow,nTab, MAXCOL,nRow,nTab), PaintPartFlags::Grid );
     }
 }
 
@@ -154,7 +154,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
 
     if ( bPaint && bChanged )
         rDocShell.PostPaint(ScRange(0, nStartRow, nTab, MAXCOL, MAXROW, nTab),
-                            PAINT_GRID | PAINT_LEFT);
+                            PaintPartFlags::Grid | PaintPartFlags::Left);
 
     return bChanged;
 }
@@ -634,7 +634,7 @@ bool ScDocFunc::DeleteContents(
     }
 
     if (!AdjustRowHeight( aExtendedRange ))
-        rDocShell.PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
+        rDocShell.PostPaint( aExtendedRange, PaintPartFlags::Grid, nExtFlags );
     else if (nExtFlags & SC_PF_LINES)
         lcl_PaintAbove( rDocShell, aExtendedRange );    // fuer Linien ueber dem Bereich
 
@@ -703,7 +703,7 @@ bool ScDocFunc::DeleteCell(
     if (!AdjustRowHeight(rPos))
         rDocShell.PostPaint(
             rPos.Col(), rPos.Row(), rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Tab(),
-            PAINT_GRID, nExtFlags);
+            PaintPartFlags::Grid, nExtFlags);
 
     aModificator.SetDocumentModified();
 
@@ -758,7 +758,7 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
     rDoc.TransliterateText( aMultiMark, nType );
 
     if (!AdjustRowHeight( aMarkRange ))
-        rDocShell.PostPaint( aMarkRange, PAINT_GRID );
+        rDocShell.PostPaint( aMarkRange, PaintPartFlags::Grid );
 
     aModificator.SetDocumentModified();
 
@@ -885,7 +885,7 @@ void ScDocFunc::SetValueCells( const ScAddress& rPos, const std::vector<double>&
 
     rDoc.SetValues(rPos, aVals);
 
-    rDocShell.PostPaint(aRange, PAINT_GRID);
+    rDocShell.PostPaint(aRange, PaintPartFlags::Grid);
     aModificator.SetDocumentModified();
 
     // #103934#; notify editline and cell in edit mode
@@ -1362,7 +1362,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
         rDocShell.UpdatePaintExt( nExtFlags, aMultiRange );     // content after the change
 
     if (!AdjustRowHeight( aMultiRange ))
-        rDocShell.PostPaint( aMultiRange, PAINT_GRID, nExtFlags );
+        rDocShell.PostPaint( aMultiRange, PaintPartFlags::Grid, nExtFlags );
     else if (nExtFlags & SC_PF_LINES)
         lcl_PaintAbove( rDocShell, aMultiRange );   // fuer Linien ueber dem Bereich
 
@@ -1430,7 +1430,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
     rDoc.ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
 
     if (!AdjustRowHeight( aMultiRange ))
-        rDocShell.PostPaint( aMultiRange, PAINT_GRID );
+        rDocShell.PostPaint( aMultiRange, PaintPartFlags::Grid );
 
     aModificator.SetDocumentModified();
 
@@ -1669,7 +1669,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
     SCROW nPaintStartRow = nStartRow;
     SCCOL nPaintEndCol = nEndCol;
     SCROW nPaintEndRow = nEndRow;
-    sal_uInt16 nPaintFlags = PAINT_GRID;
+    PaintPartFlags nPaintFlags = PaintPartFlags::Grid;
     bool bSuccess;
     SCTAB i;
 
@@ -1935,7 +1935,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
             nPaintStartCol = 0;
             nPaintEndCol = MAXCOL;
             nPaintEndRow = MAXROW;
-            nPaintFlags |= PAINT_LEFT;
+            nPaintFlags |= PaintPartFlags::Left;
             break;
         case INS_CELLSRIGHT:
             bSuccess = rDoc.InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
@@ -1947,7 +1947,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
             nPaintStartRow = 0;
             nPaintEndRow = MAXROW;
             nPaintEndCol = MAXCOL;
-            nPaintFlags |= PAINT_TOP;
+            nPaintFlags |= PaintPartFlags::Top;
             break;
         default:
             OSL_FAIL("Falscher Code beim Einfuegen");
@@ -2048,8 +2048,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
             if (bAdjusted)
             {
                 //  paint only what is not done by AdjustRowHeight
-                if (nPaintFlags & PAINT_TOP)
-                    rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, i, nPaintEndCol, nPaintEndRow, i+nScenarioCount, PAINT_TOP );
+                if (nPaintFlags & PaintPartFlags::Top)
+                    rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, i, nPaintEndCol, nPaintEndRow, i+nScenarioCount, PaintPartFlags::Top );
             }
             else
                 rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, i, nPaintEndCol, nPaintEndRow, i+nScenarioCount, nPaintFlags, nExtFlags );
@@ -2125,7 +2125,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
     SCROW nPaintStartRow = nStartRow;
     SCCOL nPaintEndCol = nEndCol;
     SCROW nPaintEndRow = nEndRow;
-    sal_uInt16 nPaintFlags = PAINT_GRID;
+    PaintPartFlags nPaintFlags = PaintPartFlags::Grid;
 
     bool bRecord = true;
     if (bRecord && !rDoc.IsUndoEnabled())
@@ -2410,7 +2410,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
             nPaintStartCol = 0;
             nPaintEndCol = MAXCOL;
             nPaintEndRow = MAXROW;
-            nPaintFlags |= PAINT_LEFT;
+            nPaintFlags |= PaintPartFlags::Left;
             break;
         case DEL_CELLSLEFT:
             rDoc.DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, nullptr, &aFullMark );
@@ -2421,7 +2421,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
             nPaintStartRow = 0;
             nPaintEndRow = MAXROW;
             nPaintEndCol = MAXCOL;
-            nPaintFlags |= PAINT_TOP;
+            nPaintFlags |= PaintPartFlags::Top;
             break;
         default:
             OSL_FAIL("Falscher Code beim Loeschen");
@@ -2576,8 +2576,8 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
             //  paint only what is not done by AdjustRowHeight
             if (nExtFlags & SC_PF_LINES)
                 lcl_PaintAbove( rDocShell, ScRange( nPaintStartCol, nPaintStartRow, *itr, nPaintEndCol, nPaintEndRow, *itr+nScenarioCount) );
-            if (nPaintFlags & PAINT_TOP)
-                rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, *itr, nPaintEndCol, nPaintEndRow, *itr+nScenarioCount, PAINT_TOP );
+            if (nPaintFlags & PaintPartFlags::Top)
+                rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, *itr, nPaintEndCol, nPaintEndRow, *itr+nScenarioCount, PaintPartFlags::Top );
         }
     }
 
@@ -2850,21 +2850,21 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
         SCROW nPaintStartY = nDestRow;
         SCCOL nPaintEndX = nDestPaintEndCol;
         SCROW nPaintEndY = nDestPaintEndRow;
-        sal_uInt16 nFlags = PAINT_GRID;
+        PaintPartFlags nFlags = PaintPartFlags::Grid;
 
         if ( nStartRow==0 && nEndRow==MAXROW )      // Breiten mitkopiert?
         {
             nPaintEndX = MAXCOL;
             nPaintStartY = 0;
             nPaintEndY = MAXROW;
-            nFlags |= PAINT_TOP;
+            nFlags |= PaintPartFlags::Top;
         }
         if ( bDestHeight || ( nStartCol == 0 && nEndCol == MAXCOL ) )
         {
             nPaintEndY = MAXROW;
             nPaintStartX = 0;
             nPaintEndX = MAXCOL;
-            nFlags |= PAINT_LEFT;
+            nFlags |= PaintPartFlags::Left;
         }
         if ( bScenariosAdded )
         {
@@ -2885,14 +2885,14 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
             nPaintStartY = nStartRow;
             nPaintEndX = nEndCol;
             nPaintEndY = nEndRow;
-            nFlags = PAINT_GRID;
+            nFlags = PaintPartFlags::Grid;
 
             if ( bSourceHeight )
             {
                 nPaintEndY = MAXROW;
                 nPaintStartX = 0;
                 nPaintEndX = MAXCOL;
-                nFlags |= PAINT_LEFT;
+                nFlags |= PaintPartFlags::Left;
             }
             if ( bScenariosAdded )
             {
@@ -3214,7 +3214,7 @@ void ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
         rDocShell.Broadcast( ScTablesHint( SC_TAB_HIDDEN, nTab ) );
 
     SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) );
-    rDocShell.PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_EXTRAS);
+    rDocShell.PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Extras);
     aModificator.SetDocumentModified();
 }
 
@@ -3236,7 +3236,7 @@ bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL, bool /* bApi */ )
         rDocShell.GetUndoManager()->AddUndoAction( new ScUndoLayoutRTL( &rDocShell, nTab, bRTL ) );
     }
 
-    rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
+    rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All );
     aModificator.SetDocumentModified();
 
     SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -3564,7 +3564,7 @@ bool ScDocFunc::SetWidthOrHeight(
 
     rDoc.UpdatePageBreaks( nTab );
 
-    rDocShell.PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_ALL);
+    rDocShell.PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::All);
     aModificator.SetDocumentModified();
 
     return bSuccess;
@@ -3609,7 +3609,7 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
 
     if (bColumn)
     {
-        rDocShell.PostPaint( static_cast<SCCOL>(nPos)-1, 0, nTab, MAXCOL, MAXROW, nTab, PAINT_GRID );
+        rDocShell.PostPaint( static_cast<SCCOL>(nPos)-1, 0, nTab, MAXCOL, MAXROW, nTab, PaintPartFlags::Grid );
         if (pBindings)
         {
             pBindings->Invalidate( FID_INS_COLBRK );
@@ -3618,7 +3618,7 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
     }
     else
     {
-        rDocShell.PostPaint( 0, static_cast<SCROW>(nPos)-1, nTab, MAXCOL, MAXROW, nTab, PAINT_GRID );
+        rDocShell.PostPaint( 0, static_cast<SCROW>(nPos)-1, nTab, MAXCOL, MAXROW, nTab, PaintPartFlags::Grid );
         if (pBindings)
         {
             pBindings->Invalidate( FID_INS_ROWBRK );
@@ -3673,7 +3673,7 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
 
     if (bColumn)
     {
-        rDocShell.PostPaint( static_cast<SCCOL>(nPos)-1, 0, nTab, MAXCOL, MAXROW, nTab, PAINT_GRID );
+        rDocShell.PostPaint( static_cast<SCCOL>(nPos)-1, 0, nTab, MAXCOL, MAXROW, nTab, PaintPartFlags::Grid );
         if (pBindings)
         {
             pBindings->Invalidate( FID_INS_COLBRK );
@@ -3682,7 +3682,7 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
     }
     else
     {
-        rDocShell.PostPaint( 0, nPos-1, nTab, MAXCOL, MAXROW, nTab, PAINT_GRID );
+        rDocShell.PostPaint( 0, nPos-1, nTab, MAXCOL, MAXROW, nTab, PaintPartFlags::Grid );
         if (pBindings)
         {
             pBindings->Invalidate( FID_INS_ROWBRK );
@@ -3889,7 +3889,7 @@ void ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
 
     rDoc.ClearSelectionItems( pWhich, aMultiMark );
 
-    rDocShell.PostPaint( aMarkRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    rDocShell.PostPaint( aMarkRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
     aModificator.SetDocumentModified();
 
     //! Bindings-Invalidate etc.?
@@ -3935,7 +3935,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
 
     rDoc.ChangeSelectionIndent( bIncrement, rMark );
 
-    rDocShell.PostPaint( aMarkRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    rDocShell.PostPaint( aMarkRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
     aModificator.SetDocumentModified();
 
     SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -4033,7 +4033,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
                 SetWidthOrHeight(true, aCols, *itr, SC_SIZE_VISOPT, STD_EXTRA_WIDTH, false, true);
                 SetWidthOrHeight(false, aRows, *itr, SC_SIZE_VISOPT, 0, false, false);
                 rDocShell.PostPaint( 0,0,*itr, MAXCOL,MAXROW,*itr,
-                                PAINT_GRID | PAINT_LEFT | PAINT_TOP );
+                                PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top );
             }
         }
         else
@@ -4045,10 +4045,10 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
                                                     nEndCol, nEndRow, *itr), false );
                 if (bAdj)
                     rDocShell.PostPaint( 0,nStartRow,*itr, MAXCOL,MAXROW,*itr,
-                                        PAINT_GRID | PAINT_LEFT );
+                                        PaintPartFlags::Grid | PaintPartFlags::Left );
                 else
                     rDocShell.PostPaint( nStartCol, nStartRow, *itr,
-                                        nEndCol, nEndRow, *itr, PAINT_GRID );
+                                        nEndCol, nEndRow, *itr, PaintPartFlags::Grid );
             }
         }
 
@@ -4144,7 +4144,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
         }
 
         //  Err522 beim Paint von DDE-Formeln werden jetzt beim Interpretieren abgefangen
-        rDocShell.PostPaint( nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab, PAINT_GRID );
+        rDocShell.PostPaint( nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab, PaintPartFlags::Grid );
         aModificator.SetDocumentModified();
 
         bSuccess = true;
@@ -4762,7 +4762,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
 
         if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab ) ) )
             rDocShell.PostPaint( nStartCol, nStartRow, nTab,
-                                 nEndCol, nEndRow, nTab, PAINT_GRID );
+                                 nEndCol, nEndRow, nTab, PaintPartFlags::Grid );
         if (bNeedContents || rOption.mbCenter)
         {
             ScRange aRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab);
@@ -4854,7 +4854,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord )
         rDoc.ExtendMerge( aRefresh, true );
 
         if ( !AdjustRowHeight( aExtended ) )
-            rDocShell.PostPaint( aExtended, PAINT_GRID );
+            rDocShell.PostPaint( aExtended, PaintPartFlags::Grid );
     }
 
     if (bRecord)
@@ -5192,7 +5192,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
             }
 
             if (!AdjustRowHeight(ScRange(0,nStartRow,nTab,MAXCOL,nEndRow,nTab)))
-                rDocShell.PostPaint( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab, PAINT_GRID );
+                rDocShell.PostPaint( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab, PaintPartFlags::Grid );
 
             aModificator.SetDocumentModified();
             bDone = true;
@@ -5405,7 +5405,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
     }
 
     if(pRepaintRange)
-        rDocShell.PostPaint(*pRepaintRange, PAINT_GRID);
+        rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid);
 
     aModificator.SetDocumentModified();
     SfxGetpApp()->Broadcast(SfxHint(SC_HINT_AREAS_CHANGED));
@@ -5466,7 +5466,7 @@ void ScDocFunc::ConvertFormulaToValue( const ScRange& rRange, bool bInteraction
             new sc::UndoFormulaToValue(&rDocShell, *pUndoVals));
     }
 
-    rDocShell.PostPaint(rRange, PAINT_GRID);
+    rDocShell.PostPaint(rRange, PaintPartFlags::Grid);
     rDocShell.PostDataChanged();
     rDoc.BroadcastCells(rRange, SC_HINT_DATACHANGED);
     aModificator.SetDocumentModified();
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 13fb414..6785133 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -91,14 +91,14 @@ void ScDocShell::PostDataChanged()
 }
 
 void ScDocShell::PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
-                            SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, sal_uInt16 nPart,
+                            SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart,
                             sal_uInt16 nExtFlags )
 {
     ScRange aRange(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab);
     PostPaint(aRange, nPart, nExtFlags);
 }
 
-void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uInt16 nExtFlags )
+void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sal_uInt16 nExtFlags )
 {
     ScRangeList aPaintRanges;
     for (size_t i = 0, n = rRanges.size(); i < n; ++i)
@@ -115,19 +115,17 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI
 
         if ( pPaintLockData )
         {
-            // #i54081# PAINT_EXTRAS still has to be broadcast because it changes the
+            // #i54081# PaintPartFlags::Extras still has to be broadcast because it changes the
             // current sheet if it's invalid. All other flags added to pPaintLockData.
-            sal_uInt16 nLockPart = nPart & ~PAINT_EXTRAS;
-            if ( nLockPart )
+            PaintPartFlags nLockPart = nPart & ~PaintPartFlags::Extras;
+            if ( nLockPart != PaintPartFlags::NONE )
             {
                 //! nExtFlags ???
                 pPaintLockData->AddRange( ScRange( nCol1, nRow1, nTab1,
                                                    nCol2, nRow2, nTab2 ), nLockPart );
             }
 
-            nPart &= PAINT_EXTRAS;  // for broadcasting
-            if (!nPart)
-                continue;
+            nPart &= PaintPartFlags::Extras;  // for broadcasting
         }
 
         if (nExtFlags & SC_PF_LINES)            // Platz fuer Linien beruecksichtigen
@@ -165,7 +163,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI
 
     // LOK: we are supposed to update the row / columns headers (and actually
     // the document size too - cell size affects that, obviously)
-    if ((nPart & (PAINT_TOP | PAINT_LEFT)) && comphelper::LibreOfficeKit::isActive())
+    if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && comphelper::LibreOfficeKit::isActive())
     {
         SfxViewShell* pViewShell = SfxViewShell::GetFirst();
         while (pViewShell)
@@ -178,12 +176,12 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI
 
 void ScDocShell::PostPaintGridAll()
 {
-    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
+    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
 }
 
 void ScDocShell::PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
 {
-    PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID, SC_PF_TESTMERGE );
+    PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PaintPartFlags::Grid, SC_PF_TESTMERGE );
 }
 
 void ScDocShell::PostPaintCell( const ScAddress& rPos )
@@ -193,7 +191,7 @@ void ScDocShell::PostPaintCell( const ScAddress& rPos )
 
 void ScDocShell::PostPaintExtras()
 {
-    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_EXTRAS );
+    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Extras );
 }
 
 void ScDocShell::UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange )
@@ -250,7 +248,7 @@ void ScDocShell::UnlockPaint_Impl(bool bDoc)
             ScRangeListRef xRangeList = pPaint->GetRangeList();
             if (xRangeList)
             {
-                sal_uInt16 nParts = pPaint->GetParts();
+                PaintPartFlags nParts = pPaint->GetParts();
                 for ( size_t i = 0, nCount = xRangeList->size(); i < nCount; i++ )
                 {
                     //! nExtFlags ???
@@ -561,7 +559,7 @@ sal_uInt16 ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, SfxPrinterChangeFlag
         }
     }
 
-    PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PAINT_ALL);
+    PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PaintPartFlags::All);
 
     return 0;
 }
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index c992590..050ed5c 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1303,7 +1303,7 @@ void ScDocShell::DoAutoStyle( const ScRange& rRange, const OUString& rStyle )
         SCROW nEndRow = rRange.aEnd.Row();
         aDocument.ApplyStyleAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, *pStyleSheet );
         aDocument.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
-        PostPaint( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab, PAINT_GRID );
+        PostPaint( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab, PaintPartFlags::Grid );
     }
 }
 
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index a57eb3d..fad1159 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -99,7 +99,7 @@ void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCR
 {
     ScDocShellModificator aModificator( *this );
     aDocument.RemoveFlagsTab( nX1, nY1, nX2, nY1, nTab, ScMF::Auto );
-    PostPaint( nX1, nY1, nTab, nX2, nY1, nTab, PAINT_GRID );
+    PostPaint( nX1, nY1, nTab, nX2, nY1, nTab, PaintPartFlags::Grid );
     // No SetDocumentModified, as the unnamed database range might have to be restored later.
     // The UNO hint is broadcast directly instead, to keep UNO objects in valid state.
     aDocument.BroadcastUno( SfxHint( SFX_HINT_DATACHANGED ) );
@@ -374,7 +374,7 @@ void ScDocShell::CancelAutoDBRange()
                 // restore AutoFilter buttons
                 pOldAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
                 aDocument.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto );
-                PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
+                PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PaintPartFlags::Grid );
             }
         }
 
@@ -394,7 +394,7 @@ bool ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
     bool bChange = aDocument.SetOptimalHeight(aCxt, nStartRow,nEndRow, nTab);
 
     if (bChange)
-        PostPaint( 0,nStartRow,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID|PAINT_LEFT );
+        PostPaint( 0,nStartRow,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid|PaintPartFlags::Left );
 
     return bChange;
 }
@@ -617,7 +617,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
     SCROW nPaintStartRow = rParam.nRow;
     SCCOL nPaintEndCol = nPaintStartCol + nColSize - 1;
     SCROW nPaintEndRow = nPaintStartRow + nRowSize - 1;
-    sal_uInt16 nPaintFlags = PAINT_GRID;
+    PaintPartFlags nPaintFlags = PaintPartFlags::Grid;
     if (rParam.bByCol)
         ++nPaintEndRow;
     if (rParam.bByRow)
@@ -627,7 +627,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
         nPaintStartCol = 0;
         nPaintEndCol = MAXCOL;
         nPaintEndRow = MAXROW;
-        nPaintFlags |= PAINT_LEFT | PAINT_SIZE;
+        nPaintFlags |= PaintPartFlags::Left | PaintPartFlags::Size;
     }
     if (pDestData)
     {
@@ -712,7 +712,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
                 //  alles painten, weil in anderen Bereichen das aktive Szenario
                 //  geaendert sein kann
                 //! nur, wenn sichtbare Rahmen vorhanden?
-                PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
+                PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid );
                 aModificator.SetDocumentModified();
             }
             else
@@ -820,7 +820,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin
             aDocument.CopyScenario( nNewTab, nTab, true );  // sal_True - nicht aus Szenario kopieren
 
             if (nFlags & ScScenarioFlags::ShowFrame)
-                PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );  // Rahmen painten
+                PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid );  // Rahmen painten
             PostPaintExtras();                                          // Tabellenreiter
             aModificator.SetDocumentModified();
 
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index d182b66..d4b1af7 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -136,7 +136,7 @@ void ScDocShell::SetVisAreaOrSize( const Rectangle& rVisArea )
         ScRange aNew;
         aDocument.GetEmbedded( aNew);
         if (aOld != aNew)
-            PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PAINT_GRID);
+            PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PaintPartFlags::Grid);
 
         //TODO/LATER: currently not implemented
         //ViewChanged( ASPECT_CONTENT );          // auch im Container anzeigen
@@ -238,7 +238,7 @@ void ScDocShell::LoadStyles( SfxObjectShell &rSource )
 
         //  Paint
 
-    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_LEFT );
+    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Left );
 }
 
 void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellStyles, bool bPageStyles )
@@ -302,7 +302,7 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS
 
     lcl_AdjustPool( GetStyleSheetPool() );      // adjust SetItems
     UpdateAllRowHeights();
-    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_LEFT );      // Paint
+    PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Left );      // Paint
 }
 
 void ScDocShell::ReconnectDdeLink(SfxObjectShell& rServer)
@@ -409,7 +409,7 @@ void ScDocShell::ReloadTabLinks()
     {
         //  Paint nur einmal
         PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB),
-                                    PAINT_GRID | PAINT_TOP | PAINT_LEFT );
+                                    PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left );
 
         SetDocumentModified();
     }
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 258780d..5ec7b72 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -256,7 +256,7 @@ void ScImportExport::EndPaste(bool bAutoRowHeight)
     if( pDocSh )
     {
         if (!bHeight)
-            pDocSh->PostPaint( aRange, PAINT_GRID );
+            pDocSh->PostPaint( aRange, PaintPartFlags::Grid );
         pDocSh->SetDocumentModified();
     }
     ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 8c8643e..a96eadf 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -47,20 +47,20 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
 {
     ScDocument& rDoc = rDocShell.GetDocument();
 
-    sal_uInt16 nParts = PAINT_GRID;
+    PaintPartFlags nParts = PaintPartFlags::Grid;
     SCCOL nStartCol = 0;
     SCROW nStartRow = 0;
     SCCOL nEndCol = MAXCOL;         // fuer Test auf Merge
     SCROW nEndRow = MAXROW;
     if ( bColumns )
     {
-        nParts |= PAINT_TOP;
+        nParts |= PaintPartFlags::Top;
         nStartCol = static_cast<SCCOL>(nStart);
         nEndCol = static_cast<SCCOL>(nEnd);
     }
     else
     {
-        nParts |= PAINT_LEFT;
+        nParts |= PaintPartFlags::Left;
         nStartRow = nStart;
         nEndRow = nEnd;
     }
@@ -113,13 +113,13 @@ void ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b
         if (rDoc.IsStreamValid(nTab))
             rDoc.SetStreamValid(nTab, false);
 
-        sal_uInt16 nParts = 0;              // Datenbereich nicht geaendert
+        PaintPartFlags nParts = PaintPartFlags::NONE;   // Datenbereich nicht geaendert
         if ( bColumns )
-            nParts |= PAINT_TOP;
+            nParts |= PaintPartFlags::Top;
         else
-            nParts |= PAINT_LEFT;
+            nParts |= PaintPartFlags::Left;
         if ( bSize )
-            nParts |= PAINT_SIZE;
+            nParts |= PaintPartFlags::Size;
 
         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, nParts );
         rDocShell.SetDocumentModified();
@@ -176,13 +176,13 @@ void ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
             if (rDoc.IsStreamValid(nTab))
                 rDoc.SetStreamValid(nTab, false);
 
-            sal_uInt16 nParts = 0;              // Datenbereich nicht geaendert
+            PaintPartFlags nParts = PaintPartFlags::NONE;   // Datenbereich nicht geaendert
             if ( bColumns )
-                nParts |= PAINT_TOP;
+                nParts |= PaintPartFlags::Top;
             else
-                nParts |= PAINT_LEFT;
+                nParts |= PaintPartFlags::Left;
             if ( bSize )
-                nParts |= PAINT_SIZE;
+                nParts |= PaintPartFlags::Size;
 
             rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, nParts );
             rDocShell.SetDocumentModified();
@@ -243,7 +243,7 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
             rDoc.SetStreamValid(nTab, false);
 
         rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab,
-                                    PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
+                                    PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size );
         rDocShell.SetDocumentModified();
         lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
         bSuccess = true;
@@ -309,7 +309,7 @@ void ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
     if (rDoc.IsStreamValid(nTab))
         rDoc.SetStreamValid(nTab, false);
 
-    rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
+    rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size );
     rDocShell.SetDocumentModified();
     lcl_InvalidateOutliner( rDocShell.GetViewBindings() );
 }
@@ -497,7 +497,7 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
         rDoc.SetDrawPageSize(nTab);
         rDoc.UpdatePageBreaks( nTab );
 
-        rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
+        rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top );
         rDocShell.SetDocumentModified();
         bDone = true;
 
@@ -589,7 +589,7 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
         rDoc.SetDrawPageSize(nTab);
         rDoc.UpdatePageBreaks( nTab );
 
-        rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
+        rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top );
 
         rDocShell.SetDocumentModified();
         bDone = true;
diff --git a/sc/source/ui/docshell/pntlock.cxx b/sc/source/ui/docshell/pntlock.cxx
index 81813b7..138c4eb 100644
--- a/sc/source/ui/docshell/pntlock.cxx
+++ b/sc/source/ui/docshell/pntlock.cxx
@@ -22,7 +22,7 @@
 ScPaintLockData::ScPaintLockData() :
     nLevel( 0 ),
     nDocLevel( 0 ),
-    nParts( 0 ),
+    nParts( PaintPartFlags::NONE ),
     bModified( false )
 {
 }
@@ -31,7 +31,7 @@ ScPaintLockData::~ScPaintLockData()
 {
 }
 
-void ScPaintLockData::AddRange( const ScRange& rRange, sal_uInt16 nP )
+void ScPaintLockData::AddRange( const ScRange& rRange, PaintPartFlags nP )
 {
     if (!xRangeList.Is())
         xRangeList = new ScRangeList;
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9cd8ea2..d16ae51 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -380,7 +380,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
     //  Paint (koennen mehrere Tabellen sein)
 
     pImpl->m_pDocSh->PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB),
-                                PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
+                                PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left | PaintPartFlags::Extras );
     aModificator.SetDocumentModified();
 
     if (bNotFound)
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index e549345..15faf2b 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -312,9 +312,9 @@ public:
     void            PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos );
 
     void            PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
-                            SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, sal_uInt16 nPart,
+                            SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart,
                             sal_uInt16 nExtFlags = 0 );
-    void            PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uInt16 nExtFlags = 0 );
+    void            PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sal_uInt16 nExtFlags = 0 );
 
     void            PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
     void            PostPaintCell( const ScAddress& rPos );
diff --git a/sc/source/ui/inc/pntlock.hxx b/sc/source/ui/inc/pntlock.hxx
index 1e1163a..ccd76c4 100644
--- a/sc/source/ui/inc/pntlock.hxx
+++ b/sc/source/ui/inc/pntlock.hxx
@@ -28,14 +28,14 @@ private:
     ScRangeListRef  xRangeList;
     sal_uInt16      nLevel;
     sal_uInt16      nDocLevel;
-    sal_uInt16      nParts;
+    PaintPartFlags  nParts;
     bool            bModified;
 
 public:
                     ScPaintLockData();
                     ~ScPaintLockData();
 
-    void            AddRange( const ScRange& rRange, sal_uInt16 nP );
+    void            AddRange( const ScRange& rRange, PaintPartFlags nP );
 
     void            SetModified()   { bModified = true; }
     void            IncLevel(bool bDoc)
@@ -44,7 +44,7 @@ public:
                         { if (bDoc) --nDocLevel; else --nLevel; }
 
     const ScRangeListRef&   GetRangeList() const            { return xRangeList; }
-    sal_uInt16              GetParts() const                { return nParts; }
+    PaintPartFlags          GetParts() const                { return nParts; }
     sal_uInt16              GetLevel(bool bDoc) const
                                 { return bDoc ? nDocLevel : nLevel; }
     bool                    GetModified() const             { return bModified; }
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 39d3396..10d0f23 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -509,7 +509,7 @@ IMPL_LINK_NOARG_TYPED(ScColRowNameRangesDlg, OkBtnHdl, Button*, void)
     // changed ranges need to take effect
     pDoc->CompileColRowNameFormula();
     ScDocShell* pDocShell = pViewData->GetDocShell();
-    pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID);
+    pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PaintPartFlags::Grid);
     pDocShell->SetDocumentModified();
 
     Close();
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index da2358a..795270d 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -318,7 +318,7 @@ bool ScBlockUndo::AdjustHeight()
     if (bRet)
         pDocShell->PostPaint( 0,      aBlockRange.aStart.Row(), aBlockRange.aStart.Tab(),
                               MAXCOL, MAXROW,                   aBlockRange.aEnd.Tab(),
-                              PAINT_GRID | PAINT_LEFT );
+                              PaintPartFlags::Grid | PaintPartFlags::Left );
 
     return bRet;
 }
@@ -418,7 +418,7 @@ void ScMultiBlockUndo::AdjustHeight()
         if (bRet)
             pDocShell->PostPaint(
                 0, r.aStart.Row(), r.aStart.Tab(), MAXCOL, MAXROW, r.aEnd.Tab(),
-                PAINT_GRID | PAINT_LEFT);
+                PaintPartFlags::Grid | PaintPartFlags::Left);
     }
 }
 
@@ -552,7 +552,7 @@ void ScDBFuncUndo::EndUndo()
                 // restore AutoFilter buttons
                 pAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
                 rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto );
-                pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
+                pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PaintPartFlags::Grid );
             }
         }
     }
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 2d7c7b2..fab2d03 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -207,13 +207,13 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
 
     // Undo for displaced attributes?
 
-    sal_uInt16 nPaint = PAINT_GRID;
+    PaintPartFlags nPaint = PaintPartFlags::Grid;
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     switch (eCmd)
     {
         case INS_INSROWS_BEFORE:
         case INS_INSROWS_AFTER:
-            nPaint |= PAINT_LEFT;
+            nPaint |= PaintPartFlags::Left;
             aWorkRange.aEnd.SetRow(MAXROW);
             break;
         case INS_CELLSDOWN:
@@ -224,23 +224,23 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
                 {
                     aWorkRange.aStart.SetCol(0);
                     aWorkRange.aEnd.SetCol(MAXCOL);
-                    nPaint |= PAINT_LEFT;
+                    nPaint |= PaintPartFlags::Left;
                 }
             }
             break;
         case INS_INSCOLS_BEFORE:
         case INS_INSCOLS_AFTER:
-            nPaint |= PAINT_TOP;                // top bar
+            nPaint |= PaintPartFlags::Top;                // top bar
             SAL_FALLTHROUGH;
         case INS_CELLSRIGHT:
             for( i=0; i<nCount; i++ )
             {
                 aWorkRange.aEnd.SetCol(MAXCOL);     // to the far right
                 if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i]) )
-                {                                   // AdjustDraw does not paint PAINT_TOP,
+                {                                   // AdjustDraw does not paint PaintPartFlags::Top,
                     aWorkRange.aStart.SetCol(0);    // thus solved like this
                     aWorkRange.aEnd.SetRow(MAXROW);
-                    nPaint |= PAINT_LEFT;
+                    nPaint |= PaintPartFlags::Left;
                 }
             }
             break;
@@ -444,11 +444,11 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
     }
 
     // paint
-    sal_uInt16 nPaint = PAINT_GRID;
+    PaintPartFlags nPaint = PaintPartFlags::Grid;
     switch (eCmd)
     {
         case DEL_DELROWS:
-            nPaint |= PAINT_LEFT;
+            nPaint |= PaintPartFlags::Left;
             aWorkRange.aEnd.SetRow(MAXROW);
             break;
         case DEL_CELLSUP:
@@ -459,12 +459,12 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
                 {
                     aWorkRange.aStart.SetCol(0);
                     aWorkRange.aEnd.SetCol(MAXCOL);
-                    nPaint |= PAINT_LEFT;
+                    nPaint |= PaintPartFlags::Left;
                 }
             }
             break;
         case DEL_DELCOLS:
-            nPaint |= PAINT_TOP;                // top bar
+            nPaint |= PaintPartFlags::Top;                // top bar
             SAL_FALLTHROUGH;
         case DEL_CELLSLEFT:
             for( i=0; i<nCount; i++ )
@@ -474,7 +474,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
                 {
                     aWorkRange.aStart.SetCol(0);
                     aWorkRange.aEnd.SetRow(MAXROW);
-                    nPaint |= PAINT_LEFT;
+                    nPaint |= PaintPartFlags::Left;
                 }
             }
             break;
@@ -574,18 +574,18 @@ void ScUndoDeleteMulti::DoChange() const
 {
     SCCOL nStartCol;
     SCROW nStartRow;
-    sal_uInt16 nPaint;
+    PaintPartFlags nPaint;
     if (mbRows)
     {
         nStartCol = 0;
         nStartRow = static_cast<SCROW>(maSpans[0].mnStart);
-        nPaint = PAINT_GRID | PAINT_LEFT;
+        nPaint = PaintPartFlags::Grid | PaintPartFlags::Left;
     }
     else
     {
         nStartCol = static_cast<SCCOL>(maSpans[0].mnStart);
         nStartRow = 0;
-        nPaint = PAINT_GRID | PAINT_TOP;
+        nPaint = PaintPartFlags::Grid | PaintPartFlags::Top;
     }
 
     if (mbRefresh)
@@ -788,7 +788,7 @@ void ScUndoCut::DoChange( const bool bUndo )
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
-/*A*/   pDocShell->PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
+/*A*/   pDocShell->PostPaint( aExtendedRange, PaintPartFlags::Grid, nExtFlags );
 
     if ( !bUndo )                               //   draw redo after updating row heights
         RedoSdrUndoAction( pDrawUndo );         //! include in ScBlockUndo?
@@ -1006,7 +1006,7 @@ void ScUndoPaste::DoChange(bool bUndo)
         SetChangeTrack();
 
     ScRangeList aDrawRanges(maBlockRanges);
-    sal_uInt16 nPaint = PAINT_GRID;
+    PaintPartFlags nPaint = PaintPartFlags::Grid;
     for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i)
     {
         ScRange& rDrawRange = *aDrawRanges[i];
@@ -1017,7 +1017,7 @@ void ScUndoPaste::DoChange(bool bUndo)
             rDrawRange.aStart.SetRow(0);
             rDrawRange.aEnd.SetCol(MAXCOL);
             rDrawRange.aEnd.SetRow(MAXROW);
-            nPaint |= PAINT_TOP | PAINT_LEFT;
+            nPaint |= PaintPartFlags::Top | PaintPartFlags::Left;
             if (pViewShell)
                 pViewShell->AdjustBlockHeight(false);
         }
@@ -1025,12 +1025,12 @@ void ScUndoPaste::DoChange(bool bUndo)
         {
             if (maBlockRanges[i]->aStart.Row() == 0 && maBlockRanges[i]->aEnd.Row() == MAXROW) // whole column
             {
-                nPaint |= PAINT_TOP;
+                nPaint |= PaintPartFlags::Top;
                 rDrawRange.aEnd.SetCol(MAXCOL);
             }
             if (maBlockRanges[i]->aStart.Col() == 0 && maBlockRanges[i]->aEnd.Col() == MAXCOL) // whole row
             {
-                nPaint |= PAINT_LEFT;
+                nPaint |= PaintPartFlags::Left;
                 rDrawRange.aEnd.SetRow(MAXROW);
             }
             if (pViewShell && pViewShell->AdjustBlockHeight(false))
@@ -1039,7 +1039,7 @@ void ScUndoPaste::DoChange(bool bUndo)
                 rDrawRange.aStart.SetRow(0);
                 rDrawRange.aEnd.SetCol(MAXCOL);
                 rDrawRange.aEnd.SetRow(MAXROW);
-                nPaint |= PAINT_LEFT;
+                nPaint |= PaintPartFlags::Left;
             }
             pDocShell->UpdatePaintExt(nExtFlags, rDrawRange);
         }
@@ -1163,7 +1163,7 @@ void ScUndoDragDrop::SetChangeTrack()
 
 void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
 {
-    sal_uInt16 nPaint = PAINT_GRID;
+    PaintPartFlags nPaint = PaintPartFlags::Grid;
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     ScDocument& rDoc = pDocShell->GetDocument();
 
@@ -1180,7 +1180,7 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
             aRange.aStart.SetCol(0);
             aRange.aEnd.SetCol(MAXCOL);
             aRange.aEnd.SetRow(MAXROW);
-            nPaint |= PAINT_LEFT;
+            nPaint |= PaintPartFlags::Left;
         }
     }
 
@@ -1196,12 +1196,12 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
     //  column/row info (width/height) included if whole columns/rows were copied
     if ( aSrcRange.aStart.Col() == 0 && aSrcRange.aEnd.Col() == MAXCOL )
     {
-        nPaint |= PAINT_LEFT;
+        nPaint |= PaintPartFlags::Left;
         aRange.aEnd.SetRow(MAXROW);
     }
     if ( aSrcRange.aStart.Row() == 0 && aSrcRange.aEnd.Row() == MAXROW )
     {
-        nPaint |= PAINT_TOP;
+        nPaint |= PaintPartFlags::Top;
         aRange.aEnd.SetCol(MAXCOL);
     }
 
@@ -1458,7 +1458,7 @@ void ScUndoListNames::DoChange( ScDocument* pSrcDoc ) const
 
     rDoc.DeleteAreaTab( aBlockRange, InsertDeleteFlags::ALL );
     pSrcDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ALL, false, rDoc);
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid );
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -1524,7 +1524,7 @@ void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
 
     rDoc.DeleteAreaTab( maRange, InsertDeleteFlags::ALL );
     pSrcDoc->CopyToDocument(maRange, InsertDeleteFlags::ALL, false, rDoc);
-    pDocShell->PostPaint( maRange, PAINT_GRID );
+    pDocShell->PostPaint( maRange, PaintPartFlags::Grid );
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -1611,9 +1611,9 @@ void ScUndoUseScenario::Undo()
 
     // if visible borders, then paint all
     if (bFrame)
-        pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_EXTRAS );
+        pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Extras );
     else
-        pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS );
+        pDocShell->PostPaint( aRange, PaintPartFlags::Grid | PaintPartFlags::Extras );
     pDocShell->PostDataChanged();
     if (pViewShell)
         pViewShell->CellContentChanged();
@@ -1722,7 +1722,7 @@ void ScUndoSelectionStyle::DoChange( const bool bUndo )
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
-/*A*/   pDocShell->PostPaint( aWorkRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
+/*A*/   pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
 
     ShowTable( aWorkRange.aStart.Tab() );
 }
@@ -1808,7 +1808,7 @@ void ScUndoEnterMatrix::Undo()
 
     rDoc.DeleteAreaTab( aBlockRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE );
     pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc);
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid );
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -1894,7 +1894,7 @@ void ScUndoIndent::Undo()
     aCopyRange.aStart.SetTab(0);
     aCopyRange.aEnd.SetTab(nTabCount-1);
     pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndUndo();
 }
@@ -1905,7 +1905,7 @@ void ScUndoIndent::Redo()
 
     ScDocument& rDoc = pDocShell->GetDocument();
     rDoc.ChangeSelectionIndent( bIsIncrement, aMarkData );
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndRedo();
 }
@@ -1950,7 +1950,7 @@ void ScUndoTransliterate::Undo()
     aCopyRange.aStart.SetTab(0);
     aCopyRange.aEnd.SetTab(nTabCount-1);
     pUndoDoc->CopyToDocument(aCopyRange, InsertDeleteFlags::CONTENTS, true, rDoc, &aMarkData);
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndUndo();
 }
@@ -1961,7 +1961,7 @@ void ScUndoTransliterate::Redo()
 
     ScDocument& rDoc = pDocShell->GetDocument();
     rDoc.TransliterateText( aMarkData, nTransliterationType );
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndRedo();
 }
@@ -2011,7 +2011,7 @@ void ScUndoClearItems::Undo()
 
     ScDocument& rDoc = pDocShell->GetDocument();
     pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndUndo();
 }
@@ -2022,7 +2022,7 @@ void ScUndoClearItems::Redo()
 
     ScDocument& rDoc = pDocShell->GetDocument();
     rDoc.ClearSelectionItems( pWhich, aMarkData );
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndRedo();
 }
@@ -2070,7 +2070,7 @@ void ScUndoRemoveBreaks::Undo()
     pUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, InsertDeleteFlags::NONE, false, rDoc);
     if (pViewShell)
         pViewShell->UpdatePageBreakData( true );
-    pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
+    pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid );
 
     EndUndo();
 }
@@ -2086,7 +2086,7 @@ void ScUndoRemoveBreaks::Redo()
     rDoc.UpdatePageBreaks(nTab);
     if (pViewShell)
         pViewShell->UpdatePageBreakData( true );
-    pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
+    pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid );
 
     EndRedo();
 }
@@ -2273,7 +2273,7 @@ void ScUndoBorder::Undo()
     ScMarkData aMarkData;
     aMarkData.MarkFromRangeList( *pRanges, false );
     pUndoDoc->CopyToDocument(aBlockRange, InsertDeleteFlags::ATTRIB, true, rDoc, &aMarkData);
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndUndo();
 }
@@ -2296,7 +2296,7 @@ void ScUndoBorder::Redo()
         rDoc.ApplySelectionFrame( aMark, pOuter, pInner );
     }
     for (size_t i = 0; i < nCount; ++i)
-        pDocShell->PostPaint( *(*pRanges)[i], PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+        pDocShell->PostPaint( *(*pRanges)[i], PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     EndRedo();
 }
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 8022ba6..50404d5 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -105,13 +105,13 @@ void ScUndoWidthOrHeight::Undo()
                                      false, rDoc);
             rDoc.UpdatePageBreaks( *itr );
             pDocShell->PostPaint( static_cast<SCCOL>(nPaintStart), 0, *itr,
-                    MAXCOL, MAXROW, *itr, PAINT_GRID | PAINT_TOP );
+                    MAXCOL, MAXROW, *itr, PaintPartFlags::Grid | PaintPartFlags::Top );
         }
         else        // Height
         {
             pUndoDoc->CopyToDocument(0, nStart, *itr, MAXCOL, nEnd, *itr, InsertDeleteFlags::NONE, false, rDoc);
             rDoc.UpdatePageBreaks( *itr );
-            pDocShell->PostPaint( 0, nPaintStart, *itr, MAXCOL, MAXROW, *itr, PAINT_GRID | PAINT_LEFT );
+            pDocShell->PostPaint( 0, nPaintStart, *itr, MAXCOL, MAXROW, *itr, PaintPartFlags::Grid | PaintPartFlags::Left );
         }
     }
 
@@ -155,7 +155,7 @@ void ScUndoWidthOrHeight::Redo()
 
     // paint grid if selection was changed directly at the MarkData
     if (bPaintAll)
-        pDocShell->PostPaint( 0, 0, nStartTab, MAXCOL, MAXROW, nEndTab, PAINT_GRID );
+        pDocShell->PostPaint( 0, 0, nStartTab, MAXCOL, MAXROW, nEndTab, PaintPartFlags::Grid );
 
     EndRedo();
 }
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index ed61de7..dc2d9e2f 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -170,7 +170,7 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if ( !( (pViewShell) && pViewShell->AdjustRowHeight(
                                 aRange.aStart.Row(), aRange.aEnd.Row() ) ) )
-/*A*/   pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
+/*A*/   pDocShell->PostPaint( aRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
 
     if (pViewShell)
         pViewShell->CellContentChanged();
@@ -299,7 +299,7 @@ void ScUndoFillTable::DoChange( const bool bUndo )
         SetChangeTrack();
     }
 
-    pDocShell->PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_EXTRAS);
+    pDocShell->PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Extras);
     pDocShell->PostDataChanged();
 
     //  CellContentChanged comes with the selection
@@ -420,7 +420,7 @@ void ScUndoSelectionAttr::DoChange( const bool bUndo )
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
-/*A*/   pDocShell->PostPaint( aEffRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
+/*A*/   pDocShell->PostPaint( aEffRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
 
     ShowTable( aRange );
 }
@@ -547,7 +547,7 @@ void ScUndoAutoFill::Undo()
         BroadcastChanges( aWorkRange);
 
         rDoc.ExtendMerge( aWorkRange, true );
-        pDocShell->PostPaint( aWorkRange, PAINT_GRID, nExtFlags );
+        pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid, nExtFlags );
     }
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -609,7 +609,7 @@ void ScUndoAutoFill::Redo()
 
     SetChangeTrack();
 
-    pDocShell->PostPaint( aBlockRange, PAINT_GRID );
+    pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid );
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -812,10 +812,10 @@ void ScUndoAutoFormat::Undo()
         pUndoDoc->CopyToDocument( 0, nStartY, 0, MAXCOL, nEndY, nTabCount-1,
                                     InsertDeleteFlags::NONE, false, rDoc, &aMarkData );
         pDocShell->PostPaint( 0, 0, nStartZ, MAXCOL, MAXROW, nEndZ,
-                              PAINT_GRID | PAINT_LEFT | PAINT_TOP, SC_PF_LINES );
+                              PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top, SC_PF_LINES );
     }
     else
-        pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES );
+        pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES );
 
     EndUndo();
 }
@@ -891,10 +891,10 @@ void ScUndoAutoFormat::Redo()
 
         pDocShell->PostPaint( 0,      0,      nStartZ,
                               MAXCOL, MAXROW, nEndZ,
-                              PAINT_GRID | PAINT_LEFT | PAINT_TOP, SC_PF_LINES);
+                              PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top, SC_PF_LINES);
     }
     else
-        pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES );
+        pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES );
 
     EndRedo();
 }
@@ -1131,7 +1131,7 @@ void ScUndoTabOp::Undo()
     ScDocument& rDoc = pDocShell->GetDocument();
     rDoc.DeleteAreaTab( aRange,InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE );
     pUndoDoc->CopyToDocument( aRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, rDoc );
-    pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags );
+    pDocShell->PostPaint( aRange, PaintPartFlags::Grid, nExtFlags );
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -1318,7 +1318,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
     aCopyRange.aStart.SetTab(0);
     aCopyRange.aEnd.SetTab(nTabCount-1);
     pRefDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, rDoc, &aMarkData );
-    pDocShell->PostPaint( aRange, PAINT_GRID);
+    pDocShell->PostPaint( aRange, PaintPartFlags::Grid);
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     if (pViewShell)
@@ -1694,7 +1694,7 @@ void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
         aWorkRange.aEnd.SetRow(MAXROW);
 
     if ( !pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), aWorkRange.aStart.Tab() ) )
-        pDocShell->PostPaint( aWorkRange, PAINT_GRID );
+        pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid );
 
     pDocShell->PostDataChanged();
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index dcf04df..f9d082f 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -133,7 +133,7 @@ void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const share
         nFlags |= SC_PF_LINES;
     if (bPaintRows)
         nFlags |= SC_PF_WHOLEROWS;
-    pDocShell->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID, nFlags );
+    pDocShell->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PaintPartFlags::Grid, nFlags );
 }
 
 void ScUndoCursorAttr::Undo()
diff --git a/sc/source/ui/undo/undoconvert.cxx b/sc/source/ui/undo/undoconvert.cxx
index 995ab8f..b23465b 100644
--- a/sc/source/ui/undo/undoconvert.cxx
+++ b/sc/source/ui/undo/undoconvert.cxx
@@ -41,7 +41,7 @@ void UndoFormulaToValue::Execute()
 
     ScUndoUtil::MarkSimpleBlock(pDocShell, maUndoValues.getRange());
 
-    pDocShell->PostPaint(maUndoValues.getRange(), PAINT_GRID);
+    pDocShell->PostPaint(maUndoValues.getRange(), PaintPartFlags::Grid);
     pDocShell->PostDataChanged();
     rDoc.BroadcastCells(maUndoValues.getRange(), SC_HINT_DATACHANGED);
 }
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 3fc8183..1595bf1 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -104,7 +104,7 @@ void ScUndoDoOutline::Undo()
 
     pViewShell->UpdateScrollBars();
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top);
 
     EndUndo();
 }
@@ -180,7 +180,7 @@ void ScUndoMakeOutline::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP|PAINT_SIZE);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
 
     EndUndo();
 }
@@ -198,7 +198,7 @@ void ScUndoMakeOutline::Redo()
     else
         pViewShell->RemoveOutline( bColumns, false );
 
-    pDocShell->PostPaint(0,0,aBlockStart.Tab(),MAXCOL,MAXROW,aBlockEnd.Tab(),PAINT_GRID);
+    pDocShell->PostPaint(0,0,aBlockStart.Tab(),MAXCOL,MAXROW,aBlockEnd.Tab(),PaintPartFlags::Grid);
 
     EndRedo();
 }
@@ -274,7 +274,7 @@ void ScUndoOutlineLevel::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top);
 
     EndUndo();
 }
@@ -372,7 +372,7 @@ void ScUndoOutlineBlock::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top);
 
     EndUndo();
 }
@@ -461,7 +461,7 @@ void ScUndoRemoveAllOutlines::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP|PAINT_SIZE);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
 
     EndUndo();
 }
@@ -551,7 +551,7 @@ void ScUndoAutoOutline::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP|PAINT_SIZE);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
 
     EndUndo();
 }
@@ -688,7 +688,7 @@ void ScUndoSubTotals::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP|PAINT_SIZE);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
     pDocShell->PostDataChanged();
 
     EndUndo();
@@ -853,11 +853,11 @@ void ScUndoQuery::Undo()
         if (bDoSize)
             nEndY = MAXROW;
         pDocShell->PostPaint( aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
-                                    nEndX, nEndY, aQueryParam.nDestTab, PAINT_GRID );
+                                    nEndX, nEndY, aQueryParam.nDestTab, PaintPartFlags::Grid );
     }
     else
         pDocShell->PostPaint( 0, aQueryParam.nRow1, nTab, MAXCOL, MAXROW, nTab,
-                                                    PAINT_GRID | PAINT_LEFT );
+                                                    PaintPartFlags::Grid | PaintPartFlags::Left );
     pDocShell->PostDataChanged();
 
     EndUndo();
@@ -942,7 +942,7 @@ void ScUndoAutoFilter::DoChange( bool bUndo )
         else
             rDoc.RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto );
 
-        pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
+        pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PaintPartFlags::Grid );
     }
 }
 
@@ -1143,10 +1143,10 @@ void ScUndoImportData::Undo()
         pViewShell->SetTabNo( nTab );
 
     if (bMoveCells)
-        pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
+        pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid );
     else
         pDocShell->PostPaint( aImportParam.nCol1,aImportParam.nRow1,nTab,
-                                nEndCol,nEndRow,nTab, PAINT_GRID );
+                                nEndCol,nEndRow,nTab, PaintPartFlags::Grid );
     pDocShell->PostDataChanged();
 
     EndUndo();
@@ -1212,10 +1212,10 @@ void ScUndoImportData::Redo()
         pViewShell->SetTabNo( nTab );
 
     if (bMoveCells)
-        pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
+        pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid );
     else
         pDocShell->PostPaint( aImportParam.nCol1,aImportParam.nRow1,nTab,
-                                nEndCol,nEndRow,nTab, PAINT_GRID );
+                                nEndCol,nEndRow,nTab, PaintPartFlags::Grid );
     pDocShell->PostDataChanged();
 
     EndRedo();
@@ -1375,7 +1375,7 @@ void ScUndoRepeatDB::Undo()
     if ( nVisTab != nTab )
         pViewShell->SetTabNo( nTab );
 
-    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_GRID|PAINT_LEFT|PAINT_TOP|PAINT_SIZE);
+    pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size);
     pDocShell->PostDataChanged();
 
     EndUndo();
@@ -1513,9 +1513,9 @@ void ScUndoDataPilot::Undo()
     }
 
     if (pNewUndoDoc)
-        pDocShell->PostPaint( aNewRange, PAINT_GRID, SC_PF_LINES );
+        pDocShell->PostPaint( aNewRange, PaintPartFlags::Grid, SC_PF_LINES );
     if (pOldUndoDoc)
-        pDocShell->PostPaint( aOldRange, PAINT_GRID, SC_PF_LINES );
+        pDocShell->PostPaint( aOldRange, PaintPartFlags::Grid, SC_PF_LINES );
     pDocShell->PostDataChanged();
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1631,7 +1631,7 @@ void ScUndoConsolidate::Undo()
         }
 
         pDocShell->PostPaint( 0,aDestArea.nRowStart,nTab, MAXCOL,MAXROW,nTab,
-                                PAINT_GRID | PAINT_LEFT | PAINT_SIZE );
+                                PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Size );
     }
     else
     {
@@ -1658,7 +1658,7 @@ void ScUndoConsolidate::Undo()
                 nEndY = aOldRange.aEnd.Row();
         }
         pDocShell->PostPaint( aDestArea.nColStart, aDestArea.nRowStart, nTab,
-                                    nEndX, nEndY, nTab, PAINT_GRID );
+                                    nEndX, nEndY, nTab, PaintPartFlags::Grid );
     }
 
     // Adjust Database range again
@@ -1939,14 +1939,14 @@ void ScUndoDataForm::DoChange( const bool bUndo )
 
     ScRange aDrawRange( aBlockRange );
     rDoc.ExtendMerge( aDrawRange, true );      // only needed for single sheet (text/rtf etc.)
-    sal_uInt16 nPaint = PAINT_GRID;
+    PaintPartFlags nPaint = PaintPartFlags::Grid;
     if (bPaintAll)
     {
         aDrawRange.aStart.SetCol(0);
         aDrawRange.aStart.SetRow(0);
         aDrawRange.aEnd.SetCol(MAXCOL);
         aDrawRange.aEnd.SetRow(MAXROW);
-        nPaint |= PAINT_TOP | PAINT_LEFT;
+        nPaint |= PaintPartFlags::Top | PaintPartFlags::Left;
 /*A*/   if (pViewShell)
             pViewShell->AdjustBlockHeight(false);
     }
@@ -1954,12 +1954,12 @@ void ScUndoDataForm::DoChange( const bool bUndo )
     {
         if ( aBlockRange.aStart.Row() == 0 && aBlockRange.aEnd.Row() == MAXROW )        // whole column
         {
-            nPaint |= PAINT_TOP;
+            nPaint |= PaintPartFlags::Top;
             aDrawRange.aEnd.SetCol(MAXCOL);
         }
         if ( aBlockRange.aStart.Col() == 0 && aBlockRange.aEnd.Col() == MAXCOL )        // whole row
         {
-            nPaint |= PAINT_LEFT;
+            nPaint |= PaintPartFlags::Left;
             aDrawRange.aEnd.SetRow(MAXROW);
         }
 /*A*/   if ((pViewShell) && pViewShell->AdjustBlockHeight(false))
@@ -1968,7 +1968,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
             aDrawRange.aStart.SetRow(0);
             aDrawRange.aEnd.SetCol(MAXCOL);
             aDrawRange.aEnd.SetRow(MAXROW);
-            nPaint |= PAINT_LEFT;
+            nPaint |= PaintPartFlags::Left;
         }
         pDocShell->UpdatePaintExt( nExtFlags, aDrawRange );
     }
diff --git a/sc/source/ui/undo/undosort.cxx b/sc/source/ui/undo/undosort.cxx
index ec29bb2..f8d1266 100644
--- a/sc/source/ui/undo/undosort.cxx
+++ b/sc/source/ui/undo/undosort.cxx
@@ -68,7 +68,7 @@ void UndoSort::Execute( bool bUndo )
     if (!aParam.mbUpdateRefs)
         rDoc.BroadcastCells(aParam.maSortRange, SC_HINT_DATACHANGED);
 
-    pDocShell->PostPaint(maParam.maSortRange, PAINT_GRID);
+    pDocShell->PostPaint(maParam.maSortRange, PaintPartFlags::Grid);
     pDocShell->PostDataChanged();
 }
 
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index 71a6e18..aaf2541 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -178,7 +178,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
         }
     }
 
-    pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
+    pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
 
     //! undo/redo document modifications for deleted styles
     //! undo/redo modifications of number formatter
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 59bba80..7245cc9 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -366,7 +366,7 @@ void ScUndoDeleteTab::Undo()
     pSfxApp->Broadcast( SfxHint( SC_HINT_DBAREAS_CHANGED ) );
     pSfxApp->Broadcast( SfxHint( SC_HINT_AREALINKS_CHANGED ) );
 
-    pDocShell->PostPaint(0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_ALL );  // incl. extras
+    pDocShell->PostPaint(0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All );  // incl. extras
 
     // not ShowTable due to SetTabNo(..., sal_True):
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -813,7 +813,7 @@ void ScUndoMakeScenario::Undo()
 
     DoSdrUndoAction( pDrawUndo, &rDoc );
 
-    pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PAINT_ALL);
+    pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All);
     pDocShell->PostDataChanged();
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -901,7 +901,7 @@ void ScUndoImportTab::DoChange() const
 
     SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) );    // Navigator
     pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB,
-                                PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
+                                PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left | PaintPartFlags::Extras );
 }
 
 void ScUndoImportTab::Undo()
@@ -1329,7 +1329,7 @@ void ScUndoPrintRange::DoChange(bool bUndo)
 
     ScPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab ).UpdatePages();
 
-    pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PAINT_GRID );
+    pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PaintPartFlags::Grid );
 }
 
 void ScUndoPrintRange::Undo()
diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx
index 806e8ed..73157ea 100644
--- a/sc/source/ui/undo/undoutil.cxx
+++ b/sc/source/ui/undo/undoutil.cxx
@@ -108,7 +108,7 @@ void ScUndoUtil::PaintMore( ScDocShell* pDocShell,
     if (nRow2<MAXROW) ++nRow2;
 
     pDocShell->PostPaint( nCol1,nRow1,rRange.aStart.Tab(),
-                          nCol2,nRow2,rRange.aEnd.Tab(), PAINT_GRID );
+                          nCol2,nRow2,rRange.aEnd.Tab(), PaintPartFlags::Grid );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index d090955..509c04a 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1081,7 +1081,7 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r
     }
 
     for (size_t i = 0; i < nCount; ++i )
-        pDocShell->PostPaint( *rRanges[ i ], PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
+        pDocShell->PostPaint( *rRanges[ i ], PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
 
     pDocShell->SetDocumentModified();
 }
@@ -1220,7 +1220,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
     }
 
     if (!bHeight)
-        rDocShell.PostPaint( rRange, PAINT_GRID );      // AdjustRowHeight may have painted already
+        rDocShell.PostPaint( rRange, PaintPartFlags::Grid );      // AdjustRowHeight may have painted already
 
     rDocShell.SetDocumentModified();
 
@@ -1321,7 +1321,7 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
     }
 
     if (!bHeight)
-        rDocShell.PostPaint( rRange, PAINT_GRID );      // AdjustRowHeight may have painted already
+        rDocShell.PostPaint( rRange, PaintPartFlags::Grid );      // AdjustRowHeight may have painted already
 
     rDocShell.SetDocumentModified();
 
@@ -1812,7 +1812,7 @@ uno::Sequence<sal_Int8> SAL_CALL ScCellRangesBase::getImplementationId()
 void ScCellRangesBase::PaintGridRanges_Impl( )
 {
     for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
-        pDocShell->PostPaint( *aRanges[ i ], PAINT_GRID );
+        pDocShell->PostPaint( *aRanges[ i ], PaintPartFlags::Grid );
 }
 
 // XSheetOperation
@@ -2421,7 +2421,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
 
                                 // and repaint
                                 for (size_t i = 0; i < aRanges.size(); ++i)
-                                    pDocShell->PostPaint(*aRanges[i], PAINT_GRID);
+                                    pDocShell->PostPaint(*aRanges[i], PaintPartFlags::Grid);
                                 pDocShell->SetDocumentModified();
                             }
                         }
@@ -7125,7 +7125,7 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks() throw(uno::RuntimeExc
 
         //? UpdatePageBreakData( sal_True );
         pDocSh->SetDocumentModified();
-        pDocSh->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
+        pDocSh->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PaintPartFlags::Grid);
     }
 }
 
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index cdf794c..7377860 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -351,7 +351,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
             SCTAB nTabCount = rDoc.GetTableCount();
             for (SCTAB nTab=0; nTab<nTabCount; nTab++)
                 if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
-                    pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
+                    pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PaintPartFlags::Grid);
             pDocShell->SetDocumentModified();
         }
     }
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 0ce7823..6af4446 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -2011,7 +2011,7 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue(
                                      aRange.aStart.Tab(), ScMF::Auto );
             ScRange aPaintRange(aRange.aStart, aRange.aEnd);
             aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
-            pDocShell->PostPaint(aPaintRange, PAINT_GRID);
+            pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
         }
         else if (aPropertyName == SC_UNONAME_USEFLTCRT )
         {
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index dc2d2ed..41f3caa 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -101,7 +101,7 @@ void ScDocDefaultsObj::ItemsChanged()
     {
         //! if not in XML import, adjust row heights
 
-        pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PAINT_GRID);
+        pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PaintPartFlags::Grid);
     }
 }
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5800a43..a5ba537 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -461,13 +461,13 @@ ScSheetSaveData* ScModelObj::GetSheetSaveData()
 void ScModelObj::RepaintRange( const ScRange& rRange )
 {
     if (pDocShell)
-        pDocShell->PostPaint( rRange, PAINT_GRID );
+        pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
 }
 
 void ScModelObj::RepaintRange( const ScRangeList& rRange )
 {
     if (pDocShell)
-        pDocShell->PostPaint( rRange, PAINT_GRID );
+        pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
 }
 
 void ScModelObj::paintTile( VirtualDevice& rDevice,
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index ba00cd1..ffc5512 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -991,7 +991,7 @@ void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData )
                     rDoc.GetRowNameRangesRef() = xNewList;
 
                 rDoc.CompileColRowNameFormula();
-                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
+                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
                 pDocShell->SetDocumentModified();
 
                 //! Undo ?!?! (here and from dialog)
@@ -1113,7 +1113,7 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre
                 rDoc.GetRowNameRangesRef() = xNewList;
 
             rDoc.CompileColRowNameFormula();
-            pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
+            pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
             pDocShell->SetDocumentModified();
 
             //! Undo ?!?! (here and from dialog)
@@ -1147,7 +1147,7 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
                     rDoc.GetRowNameRangesRef() = xNewList;
 
                 rDoc.CompileColRowNameFormula();
-                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID );
+                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
                 pDocShell->SetDocumentModified();
                 bDone = true;
 
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 30a05ce..03679b6 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -749,7 +749,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
                 double nPPTY = aLogic.Y() / 1000.0;
                 Fraction aZoom(1,1);
                 rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
-                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
+                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
                 pDocShell->SetDocumentModified();
 
                 pStylePool->Remove( pStyle );
@@ -1092,7 +1092,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
 
                 if (!rDoc.IsImportingXML())
                 {
-                    pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
+                    pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
                     pDocShell->SetDocumentModified();
                 }
             }
@@ -1458,7 +1458,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
 
             if (!rDoc.IsImportingXML())
             {
-                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
+                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
                 pDocShell->SetDocumentModified();
             }
         }
@@ -1838,7 +1838,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt
 
             if (!rDoc.IsImportingXML())
             {
-                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
+                pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
                 pDocShell->SetDocumentModified();
             }
         }
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index d9051aa..8ac9cc6 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -435,7 +435,7 @@ void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode ) thro
                                     aRange.aStart.Tab(), ScMF::Auto );
         ScRange aPaintRange(aRange.aStart, aRange.aEnd);
         aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row());
-        pDocShell->PostPaint(aPaintRange, PAINT_GRID);
+        pDocShell->PostPaint(aPaintRange, PaintPartFlags::Grid);
     }
 }
 
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 82f3280..35c52e6 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -378,7 +378,7 @@ void ScDBFunc::ToggleAutoFilter()
                 pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | ScMF::Auto ) );
             }
             pDocSh->PostPaint(ScRange(aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab),
-                              PAINT_GRID);
+                              PaintPartFlags::Grid);
             bPaint = true;
         }
         else
@@ -430,7 +430,7 @@ void ScDBFunc::HideAutoFilter()
 
     pDBData->SetAutoFilter(false);
 
-    pDocSh->PostPaint(ScRange(nCol1, nRow1, nTab, nCol2, nRow1, nTab), PAINT_GRID );
+    pDocSh->PostPaint(ScRange(nCol1, nRow1, nTab, nCol2, nRow1, nTab), PaintPartFlags::Grid );
     aModificator.SetDocumentModified();
 
     SfxBindings& rBindings = GetViewData().GetBindings();
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index bb8dd9d..e8eccb1 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -519,7 +519,7 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord,
         MarkDataChanged();
 
         pDocSh->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab),
-                          PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE);
+                          PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size);
 
         aModificator.SetDocumentModified();
 
@@ -2219,7 +2219,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
 
         GetViewData().GetDocShell()->PostPaint(
             ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab),
-            PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE);
+            PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size);
     }
     else        // "no not execute any operations"
         ErrorMessage(STR_MSSG_REPEATDB_0);
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2f4776b..6e4338c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4926,16 +4926,16 @@ static void lcl_PaintOneRange( ScDocShell* pDocSh, const ScRange& rRange, sal_uI
     {
         // Only along the edges (The corners are hit twice)
         if ( nEdges & SCE_TOP )
-            pDocSh->PostPaint( nCol1, nRow1, nTab1, nCol2, nRow1, nTab2, PAINT_MARKS );
+            pDocSh->PostPaint( nCol1, nRow1, nTab1, nCol2, nRow1, nTab2, PaintPartFlags::Marks );
         if ( nEdges & SCE_LEFT )
-            pDocSh->PostPaint( nCol1, nRow1, nTab1, nCol1, nRow2, nTab2, PAINT_MARKS );
+            pDocSh->PostPaint( nCol1, nRow1, nTab1, nCol1, nRow2, nTab2, PaintPartFlags::Marks );
         if ( nEdges & SCE_RIGHT )
-            pDocSh->PostPaint( nCol2, nRow1, nTab1, nCol2, nRow2, nTab2, PAINT_MARKS );
+            pDocSh->PostPaint( nCol2, nRow1, nTab1, nCol2, nRow2, nTab2, PaintPartFlags::Marks );
         if ( nEdges & SCE_BOTTOM )
-            pDocSh->PostPaint( nCol1, nRow2, nTab1, nCol2, nRow2, nTab2, PAINT_MARKS );
+            pDocSh->PostPaint( nCol1, nRow2, nTab1, nCol2, nRow2, nTab2, PaintPartFlags::Marks );
     }
     else    // everything in one call
-        pDocSh->PostPaint( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, PAINT_MARKS );
+        pDocSh->PostPaint( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, PaintPartFlags::Marks );
 }
 
 static void lcl_PaintRefChanged( ScDocShell* pDocSh, const ScRange& rOldUn, const ScRange& rNewUn )
@@ -5595,7 +5595,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
                 }
 
                 // Broadcast for re-paint.
-                ScPaintHint aHint(ScRange(nCol, nRow, nTab), PAINT_GRID);
+                ScPaintHint aHint(ScRange(nCol, nRow, nTab), PaintPartFlags::Grid);
                 aHint.SetPrintFlag(false);
                 pDoc->GetDocumentShell()->Broadcast(aHint);
             }
diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx
index 9681f33..31f8208 100644
--- a/sc/source/ui/view/prevwsh2.cxx
+++ b/sc/source/ui/view/prevwsh2.cxx
@@ -30,12 +30,12 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
     bool bDataChanged = false;
 
-    if (dynamic_cast<const ScPaintHint*>(&rHint))
+    if (const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint))
     {
-        if ( static_cast<const ScPaintHint&>(rHint).GetPrintFlag() )
+        if ( pPaintHint->GetPrintFlag() )
         {
-            sal_uInt16 nParts = static_cast<const ScPaintHint&>(rHint).GetParts();
-            if (nParts & ( PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE ))
+            PaintPartFlags nParts = pPaintHint->GetParts();
+            if (nParts & ( PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size ))
                 bDataChanged = true;
         }
     }
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index a23fba0..300afff 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -2409,7 +2409,7 @@ bool ScPrintFunc::UpdatePages()
 
             //  set breaks
             ResetBreaks(nTab);
-            pDocShell->PostPaint(0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID);
+            pDocShell->PostPaint(0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid);
         }
 
     return true;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 22c7a96..b7e3e5c 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2171,7 +2171,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
     // #i80499# Overlays need updates in a lot of cases, e.g. changing row/column size,
     // or showing/hiding outlines. TODO: selections in inactive windows are vanishing.
     // #i84689# With relative conditional formats, PaintArea may be called often (for each changed cell),
-    // so UpdateAllOverlays was moved to ScTabViewShell::Notify and is called only if PAINT_LEFT/PAINT_TOP
+    // so UpdateAllOverlays was moved to ScTabViewShell::Notify and is called only if PaintPartFlags::Left/PaintPartFlags::Top
     // is set (width or height changed).
 }
 
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 6748fb5..855c6605 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -42,36 +42,35 @@
 
 void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
-    if (dynamic_cast<const ScPaintHint*>(&rHint))                    // neu zeichnen
+    if (const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint))                    // neu zeichnen
     {
-        const ScPaintHint* pHint = static_cast<const ScPaintHint*>(&rHint);
-        sal_uInt16 nParts = pHint->GetParts();
+        PaintPartFlags nParts = pPaintHint->GetParts();
         SCTAB nTab = GetViewData().GetTabNo();
-        if (pHint->GetStartTab() <= nTab && pHint->GetEndTab() >= nTab)
+        if (pPaintHint->GetStartTab() <= nTab && pPaintHint->GetEndTab() >= nTab)
         {
-            if (nParts & PAINT_EXTRAS)          // zuerst, falls Tabelle weg ist !!!
+            if (nParts & PaintPartFlags::Extras)          // zuerst, falls Tabelle weg ist !!!
                 if (PaintExtras())
-                    nParts = PAINT_ALL;
+                    nParts = PaintPartFlags::All;
 
             // if the current sheet has pending row height updates (sheet links refreshed),
             // execute them before invalidating the window
             GetViewData().GetDocShell()->UpdatePendingRowHeights( GetViewData().GetTabNo() );
 
-            if (nParts & PAINT_SIZE)
+            if (nParts & PaintPartFlags::Size)
                 RepeatResize();                     //! InvalidateBorder ???
-            if (nParts & PAINT_GRID)
-                PaintArea( pHint->GetStartCol(), pHint->GetStartRow(),
-                           pHint->GetEndCol(), pHint->GetEndRow() );
-            if (nParts & PAINT_MARKS)
-                PaintArea( pHint->GetStartCol(), pHint->GetStartRow(),
-                           pHint->GetEndCol(), pHint->GetEndRow(), SC_UPDATE_MARKS );
-            if (nParts & PAINT_LEFT)
-                PaintLeftArea( pHint->GetStartRow(), pHint->GetEndRow() );
-            if (nParts & PAINT_TOP)
-                PaintTopArea( pHint->GetStartCol(), pHint->GetEndCol() );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list