summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 10:35:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-01 11:43:08 +0200
commita0ec43251e8b8a0805306ca5ad86794550916fce (patch)
tree4ed3dd954b43a2ea1946473edba9f6963350d25c /sw/source/core/layout
parentda64ad86e9f2dd66fbcecb46dcc22626e9f5a6a6 (diff)
loplugin:flatten in sw/core/layout
Change-Id: I67fd1a269d960174b88c57da4a0588f5d9252660 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99885 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx164
-rw-r--r--sw/source/core/layout/anchoredobject.cxx228
-rw-r--r--sw/source/core/layout/atrfrm.cxx302
-rw-r--r--sw/source/core/layout/calcmove.cxx438
-rw-r--r--sw/source/core/layout/colfrm.cxx44
-rw-r--r--sw/source/core/layout/findfrm.cxx98
-rw-r--r--sw/source/core/layout/fly.cxx318
-rw-r--r--sw/source/core/layout/flycnt.cxx362
-rw-r--r--sw/source/core/layout/flyincnt.cxx34
-rw-r--r--sw/source/core/layout/flylay.cxx74
-rw-r--r--sw/source/core/layout/frmtool.cxx366
-rw-r--r--sw/source/core/layout/ftnfrm.cxx630
-rw-r--r--sw/source/core/layout/layact.cxx52
-rw-r--r--sw/source/core/layout/laycache.cxx346
-rw-r--r--sw/source/core/layout/objectformattertxtfrm.cxx36
-rw-r--r--sw/source/core/layout/pagechg.cxx202
-rw-r--r--sw/source/core/layout/paintfrm.cxx1290
-rw-r--r--sw/source/core/layout/sectfrm.cxx296
-rw-r--r--sw/source/core/layout/ssfrm.cxx180
-rw-r--r--sw/source/core/layout/tabfrm.cxx192
-rw-r--r--sw/source/core/layout/wsfrm.cxx688
21 files changed, 3174 insertions, 3166 deletions
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index cc84e0bc4597..8960d4075ad9 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -342,26 +342,26 @@ void SwAnchoredDrawObject::MakeObjPos()
}
// --> #i62875#
- if ( mbCaptureAfterLayoutDirChange &&
- GetPageFrame() )
- {
- SwRect aPageRect( GetPageFrame()->getFrameArea() );
- SwRect aObjRect( GetObjRect() );
- if ( aObjRect.Right() >= aPageRect.Right() + 10 )
- {
- Size aSize( aPageRect.Right() - aObjRect.Right(), 0 );
- DrawObj()->Move( aSize );
- aObjRect = GetObjRect();
- }
+ if ( !(mbCaptureAfterLayoutDirChange &&
+ GetPageFrame()) )
+ return;
- if ( aObjRect.Left() + 10 <= aPageRect.Left() )
- {
- Size aSize( aPageRect.Left() - aObjRect.Left(), 0 );
- DrawObj()->Move( aSize );
- }
+ SwRect aPageRect( GetPageFrame()->getFrameArea() );
+ SwRect aObjRect( GetObjRect() );
+ if ( aObjRect.Right() >= aPageRect.Right() + 10 )
+ {
+ Size aSize( aPageRect.Right() - aObjRect.Right(), 0 );
+ DrawObj()->Move( aSize );
+ aObjRect = GetObjRect();
+ }
- mbCaptureAfterLayoutDirChange = false;
+ if ( aObjRect.Left() + 10 <= aPageRect.Left() )
+ {
+ Size aSize( aPageRect.Left() - aObjRect.Left(), 0 );
+ DrawObj()->Move( aSize );
}
+
+ mbCaptureAfterLayoutDirChange = false;
}
/** method for the intrinsic positioning of an at-paragraph|at-character
@@ -523,84 +523,84 @@ void SwAnchoredDrawObject::SetDrawObjAnchor()
*/
void SwAnchoredDrawObject::InvalidatePage_( SwPageFrame* _pPageFrame )
{
- if ( _pPageFrame && !_pPageFrame->GetFormat()->GetDoc()->IsInDtor() )
+ if ( !(_pPageFrame && !_pPageFrame->GetFormat()->GetDoc()->IsInDtor()) )
+ return;
+
+ if ( !_pPageFrame->GetUpper() )
+ return;
+
+ // --> #i35007# - correct invalidation for as-character
+ // anchored objects.
+ if ( GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR )
{
- if ( _pPageFrame->GetUpper() )
- {
- // --> #i35007# - correct invalidation for as-character
- // anchored objects.
- if ( GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR )
- {
- _pPageFrame->InvalidateFlyInCnt();
- }
- else
- {
- _pPageFrame->InvalidateFlyLayout();
- }
+ _pPageFrame->InvalidateFlyInCnt();
+ }
+ else
+ {
+ _pPageFrame->InvalidateFlyLayout();
+ }
- SwRootFrame* pRootFrame = static_cast<SwRootFrame*>(_pPageFrame->GetUpper());
- pRootFrame->DisallowTurbo();
- if ( pRootFrame->GetTurbo() )
- {
- const SwContentFrame* pTmpFrame = pRootFrame->GetTurbo();
- pRootFrame->ResetTurbo();
- pTmpFrame->InvalidatePage();
- }
- pRootFrame->SetIdleFlags();
- }
+ SwRootFrame* pRootFrame = static_cast<SwRootFrame*>(_pPageFrame->GetUpper());
+ pRootFrame->DisallowTurbo();
+ if ( pRootFrame->GetTurbo() )
+ {
+ const SwContentFrame* pTmpFrame = pRootFrame->GetTurbo();
+ pRootFrame->ResetTurbo();
+ pTmpFrame->InvalidatePage();
}
+ pRootFrame->SetIdleFlags();
}
void SwAnchoredDrawObject::InvalidateObjPos()
{
// --> #i28701# - check, if invalidation is allowed
- if ( mbValidPos &&
- InvalidationOfPosAllowed() )
- {
- mbValidPos = false;
- // --> #i68520#
- InvalidateObjRectWithSpaces();
+ if ( !(mbValidPos &&
+ InvalidationOfPosAllowed()) )
+ return;
- // --> #i44339# - check, if anchor frame exists.
- if ( GetAnchorFrame() )
- {
- // --> #118547# - notify anchor frame of as-character
- // anchored object, because its positioned by the format of its anchor frame.
- // --> #i44559# - assure, that text hint is already
- // existing in the text frame
- if ( dynamic_cast< const SwTextFrame* >(GetAnchorFrame()) != nullptr &&
- (GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) )
- {
- SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
- if (pAnchorTextFrame->CalcFlyPos(&GetFrameFormat()) != TextFrameIndex(COMPLETE_STRING))
- {
- AnchorFrame()->Prepare( PrepareHint::FlyFrameAttributesChanged, &GetFrameFormat() );
- }
- }
+ mbValidPos = false;
+ // --> #i68520#
+ InvalidateObjRectWithSpaces();
- SwPageFrame* pPageFrame = AnchorFrame()->FindPageFrame();
- InvalidatePage_( pPageFrame );
+ // --> #i44339# - check, if anchor frame exists.
+ if ( !GetAnchorFrame() )
+ return;
- // --> #i32270# - also invalidate page frame, at which the
- // drawing object is registered at.
- SwPageFrame* pPageFrameRegisteredAt = GetPageFrame();
- if ( pPageFrameRegisteredAt &&
- pPageFrameRegisteredAt != pPageFrame )
- {
- InvalidatePage_( pPageFrameRegisteredAt );
- }
- // #i33751#, #i34060# - method <GetPageFrameOfAnchor()>
- // is replaced by method <FindPageFrameOfAnchor()>. It's return value
- // have to be checked.
- SwPageFrame* pPageFrameOfAnchor = FindPageFrameOfAnchor();
- if ( pPageFrameOfAnchor &&
- pPageFrameOfAnchor != pPageFrame &&
- pPageFrameOfAnchor != pPageFrameRegisteredAt )
- {
- InvalidatePage_( pPageFrameOfAnchor );
- }
+ // --> #118547# - notify anchor frame of as-character
+ // anchored object, because its positioned by the format of its anchor frame.
+ // --> #i44559# - assure, that text hint is already
+ // existing in the text frame
+ if ( dynamic_cast< const SwTextFrame* >(GetAnchorFrame()) != nullptr &&
+ (GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) )
+ {
+ SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
+ if (pAnchorTextFrame->CalcFlyPos(&GetFrameFormat()) != TextFrameIndex(COMPLETE_STRING))
+ {
+ AnchorFrame()->Prepare( PrepareHint::FlyFrameAttributesChanged, &GetFrameFormat() );
}
}
+
+ SwPageFrame* pPageFrame = AnchorFrame()->FindPageFrame();
+ InvalidatePage_( pPageFrame );
+
+ // --> #i32270# - also invalidate page frame, at which the
+ // drawing object is registered at.
+ SwPageFrame* pPageFrameRegisteredAt = GetPageFrame();
+ if ( pPageFrameRegisteredAt &&
+ pPageFrameRegisteredAt != pPageFrame )
+ {
+ InvalidatePage_( pPageFrameRegisteredAt );
+ }
+ // #i33751#, #i34060# - method <GetPageFrameOfAnchor()>
+ // is replaced by method <FindPageFrameOfAnchor()>. It's return value
+ // have to be checked.
+ SwPageFrame* pPageFrameOfAnchor = FindPageFrameOfAnchor();
+ if ( pPageFrameOfAnchor &&
+ pPageFrameOfAnchor != pPageFrame &&
+ pPageFrameOfAnchor != pPageFrameRegisteredAt )
+ {
+ InvalidatePage_( pPageFrameOfAnchor );
+ }
}
SwFrameFormat& SwAnchoredDrawObject::GetFrameFormat()
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index df9d0cb08ef8..0c21a53904b5 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -145,20 +145,20 @@ SwFrame* SwAnchoredObject::GetAnchorFrameContainingAnchPos()
void SwAnchoredObject::SetPageFrame( SwPageFrame* _pNewPageFrame )
{
- if ( mpPageFrame != _pNewPageFrame )
- {
- // clear member, which denotes the layout frame at which the vertical
- // position is oriented at, if it doesn't fit to the new page frame.
- if ( GetVertPosOrientFrame() &&
- ( !_pNewPageFrame ||
- _pNewPageFrame != GetVertPosOrientFrame()->FindPageFrame() ) )
- {
- ClearVertPosOrientFrame();
- }
+ if ( mpPageFrame == _pNewPageFrame )
+ return;
- // assign new page frame
- mpPageFrame = _pNewPageFrame;
+ // clear member, which denotes the layout frame at which the vertical
+ // position is oriented at, if it doesn't fit to the new page frame.
+ if ( GetVertPosOrientFrame() &&
+ ( !_pNewPageFrame ||
+ _pNewPageFrame != GetVertPosOrientFrame()->FindPageFrame() ) )
+ {
+ ClearVertPosOrientFrame();
}
+
+ // assign new page frame
+ mpPageFrame = _pNewPageFrame;
}
@@ -215,27 +215,27 @@ void SwAnchoredObject::AddLastTopOfLineY( SwTwips _nDiff )
void SwAnchoredObject::CheckCharRectAndTopOfLine(
const bool _bCheckForParaPorInf )
{
- if ( GetAnchorFrame() &&
- GetAnchorFrame()->IsTextFrame() )
+ if ( !(GetAnchorFrame() &&
+ GetAnchorFrame()->IsTextFrame()) )
+ return;
+
+ const SwFormatAnchor& rAnch = GetFrameFormat().GetAnchor();
+ if ( !((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR) &&
+ rAnch.GetContentAnchor()) )
+ return;
+
+ // --> if requested, assure that anchor frame,
+ // which contains the anchor character, has a paragraph portion information.
+ // The paragraph portion information is needed to determine the
+ // anchor character rectangle respectively the top of the line.
+ // Thus, a format of this frame is avoided to determine the
+ // paragraph portion information.
+ // --> #i26945# - use new method <FindAnchorCharFrame()>
+ const SwTextFrame& aAnchorCharFrame = *(FindAnchorCharFrame());
+ if ( !_bCheckForParaPorInf || aAnchorCharFrame.HasPara() )
{
- const SwFormatAnchor& rAnch = GetFrameFormat().GetAnchor();
- if ( (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR) &&
- rAnch.GetContentAnchor() )
- {
- // --> if requested, assure that anchor frame,
- // which contains the anchor character, has a paragraph portion information.
- // The paragraph portion information is needed to determine the
- // anchor character rectangle respectively the top of the line.
- // Thus, a format of this frame is avoided to determine the
- // paragraph portion information.
- // --> #i26945# - use new method <FindAnchorCharFrame()>
- const SwTextFrame& aAnchorCharFrame = *(FindAnchorCharFrame());
- if ( !_bCheckForParaPorInf || aAnchorCharFrame.HasPara() )
- {
- CheckCharRect( rAnch, aAnchorCharFrame );
- CheckTopOfLine( rAnch, aAnchorCharFrame );
- }
- }
+ CheckCharRect( rAnch, aAnchorCharFrame );
+ CheckTopOfLine( rAnch, aAnchorCharFrame );
}
}
@@ -259,44 +259,44 @@ void SwAnchoredObject::CheckCharRect( const SwFormatAnchor& _rAnch,
return;
}
// check, if anchor character rectangle has changed
- if ( aCharRect != maLastCharRect )
+ if ( aCharRect == maLastCharRect )
+ return;
+
+ // check positioning and alignment for invalidation of position
{
- // check positioning and alignment for invalidation of position
+ SwRectFnSet aRectFnSet(&_rAnchorCharFrame);
+ // determine positioning and alignment
+ SwFormatVertOrient aVert( GetFrameFormat().GetVertOrient() );
+ SwFormatHoriOrient aHori( GetFrameFormat().GetHoriOrient() );
+ // check for anchor character rectangle changes for certain
+ // positionings and alignments
+ // add condition to invalidate position,
+ // if vertical aligned at frame/page area and vertical position
+ // of anchor character has changed.
+ const sal_Int16 eVertRelOrient = aVert.GetRelationOrient();
+ if ( ( aHori.GetRelationOrient() == text::RelOrientation::CHAR &&
+ aRectFnSet.GetLeft(aCharRect) != aRectFnSet.GetLeft(maLastCharRect) ) ||
+ ( eVertRelOrient == text::RelOrientation::CHAR &&
+ ( aRectFnSet.GetTop(aCharRect) != aRectFnSet.GetTop(maLastCharRect) ||
+ aRectFnSet.GetHeight(aCharRect) != aRectFnSet.GetHeight(maLastCharRect) ) ) ||
+ ( ( ( eVertRelOrient == text::RelOrientation::FRAME ) ||
+ ( eVertRelOrient == text::RelOrientation::PRINT_AREA ) ||
+ ( eVertRelOrient == text::RelOrientation::PAGE_FRAME ) ||
+ ( eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) ) &&
+ ( aRectFnSet.GetTop(aCharRect) != aRectFnSet.GetTop(maLastCharRect) ) ) )
{
- SwRectFnSet aRectFnSet(&_rAnchorCharFrame);
- // determine positioning and alignment
- SwFormatVertOrient aVert( GetFrameFormat().GetVertOrient() );
- SwFormatHoriOrient aHori( GetFrameFormat().GetHoriOrient() );
- // check for anchor character rectangle changes for certain
- // positionings and alignments
- // add condition to invalidate position,
- // if vertical aligned at frame/page area and vertical position
- // of anchor character has changed.
- const sal_Int16 eVertRelOrient = aVert.GetRelationOrient();
- if ( ( aHori.GetRelationOrient() == text::RelOrientation::CHAR &&
- aRectFnSet.GetLeft(aCharRect) != aRectFnSet.GetLeft(maLastCharRect) ) ||
- ( eVertRelOrient == text::RelOrientation::CHAR &&
- ( aRectFnSet.GetTop(aCharRect) != aRectFnSet.GetTop(maLastCharRect) ||
- aRectFnSet.GetHeight(aCharRect) != aRectFnSet.GetHeight(maLastCharRect) ) ) ||
- ( ( ( eVertRelOrient == text::RelOrientation::FRAME ) ||
- ( eVertRelOrient == text::RelOrientation::PRINT_AREA ) ||
- ( eVertRelOrient == text::RelOrientation::PAGE_FRAME ) ||
- ( eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) ) &&
- ( aRectFnSet.GetTop(aCharRect) != aRectFnSet.GetTop(maLastCharRect) ) ) )
+ // #i26945#, #i35911# - unlock position of
+ // anchored object, if it isn't registered at the page,
+ // where its anchor character frame is on.
+ if ( GetPageFrame() != _rAnchorCharFrame.FindPageFrame() )
{
- // #i26945#, #i35911# - unlock position of
- // anchored object, if it isn't registered at the page,
- // where its anchor character frame is on.
- if ( GetPageFrame() != _rAnchorCharFrame.FindPageFrame() )
- {
- UnlockPosition();
- }
- InvalidateObjPos();
+ UnlockPosition();
}
+ InvalidateObjPos();
}
- // keep new anchor character rectangle
- maLastCharRect = aCharRect;
}
+ // keep new anchor character rectangle
+ maLastCharRect = aCharRect;
}
/** check top of line
@@ -313,26 +313,26 @@ void SwAnchoredObject::CheckTopOfLine( const SwFormatAnchor& _rAnch,
const SwTextFrame& _rAnchorCharFrame )
{
SwTwips nTopOfLine = 0;
- if ( _rAnchorCharFrame.GetTopOfLine( nTopOfLine, *_rAnch.GetContentAnchor() ) )
+ if ( !_rAnchorCharFrame.GetTopOfLine( nTopOfLine, *_rAnch.GetContentAnchor() ) )
+ return;
+
+ if ( nTopOfLine == mnLastTopOfLine )
+ return;
+
+ // check alignment for invalidation of position
+ if ( GetFrameFormat().GetVertOrient().GetRelationOrient() == text::RelOrientation::TEXT_LINE )
{
- if ( nTopOfLine != mnLastTopOfLine )
+ // #i26945#, #i35911# - unlock position of
+ // anchored object, if it isn't registered at the page,
+ // where its anchor character frame is on.
+ if ( GetPageFrame() != _rAnchorCharFrame.FindPageFrame() )
{
- // check alignment for invalidation of position
- if ( GetFrameFormat().GetVertOrient().GetRelationOrient() == text::RelOrientation::TEXT_LINE )
- {
- // #i26945#, #i35911# - unlock position of
- // anchored object, if it isn't registered at the page,
- // where its anchor character frame is on.
- if ( GetPageFrame() != _rAnchorCharFrame.FindPageFrame() )
- {
- UnlockPosition();
- }
- InvalidateObjPos();
- }
- // keep new top of line value
- mnLastTopOfLine = nTopOfLine;
+ UnlockPosition();
}
+ InvalidateObjPos();
}
+ // keep new top of line value
+ mnLastTopOfLine = nTopOfLine;
}
void SwAnchoredObject::ClearCharRectAndTopOfLine()
@@ -617,48 +617,48 @@ void SwAnchoredObject::SetObjLeft( const SwTwips _nLeft)
*/
void SwAnchoredObject::UpdateObjInSortedList()
{
- if ( GetAnchorFrame() )
+ if ( !GetAnchorFrame() )
+ return;
+
+ if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) )
{
- if ( GetFrameFormat().getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) )
+ // invalidate position of all anchored objects at anchor frame
+ if ( GetAnchorFrame()->GetDrawObjs() )
{
- // invalidate position of all anchored objects at anchor frame
- if ( GetAnchorFrame()->GetDrawObjs() )
- {
- const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs();
- // determine start index
- for (auto it = pObjs->begin(); it != pObjs->end(); ++it)
- {
- SwAnchoredObject* pAnchoredObj = *it;
- if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
- pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
- else
- pAnchoredObj->InvalidateObjPos();
- }
- }
- // invalidate all following anchored objects on the page frame
- if ( GetPageFrame() && GetPageFrame()->GetSortedObjs() )
+ const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs();
+ // determine start index
+ for (auto it = pObjs->begin(); it != pObjs->end(); ++it)
{
- const SwSortedObjs* pObjs = GetPageFrame()->GetSortedObjs();
- // determine start index
- for ( size_t i = pObjs->ListPosOf( *this ) + 1; i < pObjs->size(); ++i )
- {
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
- if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
- pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
- else
- pAnchoredObj->InvalidateObjPos();
- }
+ SwAnchoredObject* pAnchoredObj = *it;
+ if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
+ pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
+ else
+ pAnchoredObj->InvalidateObjPos();
}
}
- // update its position in the sorted object list of its anchor frame
- AnchorFrame()->GetDrawObjs()->Update( *this );
- // update its position in the sorted object list of its page frame
- // note: as-character anchored object aren't registered at a page frame
- if ( GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR )
+ // invalidate all following anchored objects on the page frame
+ if ( GetPageFrame() && GetPageFrame()->GetSortedObjs() )
{
- GetPageFrame()->GetSortedObjs()->Update( *this );
+ const SwSortedObjs* pObjs = GetPageFrame()->GetSortedObjs();
+ // determine start index
+ for ( size_t i = pObjs->ListPosOf( *this ) + 1; i < pObjs->size(); ++i )
+ {
+ SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
+ if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
+ pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
+ else
+ pAnchoredObj->InvalidateObjPos();
+ }
}
}
+ // update its position in the sorted object list of its anchor frame
+ AnchorFrame()->GetDrawObjs()->Update( *this );
+ // update its position in the sorted object list of its page frame
+ // note: as-character anchored object aren't registered at a page frame
+ if ( GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR )
+ {
+ GetPageFrame()->GetSortedObjs()->Update( *this );
+ }
}
/** method to determine, if invalidation of position is allowed
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 976b38ce997e..b07b4ce99581 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -129,51 +129,51 @@ static void lcl_DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat )
bDel = false;
}
- if ( bDel )
- {
- // If there is a Cursor registered in one of the nodes, we need to call the
- // ParkCursor in an (arbitrary) shell.
- SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent());
- if ( rCnt.GetContentIdx() )
- {
- SwNode *pNode = nullptr;
+ if ( !bDel )
+ return;
+
+ // If there is a Cursor registered in one of the nodes, we need to call the
+ // ParkCursor in an (arbitrary) shell.
+ SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent());
+ if ( rCnt.GetContentIdx() )
+ {
+ SwNode *pNode = nullptr;
+ {
+ // #i92993#
+ // Begin with start node of page header/footer to assure that
+ // complete content is checked for cursors and the complete content
+ // is deleted on below made method call <pDoc->getIDocumentContentOperations().DeleteSection(pNode)>
+ SwNodeIndex aIdx( *rCnt.GetContentIdx(), 0 );
+ // If there is a Cursor registered in one of the nodes, we need to call the
+ // ParkCursor in an (arbitrary) shell.
+ pNode = & aIdx.GetNode();
+ sal_uInt32 nEnd = pNode->EndOfSectionIndex();
+ while ( aIdx < nEnd )
{
- // #i92993#
- // Begin with start node of page header/footer to assure that
- // complete content is checked for cursors and the complete content
- // is deleted on below made method call <pDoc->getIDocumentContentOperations().DeleteSection(pNode)>
- SwNodeIndex aIdx( *rCnt.GetContentIdx(), 0 );
- // If there is a Cursor registered in one of the nodes, we need to call the
- // ParkCursor in an (arbitrary) shell.
- pNode = & aIdx.GetNode();
- sal_uInt32 nEnd = pNode->EndOfSectionIndex();
- while ( aIdx < nEnd )
+ if ( pNode->IsContentNode() &&
+ static_cast<SwContentNode*>(pNode)->HasWriterListeners() )
{
- if ( pNode->IsContentNode() &&
- static_cast<SwContentNode*>(pNode)->HasWriterListeners() )
+ SwCursorShell *pShell = SwIterator<SwCursorShell,SwContentNode>( *static_cast<SwContentNode*>(pNode) ).First();
+ if( pShell )
{
- SwCursorShell *pShell = SwIterator<SwCursorShell,SwContentNode>( *static_cast<SwContentNode*>(pNode) ).First();
- if( pShell )
- {
- pShell->ParkCursor( aIdx );
- aIdx = nEnd-1;
- }
+ pShell->ParkCursor( aIdx );
+ aIdx = nEnd-1;
}
- ++aIdx;
- pNode = & aIdx.GetNode();
}
+ ++aIdx;
+ pNode = & aIdx.GetNode();
}
- rCnt.SetNewContentIdx( nullptr );
+ }
+ rCnt.SetNewContentIdx( nullptr );
- // When deleting a header/footer-format, we ALWAYS need to disable
- // the undo function (Bug 31069)
- ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ // When deleting a header/footer-format, we ALWAYS need to disable
+ // the undo function (Bug 31069)
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
- OSL_ENSURE( pNode, "A big problem." );
- pDoc->getIDocumentContentOperations().DeleteSection( pNode );
- }
- delete pFormat;
+ OSL_ENSURE( pNode, "A big problem." );
+ pDoc->getIDocumentContentOperations().DeleteSection( pNode );
}
+ delete pFormat;
}
void SwFormatFrameSize::ScaleMetrics(long lMult, long lDiv) {
@@ -639,28 +639,28 @@ void SwFormatPageDesc::SwClientNotify( const SwModify& rModify, const SfxHint& r
{
SwClient::SwClientNotify(rModify, rHint);
const SwPageDescHint* pHint = dynamic_cast<const SwPageDescHint*>(&rHint);
- if ( pHint )
- {
- // mba: shouldn't that be broadcasted also?
- SwFormatPageDesc aDfltDesc( pHint->GetPageDesc() );
- SwPageDesc* pDesc = pHint->GetPageDesc();
- const SwModify* pMod = GetDefinedIn();
- if ( pMod )
- {
- if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
- const_cast<SwContentNode*>(pContentNode)->SetAttr( aDfltDesc );
- else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
- const_cast<SwFormat*>(pFormat)->SetFormatAttr( aDfltDesc );
- else
- {
- OSL_FAIL( "What kind of SwModify is this?" );
- RegisterToPageDesc( *pDesc );
- }
- }
+ if ( !pHint )
+ return;
+
+ // mba: shouldn't that be broadcasted also?
+ SwFormatPageDesc aDfltDesc( pHint->GetPageDesc() );
+ SwPageDesc* pDesc = pHint->GetPageDesc();
+ const SwModify* pMod = GetDefinedIn();
+ if ( pMod )
+ {
+ if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
+ const_cast<SwContentNode*>(pContentNode)->SetAttr( aDfltDesc );
+ else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
+ const_cast<SwFormat*>(pFormat)->SetFormatAttr( aDfltDesc );
else
- // there could be an Undo-copy
+ {
+ OSL_FAIL( "What kind of SwModify is this?" );
RegisterToPageDesc( *pDesc );
+ }
}
+ else
+ // there could be an Undo-copy
+ RegisterToPageDesc( *pDesc );
}
void SwFormatPageDesc::RegisterToPageDesc( SwPageDesc& rDesc )
@@ -2965,92 +2965,92 @@ void SwFlyFrameFormat::MakeFrames()
break;
}
- if( pModify )
+ if( !pModify )
+ return;
+
+ SwIterator<SwFrame, SwModify, sw::IteratorMode::UnwrapMulti> aIter(*pModify);
+ for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
{
- SwIterator<SwFrame, SwModify, sw::IteratorMode::UnwrapMulti> aIter(*pModify);
- for( SwFrame *pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
- {
- bool bAdd = !pFrame->IsContentFrame() ||
- !static_cast<SwContentFrame*>(pFrame)->IsFollow();
+ bool bAdd = !pFrame->IsContentFrame() ||
+ !static_cast<SwContentFrame*>(pFrame)->IsFollow();
- if ( RndStdIds::FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrame->IsFlyFrame() )
+ if ( RndStdIds::FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrame->IsFlyFrame() )
+ {
+ SwFrame* pFlyFrame = pFrame->FindFlyFrame();
+ if ( pFlyFrame )
{
- SwFrame* pFlyFrame = pFrame->FindFlyFrame();
- if ( pFlyFrame )
- {
- pFrame = pFlyFrame;
- }
- else
- {
- aAnchorAttr.SetType( RndStdIds::FLY_AT_PARA );
- SetFormatAttr( aAnchorAttr );
- MakeFrames();
- return;
- }
+ pFrame = pFlyFrame;
+ }
+ else
+ {
+ aAnchorAttr.SetType( RndStdIds::FLY_AT_PARA );
+ SetFormatAttr( aAnchorAttr );
+ MakeFrames();
+ return;
}
+ }
- if (bAdd)
+ if (bAdd)
+ {
+ switch (aAnchorAttr.GetAnchorId())
{
- switch (aAnchorAttr.GetAnchorId())
+ case RndStdIds::FLY_AS_CHAR:
+ case RndStdIds::FLY_AT_PARA:
+ case RndStdIds::FLY_AT_CHAR:
{
- case RndStdIds::FLY_AS_CHAR:
- case RndStdIds::FLY_AT_PARA:
- case RndStdIds::FLY_AT_CHAR:
- {
- assert(pFrame->IsTextFrame());
- bAdd = IsAnchoredObjShown(*static_cast<SwTextFrame*>(pFrame), aAnchorAttr);
- }
- break;
- default:
- break;
+ assert(pFrame->IsTextFrame());
+ bAdd = IsAnchoredObjShown(*static_cast<SwTextFrame*>(pFrame), aAnchorAttr);
}
+ break;
+ default:
+ break;
}
+ }
- if (bAdd && pFrame->GetDrawObjs())
+ if (bAdd && pFrame->GetDrawObjs())
+ {
+ // #i28701# - new type <SwSortedObjs>
+ SwSortedObjs &rObjs = *pFrame->GetDrawObjs();
+ for(SwAnchoredObject* pObj : rObjs)
{
- // #i28701# - new type <SwSortedObjs>
- SwSortedObjs &rObjs = *pFrame->GetDrawObjs();
- for(SwAnchoredObject* pObj : rObjs)
+ // #i28701# - consider changed type of
+ // <SwSortedObjs> entries.
+ if( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr &&
+ (&pObj->GetFrameFormat()) == this )
{
- // #i28701# - consider changed type of
- // <SwSortedObjs> entries.
- if( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr &&
- (&pObj->GetFrameFormat()) == this )
- {
- bAdd = false;
- break;
- }
+ bAdd = false;
+ break;
}
}
+ }
- if( bAdd )
+ if( bAdd )
+ {
+ SwFlyFrame *pFly = nullptr; // avoid warnings
+ switch( aAnchorAttr.GetAnchorId() )
{
- SwFlyFrame *pFly = nullptr; // avoid warnings
- switch( aAnchorAttr.GetAnchorId() )
- {
- case RndStdIds::FLY_AT_FLY:
- pFly = new SwFlyLayFrame( this, pFrame, pFrame );
- break;
+ case RndStdIds::FLY_AT_FLY:
+ pFly = new SwFlyLayFrame( this, pFrame, pFrame );
+ break;
- case RndStdIds::FLY_AT_PARA:
- case RndStdIds::FLY_AT_CHAR:
- pFly = new SwFlyAtContentFrame( this, pFrame, pFrame );
- break;
+ case RndStdIds::FLY_AT_PARA:
+ case RndStdIds::FLY_AT_CHAR:
+ pFly = new SwFlyAtContentFrame( this, pFrame, pFrame );
+ break;
- case RndStdIds::FLY_AS_CHAR:
- pFly = new SwFlyInContentFrame( this, pFrame, pFrame );
- break;
+ case RndStdIds::FLY_AS_CHAR:
+ pFly = new SwFlyInContentFrame( this, pFrame, pFrame );
+ break;
- default:
- assert(false && "New anchor type" );
- }
- pFrame->AppendFly( pFly );
- pFly->GetFormat()->SetObjTitle(GetObjTitle());
- pFly->GetFormat()->SetObjDescription(GetObjDescription());
- SwPageFrame *pPage = pFly->FindPageFrame();
- if( pPage )
- ::RegistFlys( pPage, pFly );
+ default:
+ assert(false && "New anchor type" );
}
+ pFrame->AppendFly( pFly );
+ pFly->GetFormat()->SetObjTitle(GetObjTitle());
+ pFly->GetFormat()->SetObjDescription(GetObjDescription());
+ SwPageFrame *pPage = pFly->FindPageFrame();
+ if( pPage )
+ ::RegistFlys( pPage, pFly );
}
}
}
@@ -3582,39 +3582,39 @@ void CheckAnchoredFlyConsistency(SwDoc const& rDoc)
}
}
SwFrameFormats const*const pSpzFrameFormats(rDoc.GetSpzFrameFormats());
- if (pSpzFrameFormats)
+ if (!pSpzFrameFormats)
+ return;
+
+ for (auto it = pSpzFrameFormats->begin(); it != pSpzFrameFormats->end(); ++it)
{
- for (auto it = pSpzFrameFormats->begin(); it != pSpzFrameFormats->end(); ++it)
+ SwFormatAnchor const& rAnchor((**it).GetAnchor(false));
+ if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
{
- SwFormatAnchor const& rAnchor((**it).GetAnchor(false));
- if (RndStdIds::FLY_AT_PAGE == rAnchor.GetAnchorId())
- {
- assert(!rAnchor.GetContentAnchor()
- // for invalid documents that lack text:anchor-page-number
- // it may have an anchor before MakeFrames() is called
- || (!SwIterator<SwFrame, SwFrameFormat>(**it).First()));
- }
- else
+ assert(!rAnchor.GetContentAnchor()
+ // for invalid documents that lack text:anchor-page-number
+ // it may have an anchor before MakeFrames() is called
+ || (!SwIterator<SwFrame, SwFrameFormat>(**it).First()));
+ }
+ else
+ {
+ SwNode & rNode(rAnchor.GetContentAnchor()->nNode.GetNode());
+ std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
+ assert(std::find(pFlys->begin(), pFlys->end(), *it) != pFlys->end());
+ switch (rAnchor.GetAnchorId())
{
- SwNode & rNode(rAnchor.GetContentAnchor()->nNode.GetNode());
- std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
- assert(std::find(pFlys->begin(), pFlys->end(), *it) != pFlys->end());
- switch (rAnchor.GetAnchorId())
- {
- case RndStdIds::FLY_AT_FLY:
- assert(rNode.IsStartNode());
- break;
- case RndStdIds::FLY_AT_PARA:
- assert(rNode.IsTextNode() || rNode.IsTableNode());
- break;
- case RndStdIds::FLY_AS_CHAR:
- case RndStdIds::FLY_AT_CHAR:
- assert(rNode.IsTextNode());
- break;
- default:
- assert(false);
- break;
- }
+ case RndStdIds::FLY_AT_FLY:
+ assert(rNode.IsStartNode());
+ break;
+ case RndStdIds::FLY_AT_PARA:
+ assert(rNode.IsTextNode() || rNode.IsTableNode());
+ break;
+ case RndStdIds::FLY_AS_CHAR:
+ case RndStdIds::FLY_AT_CHAR:
+ assert(rNode.IsTextNode());
+ break;
+ default:
+ assert(false);
+ break;
}
}
}
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 5094c145c217..39d4bcd1f32b 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -533,33 +533,95 @@ static SwFrame* lcl_NotHiddenPrev( SwFrame* pFrame )
void SwFrame::MakePos()
{
- if ( !isFrameAreaPositionValid() )
+ if ( isFrameAreaPositionValid() )
+ return;
+
+ setFrameAreaPositionValid(true);
+ bool bUseUpper = false;
+ SwFrame* pPrv = lcl_Prev( this );
+ if ( pPrv &&
+ ( !pPrv->IsContentFrame() ||
+ ( static_cast<SwContentFrame*>(pPrv)->GetFollow() != this ) )
+ )
{
- setFrameAreaPositionValid(true);
- bool bUseUpper = false;
- SwFrame* pPrv = lcl_Prev( this );
- if ( pPrv &&
- ( !pPrv->IsContentFrame() ||
- ( static_cast<SwContentFrame*>(pPrv)->GetFollow() != this ) )
+ if ( !StackHack::IsLocked() &&
+ ( !IsInSct() || IsSctFrame() ) &&
+ !pPrv->IsSctFrame() &&
+ !pPrv->GetAttrSet()->GetKeep().GetValue()
)
{
- if ( !StackHack::IsLocked() &&
- ( !IsInSct() || IsSctFrame() ) &&
- !pPrv->IsSctFrame() &&
- !pPrv->GetAttrSet()->GetKeep().GetValue()
- )
+ pPrv->Calc(getRootFrame()->GetCurrShell() ? getRootFrame()->GetCurrShell()->GetOut() : nullptr); // This may cause Prev to vanish!
+ }
+ else if ( pPrv->getFrameArea().Top() == 0 )
+ {
+ bUseUpper = true;
+ }
+ }
+
+ pPrv = lcl_Prev( this, false );
+ const SwFrameType nMyType = GetType();
+ SwRectFnSet aRectFnSet((IsCellFrame() && GetUpper() ? GetUpper() : this));
+ if ( !bUseUpper && pPrv )
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aFrm.Pos( pPrv->getFrameArea().Pos() );
+
+ if( FRM_NEIGHBOUR & nMyType )
+ {
+ const bool bR2L = IsRightToLeft();
+
+ if( bR2L )
+ {
+ aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) - aRectFnSet.GetWidth(aFrm) );
+ }
+ else
{
- pPrv->Calc(getRootFrame()->GetCurrShell() ? getRootFrame()->GetCurrShell()->GetOut() : nullptr); // This may cause Prev to vanish!
+ aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) + aRectFnSet.GetWidth(pPrv->getFrameArea()) );
}
- else if ( pPrv->getFrameArea().Top() == 0 )
+
+ // cells may now leave their uppers
+ if( aRectFnSet.IsVert() && SwFrameType::Cell & nMyType )
{
- bUseUpper = true;
+ aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + pPrv->getFrameArea().Width());
}
}
-
+ else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType )
+ {
+ if ( aRectFnSet.IsVertL2R() )
+ {
+ aFrm.Pos().setX(aFrm.Pos().getX() + pPrv->getFrameArea().Width());
+ }
+ else
+ {
+ aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width());
+ }
+ }
+ else
+ {
+ aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->getFrameArea().Height());
+ }
+ }
+ else if ( GetUpper() )
+ {
+ // If parent frame is a footer frame and its <ColLocked()>, then
+ // do *not* calculate it.
+ // NOTE: Footer frame is <ColLocked()> during its
+ // <FormatSize(..)>, which is called from <Format(..)>, which
+ // is called from <MakeAll()>, which is called from <Calc()>.
+ // #i56850#
+ // - no format of upper Writer fly frame, which is anchored
+ // at-paragraph or at-character.
+ if ( !GetUpper()->IsTabFrame() &&
+ !( IsTabFrame() && GetUpper()->IsInTab() ) &&
+ !GetUpper()->IsSctFrame() &&
+ !dynamic_cast<SwFlyAtContentFrame*>(GetUpper()) &&
+ !( GetUpper()->IsFooterFrame() &&
+ GetUpper()->IsColLocked() )
+ )
+ {
+ GetUpper()->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ }
pPrv = lcl_Prev( this, false );
- const SwFrameType nMyType = GetType();
- SwRectFnSet aRectFnSet((IsCellFrame() && GetUpper() ? GetUpper() : this));
if ( !bUseUpper && pPrv )
{
SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
@@ -586,120 +648,58 @@ void SwFrame::MakePos()
}
else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType )
{
- if ( aRectFnSet.IsVertL2R() )
- {
- aFrm.Pos().setX(aFrm.Pos().getX() + pPrv->getFrameArea().Width());
- }
- else
- {
- aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width());
- }
+ aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width());
}
else
{
aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->getFrameArea().Height());
}
}
- else if ( GetUpper() )
+ else
{
- // If parent frame is a footer frame and its <ColLocked()>, then
- // do *not* calculate it.
- // NOTE: Footer frame is <ColLocked()> during its
- // <FormatSize(..)>, which is called from <Format(..)>, which
- // is called from <MakeAll()>, which is called from <Calc()>.
- // #i56850#
- // - no format of upper Writer fly frame, which is anchored
- // at-paragraph or at-character.
- if ( !GetUpper()->IsTabFrame() &&
- !( IsTabFrame() && GetUpper()->IsInTab() ) &&
- !GetUpper()->IsSctFrame() &&
- !dynamic_cast<SwFlyAtContentFrame*>(GetUpper()) &&
- !( GetUpper()->IsFooterFrame() &&
- GetUpper()->IsColLocked() )
- )
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aFrm.Pos( GetUpper()->getFrameArea().Pos() );
+
+ if( GetUpper()->IsFlyFrame() )
{
- GetUpper()->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ aFrm.Pos() += static_cast<SwFlyFrame*>(GetUpper())->ContentPos();
}
- pPrv = lcl_Prev( this, false );
- if ( !bUseUpper && pPrv )
+ else
{
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aFrm.Pos( pPrv->getFrameArea().Pos() );
-
- if( FRM_NEIGHBOUR & nMyType )
- {
- const bool bR2L = IsRightToLeft();
-
- if( bR2L )
- {
- aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) - aRectFnSet.GetWidth(aFrm) );
- }
- else
- {
- aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) + aRectFnSet.GetWidth(pPrv->getFrameArea()) );
- }
+ aFrm.Pos() += GetUpper()->getFramePrintArea().Pos();
+ }
- // cells may now leave their uppers
- if( aRectFnSet.IsVert() && SwFrameType::Cell & nMyType )
- {
- aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + pPrv->getFrameArea().Width());
- }
- }
- else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType )
+ if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() )
+ {
+ if( aRectFnSet.IsVert() )
{
- aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width());
+ aFrm.Pos().setY(aFrm.Pos().getY() + GetUpper()->getFramePrintArea().Height() - aFrm.Height());
}
else
{
- aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->getFrameArea().Height());
+ aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->getFramePrintArea().Width() - aFrm.Width());
}
}
- else
+ else if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && FRM_NOTE_VERT & nMyType )
{
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aFrm.Pos( GetUpper()->getFrameArea().Pos() );
-
- if( GetUpper()->IsFlyFrame() )
- {
- aFrm.Pos() += static_cast<SwFlyFrame*>(GetUpper())->ContentPos();
- }
- else
- {
- aFrm.Pos() += GetUpper()->getFramePrintArea().Pos();
- }
-
- if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() )
- {
- if( aRectFnSet.IsVert() )
- {
- aFrm.Pos().setY(aFrm.Pos().getY() + GetUpper()->getFramePrintArea().Height() - aFrm.Height());
- }
- else
- {
- aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->getFramePrintArea().Width() - aFrm.Width());
- }
- }
- else if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && FRM_NOTE_VERT & nMyType )
- {
- aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + GetUpper()->getFramePrintArea().Width());
- }
+ aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + GetUpper()->getFramePrintArea().Width());
}
}
- else
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aFrm.Pos().setX(0);
- aFrm.Pos().setY(0);
- }
-
- if( IsBodyFrame() && aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && GetUpper() )
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->getFramePrintArea().Width() - aFrm.Width());
- }
+ }
+ else
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aFrm.Pos().setX(0);
+ aFrm.Pos().setY(0);
+ }
- setFrameAreaPositionValid(true);
+ if( IsBodyFrame() && aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && GetUpper() )
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->getFramePrintArea().Width() - aFrm.Width());
}
+
+ setFrameAreaPositionValid(true);
}
// #i28701# - new type <SwSortedObjs>
@@ -1068,135 +1068,135 @@ bool SwFrame::IsCollapse() const
void SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
{
- if ( !isFramePrintAreaValid() )
- {
- setFramePrintAreaValid(true);
- SwRectFnSet aRectFnSet(this);
- const bool bTextFrame = IsTextFrame();
- SwTwips nUpper = 0;
- if ( bTextFrame && static_cast<SwTextFrame*>(this)->IsHiddenNow() )
- {
- if ( static_cast<SwTextFrame*>(this)->HasFollow() )
- static_cast<SwTextFrame*>(this)->JoinFrame();
+ if ( isFramePrintAreaValid() )
+ return;
- if( aRectFnSet.GetHeight(getFramePrintArea()) )
- {
- static_cast<SwTextFrame*>(this)->HideHidden();
- }
+ setFramePrintAreaValid(true);
+ SwRectFnSet aRectFnSet(this);
+ const bool bTextFrame = IsTextFrame();
+ SwTwips nUpper = 0;
+ if ( bTextFrame && static_cast<SwTextFrame*>(this)->IsHiddenNow() )
+ {
+ if ( static_cast<SwTextFrame*>(this)->HasFollow() )
+ static_cast<SwTextFrame*>(this)->JoinFrame();
- {
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aPrt.Pos().setX(0);
- aPrt.Pos().setY(0);
- aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(getFrameArea()) );
- aRectFnSet.SetHeight( aPrt, 0 );
- }
+ if( aRectFnSet.GetHeight(getFramePrintArea()) )
+ {
+ static_cast<SwTextFrame*>(this)->HideHidden();
+ }
- nUpper = -( aRectFnSet.GetHeight(getFrameArea()) );
+ {
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aPrt.Pos().setX(0);
+ aPrt.Pos().setY(0);
+ aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(getFrameArea()) );
+ aRectFnSet.SetHeight( aPrt, 0 );
}
- else
+
+ nUpper = -( aRectFnSet.GetHeight(getFrameArea()) );
+ }
+ else
+ {
+ // Simplification: ContentFrames are always variable in height!
+
+ // At the FixSize, the surrounding Frame enforces the size;
+ // the borders are simply subtracted.
+ const long nLeft = rAttrs.CalcLeft( this );
+ const long nRight = rAttrs.CalcRight( this );
+ aRectFnSet.SetXMargins( *this, nLeft, nRight );
+
+ SwViewShell *pSh = getRootFrame()->GetCurrShell();
+ SwTwips nWidthArea;
+ if( pSh && 0!=(nWidthArea=aRectFnSet.GetWidth(pSh->VisArea())) &&
+ GetUpper()->IsPageBodyFrame() && // but not for BodyFrames in Columns
+ pSh->GetViewOptions()->getBrowseMode() )
{
- // Simplification: ContentFrames are always variable in height!
-
- // At the FixSize, the surrounding Frame enforces the size;
- // the borders are simply subtracted.
- const long nLeft = rAttrs.CalcLeft( this );
- const long nRight = rAttrs.CalcRight( this );
- aRectFnSet.SetXMargins( *this, nLeft, nRight );
-
- SwViewShell *pSh = getRootFrame()->GetCurrShell();
- SwTwips nWidthArea;
- if( pSh && 0!=(nWidthArea=aRectFnSet.GetWidth(pSh->VisArea())) &&
- GetUpper()->IsPageBodyFrame() && // but not for BodyFrames in Columns
- pSh->GetViewOptions()->getBrowseMode() )
- {
- // Do not protrude the edge of the visible area. The page may be
- // wider, because there may be objects with excess width
- // (RootFrame::ImplCalcBrowseWidth())
- long nMinWidth = 0;
+ // Do not protrude the edge of the visible area. The page may be
+ // wider, because there may be objects with excess width
+ // (RootFrame::ImplCalcBrowseWidth())
+ long nMinWidth = 0;
- for (size_t i = 0; GetDrawObjs() && i < GetDrawObjs()->size(); ++i)
+ for (size_t i = 0; GetDrawObjs() && i < GetDrawObjs()->size(); ++i)
+ {
+ // #i28701# - consider changed type of
+ // <SwSortedObjs> entries
+ SwAnchoredObject* pObj = (*GetDrawObjs())[i];
+ const SwFrameFormat& rFormat = pObj->GetFrameFormat();
+ const bool bFly = dynamic_cast<const SwFlyFrame*>( pObj) != nullptr;
+ if ((bFly && (FAR_AWAY == pObj->GetObjRect().Width()))
+ || rFormat.GetFrameSize().GetWidthPercent())
{
- // #i28701# - consider changed type of
- // <SwSortedObjs> entries
- SwAnchoredObject* pObj = (*GetDrawObjs())[i];
- const SwFrameFormat& rFormat = pObj->GetFrameFormat();
- const bool bFly = dynamic_cast<const SwFlyFrame*>( pObj) != nullptr;
- if ((bFly && (FAR_AWAY == pObj->GetObjRect().Width()))
- || rFormat.GetFrameSize().GetWidthPercent())
- {
- continue;
- }
-
- if ( RndStdIds::FLY_AS_CHAR == rFormat.GetAnchor().GetAnchorId() )
- {
- nMinWidth = std::max( nMinWidth,
- bFly ? rFormat.GetFrameSize().GetWidth()
- : pObj->GetObjRect().Width() );
- }
+ continue;
}
- const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
- long nWidth = nWidthArea - 2 * ( IsVertical() ? aBorder.Height() : aBorder.Width() );
- nWidth -= aRectFnSet.GetLeft(getFramePrintArea());
- nWidth -= rAttrs.CalcRightLine();
- nWidth = std::max( nMinWidth, nWidth );
-
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aRectFnSet.SetWidth( aPrt, std::min( nWidth, aRectFnSet.GetWidth(aPrt) ) );
- }
-
- if ( aRectFnSet.GetWidth(getFramePrintArea()) <= MINLAY )
- {
- // The PrtArea should already be at least MINLAY wide, matching the
- // minimal values of the UI
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aRectFnSet.SetWidth( aPrt, std::min( long(MINLAY), aRectFnSet.GetWidth(getFrameArea()) ) );
- SwTwips nTmp = aRectFnSet.GetWidth(getFrameArea()) - aRectFnSet.GetWidth(aPrt);
-
- if( aRectFnSet.GetLeft(aPrt) > nTmp )
+ if ( RndStdIds::FLY_AS_CHAR == rFormat.GetAnchor().GetAnchorId() )
{
- aRectFnSet.SetLeft( aPrt, nTmp );
+ nMinWidth = std::max( nMinWidth,
+ bFly ? rFormat.GetFrameSize().GetWidth()
+ : pObj->GetObjRect().Width() );
}
}
- // The following rules apply for VarSize:
- // 1. The first entry of a chain has no top border
- // 2. There is never a bottom border
- // 3. The top border is the maximum of the distance
- // of Prev downwards and our own distance upwards
- // Those three rules apply when calculating spacings
- // that are given by UL- and LRSpace. There might be a spacing
- // in all directions however; this may be caused by borders
- // and / or shadows.
- // 4. The spacing for TextFrames corresponds to the interline lead,
- // at a minimum.
-
- nUpper = CalcUpperSpace( &rAttrs );
-
- SwTwips nLower = CalcLowerSpace( &rAttrs );
- if (IsCollapse()) {
- nUpper=0;
- nLower=0;
- }
+ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+ long nWidth = nWidthArea - 2 * ( IsVertical() ? aBorder.Height() : aBorder.Width() );
+ nWidth -= aRectFnSet.GetLeft(getFramePrintArea());
+ nWidth -= rAttrs.CalcRightLine();
+ nWidth = std::max( nMinWidth, nWidth );
+
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aRectFnSet.SetWidth( aPrt, std::min( nWidth, aRectFnSet.GetWidth(aPrt) ) );
+ }
+
+ if ( aRectFnSet.GetWidth(getFramePrintArea()) <= MINLAY )
+ {
+ // The PrtArea should already be at least MINLAY wide, matching the
+ // minimal values of the UI
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aRectFnSet.SetWidth( aPrt, std::min( long(MINLAY), aRectFnSet.GetWidth(getFrameArea()) ) );
+ SwTwips nTmp = aRectFnSet.GetWidth(getFrameArea()) - aRectFnSet.GetWidth(aPrt);
+ if( aRectFnSet.GetLeft(aPrt) > nTmp )
{
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aRectFnSet.SetPosY( aPrt, !aRectFnSet.IsVert() ? nUpper : nLower);
+ aRectFnSet.SetLeft( aPrt, nTmp );
}
+ }
- nUpper += nLower;
- nUpper -= aRectFnSet.GetHeight(getFrameArea()) - aRectFnSet.GetHeight(getFramePrintArea());
+ // The following rules apply for VarSize:
+ // 1. The first entry of a chain has no top border
+ // 2. There is never a bottom border
+ // 3. The top border is the maximum of the distance
+ // of Prev downwards and our own distance upwards
+ // Those three rules apply when calculating spacings
+ // that are given by UL- and LRSpace. There might be a spacing
+ // in all directions however; this may be caused by borders
+ // and / or shadows.
+ // 4. The spacing for TextFrames corresponds to the interline lead,
+ // at a minimum.
+
+ nUpper = CalcUpperSpace( &rAttrs );
+
+ SwTwips nLower = CalcLowerSpace( &rAttrs );
+ if (IsCollapse()) {
+ nUpper=0;
+ nLower=0;
}
- // If there's a difference between old and new size, call Grow() or
- // Shrink() respectively.
- if ( nUpper )
+
{
- if ( nUpper > 0 )
- GrowFrame( nUpper );
- else
- ShrinkFrame( -nUpper );
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aRectFnSet.SetPosY( aPrt, !aRectFnSet.IsVert() ? nUpper : nLower);
}
+
+ nUpper += nLower;
+ nUpper -= aRectFnSet.GetHeight(getFrameArea()) - aRectFnSet.GetHeight(getFramePrintArea());
+ }
+ // If there's a difference between old and new size, call Grow() or
+ // Shrink() respectively.
+ if ( nUpper )
+ {
+ if ( nUpper > 0 )
+ GrowFrame( nUpper );
+ else
+ ShrinkFrame( -nUpper );
}
}
diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index dfb438953688..2ef9539aff5d 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -411,34 +411,34 @@ void SwLayoutFrame::AdjustColumns( const SwFormatCol *pAttr, bool bAdjustAttribu
pCol = bR2L ? pCol->GetPrev() : pCol->GetNext();
}
- if( bOrtho )
+ if( !bOrtho )
+ return;
+
+ long nInnerWidth = ( nAvail - nGutter ) / pAttr->GetNumCols();
+ pCol = Lower();
+ for( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; pCol = pCol->GetNext(), ++i ) //i118878, value returned by GetNumCols() can't be trusted
{
- long nInnerWidth = ( nAvail - nGutter ) / pAttr->GetNumCols();
- pCol = Lower();
- for( sal_uInt16 i = 0; i < pAttr->GetNumCols() && pCol; pCol = pCol->GetNext(), ++i ) //i118878, value returned by GetNumCols() can't be trusted
+ SwTwips nWidth;
+ if ( i == pAttr->GetNumCols() - 1 )
+ nWidth = nAvail;
+ else
{
- SwTwips nWidth;
- if ( i == pAttr->GetNumCols() - 1 )
- nWidth = nAvail;
- else
- {
- SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() );
- nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight();
- }
- if( nWidth < 0 )
- nWidth = 0;
+ SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() );
+ nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight();
+ }
+ if( nWidth < 0 )
+ nWidth = 0;
- const Size aColSz = bVert ?
- Size( getFramePrintArea().Width(), nWidth ) :
- Size( nWidth, getFramePrintArea().Height() );
+ const Size aColSz = bVert ?
+ Size( getFramePrintArea().Width(), nWidth ) :
+ Size( nWidth, getFramePrintArea().Height() );
- pCol->ChgSize( aColSz );
+ pCol->ChgSize( aColSz );
- if( IsBodyFrame() )
- static_cast<SwLayoutFrame*>(pCol)->Lower()->ChgSize( aColSz );
+ if( IsBodyFrame() )
+ static_cast<SwLayoutFrame*>(pCol)->Lower()->ChgSize( aColSz );
- nAvail -= nWidth;
- }
+ nAvail -= nWidth;
}
}
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index b3d8c4dfc494..13aad81eafaf 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1230,44 +1230,44 @@ SwFrame *SwFrame::FindPrev_()
void SwFrame::ImplInvalidateNextPos( bool bNoFootnote )
{
SwFrame *pFrame = FindNext_();
- if ( nullptr != pFrame )
+ if ( nullptr == pFrame )
+ return;
+
+ if( pFrame->IsSctFrame() )
{
- if( pFrame->IsSctFrame() )
+ while( pFrame && pFrame->IsSctFrame() )
{
- while( pFrame && pFrame->IsSctFrame() )
+ if( static_cast<SwSectionFrame*>(pFrame)->GetSection() )
{
- if( static_cast<SwSectionFrame*>(pFrame)->GetSection() )
- {
- SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
- if( pTmp )
- pTmp->InvalidatePos();
- else if( !bNoFootnote )
- static_cast<SwSectionFrame*>(pFrame)->InvalidateFootnotePos();
- if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
- pFrame->InvalidatePos();
- return;
- }
- pFrame = pFrame->FindNext();
+ SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
+ if( pTmp )
+ pTmp->InvalidatePos();
+ else if( !bNoFootnote )
+ static_cast<SwSectionFrame*>(pFrame)->InvalidateFootnotePos();
+ if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
+ pFrame->InvalidatePos();
+ return;
}
- if( pFrame )
+ pFrame = pFrame->FindNext();
+ }
+ if( pFrame )
+ {
+ if ( pFrame->IsSctFrame())
{
- if ( pFrame->IsSctFrame())
- {
- // We need to invalidate the section's content so it gets
- // the chance to flow to a different page.
- SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
- if( pTmp )
- pTmp->InvalidatePos();
- if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
- pFrame->InvalidatePos();
- }
- else
+ // We need to invalidate the section's content so it gets
+ // the chance to flow to a different page.
+ SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
+ if( pTmp )
+ pTmp->InvalidatePos();
+ if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
pFrame->InvalidatePos();
}
+ else
+ pFrame->InvalidatePos();
}
- else
- pFrame->InvalidatePos();
}
+ else
+ pFrame->InvalidatePos();
}
/** method to invalidate printing area of next frame
@@ -1293,32 +1293,32 @@ void SwFrame::InvalidateNextPrtArea()
}
// Invalidate printing area of found next frame
- if ( pNextFrame )
+ if ( !pNextFrame )
+ return;
+
+ if ( pNextFrame->IsSctFrame() )
{
- if ( pNextFrame->IsSctFrame() )
+ // Invalidate printing area of found section frame, if
+ // (1) this text frame isn't in a section OR
+ // (2) found section frame isn't a follow of the section frame this
+ // text frame is in.
+ if ( !IsInSct() || FindSctFrame()->GetFollow() != pNextFrame )
{
- // Invalidate printing area of found section frame, if
- // (1) this text frame isn't in a section OR
- // (2) found section frame isn't a follow of the section frame this
- // text frame is in.
- if ( !IsInSct() || FindSctFrame()->GetFollow() != pNextFrame )
- {
- pNextFrame->InvalidatePrt();
- }
-
- // Invalidate printing area of first content in found section.
- SwFrame* pFstContentOfSctFrame =
- static_cast<SwSectionFrame*>(pNextFrame)->ContainsAny();
- if ( pFstContentOfSctFrame )
- {
- pFstContentOfSctFrame->InvalidatePrt();
- }
+ pNextFrame->InvalidatePrt();
}
- else
+
+ // Invalidate printing area of first content in found section.
+ SwFrame* pFstContentOfSctFrame =
+ static_cast<SwSectionFrame*>(pNextFrame)->ContainsAny();
+ if ( pFstContentOfSctFrame )
{
- pNextFrame->InvalidatePrt();
+ pFstContentOfSctFrame->InvalidatePrt();
}
}
+ else
+ {
+ pNextFrame->InvalidatePrt();
+ }
}
/// @returns true if the frame _directly_ sits in a section
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 95fd7d8947ec..149a42bd7ca3 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -180,48 +180,48 @@ void SwFlyFrame::Chain( SwFrame* _pAnch )
// No problem, if a neighbor doesn't exist - the construction of the
// neighbor will make the connection
const SwFormatChain& rChain = GetFormat()->GetChain();
- if ( rChain.GetPrev() || rChain.GetNext() )
+ if ( !(rChain.GetPrev() || rChain.GetNext()) )
+ return;
+
+ if ( rChain.GetNext() )
{
- if ( rChain.GetNext() )
+ SwFlyFrame* pFollow = FindChainNeighbour( *rChain.GetNext(), _pAnch );
+ if ( pFollow )
{
- SwFlyFrame* pFollow = FindChainNeighbour( *rChain.GetNext(), _pAnch );
- if ( pFollow )
- {
- OSL_ENSURE( !pFollow->GetPrevLink(), "wrong chain detected" );
- if ( !pFollow->GetPrevLink() )
- SwFlyFrame::ChainFrames( this, pFollow );
- }
+ OSL_ENSURE( !pFollow->GetPrevLink(), "wrong chain detected" );
+ if ( !pFollow->GetPrevLink() )
+ SwFlyFrame::ChainFrames( this, pFollow );
}
- if ( rChain.GetPrev() )
+ }
+ if ( rChain.GetPrev() )
+ {
+ SwFlyFrame *pMaster = FindChainNeighbour( *rChain.GetPrev(), _pAnch );
+ if ( pMaster )
{
- SwFlyFrame *pMaster = FindChainNeighbour( *rChain.GetPrev(), _pAnch );
- if ( pMaster )
- {
- OSL_ENSURE( !pMaster->GetNextLink(), "wrong chain detected" );
- if ( !pMaster->GetNextLink() )
- SwFlyFrame::ChainFrames( pMaster, this );
- }
+ OSL_ENSURE( !pMaster->GetNextLink(), "wrong chain detected" );
+ if ( !pMaster->GetNextLink() )
+ SwFlyFrame::ChainFrames( pMaster, this );
}
}
}
void SwFlyFrame::InsertCnt()
{
- if ( !GetPrevLink() )
- {
- const SwFormatContent& rContent = GetFormat()->GetContent();
- OSL_ENSURE( rContent.GetContentIdx(), ":-( no content prepared." );
- sal_uLong nIndex = rContent.GetContentIdx()->GetIndex();
- // Lower() means SwColumnFrame; the Content then needs to be inserted into the (Column)BodyFrame
- ::InsertCnt_( Lower() ? static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(Lower())->Lower()) : static_cast<SwLayoutFrame*>(this),
- GetFormat()->GetDoc(), nIndex );
+ if ( GetPrevLink() )
+ return;
- // NoText always have a fixed height.
- if ( Lower() && Lower()->IsNoTextFrame() )
- {
- mbFixSize = true;
- m_bMinHeight = false;
- }
+ const SwFormatContent& rContent = GetFormat()->GetContent();
+ OSL_ENSURE( rContent.GetContentIdx(), ":-( no content prepared." );
+ sal_uLong nIndex = rContent.GetContentIdx()->GetIndex();
+ // Lower() means SwColumnFrame; the Content then needs to be inserted into the (Column)BodyFrame
+ ::InsertCnt_( Lower() ? static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(Lower())->Lower()) : static_cast<SwLayoutFrame*>(this),
+ GetFormat()->GetDoc(), nIndex );
+
+ // NoText always have a fixed height.
+ if ( Lower() && Lower()->IsNoTextFrame() )
+ {
+ mbFixSize = true;
+ m_bMinHeight = false;
}
}
@@ -239,19 +239,19 @@ void SwFlyFrame::InsertColumns()
}
const SwFormatCol &rCol = GetFormat()->GetCol();
- if ( rCol.GetNumCols() > 1 )
- {
- // Start off PrtArea to be as large as Frame, so that we can put in the columns
- // properly. It'll adjust later on.
- {
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aPrt.Width( getFrameArea().Width() );
- aPrt.Height( getFrameArea().Height() );
- }
+ if ( rCol.GetNumCols() <= 1 )
+ return;
- const SwFormatCol aOld; // ChgColumns() also needs an old value passed
- ChgColumns( aOld, rCol );
+ // Start off PrtArea to be as large as Frame, so that we can put in the columns
+ // properly. It'll adjust later on.
+ {
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aPrt.Width( getFrameArea().Width() );
+ aPrt.Height( getFrameArea().Height() );
}
+
+ const SwFormatCol aOld; // ChgColumns() also needs an old value passed
+ ChgColumns( aOld, rCol );
}
void SwFlyFrame::DestroyImpl()
@@ -1661,31 +1661,31 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
void SwFlyFrame::MakeObjPos()
{
- if ( !isFrameAreaPositionValid() )
- {
- vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
- setFrameAreaPositionValid(true);
+ if ( isFrameAreaPositionValid() )
+ return;
- // use new class to position object
- GetAnchorFrame()->Calc(pRenderContext);
- objectpositioning::SwToLayoutAnchoredObjectPosition
- aObjPositioning( *GetVirtDrawObj() );
- aObjPositioning.CalcPosition();
+ vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
+ setFrameAreaPositionValid(true);
- // #i58280#
- // update relative position
- SetCurrRelPos( aObjPositioning.GetRelPos() );
+ // use new class to position object
+ GetAnchorFrame()->Calc(pRenderContext);
+ objectpositioning::SwToLayoutAnchoredObjectPosition
+ aObjPositioning( *GetVirtDrawObj() );
+ aObjPositioning.CalcPosition();
- {
- SwRectFnSet aRectFnSet(GetAnchorFrame());
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aFrm.Pos( aObjPositioning.GetRelPos() );
- aFrm.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->getFrameArea());
- }
+ // #i58280#
+ // update relative position
+ SetCurrRelPos( aObjPositioning.GetRelPos() );
- // #i69335#
- InvalidateObjRectWithSpaces();
+ {
+ SwRectFnSet aRectFnSet(GetAnchorFrame());
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aFrm.Pos( aObjPositioning.GetRelPos() );
+ aFrm.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->getFrameArea());
}
+
+ // #i69335#
+ InvalidateObjRectWithSpaces();
}
void SwFlyFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
@@ -2283,65 +2283,65 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj )
void SwFrame::InvalidateObjs( const bool _bNoInvaOfAsCharAnchoredObjs )
{
- if ( GetDrawObjs() )
+ if ( !GetDrawObjs() )
+ return;
+
+ // #i26945# - determine page the frame is on,
+ // in order to check, if anchored object is registered at the same
+ // page.
+ const SwPageFrame* pPageFrame = FindPageFrame();
+ // #i28701# - re-factoring
+ for (SwAnchoredObject* pAnchoredObj : *GetDrawObjs())
{
- // #i26945# - determine page the frame is on,
- // in order to check, if anchored object is registered at the same
- // page.
- const SwPageFrame* pPageFrame = FindPageFrame();
- // #i28701# - re-factoring
- for (SwAnchoredObject* pAnchoredObj : *GetDrawObjs())
+ if ( _bNoInvaOfAsCharAnchoredObjs &&
+ (pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
+ == RndStdIds::FLY_AS_CHAR) )
{
- if ( _bNoInvaOfAsCharAnchoredObjs &&
- (pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
- == RndStdIds::FLY_AS_CHAR) )
+ continue;
+ }
+ // #i26945# - no invalidation, if anchored object
+ // isn't registered at the same page and instead is registered at
+ // the page, where its anchor character text frame is on.
+ if ( pAnchoredObj->GetPageFrame() &&
+ pAnchoredObj->GetPageFrame() != pPageFrame )
+ {
+ SwTextFrame* pAnchorCharFrame = pAnchoredObj->FindAnchorCharFrame();
+ if ( pAnchorCharFrame &&
+ pAnchoredObj->GetPageFrame() == pAnchorCharFrame->FindPageFrame() )
{
continue;
}
- // #i26945# - no invalidation, if anchored object
- // isn't registered at the same page and instead is registered at
- // the page, where its anchor character text frame is on.
- if ( pAnchoredObj->GetPageFrame() &&
- pAnchoredObj->GetPageFrame() != pPageFrame )
- {
- SwTextFrame* pAnchorCharFrame = pAnchoredObj->FindAnchorCharFrame();
- if ( pAnchorCharFrame &&
- pAnchoredObj->GetPageFrame() == pAnchorCharFrame->FindPageFrame() )
- {
- continue;
- }
- // #115759# - unlock its position, if anchored
- // object isn't registered at the page, where its anchor
- // character text frame is on, respectively if it has no
- // anchor character text frame.
- else
- {
- pAnchoredObj->UnlockPosition();
- }
- }
- // #i51474# - reset flag, that anchored object
- // has cleared environment, and unlock its position, if the anchored
- // object is registered at the same page as the anchor frame is on.
- if ( pAnchoredObj->ClearedEnvironment() &&
- pAnchoredObj->GetPageFrame() &&
- pAnchoredObj->GetPageFrame() == pPageFrame )
- {
- pAnchoredObj->UnlockPosition();
- pAnchoredObj->SetClearedEnvironment( false );
- }
- // distinguish between writer fly frames and drawing objects
- if ( dynamic_cast<const SwFlyFrame*>( pAnchoredObj) != nullptr )
- {
- SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
- pFly->Invalidate_();
- pFly->InvalidatePos_();
- }
+ // #115759# - unlock its position, if anchored
+ // object isn't registered at the page, where its anchor
+ // character text frame is on, respectively if it has no
+ // anchor character text frame.
else
{
- pAnchoredObj->InvalidateObjPos();
+ pAnchoredObj->UnlockPosition();
}
- } // end of loop on objects, which are connected to the frame
- }
+ }
+ // #i51474# - reset flag, that anchored object
+ // has cleared environment, and unlock its position, if the anchored
+ // object is registered at the same page as the anchor frame is on.
+ if ( pAnchoredObj->ClearedEnvironment() &&
+ pAnchoredObj->GetPageFrame() &&
+ pAnchoredObj->GetPageFrame() == pPageFrame )
+ {
+ pAnchoredObj->UnlockPosition();
+ pAnchoredObj->SetClearedEnvironment( false );
+ }
+ // distinguish between writer fly frames and drawing objects
+ if ( dynamic_cast<const SwFlyFrame*>( pAnchoredObj) != nullptr )
+ {
+ SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
+ pFly->Invalidate_();
+ pFly->InvalidatePos_();
+ }
+ else
+ {
+ pAnchoredObj->InvalidateObjPos();
+ }
+ } // end of loop on objects, which are connected to the frame
}
// #i26945# - correct check, if anchored object is a lower
@@ -2353,65 +2353,65 @@ void SwLayoutFrame::NotifyLowerObjs( const bool _bUnlockPosOfObjs )
{
// invalidate lower floating screen objects
SwPageFrame* pPageFrame = FindPageFrame();
- if ( pPageFrame && pPageFrame->GetSortedObjs() )
+ if ( !(pPageFrame && pPageFrame->GetSortedObjs()) )
+ return;
+
+ SwSortedObjs& rObjs = *(pPageFrame->GetSortedObjs());
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwSortedObjs& rObjs = *(pPageFrame->GetSortedObjs());
- for (SwAnchoredObject* pObj : rObjs)
+ // #i26945# - check, if anchored object is a lower
+ // of the layout frame is changed to check, if its anchor frame
+ // is a lower of the layout frame.
+ // determine the anchor frame - usually it's the anchor frame,
+ // for at-character/as-character anchored objects the anchor character
+ // text frame is taken.
+ const SwFrame* pAnchorFrame = pObj->GetAnchorFrameContainingAnchPos();
+ if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
- // #i26945# - check, if anchored object is a lower
- // of the layout frame is changed to check, if its anchor frame
- // is a lower of the layout frame.
- // determine the anchor frame - usually it's the anchor frame,
- // for at-character/as-character anchored objects the anchor character
- // text frame is taken.
- const SwFrame* pAnchorFrame = pObj->GetAnchorFrameContainingAnchPos();
- if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
- {
- SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObj);
+ SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObj);
- if ( pFly->getFrameArea().Left() == FAR_AWAY )
- continue;
+ if ( pFly->getFrameArea().Left() == FAR_AWAY )
+ continue;
- if ( pFly->IsAnLower( this ) )
- continue;
+ if ( pFly->IsAnLower( this ) )
+ continue;
- // #i26945# - use <pAnchorFrame> to check, if
- // fly frame is lower of layout frame resp. if fly frame is
- // at a different page registered as its anchor frame is on.
- const bool bLow = IsAnLower( pAnchorFrame );
- if ( bLow || pAnchorFrame->FindPageFrame() != pPageFrame )
+ // #i26945# - use <pAnchorFrame> to check, if
+ // fly frame is lower of layout frame resp. if fly frame is
+ // at a different page registered as its anchor frame is on.
+ const bool bLow = IsAnLower( pAnchorFrame );
+ if ( bLow || pAnchorFrame->FindPageFrame() != pPageFrame )
+ {
+ pFly->Invalidate_( pPageFrame );
+ if ( !bLow || pFly->IsFlyAtContentFrame() )
{
- pFly->Invalidate_( pPageFrame );
- if ( !bLow || pFly->IsFlyAtContentFrame() )
+ // #i44016#
+ if ( _bUnlockPosOfObjs )
{
- // #i44016#
- if ( _bUnlockPosOfObjs )
- {
- pFly->UnlockPosition();
- }
- pFly->InvalidatePos_();
+ pFly->UnlockPosition();
}
- else
- pFly->InvalidatePrt_();
+ pFly->InvalidatePos_();
}
+ else
+ pFly->InvalidatePrt_();
}
- else
+ }
+ else
+ {
+ OSL_ENSURE( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr,
+ "<SwLayoutFrame::NotifyFlys() - anchored object of unexpected type" );
+ // #i26945# - use <pAnchorFrame> to check, if
+ // fly frame is lower of layout frame resp. if fly frame is
+ // at a different page registered as its anchor frame is on.
+ if ( IsAnLower( pAnchorFrame ) ||
+ pAnchorFrame->FindPageFrame() != pPageFrame )
{
- OSL_ENSURE( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr,
- "<SwLayoutFrame::NotifyFlys() - anchored object of unexpected type" );
- // #i26945# - use <pAnchorFrame> to check, if
- // fly frame is lower of layout frame resp. if fly frame is
- // at a different page registered as its anchor frame is on.
- if ( IsAnLower( pAnchorFrame ) ||
- pAnchorFrame->FindPageFrame() != pPageFrame )
+ // #i44016#
+ if ( _bUnlockPosOfObjs )
{
- // #i44016#
- if ( _bUnlockPosOfObjs )
- {
- pObj->UnlockPosition();
- }
- pObj->InvalidateObjPos();
+ pObj->UnlockPosition();
}
+ pObj->InvalidateObjPos();
}
}
}
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 71f6dff7748f..ce6abc998735 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -329,208 +329,208 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext)
return;
}
- if ( !SwOszControl::IsInProgress( this ) && !IsLocked() && !IsColLocked() )
+ if ( !(!SwOszControl::IsInProgress( this ) && !IsLocked() && !IsColLocked()) )
+ return;
+
+ // #i28701# - use new method <GetPageFrame()>
+ if( !GetPageFrame() && GetAnchorFrame() && GetAnchorFrame()->IsInFly() )
{
- // #i28701# - use new method <GetPageFrame()>
- if( !GetPageFrame() && GetAnchorFrame() && GetAnchorFrame()->IsInFly() )
- {
- SwFlyFrame* pFly = AnchorFrame()->FindFlyFrame();
- SwPageFrame *pTmpPage = pFly ? pFly->FindPageFrame() : nullptr;
- if( pTmpPage )
- pTmpPage->AppendFlyToPage( this );
- }
- // #i28701# - use new method <GetPageFrame()>
- if( GetPageFrame() )
+ SwFlyFrame* pFly = AnchorFrame()->FindFlyFrame();
+ SwPageFrame *pTmpPage = pFly ? pFly->FindPageFrame() : nullptr;
+ if( pTmpPage )
+ pTmpPage->AppendFlyToPage( this );
+ }
+ // #i28701# - use new method <GetPageFrame()>
+ if( !GetPageFrame() )
+ return;
+
+ bSetCompletePaintOnInvalidate = true;
+ {
+ SwFlyFrameFormat *pFormat = GetFormat();
+ const SwFormatFrameSize &rFrameSz = GetFormat()->GetFrameSize();
+ if( rFrameSz.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
+ rFrameSz.GetHeightPercent() >= 100 )
{
- bSetCompletePaintOnInvalidate = true;
+ pFormat->LockModify();
+ SwFormatSurround aMain( pFormat->GetSurround() );
+ if ( aMain.GetSurround() == css::text::WrapTextMode_NONE )
{
- SwFlyFrameFormat *pFormat = GetFormat();
- const SwFormatFrameSize &rFrameSz = GetFormat()->GetFrameSize();
- if( rFrameSz.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
- rFrameSz.GetHeightPercent() >= 100 )
- {
- pFormat->LockModify();
- SwFormatSurround aMain( pFormat->GetSurround() );
- if ( aMain.GetSurround() == css::text::WrapTextMode_NONE )
- {
- aMain.SetSurround( css::text::WrapTextMode_THROUGH );
- pFormat->SetFormatAttr( aMain );
- }
- pFormat->UnlockModify();
- }
+ aMain.SetSurround( css::text::WrapTextMode_THROUGH );
+ pFormat->SetFormatAttr( aMain );
}
+ pFormat->UnlockModify();
+ }
+ }
- SwOszControl aOszCntrl( this );
-
- // #i43255#
- // #i50356# - format the anchor frame, which
- // contains the anchor position. E.g., for at-character anchored
- // object this can be the follow frame of the anchor frame.
- const bool bFormatAnchor =
- !static_cast<const SwTextFrame*>( GetAnchorFrameContainingAnchPos() )->IsAnyJoinLocked() &&
- !ConsiderObjWrapInfluenceOnObjPos() &&
- !ConsiderObjWrapInfluenceOfOtherObjs();
-
- const SwFrame* pFooter = GetAnchorFrame()->FindFooterOrHeader();
- if( pFooter && !pFooter->IsFooterFrame() )
- pFooter = nullptr;
- bool bOsz = false;
- bool bExtra = Lower() && Lower()->IsColumnFrame();
- // #i3317# - boolean, to apply temporarily the
- // 'straightforward positioning process' for the frame due to its
- // overlapping with a previous column.
- bool bConsiderWrapInfluenceDueToOverlapPrevCol( false );
- // #i35911# - boolean, to apply temporarily the
- // 'straightforward positioning process' for the frame due to fact
- // that it causes the complete content of its layout environment
- // to move forward.
- // #i40444# - extend usage of this boolean:
- // apply temporarily the 'straightforward positioning process' for
- // the frame due to the fact that the frame clears the area for
- // the anchor frame, thus it has to move forward.
- bool bConsiderWrapInfluenceDueToMovedFwdAnchor( false );
- do {
- SwRectFnSet aRectFnSet(this);
- Point aOldPos( aRectFnSet.GetPos(getFrameArea()) );
- SwFlyFreeFrame::MakeAll(pRenderContext);
- const bool bPosChgDueToOwnFormat =
- aOldPos != aRectFnSet.GetPos(getFrameArea());
- // #i3317#
- if ( !ConsiderObjWrapInfluenceOnObjPos() &&
- OverlapsPrevColumn() )
+ SwOszControl aOszCntrl( this );
+
+ // #i43255#
+ // #i50356# - format the anchor frame, which
+ // contains the anchor position. E.g., for at-character anchored
+ // object this can be the follow frame of the anchor frame.
+ const bool bFormatAnchor =
+ !static_cast<const SwTextFrame*>( GetAnchorFrameContainingAnchPos() )->IsAnyJoinLocked() &&
+ !ConsiderObjWrapInfluenceOnObjPos() &&
+ !ConsiderObjWrapInfluenceOfOtherObjs();
+
+ const SwFrame* pFooter = GetAnchorFrame()->FindFooterOrHeader();
+ if( pFooter && !pFooter->IsFooterFrame() )
+ pFooter = nullptr;
+ bool bOsz = false;
+ bool bExtra = Lower() && Lower()->IsColumnFrame();
+ // #i3317# - boolean, to apply temporarily the
+ // 'straightforward positioning process' for the frame due to its
+ // overlapping with a previous column.
+ bool bConsiderWrapInfluenceDueToOverlapPrevCol( false );
+ // #i35911# - boolean, to apply temporarily the
+ // 'straightforward positioning process' for the frame due to fact
+ // that it causes the complete content of its layout environment
+ // to move forward.
+ // #i40444# - extend usage of this boolean:
+ // apply temporarily the 'straightforward positioning process' for
+ // the frame due to the fact that the frame clears the area for
+ // the anchor frame, thus it has to move forward.
+ bool bConsiderWrapInfluenceDueToMovedFwdAnchor( false );
+ do {
+ SwRectFnSet aRectFnSet(this);
+ Point aOldPos( aRectFnSet.GetPos(getFrameArea()) );
+ SwFlyFreeFrame::MakeAll(pRenderContext);
+ const bool bPosChgDueToOwnFormat =
+ aOldPos != aRectFnSet.GetPos(getFrameArea());
+ // #i3317#
+ if ( !ConsiderObjWrapInfluenceOnObjPos() &&
+ OverlapsPrevColumn() )
+ {
+ bConsiderWrapInfluenceDueToOverlapPrevCol = true;
+ }
+ // #i28701# - no format of anchor frame, if
+ // wrapping style influence is considered on object positioning
+ if ( bFormatAnchor )
+ {
+ SwTextFrame& rAnchPosAnchorFrame =
+ dynamic_cast<SwTextFrame&>(*GetAnchorFrameContainingAnchPos());
+ // #i58182# - For the usage of new method
+ // <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
+ // to check move forward of anchor frame due to the object
+ // positioning it's needed to know, if the object is anchored
+ // at the master frame before the anchor frame is formatted.
+ const bool bAnchoredAtMaster(!rAnchPosAnchorFrame.IsFollow());
+
+ // #i56300#
+ // perform complete format of anchor text frame and its
+ // previous frames, which have become invalid due to the
+ // fly frame format.
+ SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( rAnchPosAnchorFrame );
+ // #i35911#
+ // #i40444#
+ // #i58182# - usage of new method
+ // <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
+ sal_uInt32 nToPageNum( 0 );
+ bool bDummy( false );
+ if ( SwObjectFormatterTextFrame::CheckMovedFwdCondition(
+ *this, GetPageFrame()->GetPhyPageNum(),
+ bAnchoredAtMaster, nToPageNum, bDummy ) )
+ {
+ bConsiderWrapInfluenceDueToMovedFwdAnchor = true;
+ // mark anchor text frame
+ // directly, that it is moved forward by object positioning.
+ SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
+ bool bInsert( true );
+ sal_uInt32 nAnchorFrameToPageNum( 0 );
+ const SwDoc& rDoc = *(GetFrameFormat().GetDoc());
+ if ( SwLayouter::FrameMovedFwdByObjPos(
+ rDoc, *pAnchorTextFrame, nAnchorFrameToPageNum ) )
{
- bConsiderWrapInfluenceDueToOverlapPrevCol = true;
+ if ( nAnchorFrameToPageNum < nToPageNum )
+ SwLayouter::RemoveMovedFwdFrame( rDoc, *pAnchorTextFrame );
+ else
+ bInsert = false;
}
- // #i28701# - no format of anchor frame, if
- // wrapping style influence is considered on object positioning
- if ( bFormatAnchor )
+ if ( bInsert )
{
- SwTextFrame& rAnchPosAnchorFrame =
- dynamic_cast<SwTextFrame&>(*GetAnchorFrameContainingAnchPos());
- // #i58182# - For the usage of new method
- // <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
- // to check move forward of anchor frame due to the object
- // positioning it's needed to know, if the object is anchored
- // at the master frame before the anchor frame is formatted.
- const bool bAnchoredAtMaster(!rAnchPosAnchorFrame.IsFollow());
-
- // #i56300#
- // perform complete format of anchor text frame and its
- // previous frames, which have become invalid due to the
- // fly frame format.
- SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( rAnchPosAnchorFrame );
- // #i35911#
- // #i40444#
- // #i58182# - usage of new method
- // <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
- sal_uInt32 nToPageNum( 0 );
- bool bDummy( false );
- if ( SwObjectFormatterTextFrame::CheckMovedFwdCondition(
- *this, GetPageFrame()->GetPhyPageNum(),
- bAnchoredAtMaster, nToPageNum, bDummy ) )
- {
- bConsiderWrapInfluenceDueToMovedFwdAnchor = true;
- // mark anchor text frame
- // directly, that it is moved forward by object positioning.
- SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
- bool bInsert( true );
- sal_uInt32 nAnchorFrameToPageNum( 0 );
- const SwDoc& rDoc = *(GetFrameFormat().GetDoc());
- if ( SwLayouter::FrameMovedFwdByObjPos(
- rDoc, *pAnchorTextFrame, nAnchorFrameToPageNum ) )
- {
- if ( nAnchorFrameToPageNum < nToPageNum )
- SwLayouter::RemoveMovedFwdFrame( rDoc, *pAnchorTextFrame );
- else
- bInsert = false;
- }
- if ( bInsert )
- {
- SwLayouter::InsertMovedFwdFrame( rDoc, *pAnchorTextFrame,
- nToPageNum );
- }
- }
+ SwLayouter::InsertMovedFwdFrame( rDoc, *pAnchorTextFrame,
+ nToPageNum );
}
+ }
+ }
- if ( aOldPos != aRectFnSet.GetPos(getFrameArea()) ||
- ( !isFrameAreaPositionValid() &&
- ( pFooter || bPosChgDueToOwnFormat ) ) )
- {
- bOsz = aOszCntrl.ChkOsz();
-
- // special loop prevention for dedicated document:
- if ( bOsz &&
- HasFixSize() && IsClipped() &&
- GetAnchorFrame()->GetUpper()->IsCellFrame() )
- {
- SwFrameFormat* pFormat = GetFormat();
- const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
- if ( rFrameSz.GetWidthPercent() &&
- rFrameSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
- {
- SwFormatSurround aSurround( pFormat->GetSurround() );
- if ( aSurround.GetSurround() == css::text::WrapTextMode_NONE )
- {
- pFormat->LockModify();
- aSurround.SetSurround( css::text::WrapTextMode_THROUGH );
- pFormat->SetFormatAttr( aSurround );
- pFormat->UnlockModify();
- bOsz = false;
- OSL_FAIL( "<SwFlyAtContentFrame::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" );
- }
- }
- }
- }
+ if ( aOldPos != aRectFnSet.GetPos(getFrameArea()) ||
+ ( !isFrameAreaPositionValid() &&
+ ( pFooter || bPosChgDueToOwnFormat ) ) )
+ {
+ bOsz = aOszCntrl.ChkOsz();
- if ( bExtra && Lower() && !Lower()->isFrameAreaPositionValid() )
- {
- // If a multi column frame leaves invalid columns because of
- // a position change, we loop once more and format
- // our content using FormatWidthCols again.
- InvalidateSize_();
- bExtra = false; // Ensure only one additional loop run
- }
- } while ( !isFrameAreaDefinitionValid() && !bOsz &&
- // #i3317#
- !bConsiderWrapInfluenceDueToOverlapPrevCol &&
- // #i40444#
- !bConsiderWrapInfluenceDueToMovedFwdAnchor &&
- GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) );
-
- // #i3317# - instead of attribute change apply
- // temporarily the 'straightforward positioning process'.
- // #i80924#
- // handle special case during splitting of table rows
- if ( bConsiderWrapInfluenceDueToMovedFwdAnchor &&
- GetAnchorFrame()->IsInTab() &&
- GetAnchorFrame()->IsInFollowFlowRow() )
+ // special loop prevention for dedicated document:
+ if ( bOsz &&
+ HasFixSize() && IsClipped() &&
+ GetAnchorFrame()->GetUpper()->IsCellFrame() )
{
- const SwFrame* pCellFrame = GetAnchorFrame();
- while ( pCellFrame && !pCellFrame->IsCellFrame() )
- {
- pCellFrame = pCellFrame->GetUpper();
- }
- if ( pCellFrame )
+ SwFrameFormat* pFormat = GetFormat();
+ const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
+ if ( rFrameSz.GetWidthPercent() &&
+ rFrameSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
{
- SwRectFnSet aRectFnSet(pCellFrame);
- if ( aRectFnSet.GetTop(pCellFrame->getFrameArea()) == 0 &&
- aRectFnSet.GetHeight(pCellFrame->getFrameArea()) == 0 )
+ SwFormatSurround aSurround( pFormat->GetSurround() );
+ if ( aSurround.GetSurround() == css::text::WrapTextMode_NONE )
{
- bConsiderWrapInfluenceDueToMovedFwdAnchor = false;
+ pFormat->LockModify();
+ aSurround.SetSurround( css::text::WrapTextMode_THROUGH );
+ pFormat->SetFormatAttr( aSurround );
+ pFormat->UnlockModify();
+ bOsz = false;
+ OSL_FAIL( "<SwFlyAtContentFrame::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" );
}
}
}
- if ( bOsz || bConsiderWrapInfluenceDueToOverlapPrevCol ||
- // #i40444#
- bConsiderWrapInfluenceDueToMovedFwdAnchor )
+ }
+
+ if ( bExtra && Lower() && !Lower()->isFrameAreaPositionValid() )
+ {
+ // If a multi column frame leaves invalid columns because of
+ // a position change, we loop once more and format
+ // our content using FormatWidthCols again.
+ InvalidateSize_();
+ bExtra = false; // Ensure only one additional loop run
+ }
+ } while ( !isFrameAreaDefinitionValid() && !bOsz &&
+ // #i3317#
+ !bConsiderWrapInfluenceDueToOverlapPrevCol &&
+ // #i40444#
+ !bConsiderWrapInfluenceDueToMovedFwdAnchor &&
+ GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) );
+
+ // #i3317# - instead of attribute change apply
+ // temporarily the 'straightforward positioning process'.
+ // #i80924#
+ // handle special case during splitting of table rows
+ if ( bConsiderWrapInfluenceDueToMovedFwdAnchor &&
+ GetAnchorFrame()->IsInTab() &&
+ GetAnchorFrame()->IsInFollowFlowRow() )
+ {
+ const SwFrame* pCellFrame = GetAnchorFrame();
+ while ( pCellFrame && !pCellFrame->IsCellFrame() )
+ {
+ pCellFrame = pCellFrame->GetUpper();
+ }
+ if ( pCellFrame )
+ {
+ SwRectFnSet aRectFnSet(pCellFrame);
+ if ( aRectFnSet.GetTop(pCellFrame->getFrameArea()) == 0 &&
+ aRectFnSet.GetHeight(pCellFrame->getFrameArea()) == 0 )
{
- SetTmpConsiderWrapInfluence( true );
- SetRestartLayoutProcess( true );
- SetTmpConsiderWrapInfluenceOfOtherObjs();
+ bConsiderWrapInfluenceDueToMovedFwdAnchor = false;
}
- bSetCompletePaintOnInvalidate = false;
}
}
+ if ( bOsz || bConsiderWrapInfluenceDueToOverlapPrevCol ||
+ // #i40444#
+ bConsiderWrapInfluenceDueToMovedFwdAnchor )
+ {
+ SetTmpConsiderWrapInfluence( true );
+ SetRestartLayoutProcess( true );
+ SetTmpConsiderWrapInfluenceOfOtherObjs();
+ }
+ bSetCompletePaintOnInvalidate = false;
}
/** method to determine, if a <MakeAll()> on the Writer fly frame is possible
diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index 4823aab29230..fed15e27e672 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -154,24 +154,24 @@ void SwFlyInContentFrame::Format( vcl::RenderContext* pRenderContext, const SwBo
**/
void SwFlyInContentFrame::MakeObjPos()
{
- if ( !isFrameAreaPositionValid() )
+ if ( isFrameAreaPositionValid() )
+ return;
+
+ setFrameAreaPositionValid(true);
+ SwFlyFrameFormat *pFormat = GetFormat();
+ const SwFormatVertOrient &rVert = pFormat->GetVertOrient();
+ //Update the current values in the format if needed, during this we of
+ //course must not send any Modify.
+ const bool bVert = GetAnchorFrame()->IsVertical();
+ SwTwips nOld = rVert.GetPos();
+ SwTwips nAct = bVert ? -GetCurrRelPos().X() : GetCurrRelPos().Y();
+ if( nAct != nOld )
{
- setFrameAreaPositionValid(true);
- SwFlyFrameFormat *pFormat = GetFormat();
- const SwFormatVertOrient &rVert = pFormat->GetVertOrient();
- //Update the current values in the format if needed, during this we of
- //course must not send any Modify.
- const bool bVert = GetAnchorFrame()->IsVertical();
- SwTwips nOld = rVert.GetPos();
- SwTwips nAct = bVert ? -GetCurrRelPos().X() : GetCurrRelPos().Y();
- if( nAct != nOld )
- {
- SwFormatVertOrient aVert( rVert );
- aVert.SetPos( nAct );
- pFormat->LockModify();
- pFormat->SetFormatAttr( aVert );
- pFormat->UnlockModify();
- }
+ SwFormatVertOrient aVert( rVert );
+ aVert.SetPos( nAct );
+ pFormat->LockModify();
+ pFormat->SetFormatAttr( aVert );
+ pFormat->UnlockModify();
}
}
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 72d673b224d4..a5d3e39c2295 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -871,29 +871,29 @@ void SwPageFrame::AppendFlyToPage( SwFlyFrame *pNew )
}
// #i28701# - correction: consider also drawing objects
- if ( pNew->GetDrawObjs() )
+ if ( !pNew->GetDrawObjs() )
+ return;
+
+ SwSortedObjs &rObjs = *pNew->GetDrawObjs();
+ for (SwAnchoredObject* pTmpObj : rObjs)
{
- SwSortedObjs &rObjs = *pNew->GetDrawObjs();
- for (SwAnchoredObject* pTmpObj : rObjs)
+ if ( dynamic_cast<const SwFlyFrame*>( pTmpObj) != nullptr )
{
- if ( dynamic_cast<const SwFlyFrame*>( pTmpObj) != nullptr )
- {
- SwFlyFrame* pTmpFly = static_cast<SwFlyFrame*>(pTmpObj);
- // #i28701# - use new method <GetPageFrame()>
- if ( pTmpFly->IsFlyFreeFrame() && !pTmpFly->GetPageFrame() )
- AppendFlyToPage( pTmpFly );
- }
- else if ( dynamic_cast<const SwAnchoredDrawObject*>( pTmpObj) != nullptr )
+ SwFlyFrame* pTmpFly = static_cast<SwFlyFrame*>(pTmpObj);
+ // #i28701# - use new method <GetPageFrame()>
+ if ( pTmpFly->IsFlyFreeFrame() && !pTmpFly->GetPageFrame() )
+ AppendFlyToPage( pTmpFly );
+ }
+ else if ( dynamic_cast<const SwAnchoredDrawObject*>( pTmpObj) != nullptr )
+ {
+ // #i87493#
+ if ( pTmpObj->GetPageFrame() != this )
{
- // #i87493#
- if ( pTmpObj->GetPageFrame() != this )
+ if ( pTmpObj->GetPageFrame() != nullptr )
{
- if ( pTmpObj->GetPageFrame() != nullptr )
- {
- pTmpObj->GetPageFrame()->RemoveDrawObjFromPage( *pTmpObj );
- }
- AppendDrawObjToPage( *pTmpObj );
+ pTmpObj->GetPageFrame()->RemoveDrawObjFromPage( *pTmpObj );
}
+ AppendDrawObjToPage( *pTmpObj );
}
}
}
@@ -1016,30 +1016,30 @@ void SwPageFrame::MoveFly( SwFlyFrame *pToMove, SwPageFrame *pDest )
}
// #i28701# - correction: move lowers of Writer fly frame
- if ( pToMove->GetDrawObjs() )
+ if ( !pToMove->GetDrawObjs() )
+ return;
+
+ SwSortedObjs &rObjs = *pToMove->GetDrawObjs();
+ for (SwAnchoredObject* pObj : rObjs)
{
- SwSortedObjs &rObjs = *pToMove->GetDrawObjs();
- for (SwAnchoredObject* pObj : rObjs)
+ if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
- if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
- {
- SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObj);
- if ( pFly->IsFlyFreeFrame() )
- {
- // #i28701# - use new method <GetPageFrame()>
- SwPageFrame* pPageFrame = pFly->GetPageFrame();
- if ( pPageFrame )
- pPageFrame->MoveFly( pFly, pDest );
- else
- pDest->AppendFlyToPage( pFly );
- }
- }
- else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
+ SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObj);
+ if ( pFly->IsFlyFreeFrame() )
{
- RemoveDrawObjFromPage( *pObj );
- pDest->AppendDrawObjToPage( *pObj );
+ // #i28701# - use new method <GetPageFrame()>
+ SwPageFrame* pPageFrame = pFly->GetPageFrame();
+ if ( pPageFrame )
+ pPageFrame->MoveFly( pFly, pDest );
+ else
+ pDest->AppendFlyToPage( pFly );
}
}
+ else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
+ {
+ RemoveDrawObjFromPage( *pObj );
+ pDest->AppendDrawObjToPage( *pObj );
+ }
}
}
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 7169e865b94f..b9d4f37831d2 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -382,34 +382,34 @@ SwFrameNotify::~SwFrameNotify() COVERITY_NOEXCEPT_FALSE
SwFlyFrame* pFly = nullptr;
// #i35879# Do not trust the inf flags. pFrame does not
// necessarily have to have an upper!
- if ( !mpFrame->IsFlyFrame() && nullptr != ( pFly = mpFrame->ImplFindFlyFrame() ) )
- {
- // #i61999#
- // no invalidation of columned Writer fly frames, because automatic
- // width doesn't make sense for such Writer fly frames.
- if ( pFly->Lower() && !pFly->Lower()->IsColumnFrame() )
- {
- const SwFormatFrameSize &rFrameSz = pFly->GetFormat()->GetFrameSize();
-
- // This could be optimized. Basically the fly frame only has to
- // be invalidated, if the first line of pFrame (if pFrame is a content
- // frame, for other frame types it's the print area) has changed its
- // size and pFrame was responsible for the current width of pFly. On
- // the other hand, this is only rarely used and re-calculation of
- // the fly frame does not cause too much trouble. So we keep it this
- // way:
- if ( SwFrameSize::Fixed != rFrameSz.GetWidthSizeType() )
- {
- // #i50668#, #i50998# - invalidation of position
- // of as-character anchored fly frames not needed and can cause
- // layout loops
- if ( dynamic_cast<const SwFlyInContentFrame*>( pFly) == nullptr )
- {
- pFly->InvalidatePos();
- }
- pFly->InvalidateSize();
- }
+ if ( mpFrame->IsFlyFrame() || nullptr == ( pFly = mpFrame->ImplFindFlyFrame() ))
+ return;
+
+ // #i61999#
+ // no invalidation of columned Writer fly frames, because automatic
+ // width doesn't make sense for such Writer fly frames.
+ if ( !(pFly->Lower() && !pFly->Lower()->IsColumnFrame()) )
+ return;
+
+ const SwFormatFrameSize &rFrameSz = pFly->GetFormat()->GetFrameSize();
+
+ // This could be optimized. Basically the fly frame only has to
+ // be invalidated, if the first line of pFrame (if pFrame is a content
+ // frame, for other frame types it's the print area) has changed its
+ // size and pFrame was responsible for the current width of pFly. On
+ // the other hand, this is only rarely used and re-calculation of
+ // the fly frame does not cause too much trouble. So we keep it this
+ // way:
+ if ( SwFrameSize::Fixed != rFrameSz.GetWidthSizeType() )
+ {
+ // #i50668#, #i50998# - invalidation of position
+ // of as-character anchored fly frames not needed and can cause
+ // layout loops
+ if ( dynamic_cast<const SwFlyInContentFrame*>( pFly) == nullptr )
+ {
+ pFly->InvalidatePos();
}
+ pFly->InvalidateSize();
}
}
@@ -695,39 +695,39 @@ SwFlyNotify::~SwFlyNotify()
// OD 2004-05-13 #i28701#
// #i45180# - no adjustment of layout process flags and
// further notifications/invalidations, if format is called by grow/shrink
- if ( pFly->ConsiderObjWrapInfluenceOnObjPos() &&
+ if ( !(pFly->ConsiderObjWrapInfluenceOnObjPos() &&
( dynamic_cast<const SwFlyFreeFrame*>( pFly) == nullptr ||
- !static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip() ) )
- {
- // #i54138# - suppress restart of the layout process
- // on changed frame height.
- // Note: It doesn't seem to be necessary and can cause layout loops.
- if ( bPosChgd )
- {
- // indicate a restart of the layout process
- pFly->SetRestartLayoutProcess( true );
- }
- else
- {
- // lock position
- pFly->LockPosition();
- }
+ !static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip() )) )
+ return;
- if ( !pFly->ConsiderForTextWrap() )
- {
- // indicate that object has to be considered for text wrap
- pFly->SetConsiderForTextWrap( true );
- // invalidate 'background' in order to allow its 'background'
- // to wrap around it.
- pFly->NotifyBackground( pFly->GetPageFrame(),
- pFly->GetObjRectWithSpaces(),
- PrepareHint::FlyFrameArrive );
- // invalidate position of anchor frame in order to force
- // a re-format of the anchor frame, which also causes a
- // re-format of the invalid previous frames of the anchor frame.
- pFly->AnchorFrame()->InvalidatePos();
- }
+ // #i54138# - suppress restart of the layout process
+ // on changed frame height.
+ // Note: It doesn't seem to be necessary and can cause layout loops.
+ if ( bPosChgd )
+ {
+ // indicate a restart of the layout process
+ pFly->SetRestartLayoutProcess( true );
}
+ else
+ {
+ // lock position
+ pFly->LockPosition();
+ }
+
+ if ( pFly->ConsiderForTextWrap() )
+ return;
+
+ // indicate that object has to be considered for text wrap
+ pFly->SetConsiderForTextWrap( true );
+ // invalidate 'background' in order to allow its 'background'
+ // to wrap around it.
+ pFly->NotifyBackground( pFly->GetPageFrame(),
+ pFly->GetObjRectWithSpaces(),
+ PrepareHint::FlyFrameArrive );
+ // invalidate position of anchor frame in order to force
+ // a re-format of the anchor frame, which also causes a
+ // re-format of the invalid previous frames of the anchor frame.
+ pFly->AnchorFrame()->InvalidatePos();
}
SwContentNotify::SwContentNotify( SwContentFrame *pContentFrame ) :
@@ -740,17 +740,17 @@ SwContentNotify::SwContentNotify( SwContentFrame *pContentFrame ) :
mbBordersJoinedWithPrev( false )
{
// OD 08.01.2004 #i11859#
- if ( pContentFrame->IsTextFrame() )
+ if ( !pContentFrame->IsTextFrame() )
+ return;
+
+ SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pContentFrame);
+ if (!pTextFrame->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::OLD_LINE_SPACING))
{
- SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pContentFrame);
- if (!pTextFrame->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::OLD_LINE_SPACING))
+ const SvxLineSpacingItem &rSpace = pTextFrame->GetAttrSet()->GetLineSpacing();
+ if ( rSpace.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop )
{
- const SvxLineSpacingItem &rSpace = pTextFrame->GetAttrSet()->GetLineSpacing();
- if ( rSpace.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop )
- {
- mbChkHeightOfLastLine = true;
- mnHeightOfLastLine = pTextFrame->GetHeightOfLastLine();
- }
+ mbChkHeightOfLastLine = true;
+ mnHeightOfLastLine = pTextFrame->GetHeightOfLastLine();
}
}
}
@@ -954,22 +954,22 @@ SwContentNotify::~SwContentNotify()
// #i43255# - move code to invalidate at-character
// anchored objects due to a change of its anchor character from
// method <SwTextFrame::Format(..)>.
- if ( pCnt->IsTextFrame() )
+ if ( !pCnt->IsTextFrame() )
+ return;
+
+ SwTextFrame* pMasterFrame = pCnt->IsFollow()
+ ? static_cast<SwTextFrame*>(pCnt)->FindMaster()
+ : static_cast<SwTextFrame*>(pCnt);
+ if ( pMasterFrame && !pMasterFrame->IsFlyLock() &&
+ pMasterFrame->GetDrawObjs() )
{
- SwTextFrame* pMasterFrame = pCnt->IsFollow()
- ? static_cast<SwTextFrame*>(pCnt)->FindMaster()
- : static_cast<SwTextFrame*>(pCnt);
- if ( pMasterFrame && !pMasterFrame->IsFlyLock() &&
- pMasterFrame->GetDrawObjs() )
+ SwSortedObjs* pObjs = pMasterFrame->GetDrawObjs();
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- SwSortedObjs* pObjs = pMasterFrame->GetDrawObjs();
- for (SwAnchoredObject* pAnchoredObj : *pObjs)
+ if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
+ == RndStdIds::FLY_AT_CHAR )
{
- if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
- == RndStdIds::FLY_AT_CHAR )
- {
- pAnchoredObj->CheckCharRectAndTopOfLine( !pMasterFrame->IsEmpty() );
- }
+ pAnchoredObj->CheckCharRectAndTopOfLine( !pMasterFrame->IsEmpty() );
}
}
}
@@ -986,58 +986,58 @@ void AppendObj(SwFrame *const pFrame, SwPageFrame *const pPage, SwFrameFormat *c
const bool bDrawObjInContent = bSdrObj &&
(rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
- if( bFlyAtFly ||
+ if( !(bFlyAtFly ||
(rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
(rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR) ||
- bDrawObjInContent )
+ bDrawObjInContent) )
+ return;
+
+ SdrObject* pSdrObj = nullptr;
+ if ( bSdrObj && nullptr == (pSdrObj = pFormat->FindSdrObject()) )
+ {
+ OSL_ENSURE( !bSdrObj, "DrawObject not found." );
+ pFormat->GetDoc()->DelFrameFormat( pFormat );
+ return;
+ }
+ if ( pSdrObj )
{
- SdrObject* pSdrObj = nullptr;
- if ( bSdrObj && nullptr == (pSdrObj = pFormat->FindSdrObject()) )
+ if ( !pSdrObj->getSdrPageFromSdrObject() )
{
- OSL_ENSURE( !bSdrObj, "DrawObject not found." );
- pFormat->GetDoc()->DelFrameFormat( pFormat );
- return;
+ pFormat->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
+ InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
}
- if ( pSdrObj )
- {
- if ( !pSdrObj->getSdrPageFromSdrObject() )
- {
- pFormat->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
- InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
- }
- SwDrawContact* pNew =
- static_cast<SwDrawContact*>(GetUserCall( pSdrObj ));
- if ( !pNew->GetAnchorFrame() )
- {
- pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( nullptr )) );
- }
- // OD 19.06.2003 #108784# - add 'virtual' drawing object,
- // if necessary. But control objects have to be excluded.
- else if ( !::CheckControlLayer( pSdrObj ) &&
- pNew->GetAnchorFrame() != pFrame &&
- !pNew->GetDrawObjectByAnchorFrame( *pFrame ) )
- {
- SwDrawVirtObj* pDrawVirtObj = pNew->AddVirtObj();
- pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( pDrawVirtObj )) );
-
- pDrawVirtObj->ActionChanged();
- }
+ SwDrawContact* pNew =
+ static_cast<SwDrawContact*>(GetUserCall( pSdrObj ));
+ if ( !pNew->GetAnchorFrame() )
+ {
+ pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( nullptr )) );
}
- else
+ // OD 19.06.2003 #108784# - add 'virtual' drawing object,
+ // if necessary. But control objects have to be excluded.
+ else if ( !::CheckControlLayer( pSdrObj ) &&
+ pNew->GetAnchorFrame() != pFrame &&
+ !pNew->GetDrawObjectByAnchorFrame( *pFrame ) )
{
- SwFlyFrame *pFly;
- if( bFlyAtFly )
- pFly = new SwFlyLayFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
- else
- pFly = new SwFlyAtContentFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
- pFly->Lock();
- pFrame->AppendFly( pFly );
- pFly->Unlock();
- if ( pPage )
- ::RegistFlys( pPage, pFly );
+ SwDrawVirtObj* pDrawVirtObj = pNew->AddVirtObj();
+ pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( pDrawVirtObj )) );
+
+ pDrawVirtObj->ActionChanged();
}
}
+ else
+ {
+ SwFlyFrame *pFly;
+ if( bFlyAtFly )
+ pFly = new SwFlyLayFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
+ else
+ pFly = new SwFlyAtContentFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
+ pFly->Lock();
+ pFrame->AppendFly( pFly );
+ pFly->Unlock();
+ if ( pPage )
+ ::RegistFlys( pPage, pFly );
+ }
}
static bool IsShown(sal_uLong const nIndex,
@@ -2554,25 +2554,25 @@ SwOrderIter::SwOrderIter( const SwPageFrame *pPg ) :
void SwOrderIter::Top()
{
m_pCurrent = nullptr;
- if ( m_pPage->GetSortedObjs() )
+ if ( !m_pPage->GetSortedObjs() )
+ return;
+
+ const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
+ if ( !pObjs->size() )
+ return;
+
+ sal_uInt32 nTopOrd = 0;
+ (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
+ for (SwAnchoredObject* i : *pObjs)
{
- const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
- if ( pObjs->size() )
+ const SdrObject* pObj = i->GetDrawObj();
+ if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
+ continue;
+ sal_uInt32 nTmp = pObj->GetOrdNumDirect();
+ if ( nTmp >= nTopOrd )
{
- sal_uInt32 nTopOrd = 0;
- (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
- for (SwAnchoredObject* i : *pObjs)
- {
- const SdrObject* pObj = i->GetDrawObj();
- if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
- continue;
- sal_uInt32 nTmp = pObj->GetOrdNumDirect();
- if ( nTmp >= nTopOrd )
- {
- nTopOrd = nTmp;
- m_pCurrent = pObj;
- }
- }
+ nTopOrd = nTmp;
+ m_pCurrent = pObj;
}
}
}
@@ -2636,25 +2636,25 @@ void SwOrderIter::Prev()
{
const sal_uInt32 nCurOrd = m_pCurrent ? m_pCurrent->GetOrdNumDirect() : 0;
m_pCurrent = nullptr;
- if ( m_pPage->GetSortedObjs() )
+ if ( !m_pPage->GetSortedObjs() )
+ return;
+
+ const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
+ if ( !pObjs->size() )
+ return;
+
+ sal_uInt32 nOrd = 0;
+ (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
+ for (SwAnchoredObject* i : *pObjs)
{
- const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
- if ( pObjs->size() )
+ const SdrObject* pObj = i->GetDrawObj();
+ if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
+ continue;
+ sal_uInt32 nTmp = pObj->GetOrdNumDirect();
+ if ( nTmp < nCurOrd && nTmp >= nOrd )
{
- sal_uInt32 nOrd = 0;
- (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
- for (SwAnchoredObject* i : *pObjs)
- {
- const SdrObject* pObj = i->GetDrawObj();
- if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
- continue;
- sal_uInt32 nTmp = pObj->GetOrdNumDirect();
- if ( nTmp < nCurOrd && nTmp >= nOrd )
- {
- nOrd = nTmp;
- m_pCurrent = pObj;
- }
- }
+ nOrd = nTmp;
+ m_pCurrent = pObj;
}
}
}
@@ -3214,38 +3214,38 @@ static void lcl_CheckFlowBack( SwFrame* pFrame, const SwRect &rRect )
static void lcl_NotifyContent( const SdrObject *pThis, SwContentFrame *pCnt,
const SwRect &rRect, const PrepareHint eHint )
{
- if ( pCnt->IsTextFrame() )
+ if ( !pCnt->IsTextFrame() )
+ return;
+
+ SwRect aCntPrt( pCnt->getFramePrintArea() );
+ aCntPrt.Pos() += pCnt->getFrameArea().Pos();
+ if ( eHint == PrepareHint::FlyFrameAttributesChanged )
{
- SwRect aCntPrt( pCnt->getFramePrintArea() );
- aCntPrt.Pos() += pCnt->getFrameArea().Pos();
- if ( eHint == PrepareHint::FlyFrameAttributesChanged )
- {
- // #i35640# - use given rectangle <rRect> instead
- // of current bound rectangle
- if ( aCntPrt.IsOver( rRect ) )
- pCnt->Prepare( PrepareHint::FlyFrameAttributesChanged );
- }
- // #i23129# - only invalidate, if the text frame
- // printing area overlaps with the given rectangle.
- else if ( aCntPrt.IsOver( rRect ) )
- pCnt->Prepare( eHint, static_cast<void*>(&aCntPrt.Intersection_( rRect )) );
- if ( pCnt->GetDrawObjs() )
+ // #i35640# - use given rectangle <rRect> instead
+ // of current bound rectangle
+ if ( aCntPrt.IsOver( rRect ) )
+ pCnt->Prepare( PrepareHint::FlyFrameAttributesChanged );
+ }
+ // #i23129# - only invalidate, if the text frame
+ // printing area overlaps with the given rectangle.
+ else if ( aCntPrt.IsOver( rRect ) )
+ pCnt->Prepare( eHint, static_cast<void*>(&aCntPrt.Intersection_( rRect )) );
+ if ( !pCnt->GetDrawObjs() )
+ return;
+
+ const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
+ for (SwAnchoredObject* pObj : rObjs)
+ {
+ if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
{
- const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
- for (SwAnchoredObject* pObj : rObjs)
+ SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj);
+ if ( pFly->IsFlyInContentFrame() )
{
- if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
+ SwContentFrame *pContent = pFly->ContainsContent();
+ while ( pContent )
{
- SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj);
- if ( pFly->IsFlyInContentFrame() )
- {
- SwContentFrame *pContent = pFly->ContainsContent();
- while ( pContent )
- {
- ::lcl_NotifyContent( pThis, pContent, rRect, eHint );
- pContent = pContent->GetNextContentFrame();
- }
- }
+ ::lcl_NotifyContent( pThis, pContent, rRect, eHint );
+ pContent = pContent->GetNextContentFrame();
}
}
}
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 8ddd9747f840..809a8ea528e0 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -249,70 +249,70 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const
}
}
- if ( !isFrameAreaSizeValid() )
+ if ( isFrameAreaSizeValid() )
+ return;
+
+ bool bGrow = pPage->IsFootnotePage();
+ if( bGrow )
{
- bool bGrow = pPage->IsFootnotePage();
- if( bGrow )
- {
- const SwViewShell *pSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
- if( pSh && pSh->GetViewOptions()->getBrowseMode() )
- bGrow = false;
- }
- if( bGrow )
- Grow( LONG_MAX );
- else
+ const SwViewShell *pSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
+ if( pSh && pSh->GetViewOptions()->getBrowseMode() )
+ bGrow = false;
+ }
+ if( bGrow )
+ Grow( LONG_MAX );
+ else
+ {
+ // VarSize is determined based on the content plus the borders
+ SwTwips nRemaining = 0;
+ SwFrame *pFrame = m_pLower;
+ while ( pFrame )
+ { // lcl_Undersize(..) respects (recursively) TextFrames, which
+ // would like to be bigger. They are created especially in
+ // columnized borders, if these do not have their maximum
+ // size yet.
+ nRemaining += aRectFnSet.GetHeight(pFrame->getFrameArea()) + lcl_Undersize( pFrame );
+ pFrame = pFrame->GetNext();
+ }
+ // add the own border
+ nRemaining += nBorder;
+
+ SwTwips nDiff;
+ if( IsInSct() )
{
- // VarSize is determined based on the content plus the borders
- SwTwips nRemaining = 0;
- SwFrame *pFrame = m_pLower;
- while ( pFrame )
- { // lcl_Undersize(..) respects (recursively) TextFrames, which
- // would like to be bigger. They are created especially in
- // columnized borders, if these do not have their maximum
- // size yet.
- nRemaining += aRectFnSet.GetHeight(pFrame->getFrameArea()) + lcl_Undersize( pFrame );
- pFrame = pFrame->GetNext();
- }
- // add the own border
- nRemaining += nBorder;
-
- SwTwips nDiff;
- if( IsInSct() )
+ nDiff = -aRectFnSet.BottomDist( getFrameArea(), aRectFnSet.GetPrtBottom(*GetUpper()) );
+ if( nDiff > 0 )
{
- nDiff = -aRectFnSet.BottomDist( getFrameArea(), aRectFnSet.GetPrtBottom(*GetUpper()) );
- if( nDiff > 0 )
+ if( nDiff > aRectFnSet.GetHeight(getFrameArea()) )
{
- if( nDiff > aRectFnSet.GetHeight(getFrameArea()) )
- {
- nDiff = aRectFnSet.GetHeight(getFrameArea());
- }
-
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aRectFnSet.AddBottom( aFrm, -nDiff );
- aRectFnSet.AddHeight( aFrm, -nDiff );
+ nDiff = aRectFnSet.GetHeight(getFrameArea());
}
+
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, -nDiff );
+ aRectFnSet.AddHeight( aFrm, -nDiff );
}
- nDiff = aRectFnSet.GetHeight(getFrameArea()) - nRemaining;
- if ( nDiff > 0 )
- Shrink( nDiff );
- else if ( nDiff < 0 )
+ }
+ nDiff = aRectFnSet.GetHeight(getFrameArea()) - nRemaining;
+ if ( nDiff > 0 )
+ Shrink( nDiff );
+ else if ( nDiff < 0 )
+ {
+ Grow( -nDiff );
+ // It may happen that there is less space available,
+ // than what the border needs - the size of the PrtArea
+ // will then be negative.
+ SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
+ if( nPrtHeight < 0 )
{
- Grow( -nDiff );
- // It may happen that there is less space available,
- // than what the border needs - the size of the PrtArea
- // will then be negative.
- SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
- if( nPrtHeight < 0 )
- {
- const SwTwips nTmpDiff = std::max( aRectFnSet.GetTop(getFramePrintArea()), -nPrtHeight );
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aRectFnSet.SubTop( aPrt, nTmpDiff );
- }
+ const SwTwips nTmpDiff = std::max( aRectFnSet.GetTop(getFramePrintArea()), -nPrtHeight );
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aRectFnSet.SubTop( aPrt, nTmpDiff );
}
}
-
- setFrameAreaSizeValid(true);
}
+
+ setFrameAreaSizeValid(true);
}
SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool )
@@ -494,26 +494,26 @@ SwFootnoteFrame::SwFootnoteFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwConte
void SwFootnoteFrame::InvalidateNxtFootnoteCnts( SwPageFrame const *pPage )
{
- if ( GetNext() )
- {
- SwFrame *pCnt = static_cast<SwLayoutFrame*>(GetNext())->ContainsAny();
- if( pCnt )
+ if ( !GetNext() )
+ return;
+
+ SwFrame *pCnt = static_cast<SwLayoutFrame*>(GetNext())->ContainsAny();
+ if( !pCnt )
+ return;
+
+ pCnt->InvalidatePage( pPage );
+ pCnt->InvalidatePrt_();
+ do
+ { pCnt->InvalidatePos_();
+ if( pCnt->IsSctFrame() )
{
- pCnt->InvalidatePage( pPage );
- pCnt->InvalidatePrt_();
- do
- { pCnt->InvalidatePos_();
- if( pCnt->IsSctFrame() )
- {
- SwFrame* pTmp = static_cast<SwSectionFrame*>(pCnt)->ContainsAny();
- if( pTmp )
- pTmp->InvalidatePos_();
- }
- pCnt->GetUpper()->InvalidateSize_();
- pCnt = pCnt->FindNext();
- } while ( pCnt && GetUpper()->IsAnLower( pCnt ) );
+ SwFrame* pTmp = static_cast<SwSectionFrame*>(pCnt)->ContainsAny();
+ if( pTmp )
+ pTmp->InvalidatePos_();
}
- }
+ pCnt->GetUpper()->InvalidateSize_();
+ pCnt = pCnt->FindNext();
+ } while ( pCnt && GetUpper()->IsAnLower( pCnt ) );
}
bool SwFootnoteFrame::IsDeleteForbidden() const
@@ -559,32 +559,32 @@ void SwFootnoteFrame::Cut()
// cut all connections
RemoveFromLayout();
- if ( pUp )
+ if ( !pUp )
+ return;
+
+ // The last footnote takes its container along
+ if (!pUp->Lower())
{
- // The last footnote takes its container along
- if (!pUp->Lower())
+ SwPageFrame *pPage = pUp->FindPageFrame();
+ if ( pPage )
{
- SwPageFrame *pPage = pUp->FindPageFrame();
- if ( pPage )
- {
- SwLayoutFrame *pBody = pPage->FindBodyCont();
- if( pBody && !pBody->ContainsContent() )
- pPage->getRootFrame()->SetSuperfluous();
- }
- SwSectionFrame* pSect = pUp->FindSctFrame();
- pUp->Cut();
- SwFrame::DestroyFrame(pUp);
- // If the last footnote container was removed from a column
- // section without a Follow, then this section can be shrunk.
- if( pSect && !pSect->ToMaximize( false ) && !pSect->IsColLocked() )
- pSect->InvalidateSize_();
- }
- else
- { if ( getFrameArea().Height() )
- pUp->Shrink( getFrameArea().Height() );
- pUp->SetCompletePaint();
- pUp->InvalidatePage();
+ SwLayoutFrame *pBody = pPage->FindBodyCont();
+ if( pBody && !pBody->ContainsContent() )
+ pPage->getRootFrame()->SetSuperfluous();
}
+ SwSectionFrame* pSect = pUp->FindSctFrame();
+ pUp->Cut();
+ SwFrame::DestroyFrame(pUp);
+ // If the last footnote container was removed from a column
+ // section without a Follow, then this section can be shrunk.
+ if( pSect && !pSect->ToMaximize( false ) && !pSect->IsColLocked() )
+ pSect->InvalidateSize_();
+ }
+ else
+ { if ( getFrameArea().Height() )
+ pUp->Shrink( getFrameArea().Height() );
+ pUp->SetCompletePaint();
+ pUp->InvalidatePage();
}
}
@@ -2104,59 +2104,59 @@ void SwFootnoteBossFrame::MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool b
// #i21478# - format content of footnote following
// the new inserted ones.
- if ( bCalc && pLastInsertedFootnote )
- {
- if ( pLastInsertedFootnote->GetNext() )
- {
- SwFootnoteFrame* pNextFootnote = static_cast<SwFootnoteFrame*>(pLastInsertedFootnote->GetNext());
- SwTextFootnote* pAttr = pNextFootnote->GetAttr();
- SwFrame* pCnt = pNextFootnote->ContainsAny();
+ if ( !(bCalc && pLastInsertedFootnote) )
+ return;
- bool bUnlock = !pNextFootnote->IsBackMoveLocked();
- pNextFootnote->LockBackMove();
- // #i49383# - disable unlock of position of
- // lower objects during format of footnote content.
- pNextFootnote->KeepLockPosOfLowerObjs();
- // #i57914# - adjust fix #i49383#
+ if ( !pLastInsertedFootnote->GetNext() )
+ return;
- while ( pCnt && pCnt->FindFootnoteFrame()->GetAttr() == pAttr )
- {
- pCnt->InvalidatePos_();
- pCnt->Calc(getRootFrame()->GetCurrShell()->GetOut());
- // #i49383# - format anchored objects
- if ( pCnt->IsTextFrame() && pCnt->isFrameAreaDefinitionValid() )
- {
- if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt,
- *(pCnt->FindPageFrame()) ) )
- {
- // restart format with first content
- pCnt = pNextFootnote->ContainsAny();
- continue;
- }
- }
- if( pCnt->IsSctFrame() )
- {
- // If the area is not empty, iterate also over the content
- SwFrame* pTmp = static_cast<SwSectionFrame*>(pCnt)->ContainsAny();
- if( pTmp )
- pCnt = pTmp;
- else
- pCnt = pCnt->FindNext();
- }
- else
- pCnt = pCnt->FindNext();
- }
- if( bUnlock )
+ SwFootnoteFrame* pNextFootnote = static_cast<SwFootnoteFrame*>(pLastInsertedFootnote->GetNext());
+ SwTextFootnote* pAttr = pNextFootnote->GetAttr();
+ SwFrame* pCnt = pNextFootnote->ContainsAny();
+
+ bool bUnlock = !pNextFootnote->IsBackMoveLocked();
+ pNextFootnote->LockBackMove();
+ // #i49383# - disable unlock of position of
+ // lower objects during format of footnote content.
+ pNextFootnote->KeepLockPosOfLowerObjs();
+ // #i57914# - adjust fix #i49383#
+
+ while ( pCnt && pCnt->FindFootnoteFrame()->GetAttr() == pAttr )
+ {
+ pCnt->InvalidatePos_();
+ pCnt->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ // #i49383# - format anchored objects
+ if ( pCnt->IsTextFrame() && pCnt->isFrameAreaDefinitionValid() )
+ {
+ if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt,
+ *(pCnt->FindPageFrame()) ) )
{
- pNextFootnote->UnlockBackMove();
+ // restart format with first content
+ pCnt = pNextFootnote->ContainsAny();
+ continue;
}
- // #i49383#
- // #i57914# - adjust fix #i49383#
- // enable lock of lower object position before format of footnote frame.
- pNextFootnote->UnlockPosOfLowerObjs();
- pNextFootnote->Calc(getRootFrame()->GetCurrShell()->GetOut());
}
+ if( pCnt->IsSctFrame() )
+ {
+ // If the area is not empty, iterate also over the content
+ SwFrame* pTmp = static_cast<SwSectionFrame*>(pCnt)->ContainsAny();
+ if( pTmp )
+ pCnt = pTmp;
+ else
+ pCnt = pCnt->FindNext();
+ }
+ else
+ pCnt = pCnt->FindNext();
}
+ if( bUnlock )
+ {
+ pNextFootnote->UnlockBackMove();
+ }
+ // #i49383#
+ // #i57914# - adjust fix #i49383#
+ // enable lock of lower object position before format of footnote frame.
+ pNextFootnote->UnlockPosOfLowerObjs();
+ pNextFootnote->Calc(getRootFrame()->GetCurrShell()->GetOut());
}
void SwFootnoteBossFrame::MoveFootnotes( const SwContentFrame *pSrc, SwContentFrame *pDest,
@@ -2171,29 +2171,29 @@ void SwFootnoteBossFrame::MoveFootnotes( const SwContentFrame *pSrc, SwContentFr
"SwPageFrame::MoveFootnotes: source frame isn't on that FootnoteBoss" );
SwFootnoteFrame *pFootnote = FindFirstFootnote();
- if( pFootnote )
+ if( !pFootnote )
+ return;
+
+ ChangeFootnoteRef( pSrc, pAttr, pDest );
+ SwFootnoteBossFrame *pDestBoss = pDest->FindFootnoteBossFrame( true );
+ OSL_ENSURE( pDestBoss, "+SwPageFrame::MoveFootnotes: no destination boss" );
+ if( !pDestBoss ) // robust
+ return;
+
+ SwFootnoteFrames aFootnoteArr;
+ SwFootnoteBossFrame::CollectFootnotes_(pDest, pFootnote, aFootnoteArr, nullptr);
+ if ( aFootnoteArr.empty() )
+ return;
+
+ pDestBoss->MoveFootnotes_( aFootnoteArr, true );
+ SwPageFrame* pSrcPage = FindPageFrame();
+ SwPageFrame* pDestPage = pDestBoss->FindPageFrame();
+ // update FootnoteNum only at page change
+ if( pSrcPage != pDestPage )
{
- ChangeFootnoteRef( pSrc, pAttr, pDest );
- SwFootnoteBossFrame *pDestBoss = pDest->FindFootnoteBossFrame( true );
- OSL_ENSURE( pDestBoss, "+SwPageFrame::MoveFootnotes: no destination boss" );
- if( pDestBoss ) // robust
- {
- SwFootnoteFrames aFootnoteArr;
- SwFootnoteBossFrame::CollectFootnotes_(pDest, pFootnote, aFootnoteArr, nullptr);
- if ( !aFootnoteArr.empty() )
- {
- pDestBoss->MoveFootnotes_( aFootnoteArr, true );
- SwPageFrame* pSrcPage = FindPageFrame();
- SwPageFrame* pDestPage = pDestBoss->FindPageFrame();
- // update FootnoteNum only at page change
- if( pSrcPage != pDestPage )
- {
- if( pSrcPage->GetPhyPageNum() > pDestPage->GetPhyPageNum() )
- pSrcPage->UpdateFootnoteNum();
- pDestPage->UpdateFootnoteNum();
- }
- }
- }
+ if( pSrcPage->GetPhyPageNum() > pDestPage->GetPhyPageNum() )
+ pSrcPage->UpdateFootnoteNum();
+ pDestPage->UpdateFootnoteNum();
}
}
@@ -2228,189 +2228,189 @@ void SwFootnoteBossFrame::RearrangeFootnotes( const SwTwips nDeadLine, const boo
SwDoc *pDoc = GetFormat()->GetDoc();
const sal_uLong nFootnotePos = pAttr ? ::lcl_FindFootnotePos( pDoc, pAttr ) : 0;
SwFrame *pCnt = pFootnote ? pFootnote->ContainsAny() : nullptr;
- if ( pCnt )
- {
- bool bMore = true;
- bool bStart = pAttr == nullptr; // If no attribute is given, process all
- // #i49383# - disable unlock of position of
- // lower objects during format of footnote and footnote content.
- SwFootnoteFrame* pLastFootnoteFrame( nullptr );
- // footnote frame needs to be locked, if <bLock> isn't set.
- bool bUnlockLastFootnoteFrame( false );
- do
+ if ( !pCnt )
+ return;
+
+ bool bMore = true;
+ bool bStart = pAttr == nullptr; // If no attribute is given, process all
+ // #i49383# - disable unlock of position of
+ // lower objects during format of footnote and footnote content.
+ SwFootnoteFrame* pLastFootnoteFrame( nullptr );
+ // footnote frame needs to be locked, if <bLock> isn't set.
+ bool bUnlockLastFootnoteFrame( false );
+ do
+ {
+ if( !bStart )
+ bStart = ::lcl_FindFootnotePos( pDoc, pCnt->FindFootnoteFrame()->GetAttr() )
+ == nFootnotePos;
+ if( bStart )
{
- if( !bStart )
- bStart = ::lcl_FindFootnotePos( pDoc, pCnt->FindFootnoteFrame()->GetAttr() )
- == nFootnotePos;
- if( bStart )
+ pCnt->InvalidatePos_();
+ pCnt->InvalidateSize_();
+ pCnt->Prepare( PrepareHint::AdjustSizeWithoutFormatting );
+ SwFootnoteFrame* pFootnoteFrame = pCnt->FindFootnoteFrame();
+ // #i49383#
+ if ( pFootnoteFrame != pLastFootnoteFrame )
{
- pCnt->InvalidatePos_();
- pCnt->InvalidateSize_();
- pCnt->Prepare( PrepareHint::AdjustSizeWithoutFormatting );
- SwFootnoteFrame* pFootnoteFrame = pCnt->FindFootnoteFrame();
- // #i49383#
- if ( pFootnoteFrame != pLastFootnoteFrame )
+ if ( pLastFootnoteFrame )
{
- if ( pLastFootnoteFrame )
+ if ( !bLock && bUnlockLastFootnoteFrame )
{
- if ( !bLock && bUnlockLastFootnoteFrame )
- {
- pLastFootnoteFrame->ColUnlock();
- }
- // #i57914# - adjust fix #i49383#
- // enable lock of lower object position before format of footnote frame.
- pLastFootnoteFrame->UnlockPosOfLowerObjs();
- pLastFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
- if ( !bLock && bUnlockLastFootnoteFrame &&
- !pLastFootnoteFrame->GetLower() &&
- !pLastFootnoteFrame->IsColLocked() &&
- !pLastFootnoteFrame->IsBackMoveLocked() &&
- !pLastFootnoteFrame->IsDeleteForbidden() )
- {
- pLastFootnoteFrame->Cut();
- SwFrame::DestroyFrame(pLastFootnoteFrame);
- pLastFootnoteFrame = nullptr;
- }
+ pLastFootnoteFrame->ColUnlock();
}
- if ( !bLock )
+ // #i57914# - adjust fix #i49383#
+ // enable lock of lower object position before format of footnote frame.
+ pLastFootnoteFrame->UnlockPosOfLowerObjs();
+ pLastFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ if ( !bLock && bUnlockLastFootnoteFrame &&
+ !pLastFootnoteFrame->GetLower() &&
+ !pLastFootnoteFrame->IsColLocked() &&
+ !pLastFootnoteFrame->IsBackMoveLocked() &&
+ !pLastFootnoteFrame->IsDeleteForbidden() )
{
- bUnlockLastFootnoteFrame = !pFootnoteFrame->IsColLocked();
- pFootnoteFrame->ColLock();
+ pLastFootnoteFrame->Cut();
+ SwFrame::DestroyFrame(pLastFootnoteFrame);
+ pLastFootnoteFrame = nullptr;
}
- pFootnoteFrame->KeepLockPosOfLowerObjs();
- pLastFootnoteFrame = pFootnoteFrame;
}
- // OD 30.10.2002 #97265# - invalidate position of footnote
- // frame, if it's below its footnote container, in order to
- // assure its correct position, probably calculating its previous
- // footnote frames.
+ if ( !bLock )
{
- SwRectFnSet aRectFnSet(this);
- SwFrame* pFootnoteContFrame = pFootnoteFrame->GetUpper();
- if ( aRectFnSet.TopDist(pFootnoteFrame->getFrameArea(), aRectFnSet.GetPrtBottom(*pFootnoteContFrame)) > 0 )
- {
- pFootnoteFrame->InvalidatePos_();
- }
+ bUnlockLastFootnoteFrame = !pFootnoteFrame->IsColLocked();
+ pFootnoteFrame->ColLock();
}
- if ( bLock )
+ pFootnoteFrame->KeepLockPosOfLowerObjs();
+ pLastFootnoteFrame = pFootnoteFrame;
+ }
+ // OD 30.10.2002 #97265# - invalidate position of footnote
+ // frame, if it's below its footnote container, in order to
+ // assure its correct position, probably calculating its previous
+ // footnote frames.
+ {
+ SwRectFnSet aRectFnSet(this);
+ SwFrame* pFootnoteContFrame = pFootnoteFrame->GetUpper();
+ if ( aRectFnSet.TopDist(pFootnoteFrame->getFrameArea(), aRectFnSet.GetPrtBottom(*pFootnoteContFrame)) > 0 )
{
- bool bUnlock = !pFootnoteFrame->IsBackMoveLocked();
- pFootnoteFrame->LockBackMove();
- pFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
- pCnt->Calc(getRootFrame()->GetCurrShell()->GetOut());
- // #i49383# - format anchored objects
- if ( pCnt->IsTextFrame() && pCnt->isFrameAreaDefinitionValid() )
- {
- SwFrameDeleteGuard aDeleteGuard(pFootnote);
- if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt,
- *(pCnt->FindPageFrame()) ) )
- {
- // restart format with first content
- pCnt = pFootnote ? pFootnote->ContainsAny() : nullptr;
- if (!pCnt)
- bMore = false;
- continue;
- }
- }
- if( bUnlock )
- {
- pFootnoteFrame->UnlockBackMove();
- if( !pFootnoteFrame->Lower() &&
- !pFootnoteFrame->IsColLocked() )
- {
- // #i49383#
- OSL_ENSURE( pLastFootnoteFrame == pFootnoteFrame,
- "<SwFootnoteBossFrame::RearrangeFootnotes(..)> - <pLastFootnoteFrame> != <pFootnoteFrame>" );
- pLastFootnoteFrame = nullptr;
- pFootnoteFrame->Cut();
- SwFrame::DestroyFrame(pFootnoteFrame);
- if (pFootnote == pFootnoteFrame)
- pFootnote = nullptr;
- }
- }
+ pFootnoteFrame->InvalidatePos_();
}
- else
+ }
+ if ( bLock )
+ {
+ bool bUnlock = !pFootnoteFrame->IsBackMoveLocked();
+ pFootnoteFrame->LockBackMove();
+ pFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ pCnt->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ // #i49383# - format anchored objects
+ if ( pCnt->IsTextFrame() && pCnt->isFrameAreaDefinitionValid() )
{
- pFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
- pCnt->Calc(getRootFrame()->GetCurrShell()->GetOut());
- // #i49383# - format anchored objects
- if ( pCnt->IsTextFrame() && pCnt->isFrameAreaDefinitionValid() )
+ SwFrameDeleteGuard aDeleteGuard(pFootnote);
+ if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt,
+ *(pCnt->FindPageFrame()) ) )
{
- if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt,
- *(pCnt->FindPageFrame()) ) )
- {
- // restart format with first content
- pCnt = pFootnote->ContainsAny();
- continue;
- }
+ // restart format with first content
+ pCnt = pFootnote ? pFootnote->ContainsAny() : nullptr;
+ if (!pCnt)
+ bMore = false;
+ continue;
}
}
- }
- SwSectionFrame *pDel = nullptr;
- if( pCnt->IsSctFrame() )
- {
- SwFrame* pTmp = static_cast<SwSectionFrame*>(pCnt)->ContainsAny();
- if( pTmp )
+ if( bUnlock )
{
- pCnt = pTmp;
- continue;
+ pFootnoteFrame->UnlockBackMove();
+ if( !pFootnoteFrame->Lower() &&
+ !pFootnoteFrame->IsColLocked() )
+ {
+ // #i49383#
+ OSL_ENSURE( pLastFootnoteFrame == pFootnoteFrame,
+ "<SwFootnoteBossFrame::RearrangeFootnotes(..)> - <pLastFootnoteFrame> != <pFootnoteFrame>" );
+ pLastFootnoteFrame = nullptr;
+ pFootnoteFrame->Cut();
+ SwFrame::DestroyFrame(pFootnoteFrame);
+ if (pFootnote == pFootnoteFrame)
+ pFootnote = nullptr;
+ }
}
- pDel = static_cast<SwSectionFrame*>(pCnt);
}
- if ( pCnt->GetNext() )
- pCnt = pCnt->GetNext();
else
{
- pCnt = pCnt->FindNext();
- if ( pCnt )
+ pFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ pCnt->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ // #i49383# - format anchored objects
+ if ( pCnt->IsTextFrame() && pCnt->isFrameAreaDefinitionValid() )
{
- SwFootnoteFrame* pFootnoteFrame = pCnt->FindFootnoteFrame();
- if( pFootnoteFrame->GetRef()->FindFootnoteBossFrame(
- pFootnoteFrame->GetAttr()->GetFootnote().IsEndNote() ) != this )
- bMore = false;
+ if ( !SwObjectFormatter::FormatObjsAtFrame( *pCnt,
+ *(pCnt->FindPageFrame()) ) )
+ {
+ // restart format with first content
+ pCnt = pFootnote->ContainsAny();
+ continue;
+ }
}
- else
- bMore = false;
}
- if( pDel )
+ }
+ SwSectionFrame *pDel = nullptr;
+ if( pCnt->IsSctFrame() )
+ {
+ SwFrame* pTmp = static_cast<SwSectionFrame*>(pCnt)->ContainsAny();
+ if( pTmp )
{
- bool bUnlockLastFootnoteFrameGuard = pLastFootnoteFrame && !pLastFootnoteFrame->IsColLocked();
- if (bUnlockLastFootnoteFrameGuard)
- pLastFootnoteFrame->ColLock();
- pDel->Cut();
- if (bUnlockLastFootnoteFrameGuard)
- pLastFootnoteFrame->ColUnlock();
- SwFrame::DestroyFrame(pDel);
+ pCnt = pTmp;
+ continue;
}
- if ( bMore )
+ pDel = static_cast<SwSectionFrame*>(pCnt);
+ }
+ if ( pCnt->GetNext() )
+ pCnt = pCnt->GetNext();
+ else
+ {
+ pCnt = pCnt->FindNext();
+ if ( pCnt )
{
- // Go not further than to the provided footnote (if given)
- if ( pAttr &&
- (::lcl_FindFootnotePos( pDoc,
- pCnt->FindFootnoteFrame()->GetAttr()) > nFootnotePos ) )
+ SwFootnoteFrame* pFootnoteFrame = pCnt->FindFootnoteFrame();
+ if( pFootnoteFrame->GetRef()->FindFootnoteBossFrame(
+ pFootnoteFrame->GetAttr()->GetFootnote().IsEndNote() ) != this )
bMore = false;
}
- } while ( bMore );
- // #i49383#
- if ( pLastFootnoteFrame )
+ else
+ bMore = false;
+ }
+ if( pDel )
{
- if ( !bLock && bUnlockLastFootnoteFrame )
- {
+ bool bUnlockLastFootnoteFrameGuard = pLastFootnoteFrame && !pLastFootnoteFrame->IsColLocked();
+ if (bUnlockLastFootnoteFrameGuard)
+ pLastFootnoteFrame->ColLock();
+ pDel->Cut();
+ if (bUnlockLastFootnoteFrameGuard)
pLastFootnoteFrame->ColUnlock();
- }
- // #i57914# - adjust fix #i49383#
- // enable lock of lower object position before format of footnote frame.
- pLastFootnoteFrame->UnlockPosOfLowerObjs();
- pLastFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
- if ( !bLock && bUnlockLastFootnoteFrame &&
- !pLastFootnoteFrame->GetLower() &&
- !pLastFootnoteFrame->IsColLocked() &&
- !pLastFootnoteFrame->IsBackMoveLocked() )
- {
- pLastFootnoteFrame->Cut();
- SwFrame::DestroyFrame(pLastFootnoteFrame);
- }
+ SwFrame::DestroyFrame(pDel);
+ }
+ if ( bMore )
+ {
+ // Go not further than to the provided footnote (if given)
+ if ( pAttr &&
+ (::lcl_FindFootnotePos( pDoc,
+ pCnt->FindFootnoteFrame()->GetAttr()) > nFootnotePos ) )
+ bMore = false;
}
+ } while ( bMore );
+ // #i49383#
+ if ( !pLastFootnoteFrame )
+ return;
+
+ if ( !bLock && bUnlockLastFootnoteFrame )
+ {
+ pLastFootnoteFrame->ColUnlock();
+ }
+ // #i57914# - adjust fix #i49383#
+ // enable lock of lower object position before format of footnote frame.
+ pLastFootnoteFrame->UnlockPosOfLowerObjs();
+ pLastFootnoteFrame->Calc(getRootFrame()->GetCurrShell()->GetOut());
+ if ( !bLock && bUnlockLastFootnoteFrame &&
+ !pLastFootnoteFrame->GetLower() &&
+ !pLastFootnoteFrame->IsColLocked() &&
+ !pLastFootnoteFrame->IsBackMoveLocked() )
+ {
+ pLastFootnoteFrame->Cut();
+ SwFrame::DestroyFrame(pLastFootnoteFrame);
}
}
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index f84d33eccb3f..d506251278ff 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -228,20 +228,20 @@ void SwLayAction::PaintContent( const SwContentFrame *pCnt,
PaintContent_( pCnt, pPage, aPaintRect );
}
- if ( pCnt->IsRetouche() && !pCnt->GetNext() )
+ if ( !(pCnt->IsRetouche() && !pCnt->GetNext()) )
+ return;
+
+ const SwFrame *pTmp = pCnt;
+ if( pCnt->IsInSct() )
{
- const SwFrame *pTmp = pCnt;
- if( pCnt->IsInSct() )
- {
- const SwSectionFrame* pSct = pCnt->FindSctFrame();
- if( pSct->IsRetouche() && !pSct->GetNext() )
- pTmp = pSct;
- }
- SwRect aRect( pTmp->GetUpper()->GetPaintArea() );
- aRectFnSet.SetTop( aRect, aRectFnSet.GetPrtBottom(*pTmp) );
- if ( !PaintContent_( pCnt, pPage, aRect ) )
- pCnt->ResetRetouche();
+ const SwSectionFrame* pSct = pCnt->FindSctFrame();
+ if( pSct->IsRetouche() && !pSct->GetNext() )
+ pTmp = pSct;
}
+ SwRect aRect( pTmp->GetUpper()->GetPaintArea() );
+ aRectFnSet.SetTop( aRect, aRectFnSet.GetPrtBottom(*pTmp) );
+ if ( !PaintContent_( pCnt, pPage, aRect ) )
+ pCnt->ResetRetouche();
}
SwLayAction::SwLayAction(SwRootFrame *pRt, SwViewShellImp *pI, TaskStopwatch* pWatch)
@@ -2120,21 +2120,21 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly )
#if HAVE_FEATURE_DESKTOP && defined DBG_UTIL
void SwLayIdle::ShowIdle( Color eColor )
{
- if ( !m_bIndicator )
+ if ( m_bIndicator )
+ return;
+
+ m_bIndicator = true;
+ vcl::Window *pWin = pImp->GetShell()->GetWin();
+ if (pWin && !pWin->SupportsDoubleBuffering()) // FIXME make this work with double-buffering
{
- m_bIndicator = true;
- vcl::Window *pWin = pImp->GetShell()->GetWin();
- if (pWin && !pWin->SupportsDoubleBuffering()) // FIXME make this work with double-buffering
- {
- tools::Rectangle aRect( 0, 0, 5, 5 );
- aRect = pWin->PixelToLogic( aRect );
- // Depending on if idle layout is in progress or not, draw a "red square" or a "green square".
- pWin->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
- pWin->SetFillColor( eColor );
- pWin->SetLineColor();
- pWin->DrawRect( aRect );
- pWin->Pop();
- }
+ tools::Rectangle aRect( 0, 0, 5, 5 );
+ aRect = pWin->PixelToLogic( aRect );
+ // Depending on if idle layout is in progress or not, draw a "red square" or a "green square".
+ pWin->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+ pWin->SetFillColor( eColor );
+ pWin->SetLineColor();
+ pWin->DrawRect( aRect );
+ pWin->Pop();
}
}
#define SHOW_IDLE( Color ) ShowIdle( Color )
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index f821a8d355d1..df4cfef9e0ed 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -163,65 +163,101 @@ bool SwLayCacheImpl::Read( SvStream& rStream )
*/
void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
{
- if( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ) // the layout itself ..
- {
- SwLayCacheIoImpl aIo( rStream, true );
- // We want to save the relative index, so we need the index
- // of the first content
- sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent().
- StartOfSectionNode()->GetIndex();
- // The first page...
- SwPageFrame* pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower()));
+ if( !rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ) // the layout itself ..
+ return;
- aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES );
- aIo.OpenFlagRec( 0, 0 );
- aIo.CloseFlagRec();
- while( pPage )
+ SwLayCacheIoImpl aIo( rStream, true );
+ // We want to save the relative index, so we need the index
+ // of the first content
+ sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent().
+ StartOfSectionNode()->GetIndex();
+ // The first page...
+ SwPageFrame* pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower()));
+
+ aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES );
+ aIo.OpenFlagRec( 0, 0 );
+ aIo.CloseFlagRec();
+ while( pPage )
+ {
+ if( pPage->GetPrev() )
{
- if( pPage->GetPrev() )
+ SwLayoutFrame* pLay = pPage->FindBodyCont();
+ SwFrame* pTmp = pLay ? pLay->ContainsAny() : nullptr;
+ // We are only interested in paragraph or table frames,
+ // a section frames contains paragraphs/tables.
+ if( pTmp && pTmp->IsSctFrame() )
+ pTmp = static_cast<SwSectionFrame*>(pTmp)->ContainsAny();
+
+ if( pTmp ) // any content
{
- SwLayoutFrame* pLay = pPage->FindBodyCont();
- SwFrame* pTmp = pLay ? pLay->ContainsAny() : nullptr;
- // We are only interested in paragraph or table frames,
- // a section frames contains paragraphs/tables.
- if( pTmp && pTmp->IsSctFrame() )
- pTmp = static_cast<SwSectionFrame*>(pTmp)->ContainsAny();
-
- if( pTmp ) // any content
+ if( pTmp->IsTextFrame() )
{
- if( pTmp->IsTextFrame() )
+ SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTmp));
+ assert(!pFrame->GetMergedPara());
+ sal_uLong nNdIdx = pFrame->GetTextNodeFirst()->GetIndex();
+ if( nNdIdx > nStartOfContent )
+ {
+ /* Open Paragraph Record */
+ aIo.OpenRec( SW_LAYCACHE_IO_REC_PARA );
+ bool bFollow = static_cast<SwTextFrame*>(pTmp)->IsFollow();
+ aIo.OpenFlagRec( bFollow ? 0x01 : 0x00,
+ bFollow ? 8 : 4 );
+ nNdIdx -= nStartOfContent;
+ aIo.GetStream().WriteUInt32( nNdIdx );
+ if( bFollow )
+ aIo.GetStream().WriteUInt32( sal_Int32(static_cast<SwTextFrame*>(pTmp)->GetOffset()) );
+ aIo.CloseFlagRec();
+ /* Close Paragraph Record */
+ aIo.CloseRec();
+ }
+ }
+ else if( pTmp->IsTabFrame() )
+ {
+ SwTabFrame* pTab = static_cast<SwTabFrame*>(pTmp);
+ sal_uLong nOfst = COMPLETE_STRING;
+ if( pTab->IsFollow() )
{
- SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(pTmp));
- assert(!pFrame->GetMergedPara());
- sal_uLong nNdIdx = pFrame->GetTextNodeFirst()->GetIndex();
+ // If the table is a follow, we have to look for the
+ // master and to count all rows to get the row number
+ nOfst = 0;
+ if( pTab->IsFollow() )
+ pTab = pTab->FindMaster( true );
+ while( pTab != pTmp )
+ {
+ SwFrame* pSub = pTab->Lower();
+ while( pSub )
+ {
+ ++nOfst;
+ pSub = pSub->GetNext();
+ }
+ pTab = pTab->GetFollow();
+ assert(pTab && "Table follow without master");
+ }
+ }
+ while (true)
+ {
+ sal_uLong nNdIdx =
+ pTab->GetTable()->GetTableNode()->GetIndex();
if( nNdIdx > nStartOfContent )
{
- /* Open Paragraph Record */
- aIo.OpenRec( SW_LAYCACHE_IO_REC_PARA );
- bool bFollow = static_cast<SwTextFrame*>(pTmp)->IsFollow();
- aIo.OpenFlagRec( bFollow ? 0x01 : 0x00,
- bFollow ? 8 : 4 );
+ /* Open Table Record */
+ aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE );
+ aIo.OpenFlagRec( 0, 8 );
nNdIdx -= nStartOfContent;
- aIo.GetStream().WriteUInt32( nNdIdx );
- if( bFollow )
- aIo.GetStream().WriteUInt32( sal_Int32(static_cast<SwTextFrame*>(pTmp)->GetOffset()) );
+ aIo.GetStream().WriteUInt32( nNdIdx )
+ .WriteUInt32( nOfst );
aIo.CloseFlagRec();
- /* Close Paragraph Record */
+ /* Close Table Record */
aIo.CloseRec();
}
- }
- else if( pTmp->IsTabFrame() )
- {
- SwTabFrame* pTab = static_cast<SwTabFrame*>(pTmp);
- sal_uLong nOfst = COMPLETE_STRING;
- if( pTab->IsFollow() )
+ // If the table has a follow on the next page,
+ // we know already the row number and store this
+ // immediately.
+ if( pTab->GetFollow() )
{
- // If the table is a follow, we have to look for the
- // master and to count all rows to get the row number
- nOfst = 0;
- if( pTab->IsFollow() )
- pTab = pTab->FindMaster( true );
- while( pTab != pTmp )
+ if( nOfst == sal_uLong(COMPLETE_STRING) )
+ nOfst = 0;
+ do
{
SwFrame* pSub = pTab->Lower();
while( pSub )
@@ -230,96 +266,60 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
pSub = pSub->GetNext();
}
pTab = pTab->GetFollow();
- assert(pTab && "Table follow without master");
- }
- }
- while (true)
- {
- sal_uLong nNdIdx =
- pTab->GetTable()->GetTableNode()->GetIndex();
- if( nNdIdx > nStartOfContent )
- {
- /* Open Table Record */
- aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE );
- aIo.OpenFlagRec( 0, 8 );
- nNdIdx -= nStartOfContent;
- aIo.GetStream().WriteUInt32( nNdIdx )
- .WriteUInt32( nOfst );
- aIo.CloseFlagRec();
- /* Close Table Record */
- aIo.CloseRec();
- }
- // If the table has a follow on the next page,
- // we know already the row number and store this
- // immediately.
- if( pTab->GetFollow() )
- {
- if( nOfst == sal_uLong(COMPLETE_STRING) )
- nOfst = 0;
- do
+ SwPageFrame *pTabPage = pTab->FindPageFrame();
+ if( pTabPage != pPage )
{
- SwFrame* pSub = pTab->Lower();
- while( pSub )
- {
- ++nOfst;
- pSub = pSub->GetNext();
- }
- pTab = pTab->GetFollow();
- SwPageFrame *pTabPage = pTab->FindPageFrame();
- if( pTabPage != pPage )
- {
- OSL_ENSURE( pPage->GetPhyPageNum() <
- pTabPage->GetPhyPageNum(),
- "Looping Tableframes" );
- pPage = pTabPage;
- break;
- }
- } while ( pTab->GetFollow() );
- }
- else
- break;
+ OSL_ENSURE( pPage->GetPhyPageNum() <
+ pTabPage->GetPhyPageNum(),
+ "Looping Tableframes" );
+ pPage = pTabPage;
+ break;
+ }
+ } while ( pTab->GetFollow() );
}
+ else
+ break;
}
}
}
- if( pPage->GetSortedObjs() )
+ }
+ if( pPage->GetSortedObjs() )
+ {
+ SwSortedObjs &rObjs = *pPage->GetSortedObjs();
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
{
- SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- for (SwAnchoredObject* pAnchoredObj : rObjs)
+ if (SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj))
{
- if (SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj))
+ if( pFly->getFrameArea().Left() != FAR_AWAY &&
+ !pFly->GetAnchorFrame()->FindFooterOrHeader() )
{
- if( pFly->getFrameArea().Left() != FAR_AWAY &&
- !pFly->GetAnchorFrame()->FindFooterOrHeader() )
+ const SwContact *pC =
+ ::GetUserCall(pAnchoredObj->GetDrawObj());
+ if( pC )
{
- const SwContact *pC =
- ::GetUserCall(pAnchoredObj->GetDrawObj());
- if( pC )
- {
- sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum();
- sal_uInt16 nPageNum = pPage->GetPhyPageNum();
- /* Open Fly Record */
- aIo.OpenRec( SW_LAYCACHE_IO_REC_FLY );
- aIo.OpenFlagRec( 0, 0 );
- aIo.CloseFlagRec();
- const SwRect& rRct = pFly->getFrameArea();
- sal_Int32 nX = rRct.Left() - pPage->getFrameArea().Left();
- sal_Int32 nY = rRct.Top() - pPage->getFrameArea().Top();
- aIo.GetStream().WriteUInt16( nPageNum ).WriteUInt32( nOrdNum )
- .WriteInt32( nX ).WriteInt32( nY )
- .WriteInt32( rRct.Width() )
- .WriteInt32( rRct.Height() );
- /* Close Fly Record */
- aIo.CloseRec();
- }
+ sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum();
+ sal_uInt16 nPageNum = pPage->GetPhyPageNum();
+ /* Open Fly Record */
+ aIo.OpenRec( SW_LAYCACHE_IO_REC_FLY );
+ aIo.OpenFlagRec( 0, 0 );
+ aIo.CloseFlagRec();
+ const SwRect& rRct = pFly->getFrameArea();
+ sal_Int32 nX = rRct.Left() - pPage->getFrameArea().Left();
+ sal_Int32 nY = rRct.Top() - pPage->getFrameArea().Top();
+ aIo.GetStream().WriteUInt16( nPageNum ).WriteUInt32( nOrdNum )
+ .WriteInt32( nX ).WriteInt32( nY )
+ .WriteInt32( rRct.Width() )
+ .WriteInt32( rRct.Height() );
+ /* Close Fly Record */
+ aIo.CloseRec();
}
}
}
}
- pPage = static_cast<SwPageFrame*>(pPage->GetNext());
}
- aIo.CloseRec();
+ pPage = static_cast<SwPageFrame*>(pPage->GetNext());
}
+ aIo.CloseRec();
}
#ifdef DBG_UTIL
@@ -975,75 +975,75 @@ void SwLayHelper::CheckFlyCache_( SwPageFrame* pPage )
return;
const size_t nFlyCount = mpImpl->GetFlyCount();
// Any text frames at the page, fly cache available?
- if( pPage->GetSortedObjs() && mnFlyIdx < nFlyCount )
- {
- SwSortedObjs &rObjs = *pPage->GetSortedObjs();
- sal_uInt16 nPgNum = pPage->GetPhyPageNum();
+ if( !(pPage->GetSortedObjs() && mnFlyIdx < nFlyCount) )
+ return;
- // NOTE: Here we do not use the absolute ordnums but
- // relative ordnums for the objects on this page.
+ SwSortedObjs &rObjs = *pPage->GetSortedObjs();
+ sal_uInt16 nPgNum = pPage->GetPhyPageNum();
- // skip fly frames from pages before the current page
- while( mnFlyIdx < nFlyCount &&
- mpImpl->GetFlyCache(mnFlyIdx).nPageNum < nPgNum )
- ++mnFlyIdx;
+ // NOTE: Here we do not use the absolute ordnums but
+ // relative ordnums for the objects on this page.
- // sort cached objects on this page by ordnum
- std::set< const SwFlyCache*, FlyCacheCompare > aFlyCacheSet;
- size_t nIdx = mnFlyIdx;
+ // skip fly frames from pages before the current page
+ while( mnFlyIdx < nFlyCount &&
+ mpImpl->GetFlyCache(mnFlyIdx).nPageNum < nPgNum )
+ ++mnFlyIdx;
- SwFlyCache* pFlyC;
- while( nIdx < nFlyCount &&
- ( pFlyC = &mpImpl->GetFlyCache( nIdx ) )->nPageNum == nPgNum )
- {
- aFlyCacheSet.insert( pFlyC );
- ++nIdx;
- }
+ // sort cached objects on this page by ordnum
+ std::set< const SwFlyCache*, FlyCacheCompare > aFlyCacheSet;
+ size_t nIdx = mnFlyIdx;
- // sort objects on this page by ordnum
- std::set< const SdrObject*, SdrObjectCompare > aFlySet;
- for (SwAnchoredObject* pAnchoredObj : rObjs)
+ SwFlyCache* pFlyC;
+ while( nIdx < nFlyCount &&
+ ( pFlyC = &mpImpl->GetFlyCache( nIdx ) )->nPageNum == nPgNum )
+ {
+ aFlyCacheSet.insert( pFlyC );
+ ++nIdx;
+ }
+
+ // sort objects on this page by ordnum
+ std::set< const SdrObject*, SdrObjectCompare > aFlySet;
+ for (SwAnchoredObject* pAnchoredObj : rObjs)
+ {
+ if (SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj)) // a text frame?
{
- if (SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj)) // a text frame?
+ if( pFly->GetAnchorFrame() &&
+ !pFly->GetAnchorFrame()->FindFooterOrHeader() )
{
- if( pFly->GetAnchorFrame() &&
- !pFly->GetAnchorFrame()->FindFooterOrHeader() )
+ const SwContact *pC = ::GetUserCall( pAnchoredObj->GetDrawObj() );
+ if( pC )
{
- const SwContact *pC = ::GetUserCall( pAnchoredObj->GetDrawObj() );
- if( pC )
- {
- aFlySet.insert( pAnchoredObj->GetDrawObj() );
- }
+ aFlySet.insert( pAnchoredObj->GetDrawObj() );
}
}
}
+ }
- if ( aFlyCacheSet.size() == aFlySet.size() )
- {
- std::set< const SdrObject*, SdrObjectCompare >::iterator aFlySetIt =
- aFlySet.begin();
+ if ( aFlyCacheSet.size() != aFlySet.size() )
+ return;
- for ( const SwFlyCache* pFlyCache : aFlyCacheSet )
- {
- SwFlyFrame* pFly = const_cast<SwVirtFlyDrawObj*>(static_cast<const SwVirtFlyDrawObj*>(*aFlySetIt))->GetFlyFrame();
+ std::set< const SdrObject*, SdrObjectCompare >::iterator aFlySetIt =
+ aFlySet.begin();
- if ( pFly->getFrameArea().Left() == FAR_AWAY )
- {
- // we get the stored information
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*pFly);
- aFrm.Pos().setX( pFlyCache->Left() + pPage->getFrameArea().Left() );
- aFrm.Pos().setY( pFlyCache->Top() + pPage->getFrameArea().Top() );
+ for ( const SwFlyCache* pFlyCache : aFlyCacheSet )
+ {
+ SwFlyFrame* pFly = const_cast<SwVirtFlyDrawObj*>(static_cast<const SwVirtFlyDrawObj*>(*aFlySetIt))->GetFlyFrame();
- if ( mpImpl->IsUseFlyCache() )
- {
- aFrm.Width( pFlyCache->Width() );
- aFrm.Height( pFlyCache->Height() );
- }
- }
+ if ( pFly->getFrameArea().Left() == FAR_AWAY )
+ {
+ // we get the stored information
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*pFly);
+ aFrm.Pos().setX( pFlyCache->Left() + pPage->getFrameArea().Left() );
+ aFrm.Pos().setY( pFlyCache->Top() + pPage->getFrameArea().Top() );
- ++aFlySetIt;
+ if ( mpImpl->IsUseFlyCache() )
+ {
+ aFrm.Width( pFlyCache->Width() );
+ aFrm.Height( pFlyCache->Height() );
}
}
+
+ ++aFlySetIt;
}
}
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx
index c8d64cf4449e..609b5a527ac1 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -462,28 +462,28 @@ void SwObjectFormatterTextFrame::InvalidatePrevObjs( SwAnchoredObject& _rAnchore
// Note: list of objects at anchor frame is sorted by this property.
if ( _rAnchoredObj.GetFrameFormat().GetWrapInfluenceOnObjPos().
// #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
- GetWrapInfluenceOnObjPos( true ) ==
+ GetWrapInfluenceOnObjPos( true ) !=
// #i35017# - constant name has changed
text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
+ return;
+
+ const SwSortedObjs* pObjs = GetAnchorFrame().GetDrawObjs();
+ if ( !pObjs )
+ return;
+
+ // determine start index
+ size_t i = pObjs->ListPosOf( _rAnchoredObj );
+ while (i > 0)
{
- const SwSortedObjs* pObjs = GetAnchorFrame().GetDrawObjs();
- if ( pObjs )
+ --i;
+ SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
+ if ( pAnchoredObj->GetFrameFormat().GetWrapInfluenceOnObjPos().
+ // #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
+ GetWrapInfluenceOnObjPos( true ) ==
+ // #i35017# - constant name has changed
+ text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
{
- // determine start index
- size_t i = pObjs->ListPosOf( _rAnchoredObj );
- while (i > 0)
- {
- --i;
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
- if ( pAnchoredObj->GetFrameFormat().GetWrapInfluenceOnObjPos().
- // #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE
- GetWrapInfluenceOnObjPos( true ) ==
- // #i35017# - constant name has changed
- text::WrapInfluenceOnPosition::ONCE_CONCURRENT )
- {
- pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
- }
- }
+ pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
}
}
}
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index ebcf239ef580..d9d672afaee9 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -308,21 +308,21 @@ void SwPageFrame::CheckGrid( bool bInvalidate )
m_bHasGrid = true;
SwTextGridItem const*const pGrid(GetGridItem(this));
m_bHasGrid = nullptr != pGrid;
- if( bInvalidate || bOld != m_bHasGrid )
+ if( !(bInvalidate || bOld != m_bHasGrid) )
+ return;
+
+ SwLayoutFrame* pBody = FindBodyCont();
+ if( pBody )
{
- SwLayoutFrame* pBody = FindBodyCont();
- if( pBody )
+ pBody->InvalidatePrt();
+ SwContentFrame* pFrame = pBody->ContainsContent();
+ while( pBody->IsAnLower( pFrame ) )
{
- pBody->InvalidatePrt();
- SwContentFrame* pFrame = pBody->ContainsContent();
- while( pBody->IsAnLower( pFrame ) )
- {
- static_cast<SwTextFrame*>(pFrame)->Prepare();
- pFrame = pFrame->GetNextContentFrame();
- }
+ static_cast<SwTextFrame*>(pFrame)->Prepare();
+ pFrame = pFrame->GetNextContentFrame();
}
- SetCompletePaint();
}
+ SetCompletePaint();
}
void SwPageFrame::CheckDirection( bool bVert )
@@ -524,22 +524,22 @@ void SwPageFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
else
UpdateAttr_( pOld, pNew, nInvFlags );
- if ( nInvFlags != 0 )
- {
- InvalidatePage( this );
- if ( nInvFlags & 0x01 )
- InvalidatePrt_();
- if ( nInvFlags & 0x02 )
- SetCompletePaint();
- if ( nInvFlags & 0x04 && GetNext() )
- GetNext()->InvalidatePos();
- if ( nInvFlags & 0x08 )
- PrepareHeader();
- if ( nInvFlags & 0x10 )
- PrepareFooter();
- if ( nInvFlags & 0x20 )
- CheckGrid( nInvFlags & 0x40 );
- }
+ if ( nInvFlags == 0 )
+ return;
+
+ InvalidatePage( this );
+ if ( nInvFlags & 0x01 )
+ InvalidatePrt_();
+ if ( nInvFlags & 0x02 )
+ SetCompletePaint();
+ if ( nInvFlags & 0x04 && GetNext() )
+ GetNext()->InvalidatePos();
+ if ( nInvFlags & 0x08 )
+ PrepareHeader();
+ if ( nInvFlags & 0x10 )
+ PrepareFooter();
+ if ( nInvFlags & 0x20 )
+ CheckGrid( nInvFlags & 0x40 );
}
@@ -943,20 +943,20 @@ void SwPageFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
static void lcl_PrepFlyInCntRegister( SwContentFrame *pFrame )
{
pFrame->Prepare( PrepareHint::Register );
- if( pFrame->GetDrawObjs() )
+ if( !pFrame->GetDrawObjs() )
+ return;
+
+ for(SwAnchoredObject* pAnchoredObj : *pFrame->GetDrawObjs())
{
- for(SwAnchoredObject* pAnchoredObj : *pFrame->GetDrawObjs())
+ // #i28701#
+ if ( dynamic_cast< const SwFlyInContentFrame *>( pAnchoredObj ) != nullptr )
{
- // #i28701#
- if ( dynamic_cast< const SwFlyInContentFrame *>( pAnchoredObj ) != nullptr )
+ SwFlyFrame* pFly = static_cast<SwFlyInContentFrame*>(pAnchoredObj);
+ SwContentFrame *pCnt = pFly->ContainsContent();
+ while ( pCnt )
{
- SwFlyFrame* pFly = static_cast<SwFlyInContentFrame*>(pAnchoredObj);
- SwContentFrame *pCnt = pFly->ContainsContent();
- while ( pCnt )
- {
- lcl_PrepFlyInCntRegister( pCnt );
- pCnt = pCnt->GetNextContentFrame();
- }
+ lcl_PrepFlyInCntRegister( pCnt );
+ pCnt = pCnt->GetNextContentFrame();
}
}
}
@@ -972,20 +972,20 @@ void SwPageFrame::PrepareRegisterChg()
if( !IsAnLower( pFrame ) )
break;
}
- if( GetSortedObjs() )
+ if( !GetSortedObjs() )
+ return;
+
+ for(SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
{
- for(SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
+ // #i28701#
+ if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
- // #i28701#
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
+ pFrame = pFly->ContainsContent();
+ while ( pFrame )
{
- SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
- pFrame = pFly->ContainsContent();
- while ( pFrame )
- {
- ::lcl_PrepFlyInCntRegister( pFrame );
- pFrame = pFrame->GetNextContentFrame();
- }
+ ::lcl_PrepFlyInCntRegister( pFrame );
+ pFrame = pFrame->GetNextContentFrame();
}
}
}
@@ -1876,73 +1876,79 @@ void SwRootFrame::StartAllAction()
void SwRootFrame::EndAllAction( bool bVirDev )
{
- if ( GetCurrShell() )
- for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ if ( !GetCurrShell() )
+ return;
+
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ {
+ const bool bOldEndActionByVirDev = rSh.IsEndActionByVirDev();
+ rSh.SetEndActionByVirDev( bVirDev );
+ if ( dynamic_cast<const SwCursorShell*>( &rSh) != nullptr )
{
- const bool bOldEndActionByVirDev = rSh.IsEndActionByVirDev();
- rSh.SetEndActionByVirDev( bVirDev );
- if ( dynamic_cast<const SwCursorShell*>( &rSh) != nullptr )
- {
- static_cast<SwCursorShell*>(&rSh)->EndAction();
- static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
- if ( dynamic_cast<const SwFEShell*>( &rSh) != nullptr )
- static_cast<SwFEShell*>(&rSh)->SetChainMarker();
- }
- else
- rSh.EndAction();
- rSh.SetEndActionByVirDev( bOldEndActionByVirDev );
+ static_cast<SwCursorShell*>(&rSh)->EndAction();
+ static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
+ if ( dynamic_cast<const SwFEShell*>( &rSh) != nullptr )
+ static_cast<SwFEShell*>(&rSh)->SetChainMarker();
}
+ else
+ rSh.EndAction();
+ rSh.SetEndActionByVirDev( bOldEndActionByVirDev );
+ }
}
void SwRootFrame::UnoRemoveAllActions()
{
- if ( GetCurrShell() )
- for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ if ( !GetCurrShell() )
+ return;
+
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ {
+ // #i84729#
+ // No end action, if <SwViewShell> instance is currently in its end action.
+ // Recursives calls to <::EndAction()> are not allowed.
+ if ( !rSh.IsInEndAction() )
{
- // #i84729#
- // No end action, if <SwViewShell> instance is currently in its end action.
- // Recursives calls to <::EndAction()> are not allowed.
- if ( !rSh.IsInEndAction() )
+ OSL_ENSURE(!rSh.GetRestoreActions(), "Restore action count is already set!");
+ bool bCursor = dynamic_cast<const SwCursorShell*>( &rSh) != nullptr;
+ bool bFE = dynamic_cast<const SwFEShell*>( &rSh) != nullptr;
+ sal_uInt16 nRestore = 0;
+ while( rSh.ActionCount() )
{
- OSL_ENSURE(!rSh.GetRestoreActions(), "Restore action count is already set!");
- bool bCursor = dynamic_cast<const SwCursorShell*>( &rSh) != nullptr;
- bool bFE = dynamic_cast<const SwFEShell*>( &rSh) != nullptr;
- sal_uInt16 nRestore = 0;
- while( rSh.ActionCount() )
+ if( bCursor )
{
- if( bCursor )
- {
- static_cast<SwCursorShell*>(&rSh)->EndAction();
- static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
- if ( bFE )
- static_cast<SwFEShell*>(&rSh)->SetChainMarker();
- }
- else
- rSh.EndAction();
- nRestore++;
+ static_cast<SwCursorShell*>(&rSh)->EndAction();
+ static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
+ if ( bFE )
+ static_cast<SwFEShell*>(&rSh)->SetChainMarker();
}
- rSh.SetRestoreActions(nRestore);
+ else
+ rSh.EndAction();
+ nRestore++;
}
- rSh.LockView(true);
+ rSh.SetRestoreActions(nRestore);
}
+ rSh.LockView(true);
+ }
}
void SwRootFrame::UnoRestoreAllActions()
{
- if ( GetCurrShell() )
- for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ if ( !GetCurrShell() )
+ return;
+
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ {
+ sal_uInt16 nActions = rSh.GetRestoreActions();
+ while( nActions-- )
{
- sal_uInt16 nActions = rSh.GetRestoreActions();
- while( nActions-- )
- {
- if ( dynamic_cast<const SwCursorShell*>( &rSh) != nullptr )
- static_cast<SwCursorShell*>(&rSh)->StartAction();
- else
- rSh.StartAction();
- }
- rSh.SetRestoreActions(0);
- rSh.LockView(false);
+ if ( dynamic_cast<const SwCursorShell*>( &rSh) != nullptr )
+ static_cast<SwCursorShell*>(&rSh)->StartAction();
+ else
+ rSh.StartAction();
}
+ rSh.SetRestoreActions(0);
+ rSh.LockView(false);
+ }
}
// Helper functions for SwRootFrame::CheckViewLayout
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 37a5bba27ed0..a3454140ed82 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1007,105 +1007,105 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
const SwLineRects *pRects,
SwPaintProperties const & properties )
{
- if ( !aLineRects.empty() )
+ if ( aLineRects.empty() )
+ return;
+
+ // #i16816# tagged pdf support
+ SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pOut );
+
+ // Remove all help line that are almost covered (tables)
+ for (size_type i = 0; i != aLineRects.size(); ++i)
{
- // #i16816# tagged pdf support
- SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pOut );
+ SwLineRect &rLi = aLineRects[i];
+ const bool bVerticalSubs = rLi.Height() > rLi.Width();
- // Remove all help line that are almost covered (tables)
- for (size_type i = 0; i != aLineRects.size(); ++i)
+ for (size_type k = i + 1; k != aLineRects.size(); ++k)
{
- SwLineRect &rLi = aLineRects[i];
- const bool bVerticalSubs = rLi.Height() > rLi.Width();
-
- for (size_type k = i + 1; k != aLineRects.size(); ++k)
+ SwLineRect &rLk = aLineRects[k];
+ if ( rLi.SSize() == rLk.SSize() )
{
- SwLineRect &rLk = aLineRects[k];
- if ( rLi.SSize() == rLk.SSize() )
+ if ( bVerticalSubs == ( rLk.Height() > rLk.Width() ) )
{
- if ( bVerticalSubs == ( rLk.Height() > rLk.Width() ) )
+ if ( bVerticalSubs )
{
- if ( bVerticalSubs )
+ long nLi = rLi.Right();
+ long nLk = rLk.Right();
+ if ( rLi.Top() == rLk.Top() &&
+ ((nLi < rLk.Left() && nLi+21 > rLk.Left()) ||
+ (nLk < rLi.Left() && nLk+21 > rLi.Left())))
{
- long nLi = rLi.Right();
- long nLk = rLk.Right();
- if ( rLi.Top() == rLk.Top() &&
- ((nLi < rLk.Left() && nLi+21 > rLk.Left()) ||
- (nLk < rLi.Left() && nLk+21 > rLi.Left())))
- {
- aLineRects.erase(aLineRects.begin() + i);
- // don't continue with inner loop any more:
- // the array may shrink!
- --i;
- break;
- }
+ aLineRects.erase(aLineRects.begin() + i);
+ // don't continue with inner loop any more:
+ // the array may shrink!
+ --i;
+ break;
}
- else
+ }
+ else
+ {
+ long nLi = rLi.Bottom();
+ long nLk = rLk.Bottom();
+ if ( rLi.Left() == rLk.Left() &&
+ ((nLi < rLk.Top() && nLi+21 > rLk.Top()) ||
+ (nLk < rLi.Top() && nLk+21 > rLi.Top())))
{
- long nLi = rLi.Bottom();
- long nLk = rLk.Bottom();
- if ( rLi.Left() == rLk.Left() &&
- ((nLi < rLk.Top() && nLi+21 > rLk.Top()) ||
- (nLk < rLi.Top() && nLk+21 > rLi.Top())))
- {
- aLineRects.erase(aLineRects.begin() + i);
- // don't continue with inner loop any more:
- // the array may shrink!
- --i;
- break;
- }
+ aLineRects.erase(aLineRects.begin() + i);
+ // don't continue with inner loop any more:
+ // the array may shrink!
+ --i;
+ break;
}
}
}
}
}
+ }
- if ( pRects && (!pRects->aLineRects.empty()) )
- RemoveSuperfluousSubsidiaryLines( *pRects, properties );
+ if ( pRects && (!pRects->aLineRects.empty()) )
+ RemoveSuperfluousSubsidiaryLines( *pRects, properties );
- if ( !aLineRects.empty() )
- {
- pOut->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
- pOut->SetLineColor();
-
- // Reset draw mode in high contrast mode in order to get fill color
- // set at output device. Recover draw mode after draw of lines.
- // Necessary for the subsidiary lines painted by the fly frames.
- DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
- if( gProp.pSGlobalShell->GetWin() &&
- Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- pOut->SetDrawMode( DrawModeFlags::Default );
- }
+ if ( aLineRects.empty() )
+ return;
- for (SwLineRect& rLRect : aLineRects)
- {
- // Add condition <!rLRect.IsLocked()> to prevent paint of locked subsidiary lines.
- if ( !rLRect.IsPainted() &&
- !rLRect.IsLocked() )
- {
- const Color *pCol = nullptr;
- switch ( rLRect.GetSubColor() )
- {
- case SubColFlags::Page: pCol = &SwViewOption::GetDocBoundariesColor(); break;
- case SubColFlags::Fly: pCol = &SwViewOption::GetObjectBoundariesColor(); break;
- case SubColFlags::Tab: pCol = &SwViewOption::GetTableBoundariesColor(); break;
- case SubColFlags::Sect: pCol = &SwViewOption::GetSectionBoundColor(); break;
- }
+ pOut->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+ pOut->SetLineColor();
- if (pCol && pOut->GetFillColor() != *pCol)
- pOut->SetFillColor( *pCol );
- pOut->DrawRect( rLRect.SVRect() );
+ // Reset draw mode in high contrast mode in order to get fill color
+ // set at output device. Recover draw mode after draw of lines.
+ // Necessary for the subsidiary lines painted by the fly frames.
+ DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
+ if( gProp.pSGlobalShell->GetWin() &&
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ pOut->SetDrawMode( DrawModeFlags::Default );
+ }
- rLRect.SetPainted();
- }
+ for (SwLineRect& rLRect : aLineRects)
+ {
+ // Add condition <!rLRect.IsLocked()> to prevent paint of locked subsidiary lines.
+ if ( !rLRect.IsPainted() &&
+ !rLRect.IsLocked() )
+ {
+ const Color *pCol = nullptr;
+ switch ( rLRect.GetSubColor() )
+ {
+ case SubColFlags::Page: pCol = &SwViewOption::GetDocBoundariesColor(); break;
+ case SubColFlags::Fly: pCol = &SwViewOption::GetObjectBoundariesColor(); break;
+ case SubColFlags::Tab: pCol = &SwViewOption::GetTableBoundariesColor(); break;
+ case SubColFlags::Sect: pCol = &SwViewOption::GetSectionBoundColor(); break;
}
- pOut->SetDrawMode( nOldDrawMode );
+ if (pCol && pOut->GetFillColor() != *pCol)
+ pOut->SetFillColor( *pCol );
+ pOut->DrawRect( rLRect.SVRect() );
- pOut->Pop();
+ rLRect.SetPainted();
}
}
+
+ pOut->SetDrawMode( nOldDrawMode );
+
+ pOut->Pop();
}
// Various functions that are use in this file.
@@ -3543,125 +3543,125 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateDashedIndicator
void SwPageFrame::PaintBreak( ) const
{
- if ( gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
+ if ( !(gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
!gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() &&
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
- !gProp.pSGlobalShell->IsPreview() )
- {
- const SwFrame* pBodyFrame = Lower();
- while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
- pBodyFrame = pBodyFrame->GetNext();
+ !gProp.pSGlobalShell->IsPreview()) )
+ return;
- if ( pBodyFrame )
- {
- const SwLayoutFrame* pLayBody = static_cast< const SwLayoutFrame* >( pBodyFrame );
- const SwFlowFrame *pFlowFrame = pLayBody->ContainsContent();
+ const SwFrame* pBodyFrame = Lower();
+ while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
+ pBodyFrame = pBodyFrame->GetNext();
+
+ if ( pBodyFrame )
+ {
+ const SwLayoutFrame* pLayBody = static_cast< const SwLayoutFrame* >( pBodyFrame );
+ const SwFlowFrame *pFlowFrame = pLayBody->ContainsContent();
- // Test if the first node is a table
- const SwFrame* pFirstFrame = pLayBody->Lower();
- if ( pFirstFrame && pFirstFrame->IsTabFrame() )
- pFlowFrame = static_cast< const SwTabFrame* >( pFirstFrame );
+ // Test if the first node is a table
+ const SwFrame* pFirstFrame = pLayBody->Lower();
+ if ( pFirstFrame && pFirstFrame->IsTabFrame() )
+ pFlowFrame = static_cast< const SwTabFrame* >( pFirstFrame );
- SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( gProp.pSGlobalShell );
- if ( pWrtSh )
- {
- SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
- SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
+ SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( gProp.pSGlobalShell );
+ if ( pWrtSh )
+ {
+ SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
+ SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
- if ( pFlowFrame && pFlowFrame->IsPageBreak( true ) )
- rMngr.SetPageBreakControl( this );
- else
- rMngr.RemoveControlsByType( FrameControlType::PageBreak, this );
- }
+ if ( pFlowFrame && pFlowFrame->IsPageBreak( true ) )
+ rMngr.SetPageBreakControl( this );
+ else
+ rMngr.RemoveControlsByType( FrameControlType::PageBreak, this );
}
- SwLayoutFrame::PaintBreak( );
}
+ SwLayoutFrame::PaintBreak( );
}
void SwColumnFrame::PaintBreak( ) const
{
- if ( gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
+ if ( !(gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
!gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() &&
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
- !gProp.pSGlobalShell->IsPreview() )
- {
- const SwFrame* pBodyFrame = Lower();
- while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
- pBodyFrame = pBodyFrame->GetNext();
+ !gProp.pSGlobalShell->IsPreview()) )
+ return;
- if ( pBodyFrame )
- {
- const SwContentFrame *pCnt = static_cast< const SwLayoutFrame* >( pBodyFrame )->ContainsContent();
- if ( pCnt && pCnt->IsColBreak( true ) )
- {
- // Paint the break only if:
- // * Not in header footer edition, to avoid conflicts with the
- // header/footer marker
- // * Non-printing characters are shown, as this is more consistent
- // with other formatting marks
- if ( !gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Header ) &&
- !gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Footer ) &&
- gProp.pSGlobalShell->GetViewOptions()->IsLineBreak() )
- {
- SwRect aRect( pCnt->getFramePrintArea() );
- aRect.Pos() += pCnt->getFrameArea().Pos();
-
- // Draw the line
- basegfx::B2DPoint aStart( double( aRect.Left() ), aRect.Top() );
- basegfx::B2DPoint aEnd( double( aRect.Right() ), aRect.Top() );
- double nWidth = aRect.Width();
- if ( IsVertical( ) )
- {
- aStart = basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Top() ) );
- aEnd = basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Bottom() ) );
- nWidth = aRect.Height();
- }
+ const SwFrame* pBodyFrame = Lower();
+ while ( pBodyFrame && !pBodyFrame->IsBodyFrame() )
+ pBodyFrame = pBodyFrame->GetNext();
- basegfx::BColor aLineColor = SwViewOption::GetPageBreakColor().getBColor();
+ if ( !pBodyFrame )
+ return;
- drawinglayer::primitive2d::Primitive2DContainer aSeq =
- lcl_CreateDashedIndicatorPrimitive( aStart, aEnd, aLineColor );
+ const SwContentFrame *pCnt = static_cast< const SwLayoutFrame* >( pBodyFrame )->ContainsContent();
+ if ( !(pCnt && pCnt->IsColBreak( true )) )
+ return;
- // Add the text above
- OUString aBreakText = SwResId(STR_COLUMN_BREAK);
+ // Paint the break only if:
+ // * Not in header footer edition, to avoid conflicts with the
+ // header/footer marker
+ // * Non-printing characters are shown, as this is more consistent
+ // with other formatting marks
+ if ( !(!gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Header ) &&
+ !gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Footer ) &&
+ gProp.pSGlobalShell->GetViewOptions()->IsLineBreak()) )
+ return;
- basegfx::B2DVector aFontSize;
- OutputDevice* pOut = gProp.pSGlobalShell->GetOut();
- vcl::Font aFont = pOut->GetSettings().GetStyleSettings().GetToolFont();
- aFont.SetFontHeight( 8 * 20 );
- pOut->SetFont( aFont );
- drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(
- aFontSize, aFont, IsRightToLeft(), false );
+ SwRect aRect( pCnt->getFramePrintArea() );
+ aRect.Pos() += pCnt->getFrameArea().Pos();
- tools::Rectangle aTextRect;
- pOut->GetTextBoundRect( aTextRect, aBreakText );
- long nTextOff = ( nWidth - aTextRect.GetWidth() ) / 2;
+ // Draw the line
+ basegfx::B2DPoint aStart( double( aRect.Left() ), aRect.Top() );
+ basegfx::B2DPoint aEnd( double( aRect.Right() ), aRect.Top() );
+ double nWidth = aRect.Width();
+ if ( IsVertical( ) )
+ {
+ aStart = basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Top() ) );
+ aEnd = basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Bottom() ) );
+ nWidth = aRect.Height();
+ }
- basegfx::B2DHomMatrix aTextMatrix( basegfx::utils::createScaleTranslateB2DHomMatrix(
- aFontSize.getX(), aFontSize.getY(),
- aRect.Left() + nTextOff, aRect.Top() ) );
- if ( IsVertical() )
- {
- aTextMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix (
- aFontSize.getX(), aFontSize.getY(), 0.0, M_PI_2,
- aRect.Right(), aRect.Top() + nTextOff );
- }
+ basegfx::BColor aLineColor = SwViewOption::GetPageBreakColor().getBColor();
- drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
- new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
- aTextMatrix,
- aBreakText, 0, aBreakText.getLength(),
- std::vector< double >(),
- aFontAttr,
- lang::Locale(),
- aLineColor );
- aSeq.push_back( drawinglayer::primitive2d::Primitive2DReference( pText ) );
-
- ProcessPrimitives( aSeq );
- }
- }
- }
+ drawinglayer::primitive2d::Primitive2DContainer aSeq =
+ lcl_CreateDashedIndicatorPrimitive( aStart, aEnd, aLineColor );
+
+ // Add the text above
+ OUString aBreakText = SwResId(STR_COLUMN_BREAK);
+
+ basegfx::B2DVector aFontSize;
+ OutputDevice* pOut = gProp.pSGlobalShell->GetOut();
+ vcl::Font aFont = pOut->GetSettings().GetStyleSettings().GetToolFont();
+ aFont.SetFontHeight( 8 * 20 );
+ pOut->SetFont( aFont );
+ drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aFontSize, aFont, IsRightToLeft(), false );
+
+ tools::Rectangle aTextRect;
+ pOut->GetTextBoundRect( aTextRect, aBreakText );
+ long nTextOff = ( nWidth - aTextRect.GetWidth() ) / 2;
+
+ basegfx::B2DHomMatrix aTextMatrix( basegfx::utils::createScaleTranslateB2DHomMatrix(
+ aFontSize.getX(), aFontSize.getY(),
+ aRect.Left() + nTextOff, aRect.Top() ) );
+ if ( IsVertical() )
+ {
+ aTextMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix (
+ aFontSize.getX(), aFontSize.getY(), 0.0, M_PI_2,
+ aRect.Right(), aRect.Top() + nTextOff );
}
+
+ drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
+ new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aTextMatrix,
+ aBreakText, 0, aBreakText.getLength(),
+ std::vector< double >(),
+ aFontAttr,
+ lang::Locale(),
+ aLineColor );
+ aSeq.push_back( drawinglayer::primitive2d::Primitive2DReference( pText ) );
+
+ ProcessPrimitives( aSeq );
}
void SwLayoutFrame::PaintBreak( ) const
@@ -3678,59 +3678,59 @@ void SwLayoutFrame::PaintBreak( ) const
void SwPageFrame::PaintDecorators( ) const
{
SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( gProp.pSGlobalShell );
- if ( pWrtSh )
- {
- SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
+ if ( !pWrtSh )
+ return;
- const SwLayoutFrame* pBody = FindBodyCont();
- if ( pBody )
- {
- SwRect aBodyRect( pBody->getFrameArea() );
+ SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
- if ( gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
- !gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() &&
- !gProp.pSGlobalShell->IsPreview() &&
- !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
- !gProp.pSGlobalShell->GetViewOptions()->getBrowseMode() &&
- ( gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Header ) ||
- gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Footer ) ) )
- {
- bool bRtl = AllSettings::GetLayoutRTL();
- const SwRect& rVisArea = gProp.pSGlobalShell->VisArea();
- long nXOff = std::min( aBodyRect.Right(), rVisArea.Right() );
- if ( bRtl )
- nXOff = std::max( aBodyRect.Left(), rVisArea.Left() );
-
- // Header
- if ( gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Header ) )
- {
- const SwFrame* pHeaderFrame = Lower();
- if ( !pHeaderFrame->IsHeaderFrame() )
- pHeaderFrame = nullptr;
+ const SwLayoutFrame* pBody = FindBodyCont();
+ if ( !pBody )
+ return;
- long nHeaderYOff = aBodyRect.Top();
- Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff ) );
- rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, FrameControlType::Header, nOutputOff );
- }
+ SwRect aBodyRect( pBody->getFrameArea() );
- // Footer
- if ( gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Footer ) )
- {
- const SwFrame* pFootnoteContFrame = Lower();
- while ( pFootnoteContFrame )
- {
- if ( pFootnoteContFrame->IsFootnoteContFrame() )
- aBodyRect.AddBottom( pFootnoteContFrame->getFrameArea().Bottom() - aBodyRect.Bottom() );
- pFootnoteContFrame = pFootnoteContFrame->GetNext();
- }
+ if ( !(gProp.pSGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
+ !gProp.pSGlobalShell->GetViewOptions()->IsPDFExport() &&
+ !gProp.pSGlobalShell->IsPreview() &&
+ !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
+ !gProp.pSGlobalShell->GetViewOptions()->getBrowseMode() &&
+ ( gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Header ) ||
+ gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Footer ) )) )
+ return;
- long nFooterYOff = aBodyRect.Bottom();
- Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nFooterYOff ) );
- rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, FrameControlType::Footer, nOutputOff );
- }
- }
- }
+ bool bRtl = AllSettings::GetLayoutRTL();
+ const SwRect& rVisArea = gProp.pSGlobalShell->VisArea();
+ long nXOff = std::min( aBodyRect.Right(), rVisArea.Right() );
+ if ( bRtl )
+ nXOff = std::max( aBodyRect.Left(), rVisArea.Left() );
+
+ // Header
+ if ( gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Header ) )
+ {
+ const SwFrame* pHeaderFrame = Lower();
+ if ( !pHeaderFrame->IsHeaderFrame() )
+ pHeaderFrame = nullptr;
+
+ long nHeaderYOff = aBodyRect.Top();
+ Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff ) );
+ rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, FrameControlType::Header, nOutputOff );
+ }
+
+ // Footer
+ if ( !gProp.pSGlobalShell->IsShowHeaderFooterSeparator( FrameControlType::Footer ) )
+ return;
+
+ const SwFrame* pFootnoteContFrame = Lower();
+ while ( pFootnoteContFrame )
+ {
+ if ( pFootnoteContFrame->IsFootnoteContFrame() )
+ aBodyRect.AddBottom( pFootnoteContFrame->getFrameArea().Bottom() - aBodyRect.Bottom() );
+ pFootnoteContFrame = pFootnoteContFrame->GetNext();
}
+
+ long nFooterYOff = aBodyRect.Bottom();
+ Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nFooterYOff ) );
+ rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, FrameControlType::Footer, nOutputOff );
}
/**
@@ -5349,292 +5349,292 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co
if( !m_bHasGrid || gProp.pSRetoucheFly || gProp.pSRetoucheFly2 )
return;
SwTextGridItem const*const pGrid(GetGridItem(this));
- if( pGrid && ( OUTDEV_PRINTER != pOut->GetOutDevType() ?
- pGrid->GetDisplayGrid() : pGrid->GetPrintGrid() ) )
+ if( !(pGrid && ( OUTDEV_PRINTER != pOut->GetOutDevType() ?
+ pGrid->GetDisplayGrid() : pGrid->GetPrintGrid() )) )
+ return;
+
+ const SwLayoutFrame* pBody = FindBodyCont();
+ if( !pBody )
+ return;
+
+ SwRect aGrid( pBody->getFramePrintArea() );
+ aGrid += pBody->getFrameArea().Pos();
+
+ SwRect aInter( aGrid );
+ aInter.Intersection( rRect );
+ if( !aInter.HasArea() )
+ return;
+
+ bool bGrid = pGrid->GetRubyTextBelow();
+ bool bCell = GRID_LINES_CHARS == pGrid->GetGridType();
+ long nGrid = pGrid->GetBaseHeight();
+ const SwDoc* pDoc = GetFormat()->GetDoc();
+ long nGridWidth = GetGridWidth(*pGrid, *pDoc);
+ long nRuby = pGrid->GetRubyHeight();
+ long nSum = nGrid + nRuby;
+ const Color *pCol = &pGrid->GetColor();
+
+ SwTwips nRight = aInter.Left() + aInter.Width();
+ SwTwips nBottom = aInter.Top() + aInter.Height();
+ if( IsVertical() )
{
- const SwLayoutFrame* pBody = FindBodyCont();
- if( pBody )
+ SwTwips nOrig = aGrid.Left() + aGrid.Width();
+ SwTwips nY = nOrig + nSum *
+ ( ( nOrig - aInter.Left() ) / nSum );
+ SwRect aTmp( Point( nY, aInter.Top() ),
+ Size( 1, aInter.Height() ) );
+ SwTwips nX = aGrid.Top() + nGrid *
+ ( ( aInter.Top() - aGrid.Top() )/ nGrid );
+ if( nX < aInter.Top() )
+ nX += nGrid;
+ SwTwips nGridBottom = aGrid.Top() + aGrid.Height();
+ bool bLeft = aGrid.Top() >= aInter.Top();
+ bool bRight = nGridBottom <= nBottom;
+ bool bBorder = bLeft || bRight;
+ while( nY > nRight )
+ {
+ aTmp.Pos().setX( nY );
+ if( bGrid )
+ {
+ nY -= nGrid;
+ SwTwips nPosY = std::max( aInter.Left(), nY );
+ SwTwips nHeight = std::min(nRight, aTmp.Pos().X())-nPosY;
+ if( nHeight > 0 )
+ {
+ if( bCell )
+ {
+ SwRect aVert( Point( nPosY, nX ),
+ Size( nHeight, 1 ) );
+ while( aVert.Top() <= nBottom )
+ {
+ PaintBorderLine(rRect,aVert,this,pCol);
+ aVert.Pos().AdjustY(nGrid );
+ }
+ }
+ else if( bBorder )
+ {
+ SwRect aVert( Point( nPosY, aGrid.Top() ),
+ Size( nHeight, 1 ) );
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
+ {
+ aVert.Pos().setY( nGridBottom );
+ PaintBorderLine(rRect,aVert,this,pCol);
+ }
+ }
+ }
+ }
+ else
+ {
+ nY -= nRuby;
+ if( bBorder )
+ {
+ SwTwips nPos = std::max( aInter.Left(), nY );
+ SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos;
+ SwRect aVert( Point( nPos, aGrid.Top() ),
+ Size( nW, 1 ) );
+ if( nW > 0 )
+ {
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
+ {
+ aVert.Pos().setY( nGridBottom );
+ PaintBorderLine(rRect,aVert,this,pCol);
+ }
+ }
+ }
+ }
+ bGrid = !bGrid;
+ }
+ while( nY >= aInter.Left() )
{
- SwRect aGrid( pBody->getFramePrintArea() );
- aGrid += pBody->getFrameArea().Pos();
-
- SwRect aInter( aGrid );
- aInter.Intersection( rRect );
- if( aInter.HasArea() )
+ aTmp.Pos().setX( nY );
+ PaintBorderLine( rRect, aTmp, this, pCol);
+ if( bGrid )
{
- bool bGrid = pGrid->GetRubyTextBelow();
- bool bCell = GRID_LINES_CHARS == pGrid->GetGridType();
- long nGrid = pGrid->GetBaseHeight();
- const SwDoc* pDoc = GetFormat()->GetDoc();
- long nGridWidth = GetGridWidth(*pGrid, *pDoc);
- long nRuby = pGrid->GetRubyHeight();
- long nSum = nGrid + nRuby;
- const Color *pCol = &pGrid->GetColor();
-
- SwTwips nRight = aInter.Left() + aInter.Width();
- SwTwips nBottom = aInter.Top() + aInter.Height();
- if( IsVertical() )
+ nY -= nGrid;
+ SwTwips nHeight = aTmp.Pos().X()
+ - std::max(aInter.Left(), nY );
+ if( nHeight > 0 )
{
- SwTwips nOrig = aGrid.Left() + aGrid.Width();
- SwTwips nY = nOrig + nSum *
- ( ( nOrig - aInter.Left() ) / nSum );
- SwRect aTmp( Point( nY, aInter.Top() ),
- Size( 1, aInter.Height() ) );
- SwTwips nX = aGrid.Top() + nGrid *
- ( ( aInter.Top() - aGrid.Top() )/ nGrid );
- if( nX < aInter.Top() )
- nX += nGrid;
- SwTwips nGridBottom = aGrid.Top() + aGrid.Height();
- bool bLeft = aGrid.Top() >= aInter.Top();
- bool bRight = nGridBottom <= nBottom;
- bool bBorder = bLeft || bRight;
- while( nY > nRight )
+ if( bCell )
{
- aTmp.Pos().setX( nY );
- if( bGrid )
+ SwRect aVert( Point(aTmp.Pos().X()-nHeight,
+ nX ), Size( nHeight, 1 ) );
+ while( aVert.Top() <= nBottom )
{
- nY -= nGrid;
- SwTwips nPosY = std::max( aInter.Left(), nY );
- SwTwips nHeight = std::min(nRight, aTmp.Pos().X())-nPosY;
- if( nHeight > 0 )
- {
- if( bCell )
- {
- SwRect aVert( Point( nPosY, nX ),
- Size( nHeight, 1 ) );
- while( aVert.Top() <= nBottom )
- {
- PaintBorderLine(rRect,aVert,this,pCol);
- aVert.Pos().AdjustY(nGrid );
- }
- }
- else if( bBorder )
- {
- SwRect aVert( Point( nPosY, aGrid.Top() ),
- Size( nHeight, 1 ) );
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setY( nGridBottom );
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ PaintBorderLine(rRect,aVert,this,pCol);
+ aVert.Pos().AdjustY(nGrid );
}
- else
+ }
+ else if( bBorder )
+ {
+ SwRect aVert( Point(aTmp.Pos().X()-nHeight,
+ aGrid.Top() ), Size( nHeight, 1 ) );
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
{
- nY -= nRuby;
- if( bBorder )
- {
- SwTwips nPos = std::max( aInter.Left(), nY );
- SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos;
- SwRect aVert( Point( nPos, aGrid.Top() ),
- Size( nW, 1 ) );
- if( nW > 0 )
- {
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setY( nGridBottom );
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ aVert.Pos().setY( nGridBottom );
+ PaintBorderLine(rRect,aVert,this,pCol);
}
- bGrid = !bGrid;
}
- while( nY >= aInter.Left() )
+ }
+ }
+ else
+ {
+ nY -= nRuby;
+ if( bBorder )
+ {
+ SwTwips nPos = std::max( aInter.Left(), nY );
+ SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos;
+ SwRect aVert( Point( nPos, aGrid.Top() ),
+ Size( nW, 1 ) );
+ if( nW > 0 )
{
- aTmp.Pos().setX( nY );
- PaintBorderLine( rRect, aTmp, this, pCol);
- if( bGrid )
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
{
- nY -= nGrid;
- SwTwips nHeight = aTmp.Pos().X()
- - std::max(aInter.Left(), nY );
- if( nHeight > 0 )
- {
- if( bCell )
- {
- SwRect aVert( Point(aTmp.Pos().X()-nHeight,
- nX ), Size( nHeight, 1 ) );
- while( aVert.Top() <= nBottom )
- {
- PaintBorderLine(rRect,aVert,this,pCol);
- aVert.Pos().AdjustY(nGrid );
- }
- }
- else if( bBorder )
- {
- SwRect aVert( Point(aTmp.Pos().X()-nHeight,
- aGrid.Top() ), Size( nHeight, 1 ) );
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setY( nGridBottom );
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ aVert.Pos().setY( nGridBottom );
+ PaintBorderLine(rRect,aVert,this,pCol);
}
- else
+ }
+ }
+ }
+ bGrid = !bGrid;
+ }
+ }
+ else
+ {
+ SwTwips nOrig = aGrid.Top();
+ SwTwips nY = nOrig + nSum *( (aInter.Top()-nOrig)/nSum );
+ SwRect aTmp( Point( aInter.Left(), nY ),
+ Size( aInter.Width(), 1 ) );
+ //for textgrid refactor
+ SwTwips nX = aGrid.Left() + nGridWidth *
+ ( ( aInter.Left() - aGrid.Left() )/ nGridWidth );
+ if( nX < aInter.Left() )
+ nX += nGridWidth;
+ SwTwips nGridRight = aGrid.Left() + aGrid.Width();
+ bool bLeft = aGrid.Left() >= aInter.Left();
+ bool bRight = nGridRight <= nRight;
+ bool bBorder = bLeft || bRight;
+ while( nY < aInter.Top() )
+ {
+ aTmp.Pos().setY(nY);
+ if( bGrid )
+ {
+ nY += nGrid;
+ SwTwips nPosY = std::max( aInter.Top(), aTmp.Pos().getY() );
+ SwTwips nHeight = std::min(nBottom, nY ) - nPosY;
+ if( nHeight )
+ {
+ if( bCell )
+ {
+ SwRect aVert( Point( nX, nPosY ),
+ Size( 1, nHeight ) );
+ while( aVert.Left() <= nRight )
{
- nY -= nRuby;
- if( bBorder )
- {
- SwTwips nPos = std::max( aInter.Left(), nY );
- SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos;
- SwRect aVert( Point( nPos, aGrid.Top() ),
- Size( nW, 1 ) );
- if( nW > 0 )
- {
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setY( nGridBottom );
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ PaintBorderLine(rRect,aVert,this,pCol);
+ aVert.Pos().AdjustX(nGridWidth ); //for textgrid refactor
+ }
+ }
+ else if ( bBorder )
+ {
+ SwRect aVert( Point( aGrid.Left(), nPosY ),
+ Size( 1, nHeight ) );
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
+ {
+ aVert.Pos().setX( nGridRight );
+ PaintBorderLine(rRect,aVert,this,pCol);
}
- bGrid = !bGrid;
}
}
- else
+ }
+ else
+ {
+ nY += nRuby;
+ if( bBorder )
{
- SwTwips nOrig = aGrid.Top();
- SwTwips nY = nOrig + nSum *( (aInter.Top()-nOrig)/nSum );
- SwRect aTmp( Point( aInter.Left(), nY ),
- Size( aInter.Width(), 1 ) );
- //for textgrid refactor
- SwTwips nX = aGrid.Left() + nGridWidth *
- ( ( aInter.Left() - aGrid.Left() )/ nGridWidth );
- if( nX < aInter.Left() )
- nX += nGridWidth;
- SwTwips nGridRight = aGrid.Left() + aGrid.Width();
- bool bLeft = aGrid.Left() >= aInter.Left();
- bool bRight = nGridRight <= nRight;
- bool bBorder = bLeft || bRight;
- while( nY < aInter.Top() )
+ SwTwips nPos = std::max(aInter.Top(),aTmp.Pos().getY());
+ SwTwips nH = std::min( nBottom, nY ) - nPos;
+ SwRect aVert( Point( aGrid.Left(), nPos ),
+ Size( 1, nH ) );
+ if( nH > 0 )
{
- aTmp.Pos().setY(nY);
- if( bGrid )
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
{
- nY += nGrid;
- SwTwips nPosY = std::max( aInter.Top(), aTmp.Pos().getY() );
- SwTwips nHeight = std::min(nBottom, nY ) - nPosY;
- if( nHeight )
- {
- if( bCell )
- {
- SwRect aVert( Point( nX, nPosY ),
- Size( 1, nHeight ) );
- while( aVert.Left() <= nRight )
- {
- PaintBorderLine(rRect,aVert,this,pCol);
- aVert.Pos().AdjustX(nGridWidth ); //for textgrid refactor
- }
- }
- else if ( bBorder )
- {
- SwRect aVert( Point( aGrid.Left(), nPosY ),
- Size( 1, nHeight ) );
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setX( nGridRight );
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ aVert.Pos().setX(nGridRight);
+ PaintBorderLine(rRect,aVert,this,pCol);
}
- else
+ }
+ }
+ }
+ bGrid = !bGrid;
+ }
+ while( nY <= nBottom )
+ {
+ aTmp.Pos().setY(nY);
+ PaintBorderLine( rRect, aTmp, this, pCol);
+ if( bGrid )
+ {
+ nY += nGrid;
+ SwTwips nHeight = std::min(nBottom, nY) - aTmp.Pos().getY();
+ if( nHeight )
+ {
+ if( bCell )
+ {
+ SwRect aVert( Point( nX, aTmp.Pos().getY() ),
+ Size( 1, nHeight ) );
+ while( aVert.Left() <= nRight )
{
- nY += nRuby;
- if( bBorder )
- {
- SwTwips nPos = std::max(aInter.Top(),aTmp.Pos().getY());
- SwTwips nH = std::min( nBottom, nY ) - nPos;
- SwRect aVert( Point( aGrid.Left(), nPos ),
- Size( 1, nH ) );
- if( nH > 0 )
- {
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setX(nGridRight);
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ PaintBorderLine( rRect, aVert, this, pCol);
+ aVert.Pos().setX(aVert.Pos().getX() + nGridWidth); //for textgrid refactor
}
- bGrid = !bGrid;
}
- while( nY <= nBottom )
+ else if( bBorder )
{
- aTmp.Pos().setY(nY);
- PaintBorderLine( rRect, aTmp, this, pCol);
- if( bGrid )
+ SwRect aVert( Point( aGrid.Left(),
+ aTmp.Pos().getY() ), Size( 1, nHeight ) );
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
{
- nY += nGrid;
- SwTwips nHeight = std::min(nBottom, nY) - aTmp.Pos().getY();
- if( nHeight )
- {
- if( bCell )
- {
- SwRect aVert( Point( nX, aTmp.Pos().getY() ),
- Size( 1, nHeight ) );
- while( aVert.Left() <= nRight )
- {
- PaintBorderLine( rRect, aVert, this, pCol);
- aVert.Pos().setX(aVert.Pos().getX() + nGridWidth); //for textgrid refactor
- }
- }
- else if( bBorder )
- {
- SwRect aVert( Point( aGrid.Left(),
- aTmp.Pos().getY() ), Size( 1, nHeight ) );
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setX(nGridRight);
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ aVert.Pos().setX(nGridRight);
+ PaintBorderLine(rRect,aVert,this,pCol);
}
- else
+ }
+ }
+ }
+ else
+ {
+ nY += nRuby;
+ if( bBorder )
+ {
+ SwTwips nPos = std::max(aInter.Top(),aTmp.Pos().Y());
+ SwTwips nH = std::min( nBottom, nY ) - nPos;
+ SwRect aVert( Point( aGrid.Left(), nPos ),
+ Size( 1, nH ) );
+ if( nH > 0 )
+ {
+ if( bLeft )
+ PaintBorderLine(rRect,aVert,this,pCol);
+ if( bRight )
{
- nY += nRuby;
- if( bBorder )
- {
- SwTwips nPos = std::max(aInter.Top(),aTmp.Pos().Y());
- SwTwips nH = std::min( nBottom, nY ) - nPos;
- SwRect aVert( Point( aGrid.Left(), nPos ),
- Size( 1, nH ) );
- if( nH > 0 )
- {
- if( bLeft )
- PaintBorderLine(rRect,aVert,this,pCol);
- if( bRight )
- {
- aVert.Pos().setX(nGridRight);
- PaintBorderLine(rRect,aVert,this,pCol);
- }
- }
- }
+ aVert.Pos().setX(nGridRight);
+ PaintBorderLine(rRect,aVert,this,pCol);
}
- bGrid = !bGrid;
}
}
}
+ bGrid = !bGrid;
}
}
}
@@ -5657,23 +5657,23 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co
void SwPageFrame::PaintMarginArea( const SwRect& _rOutputRect,
SwViewShell const * _pViewShell ) const
{
- if ( _pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode() )
- {
- // Simplified paint with DrawingLayer FillStyle
- SwRect aPgRect = getFrameArea();
- aPgRect.Intersection_( _rOutputRect );
+ if ( !(_pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode()) )
+ return;
- if(!aPgRect.IsEmpty())
- {
- OutputDevice *pOut = _pViewShell->GetOut();
+ // Simplified paint with DrawingLayer FillStyle
+ SwRect aPgRect = getFrameArea();
+ aPgRect.Intersection_( _rOutputRect );
- if(pOut->GetFillColor() != aGlobalRetoucheColor)
- {
- pOut->SetFillColor(aGlobalRetoucheColor);
- }
+ if(!aPgRect.IsEmpty())
+ {
+ OutputDevice *pOut = _pViewShell->GetOut();
- pOut->DrawRect(aPgRect.SVRect());
+ if(pOut->GetFillColor() != aGlobalRetoucheColor)
+ {
+ pOut->SetFillColor(aGlobalRetoucheColor);
}
+
+ pOut->DrawRect(aPgRect.SVRect());
}
}
@@ -5965,90 +5965,90 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
SwAlignRect( aPageRect, _pViewShell, _pViewShell->GetOut() );
const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
- if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) // do not show anything in print preview
+ if (!(pMgr && pMgr->ShowNotes() && pMgr->HasNotes())) // do not show anything in print preview
+ return;
+
+ sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
+ const tools::Rectangle &aVisRect = _pViewShell->VisArea().SVRect();
+ //draw border and sidepane
+ _pViewShell->GetOut()->SetLineColor();
+ if (!bRight)
{
- sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
- const tools::Rectangle &aVisRect = _pViewShell->VisArea().SVRect();
- //draw border and sidepane
- _pViewShell->GetOut()->SetLineColor();
- if (!bRight)
+ _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
+ _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()))) ;
+ if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ _pViewShell->GetOut()->SetFillColor(COL_BLACK);
+ else
+ _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
+ _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarWidth()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()))) ;
+ }
+ else
+ {
+ _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
+ SwRect aSidebarBorder(aPageRect.TopRight(),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()));
+ _pViewShell->GetOut()->DrawRect(aSidebarBorder.SVRect());
+ if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ _pViewShell->GetOut()->SetFillColor(COL_BLACK);
+ else
+ _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
+ SwRect aSidebar(Point(aPageRect.Right()+pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()));
+ _pViewShell->GetOut()->DrawRect(aSidebar.SVRect());
+ }
+ if (!pMgr->ShowScrollbar(nPageNum))
+ return;
+
+ // draw scrollbar area and arrows
+ Point aPointBottom;
+ Point aPointTop;
+ aPointBottom = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() - pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height()) :
+ Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height());
+ aPointTop = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height()) :
+ Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height());
+ Size aSize(pMgr->GetSidebarWidth() - _pViewShell->GetOut()->PixelToLogic(Size(4,0)).Width(), _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()) ;
+ tools::Rectangle aRectBottom(aPointBottom,aSize);
+ tools::Rectangle aRectTop(aPointTop,aSize);
+
+ if (aRectBottom.IsOver(aVisRect))
+ {
+
+ if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
{
- _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
- _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()))) ;
- if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- _pViewShell->GetOut()->SetFillColor(COL_BLACK);
- else
- _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
- _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarWidth()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()))) ;
+ _pViewShell->GetOut()->SetLineColor(COL_WHITE);
+ _pViewShell->GetOut()->SetFillColor(COL_BLACK);
}
else
{
- _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
- SwRect aSidebarBorder(aPageRect.TopRight(),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()));
- _pViewShell->GetOut()->DrawRect(aSidebarBorder.SVRect());
- if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- _pViewShell->GetOut()->SetFillColor(COL_BLACK);
- else
- _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
- SwRect aSidebar(Point(aPageRect.Right()+pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()));
- _pViewShell->GetOut()->DrawRect(aSidebar.SVRect());
- }
- if (pMgr->ShowScrollbar(nPageNum))
- {
- // draw scrollbar area and arrows
- Point aPointBottom;
- Point aPointTop;
- aPointBottom = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() - pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height()) :
- Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height());
- aPointTop = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height()) :
- Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height());
- Size aSize(pMgr->GetSidebarWidth() - _pViewShell->GetOut()->PixelToLogic(Size(4,0)).Width(), _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()) ;
- tools::Rectangle aRectBottom(aPointBottom,aSize);
- tools::Rectangle aRectTop(aPointTop,aSize);
-
- if (aRectBottom.IsOver(aVisRect))
- {
-
- if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- _pViewShell->GetOut()->SetLineColor(COL_WHITE);
- _pViewShell->GetOut()->SetFillColor(COL_BLACK);
- }
- else
- {
- _pViewShell->GetOut()->SetLineColor(COL_BLACK);
- _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
- }
- _pViewShell->GetOut()->DrawRect(aRectBottom);
- _pViewShell->GetOut()->DrawLine(aPointBottom + Point(pMgr->GetSidebarWidth()/3,0), aPointBottom + Point(pMgr->GetSidebarWidth()/3 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
+ _pViewShell->GetOut()->SetLineColor(COL_BLACK);
+ _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
+ }
+ _pViewShell->GetOut()->DrawRect(aRectBottom);
+ _pViewShell->GetOut()->DrawLine(aPointBottom + Point(pMgr->GetSidebarWidth()/3,0), aPointBottom + Point(pMgr->GetSidebarWidth()/3 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
- _pViewShell->GetOut()->SetLineColor();
- Point aMiddleFirst(aPointBottom + Point(pMgr->GetSidebarWidth()/6,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
- Point aMiddleSecond(aPointBottom + Point(pMgr->GetSidebarWidth()/3*2,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
- PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell,pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
- }
- if (aRectTop.IsOver(aVisRect))
- {
- if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- _pViewShell->GetOut()->SetLineColor(COL_WHITE);
- _pViewShell->GetOut()->SetFillColor(COL_BLACK);
- }
- else
- {
- _pViewShell->GetOut()->SetLineColor(COL_BLACK);
- _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
- }
- _pViewShell->GetOut()->DrawRect(aRectTop);
- _pViewShell->GetOut()->DrawLine(aPointTop + Point(pMgr->GetSidebarWidth()/3*2,0), aPointTop + Point(pMgr->GetSidebarWidth()/3*2 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
+ _pViewShell->GetOut()->SetLineColor();
+ Point aMiddleFirst(aPointBottom + Point(pMgr->GetSidebarWidth()/6,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
+ Point aMiddleSecond(aPointBottom + Point(pMgr->GetSidebarWidth()/3*2,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
+ PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell,pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
+ }
+ if (!aRectTop.IsOver(aVisRect))
+ return;
- _pViewShell->GetOut()->SetLineColor();
- Point aMiddleFirst(aPointTop + Point(pMgr->GetSidebarWidth()/3,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
- Point aMiddleSecond(aPointTop + Point(pMgr->GetSidebarWidth()/6*5,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
- PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell, pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
- }
- }
+ if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ _pViewShell->GetOut()->SetLineColor(COL_WHITE);
+ _pViewShell->GetOut()->SetFillColor(COL_BLACK);
+ }
+ else
+ {
+ _pViewShell->GetOut()->SetLineColor(COL_BLACK);
+ _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
}
+ _pViewShell->GetOut()->DrawRect(aRectTop);
+ _pViewShell->GetOut()->DrawLine(aPointTop + Point(pMgr->GetSidebarWidth()/3*2,0), aPointTop + Point(pMgr->GetSidebarWidth()/3*2 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
+
+ _pViewShell->GetOut()->SetLineColor();
+ Point aMiddleFirst(aPointTop + Point(pMgr->GetSidebarWidth()/3,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
+ Point aMiddleSecond(aPointTop + Point(pMgr->GetSidebarWidth()/6*5,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
+ PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell, pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
}
/*static*/ void SwPageFrame::PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, SwViewShell const * _pViewShell, const Color& rColorUp, const Color& rColorDown)
@@ -6382,70 +6382,70 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
//We end this as soon as a Frame leaves the chain and therefore is not a lower
//of me anymore
const SwFrame *pFrame = GetLower();
- if ( pFrame )
- {
- SwRect aFrameRect;
- SwRect aRect( GetPaintArea() );
- aRect.Intersection_( rRect );
- SwRect aBorderRect( aRect );
- SwShortCut aShortCut( *pFrame, aBorderRect );
- do
- { if ( gProp.pSProgress )
- SfxProgress::Reschedule();
-
- aFrameRect = pFrame->GetPaintArea();
- if ( aFrameRect.IsOver( aBorderRect ) )
+ if ( !pFrame )
+ return;
+
+ SwRect aFrameRect;
+ SwRect aRect( GetPaintArea() );
+ aRect.Intersection_( rRect );
+ SwRect aBorderRect( aRect );
+ SwShortCut aShortCut( *pFrame, aBorderRect );
+ do
+ { if ( gProp.pSProgress )
+ SfxProgress::Reschedule();
+
+ aFrameRect = pFrame->GetPaintArea();
+ if ( aFrameRect.IsOver( aBorderRect ) )
+ {
+ SwBorderAttrAccess aAccess( SwFrame::GetCache(), pFrame );
+ const SwBorderAttrs &rTmpAttrs = *aAccess.Get();
+ if ( ( pFrame->IsLayoutFrame() && bLowerBorder ) || aFrameRect.IsOver( aRect ) )
{
- SwBorderAttrAccess aAccess( SwFrame::GetCache(), pFrame );
- const SwBorderAttrs &rTmpAttrs = *aAccess.Get();
- if ( ( pFrame->IsLayoutFrame() && bLowerBorder ) || aFrameRect.IsOver( aRect ) )
- {
- pFrame->PaintSwFrameBackground( aRect, pPage, rTmpAttrs, bLowMode,
- bLowerBorder, bOnlyTextBackground );
- }
+ pFrame->PaintSwFrameBackground( aRect, pPage, rTmpAttrs, bLowMode,
+ bLowerBorder, bOnlyTextBackground );
+ }
- if ( bLowerBorder )
- {
- pFrame->PaintSwFrameShadowAndBorder( aBorderRect, pPage, rTmpAttrs );
- }
+ if ( bLowerBorder )
+ {
+ pFrame->PaintSwFrameShadowAndBorder( aBorderRect, pPage, rTmpAttrs );
}
- pFrame = pFrame->GetNext();
- } while ( pFrame && pFrame->GetUpper() == this &&
- !aShortCut.Stop( aFrameRect ) );
- }
+ }
+ pFrame = pFrame->GetNext();
+ } while ( pFrame && pFrame->GetUpper() == this &&
+ !aShortCut.Stop( aFrameRect ) );
}
/// Refreshes all subsidiary lines of a page.
void SwPageFrame::RefreshSubsidiary( const SwRect &rRect ) const
{
- if ( isSubsidiaryLinesEnabled() || isTableBoundariesEnabled()
- || isSubsidiaryLinesForSectionsEnabled() || isSubsidiaryLinesFlysEnabled() )
+ if ( !(isSubsidiaryLinesEnabled() || isTableBoundariesEnabled()
+ || isSubsidiaryLinesForSectionsEnabled() || isSubsidiaryLinesFlysEnabled()) )
+ return;
+
+ if ( !rRect.HasArea() )
+ return;
+
+ //During paint using the root, the array is controlled from there.
+ //Otherwise we'll handle it for our self.
+ bool bDelSubs = false;
+ if ( !gProp.pSSubsLines )
{
- if ( rRect.HasArea() )
- {
- //During paint using the root, the array is controlled from there.
- //Otherwise we'll handle it for our self.
- bool bDelSubs = false;
- if ( !gProp.pSSubsLines )
- {
- gProp.pSSubsLines.reset(new SwSubsRects);
- // create container for special subsidiary lines
- gProp.pSSpecSubsLines.reset(new SwSubsRects);
- bDelSubs = true;
- }
+ gProp.pSSubsLines.reset(new SwSubsRects);
+ // create container for special subsidiary lines
+ gProp.pSSpecSubsLines.reset(new SwSubsRects);
+ bDelSubs = true;
+ }
- RefreshLaySubsidiary( this, rRect );
+ RefreshLaySubsidiary( this, rRect );
- if ( bDelSubs )
- {
- // paint special subsidiary lines and delete its container
- gProp.pSSpecSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), nullptr, gProp );
- gProp.pSSpecSubsLines.reset();
+ if ( bDelSubs )
+ {
+ // paint special subsidiary lines and delete its container
+ gProp.pSSpecSubsLines->PaintSubsidiary( gProp.pSGlobalShell->GetOut(), nullptr, gProp );
+ gProp.pSSpecSubsLines.reset();
- gProp.pSSubsLines->PaintSubsidiary(gProp.pSGlobalShell->GetOut(), gProp.pSLines.get(), gProp);
- gProp.pSSubsLines.reset();
- }
- }
+ gProp.pSSubsLines->PaintSubsidiary(gProp.pSGlobalShell->GetOut(), gProp.pSLines.get(), gProp);
+ gProp.pSSubsLines.reset();
}
}
@@ -6697,29 +6697,29 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateColumnAreaDelim
void SwPageFrame::PaintSubsidiaryLines( const SwPageFrame *,
const SwRect & ) const
{
- if ( !gProp.pSGlobalShell->IsHeaderFooterEdit() )
+ if ( gProp.pSGlobalShell->IsHeaderFooterEdit() )
+ return;
+
+ const SwFrame* pLay = Lower();
+ const SwFrame* pFootnoteCont = nullptr;
+ const SwFrame* pPageBody = nullptr;
+ while ( pLay && !( pFootnoteCont && pPageBody ) )
{
- const SwFrame* pLay = Lower();
- const SwFrame* pFootnoteCont = nullptr;
- const SwFrame* pPageBody = nullptr;
- while ( pLay && !( pFootnoteCont && pPageBody ) )
- {
- if ( pLay->IsFootnoteContFrame( ) )
- pFootnoteCont = pLay;
- if ( pLay->IsBodyFrame() )
- pPageBody = pLay;
- pLay = pLay->GetNext();
- }
+ if ( pLay->IsFootnoteContFrame( ) )
+ pFootnoteCont = pLay;
+ if ( pLay->IsBodyFrame() )
+ pPageBody = pLay;
+ pLay = pLay->GetNext();
+ }
- SwRect aArea( pPageBody->getFrameArea() );
- if ( pFootnoteCont )
- aArea.AddBottom( pFootnoteCont->getFrameArea().Bottom() - aArea.Bottom() );
+ SwRect aArea( pPageBody->getFrameArea() );
+ if ( pFootnoteCont )
+ aArea.AddBottom( pFootnoteCont->getFrameArea().Bottom() - aArea.Bottom() );
- if ( !gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars( ) )
- ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) );
- else
- ProcessPrimitives( lcl_CreateRectangleDelimiterPrimitives( aArea ) );
- }
+ if ( !gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars( ) )
+ ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) );
+ else
+ ProcessPrimitives( lcl_CreateRectangleDelimiterPrimitives( aArea ) );
}
void SwColumnFrame::PaintSubsidiaryLines( const SwPageFrame *,
@@ -6948,21 +6948,21 @@ void SwPageFrame::RefreshExtraData( const SwRect &rRect ) const
SwRect aRect( rRect );
::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
- if ( aRect.HasArea() )
- {
- SwLayoutFrame::RefreshExtraData( aRect );
+ if ( !aRect.HasArea() )
+ return;
- if ( bLineInFly && GetSortedObjs() )
- for (SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
+ SwLayoutFrame::RefreshExtraData( aRect );
+
+ if ( bLineInFly && GetSortedObjs() )
+ for (SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
+ {
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) )
{
- if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) )
- {
- if ( pFly->getFrameArea().Top() <= aRect.Bottom() &&
- pFly->getFrameArea().Bottom() >= aRect.Top() )
- pFly->RefreshExtraData( aRect );
- }
+ if ( pFly->getFrameArea().Top() <= aRect.Bottom() &&
+ pFly->getFrameArea().Bottom() >= aRect.Top() )
+ pFly->RefreshExtraData( aRect );
}
- }
+ }
}
void SwLayoutFrame::RefreshExtraData( const SwRect &rRect ) const
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 807780612bdc..6a3cd158dde2 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -221,29 +221,29 @@ void SwSectionFrame::DelEmpty( bool bRemove )
pMaster->InvalidateSize();
}
SetFollow(nullptr);
- if( pUp )
- {
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aFrm.Height( 0 );
- }
+ if( !pUp )
+ return;
- // If we are destroyed immediately anyway, we don't need
- // to put us into the list
- if( bRemove )
- { // If we already were half dead before this DelEmpty,
- // we are likely in the list and have to remove us from
- // it
- if( !m_pSection && getRootFrame() )
- getRootFrame()->RemoveFromList( this );
- }
- else if( getRootFrame() )
- {
- getRootFrame()->InsertEmptySct( this );
- }
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aFrm.Height( 0 );
+ }
- m_pSection = nullptr; // like this a reanimation is virtually impossible though
+ // If we are destroyed immediately anyway, we don't need
+ // to put us into the list
+ if( bRemove )
+ { // If we already were half dead before this DelEmpty,
+ // we are likely in the list and have to remove us from
+ // it
+ if( !m_pSection && getRootFrame() )
+ getRootFrame()->RemoveFromList( this );
+ }
+ else if( getRootFrame() )
+ {
+ getRootFrame()->InsertEmptySct( this );
}
+
+ m_pSection = nullptr; // like this a reanimation is virtually impossible though
}
void SwSectionFrame::Cut()
@@ -313,24 +313,24 @@ void SwSectionFrame::Cut_( bool bRemove )
}
if( pPrepFrame )
pPrepFrame->Prepare( PrepareHint::FootnoteInvalidation );
- if ( pUp )
- {
- SwRectFnSet aRectFnSet(this);
- SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
- if( nFrameHeight > 0 )
- {
- if( !bRemove )
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aRectFnSet.SetHeight( aFrm, 0 );
+ if ( !pUp )
+ return;
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aRectFnSet.SetHeight( aPrt, 0 );
- }
+ SwRectFnSet aRectFnSet(this);
+ SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
+ if( nFrameHeight <= 0 )
+ return;
- pUp->Shrink( nFrameHeight );
- }
+ if( !bRemove )
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aRectFnSet.SetHeight( aFrm, 0 );
+
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aRectFnSet.SetHeight( aPrt, 0 );
}
+
+ pUp->Shrink( nFrameHeight );
}
void SwSectionFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
@@ -467,36 +467,36 @@ void SwSectionFrame::MergeNext( SwSectionFrame* pNxt )
if (pNxt->IsDeleteForbidden())
return;
- if (!pNxt->IsJoinLocked() && GetSection() == pNxt->GetSection())
- {
- PROTOCOL( this, PROT::Section, DbgAction::Merge, pNxt )
+ if (pNxt->IsJoinLocked() || GetSection() != pNxt->GetSection())
+ return;
- SwFrame* pTmp = ::SaveContent( pNxt );
- if( pTmp )
- {
- SwFrame* pLast = Lower();
- SwLayoutFrame* pLay = this;
- if( pLast )
- {
- while( pLast->GetNext() )
- pLast = pLast->GetNext();
- if( pLast->IsColumnFrame() )
- { // Columns now with BodyFrame
- pLay = static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(pLast)->Lower());
- pLast = pLay->Lower();
- if( pLast )
- while( pLast->GetNext() )
- pLast = pLast->GetNext();
- }
+ PROTOCOL( this, PROT::Section, DbgAction::Merge, pNxt )
+
+ SwFrame* pTmp = ::SaveContent( pNxt );
+ if( pTmp )
+ {
+ SwFrame* pLast = Lower();
+ SwLayoutFrame* pLay = this;
+ if( pLast )
+ {
+ while( pLast->GetNext() )
+ pLast = pLast->GetNext();
+ if( pLast->IsColumnFrame() )
+ { // Columns now with BodyFrame
+ pLay = static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(pLast)->Lower());
+ pLast = pLay->Lower();
+ if( pLast )
+ while( pLast->GetNext() )
+ pLast = pLast->GetNext();
}
- ::RestoreContent( pTmp, pLay, pLast );
}
- SetFollow( pNxt->GetFollow() );
- pNxt->SetFollow( nullptr );
- pNxt->Cut();
- SwFrame::DestroyFrame(pNxt);
- InvalidateSize();
+ ::RestoreContent( pTmp, pLay, pLast );
}
+ SetFollow( pNxt->GetFollow() );
+ pNxt->SetFollow( nullptr );
+ pNxt->Cut();
+ SwFrame::DestroyFrame(pNxt);
+ InvalidateSize();
}
/**
@@ -877,30 +877,30 @@ const SwSectionFormat* SwSectionFrame::GetEndSectFormat_() const
static void lcl_FindContentFrame( SwContentFrame* &rpContentFrame, SwFootnoteFrame* &rpFootnoteFrame,
SwFrame* pFrame, bool &rbChkFootnote )
{
- if( pFrame )
+ if( !pFrame )
+ return;
+
+ while( pFrame->GetNext() )
+ pFrame = pFrame->GetNext();
+ while( !rpContentFrame && pFrame )
{
- while( pFrame->GetNext() )
- pFrame = pFrame->GetNext();
- while( !rpContentFrame && pFrame )
+ if( pFrame->IsContentFrame() )
+ rpContentFrame = static_cast<SwContentFrame*>(pFrame);
+ else if( pFrame->IsLayoutFrame() )
{
- if( pFrame->IsContentFrame() )
- rpContentFrame = static_cast<SwContentFrame*>(pFrame);
- else if( pFrame->IsLayoutFrame() )
+ if( pFrame->IsFootnoteFrame() )
{
- if( pFrame->IsFootnoteFrame() )
+ if( rbChkFootnote )
{
- if( rbChkFootnote )
- {
- rpFootnoteFrame = static_cast<SwFootnoteFrame*>(pFrame);
- rbChkFootnote = rpFootnoteFrame->GetAttr()->GetFootnote().IsEndNote();
- }
+ rpFootnoteFrame = static_cast<SwFootnoteFrame*>(pFrame);
+ rbChkFootnote = rpFootnoteFrame->GetAttr()->GetFootnote().IsEndNote();
}
- else
- lcl_FindContentFrame( rpContentFrame, rpFootnoteFrame,
- static_cast<SwLayoutFrame*>(pFrame)->Lower(), rbChkFootnote );
}
- pFrame = pFrame->GetPrev();
+ else
+ lcl_FindContentFrame( rpContentFrame, rpFootnoteFrame,
+ static_cast<SwLayoutFrame*>(pFrame)->Lower(), rbChkFootnote );
}
+ pFrame = pFrame->GetPrev();
}
}
@@ -1111,51 +1111,51 @@ void SwSectionFrame::CheckClipping( bool bGrow, bool bMaximize )
else if( GetFollow() && !GetFollow()->ContainsAny() )
bExtraCalc = true;
}
- if ( bCalc || bExtraCalc )
- {
- nDiff = aRectFnSet.YDiff( nDeadLine, aRectFnSet.GetTop(getFrameArea()) );
- if( nDiff < 0 )
- nDeadLine = aRectFnSet.GetTop(getFrameArea());
- const Size aOldSz( getFramePrintArea().SSize() );
- long nTop = aRectFnSet.GetTopMargin(*this);
+ if ( !(bCalc || bExtraCalc) )
+ return;
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aRectFnSet.SetBottom( aFrm, nDeadLine );
- }
+ nDiff = aRectFnSet.YDiff( nDeadLine, aRectFnSet.GetTop(getFrameArea()) );
+ if( nDiff < 0 )
+ nDeadLine = aRectFnSet.GetTop(getFrameArea());
+ const Size aOldSz( getFramePrintArea().SSize() );
+ long nTop = aRectFnSet.GetTopMargin(*this);
- nDiff = aRectFnSet.GetHeight(getFrameArea());
- if( nTop > nDiff )
- nTop = nDiff;
- aRectFnSet.SetYMargins( *this, nTop, 0 );
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aRectFnSet.SetBottom( aFrm, nDeadLine );
+ }
+
+ nDiff = aRectFnSet.GetHeight(getFrameArea());
+ if( nTop > nDiff )
+ nTop = nDiff;
+ aRectFnSet.SetYMargins( *this, nTop, 0 );
+
+ // OD 18.09.2002 #100522#
+ // Determine, if height has changed.
+ // Note: In vertical layout the height equals the width value.
+ bool bHeightChanged = aRectFnSet.IsVert() ?
+ (aOldSz.Width() != getFramePrintArea().Width()) :
+ (aOldSz.Height() != getFramePrintArea().Height());
+ // Last but not least we have changed the height again, thus the inner
+ // layout (columns) is calculated and the content as well.
+ // OD 18.09.2002 #100522#
+ // calculate content, only if height has changed.
+ // OD 03.11.2003 #i19737# - restriction of content calculation too strong.
+ // If an endnote has an incorrect position or a follow section contains
+ // no content except footnotes/endnotes, the content has also been calculated.
+ if ( !(( bHeightChanged || bExtraCalc ) && Lower()) )
+ return;
- // OD 18.09.2002 #100522#
- // Determine, if height has changed.
- // Note: In vertical layout the height equals the width value.
- bool bHeightChanged = aRectFnSet.IsVert() ?
- (aOldSz.Width() != getFramePrintArea().Width()) :
- (aOldSz.Height() != getFramePrintArea().Height());
- // Last but not least we have changed the height again, thus the inner
- // layout (columns) is calculated and the content as well.
- // OD 18.09.2002 #100522#
- // calculate content, only if height has changed.
- // OD 03.11.2003 #i19737# - restriction of content calculation too strong.
- // If an endnote has an incorrect position or a follow section contains
- // no content except footnotes/endnotes, the content has also been calculated.
- if ( ( bHeightChanged || bExtraCalc ) && Lower() )
- {
- if( Lower()->IsColumnFrame() )
- {
- lcl_ColumnRefresh( this, false );
- ::CalcContent( this );
- }
- else
- {
- ChgLowersProp( aOldSz );
- if( !bMaximize && !IsContentLocked() )
- ::CalcContent( this );
- }
- }
+ if( Lower()->IsColumnFrame() )
+ {
+ lcl_ColumnRefresh( this, false );
+ ::CalcContent( this );
+ }
+ else
+ {
+ ChgLowersProp( aOldSz );
+ if( !bMaximize && !IsContentLocked() )
+ ::CalcContent( this );
}
}
@@ -1210,19 +1210,19 @@ class ExtraFormatToPositionObjs
~ExtraFormatToPositionObjs()
{
- if ( mbExtraFormatPerformed )
+ if ( !mbExtraFormatPerformed )
+ return;
+
+ // release keep locked position of lower floating screen objects
+ SwPageFrame* pPageFrame = mpSectFrame->FindPageFrame();
+ SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
+ if ( pObjs )
{
- // release keep locked position of lower floating screen objects
- SwPageFrame* pPageFrame = mpSectFrame->FindPageFrame();
- SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
- if ( pObjs )
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- for (SwAnchoredObject* pAnchoredObj : *pObjs)
+ if ( mpSectFrame->IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
{
- if ( mpSectFrame->IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
- {
- pAnchoredObj->SetKeepPosLocked( false );
- }
+ pAnchoredObj->SetKeepPosLocked( false );
}
}
}
@@ -2814,28 +2814,28 @@ void SwSectionFrame::CalcFootnoteContent()
{
vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
SwFootnoteContFrame* pCont = ContainsFootnoteCont();
- if( pCont )
+ if( !pCont )
+ return;
+
+ SwFrame* pFrame = pCont->ContainsAny();
+ if( pFrame )
+ pCont->Calc(pRenderContext);
+ while( pFrame && IsAnLower( pFrame ) )
{
- SwFrame* pFrame = pCont->ContainsAny();
- if( pFrame )
- pCont->Calc(pRenderContext);
- while( pFrame && IsAnLower( pFrame ) )
- {
- SwFootnoteFrame* pFootnote = pFrame->FindFootnoteFrame();
- if( pFootnote )
- pFootnote->Calc(pRenderContext);
- pFrame->Calc(pRenderContext);
- if( pFrame->IsSctFrame() )
+ SwFootnoteFrame* pFootnote = pFrame->FindFootnoteFrame();
+ if( pFootnote )
+ pFootnote->Calc(pRenderContext);
+ pFrame->Calc(pRenderContext);
+ if( pFrame->IsSctFrame() )
+ {
+ SwFrame *pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
+ if( pTmp )
{
- SwFrame *pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
- if( pTmp )
- {
- pFrame = pTmp;
- continue;
- }
+ pFrame = pTmp;
+ continue;
}
- pFrame = pFrame->FindNext();
}
+ pFrame = pFrame->FindNext();
}
}
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 1a92144a5583..76a56ed65508 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -195,90 +195,90 @@ void SwFrame::CheckDirChange()
mbInvalidR2L = true;
bool bChg = bOldR2L != IsRightToLeft();
bool bOldVertL2R = IsVertLR();
- if( ( IsVertical() != bOldVert ) || bChg || bOldVertL2R != IsVertLR() )
+ if( !(( IsVertical() != bOldVert ) || bChg || bOldVertL2R != IsVertLR()) )
+ return;
+
+ InvalidateAll();
+ if( IsLayoutFrame() )
{
- InvalidateAll();
- if( IsLayoutFrame() )
+ // set minimum row height for vertical cells in horizontal table:
+ if ( IsCellFrame() && GetUpper() )
{
- // set minimum row height for vertical cells in horizontal table:
- if ( IsCellFrame() && GetUpper() )
+ if ( IsVertical() != GetUpper()->IsVertical() &&
+ static_cast<SwCellFrame*>(this)->GetTabBox()->getRowSpan() == 1 )
{
- if ( IsVertical() != GetUpper()->IsVertical() &&
- static_cast<SwCellFrame*>(this)->GetTabBox()->getRowSpan() == 1 )
- {
- enum {
- MIN_VERT_CELL_HEIGHT = 1135
- };
-
- SwTableLine* pLine = const_cast<SwTableLine*>(static_cast<SwCellFrame*>(this)->GetTabBox()->GetUpper());
- SwFrameFormat* pFrameFormat = pLine->GetFrameFormat();
- SwFormatFrameSize aNew( pFrameFormat->GetFrameSize() );
- if ( SwFrameSize::Fixed != aNew.GetHeightSizeType() )
- aNew.SetHeightSizeType( SwFrameSize::Minimum );
- if ( aNew.GetHeight() < MIN_VERT_CELL_HEIGHT )
- aNew.SetHeight( MIN_VERT_CELL_HEIGHT );
- SwDoc* pDoc = pFrameFormat->GetDoc();
- pDoc->SetAttr( aNew, *pLine->ClaimFrameFormat() );
- }
+ enum {
+ MIN_VERT_CELL_HEIGHT = 1135
+ };
+
+ SwTableLine* pLine = const_cast<SwTableLine*>(static_cast<SwCellFrame*>(this)->GetTabBox()->GetUpper());
+ SwFrameFormat* pFrameFormat = pLine->GetFrameFormat();
+ SwFormatFrameSize aNew( pFrameFormat->GetFrameSize() );
+ if ( SwFrameSize::Fixed != aNew.GetHeightSizeType() )
+ aNew.SetHeightSizeType( SwFrameSize::Minimum );
+ if ( aNew.GetHeight() < MIN_VERT_CELL_HEIGHT )
+ aNew.SetHeight( MIN_VERT_CELL_HEIGHT );
+ SwDoc* pDoc = pFrameFormat->GetDoc();
+ pDoc->SetAttr( aNew, *pLine->ClaimFrameFormat() );
}
+ }
- SwFrame* pFrame = static_cast<SwLayoutFrame*>(this)->Lower();
- const SwFormatCol* pCol = nullptr;
- SwLayoutFrame* pBody = nullptr;
- if( pFrame )
+ SwFrame* pFrame = static_cast<SwLayoutFrame*>(this)->Lower();
+ const SwFormatCol* pCol = nullptr;
+ SwLayoutFrame* pBody = nullptr;
+ if( pFrame )
+ {
+ if( IsPageFrame() )
{
- if( IsPageFrame() )
- {
- // If we're a page frame and we change our layout direction,
- // we have to look for columns and rearrange them.
- pBody = static_cast<SwPageFrame*>(this)->FindBodyCont();
- if(pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame())
- pCol = &static_cast<SwPageFrame*>(this)->GetFormat()->GetCol();
- }
- else if( pFrame->IsColumnFrame() )
- {
- pBody = static_cast<SwLayoutFrame*>(this);
- const SwFrameFormat *pFormat = pBody->GetFormat();
- if( pFormat )
- pCol = &pFormat->GetCol();
- }
+ // If we're a page frame and we change our layout direction,
+ // we have to look for columns and rearrange them.
+ pBody = static_cast<SwPageFrame*>(this)->FindBodyCont();
+ if(pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame())
+ pCol = &static_cast<SwPageFrame*>(this)->GetFormat()->GetCol();
}
- while( pFrame )
+ else if( pFrame->IsColumnFrame() )
{
- pFrame->CheckDirChange();
- pFrame = pFrame->GetNext();
+ pBody = static_cast<SwLayoutFrame*>(this);
+ const SwFrameFormat *pFormat = pBody->GetFormat();
+ if( pFormat )
+ pCol = &pFormat->GetCol();
}
- if( pCol )
- pBody->AdjustColumns( pCol, true );
}
- else if( IsTextFrame() )
- static_cast<SwTextFrame*>(this)->Prepare();
+ while( pFrame )
+ {
+ pFrame->CheckDirChange();
+ pFrame = pFrame->GetNext();
+ }
+ if( pCol )
+ pBody->AdjustColumns( pCol, true );
+ }
+ else if( IsTextFrame() )
+ static_cast<SwTextFrame*>(this)->Prepare();
+
+ // #i31698# - notify anchored objects also for page frames.
+ // Remove code above for special handling of page frames
+ if ( !GetDrawObjs() )
+ return;
- // #i31698# - notify anchored objects also for page frames.
- // Remove code above for special handling of page frames
- if ( GetDrawObjs() )
+ const SwSortedObjs *pObjs = GetDrawObjs();
+ const size_t nCnt = pObjs->size();
+ for ( size_t i = 0; i < nCnt; ++i )
+ {
+ SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
+ if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ static_cast<SwFlyFrame*>(pAnchoredObj)->CheckDirChange();
+ else
{
- const SwSortedObjs *pObjs = GetDrawObjs();
- const size_t nCnt = pObjs->size();
- for ( size_t i = 0; i < nCnt; ++i )
- {
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
- if( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
- static_cast<SwFlyFrame*>(pAnchoredObj)->CheckDirChange();
- else
- {
- // OD 2004-04-06 #i26791# - direct object
- // positioning no longer needed. Instead
- // invalidate
- pAnchoredObj->InvalidateObjPos();
- }
- // #i31698# - update layout direction of
- // anchored object
- {
- ::setContextWritingMode( pAnchoredObj->DrawObj(), pAnchoredObj->GetAnchorFrameContainingAnchPos() );
- pAnchoredObj->UpdateLayoutDir();
- }
- }
+ // OD 2004-04-06 #i26791# - direct object
+ // positioning no longer needed. Instead
+ // invalidate
+ pAnchoredObj->InvalidateObjPos();
+ }
+ // #i31698# - update layout direction of
+ // anchored object
+ {
+ ::setContextWritingMode( pAnchoredObj->DrawObj(), pAnchoredObj->GetAnchorFrameContainingAnchPos() );
+ pAnchoredObj->UpdateLayoutDir();
}
}
}
@@ -343,30 +343,30 @@ void SwFrame::DestroyImpl()
}
}
- if (m_pDrawObjs)
+ if (!m_pDrawObjs)
+ return;
+
+ for (size_t i = m_pDrawObjs->size(); i; )
{
- for (size_t i = m_pDrawObjs->size(); i; )
+ SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i];
+ if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
- SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i];
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
- {
- SwFrame::DestroyFrame(static_cast<SwFlyFrame*>(pAnchoredObj));
- }
- else
+ SwFrame::DestroyFrame(static_cast<SwFlyFrame*>(pAnchoredObj));
+ }
+ else
+ {
+ SdrObject* pSdrObj = pAnchoredObj->DrawObj();
+ SwDrawContact* pContact =
+ static_cast<SwDrawContact*>(pSdrObj->GetUserCall());
+ OSL_ENSURE( pContact,
+ "<SwFrame::~SwFrame> - missing contact for drawing object" );
+ if ( pContact )
{
- SdrObject* pSdrObj = pAnchoredObj->DrawObj();
- SwDrawContact* pContact =
- static_cast<SwDrawContact*>(pSdrObj->GetUserCall());
- OSL_ENSURE( pContact,
- "<SwFrame::~SwFrame> - missing contact for drawing object" );
- if ( pContact )
- {
- pContact->DisconnectObjFromLayout( pSdrObj );
- }
+ pContact->DisconnectObjFromLayout( pSdrObj );
}
}
- m_pDrawObjs.reset();
}
+ m_pDrawObjs.reset();
}
SwFrame::~SwFrame()
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a92cbe6b1356..961c1c94171e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1360,36 +1360,36 @@ void SwTabFrame::Join()
SwTabFrame *pFoll = GetFollow();
- if (pFoll && !pFoll->IsJoinLocked())
- {
- SwRectFnSet aRectFnSet(this);
- pFoll->Cut(); //Cut out first to avoid unnecessary notifications.
+ if (!(pFoll && !pFoll->IsJoinLocked()))
+ return;
- SwFrame *pRow = pFoll->GetFirstNonHeadlineRow(),
- *pNxt;
+ SwRectFnSet aRectFnSet(this);
+ pFoll->Cut(); //Cut out first to avoid unnecessary notifications.
- SwFrame* pPrv = GetLastLower();
+ SwFrame *pRow = pFoll->GetFirstNonHeadlineRow(),
+ *pNxt;
- SwTwips nHeight = 0; //Total height of the inserted rows as return value.
+ SwFrame* pPrv = GetLastLower();
- while ( pRow )
- {
- pNxt = pRow->GetNext();
- nHeight += aRectFnSet.GetHeight(pRow->getFrameArea());
- pRow->RemoveFromLayout();
- pRow->InvalidateAll_();
- pRow->InsertBehind( this, pPrv );
- pRow->CheckDirChange();
- pPrv = pRow;
- pRow = pNxt;
- }
+ SwTwips nHeight = 0; //Total height of the inserted rows as return value.
- SetFollow( pFoll->GetFollow() );
- SetFollowFlowLine( pFoll->HasFollowFlowLine() );
- SwFrame::DestroyFrame(pFoll);
-
- Grow( nHeight );
+ while ( pRow )
+ {
+ pNxt = pRow->GetNext();
+ nHeight += aRectFnSet.GetHeight(pRow->getFrameArea());
+ pRow->RemoveFromLayout();
+ pRow->InvalidateAll_();
+ pRow->InsertBehind( this, pPrv );
+ pRow->CheckDirChange();
+ pPrv = pRow;
+ pRow = pNxt;
}
+
+ SetFollow( pFoll->GetFollow() );
+ SetFollowFlowLine( pFoll->HasFollowFlowLine() );
+ SwFrame::DestroyFrame(pFoll);
+
+ Grow( nHeight );
}
static void SwInvalidatePositions( SwFrame *pFrame, long nBottom )
@@ -3116,27 +3116,27 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
}
}
- if ( !isFrameAreaSizeValid() )
- {
- setFrameAreaSizeValid(true);
+ if ( isFrameAreaSizeValid() )
+ return;
- // The size is defined by the content plus the margins.
- SwTwips nRemaining = 0, nDiff;
- SwFrame *pFrame = m_pLower;
- while ( pFrame )
- {
- nRemaining += aRectFnSet.GetHeight(pFrame->getFrameArea());
- pFrame = pFrame->GetNext();
- }
- // And now add the margins
- nRemaining += nUpper + nLower;
+ setFrameAreaSizeValid(true);
- nDiff = aRectFnSet.GetHeight(getFrameArea()) - nRemaining;
- if ( nDiff > 0 )
- Shrink( nDiff );
- else if ( nDiff < 0 )
- Grow( -nDiff );
+ // The size is defined by the content plus the margins.
+ SwTwips nRemaining = 0, nDiff;
+ SwFrame *pFrame = m_pLower;
+ while ( pFrame )
+ {
+ nRemaining += aRectFnSet.GetHeight(pFrame->getFrameArea());
+ pFrame = pFrame->GetNext();
}
+ // And now add the margins
+ nRemaining += nUpper + nLower;
+
+ nDiff = aRectFnSet.GetHeight(getFrameArea()) - nRemaining;
+ if ( nDiff > 0 )
+ Shrink( nDiff );
+ else if ( nDiff < 0 )
+ Grow( -nDiff );
}
SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
@@ -3246,40 +3246,40 @@ void SwTabFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
else
UpdateAttr_( pOld, pNew, nInvFlags );
- if ( nInvFlags != 0 )
+ if ( nInvFlags == 0 )
+ return;
+
+ SwPageFrame *pPage = FindPageFrame();
+ InvalidatePage( pPage );
+ if ( nInvFlags & 0x02 )
+ InvalidatePrt_();
+ if ( nInvFlags & 0x40 )
+ InvalidatePos_();
+ SwFrame *pTmp = GetIndNext();
+ if ( nullptr != pTmp )
{
- SwPageFrame *pPage = FindPageFrame();
- InvalidatePage( pPage );
- if ( nInvFlags & 0x02 )
- InvalidatePrt_();
- if ( nInvFlags & 0x40 )
- InvalidatePos_();
- SwFrame *pTmp = GetIndNext();
- if ( nullptr != pTmp )
- {
- if ( nInvFlags & 0x04 )
- {
- pTmp->InvalidatePrt_();
- if ( pTmp->IsContentFrame() )
- pTmp->InvalidatePage( pPage );
- }
- if ( nInvFlags & 0x10 )
- pTmp->SetCompletePaint();
- }
- if ( nInvFlags & 0x08 && nullptr != (pTmp = GetPrev()) )
+ if ( nInvFlags & 0x04 )
{
pTmp->InvalidatePrt_();
if ( pTmp->IsContentFrame() )
pTmp->InvalidatePage( pPage );
}
- if ( nInvFlags & 0x20 )
- {
- if ( pPage && pPage->GetUpper() && !IsFollow() )
- static_cast<SwRootFrame*>(pPage->GetUpper())->InvalidateBrowseWidth();
- }
- if ( nInvFlags & 0x80 )
- InvalidateNextPos();
+ if ( nInvFlags & 0x10 )
+ pTmp->SetCompletePaint();
+ }
+ if ( nInvFlags & 0x08 && nullptr != (pTmp = GetPrev()) )
+ {
+ pTmp->InvalidatePrt_();
+ if ( pTmp->IsContentFrame() )
+ pTmp->InvalidatePage( pPage );
}
+ if ( nInvFlags & 0x20 )
+ {
+ if ( pPage && pPage->GetUpper() && !IsFollow() )
+ static_cast<SwRootFrame*>(pPage->GetUpper())->InvalidateBrowseWidth();
+ }
+ if ( nInvFlags & 0x80 )
+ InvalidateNextPos();
}
void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
@@ -3739,18 +3739,18 @@ void SwTabFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
// b) The new follower was previously the first in a chain
GetNext()->InvalidatePrt_();
- if ( pPage && !IsFollow() )
- {
- if ( pPage->GetUpper() )
- static_cast<SwRootFrame*>(pPage->GetUpper())->InvalidateBrowseWidth();
+ if ( !(pPage && !IsFollow()) )
+ return;
- if ( !GetPrev() )//At least needed for HTML with a table at the beginning.
- {
- const SwPageDesc *pDesc = GetFormat()->GetPageDesc().GetPageDesc();
- if ( (pDesc && pDesc != pPage->GetPageDesc()) ||
- (!pDesc && pPage->GetPageDesc() != &GetFormat()->GetDoc()->GetPageDesc(0)) )
- CheckPageDescs( pPage );
- }
+ if ( pPage->GetUpper() )
+ static_cast<SwRootFrame*>(pPage->GetUpper())->InvalidateBrowseWidth();
+
+ if ( !GetPrev() )//At least needed for HTML with a table at the beginning.
+ {
+ const SwPageDesc *pDesc = GetFormat()->GetPageDesc().GetPageDesc();
+ if ( (pDesc && pDesc != pPage->GetPageDesc()) ||
+ (!pDesc && pPage->GetPageDesc() != &GetFormat()->GetDoc()->GetPageDesc(0)) )
+ CheckPageDescs( pPage );
}
}
@@ -4409,22 +4409,22 @@ void SwRowFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
}
// last row will fill the space in its upper.
- if ( !GetNext() )
- {
- //The last fills the remaining space in the upper.
- SwTwips nDiff = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea());
- SwFrame *pSibling = GetUpper()->Lower();
- do
- { nDiff -= aRectFnSet.GetHeight(pSibling->getFrameArea());
- pSibling = pSibling->GetNext();
- } while ( pSibling );
- if ( nDiff > 0 )
- {
- mbFixSize = false;
- Grow( nDiff );
- mbFixSize = bFix;
- setFrameAreaSizeValid(true);
- }
+ if ( GetNext() )
+ return;
+
+ //The last fills the remaining space in the upper.
+ SwTwips nDiff = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea());
+ SwFrame *pSibling = GetUpper()->Lower();
+ do
+ { nDiff -= aRectFnSet.GetHeight(pSibling->getFrameArea());
+ pSibling = pSibling->GetNext();
+ } while ( pSibling );
+ if ( nDiff > 0 )
+ {
+ mbFixSize = false;
+ Grow( nDiff );
+ mbFixSize = bFix;
+ setFrameAreaSizeValid(true);
}
}
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index c8be85e67d2d..9d93cf61733f 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -245,21 +245,21 @@ void TransformableSwFrame::adaptFrameAreasToTransformations()
}
}
- if(!getLocalFramePrintAreaTransformation().isIdentity())
- {
- basegfx::B2DRange aRangeFramePrintArea(0.0, 0.0, 1.0, 1.0);
- aRangeFramePrintArea.transform(getLocalFramePrintAreaTransformation());
- const SwRect aNewPrt(
- basegfx::fround(aRangeFramePrintArea.getMinX()) - mrSwFrameAreaDefinition.getFrameArea().Left(),
- basegfx::fround(aRangeFramePrintArea.getMinY()) - mrSwFrameAreaDefinition.getFrameArea().Top(),
- basegfx::fround(aRangeFramePrintArea.getWidth()),
- basegfx::fround(aRangeFramePrintArea.getHeight()));
+ if(getLocalFramePrintAreaTransformation().isIdentity())
+ return;
- if(aNewPrt != mrSwFrameAreaDefinition.getFramePrintArea())
- {
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(mrSwFrameAreaDefinition);
- aPrt.setSwRect(aNewPrt);
- }
+ basegfx::B2DRange aRangeFramePrintArea(0.0, 0.0, 1.0, 1.0);
+ aRangeFramePrintArea.transform(getLocalFramePrintAreaTransformation());
+ const SwRect aNewPrt(
+ basegfx::fround(aRangeFramePrintArea.getMinX()) - mrSwFrameAreaDefinition.getFrameArea().Left(),
+ basegfx::fround(aRangeFramePrintArea.getMinY()) - mrSwFrameAreaDefinition.getFrameArea().Top(),
+ basegfx::fround(aRangeFramePrintArea.getWidth()),
+ basegfx::fround(aRangeFramePrintArea.getHeight()));
+
+ if(aNewPrt != mrSwFrameAreaDefinition.getFramePrintArea())
+ {
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(mrSwFrameAreaDefinition);
+ aPrt.setSwRect(aNewPrt);
}
}
@@ -491,31 +491,31 @@ void SwFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
else
UpdateAttrFrame( pOld, pNew, nInvFlags );
- if ( nInvFlags != 0 )
+ if ( nInvFlags == 0 )
+ return;
+
+ SwPageFrame *pPage = FindPageFrame();
+ InvalidatePage( pPage );
+ if ( nInvFlags & 0x01 )
{
- SwPageFrame *pPage = FindPageFrame();
- InvalidatePage( pPage );
- if ( nInvFlags & 0x01 )
- {
- InvalidatePrt_();
- if( !GetPrev() && IsTabFrame() && IsInSct() )
- FindSctFrame()->InvalidatePrt_();
- }
- if ( nInvFlags & 0x02 )
- InvalidateSize_();
- if ( nInvFlags & 0x04 )
- InvalidatePos_();
- if ( nInvFlags & 0x08 )
- SetCompletePaint();
- SwFrame *pNxt;
- if ( nInvFlags & 0x30 && nullptr != (pNxt = GetNext()) )
- {
- pNxt->InvalidatePage( pPage );
- if ( nInvFlags & 0x10 )
- pNxt->InvalidatePos_();
- if ( nInvFlags & 0x20 )
- pNxt->SetCompletePaint();
- }
+ InvalidatePrt_();
+ if( !GetPrev() && IsTabFrame() && IsInSct() )
+ FindSctFrame()->InvalidatePrt_();
+ }
+ if ( nInvFlags & 0x02 )
+ InvalidateSize_();
+ if ( nInvFlags & 0x04 )
+ InvalidatePos_();
+ if ( nInvFlags & 0x08 )
+ SetCompletePaint();
+ SwFrame *pNxt;
+ if ( nInvFlags & 0x30 && nullptr != (pNxt = GetNext()) )
+ {
+ pNxt->InvalidatePage( pPage );
+ if ( nInvFlags & 0x10 )
+ pNxt->InvalidatePos_();
+ if ( nInvFlags & 0x20 )
+ pNxt->SetCompletePaint();
}
}
@@ -620,99 +620,99 @@ void SwFrame::InvalidatePage( const SwPageFrame *pPage ) const
}
}
- if ( pPage && pPage->GetUpper() )
- {
- if ( pPage->GetFormat()->GetDoc()->IsInDtor() )
- return;
+ if ( !(pPage && pPage->GetUpper()) )
+ return;
+
+ if ( pPage->GetFormat()->GetDoc()->IsInDtor() )
+ return;
- SwRootFrame *pRoot = const_cast<SwRootFrame*>(static_cast<const SwRootFrame*>(pPage->GetUpper()));
- const SwFlyFrame *pFly = FindFlyFrame();
- if ( IsContentFrame() )
+ SwRootFrame *pRoot = const_cast<SwRootFrame*>(static_cast<const SwRootFrame*>(pPage->GetUpper()));
+ const SwFlyFrame *pFly = FindFlyFrame();
+ if ( IsContentFrame() )
+ {
+ if ( pRoot->IsTurboAllowed() )
{
- if ( pRoot->IsTurboAllowed() )
- {
- // If a ContentFrame wants to register for a second time, make it a TurboAction.
- if ( !pRoot->GetTurbo() || this == pRoot->GetTurbo() )
- pRoot->SetTurbo( static_cast<const SwContentFrame*>(this) );
- else
- {
- pRoot->DisallowTurbo();
- //The page of the Turbo could be a different one then mine,
- //therefore we have to invalidate it.
- const SwFrame *pTmp = pRoot->GetTurbo();
- pRoot->ResetTurbo();
- pTmp->InvalidatePage();
- }
- }
- if ( !pRoot->GetTurbo() )
+ // If a ContentFrame wants to register for a second time, make it a TurboAction.
+ if ( !pRoot->GetTurbo() || this == pRoot->GetTurbo() )
+ pRoot->SetTurbo( static_cast<const SwContentFrame*>(this) );
+ else
{
- if ( pFly )
- { if( !pFly->IsLocked() )
- {
- if ( pFly->IsFlyInContentFrame() )
- { pPage->InvalidateFlyInCnt();
- pFly->GetAnchorFrame()->InvalidatePage();
- }
- else
- pPage->InvalidateFlyContent();
- }
- }
- else
- pPage->InvalidateContent();
+ pRoot->DisallowTurbo();
+ //The page of the Turbo could be a different one then mine,
+ //therefore we have to invalidate it.
+ const SwFrame *pTmp = pRoot->GetTurbo();
+ pRoot->ResetTurbo();
+ pTmp->InvalidatePage();
}
}
- else
+ if ( !pRoot->GetTurbo() )
{
- pRoot->DisallowTurbo();
if ( pFly )
- {
- if ( !pFly->IsLocked() )
+ { if( !pFly->IsLocked() )
{
if ( pFly->IsFlyInContentFrame() )
- {
- pPage->InvalidateFlyInCnt();
+ { pPage->InvalidateFlyInCnt();
pFly->GetAnchorFrame()->InvalidatePage();
}
else
- pPage->InvalidateFlyLayout();
+ pPage->InvalidateFlyContent();
}
}
else
- pPage->InvalidateLayout();
-
- if ( pRoot->GetTurbo() )
- { const SwFrame *pTmp = pRoot->GetTurbo();
- pRoot->ResetTurbo();
- pTmp->InvalidatePage();
+ pPage->InvalidateContent();
+ }
+ }
+ else
+ {
+ pRoot->DisallowTurbo();
+ if ( pFly )
+ {
+ if ( !pFly->IsLocked() )
+ {
+ if ( pFly->IsFlyInContentFrame() )
+ {
+ pPage->InvalidateFlyInCnt();
+ pFly->GetAnchorFrame()->InvalidatePage();
+ }
+ else
+ pPage->InvalidateFlyLayout();
}
}
- pRoot->SetIdleFlags();
+ else
+ pPage->InvalidateLayout();
+
+ if ( pRoot->GetTurbo() )
+ { const SwFrame *pTmp = pRoot->GetTurbo();
+ pRoot->ResetTurbo();
+ pTmp->InvalidatePage();
+ }
+ }
+ pRoot->SetIdleFlags();
- if (IsTextFrame())
+ if (IsTextFrame())
+ {
+ SwTextFrame const*const pText(static_cast<SwTextFrame const*>(this));
+ if (sw::MergedPara const*const pMergedPara = pText->GetMergedPara())
{
- SwTextFrame const*const pText(static_cast<SwTextFrame const*>(this));
- if (sw::MergedPara const*const pMergedPara = pText->GetMergedPara())
+ SwTextNode const* pNode(nullptr);
+ for (auto const& e : pMergedPara->extents)
{
- SwTextNode const* pNode(nullptr);
- for (auto const& e : pMergedPara->extents)
+ if (e.pNode != pNode)
{
- if (e.pNode != pNode)
+ pNode = e.pNode;
+ if (pNode->IsGrammarCheckDirty())
{
- pNode = e.pNode;
- if (pNode->IsGrammarCheckDirty())
- {
- pRoot->SetNeedGrammarCheck( true );
- break;
- }
+ pRoot->SetNeedGrammarCheck( true );
+ break;
}
}
}
- else
+ }
+ else
+ {
+ if (pText->GetTextNodeFirst()->IsGrammarCheckDirty())
{
- if (pText->GetTextNodeFirst()->IsGrammarCheckDirty())
- {
- pRoot->SetNeedGrammarCheck( true );
- }
+ pRoot->SetNeedGrammarCheck( true );
}
}
}
@@ -1100,20 +1100,20 @@ void SwContentFrame::Paste( SwFrame* pParent, SwFrame* pSibling)
InvalidateLineNum_();
SwFrame *pNxt = FindNextCnt();
- if ( pNxt )
+ if ( !pNxt )
+ return;
+
+ while ( pNxt && pNxt->IsInTab() )
{
- while ( pNxt && pNxt->IsInTab() )
- {
- pNxt = pNxt->FindTabFrame();
- if( nullptr != pNxt )
- pNxt = pNxt->FindNextCnt();
- }
- if ( pNxt )
- {
- pNxt->InvalidateLineNum_();
- if ( pNxt != GetNext() )
- pNxt->InvalidatePage();
- }
+ pNxt = pNxt->FindTabFrame();
+ if( nullptr != pNxt )
+ pNxt = pNxt->FindNextCnt();
+ }
+ if ( pNxt )
+ {
+ pNxt->InvalidateLineNum_();
+ if ( pNxt != GetNext() )
+ pNxt->InvalidatePage();
}
}
@@ -1236,67 +1236,67 @@ void SwContentFrame::Cut()
//Remove first, then shrink the upper.
SwLayoutFrame *pUp = GetUpper();
RemoveFromLayout();
- if ( pUp )
- {
- SwSectionFrame *pSct = nullptr;
- if ( !pUp->Lower() &&
- ( ( pUp->IsFootnoteFrame() && !pUp->IsColLocked() ) ||
- ( pUp->IsInSct() &&
- // #i29438#
- // We have to consider the case that the section may be "empty"
- // except from a temporary empty table frame.
- // This can happen due to the new cell split feature.
- !pUp->IsCellFrame() &&
- // #126020# - adjust check for empty section
- // #130797# - correct fix #126020#
- !(pSct = pUp->FindSctFrame())->ContainsContent() &&
- !pSct->ContainsAny( true ) ) ) )
+ if ( !pUp )
+ return;
+
+ SwSectionFrame *pSct = nullptr;
+ if ( !pUp->Lower() &&
+ ( ( pUp->IsFootnoteFrame() && !pUp->IsColLocked() ) ||
+ ( pUp->IsInSct() &&
+ // #i29438#
+ // We have to consider the case that the section may be "empty"
+ // except from a temporary empty table frame.
+ // This can happen due to the new cell split feature.
+ !pUp->IsCellFrame() &&
+ // #126020# - adjust check for empty section
+ // #130797# - correct fix #126020#
+ !(pSct = pUp->FindSctFrame())->ContainsContent() &&
+ !pSct->ContainsAny( true ) ) ) )
+ {
+ if ( pUp->GetUpper() )
{
- if ( pUp->GetUpper() )
+
+ // prevent delete of <ColLocked> footnote frame
+ if ( pUp->IsFootnoteFrame() && !pUp->IsColLocked())
+ {
+ if( pUp->GetNext() && !pUp->GetPrev() )
+ {
+ SwFrame* pTmp = static_cast<SwLayoutFrame*>(pUp->GetNext())->ContainsAny();
+ if( pTmp )
+ pTmp->InvalidatePrt_();
+ }
+ if (!pUp->IsDeleteForbidden())
+ {
+ pUp->Cut();
+ SwFrame::DestroyFrame(pUp);
+ }
+ }
+ else
{
- // prevent delete of <ColLocked> footnote frame
- if ( pUp->IsFootnoteFrame() && !pUp->IsColLocked())
+ if ( pSct->IsColLocked() || !pSct->IsInFootnote() ||
+ ( pUp->IsFootnoteFrame() && pUp->IsColLocked() ) )
{
- if( pUp->GetNext() && !pUp->GetPrev() )
- {
- SwFrame* pTmp = static_cast<SwLayoutFrame*>(pUp->GetNext())->ContainsAny();
- if( pTmp )
- pTmp->InvalidatePrt_();
- }
- if (!pUp->IsDeleteForbidden())
- {
- pUp->Cut();
- SwFrame::DestroyFrame(pUp);
- }
+ pSct->DelEmpty( false );
+ // If a locked section may not be deleted then at least
+ // its size became invalid after removing its last
+ // content.
+ pSct->InvalidateSize_();
}
else
{
-
- if ( pSct->IsColLocked() || !pSct->IsInFootnote() ||
- ( pUp->IsFootnoteFrame() && pUp->IsColLocked() ) )
- {
- pSct->DelEmpty( false );
- // If a locked section may not be deleted then at least
- // its size became invalid after removing its last
- // content.
- pSct->InvalidateSize_();
- }
- else
- {
- pSct->DelEmpty( true );
- SwFrame::DestroyFrame(pSct);
- }
+ pSct->DelEmpty( true );
+ SwFrame::DestroyFrame(pSct);
}
}
}
- else
- {
- SwRectFnSet aRectFnSet(this);
- long nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
- if( nFrameHeight )
- pUp->Shrink( nFrameHeight );
- }
+ }
+ else
+ {
+ SwRectFnSet aRectFnSet(this);
+ long nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
+ if( nFrameHeight )
+ pUp->Shrink( nFrameHeight );
}
}
@@ -1374,26 +1374,26 @@ void SwLayoutFrame::Paste( SwFrame* pParent, SwFrame* pSibling)
}
}
- if( (getFrameArea().*fnRect->fnGetHeight)() )
+ if( !(getFrameArea().*fnRect->fnGetHeight)() )
+ return;
+
+ // AdjustNeighbourhood is now also called in columns which are not
+ // placed inside a frame
+ SwNeighbourAdjust nAdjust = GetUpper()->IsFootnoteBossFrame() ?
+ static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment()
+ : SwNeighbourAdjust::GrowShrink;
+ SwTwips nGrow = (getFrameArea().*fnRect->fnGetHeight)();
+ if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
+ AdjustNeighbourhood( nGrow );
+ else
{
- // AdjustNeighbourhood is now also called in columns which are not
- // placed inside a frame
- SwNeighbourAdjust nAdjust = GetUpper()->IsFootnoteBossFrame() ?
- static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment()
- : SwNeighbourAdjust::GrowShrink;
- SwTwips nGrow = (getFrameArea().*fnRect->fnGetHeight)();
- if( SwNeighbourAdjust::OnlyAdjust == nAdjust )
- AdjustNeighbourhood( nGrow );
- else
- {
- SwTwips nReal = 0;
- if( SwNeighbourAdjust::AdjustGrow == nAdjust )
- nReal = AdjustNeighbourhood( nGrow );
- if( nReal < nGrow )
- nReal += pParent->Grow( nGrow - nReal );
- if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nGrow )
- AdjustNeighbourhood( nGrow - nReal );
- }
+ SwTwips nReal = 0;
+ if( SwNeighbourAdjust::AdjustGrow == nAdjust )
+ nReal = AdjustNeighbourhood( nGrow );
+ if( nReal < nGrow )
+ nReal += pParent->Grow( nGrow - nReal );
+ if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nGrow )
+ AdjustNeighbourhood( nGrow - nReal );
}
}
@@ -1950,22 +1950,22 @@ void SwFrame::ImplInvalidatePrt()
void SwFrame::ImplInvalidatePos()
{
- if ( InvalidationAllowed( INVALID_POS ) )
- {
- setFrameAreaPositionValid(false);
+ if ( !InvalidationAllowed( INVALID_POS ) )
+ return;
- if ( IsFlyFrame() )
- {
- static_cast<SwFlyFrame*>(this)->Invalidate_();
- }
- else
- {
- InvalidatePage();
- }
+ setFrameAreaPositionValid(false);
- // OD 2004-05-19 #i28701#
- ActionOnInvalidation( INVALID_POS );
+ if ( IsFlyFrame() )
+ {
+ static_cast<SwFlyFrame*>(this)->Invalidate_();
}
+ else
+ {
+ InvalidatePage();
+ }
+
+ // OD 2004-05-19 #i28701#
+ ActionOnInvalidation( INVALID_POS );
}
void SwFrame::ImplInvalidateLineNum()
@@ -3332,25 +3332,25 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize )
// Finally adjust the columns if width is set to auto
// Possible optimization: execute this code earlier in this function and
// return???
- if ( ( (aRectFnSet.IsVert() && bHeightChgd) || (! aRectFnSet.IsVert() && bWidthChgd) ) &&
- Lower()->IsColumnFrame() )
- {
- // get column attribute
- const SwFormatCol* pColAttr = nullptr;
- if ( IsPageBodyFrame() )
- {
- OSL_ENSURE( GetUpper()->IsPageFrame(), "Upper is not page frame" );
- pColAttr = &GetUpper()->GetFormat()->GetCol();
- }
- else
- {
- OSL_ENSURE( IsFlyFrame() || IsSctFrame(), "Columns not in fly or section" );
- pColAttr = &GetFormat()->GetCol();
- }
+ if ( !(( (aRectFnSet.IsVert() && bHeightChgd) || (! aRectFnSet.IsVert() && bWidthChgd) ) &&
+ Lower()->IsColumnFrame()) )
+ return;
- if ( pColAttr->IsOrtho() && pColAttr->GetNumCols() > 1 )
- AdjustColumns( pColAttr, false );
+ // get column attribute
+ const SwFormatCol* pColAttr = nullptr;
+ if ( IsPageBodyFrame() )
+ {
+ OSL_ENSURE( GetUpper()->IsPageFrame(), "Upper is not page frame" );
+ pColAttr = &GetUpper()->GetFormat()->GetCol();
+ }
+ else
+ {
+ OSL_ENSURE( IsFlyFrame() || IsSctFrame(), "Columns not in fly or section" );
+ pColAttr = &GetFormat()->GetCol();
}
+
+ if ( pColAttr->IsOrtho() && pColAttr->GetNumCols() > 1 )
+ AdjustColumns( pColAttr, false );
}
/** "Formats" the Frame; Frame and PrtArea.
@@ -3393,83 +3393,83 @@ void SwLayoutFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBord
(this->*fnRect->fnSetYMargins)( nUpper, nLower );
}
- if ( !isFrameAreaSizeValid() )
+ if ( isFrameAreaSizeValid() )
+ return;
+
+ if ( !HasFixSize() )
{
- if ( !HasFixSize() )
+ const SwTwips nBorder = nUpper + nLower;
+ const SwFormatFrameSize &rSz = GetFormat()->GetFrameSize();
+ SwTwips nMinHeight = rSz.GetHeightSizeType() == SwFrameSize::Minimum ? rSz.GetHeight() : 0;
+ do
{
- const SwTwips nBorder = nUpper + nLower;
- const SwFormatFrameSize &rSz = GetFormat()->GetFrameSize();
- SwTwips nMinHeight = rSz.GetHeightSizeType() == SwFrameSize::Minimum ? rSz.GetHeight() : 0;
- do
+ setFrameAreaSizeValid(true);
+
+ //The size in VarSize is calculated using the content plus the
+ // borders.
+ SwTwips nRemaining = 0;
+ SwFrame *pFrame = Lower();
+ while ( pFrame )
+ { nRemaining += (pFrame->getFrameArea().*fnRect->fnGetHeight)();
+ if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
+ // This TextFrame would like to be a bit bigger
+ nRemaining += static_cast<SwTextFrame*>(pFrame)->GetParHeight()
+ - (pFrame->getFramePrintArea().*fnRect->fnGetHeight)();
+ else if( pFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pFrame)->IsUndersized() )
+ nRemaining += static_cast<SwSectionFrame*>(pFrame)->Undersize();
+ pFrame = pFrame->GetNext();
+ }
+ nRemaining += nBorder;
+ nRemaining = std::max( nRemaining, nMinHeight );
+ const SwTwips nDiff = nRemaining-(getFrameArea().*fnRect->fnGetHeight)();
+ const long nOldLeft = (getFrameArea().*fnRect->fnGetLeft)();
+ const long nOldTop = (getFrameArea().*fnRect->fnGetTop)();
+ if ( nDiff )
{
- setFrameAreaSizeValid(true);
-
- //The size in VarSize is calculated using the content plus the
- // borders.
- SwTwips nRemaining = 0;
- SwFrame *pFrame = Lower();
- while ( pFrame )
- { nRemaining += (pFrame->getFrameArea().*fnRect->fnGetHeight)();
- if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
- // This TextFrame would like to be a bit bigger
- nRemaining += static_cast<SwTextFrame*>(pFrame)->GetParHeight()
- - (pFrame->getFramePrintArea().*fnRect->fnGetHeight)();
- else if( pFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pFrame)->IsUndersized() )
- nRemaining += static_cast<SwSectionFrame*>(pFrame)->Undersize();
- pFrame = pFrame->GetNext();
- }
- nRemaining += nBorder;
- nRemaining = std::max( nRemaining, nMinHeight );
- const SwTwips nDiff = nRemaining-(getFrameArea().*fnRect->fnGetHeight)();
- const long nOldLeft = (getFrameArea().*fnRect->fnGetLeft)();
- const long nOldTop = (getFrameArea().*fnRect->fnGetTop)();
- if ( nDiff )
- {
- if ( nDiff > 0 )
- Grow( nDiff );
- else
- Shrink( -nDiff );
- //Updates the positions using the fast channel.
- MakePos();
- }
- //Don't exceed the bottom edge of the Upper.
- if ( GetUpper() && (getFrameArea().*fnRect->fnGetHeight)() )
- {
- const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
- if( (this->*fnRect->fnSetLimit)( nLimit ) &&
- nOldLeft == (getFrameArea().*fnRect->fnGetLeft)() &&
- nOldTop == (getFrameArea().*fnRect->fnGetTop)() )
- {
- setFrameAreaSizeValid(true);
- setFramePrintAreaValid(true);
- }
- }
- } while ( !isFrameAreaSizeValid() );
- }
- else if (GetType() & FRM_HEADFOOT)
- {
- do
- { if ( getFrameArea().Height() != pAttrs->GetSize().Height() )
+ if ( nDiff > 0 )
+ Grow( nDiff );
+ else
+ Shrink( -nDiff );
+ //Updates the positions using the fast channel.
+ MakePos();
+ }
+ //Don't exceed the bottom edge of the Upper.
+ if ( GetUpper() && (getFrameArea().*fnRect->fnGetHeight)() )
+ {
+ const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
+ if( (this->*fnRect->fnSetLimit)( nLimit ) &&
+ nOldLeft == (getFrameArea().*fnRect->fnGetLeft)() &&
+ nOldTop == (getFrameArea().*fnRect->fnGetTop)() )
{
- ChgSize( Size( getFrameArea().Width(), pAttrs->GetSize().Height()));
+ setFrameAreaSizeValid(true);
+ setFramePrintAreaValid(true);
}
+ }
+ } while ( !isFrameAreaSizeValid() );
+ }
+ else if (GetType() & FRM_HEADFOOT)
+ {
+ do
+ { if ( getFrameArea().Height() != pAttrs->GetSize().Height() )
+ {
+ ChgSize( Size( getFrameArea().Width(), pAttrs->GetSize().Height()));
+ }
- setFrameAreaSizeValid(true);
- MakePos();
- } while ( !isFrameAreaSizeValid() );
- }
- else
- {
setFrameAreaSizeValid(true);
- }
+ MakePos();
+ } while ( !isFrameAreaSizeValid() );
+ }
+ else
+ {
+ setFrameAreaSizeValid(true);
+ }
- // While updating the size, PrtArea might be invalidated.
- if (!isFramePrintAreaValid())
- {
- setFramePrintAreaValid(true);
- (this->*fnRect->fnSetXMargins)(nLeft, nRight);
- (this->*fnRect->fnSetYMargins)(nUpper, nLower);
- }
+ // While updating the size, PrtArea might be invalidated.
+ if (!isFramePrintAreaValid())
+ {
+ setFramePrintAreaValid(true);
+ (this->*fnRect->fnSetXMargins)(nLeft, nRight);
+ (this->*fnRect->fnSetYMargins)(nUpper, nLower);
}
}
@@ -3514,27 +3514,29 @@ void SwLayoutFrame::InvaPercentLowers( SwTwips nDiff )
::InvaPercentFlys( this, nDiff );
SwFrame *pFrame = ContainsContent();
- if ( pFrame )
- do
+ if ( !pFrame )
+ return;
+
+ do
+ {
+ if ( pFrame->IsInTab() && !IsTabFrame() )
{
- if ( pFrame->IsInTab() && !IsTabFrame() )
- {
- SwFrame *pTmp = pFrame->FindTabFrame();
- OSL_ENSURE( pTmp, "Where's my TabFrame?" );
- if( IsAnLower( pTmp ) )
- pFrame = pTmp;
- }
+ SwFrame *pTmp = pFrame->FindTabFrame();
+ OSL_ENSURE( pTmp, "Where's my TabFrame?" );
+ if( IsAnLower( pTmp ) )
+ pFrame = pTmp;
+ }
- if ( pFrame->IsTabFrame() )
- {
- const SwFormatFrameSize &rSz = static_cast<SwLayoutFrame*>(pFrame)->GetFormat()->GetFrameSize();
- if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
- pFrame->InvalidatePrt();
- }
- else if ( pFrame->GetDrawObjs() )
- ::InvaPercentFlys( pFrame, nDiff );
- pFrame = pFrame->FindNextCnt();
- } while ( pFrame && IsAnLower( pFrame ) ) ;
+ if ( pFrame->IsTabFrame() )
+ {
+ const SwFormatFrameSize &rSz = static_cast<SwLayoutFrame*>(pFrame)->GetFormat()->GetFrameSize();
+ if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
+ pFrame->InvalidatePrt();
+ }
+ else if ( pFrame->GetDrawObjs() )
+ ::InvaPercentFlys( pFrame, nDiff );
+ pFrame = pFrame->FindNextCnt();
+ } while ( pFrame && IsAnLower( pFrame ) ) ;
}
long SwLayoutFrame::CalcRel( const SwFormatFrameSize &rSz ) const
@@ -4225,50 +4227,50 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode(
std::set<sal_uLong> *const pSkipped)
{
auto const pMerged(rFrame.GetMergedPara());
- if (pMerged
+ if (!(pMerged
// do this only *once*, for the *last* frame
// otherwise AppendObj would create multiple frames for fly-frames!
- && !rFrame.GetFollow())
- {
- assert(pMerged->pFirstNode->GetIndex() <= rTextNode.GetIndex()
- && rTextNode.GetIndex() <= pMerged->pLastNode->GetIndex());
- // add visible flys in non-first node to merged frame
- // (hidden flys remain and are deleted via DelFrames())
- SwFrameFormats& rTable(*rTextNode.GetDoc()->GetSpzFrameFormats());
- SwPageFrame *const pPage(rFrame.FindPageFrame());
- std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin());
- std::vector<sw::Extent>::const_iterator iter(iterFirst);
- SwTextNode const* pNode(pMerged->pFirstNode);
- for ( ; ; ++iter)
+ && !rFrame.GetFollow()))
+ return;
+
+ assert(pMerged->pFirstNode->GetIndex() <= rTextNode.GetIndex()
+ && rTextNode.GetIndex() <= pMerged->pLastNode->GetIndex());
+ // add visible flys in non-first node to merged frame
+ // (hidden flys remain and are deleted via DelFrames())
+ SwFrameFormats& rTable(*rTextNode.GetDoc()->GetSpzFrameFormats());
+ SwPageFrame *const pPage(rFrame.FindPageFrame());
+ std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin());
+ std::vector<sw::Extent>::const_iterator iter(iterFirst);
+ SwTextNode const* pNode(pMerged->pFirstNode);
+ for ( ; ; ++iter)
+ {
+ if (iter == pMerged->extents.end()
+ || iter->pNode != pNode)
{
- if (iter == pMerged->extents.end()
- || iter->pNode != pNode)
+ AddRemoveFlysForNode(rFrame, rTextNode, pSkipped, rTable, pPage,
+ pNode, iterFirst, iter,
+ pMerged->pFirstNode, pMerged->pLastNode);
+ sal_uLong const until = iter == pMerged->extents.end()
+ ? pMerged->pLastNode->GetIndex() + 1
+ : iter->pNode->GetIndex();
+ for (sal_uLong i = pNode->GetIndex() + 1; i < until; ++i)
{
- AddRemoveFlysForNode(rFrame, rTextNode, pSkipped, rTable, pPage,
- pNode, iterFirst, iter,
- pMerged->pFirstNode, pMerged->pLastNode);
- sal_uLong const until = iter == pMerged->extents.end()
- ? pMerged->pLastNode->GetIndex() + 1
- : iter->pNode->GetIndex();
- for (sal_uLong i = pNode->GetIndex() + 1; i < until; ++i)
- {
- // let's show at-para flys on nodes that contain start/end of
- // redline too, even if there's no text there
- SwNode const*const pTmp(pNode->GetNodes()[i]);
- if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
- {
- AddRemoveFlysForNode(rFrame, rTextNode, pSkipped,
- rTable, pPage, pTmp->GetTextNode(), iter, iter,
- pMerged->pFirstNode, pMerged->pLastNode);
- }
- }
- if (iter == pMerged->extents.end())
+ // let's show at-para flys on nodes that contain start/end of
+ // redline too, even if there's no text there
+ SwNode const*const pTmp(pNode->GetNodes()[i]);
+ if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
{
- break;
+ AddRemoveFlysForNode(rFrame, rTextNode, pSkipped,
+ rTable, pPage, pTmp->GetTextNode(), iter, iter,
+ pMerged->pFirstNode, pMerged->pLastNode);
}
- pNode = iter->pNode;
- iterFirst = iter;
}
+ if (iter == pMerged->extents.end())
+ {
+ break;
+ }
+ pNode = iter->pNode;
+ iterFirst = iter;
}
}
}