sw: fix hiding of flys in hidden sections, part 2

Didn't notice that this depends on a global variable "bObjsDirect" so it
only works for some documents; move the HideAndShowObjects() call to the
end so it works in all cases.

(follow-up to commit 8a13277f79)

Change-Id: I26a7cecdb660179f3ac1c3ea1e5d19067806b741
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172915
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl
2024-09-05 17:24:23 +02:00
parent 295e103964
commit e2f3ba12c2
+14 -11
View File
@@ -1587,6 +1587,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
//the SwActualSection class has a member, which points to an upper(section).
//When the "inner" section finishes, the upper will used instead.
std::vector<SwSectionFrame *> newHiddenSections;
// Do not consider the end node. The caller (Section/MakeFrames()) has to
// ensure that the end of this range is positioned before EndIndex!
for ( ; nEndIndex == SwNodeOffset(0) || nIndex < nEndIndex; ++nIndex)
@@ -1908,12 +1910,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pActualSection.reset(pActualSection->GetUpper());
pLay = pLay->FindSctFrame();
if (pLay->IsHiddenNow())
{ // flys were created visible
for (SwFlowFrame * pSect = SwFlowFrame::CastFlowFrame(pLay);
pSect; pSect = pSect->GetPrecede())
{ // flys were created visible
pSect->GetFrame().HideAndShowObjects();
}
{
newHiddenSections.push_back(static_cast<SwSectionFrame*>(pLay));
}
if ( pActualSection )
{
@@ -1948,11 +1946,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
}
else if (pOuterSectionFrame->IsHiddenNow())
{
for (SwFlowFrame * pSect = SwFlowFrame::CastFlowFrame(pOuterSectionFrame);
pSect; pSect = pSect->GetPrecede())
{ // flys were created visible
pSect->GetFrame().HideAndShowObjects();
}
newHiddenSections.push_back(pOuterSectionFrame);
}
}
else
@@ -2025,6 +2019,15 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
bObjsDirect = true;
}
// do it after AppendAllObjs()
for (SwSectionFrame * pNew : newHiddenSections)
{
for (SwFlowFrame * pSect = pNew; pSect; pSect = pSect->GetPrecede())
{ // flys were created visible; section may be paginated so iterate
pSect->GetFrame().HideAndShowObjects();
}
}
if( pPageMaker )
{
pPageMaker->CheckFlyCache( pPage );