tdf#147666 sw: layout: no IsShortCut() if fly was moved to page
The problem was that the fly's anchor frame was moved to page 2, and
then IsShortCut() returns true for the anchor frame, which means only
the anchor frame itself is formatted, but not its fly.
Thus the fly remains invalid and positioned on page 1 when its rectangle
is passed to SwViewShell::VisPortChgd(), and only later it is properly
positioned.
(regression from commit eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf)
Change-Id: I9e0554bd0d9751b47a11a3917575d382139ee93a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155461
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 9c291ea8c63284fe5c344553fcb338e66c17c797)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155470
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 21496e2..ecce180 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1166,21 +1166,28 @@ bool SwLayAction::IsShortCut( SwPageFrame *&prPage )
}
// no shortcut, if at previous page
// an anchored object is registered, whose anchor is <pContent>.
else if ( prPage->GetPrev() )
else
{
SwSortedObjs* pObjs =
static_cast<SwPageFrame*>(prPage->GetPrev())->GetSortedObjs();
if ( pObjs )
auto const CheckFlys = [&bRet,pContent](SwPageFrame & rPage)
{
for (SwAnchoredObject* pObj : *pObjs)
SwSortedObjs *const pObjs(rPage.GetSortedObjs());
if (pObjs)
{
if ( pObj->GetAnchorFrameContainingAnchPos() == pContent )
for (SwAnchoredObject *const pObj : *pObjs)
{
bRet = false;
break;
if (pObj->GetAnchorFrameContainingAnchPos() == pContent)
{
bRet = false;
break;
}
}
}
};
if (prPage->GetPrev())
{
CheckFlys(*static_cast<SwPageFrame*>(prPage->GetPrev()));
}
CheckFlys(*prPage); // tdf#147666 also check this page
}
}
}