Kaydet (Commit) 53a066b7 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Replace SWAP_IF_[NOT_]SWAPPED/UNDO_SWAP with RAII classes

Change-Id: I3c2c1dd8221b6b9c884f368a65696318c698bb43
üst efc64511
......@@ -779,25 +779,42 @@ inline void SwTextFrm::ResetBlinkPor() const
const_cast<SwTextFrm*>(this)->bBlinkPor = false;
}
#define SWAP_IF_SWAPPED( pFrm )\
bool bUndoSwap = false; \
if ( pFrm->IsVertical() && pFrm->IsSwapped() )\
{ \
bUndoSwap = true; \
const_cast<SwTextFrm*>(pFrm)->SwapWidthAndHeight(); \
class TemporarySwap {
protected:
explicit TemporarySwap(SwTextFrm * frame, bool swap):
frame_(frame), undo_(false)
{
if (frame_->IsVertical() && swap) {
undo_ = true;
frame_->SwapWidthAndHeight();
}
}
#define SWAP_IF_NOT_SWAPPED( pFrm )\
bool bUndoSwap = false; \
if ( pFrm->IsVertical() && ! pFrm->IsSwapped() )\
{ \
bUndoSwap = true; \
const_cast<SwTextFrm*>(pFrm)->SwapWidthAndHeight(); \
~TemporarySwap() {
if (undo_) {
frame_->SwapWidthAndHeight();
}
}
#define UNDO_SWAP( pFrm )\
if ( bUndoSwap )\
const_cast<SwTextFrm*>(pFrm)->SwapWidthAndHeight();
private:
TemporarySwap(TemporarySwap &) = delete;
void operator =(TemporarySwap &) = delete;
SwTextFrm * frame_;
bool undo_;
};
class SWAP_IF_SWAPPED: private TemporarySwap {
public:
explicit SWAP_IF_SWAPPED(SwTextFrm * frame):
TemporarySwap(frame, frame->IsSwapped()) {}
};
class SWAP_IF_NOT_SWAPPED: private TemporarySwap {
public:
explicit SWAP_IF_NOT_SWAPPED(SwTextFrm * frame):
TemporarySwap(frame, !frame->IsSwapped()) {}
};
/**
* Helper class which can be used instead of the macros if a function
......
......@@ -79,7 +79,7 @@ void ValidateText( SwFrm *pFrm ) // Friend of frame
void SwTextFrm::ValidateFrm()
{
// Validate surroundings to avoid oscillation
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED( this );
if ( !IsInFly() && !IsInTab() )
{ // Only validate 'this' when inside a fly, the rest should actually only be
......@@ -106,8 +106,6 @@ void SwTextFrm::ValidateFrm()
const bool bMustFit = pPara->IsPrepMustFit();
ResetPreps();
pPara->SetPrepMustFit( bMustFit );
UNDO_SWAP( this )
}
// After a RemoveFootnote the BodyFrm and all Frms contained within it, need to be
......@@ -134,19 +132,17 @@ void _ValidateBodyFrm( SwFrm *pFrm )
void SwTextFrm::ValidateBodyFrm()
{
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED( this );
// See comment in ValidateFrm()
if ( !IsInFly() && !IsInTab() &&
!( IsInSct() && FindSctFrm()->Lower()->IsColumnFrm() ) )
_ValidateBodyFrm( GetUpper() );
UNDO_SWAP( this )
}
bool SwTextFrm::_GetDropRect( SwRect &rRect ) const
{
SWAP_IF_NOT_SWAPPED( this )
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(this));
OSL_ENSURE( HasPara(), "SwTextFrm::_GetDropRect: try again next year." );
SwTextSizeInfo aInf( const_cast<SwTextFrm*>(this) );
......@@ -163,12 +159,9 @@ bool SwTextFrm::_GetDropRect( SwRect &rRect ) const
if ( IsVertical() )
SwitchHorizontalToVertical( rRect );
UNDO_SWAP( this )
return true;
}
UNDO_SWAP( this )
return false;
}
......@@ -186,7 +179,7 @@ const SwBodyFrm *SwTextFrm::FindBodyFrm() const
bool SwTextFrm::CalcFollow( const sal_Int32 nTextOfst )
{
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED( this );
OSL_ENSURE( HasFollow(), "CalcFollow: missing Follow." );
......@@ -338,13 +331,10 @@ bool SwTextFrm::CalcFollow( const sal_Int32 nTextOfst )
nMyPos - Frm().Right() :
Frm().Top() - nMyPos ) )
{
UNDO_SWAP( this )
return true;
}
}
UNDO_SWAP( this )
return false;
}
......@@ -359,7 +349,7 @@ void SwTextFrm::AdjustFrm( const SwTwips nChgHght, bool bHasToFit )
// AdjustFrm is called with a swapped frame during
// formatting but the frame is not swapped during FormatEmpty
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED( this );
SWRECTFN ( this )
// The Frame's size variable is incremented by Grow or decremented by Shrink.
......@@ -385,7 +375,6 @@ void SwTextFrm::AdjustFrm( const SwTwips nChgHght, bool bHasToFit )
Prt().SSize().Width() += nChgHght;
else
Prt().SSize().Height() += nChgHght;
UNDO_SWAP( this )
return;
}
}
......@@ -495,8 +484,6 @@ void SwTextFrm::AdjustFrm( const SwTwips nChgHght, bool bHasToFit )
}
else
Shrink( -nChgHght );
UNDO_SWAP( this )
}
com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwTextFrm::GetTabStopInfo( SwTwips CurrentPos )
......@@ -674,7 +661,7 @@ SwContentFrm *SwTextFrm::JoinFrm()
SwContentFrm *SwTextFrm::SplitFrm( const sal_Int32 nTextPos )
{
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED( this );
// The Paste sends a Modify() to me
// I lock myself, so that my data does not disappear
......@@ -747,7 +734,6 @@ SwContentFrm *SwTextFrm::SplitFrm( const sal_Int32 nTextPos )
pNew->ManipOfst( nTextPos );
UNDO_SWAP( this )
return pNew;
}
......@@ -866,59 +852,60 @@ bool SwTextFrm::CalcPreps()
}
}
SWAP_IF_NOT_SWAPPED( this )
{
SWAP_IF_NOT_SWAPPED( this );
SwTextFormatInfo aInf( this );
SwTextFormatter aLine( this, &aInf );
SwTextFormatInfo aInf( this );
SwTextFormatter aLine( this, &aInf );
WidowsAndOrphans aFrmBreak( this );
// Whatever the attributes say: we split the paragraph in
// MustFit in any case
if( bPrepMustFit )
{
aFrmBreak.SetKeep( false );
aFrmBreak.ClrOrphLines();
}
// Before calling FormatAdjust, we need to make sure
// that the lines protruding at the bottom get indeed
// truncated
bool bBreak = aFrmBreak.IsBreakNowWidAndOrp( aLine );
bRet = true;
while( !bBreak && aLine.Next() )
{
bBreak = aFrmBreak.IsBreakNowWidAndOrp( aLine );
}
if( bBreak )
{
// We run into troubles: when TruncLines get called, the
// conditions in IsInside change immediately such that
// IsBreakNow can return different results.
// For this reason, we make it clear to rFrmBreak, that the
// end is reached at the location of rLine.
// Let's see if it works ...
aLine.TruncLines();
aFrmBreak.SetRstHeight( aLine );
FormatAdjust( aLine, aFrmBreak, aInf.GetText().getLength(), aInf.IsStop() );
}
else
{
if( !GetFollow() )
WidowsAndOrphans aFrmBreak( this );
// Whatever the attributes say: we split the paragraph in
// MustFit in any case
if( bPrepMustFit )
{
FormatAdjust( aLine, aFrmBreak,
aInf.GetText().getLength(), aInf.IsStop() );
aFrmBreak.SetKeep( false );
aFrmBreak.ClrOrphLines();
}
else if ( !aFrmBreak.IsKeepAlways() )
// Before calling FormatAdjust, we need to make sure
// that the lines protruding at the bottom get indeed
// truncated
bool bBreak = aFrmBreak.IsBreakNowWidAndOrp( aLine );
bRet = true;
while( !bBreak && aLine.Next() )
{
// We delete a line before the Master, because the Follow
// could hand over a line
const SwCharRange aFollowRg( GetFollow()->GetOfst(), 1 );
pPara->GetReformat() += aFollowRg;
// We should continue!
bBreak = aFrmBreak.IsBreakNowWidAndOrp( aLine );
}
if( bBreak )
{
// We run into troubles: when TruncLines get called, the
// conditions in IsInside change immediately such that
// IsBreakNow can return different results.
// For this reason, we make it clear to rFrmBreak, that the
// end is reached at the location of rLine.
// Let's see if it works ...
aLine.TruncLines();
aFrmBreak.SetRstHeight( aLine );
FormatAdjust( aLine, aFrmBreak, aInf.GetText().getLength(), aInf.IsStop() );
}
else
{
if( !GetFollow() )
{
FormatAdjust( aLine, aFrmBreak,
aInf.GetText().getLength(), aInf.IsStop() );
}
else if ( !aFrmBreak.IsKeepAlways() )
{
// We delete a line before the Master, because the Follow
// could hand over a line
const SwCharRange aFollowRg( GetFollow()->GetOfst(), 1 );
pPara->GetReformat() += aFollowRg;
// We should continue!
bRet = false;
}
}
}
UNDO_SWAP( this )
// A final check, if FormatAdjust() didn't help we need to
// truncate
if( bPrepMustFit )
......@@ -961,7 +948,7 @@ void SwTextFrm::FormatAdjust( SwTextFormatter &rLine,
const sal_Int32 nStrLen,
const bool bDummy )
{
SWAP_IF_NOT_SWAPPED( this )
SWAP_IF_NOT_SWAPPED( this );
SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
......@@ -1119,8 +1106,6 @@ void SwTextFrm::FormatAdjust( SwTextFormatter &rLine,
_AdjustFollow( rLine, nEnd, nStrLen, nNew );
pPara->SetPrepMustFit( false );
UNDO_SWAP( this )
}
// bPrev is set whether Reformat.Start() was called because of Prev().
......
......@@ -300,7 +300,7 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const
return;
SwViewShell *pSh = getRootFrm()->GetCurrShell();
SWAP_IF_NOT_SWAPPED( this )
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(this));
SwRect rOldRect( rRect );
if ( IsVertical() )
......@@ -337,7 +337,6 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const
if( !aLine.Next() )
{
(SwRect&)rRect = rOldRect;
UNDO_SWAP( this )
return;
}
}
......@@ -399,7 +398,6 @@ void SwTextFrm::PaintExtraData( const SwRect &rRect ) const
}
(SwRect&)rRect = rOldRect;
UNDO_SWAP( this )
}
}
......@@ -648,60 +646,61 @@ void SwTextFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
OSL_ENSURE( ! IsSwapped(), "A frame is swapped before Paint" );
SwRect aOldRect( rRect );
SWAP_IF_NOT_SWAPPED( this )
{
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(this));
if ( IsVertical() )
SwitchVerticalToHorizontal( (SwRect&)rRect );
if ( IsVertical() )
SwitchVerticalToHorizontal( (SwRect&)rRect );
if ( IsRightToLeft() )
SwitchRTLtoLTR( (SwRect&)rRect );
if ( IsRightToLeft() )
SwitchRTLtoLTR( (SwRect&)rRect );
SwTextPaintInfo aInf( const_cast<SwTextFrm*>(this), rRect );
aInf.SetWrongList( const_cast<SwTextNode*>(GetTextNode())->GetWrong() );
aInf.SetGrammarCheckList( const_cast<SwTextNode*>(GetTextNode())->GetGrammarCheck() );
aInf.SetSmartTags( const_cast<SwTextNode*>(GetTextNode())->GetSmartTags() );
aInf.GetTextFly().SetTopRule();
SwTextPaintInfo aInf( const_cast<SwTextFrm*>(this), rRect );
aInf.SetWrongList( const_cast<SwTextNode*>(GetTextNode())->GetWrong() );
aInf.SetGrammarCheckList( const_cast<SwTextNode*>(GetTextNode())->GetGrammarCheck() );
aInf.SetSmartTags( const_cast<SwTextNode*>(GetTextNode())->GetSmartTags() );
aInf.GetTextFly().SetTopRule();
SwTextPainter aLine( const_cast<SwTextFrm*>(this), &aInf );
// Optimization: if no free flying Frm overlaps into our line, the
// SwTextFly just switches off
aInf.GetTextFly().Relax();
SwTextPainter aLine( const_cast<SwTextFrm*>(this), &aInf );
// Optimization: if no free flying Frm overlaps into our line, the
// SwTextFly just switches off
aInf.GetTextFly().Relax();
OutputDevice* pOut = aInf.GetOut();
const bool bOnWin = pSh->GetWin() != 0;
OutputDevice* pOut = aInf.GetOut();
const bool bOnWin = pSh->GetWin() != 0;
SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : 0 );
SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : 0 );
// Output loop: For each Line ... (which is still visible) ...
// adapt rRect (Top + 1, Bottom - 1)
// Because the Iterator attaches the Lines without a gap to each other
aLine.TwipsToLine( rRect.Top() + 1 );
long nBottom = rRect.Bottom();
// Output loop: For each Line ... (which is still visible) ...
// adapt rRect (Top + 1, Bottom - 1)
// Because the Iterator attaches the Lines without a gap to each other
aLine.TwipsToLine( rRect.Top() + 1 );
long nBottom = rRect.Bottom();
bool bNoPrtLine = 0 == GetMinPrtLine();
if( !bNoPrtLine )
{
while ( aLine.Y() < GetMinPrtLine() && aLine.Next() )
;
bNoPrtLine = aLine.Y() >= GetMinPrtLine();
}
if( bNoPrtLine )
{
do
bool bNoPrtLine = 0 == GetMinPrtLine();
if( !bNoPrtLine )
{
while ( aLine.Y() < GetMinPrtLine() && aLine.Next() )
;
bNoPrtLine = aLine.Y() >= GetMinPrtLine();
}
if( bNoPrtLine )
{
aLine.DrawTextLine( rRect, aClip, IsUndersized() );
do
{
aLine.DrawTextLine( rRect, aClip, IsUndersized() );
} while( aLine.Next() && aLine.Y() <= nBottom );
}
} while( aLine.Next() && aLine.Y() <= nBottom );
}
// Once is enough:
if( aLine.IsPaintDrop() )
aLine.PaintDropPortion();
// Once is enough:
if( aLine.IsPaintDrop() )
aLine.PaintDropPortion();
if( rRepaint.HasArea() )
rRepaint.Clear();
if( rRepaint.HasArea() )
rRepaint.Clear();
}
UNDO_SWAP( this )
(SwRect&)rRect = aOldRect;
OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Paint" );
......
......@@ -410,15 +410,13 @@ SwRect SwTextFly::_GetFrm( const SwRect &rRect, bool bTop ) const
bool SwTextFly::IsAnyFrm() const
{
SWAP_IF_SWAPPED( pCurrFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pCurrFrm));
OSL_ENSURE( bOn, "IsAnyFrm: Why?" );
SwRect aRect( pCurrFrm->Frm().Pos() + pCurrFrm->Prt().Pos(),
pCurrFrm->Prt().SSize() );
const bool bRet = ForEach( aRect, NULL, false );
UNDO_SWAP( pCurrFrm )
return bRet;
return ForEach( aRect, NULL, false );
}
bool SwTextFly::IsAnyObj( const SwRect &rRect ) const
......@@ -863,7 +861,7 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
// #i68520#
OSL_ENSURE( !mpAnchoredObjList, "InitFlyList: FlyList already initialized" );
SWAP_IF_SWAPPED( pCurrFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pCurrFrm));
const SwSortedObjs *pSorted = pPage->GetSortedObjs();
const size_t nCount = pSorted ? pSorted->size() : 0;
......@@ -985,8 +983,6 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
mpAnchoredObjList = new SwAnchoredObjList();
}
UNDO_SWAP( pCurrFrm )
// #i68520#
return mpAnchoredObjList;
}
......@@ -1027,7 +1023,7 @@ SwTwips SwTextFly::CalcMinBottom() const
bool SwTextFly::ForEach( const SwRect &rRect, SwRect* pRect, bool bAvoid ) const
{
SWAP_IF_SWAPPED( pCurrFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pCurrFrm));
bool bRet = false;
// #i68520#
......@@ -1105,8 +1101,6 @@ bool SwTextFly::ForEach( const SwRect &rRect, SwRect* pRect, bool bAvoid ) const
}
}
UNDO_SWAP( pCurrFrm )
return bRet;
}
......@@ -1412,13 +1406,11 @@ SwSurround SwTextFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchored
bool SwTextFly::IsAnyFrm( const SwRect &rLine ) const
{
SWAP_IF_SWAPPED( pCurrFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pCurrFrm));
OSL_ENSURE( bOn, "IsAnyFrm: Why?" );
const bool bRet = ForEach( rLine, NULL, false );
UNDO_SWAP( pCurrFrm )
return bRet;
return ForEach( rLine, NULL, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -271,24 +271,20 @@ SwFrmSwapper::~SwFrmSwapper()
void SwTextFrm::SwitchLTRtoRTL( SwRect& rRect ) const
{
SWAP_IF_NOT_SWAPPED( this )
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(this));
long nWidth = rRect.Width();
rRect.Left( 2 * ( Frm().Left() + Prt().Left() ) +
Prt().Width() - rRect.Right() - 1 );
rRect.Width( nWidth );
UNDO_SWAP( this )
}
void SwTextFrm::SwitchLTRtoRTL( Point& rPoint ) const
{
SWAP_IF_NOT_SWAPPED( this )
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(this));
rPoint.X() = 2 * ( Frm().Left() + Prt().Left() ) + Prt().Width() - rPoint.X() - 1;
UNDO_SWAP( this )
}
SwLayoutModeModifier::SwLayoutModeModifier( const OutputDevice& rOutp ) :
......@@ -1382,7 +1378,7 @@ void SwTextFrm::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
sal_uInt16 nHave = nNeed;
// We yield a few lines and shrink in CalcPreps()
SWAP_IF_NOT_SWAPPED( this )
SWAP_IF_NOT_SWAPPED( this );
SwTextSizeInfo aInf( this );
SwTextMargin aLine( this, &aInf );
......@@ -1420,8 +1416,6 @@ void SwTextFrm::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
_InvalidateSize();
InvalidatePage();
}
UNDO_SWAP( this )
}
static bool lcl_ErgoVadis( SwTextFrm* pFrm, sal_Int32 &rPos, const PrepareHint ePrep )
......@@ -2004,8 +1998,6 @@ bool SwTextFrm::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst )
} while ( aLine.Next() );
}
UNDO_SWAP( this )
return bRet;
}
......@@ -2052,7 +2044,7 @@ sal_uInt16 SwTextFrm::GetParHeight() const
*/
SwTextFrm* SwTextFrm::GetFormatted( bool bForceQuickFormat )
{
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED( this );
// The IdleCollector could've removed my cached information
// Calc() calls our format
......@@ -2071,8 +2063,6 @@ SwTextFrm* SwTextFrm::GetFormatted( bool bForceQuickFormat )
Format();
}
UNDO_SWAP( this )
return this;
}
......
......@@ -268,18 +268,19 @@ SwTwips SwTextFrm::GetFootnoteLine( const SwTextFootnote *pFootnote ) const
IsVertical() ? Frm().Left() : Frm().Bottom();
}
SWAP_IF_NOT_SWAPPED( this )
SwTextInfo aInf( pThis );
SwTextIter aLine( pThis, &aInf );
const sal_Int32 nPos = pFootnote->GetStart();
aLine.CharToLine( nPos );
SwTwips nRet;
{
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(this));
SwTwips nRet = aLine.Y() + SwTwips(aLine.GetLineHeight());
if( IsVertical() )
nRet = SwitchHorizontalToVertical( nRet );
SwTextInfo aInf( pThis );
SwTextIter aLine( pThis, &aInf );
const sal_Int32 nPos = pFootnote->GetStart();
aLine.CharToLine( nPos );
UNDO_SWAP( this )
nRet = aLine.Y() + SwTwips(aLine.GetLineHeight());
if( IsVertical() )
nRet = SwitchHorizontalToVertical( nRet );
}
nRet = lcl_GetFootnoteLower( pThis, nRet );
......@@ -302,7 +303,7 @@ SwTwips SwTextFrm::_GetFootnoteFrmHeight() const
GetFootnote().IsEndNote() ) )
return 0;
SWAP_IF_SWAPPED( this )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(this));
SwTwips nHeight = pRef->IsInFootnoteConnect() ?
1 : pRef->GetFootnoteLine( pFootnoteFrm->GetAttr() );
......@@ -359,8 +360,6 @@ SwTwips SwTextFrm::_GetFootnoteFrmHeight() const
}
}
UNDO_SWAP( this )
return nHeight;
}
......@@ -805,7 +804,7 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf,
if( rInf.IsTest() )
return new SwFootnotePortion( rFootnote.GetViewNumStr( *pDoc ), pFootnote );
SWAP_IF_SWAPPED( pFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pFrm));
sal_uInt16 nReal;
{
......@@ -866,7 +865,6 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf,
if( !pFootnoteCont )
{
rInf.SetStop( true );
UNDO_SWAP( pFrm )
return 0;
}
else
......@@ -883,7 +881,6 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf,
if( pTmpFrm && *pTmpFrm < pFootnote )
{
rInf.SetStop( true );
UNDO_SWAP( pFrm )
return 0;
}
}
......@@ -910,7 +907,6 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf,
// We're in the last Line and the Footnote has moved
// to another Page. We also want to be on that Page!
rInf.SetStop( true );
UNDO_SWAP( pFrm )
return 0;
}
}
......@@ -924,8 +920,6 @@ SwFootnotePortion *SwTextFormatter::NewFootnotePortion( SwTextFormatInfo &rInf,
pFootnote, nReal );
rInf.SetFootnoteInside( true );
UNDO_SWAP( pFrm )
return pRet;
}
......@@ -1109,11 +1103,12 @@ sal_Int32 SwTextFormatter::FormatQuoVadis( const sal_Int32 nOffset )
Right( Right() - nQuoWidth );
SWAP_IF_NOT_SWAPPED( pFrm )
const sal_Int32 nRet = FormatLine( nStart );
sal_Int32 nRet;
{
SWAP_IF_NOT_SWAPPED(const_cast<SwTextFrm *>(pFrm));
UNDO_SWAP( pFrm )
nRet = FormatLine( nStart );
}
Right( rInf.Left() + nOldRealWidth - 1 );
......
......@@ -57,7 +57,7 @@ inline bool IsNastyFollow( const SwTextFrm *pFrm )
SwTextFrmBreak::SwTextFrmBreak( SwTextFrm *pNewFrm, const SwTwips nRst )
: nRstHeight(nRst), pFrm(pNewFrm)
{
SWAP_IF_SWAPPED( pFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pFrm));
SWRECTFN( pFrm )
nOrigin = (pFrm->*fnRect->fnGetPrtTop)();
bKeep = !pFrm->IsMoveable() || IsNastyFollow( pFrm );
......@@ -78,8 +78,6 @@ SwTextFrmBreak::SwTextFrmBreak( SwTextFrm *pNewFrm, const SwTwips nRst )
if( nRstHeight < 0 )
nRstHeight = 0;
}
UNDO_SWAP( pFrm )
}
/**
......@@ -106,7 +104,7 @@ bool SwTextFrmBreak::IsInside( SwTextMargin &rLine ) const
{
bool bFit = false;
SWAP_IF_SWAPPED( pFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pFrm));
SWRECTFN( pFrm )
// nOrigin is an absolut value, rLine referes to the swapped situation.
......@@ -158,14 +156,12 @@ bool SwTextFrmBreak::IsInside( SwTextMargin &rLine ) const
}
}
UNDO_SWAP( pFrm );
return bFit;
}
bool SwTextFrmBreak::IsBreakNow( SwTextMargin &rLine )
{
SWAP_IF_SWAPPED( pFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pFrm));
// bKeep is stronger than IsBreakNow()
// Is there enough space ?
......@@ -198,8 +194,6 @@ bool SwTextFrmBreak::IsBreakNow( SwTextMargin &rLine )
}
}
UNDO_SWAP( pFrm )
return bBreak;
}
......@@ -226,7 +220,7 @@ WidowsAndOrphans::WidowsAndOrphans( SwTextFrm *pNewFrm, const SwTwips nRst,
bool bChkKeep )
: SwTextFrmBreak( pNewFrm, nRst ), nWidLines( 0 ), nOrphLines( 0 )
{
SWAP_IF_SWAPPED( pFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pFrm));
if( bKeep )
{
......@@ -294,8 +288,6 @@ WidowsAndOrphans::WidowsAndOrphans( SwTextFrm *pNewFrm, const SwTwips nRst,
nWidLines = 0;
}
}
UNDO_SWAP( pFrm )
}
/**
......@@ -310,7 +302,7 @@ bool WidowsAndOrphans::FindBreak( SwTextFrm *pFrame, SwTextMargin &rLine,
// Thus, assertion on situation, that these are different to figure out why.
OSL_ENSURE( pFrm == pFrame, "<WidowsAndOrphans::FindBreak> - pFrm != pFrame" );
SWAP_IF_SWAPPED( pFrm )
SWAP_IF_SWAPPED(const_cast<SwTextFrm *>(pFrm));
bool bRet = true;
sal_uInt16 nOldOrphans = nOrphLines;
......@@ -345,8 +337,6 @@ bool WidowsAndOrphans::FindBreak( SwTextFrm *pFrame, SwTextMargin &rLine,
}
nOrphLines = nOldOrphans;
UNDO_SWAP( pFrm )
return bRet;
}
......
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