sw/qa/extras/layout/data/nested-sections.fodt | 157 ++++++++++++++++++++++++++ sw/qa/extras/layout/layout3.cxx | 37 ++++++ sw/source/core/inc/sectfrm.hxx | 10 + sw/source/core/layout/calcmove.cxx | 20 +-- sw/source/core/layout/sectfrm.cxx | 12 + 5 files changed, 223 insertions(+), 13 deletions(-)
New commits: commit 528d5c8e0b9401ba945967e66775aea17aec7d00 Author: Michael Stahl <[email protected]> AuthorDate: Tue Sep 23 16:19:36 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Sep 24 13:41:07 2025 +0200 sw: layout: when positioning SwSectionFrame, ignore dead prev sections The place where it went wrong was in a second layout iteration when after positioning some objects everything was moved down, in SwSectionFrame::SimpleFormat(), where an empty section frame 72 of the 1st outer section was the prev of the 2nd outer section frame 73, and was itself not positioned properly. Apparently this empty section frame is inserted by InsertCnt_() but of course empty section frames can happen in other ways too. (reportedly regression from commit a85bd1bc9305af059d880ee422a656a3d9ce1b0b) Change-Id: I7513a2171fe4f3763f7b73b2e4368032e015c495 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191410 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/qa/extras/layout/data/nested-sections.fodt b/sw/qa/extras/layout/data/nested-sections.fodt new file mode 100644 index 000000000000..cb27f13fd9d8 --- /dev/null +++ b/sw/qa/extras/layout/data/nested-sections.fodt @@ -0,0 +1,157 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:c alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns: meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0cm" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + </text:outline-style> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties fo:background-color="#81d41a" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + <style:background-image/> + </style:section-properties> + </style:style> + <style:style style:name="Sect2" style:family="section"> + <style:section-properties fo:background-color="#00a933" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + <style:background-image/> + </style:section-properties> + </style:style> + <style:style style:name="Sect3" style:family="section"> + <style:section-properties fo:background-color="#77caee" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + <style:background-image/> + </style:section-properties> + </style:style> + <style:style style:name="gr1" style:family="graphic"> + <style:graphic-properties draw:textarea-horizontal-align="justify" draw:textarea-vertical-align="middle" draw:auto-grow-height="false" fo:min-height="2.499cm" fo:min-width="3.099cm" loext:decorative="false" style:run-through="foreground" style:wrap="none" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" style:flow-with-text="false"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="10.5cm" fo:page-height="14.801cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> + </office:master-styles> + <office:body> + <office:text text:use-soft-page-breaks="true"> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + <text:sequence-decl text:display-outline-level="0" text:name="Figure"/> + </text:sequence-decls> + <text:section text:style-name="Sect1" text:name="Section1"> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"><draw:custom-shape text:anchor-type="paragraph" draw:z-index="0" draw:name="Shape 1" draw:style-name="gr1" svg:width="3.1cm" svg:height="2.5cm" svg:x="2.559cm" svg:y="0.09cm"> + <text:p/> + <draw:enhanced-geometry svg:viewBox="0 0 21600 21600" draw:type="rectangle" draw:enhanced-path="M 0 0 L 21600 0 21600 21600 0 21600 0 0 Z N"/> + </draw:custom-shape>Outer 1</text:p> + <text:section text:style-name="Sect2" text:name="Section2"> + <text:p text:style-name="Standard">Inner 1</text:p> + <text:p text:style-name="Standard">more</text:p> + </text:section> + </text:section> + <text:section text:style-name="Sect3" text:name="Section4"> + <text:p text:style-name="Standard">Outer 2</text:p> + <text:p text:style-name="Standard"><text:soft-page-break/>more2</text:p> + </text:section> + <text:p text:style-name="Standard"/> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 20185ad41211..9ad3c18412fd 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -137,6 +137,43 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf120287) assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testNestedSectionOverlap) +{ + createSwDoc("nested-sections.fodt"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + SwTwips nOuterSection1Bottom + = getXPath(pXmlDoc, "/root/page[1]/body/section[1]/infos/bounds", "bottom").toInt32(); + SwTwips nInnerSection1Top + = getXPath(pXmlDoc, "/root/page[1]/body/section[2]/infos/bounds", "top").toInt32(); + SwTwips nInnerSection1Bottom + = getXPath(pXmlDoc, "/root/page[1]/body/section[2]/infos/bounds", "bottom").toInt32(); + SwTwips nOuterSection2Top + = getXPath(pXmlDoc, "/root/page[1]/body/section[3]/infos/bounds", "top").toInt32(); + + SwTwips nOuterSection1TextBottom + = getXPath(pXmlDoc, "/root/page[1]/body/section[1]/txt[13]/infos/bounds", "bottom") + .toInt32(); + CPPUNIT_ASSERT_EQUAL(nOuterSection1Bottom, nOuterSection1TextBottom); + + SwTwips nInnerSection1TextTop + = getXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[1]/infos/bounds", "top").toInt32(); + CPPUNIT_ASSERT_EQUAL(nInnerSection1Top, nInnerSection1TextTop); + SwTwips nInnerSection1TextBottom + = getXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[2]/infos/bounds", "bottom") + .toInt32(); + CPPUNIT_ASSERT_EQUAL(nInnerSection1Bottom, nInnerSection1TextBottom); + + SwTwips nOuterSection2TextTop + = getXPath(pXmlDoc, "/root/page[1]/body/section[3]/txt[1]/infos/bounds", "top").toInt32(); + CPPUNIT_ASSERT_EQUAL(nOuterSection2Top, nOuterSection2TextTop); + + // the problem was that the outer section 2 was positioned above inner 1 + CPPUNIT_ASSERT_EQUAL(nOuterSection1Bottom + 1, nInnerSection1Top); + CPPUNIT_ASSERT_EQUAL(nInnerSection1Bottom + 1, nOuterSection2Top); +} + auto getXPathIntAttributeValue(xmlXPathContextPtr pXmlXpathCtx, char const* const pXPath) -> sal_Int32 { diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 4222a6e6443d..b8361ac93465 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -191,6 +191,16 @@ inline const SwContentFrame *SwSectionFrame::FindLastContent() const return const_cast<SwSectionFrame*>(this)->FindLastContent(); } +namespace sw { + +/** GetPrev() but ignore dead empty SectionFrames + @param bSectPrev if true, and pFrame is first child of section frame, + get section frame's prev + */ +SwFrame* PrevSkipDead(SwFrame* pFrame, bool bSectPrv); + +} // namespace sw + #endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 6aafb9826e22..0c71e22d5e97 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -521,8 +521,10 @@ void SwFrame::PrepareCursor() Calc(getRootFrame()->GetCurrShell() ? getRootFrame()->GetCurrShell()->GetOut() : nullptr); } +namespace sw { + // Here we return GetPrev(); however we will ignore empty SectionFrames -static SwFrame* lcl_Prev( SwFrame* pFrame, bool bSectPrv = true ) +SwFrame* PrevSkipDead(SwFrame *const pFrame, bool const bSectPrv) { SwFrame* pRet = pFrame->GetPrev(); if( !pRet && pFrame->GetUpper() && pFrame->GetUpper()->IsSctFrame() && @@ -534,12 +536,14 @@ static SwFrame* lcl_Prev( SwFrame* pFrame, bool bSectPrv = true ) return pRet; } +} // namespace sw + static SwFrame* lcl_NotHiddenPrev( SwFrame* pFrame ) { SwFrame *pRet = pFrame; do { - pRet = lcl_Prev( pRet ); + pRet = ::sw::PrevSkipDead(pRet, true); } while ( pRet && pRet->IsHiddenNow() ); return pRet; } @@ -551,7 +555,7 @@ void SwFrame::MakePos() setFrameAreaPositionValid(true); bool bUseUpper = false; - SwFrame* pPrv = lcl_Prev( this ); + SwFrame* pPrv = ::sw::PrevSkipDead(this, true); if ( pPrv && ( !pPrv->IsContentFrame() || ( static_cast<SwContentFrame*>(pPrv)->GetFollow() != this ) ) @@ -574,7 +578,7 @@ void SwFrame::MakePos() } } - pPrv = lcl_Prev( this, false ); + pPrv = ::sw::PrevSkipDead(this, false); const SwFrameType nMyType = GetType(); SwRectFnSet aRectFnSet((IsCellFrame() && GetUpper() ? GetUpper() : this)); if ( !bUseUpper && pPrv ) @@ -637,7 +641,7 @@ void SwFrame::MakePos() { GetUpper()->Calc(getRootFrame()->GetCurrShell()->GetOut()); } - pPrv = lcl_Prev( this, false ); + pPrv = ::sw::PrevSkipDead(this, false); if ( !bUseUpper && pPrv ) { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); @@ -1415,7 +1419,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // Also move a paragraph forward, which is the first one inside a table cell. if ( bMoveFwdByObjPos && FindPageFrame()->GetPhyPageNum() < nToPageNum && - ( lcl_Prev( this ) || + ( ::sw::PrevSkipDead(this, true) || GetUpper()->IsCellFrame() || ( GetUpper()->IsSctFrame() && GetUpper()->GetUpper()->IsCellFrame() ) ) && @@ -1425,7 +1429,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) MoveFwd( bMakePage, false ); } } - else if (auto* prev = lcl_Prev(this); prev && IsMoveable()) + else if (auto *const prev{::sw::PrevSkipDead(this, true)}; prev && IsMoveable()) { // If a Follow sits next to its Master and doesn't fit, we know it can be moved right now. bMovedFwd = true; @@ -1645,7 +1649,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) auto const pTemp(GetIndPrev()); auto const bTemp(pTemp && pTemp->isFrameAreaSizeValid() && pTemp->isFramePrintAreaValid()); - if ( !lcl_Prev( this ) && + if ( !::sw::PrevSkipDead(this, true) && !bMovedFwd && ( bMoveable || ( bFly && !bTab ) ) && ( !bFootnote || !GetUpper()->FindFootnoteFrame()->GetPrev() ) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index e905c81b6678..5d4b7eb173a5 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -418,7 +418,7 @@ void SwSectionFrame::Paste( SwFrame* pParent, SwFrame* pSibling ) if (bInserted) { pSect->Init(); - aRectFnSet.MakePos( *pSect, pSect->GetUpper(), pSect->GetPrev(), true); + aRectFnSet.MakePos(*pSect, pSect->GetUpper(), ::sw::PrevSkipDead(pSect, false), true); } if( !static_cast<SwLayoutFrame*>(pParent)->Lower() ) { @@ -561,6 +561,7 @@ SwSectionFrame* SwSectionFrame::SplitSect( SwFrame* pFrameStartAfter, SwFrame* p pNew->InsertBehind( pFramePutAfter->GetUpper(), pFramePutAfter ); pNew->Init(); SwRectFnSet aRectFnSet(this); + assert(!pFramePutAfter->IsSctFrame() || static_cast<SwSectionFrame*>(pFramePutAfter)->GetSection()); // it's not dead aRectFnSet.MakePos( *pNew, nullptr, pFramePutAfter, true ); // OD 25.03.2003 #108339# - restore content: // determine layout frame for restoring content after the initialization @@ -820,7 +821,7 @@ void SwSectionFrame::MakeAll(vcl::RenderContext* pRenderContext) if( GetUpper() ) { SwRectFnSet aRectFnSet(GetUpper()); - aRectFnSet.MakePos( *this, GetUpper(), GetPrev(), false ); + aRectFnSet.MakePos(*this, GetUpper(), ::sw::PrevSkipDead(this, false), false); } if (getFrameArea().Height() == 0) @@ -1264,11 +1265,12 @@ void SwSectionFrame::SimpleFormat() return; LockJoin(); SwRectFnSet aRectFnSet(this); - if( GetPrev() || GetUpper() ) + SwFrame *const pPrev{::sw::PrevSkipDead(this, false)}; + if (pPrev || GetUpper()) { // assure notifications on position changes. const SwLayNotify aNotify( this ); - aRectFnSet.MakePos( *this, GetUpper(), GetPrev(), false ); + aRectFnSet.MakePos(*this, GetUpper(), pPrev, false); setFrameAreaPositionValid(true); } SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper()); @@ -2204,7 +2206,7 @@ SwLayoutFrame *SwFrame::GetPrevSctLeaf() pNew->InsertBefore( pLayLeaf, nullptr ); pNew->Init(); SwRectFnSet aRectFnSet(pNew); - aRectFnSet.MakePos( *pNew, pLayLeaf, pNew->GetPrev(), true ); + aRectFnSet.MakePos(*pNew, pLayLeaf, ::sw::PrevSkipDead(pNew, false), true); pLayLeaf = FirstLeaf( pNew ); if( !pNew->Lower() ) // Format single column sections
