Kaydet (Commit) 77a5c974 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

tdf#84938 convert NA_ constants to scoped enum

Change-Id: Id348f202483d17b63c0762a60f8ddc5f01b8e01f
üst eb20c5c7
...@@ -39,10 +39,9 @@ public: ...@@ -39,10 +39,9 @@ public:
~SwSaveFootnoteHeight(); ~SwSaveFootnoteHeight();
}; };
#define NA_ONLY_ADJUST 0 enum class SwNeighbourAdjust {
#define NA_GROW_SHRINK 1 OnlyAdjust, GrowShrink, GrowAdjust, AdjustGrow
#define NA_GROW_ADJUST 2 };
#define NA_ADJUST_GROW 3
typedef std::vector<SwFootnoteFrame*> SwFootnoteFrames; typedef std::vector<SwFootnoteFrame*> SwFootnoteFrames;
...@@ -58,7 +57,7 @@ class SwFootnoteBossFrame: public SwLayoutFrame ...@@ -58,7 +57,7 @@ class SwFootnoteBossFrame: public SwLayoutFrame
SwFootnoteContFrame *MakeFootnoteCont(); SwFootnoteContFrame *MakeFootnoteCont();
SwFootnoteFrame *FindFirstFootnote(); SwFootnoteFrame *FindFirstFootnote();
sal_uInt8 _NeighbourhoodAdjustment( const SwFrame* pFrame ) const; SwNeighbourAdjust _NeighbourhoodAdjustment( const SwFrame* pFrame ) const;
protected: protected:
void InsertFootnote( SwFootnoteFrame * ); void InsertFootnote( SwFootnoteFrame * );
...@@ -119,8 +118,8 @@ public: ...@@ -119,8 +118,8 @@ public:
SwTextFootnote *pAttr ); SwTextFootnote *pAttr );
// should AdjustNeighbourhood be called (or Grow/Shrink)? // should AdjustNeighbourhood be called (or Grow/Shrink)?
sal_uInt8 NeighbourhoodAdjustment( const SwFrame* pFrame ) const SwNeighbourAdjust NeighbourhoodAdjustment( const SwFrame* pFrame ) const
{ return IsPageFrame() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrame ); } { return IsPageFrame() ? SwNeighbourAdjust::OnlyAdjust : _NeighbourhoodAdjustment( pFrame ); }
}; };
inline const SwLayoutFrame *SwFootnoteBossFrame::FindBodyCont() const inline const SwLayoutFrame *SwFootnoteBossFrame::FindBodyCont() const
......
...@@ -336,12 +336,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) ...@@ -336,12 +336,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool )
nReal = 0; nReal = 0;
if ( nGrow > 0 ) if ( nGrow > 0 )
{ {
sal_uInt8 nAdjust = pBoss->NeighbourhoodAdjustment( this ); SwNeighbourAdjust nAdjust = pBoss->NeighbourhoodAdjustment( this );
if( NA_ONLY_ADJUST == nAdjust ) if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
nReal = AdjustNeighbourhood( nGrow, bTst ); nReal = AdjustNeighbourhood( nGrow, bTst );
else else
{ {
if( NA_GROW_ADJUST == nAdjust ) if( SwNeighbourAdjust::GrowAdjust == nAdjust )
{ {
SwFrame* pFootnote = Lower(); SwFrame* pFootnote = Lower();
if( pFootnote ) if( pFootnote )
...@@ -351,12 +351,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) ...@@ -351,12 +351,12 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool )
if( static_cast<SwFootnoteFrame*>(pFootnote)->GetAttr()->GetFootnote().IsEndNote() ) if( static_cast<SwFootnoteFrame*>(pFootnote)->GetAttr()->GetFootnote().IsEndNote() )
{ {
nReal = AdjustNeighbourhood( nGrow, bTst ); nReal = AdjustNeighbourhood( nGrow, bTst );
nAdjust = NA_GROW_SHRINK; // no more AdjustNeighbourhood nAdjust = SwNeighbourAdjust::GrowShrink; // no more AdjustNeighbourhood
} }
} }
} }
nReal += pBoss->Grow( nGrow - nReal, bTst ); 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 < nGrow )
nReal += AdjustNeighbourhood( nGrow - nReal, bTst ); nReal += AdjustNeighbourhood( nGrow - nReal, bTst );
} }
...@@ -2495,27 +2495,27 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const ...@@ -2495,27 +2495,27 @@ SwTwips SwFootnoteBossFrame::GetVarSpace() const
* @see Grow() * @see Grow()
* @see Shrink() * @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() ) if( GetUpper() && !GetUpper()->IsPageBodyFrame() )
{ {
// column sections need grow/shrink // column sections need grow/shrink
if( GetUpper()->IsFlyFrame() ) if( GetUpper()->IsFlyFrame() )
nRet = NA_GROW_SHRINK; nRet = SwNeighbourAdjust::GrowShrink;
else else
{ {
OSL_ENSURE( GetUpper()->IsSctFrame(), "NeighbourhoodAdjustment: Unexpected Upper" ); OSL_ENSURE( GetUpper()->IsSctFrame(), "NeighbourhoodAdjustment: Unexpected Upper" );
if( !GetNext() && !GetPrev() ) if( !GetNext() && !GetPrev() )
nRet = NA_GROW_ADJUST; // section with a single column (FootnoteAtEnd) nRet = SwNeighbourAdjust::GrowAdjust; // section with a single column (FootnoteAtEnd)
else else
{ {
const SwFrame* pTmp = Lower(); const SwFrame* pTmp = Lower();
OSL_ENSURE( pTmp, "NeighbourhoodAdjustment: Missing Lower()" ); OSL_ENSURE( pTmp, "NeighbourhoodAdjustment: Missing Lower()" );
if( !pTmp->GetNext() ) if( !pTmp->GetNext() )
nRet = NA_GROW_SHRINK; nRet = SwNeighbourAdjust::GrowShrink;
else if( !GetUpper()->IsColLocked() ) else if( !GetUpper()->IsColLocked() )
nRet = NA_ADJUST_GROW; nRet = SwNeighbourAdjust::AdjustGrow;
OSL_ENSURE( !pTmp->GetNext() || pTmp->GetNext()->IsFootnoteContFrame(), OSL_ENSURE( !pTmp->GetNext() || pTmp->GetNext()->IsFootnoteContFrame(),
"NeighbourhoodAdjustment: Who's that guy?" ); "NeighbourhoodAdjustment: Who's that guy?" );
} }
......
...@@ -464,7 +464,7 @@ Size SwFrame::ChgSize( const Size& aNewSize ) ...@@ -464,7 +464,7 @@ Size SwFrame::ChgSize( const Size& aNewSize )
if( nDiff ) if( nDiff )
{ {
if ( GetUpper()->IsFootnoteBossFrame() && HasFixSize() && if ( GetUpper()->IsFootnoteBossFrame() && HasFixSize() &&
NA_GROW_SHRINK != SwNeighbourAdjust::GrowShrink !=
static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) ) static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) )
{ {
(maFrame.*fnRect->fnSetHeight)( nNew ); (maFrame.*fnRect->fnSetHeight)( nNew );
...@@ -1076,20 +1076,20 @@ void SwLayoutFrame::Paste( SwFrame* pParent, SwFrame* pSibling) ...@@ -1076,20 +1076,20 @@ void SwLayoutFrame::Paste( SwFrame* pParent, SwFrame* pSibling)
{ {
// AdjustNeighbourhood is now also called in columns which are not // AdjustNeighbourhood is now also called in columns which are not
// placed inside a frame // placed inside a frame
sal_uInt8 nAdjust = GetUpper()->IsFootnoteBossFrame() ? SwNeighbourAdjust nAdjust = GetUpper()->IsFootnoteBossFrame() ?
static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this )
: NA_GROW_SHRINK; : SwNeighbourAdjust::GrowShrink;
SwTwips nGrow = (Frame().*fnRect->fnGetHeight)(); SwTwips nGrow = (Frame().*fnRect->fnGetHeight)();
if( NA_ONLY_ADJUST == nAdjust ) if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
AdjustNeighbourhood( nGrow ); AdjustNeighbourhood( nGrow );
else else
{ {
SwTwips nReal = 0; SwTwips nReal = 0;
if( NA_ADJUST_GROW == nAdjust ) if( SwNeighbourAdjust::AdjustGrow == nAdjust )
nReal = AdjustNeighbourhood( nGrow ); nReal = AdjustNeighbourhood( nGrow );
if( nReal < nGrow ) if( nReal < nGrow )
nReal += pParent->Grow( nGrow - nReal ); nReal += pParent->Grow( nGrow - nReal );
if( NA_GROW_ADJUST == nAdjust && nReal < nGrow ) if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nGrow )
AdjustNeighbourhood( nGrow - nReal ); AdjustNeighbourhood( nGrow - nReal );
} }
} }
...@@ -1116,13 +1116,13 @@ void SwLayoutFrame::Cut() ...@@ -1116,13 +1116,13 @@ void SwLayoutFrame::Cut()
{ {
if( pUp->IsFootnoteBossFrame() ) if( pUp->IsFootnoteBossFrame() )
{ {
sal_uInt8 nAdjust= static_cast<SwFootnoteBossFrame*>(pUp)->NeighbourhoodAdjustment( this ); SwNeighbourAdjust nAdjust= static_cast<SwFootnoteBossFrame*>(pUp)->NeighbourhoodAdjustment( this );
if( NA_ONLY_ADJUST == nAdjust ) if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
AdjustNeighbourhood( -nShrink ); AdjustNeighbourhood( -nShrink );
else else
{ {
SwTwips nReal = 0; SwTwips nReal = 0;
if( NA_ADJUST_GROW == nAdjust ) if( SwNeighbourAdjust::AdjustGrow == nAdjust )
nReal = -AdjustNeighbourhood( -nShrink ); nReal = -AdjustNeighbourhood( -nShrink );
if( nReal < nShrink ) if( nReal < nShrink )
{ {
...@@ -1131,7 +1131,7 @@ void SwLayoutFrame::Cut() ...@@ -1131,7 +1131,7 @@ void SwLayoutFrame::Cut()
nReal += pUp->Shrink( nShrink - nReal ); nReal += pUp->Shrink( nShrink - nReal );
(Frame().*fnRect->fnSetHeight)( nOldHeight ); (Frame().*fnRect->fnSetHeight)( nOldHeight );
} }
if( NA_GROW_ADJUST == nAdjust && nReal < nShrink ) if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nShrink )
AdjustNeighbourhood( nReal - nShrink ); AdjustNeighbourhood( nReal - nShrink );
} }
RemoveFromLayout(); RemoveFromLayout();
...@@ -2241,14 +2241,14 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) ...@@ -2241,14 +2241,14 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
{ {
if ( GetUpper() ) if ( GetUpper() )
{ // AdjustNeighbourhood now only for the columns (but not in frames) { // 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 ) static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this )
: NA_GROW_SHRINK; : SwNeighbourAdjust::GrowShrink;
if( NA_ONLY_ADJUST == nAdjust ) if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
nReal = AdjustNeighbourhood( nReal, bTst ); nReal = AdjustNeighbourhood( nReal, bTst );
else else
{ {
if( NA_ADJUST_GROW == nAdjust ) if( SwNeighbourAdjust::AdjustGrow == nAdjust )
nReal += AdjustNeighbourhood( nReal, bTst ); nReal += AdjustNeighbourhood( nReal, bTst );
SwTwips nGrow = 0; SwTwips nGrow = 0;
...@@ -2272,7 +2272,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) ...@@ -2272,7 +2272,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
nGrow = pToGrow ? pToGrow->Grow( nReal, bTst, bInfo ) : 0; 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 ); nReal += AdjustNeighbourhood( nReal - nGrow, bTst );
if ( IsFootnoteFrame() && (nGrow != nReal) && GetNext() ) if ( IsFootnoteFrame() && (nGrow != nReal) && GetNext() )
...@@ -2417,12 +2417,12 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) ...@@ -2417,12 +2417,12 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
bMoveAccFrame = true; bMoveAccFrame = true;
} }
sal_uInt8 nAdjust = GetUpper() && GetUpper()->IsFootnoteBossFrame() ? SwNeighbourAdjust nAdjust = GetUpper() && GetUpper()->IsFootnoteBossFrame() ?
static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this ) static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment( this )
: NA_GROW_SHRINK; : SwNeighbourAdjust::GrowShrink;
// AdjustNeighbourhood also in columns (but not in frames) // AdjustNeighbourhood also in columns (but not in frames)
if( NA_ONLY_ADJUST == nAdjust ) if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
{ {
if ( IsPageBodyFrame() && !bBrowse ) if ( IsPageBodyFrame() && !bBrowse )
nReal = nDist; nReal = nDist;
...@@ -2465,7 +2465,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) ...@@ -2465,7 +2465,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
} }
nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0; 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 ) && nReal < nShrink )
AdjustNeighbourhood( nReal - nShrink ); AdjustNeighbourhood( nReal - nShrink );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment