summaryrefslogtreecommitdiffstats
path: root/sw/source/core/layout/fly.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/layout/fly.cxx')
-rw-r--r--sw/source/core/layout/fly.cxx52
1 files changed, 30 insertions, 22 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index d23c30a0aa..db50a42de0 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -43,6 +43,7 @@
#include <svx/svdoashp.hxx>
#include <svx/svdpage.hxx>
#include <layouter.hxx>
+#include <layact.hxx>
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <viewimp.hxx>
@@ -99,10 +100,10 @@ SwTwips GetFlyAnchorBottom(SwFlyFrame* pFly, const SwFrame& rAnchor)
return 0;
}
- const auto& rFrameFormat = pFly->GetFrameFormat();
- const IDocumentSettingAccess& rIDSA = rFrameFormat.getIDocumentSettingAccess();
+ const auto* pFrameFormat = pFly->GetFrameFormat();
+ const IDocumentSettingAccess& rIDSA = pFrameFormat->getIDocumentSettingAccess();
// Allow overlap with bottom margin / footer only in case we're relative to the page frame.
- bool bVertPageFrame = rFrameFormat.GetVertOrient().GetRelationOrient() == text::RelOrientation::PAGE_FRAME;
+ bool bVertPageFrame = pFrameFormat->GetVertOrient().GetRelationOrient() == text::RelOrientation::PAGE_FRAME;
bool bInBody = rAnchor.IsInDocBody();
bool bLegacy = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN) && (bVertPageFrame || !bInBody);
if (bLegacy)
@@ -1271,7 +1272,7 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos )
const SwTextFrame *pAutoFrame = nullptr;
// #i34948# - handle also at-page and at-fly anchored
// Writer fly frames
- const RndStdIds eAnchorType = GetFrameFormat().GetAnchor().GetAnchorId();
+ const RndStdIds eAnchorType = GetFrameFormat()->GetAnchor().GetAnchorId();
if ( eAnchorType == RndStdIds::FLY_AT_PAGE )
{
aVert.SetVertOrient( text::VertOrientation::NONE );
@@ -1741,6 +1742,10 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
if (!SwObjectFormatter::FormatObj(*pAnchoredObj, pAnchorFrame, pAnchorPageFrame,
rShell.Imp()->IsAction() ? &rShell.Imp()->GetLayAction() : nullptr))
{
+ if (rShell.Imp()->IsAction() && rShell.Imp()->GetLayAction().IsAgain())
+ { // tdf#159015 will always fail, don't loop
+ return;
+ }
bRestartLayoutProcess = true;
break;
}
@@ -1759,13 +1764,13 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
{
OSL_FAIL( "::CalcContent(..) - loop detected, perform attribute changes to avoid the loop" );
// Prevent oscillation
- SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat();
- SwFormatSurround aAttr( rFormat.GetSurround() );
+ SwFrameFormat* pFormat = pAnchoredObj->GetFrameFormat();
+ SwFormatSurround aAttr( pFormat->GetSurround() );
if( css::text::WrapTextMode_THROUGH != aAttr.GetSurround() )
{
// When on auto position, we can only set it to
// flow through
- if ((rFormat.GetAnchor().GetAnchorId() ==
+ if ((pFormat->GetAnchor().GetAnchorId() ==
RndStdIds::FLY_AT_CHAR) &&
(css::text::WrapTextMode_PARALLEL ==
aAttr.GetSurround()))
@@ -1776,9 +1781,9 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
{
aAttr.SetSurround( css::text::WrapTextMode_PARALLEL );
}
- rFormat.LockModify();
- rFormat.SetFormatAttr( aAttr );
- rFormat.UnlockModify();
+ pFormat->LockModify();
+ pFormat->SetFormatAttr( aAttr );
+ pFormat->UnlockModify();
}
}
else
@@ -2054,7 +2059,7 @@ bool SwFlyFrame::IsShowUnfloatButton(SwWrtShell* pWrtSh) const
if (pWrtSh->GetViewOptions()->IsReadonly())
return false;
- const SdrObject *pObj = GetFrameFormat().FindRealSdrObject();
+ const SdrObject *pObj = GetFrameFormat()->FindRealSdrObject();
if (pObj == nullptr)
return false;
@@ -2594,12 +2599,15 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj )
{
// Notify accessible layout.
#if !ENABLE_WASM_STRIP_ACCESSIBILITY
- SwViewShell* pSh = getRootFrame()->GetCurrShell();
- if( pSh )
+ if (!mbInDtor)
{
- SwRootFrame* pLayout = getRootFrame();
- if (pLayout && pLayout->IsAnyShellAccessible())
- pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false);
+ SwViewShell* pSh = getRootFrame()->GetCurrShell();
+ if (pSh)
+ {
+ SwRootFrame* pLayout = getRootFrame();
+ if (pLayout && pLayout->IsAnyShellAccessible())
+ pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), false);
+ }
}
#endif
@@ -2631,7 +2639,7 @@ void SwFrame::InvalidateObjs( const bool _bNoInvaOfAsCharAnchoredObjs )
for (SwAnchoredObject* pAnchoredObj : *GetDrawObjs())
{
if ( _bNoInvaOfAsCharAnchoredObjs &&
- (pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
+ (pAnchoredObj->GetFrameFormat()->GetAnchor().GetAnchorId()
== RndStdIds::FLY_AS_CHAR) )
{
continue;
@@ -2738,7 +2746,7 @@ void SwLayoutFrame::NotifyLowerObjs( const bool _bUnlockPosOfObjs )
bool isPositionedByHF(false);
if (IsHeaderFrame() || IsFooterFrame())
{
- auto const nO(pObj->GetFrameFormat().GetVertOrient().GetRelationOrient());
+ auto const nO(pObj->GetFrameFormat()->GetVertOrient().GetRelationOrient());
if (nO == text::RelOrientation::PAGE_PRINT_AREA
|| nO == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM
|| nO == text::RelOrientation::PAGE_PRINT_AREA_TOP)
@@ -3093,17 +3101,17 @@ void SwFlyFrame::InvalidateObjPos()
InvalidateObjRectWithSpaces();
}
-SwFrameFormat& SwFlyFrame::GetFrameFormat()
+SwFrameFormat* SwFlyFrame::GetFrameFormat()
{
OSL_ENSURE( GetFormat(),
"<SwFlyFrame::GetFrameFormat()> - missing frame format -> crash." );
- return *GetFormat();
+ return GetFormat();
}
-const SwFrameFormat& SwFlyFrame::GetFrameFormat() const
+const SwFrameFormat* SwFlyFrame::GetFrameFormat() const
{
OSL_ENSURE( GetFormat(),
"<SwFlyFrame::GetFrameFormat()> - missing frame format -> crash." );
- return *GetFormat();
+ return GetFormat();
}
SwRect SwFlyFrame::GetObjRect() const