[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Aug 1 09:43:47 UTC 2020
sw/source/core/layout/anchoreddrawobject.cxx | 164 +--
sw/source/core/layout/anchoredobject.cxx | 228 ++--
sw/source/core/layout/atrfrm.cxx | 302 ++---
sw/source/core/layout/calcmove.cxx | 438 ++++----
sw/source/core/layout/colfrm.cxx | 44
sw/source/core/layout/findfrm.cxx | 98 -
sw/source/core/layout/fly.cxx | 318 ++---
sw/source/core/layout/flycnt.cxx | 362 +++---
sw/source/core/layout/flyincnt.cxx | 34
sw/source/core/layout/flylay.cxx | 74 -
sw/source/core/layout/frmtool.cxx | 366 +++---
sw/source/core/layout/ftnfrm.cxx | 630 +++++------
sw/source/core/layout/layact.cxx | 52
sw/source/core/layout/laycache.cxx | 346 +++---
sw/source/core/layout/objectformattertxtfrm.cxx | 36
sw/source/core/layout/pagechg.cxx | 202 +--
sw/source/core/layout/paintfrm.cxx | 1290 ++++++++++++------------
sw/source/core/layout/sectfrm.cxx | 296 ++---
sw/source/core/layout/ssfrm.cxx | 180 +--
sw/source/core/layout/tabfrm.cxx | 192 +--
sw/source/core/layout/wsfrm.cxx | 688 ++++++------
21 files changed, 3174 insertions(+), 3166 deletions(-)
New commits:
commit a0ec43251e8b8a0805306ca5ad86794550916fce
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:35:22 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Aug 1 11:43:08 2020 +0200
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 at collabora.co.uk>
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() );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list