summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-03-30 20:01:57 +0200
committerNoel Grandin <noel@peralex.com>2016-03-31 13:23:03 +0200
commit0c536453950c21b066478daa93ba69d4ac83a5de (patch)
treeacb2d0cd4454bbb16ce99495c560712017a379d9
parent8d463bbf6ac7f76054924c1f35a71ffa4bdd4c96 (diff)
tdf#84938 convert INV_ constants to scoped enum
Change-Id: I587d8ae6510aa5e464214c05a5da9e5e2e0b7228
-rw-r--r--sw/source/core/doc/DocumentDeviceManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx4
-rw-r--r--sw/source/core/doc/lineinfo.cxx4
-rw-r--r--sw/source/core/inc/rootfrm.hxx26
-rw-r--r--sw/source/core/layout/dumpfilter.cxx2
-rw-r--r--sw/source/core/layout/wsfrm.cxx46
-rw-r--r--sw/source/core/view/viewsh.cxx24
7 files changed, 58 insertions, 50 deletions
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index 38b57b942a32..e6bc91d264cb 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -339,7 +339,7 @@ void DocumentDeviceManager::PrtDataChanged()
pFntCache->Flush();
for(SwRootFrame* aLayout : m_rDoc.GetAllLayouts())
- aLayout->InvalidateAllContent(INV_SIZE);
+ aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
for(SwViewShell& rShell : pSh->GetRingContainer())
rShell.InitPrt(getPrinter(false));
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 5a32cc431fcc..b2d251c07c72 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -435,7 +435,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLan
{
pTmpRoot->StartAllAction();
for(SwRootFrame* aLayout : m_rDoc.GetAllLayouts())
- aLayout->InvalidateAllContent(INV_SIZE);
+ aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
pTmpRoot->EndAllAction();
}
m_rDoc.getIDocumentState().SetModified();
@@ -505,7 +505,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp
{
pTmpRoot->StartAllAction();
for( auto aLayout : m_rDoc.GetAllLayouts() )
- aLayout->InvalidateAllContent(INV_SIZE);
+ aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
pTmpRoot->EndAllAction();
}
m_rDoc.getIDocumentState().SetModified();
diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx
index 0b73cbac9b3d..4839a3cd70fc 100644
--- a/sw/source/core/doc/lineinfo.cxx
+++ b/sw/source/core/doc/lineinfo.cxx
@@ -38,9 +38,9 @@ void SwDoc::SetLineNumberInfo( const SwLineNumberInfo &rNew )
pTmpRoot->StartAllAction();
// FME 2007-08-14 #i80120# Invalidate size, because ChgThisLines()
// is only (and may only be) called by the formatting routines
- //pTmpRoot->InvalidateAllContent( INV_LINENUM | INV_SIZE );
+ //pTmpRoot->InvalidateAllContent( SwInvalidateFlags::LineNum | SwInvalidateFlags::Size );
for( auto aLayout : GetAllLayouts() )
- aLayout->InvalidateAllContent( INV_LINENUM | INV_SIZE );
+ aLayout->InvalidateAllContent( SwInvalidateFlags::LineNum | SwInvalidateFlags::Size );
pTmpRoot->EndAllAction();
}
*mpLineNumberInfo = rNew;
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index d30b8b160f81..1da4f8a93902 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -23,6 +23,8 @@
#include <viewsh.hxx>
#include <doc.hxx>
#include <IDocumentTimerAccess.hxx>
+#include <o3tl/typed_flags_set.hxx>
+#include <vector>
class SwContentFrame;
class SwViewShell;
@@ -40,15 +42,21 @@ class SwSelectionList;
struct SwPosition;
struct SwCursorMoveState;
-#define INV_SIZE 1
-#define INV_PRTAREA 2
-#define INV_POS 4
-#define INV_TABLE 8
-#define INV_SECTION 16
-#define INV_LINENUM 32
-#define INV_DIRECTION 64
+enum class SwInvalidateFlags
+{
+ Size = 0x01,
+ PrtArea = 0x02,
+ Pos = 0x04,
+ Table = 0x08,
+ Section = 0x10,
+ LineNum = 0x20,
+ Direction = 0x40,
+};
-#include <vector>
+namespace o3tl
+{
+ template<> struct typed_flags<SwInvalidateFlags> : is_typed_flags<SwInvalidateFlags, 0x7f> {};
+};
/// The root element of a Writer document layout.
class SwRootFrame: public SwLayoutFrame
@@ -254,7 +262,7 @@ public:
static void AssertPageFlys( SwPageFrame * );
/// Invalidate all Content, Size or PrtArea
- void InvalidateAllContent( sal_uInt8 nInvalidate );
+ void InvalidateAllContent( SwInvalidateFlags nInvalidate );
/**
* Invalidate/re-calculate the position of all floating
diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx
index 36d28c7d4403..e0c0649bcba6 100644
--- a/sw/source/core/layout/dumpfilter.cxx
+++ b/sw/source/core/layout/dumpfilter.cxx
@@ -99,7 +99,7 @@ namespace sw
pXDoc->GetDocShell()->GetWrtShell()->StartAction();
Rectangle aRect( 0, 0, 26000, 21000 );
pXDoc->GetDocShell()->SetVisArea( aRect );
- pLayout->InvalidateAllContent( INV_SIZE );
+ pLayout->InvalidateAllContent( SwInvalidateFlags::Size );
pXDoc->GetDocShell()->GetWrtShell()->EndAction();
// Dump the layout XML into the XOutputStream
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index a46ba4c3537f..c7defeb2e285 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -3556,7 +3556,7 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs,
}
}
-static SwContentFrame* lcl_InvalidateSection( SwFrame *pCnt, sal_uInt8 nInv )
+static SwContentFrame* lcl_InvalidateSection( SwFrame *pCnt, SwInvalidateFlags nInv )
{
SwSectionFrame* pSect = pCnt->FindSctFrame();
// If our ContentFrame is placed inside a table or a footnote, only sections
@@ -3565,11 +3565,11 @@ static SwContentFrame* lcl_InvalidateSection( SwFrame *pCnt, sal_uInt8 nInv )
if( ( ( pCnt->IsInTab() && !pSect->IsInTab() ) ||
( pCnt->IsInFootnote() && !pSect->IsInFootnote() ) ) && !pCnt->IsTabFrame() )
return nullptr;
- if( nInv & INV_SIZE )
+ if( nInv & SwInvalidateFlags::Size )
pSect->_InvalidateSize();
- if( nInv & INV_POS )
+ if( nInv & SwInvalidateFlags::Pos )
pSect->_InvalidatePos();
- if( nInv & INV_PRTAREA )
+ if( nInv & SwInvalidateFlags::PrtArea )
pSect->_InvalidatePrt();
SwFlowFrame *pFoll = pSect->GetFollow();
// Temporary separation from follow
@@ -3579,28 +3579,28 @@ static SwContentFrame* lcl_InvalidateSection( SwFrame *pCnt, sal_uInt8 nInv )
return pRet;
}
-static SwContentFrame* lcl_InvalidateTable( SwTabFrame *pTable, sal_uInt8 nInv )
+static SwContentFrame* lcl_InvalidateTable( SwTabFrame *pTable, SwInvalidateFlags nInv )
{
- if( ( nInv & INV_SECTION ) && pTable->IsInSct() )
+ if( ( nInv & SwInvalidateFlags::Section ) && pTable->IsInSct() )
lcl_InvalidateSection( pTable, nInv );
- if( nInv & INV_SIZE )
+ if( nInv & SwInvalidateFlags::Size )
pTable->_InvalidateSize();
- if( nInv & INV_POS )
+ if( nInv & SwInvalidateFlags::Pos )
pTable->_InvalidatePos();
- if( nInv & INV_PRTAREA )
+ if( nInv & SwInvalidateFlags::PrtArea )
pTable->_InvalidatePrt();
return pTable->FindLastContent();
}
-static void lcl_InvalidateAllContent( SwContentFrame *pCnt, sal_uInt8 nInv );
+static void lcl_InvalidateAllContent( SwContentFrame *pCnt, SwInvalidateFlags nInv );
-static void lcl_InvalidateContent( SwContentFrame *pCnt, sal_uInt8 nInv )
+static void lcl_InvalidateContent( SwContentFrame *pCnt, SwInvalidateFlags nInv )
{
SwContentFrame *pLastTabCnt = nullptr;
SwContentFrame *pLastSctCnt = nullptr;
while ( pCnt )
{
- if( nInv & INV_SECTION )
+ if( nInv & SwInvalidateFlags::Section )
{
if( pCnt->IsInSct() )
{
@@ -3615,7 +3615,7 @@ static void lcl_InvalidateContent( SwContentFrame *pCnt, sal_uInt8 nInv )
OSL_ENSURE( !pLastSctCnt, "Where's the last SctContent?" );
#endif
}
- if( nInv & INV_TABLE )
+ if( nInv & SwInvalidateFlags::Table )
{
if( pCnt->IsInTab() )
{
@@ -3643,13 +3643,13 @@ static void lcl_InvalidateContent( SwContentFrame *pCnt, sal_uInt8 nInv )
#endif
}
- if( nInv & INV_SIZE )
+ if( nInv & SwInvalidateFlags::Size )
pCnt->Prepare( PREP_CLEAR, nullptr, false );
- if( nInv & INV_POS )
+ if( nInv & SwInvalidateFlags::Pos )
pCnt->_InvalidatePos();
- if( nInv & INV_PRTAREA )
+ if( nInv & SwInvalidateFlags::PrtArea )
pCnt->_InvalidatePrt();
- if ( nInv & INV_LINENUM )
+ if ( nInv & SwInvalidateFlags::LineNum )
pCnt->InvalidateLineNum();
if ( pCnt->GetDrawObjs() )
lcl_InvalidateAllContent( pCnt, nInv );
@@ -3657,7 +3657,7 @@ static void lcl_InvalidateContent( SwContentFrame *pCnt, sal_uInt8 nInv )
}
}
-static void lcl_InvalidateAllContent( SwContentFrame *pCnt, sal_uInt8 nInv )
+static void lcl_InvalidateAllContent( SwContentFrame *pCnt, SwInvalidateFlags nInv )
{
SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
for ( size_t i = 0; i < rObjs.size(); ++i )
@@ -3669,14 +3669,14 @@ static void lcl_InvalidateAllContent( SwContentFrame *pCnt, sal_uInt8 nInv )
if ( pFly->IsFlyInContentFrame() )
{
::lcl_InvalidateContent( pFly->ContainsContent(), nInv );
- if( nInv & INV_DIRECTION )
+ if( nInv & SwInvalidateFlags::Direction )
pFly->CheckDirChange();
}
}
}
}
-void SwRootFrame::InvalidateAllContent( sal_uInt8 nInv )
+void SwRootFrame::InvalidateAllContent( SwInvalidateFlags nInv )
{
// First process all page bound FlyFrames.
SwPageFrame *pPage = static_cast<SwPageFrame*>(Lower());
@@ -3699,12 +3699,12 @@ void SwRootFrame::InvalidateAllContent( sal_uInt8 nInv )
{
SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
::lcl_InvalidateContent( pFly->ContainsContent(), nInv );
- if ( nInv & INV_DIRECTION )
+ if ( nInv & SwInvalidateFlags::Direction )
pFly->CheckDirChange();
}
}
}
- if( nInv & INV_DIRECTION )
+ if( nInv & SwInvalidateFlags::Direction )
pPage->CheckDirChange();
pPage = static_cast<SwPageFrame*>(pPage->GetNext());
}
@@ -3712,7 +3712,7 @@ void SwRootFrame::InvalidateAllContent( sal_uInt8 nInv )
//Invalidate the whole document content and the character bound Flys here.
::lcl_InvalidateContent( ContainsContent(), nInv );
- if( nInv & INV_PRTAREA )
+ if( nInv & SwInvalidateFlags::PrtArea )
{
SwViewShell *pSh = getRootFrame()->GetCurrShell();
if( pSh )
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index bd77cc8736df..bf4152661553 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -720,7 +720,7 @@ void SwViewShell::LayoutIdle()
}
}
-static void lcl_InvalidateAllContent( SwViewShell& rSh, sal_uInt8 nInv )
+static void lcl_InvalidateAllContent( SwViewShell& rSh, SwInvalidateFlags nInv )
{
bool bCursor = dynamic_cast<const SwCursorShell*>( &rSh) != nullptr;
if ( bCursor )
@@ -765,7 +765,7 @@ void SwViewShell::SetParaSpaceMax( bool bNew )
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::PARA_SPACE_MAX, bNew );
- const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Table | SwInvalidateFlags::Section;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -777,7 +777,7 @@ void SwViewShell::SetParaSpaceMaxAtPages( bool bNew )
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bNew );
- const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Table | SwInvalidateFlags::Section;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -789,7 +789,7 @@ void SwViewShell::SetTabCompat( bool bNew )
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::TAB_COMPAT, bNew );
- const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Size | SwInvalidateFlags::Table | SwInvalidateFlags::Section;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -804,7 +804,7 @@ void SwViewShell::SetAddExtLeading( bool bNew )
SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess().GetDrawModel();
if ( pTmpDrawModel )
pTmpDrawModel->SetAddExtLeading( bNew );
- const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Size | SwInvalidateFlags::Table | SwInvalidateFlags::Section;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -832,7 +832,7 @@ void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCel
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
- const sal_uInt8 nInv = INV_PRTAREA;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -849,7 +849,7 @@ void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing )
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing );
- const sal_uInt8 nInv = INV_PRTAREA;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -889,7 +889,7 @@ void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping )
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping );
- const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Size | SwInvalidateFlags::Table | SwInvalidateFlags::Section;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -902,7 +902,7 @@ void SwViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesW
{
SwWait aWait( *GetDoc()->GetDocShell(), true );
rIDSA.set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak );
- const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
+ const SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Size | SwInvalidateFlags::Table | SwInvalidateFlags::Section;
lcl_InvalidateAllContent( *this, nInv );
}
}
@@ -919,7 +919,7 @@ void SwViewShell::Reformat()
if( GetLayout()->IsCallbackActionEnabled() )
{
StartAction();
- GetLayout()->InvalidateAllContent( INV_SIZE | INV_POS | INV_PRTAREA );
+ GetLayout()->InvalidateAllContent( SwInvalidateFlags::Size | SwInvalidateFlags::Pos | SwInvalidateFlags::PrtArea );
EndAction();
}
}
@@ -1979,11 +1979,11 @@ void SwViewShell::InvalidateLayout( bool bSizeChanged )
// When the size ratios in browse mode change,
// the Position and PrtArea of the Content and Tab frames must be Invalidated.
- sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_POS;
+ SwInvalidateFlags nInv = SwInvalidateFlags::PrtArea | SwInvalidateFlags::Table | SwInvalidateFlags::Pos;
// In case of layout or mode change, the ContentFrames need a size-Invalidate
// because of printer/screen formatting.
if ( bSizeChanged )
- nInv |= INV_SIZE | INV_DIRECTION;
+ nInv |= SwInvalidateFlags::Size | SwInvalidateFlags::Direction;
GetLayout()->InvalidateAllContent( nInv );