diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-03-30 20:53:08 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-03-31 13:23:03 +0200 |
commit | 77a5c97418112127ce8adb5aa902b7c5b7d8c3c3 (patch) | |
tree | f30a1986b851db30187d4604576be122bb75c75d | |
parent | eb20c5c707e12780008c3a87803324f516a935e0 (diff) |
tdf#84938 convert NA_ constants to scoped enum
Change-Id: Id348f202483d17b63c0762a60f8ddc5f01b8e01f
-rw-r--r-- | sw/source/core/inc/ftnboss.hxx | 13 | ||||
-rw-r--r-- | sw/source/core/layout/ftnfrm.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 38 |
3 files changed, 36 insertions, 37 deletions
diff --git a/sw/source/core/inc/ftnboss.hxx b/sw/source/core/inc/ftnboss.hxx index 2a61219801ce..9afe1a69aa1f 100644 --- a/sw/source/core/inc/ftnboss.hxx +++ b/sw/source/core/inc/ftnboss.hxx @@ -39,10 +39,9 @@ public: ~SwSaveFootnoteHeight(); }; -#define NA_ONLY_ADJUST 0 -#define NA_GROW_SHRINK 1 -#define NA_GROW_ADJUST 2 -#define NA_ADJUST_GROW 3 +enum class SwNeighbourAdjust { + OnlyAdjust, GrowShrink, GrowAdjust, AdjustGrow +}; typedef std::vector<SwFootnoteFrame*> SwFootnoteFrames; @@ -58,7 +57,7 @@ class SwFootnoteBossFrame: public SwLayoutFrame SwFootnoteContFrame *MakeFootnoteCont(); SwFootnoteFrame *FindFirstFootnote(); - sal_uInt8 _NeighbourhoodAdjustment( const SwFrame* pFrame ) const; + SwNeighbourAdjust _NeighbourhoodAdjustment( const SwFrame* pFrame ) const; protected: void InsertFootnote( SwFootnoteFrame * ); @@ -119,8 +118,8 @@ public: SwTextFootnote *pAttr ); // should AdjustNeighbourhood be called (or Grow/Shrink)? - sal_uInt8 NeighbourhoodAdjustment( const SwFrame* pFrame ) const - { return IsPageFrame() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrame ); } + SwNeighbourAdjust NeighbourhoodAdjustment( const SwFrame* pFrame ) const + { return IsPageFrame() ? SwNeighbourAdjust::OnlyAdjust : _NeighbourhoodAdjustment( pFrame ); } }; inline const SwLayoutFrame *SwFootnoteBossFrame::FindBodyCont() const diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 0a88a25c1e52..ca12b249004f 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -336,12 +336,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) nReal = 0; if ( nGrow > 0 ) { - sal_uInt8 nAdjust = pBoss->NeighbourhoodAdjustment( this ); - if( NA_ONLY_ADJUST == nAdjust ) + SwNeighbourAdjust nAdjust = pBoss->NeighbourhoodAdjustment( this ); + if( SwNeighbourAdjust::OnlyAdjust == nAdjust ) nReal = AdjustNeighbourhood( nGrow, bTst ); else { - if( NA_GROW_ADJUST == nAdjust ) + if( SwNeighbourAdjust::GrowAdjust == nAdjust ) { SwFrame* pFootnote = Lower(); if( pFootnote ) @@ -351,12 +351,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) if( static_cast<SwFootnoteFrame*>(pFootnote)->GetAttr()->GetFootnote().IsEndNote() ) { nReal = AdjustNeighbourhood( nGrow, bTst ); - nAdjust = NA_GROW_SHRINK; // no more AdjustNeighbourhood + nAdjust = SwNeighbourAdjust::GrowShrink; // no more AdjustNeighbourhood } } } nReal += pBoss->Grow( nGrow - nReal, bTst ); - if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust ) + if( ( SwNeighbourAdjust::GrowAdjust == nAdjust || SwNeighbourAdjust::AdjustGrow == nAdjust ) && nReal < nGrow ) nReal += AdjustNeighbourhood( nGrow - nReal, bTst ); } @@ -2495,27 +2495,27 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const * @see Grow() * @see Shrink() */ -sal_uInt8 SwFootnoteBossFrame::_NeighbourhoodAdjustment( const SwFrame* ) const +SwNeighbourAdjust SwFootnoteBossFrame::_NeighbourhoodAdjustment( const SwFrame* ) const { - sal_uInt8 nRet = NA_ONLY_ADJUST; + SwNeighbourAdjust nRet = SwNeighbourAdjust::OnlyAdjust; if( GetUpper() && !GetUpper()->IsPageBodyFrame() ) { // column sections need grow/shrink if( GetUpper()->IsFlyFrame() ) - nRet = NA_GROW_SHRINK; + nRet = SwNeighbourAdjust::GrowShrink; else { OSL_ENSURE( GetUpper()->IsSctFrame(), "NeighbourhoodAdjustment: Unexpected Upper" ); if( !GetNext() && !GetPrev() ) - nRet = NA_GROW_ADJUST; // section with a single column (FootnoteAtEnd) + nRet = SwNeighbourAdjust::GrowAdjust; // section with a single column (FootnoteAtEnd) else { const SwFrame* pTmp = Lower(); OSL_ENSURE( pTmp, "NeighbourhoodAdjustment: Missing Lower()" ); if( !pTmp->GetNext() ) - nRet = NA_GROW_SHRINK; + nRet = SwNeighbourAdjust::GrowShrink; else if( !GetUpper()->IsColLocked() ) - nRet = NA_ADJUST_GROW; + nRet = SwNeighbourAdjust::AdjustGrow; OSL_ENSURE( !pTmp->GetNext() || pTmp->GetNext()->IsFootnoteContFrame(), "NeighbourhoodAdjustment: Who's that guy?" ); } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index c7defeb2e285..530d78d1f35d 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -464,7 +464,7 @@ Size SwFrame::ChgSize( const Size& aNewSize ) if( nDiff ) { if ( GetUpper()->IsFootnoteBossFrame() && HasFixSize() && - NA_GROW_SHRINK != + SwNeighbourAdjust::GrowShrink != static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) ) { (maFrame.*fnRect->fnSetHeight)( nNew ); @@ -1076,20 +1076,20 @@ void SwLayoutFrame::Paste( SwFrame* pParent, SwFrame* pSibling) { // AdjustNeighbourhood is now also called in columns which are not // placed inside a frame - sal_uInt8 nAdjust = GetUpper()->IsFootnoteBossFrame() ? + SwNeighbourAdjust nAdjust = GetUpper()->IsFootnoteBossFrame() ? static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) - : NA_GROW_SHRINK; + : SwNeighbourAdjust::GrowShrink; SwTwips nGrow = (Frame().*fnRect->fnGetHeight)(); - if( NA_ONLY_ADJUST == nAdjust ) + if( SwNeighbourAdjust::OnlyAdjust == nAdjust ) AdjustNeighbourhood( nGrow ); else { SwTwips nReal = 0; - if( NA_ADJUST_GROW == nAdjust ) + if( SwNeighbourAdjust::AdjustGrow == nAdjust ) nReal = AdjustNeighbourhood( nGrow ); if( nReal < nGrow ) nReal += pParent->Grow( nGrow - nReal ); - if( NA_GROW_ADJUST == nAdjust && nReal < nGrow ) + if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nGrow ) AdjustNeighbourhood( nGrow - nReal ); } } @@ -1116,13 +1116,13 @@ void SwLayoutFrame::Cut() { if( pUp->IsFootnoteBossFrame() ) { - sal_uInt8 nAdjust= static_cast<SwFootnoteBossFrame*>(pUp)->NeighbourhoodAdjustment( this ); - if( NA_ONLY_ADJUST == nAdjust ) + SwNeighbourAdjust nAdjust= static_cast<SwFootnoteBossFrame*>(pUp)->NeighbourhoodAdjustment( this ); + if( SwNeighbourAdjust::OnlyAdjust == nAdjust ) AdjustNeighbourhood( -nShrink ); else { SwTwips nReal = 0; - if( NA_ADJUST_GROW == nAdjust ) + if( SwNeighbourAdjust::AdjustGrow == nAdjust ) nReal = -AdjustNeighbourhood( -nShrink ); if( nReal < nShrink ) { @@ -1131,7 +1131,7 @@ void SwLayoutFrame::Cut() nReal += pUp->Shrink( nShrink - nReal ); (Frame().*fnRect->fnSetHeight)( nOldHeight ); } - if( NA_GROW_ADJUST == nAdjust && nReal < nShrink ) + if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nShrink ) AdjustNeighbourhood( nReal - nShrink ); } RemoveFromLayout(); @@ -2241,14 +2241,14 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { if ( GetUpper() ) { // AdjustNeighbourhood now only for the columns (but not in frames) - sal_uInt8 nAdjust = GetUpper()->IsFootnoteBossFrame() ? + SwNeighbourAdjust nAdjust = GetUpper()->IsFootnoteBossFrame() ? static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) - : NA_GROW_SHRINK; - if( NA_ONLY_ADJUST == nAdjust ) + : SwNeighbourAdjust::GrowShrink; + if( SwNeighbourAdjust::OnlyAdjust == nAdjust ) nReal = AdjustNeighbourhood( nReal, bTst ); else { - if( NA_ADJUST_GROW == nAdjust ) + if( SwNeighbourAdjust::AdjustGrow == nAdjust ) nReal += AdjustNeighbourhood( nReal, bTst ); SwTwips nGrow = 0; @@ -2272,7 +2272,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) nGrow = pToGrow ? pToGrow->Grow( nReal, bTst, bInfo ) : 0; } - if( NA_GROW_ADJUST == nAdjust && nGrow < nReal ) + if( SwNeighbourAdjust::GrowAdjust == nAdjust && nGrow < nReal ) nReal += AdjustNeighbourhood( nReal - nGrow, bTst ); if ( IsFootnoteFrame() && (nGrow != nReal) && GetNext() ) @@ -2417,12 +2417,12 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) bMoveAccFrame = true; } - sal_uInt8 nAdjust = GetUpper() && GetUpper()->IsFootnoteBossFrame() ? + SwNeighbourAdjust nAdjust = GetUpper() && GetUpper()->IsFootnoteBossFrame() ? static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) - : NA_GROW_SHRINK; + : SwNeighbourAdjust::GrowShrink; // AdjustNeighbourhood also in columns (but not in frames) - if( NA_ONLY_ADJUST == nAdjust ) + if( SwNeighbourAdjust::OnlyAdjust == nAdjust ) { if ( IsPageBodyFrame() && !bBrowse ) nReal = nDist; @@ -2465,7 +2465,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) } nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0; - if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust ) + if( ( SwNeighbourAdjust::GrowAdjust == nAdjust || SwNeighbourAdjust::AdjustGrow == nAdjust ) && nReal < nShrink ) AdjustNeighbourhood( nReal - nShrink ); } |