configure.ac | 2 sw/qa/extras/layout/data/hidden-para-as-char-fly.fodt | 279 +++++++++++ sw/qa/extras/layout/data/hidden-para-follow-frame.fodt | 113 ++++ sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt | 148 +++++ sw/qa/extras/layout/layout3.cxx | 238 +++++++++ sw/qa/extras/uiwriter/data/tdf165351.fodt | 158 ++++++ sw/qa/extras/uiwriter/uiwriter9.cxx | 18 sw/source/core/docnode/section.cxx | 4 sw/source/core/inc/flowfrm.hxx | 3 sw/source/core/inc/frame.hxx | 22 sw/source/core/inc/txtfrm.hxx | 3 sw/source/core/layout/calcmove.cxx | 107 +++- sw/source/core/layout/colfrm.cxx | 16 sw/source/core/layout/flowfrm.cxx | 53 +- sw/source/core/layout/fly.cxx | 5 sw/source/core/layout/frmtool.cxx | 7 sw/source/core/layout/layact.cxx | 2 sw/source/core/layout/paintfrm.cxx | 49 - sw/source/core/layout/sectfrm.cxx | 15 sw/source/core/layout/ssfrm.cxx | 36 - sw/source/core/layout/tabfrm.cxx | 24 sw/source/core/layout/trvlfrm.cxx | 1 sw/source/core/layout/wsfrm.cxx | 66 +- sw/source/core/text/txtfrm.cxx | 21 24 files changed, 1233 insertions(+), 157 deletions(-)
New commits: commit 44afcdd3b7ff415fbe1ce7cf8eafad7205bf147c Author: Thorsten Behrens <thorsten.behr...@collabora.com> AuthorDate: Thu Aug 28 02:42:08 2025 +0200 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 03:18:47 2025 +0200 Release 24.2.17 Change-Id: I3a1bae71d4e320c6f3c3f085d31b910d80e0ac47 diff --git a/configure.ac b/configure.ac index 7e1dfdc19a6b..cb737a75cee9 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([LibreOffice],[24.2.16.0],[],[],[http://documentfoundation.org/]) +AC_INIT([LibreOffice],[24.2.17.0],[],[],[http://documentfoundation.org/]) dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard commit 6ba6e2203d3ab6b78d9086f5e30937fde6b254e2 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Feb 28 19:19:28 2025 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 03:18:47 2025 +0200 tdf#165351 sw: fix crash after Undo of inserting table row... ... if an existing row of the table has a drawing object anchored to it as character, and the table is in a fly frame. The problem is that the SwTextFrame inside the table cell doesn't have the mbInfFly flag set, because SetInfFlags() was called too early, when the frame was attached to its SwCellFrame but the SwCellFrame didn't have an upper yet: 0 SwFrame::SetInfFlags () at sw/source/core/layout/findfrm.cxx:1600 1 SwFrame::IsInSct () at sw/source/core/inc/frame.hxx:1009 2 SwFrame::FindSctFrame () at sw/source/core/inc/frame.hxx:1178 3 SwFrame::IsHiddenNow () at sw/source/core/layout/trvlfrm.cxx:1734 4 SwTextFrame::IsHiddenNowImpl () at sw/source/core/text/txtfrm.cxx:1514 5 SwTextFrame::Prepare (ePrep=PrepareHint::FlyFrameAttributesChanged) at sw/source/core/text/txtfrm.cxx:3031 6 SwAnchoredDrawObject::InvalidateObjPos () at sw/source/core/layout/anchoreddrawobject.cxx:595 7 SwFrame::AppendDrawObj () at sw/source/core/layout/fly.cxx:2803 8 AppendObj () at sw/source/core/layout/frmtool.cxx:1079 9 AppendObjsOfNode () at sw/source/core/layout/frmtool.cxx:1277 10 AppendObjs () at sw/source/core/layout/frmtool.cxx:1330 11 InsertCnt_() at sw/source/core/layout/frmtool.cxx:1666 12 SwCellFrame::SwCellFrame () at sw/source/core/layout/tabfrm.cxx:5729 13 SwRowFrame::SwRowFrame () at sw/source/core/layout/tabfrm.cxx:4627 14 lcl_InsertRow () at sw/source/core/frmedt/tblsel.cxx:2053 15 FndBox_::MakeFrames () at sw/source/core/frmedt/tblsel.cxx:2402 16 SaveTable::CreateNew () at sw/source/core/undo/untbl.cxx:1100 17 SwUndoTableNdsChg::UndoImpl () at sw/source/core/undo/untbl.cxx:1783 Reset flags in InsertCnt_(). (regression from commit 0a3f5169acc6708c352cad0fa07fdb4af8c8b2dd) Conflicts: sw/qa/extras/uiwriter/uiwriter9.cxx Change-Id: I048196278b314ea516bd5a4877b3e86f696dfce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182367 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/uiwriter/data/tdf165351.fodt b/sw/qa/extras/uiwriter/data/tdf165351.fodt new file mode 100644 index 000000000000..0bd7a24a9a1a --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf165351.fodt @@ -0,0 +1,158 @@ +<?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:meta><meta:initial-creator>gcc</meta:initial-creator><meta:creation-date>2025-02-28T18:33:31.005687737</meta:creation-date><dc:date>2025-02-28T18:59:14.362239231</dc:date><dc:creator>gcc</dc:creator><meta:editing-duration>PT9M7S</meta:editing-duration><meta:editing-cycles>3</meta:editing-cycles><meta:generator>LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64 LibreOffice_project/8f30e038a6dd68b9085adaa637a95695a028d2d5</meta:generator><meta:document-statistic meta:table-count="1" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="2" meta:word-count="1" meta:character-count="4" meta:non-whitespace-character-count="4"/></office:meta> + <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" 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"/> + <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/> + </style:style> + <style:style style:name="Frame" style:family="graphic"> + <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" fo:margin-left="0.201cm" fo:margin-right="0.201cm" fo:margin-top="0.201cm" fo:margin-bottom="0.201cm" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" fo:background-color="transparent" draw:fill="none" draw:fill-color="#729fcf" fo:padding="0.15cm" fo:border="0.06pt solid #000000"/> + </style:style> + <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="Table1" style:family="table"> + <style:table-properties style:width="3.059cm" table:align="margins"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:column-width="3.059cm" style:rel-column-width="65535*"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border="0.5pt solid #000000"/> + </style:style> + <style:style style:name="Table1" style:family="table"> + <style:table-properties style:width="3.059cm" table:align="margins"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:column-width="3.059cm" style:rel-column-width="65535*"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border="0.5pt solid #000000"/> + </style:style> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties/> + </style:style> + <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame"> + <style:graphic-properties style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph" fo:padding="0.15cm" fo:border="0.06pt solid #000000"/> + </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="0.61cm" fo:min-width="1.506cm" loext:decorative="false" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" 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: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:p text:style-name="P1"><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="char" svg:width="3.362cm" draw:z-index="0"> + <draw:text-box fo:min-height="2.212cm"> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column table:style-name="Table1.A"/> + <table:table-row> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="Table_20_Contents"><draw:custom-shape text:anchor-type="as-char" draw:z-index="1" draw:name="Shape 1" draw:style-name="gr1" svg:width="1.507cm" svg:height="0.611cm"> + <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></text:p> + </table:table-cell> + </table:table-row> + </table:table> + </draw:text-box> + </draw:frame>body</text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 547140e6229d..4dca09e83e48 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -39,6 +39,7 @@ #include <fmtfsize.hxx> #include <fmtinfmt.hxx> #include <rootfrm.hxx> +#include <svx/svxids.hrc> namespace { @@ -307,6 +308,23 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, /*bXSelection=*/true); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf165351) +{ + createSwDoc("tdf165351.fodt"); + + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + + // Move the cursor into the fly frame + pWrtShell->GotoFly(u"Frame1"_ustr, FLYCNTTYPE_FRM, false); + pWrtShell->EndOfSection(); + pWrtShell->GoNextCell(/*bAppendLine=*/true); + pWrtShell->Undo(); + // getting this item crashed + SfxItemSet temp{ pDoc->GetAttrPool(), svl::Items<SID_RULER_LR_MIN_MAX, SID_RULER_LR_MIN_MAX> }; + pWrtShell->GetView().StateTabWin(temp); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) { // Given a document with a 1-cell table in another 1-cell table: diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 48d93fbabbfc..ada0795d1d23 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1659,7 +1659,12 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, pPrv = pFrame; if ( !pTable->empty() && bObjsDirect && !isFlyCreationSuppressed ) + { AppendObjs( pTable, nIndex, pFrame, pPage, pDoc ); + // tdf#165351 from SwCellFrame ctor, this may set inf flags + // before the SwCellFrame has an upper, so reset here + pFrame->InvalidateInfFlags(); + } } else if ( pNd->IsTableNode() ) { //Should we have encountered a table? commit 36de04abe04b7a367c4762e9a762dc495186e342 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Dec 6 14:24:12 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 03:18:47 2025 +0200 sw: layout: ignore Keep-With-Next on hidden frames, part3 SwTabFrame: :MakeAll(), SwRowFrame::ShouldRowKeepWithNext() Change-Id: I7cb6e558dc05736658a9bc75d6c735e6a47062b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177977 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 739530926d24..dd0f643fae34 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2210,7 +2210,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) && !pAttrs->GetAttrSet().GetKeep().GetValue() && AreAllRowsKeepWithNext(GetFirstNonHeadlineRow(), /*bCheckParents=*/false); // The beloved keep attribute - const bool bKeep = IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep); + const bool bKeep{!isHiddenNow && IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep)}; // Join follow table, if this table is not allowed to split: if ( bDontSplit ) @@ -2308,9 +2308,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } aNotify.SetLowersComplete( false ); } - SwFrame *pPre; - if ( bKeep || (nullptr != (pPre = FindPrev()) && - pPre->GetAttrSet()->GetKeep().GetValue()) ) + SwFrame const*const pPre{bKeep ? nullptr : FindPrevIgnoreHidden()}; + if (bKeep || (nullptr != pPre && pPre->GetAttrSet()->GetKeep().GetValue())) { m_bCalcLowers = true; } @@ -2665,7 +2664,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.emplace(SwFrame::GetCache(), this); pAttrs = oAccess->Get(); } - if (IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true) + if (!isHiddenNow + && IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true) && pLastRow->ShouldRowKeepWithNext()) { bFormat = true; @@ -5511,7 +5511,7 @@ bool SwRowFrame::ShouldRowKeepWithNext( const bool bCheckParents ) const const SwCellFrame* pCell = static_cast<const SwCellFrame*>(Lower()); const SwFrame* pText = pCell->Lower(); - return pText && pText->IsTextFrame() && + return pText && pText->IsTextFrame() && !pText->IsHiddenNow() && static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue(); } commit 2be18c78483d610fcb3d37dc286d62775c7ce5d8 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Dec 6 14:20:22 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 03:18:47 2025 +0200 sw: layout: ignore Keep-With-Next on hidden frames, part2 SwFrame::PrepareMake(), SwContentFrame::MakeAll(), SwContentFrame::WouldFit_() Change-Id: I2a909ac6d147668dddece97bd99e31fdddcf20eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177976 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index d8767e8ceb60..b4a465ad5e7d 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -304,9 +304,17 @@ void SwFrame::PrepareMake(vcl::RenderContext* pRenderContext) // There is no format of previous frame, if current frame is a table // frame and its previous frame wants to keep with it. - const bool bFormatPrev = !bTab || - !GetPrev() || - !GetPrev()->GetAttrSet()->GetKeep().GetValue(); + bool bFormatPrev{!bTab}; + if (!bFormatPrev) + { + SwFrame const* pPrev{this}; + do + { + pPrev = pPrev->GetPrev(); + } + while (pPrev && pPrev->IsHiddenNow()); + bFormatPrev = pPrev && !pPrev->GetAttrSet()->GetKeep().GetValue(); + } if ( bFormatPrev ) { SwFrame *pFrame = GetUpper()->Lower(); @@ -1341,7 +1349,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) oNotify->SetBordersJoinedWithPrev(); } - const bool bKeep = IsKeep(rAttrs.GetAttrSet().GetKeep(), GetBreakItem()); + const bool bKeep{!isHiddenNow && IsKeep(rAttrs.GetAttrSet().GetKeep(), GetBreakItem())}; std::unique_ptr<SwSaveFootnoteHeight> pSaveFootnote; if ( bFootnote ) @@ -1759,7 +1767,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if( nBottomDist >= 0 ) { - if ( bKeep && bMoveable ) + if (bKeep && bMoveable && !isHiddenNow) { // We make sure the successor will be formatted the same. // This way, we keep control until (almost) everything is stable, @@ -2086,8 +2094,18 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace, const SwFrame *pTmpPrev = pNewUpper->Lower(); if( pTmpPrev && pTmpPrev->IsFootnoteFrame() ) pTmpPrev = static_cast<const SwFootnoteFrame*>(pTmpPrev)->Lower(); - while ( pTmpPrev && pTmpPrev->GetNext() ) - pTmpPrev = pTmpPrev->GetNext(); + { + SwFrame const* pTmpNonHidden{pTmpPrev && pTmpPrev->IsHiddenNow() ? nullptr : pTmpPrev}; + while (pTmpPrev && pTmpPrev->GetNext()) + { + pTmpPrev = pTmpPrev->GetNext(); + if (!pTmpPrev->IsHiddenNow()) + { + pTmpNonHidden = pTmpPrev; + } + } + pTmpPrev = pTmpNonHidden; + } // tdf#156727 if the previous one has keep-with-next, ignore it on this one! bool const isIgnoreKeep(pTmpPrev && pTmpPrev->IsFlowFrame() @@ -2096,6 +2114,14 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace, do { + if (pFrame->IsHiddenNow()) + { // shortcut + assert(pFrame == this); + bRet = true; + pFrame = nullptr; + break; + } + // #i46181# SwTwips nSecondCheck = 0; SwTwips nOldSpace = nSpace; @@ -2261,8 +2287,8 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace, return true; } } - SwFrame *pNxt; - if( nullptr != (pNxt = pFrame->FindNext()) && pNxt->IsContentFrame() && + SwFrame *const pNxt{pFrame->FindNextIgnoreHidden()}; + if (nullptr != pNxt && pNxt->IsContentFrame() && ( !pFootnoteFrame || ( pNxt->IsInFootnote() && pNxt->FindFootnoteFrame()->GetAttr() == pFootnoteFrame->GetAttr() ) ) ) { @@ -2288,10 +2314,7 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace, pTmpPrev = nullptr; else { - if (pFrame->IsHiddenNow()) - pTmpPrev = lcl_NotHiddenPrev( pFrame ); - else - pTmpPrev = pFrame; + pTmpPrev = pFrame; } pFrame = static_cast<SwContentFrame*>(pNxt); } commit d318057fe1d54e96a9441ca22778437658e1a3af Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Dec 6 14:10:32 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 03:18:47 2025 +0200 sw: layout: ignore Keep-With-Next on hidden frames, part1 When a frame is hidden, don't consider it when evaluating keep-with-next attributes - this was the case for content in hidden sections before commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 ~SwFrameNotify() invalidating position of hidden frame with keep attribute causes layout loops. Also skip hidden frames in SwFlowFrame::IsKeepFwdMoveAllowed(), SwFlowFrame::CheckKeep(), SwFlowFrame::IsPrevObjMove(), SwFlowFrame::MoveBwd(), CalcContent(). Change-Id: I68556ba0a8e016d962399f3ce199e5eda0378867 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177975 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx index 3d271613bf6a..bfc99cc09961 100644 --- a/sw/source/core/inc/flowfrm.hxx +++ b/sw/source/core/inc/flowfrm.hxx @@ -184,6 +184,9 @@ public: SvxFormatBreakItem const& rBreak, bool bBreakCheck = false ) const; + SwFrame * FindPrevIgnoreHidden() const; + SwFrame * FindNextIgnoreHidden() const; + bool HasLockedFollow() const; bool HasParaSpaceAtPages( bool bSct ) const; diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index e3d6a7b7e4ad..e49af1e31549 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -131,7 +131,9 @@ bool SwFlowFrame::IsKeepFwdMoveAllowed( bool bIgnoreMyOwnKeepValue ) if ( bIgnoreMyOwnKeepValue && pFrame->GetIndPrev() ) pFrame = pFrame->GetIndPrev(); do - { if ( pFrame->GetAttrSet()->GetKeep().GetValue() ) + { + if (pFrame->GetAttrSet()->GetKeep().GetValue() + || pFrame->IsHiddenNow()) pFrame = pFrame->GetIndPrev(); else return true; @@ -150,22 +152,42 @@ void SwFlowFrame::CheckKeep() // it's possible for the whole troop to move back. SwFrame *pPre = m_rThis.GetIndPrev(); assert(pPre); + while (pPre && pPre->IsHiddenNow()) + { + pPre = pPre->GetIndPrev(); + } + if (!pPre) + { + return; + } if( pPre->IsSctFrame() ) { SwFrame *pLast = static_cast<SwSectionFrame*>(pPre)->FindLastContent(); + while (pLast && pLast->IsHiddenNow()) + { + pLast = pLast->GetIndPrev(); + } if( pLast && pLast->FindSctFrame() == pPre ) pPre = pLast; else return; } - SwFrame* pTmp; + SwFrame* pTmp{pPre}; bool bKeep; while ( (bKeep = pPre->GetAttrSet()->GetKeep().GetValue()) && - nullptr != ( pTmp = pPre->GetIndPrev() ) ) + nullptr != (pTmp = pTmp->GetIndPrev()) ) { + if (pTmp->IsHiddenNow()) + { + continue; + } if( pTmp->IsSctFrame() ) { SwFrame *pLast = static_cast<SwSectionFrame*>(pTmp)->FindLastContent(); + while (pLast && pLast->IsHiddenNow()) + { + pLast = pLast->GetIndPrev(); + } if( pLast && pLast->FindSctFrame() == pTmp ) pTmp = pLast; else @@ -236,6 +258,7 @@ bool SwFlowFrame::IsKeep(SvxFormatKeepItem const& rKeep, SvxFormatBreakItem const& rBreak, bool const bCheckIfLastRowShouldKeep) const { + assert(!m_rThis.IsHiddenNow()); // check it before? // 1. The keep attribute is ignored inside footnotes // 2. For compatibility reasons, the keep attribute is // ignored for frames inside table cells @@ -338,6 +361,26 @@ bool SwFlowFrame::IsKeep(SvxFormatKeepItem const& rKeep, return bKeep; } +SwFrame * SwFlowFrame::FindPrevIgnoreHidden() const +{ + SwFrame * pRet{m_rThis.FindPrev()}; + while (pRet && pRet->IsHiddenNow()) + { + pRet = pRet->FindPrev(); + } + return pRet; +} + +SwFrame * SwFlowFrame::FindNextIgnoreHidden() const +{ + SwFrame * pRet{m_rThis.FindNext()}; + while (pRet && pRet->IsHiddenNow()) + { + pRet = pRet->FindNext(); + } + return pRet; +} + sal_uInt8 SwFlowFrame::BwdMoveNecessary( const SwPageFrame *pPage, const SwRect &rRect ) { // The return value helps deciding whether we need to flow back (3), @@ -1188,7 +1231,7 @@ bool SwFlowFrame::IsPrevObjMove() const if( pSh && pSh->GetViewOptions()->getBrowseMode() ) return false; - SwFrame *pPre = m_rThis.FindPrev(); + SwFrame *const pPre{FindPrevIgnoreHidden()}; if ( pPre && pPre->GetDrawObjs() ) { @@ -2587,7 +2630,7 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat ) // keep with next frame and next frame is locked. // i#38232 - If next frame is a table, do *not* check, // if it's locked. - if ( pNewUpper && !IsFollow() && + if ( pNewUpper && !IsFollow() && !m_rThis.IsHiddenNow() && m_rThis.GetAttrSet()->GetKeep().GetValue() && m_rThis.GetIndNext() ) { SwFrame* pIndNext = m_rThis.GetIndNext(); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index fd95ce192cf7..b4b8fbafb18d 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1682,9 +1682,10 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) // frame due to its keep-attribute, if it can't move forward. // #i57765# - do not consider invalid previous // frame, if current frame has a column/page break before attribute. - SwFrame* pTmpPrev = pFrame->FindPrev(); + assert(pFrame->IsFlowFrame()); + SwFlowFrame* pTmpFlowFrame = SwFlowFrame::CastFlowFrame(pFrame); + SwFrame* pTmpPrev = pTmpFlowFrame->FindPrevIgnoreHidden(); SwFlowFrame* pTmpPrevFlowFrame = pTmpPrev && pTmpPrev->IsFlowFrame() ? SwFlowFrame::CastFlowFrame(pTmpPrev) : nullptr; - SwFlowFrame* pTmpFlowFrame = pFrame->IsFlowFrame() ? SwFlowFrame::CastFlowFrame(pFrame) : nullptr; bool bPrevInvalid = pTmpPrevFlowFrame && pTmpFlowFrame && !pTmpFlowFrame->IsFollow() && diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index d7d97c64c189..48d93fbabbfc 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -155,7 +155,7 @@ void SwFrameNotify::ImplDestroy() { if ( mbInvaKeep ) { - SwFrame *pPre = mpFrame->FindPrev(); + SwFrame *pPre = pFlow->FindPrevIgnoreHidden(); if ( pPre && pPre->IsFlowFrame() ) { // 1. pPre wants to keep with me: commit df8eca02fb3aa53b297eec26c5768879d28c373e Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Nov 29 11:49:39 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 02:37:26 2025 +0200 sw: layout: fix toggling Hidden Paragraphs not shrinking flys There are 2 as-char flys with 2 hidden paragraphs each, and when turning off show hidden paragraphs, the paragraphs shrink to height 0 but the flys don't - this is because due to other hidden paragraphs earlier, the position of the flys change and Shrink() is called before MakePos() and then it uses the old position to check and that results in a negative nRstHeight, so the upper doesn't actually shrink. Fix this by always calling MakePos() before MakeValidZeroHeight(). (presumably regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 or one of its follow-ups) Change-Id: I9a4ffadff02b6a2bc59c6a37aa15abec429e1068 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177524 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sw/qa/extras/layout/data/hidden-para-as-char-fly.fodt b/sw/qa/extras/layout/data/hidden-para-as-char-fly.fodt new file mode 100644 index 000000000000..a3a524691b5e --- /dev/null +++ b/sw/qa/extras/layout/data/hidden-para-as-char-fly.fodt @@ -0,0 +1,279 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:officeooo="http://openoffice.org/2009/office" 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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:dc="http://purl.org/dc/eleme nts/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0 " xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:creation-date>2024-11-29T14:11:48.126766636</meta:creation-date><dc:date>2024-11-29T14:16:02.135004394</dc:date><meta:editing-duration>PT4M14S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="2" meta:word-count="1" meta:character-count="3" meta:non-whitespace-character-count="3"/><meta:generator>CIB_OfficeDev/6.4.0.29$Linux_X86_64 LibreOffice_project/5374b230ff33d77a7f81d56046759f218a160036</meta:generator></office:meta> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item> + <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item> + <config:config-item config:name="ViewAreaWidth" config:type="long">24396</config:config-item> + <config:config-item config:name="ViewAreaHeight" config:type="long">15242</config:config-item> + <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item> + <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> + <config:config-item config:name="ViewLeft" config:type="long">4050</config:config-item> + <config:config-item config:name="ViewTop" config:type="long">3341</config:config-item> + <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item> + <config:config-item config:name="VisibleTop" config:type="long">0</config:config-item> + <config:config-item config:name="VisibleRight" config:type="long">24395</config:config-item> + <config:config-item config:name="VisibleBottom" config:type="long">15240</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item> + <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item> + <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item> + <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item> + <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item> + <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item> + <config:config-item config:name="ProtectFields" config:type="boolean">false</config:config-item> + <config:config-item config:name="ProtectBookmarks" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmptyDbFieldHidesPara" config:type="boolean">true</config:config-item> + <config:config-item config:name="DisableOffPagePositioning" config:type="boolean">false</config:config-item> + <config:config-item config:name="SubtractFlysAnchoredAtFlys" config:type="boolean">false</config:config-item> + <config:config-item config:name="PropLineSpacingShrinksFirstLine" config:type="boolean">true</config:config-item> + <config:config-item config:name="ApplyParagraphMarkFormatToNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="TreatSingleColumnBreakAsPageBreak" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="ContinuousEndnotes" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item> + <config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item> + <config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item> + <config:config-item config:name="HeaderSpacingBelowLastPara" config:type="boolean">false</config:config-item> + <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item> + <config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item> + <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item> + <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item> + <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item> + <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item> + <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item> + <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/> + <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item> + <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintFaxName" config:type="string"/> + <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/> + <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> + <config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item> + <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item> + <config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item> + <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrinterSetup" config:type="base64Binary"/> + <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item> + <config:config-item config:name="Rsid" config:type="int">1995778</config:config-item> + <config:config-item config:name="EmbeddedDatabaseName" config:type="string"/> + <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item> + <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item> + <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> + <config:config-item config:name="PrinterName" config:type="string"/> + <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item> + <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddParaLineSpacingToTableCells" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item> + <config:config-item config:name="SurroundTextWrapSmall" config:type="boolean">false</config:config-item> + <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item> + <config:config-item config:name="MsWordCompTrailingBlanks" config:type="boolean">false</config:config-item> + <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item> + <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/> + <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item> + <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item> + <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item> + <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> + <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddVerticalFrameOffsets" config:type="boolean">false</config:config-item> + <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item> + <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item> + <config:config-item config:name="RsidRoot" config:type="int">1995778</config:config-item> + <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item> + <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item> + <config:config-item config:name="MsWordCompMinLineHeightByFly" config:type="boolean">false</config:config-item> + <config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item> + <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> + <config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item> + <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item> + <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item> + <config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item> + </config:config-item-set> + </office:settings> + <office:scripts> + <office:script script:language="ooo:Basic"> + <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/> + </office:script> + </office:scripts> + <office:font-face-decls> + <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" style:font-family-generic="swiss"/> + <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="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Noto Sans CJK SC" svg:font-family="'Noto Sans CJK SC'" 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:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" 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" 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 Sans" 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" 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" 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 Sans" 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"/> + </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"/> + <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text"> + <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" fo:keep-with-next="always"/> + <style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC" style:font-family-asian="'Noto Sans CJK SC'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lucida Sans" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/> + </style:style> + <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> + <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" loext:contextual-spacing="false" fo:line-height="115%"/> + </style:style> + <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list"> + <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss"/> + </style:style> + <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" text:number-lines="false" text:line-number="0"/> + <style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss" style:font-size-complex="12pt" style:font-style-complex="italic"/> + </style:style> + <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"> + <style:paragraph-properties text:number-lines="false" text:line-number="0"/> + <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss"/> + </style:style> + <style:style style:name="Frame_20_contents" style:display-name="Frame contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"/> + <style:style style:name="Frame" style:family="graphic"> + <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" fo:margin-left="0.201cm" fo:margin-right="0.201cm" fo:margin-top="0.201cm" fo:margin-bottom="0.201cm" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" fo:padding="0.15cm" fo:border="0.06pt solid #000000"/> + </style:style> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="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" 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" 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" 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" 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" 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" 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" 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" 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" 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="P1" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties officeooo:rsid="001e7402" officeooo:paragraph-rsid="001e7402"/> + </style:style> + <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame"> + <style:graphic-properties style:vertical-pos="top" style:vertical-rel="baseline"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" 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:footnote-max-height="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> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <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:p text:style-name="P1">Foo</text:p> + <text:p text:style-name="P1"><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:hidden-paragraph text:condition="ooow:TRUE" text:is-hidden="true"/></text:p> + <text:p text:style-name="P1"><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="as-char" svg:width="2cm" draw:z-index="0"> + <draw:text-box fo:min-height="0.499cm"> + <text:p text:style-name="Frame_20_contents"/> + <text:p text:style-name="Frame_20_contents"><text:hidden-paragraph text:condition="ooow:TRUE" text:is-hidden="true"/></text:p> + </draw:text-box> + </draw:frame></text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 525186628dd4..7be0870637ab 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1839,6 +1839,39 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFollowFrame) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFlys) +{ + createSwDoc("hidden-para-as-char-fly.fodt"); + + uno::Sequence<beans::PropertyValue> argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } })); + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + uno::Sequence<beans::PropertyValue> args( + comphelper::InitPropertySequence({ { "Fieldnames", uno::Any(false) } })); + dispatchCommand(mxComponent, ".uno:Fieldnames", args); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt[3]/anchored/fly/infos/bounds", "height", u"724"); + } + + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // the problem was that this did not shrink + assertXPath(pXmlDoc, "/root/page/body/txt[3]/anchored/fly/infos/bounds", "height", u"448"); + } + + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt[3]/anchored/fly/infos/bounds", "height", u"724"); + } +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testSectionUnhide) { createSwDoc("hiddensection.fodt"); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 86240a4f1a0e..d8767e8ceb60 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -965,9 +965,6 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) const SwLayNotify aNotify( this ); bool bVert = IsVertical(); - if (IsHiddenNow()) - MakeValidZeroHeight(); - SwRectFnSet fnRect(IsNeighbourFrame() != bVert, IsVertLR(), IsVertLRBT()); std::optional<SwBorderAttrAccess> oAccess; @@ -976,7 +973,14 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) while ( !isFrameAreaPositionValid() || !isFrameAreaSizeValid() || !isFramePrintAreaValid() ) { if ( !isFrameAreaPositionValid() ) + { MakePos(); + } + + if (IsHiddenNow()) + { + MakeValidZeroHeight(); + } if ( GetUpper() ) { @@ -1291,7 +1295,6 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { static_cast<SwTextFrame&>(*this).JoinFrame(); } - MakeValidZeroHeight(); HideAndShowObjects(); } @@ -1468,10 +1471,11 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if ( !isFrameAreaPositionValid() ) { MakePos(); - if (isHiddenNow && !isFrameAreaSizeValid()) - { // in a table cell, might be invalidated by ~SwLayNotify - MakeValidZeroHeight(); - } + } + + if (isHiddenNow) + { // call this after MakePos() otherwise Shrink may not work + MakeValidZeroHeight(); } //Set FixSize. VarSize is being adjusted by Format(). diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 44d9752a4dd0..739530926d24 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2263,9 +2263,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } } - if (isHiddenNow) - MakeValidZeroHeight(); - int nUnSplitted = 5; // Just another loop control :-( int nThrowAwayValidLayoutLimit = 5; // And another one :-( PosSizeOscillationControl posSizeOscillationControl; // And yet another one. @@ -2288,6 +2285,11 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) Point aOldPos( aRectFnSet.GetPos(getFrameArea()) ); MakePos(); + if (isHiddenNow) + { // after MakePos() + MakeValidZeroHeight(); + } + if ( aOldPos != aRectFnSet.GetPos(getFrameArea()) ) { if ( aOldPos.Y() != aRectFnSet.GetTop(getFrameArea()) ) diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index c7a74a4bc359..df07d117c374 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1752,7 +1752,6 @@ void SwFrame::MakeValidZeroHeight() } setFrameAreaSizeValid(true); setFramePrintAreaValid(true); - setFrameAreaPositionValid(false); } /** @return the physical page number */ commit 755743ae230c165c34109f9bfc83afe3d4f05ab1 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Nov 28 17:08:41 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 02:37:26 2025 +0200 sw: layout: fix toggling Hidden Paragraphs that have follows When a hidden paragraph is split across pages, there is nothing that joins its follow (SwContentFrame::MakePrtArea() has code to do it but it wasn't called even before the previous commit?) and when the follow is formatted is doesn't move back. So just join all follows asap in SwContentFrame::MakeAll(). (presumably regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 or one of its follow-ups) Change-Id: Icecdf17c1c1e11a3b62c7e5bf2c6624f234c94f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177500 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sw/qa/extras/layout/data/hidden-para-follow-frame.fodt b/sw/qa/extras/layout/data/hidden-para-follow-frame.fodt new file mode 100644 index 000000000000..20b67c13afc9 --- /dev/null +++ b/sw/qa/extras/layout/data/hidden-para-follow-frame.fodt @@ -0,0 +1,113 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:officeooo="http://openoffice.org/2009/office" 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:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:dc="http://purl.org/dc/eleme nts/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0 " xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:creation-date>2024-11-29T14:58:14.708431006</meta:creation-date><dc:date>2024-11-29T14:59:51.787415000</dc:date><meta:editing-duration>PT1M37S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="2" meta:paragraph-count="2" meta:word-count="2" meta:character-count="6" meta:non-whitespace-character-count="6"/><meta:generator>CIB_OfficeDev/6.4.0.29$Linux_X86_64 LibreOffice_project/5374b230ff33d77a7f81d56046759f218a160036</meta:generator></office:meta> + <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 Sans" 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:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" 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" 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 Sans" 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" 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" 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 Sans" 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"/> + </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" 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" 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" 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" 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" 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" 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" 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" 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" 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" 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="P1" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties fo:font-size="24pt" style:font-size-asian="24pt" style:font-size-complex="24pt"/> + </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:footnote-max-height="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> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </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:p text:style-name="P1">Foo</text:p> + <text:p text:style-name="P1"><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:line-break/><text:soft-page-break/><text:line-break/><text:hidden-paragraph text:condition="ooow:TRUE" text:is-hidden="true"/></text:p> + <text:p text:style-name="P1">Bar</text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index a8915b8c7957..525186628dd4 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1801,6 +1801,44 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf156724) assertXPath(pXmlDoc, "/root/page"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFollowFrame) +{ + createSwDoc("hidden-para-follow-frame.fodt"); + + uno::Sequence<beans::PropertyValue> argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } })); + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + uno::Sequence<beans::PropertyValue> args( + comphelper::InitPropertySequence({ { "Fieldnames", uno::Any(false) } })); + dispatchCommand(mxComponent, ".uno:Fieldnames", args); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/txt", 2); + } + + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // the problem was that the 3rd paragraph didn't move to page 1 + assertXPath(pXmlDoc, "/root/page", 1); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 3); + } + + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/txt", 2); + } +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testSectionUnhide) { createSwDoc("hiddensection.fodt"); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 9e87cc9f31c8..86240a4f1a0e 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1287,6 +1287,10 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) bool const isHiddenNow(static_cast<SwTextFrame*>(this)->IsHiddenNowImpl()); if (isHiddenNow) { + while (HasFollow()) + { + static_cast<SwTextFrame&>(*this).JoinFrame(); + } MakeValidZeroHeight(); HideAndShowObjects(); } commit d86428b25de029022a78a2926bd017e54177dd5d Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Nov 28 14:28:58 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 02:37:26 2025 +0200 sw: layout: fix toggling Hidden Paragraphs resulting in bad layout 1. SwContentFrame::MakeAll() needs some more checks to ensure that it never Formats a hidden text frame. This fixes the reported problem that turning off "Hidden Paragraphs" in Tools->Options->Writer->View results in bad layout (extra completely empty page at the end). 3. This means HideAndShowObjects() must be called manually in that case as it was previously called inside Format(), see testHiddenSectionFlys. 2. SwTextFrame::Prepare() as called from calcing some upper (table cell) in the bugdoc needs to avoid invalidating a hidden frame so it isn't formatted (triggered new assert). 4. SwLayAction::IsShortCut() had what looks like an obvious and ancient mistake that was causing a crash in testTdf155011. 5. SwTabFrame::MakeAll() should not calc the next if it's hidden, that was causing a problem in testThemeCrash where a hidden frame moved back into an overfull body and immediately forward again, triggering the new asserts. 6. SwTextFrame::IsHiddenNow() caused interesting problem where some ancient (CVS import) check for a 0 width would skip the invalidating due to the 2. change when called from SwViewShell::Reformat() ... lcl_InvalidateContent() in testParagraphMarkInCell; unclear why this check exists, let's avoid it for the cases where we definitely know that only doc model should determine visibility. 7. JunitTest_sw_unoapi_1 triggers new asserts because MakePos() in a cell ends up invalidating the text frame; fix it up again. (presumably regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1 or one of its follow-ups) Change-Id: I619f4be852eca5124f49d9a91e1de658b7070074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177486 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index a1b7d1942f68..c32bf1e480c4 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -559,7 +559,8 @@ public: #endif /// Hidden - virtual bool IsHiddenNow() const override; // bHidden && pOut == pPrt + virtual bool IsHiddenNow() const override; + bool IsHiddenNowImpl() const; void HideHidden(); // Remove appendage if Hidden void HideFootnotes(TextFrameIndex nStart, TextFrameIndex nEnd); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index de9ef1b16d94..9e87cc9f31c8 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1284,8 +1284,12 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) return; } - if (IsHiddenNow()) + bool const isHiddenNow(static_cast<SwTextFrame*>(this)->IsHiddenNowImpl()); + if (isHiddenNow) + { MakeValidZeroHeight(); + HideAndShowObjects(); + } std::optional<SwFrameDeleteGuard> oDeleteGuard(std::in_place, this); LockJoin(); @@ -1458,11 +1462,18 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) aOldPrtPos = aRectFnSet.GetPos(getFramePrintArea()); if ( !isFrameAreaPositionValid() ) + { MakePos(); + if (isHiddenNow && !isFrameAreaSizeValid()) + { // in a table cell, might be invalidated by ~SwLayNotify + MakeValidZeroHeight(); + } + } //Set FixSize. VarSize is being adjusted by Format(). if ( !isFrameAreaSizeValid() ) { + assert(!isHiddenNow); // hidden frame must not be formatted // invalidate printing area flag, if the following conditions are hold: // - current frame width is 0. // - current printing area width is 0. @@ -1499,6 +1510,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } if ( !isFramePrintAreaValid() ) { + assert(!isHiddenNow); // hidden frame must not be formatted const tools::Long nOldW = aRectFnSet.GetWidth(getFramePrintArea()); // #i34730# - keep current frame height const SwTwips nOldH = aRectFnSet.GetHeight(getFrameArea()); @@ -1535,7 +1547,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // Criteria: // - It needs to be movable (otherwise, splitting doesn't make sense) // - It needs to overlap with the lower edge of the PrtArea of the Upper - if ( !bMustFit ) + if (!bMustFit && !isHiddenNow) { bool bWidow = true; const SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper()); @@ -1561,6 +1573,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } if ( !isFrameAreaSizeValid() ) { + assert(!isHiddenNow); // hidden frame must not be formatted setFrameAreaSizeValid(true); bFormatted = true; ++nFormatCount; @@ -1599,8 +1612,15 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) pMoveBwdPre = pTemp; isMoveBwdPreValid = bTemp; bMovedBwd = true; - bFormatted = false; - if ( bKeep && bMoveable ) + if (isHiddenNow) + { // MoveBwd invalidated the size! Validate to prevent Format! + MakeValidZeroHeight(); + } + else + { + bFormatted = false; + } + if (bKeep && bMoveable && !isHiddenNow) { if( CheckMoveFwd( bMakePage, false, bMovedBwd ) ) { diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index ad437f98527f..85efd2d56f51 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1085,7 +1085,7 @@ bool SwLayAction::IsShortCut( SwPageFrame *&prPage ) if ( pLst->IsInTab() ) pLst = pContent->FindTabFrame(); if ( pLst->IsInSct() ) - pLst = pContent->FindSctFrame(); + pLst = pLst->FindSctFrame(); pLst = pLst->FindPrev(); if ( pLst && (pLst->getFrameArea().Top() >= rVis.Bottom() || diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 45623a7a2c04..44d9752a4dd0 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3040,6 +3040,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) bCalcNxt = false; } } + if (pNxt->IsHiddenNow()) + { // e.g. "testThemeCrash" + bCalcNxt = false; + } if ( bCalcNxt ) { // tdf#119109 follow was just formatted, diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index ac705517be4c..7c0a23256dca 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1485,6 +1485,12 @@ bool SwTextFrame::IsHiddenNow() const return true; } + // TODO: what is the above check good for and can it be removed? + return IsHiddenNowImpl(); +} + +bool SwTextFrame::IsHiddenNowImpl() const +{ if (SwContentFrame::IsHiddenNow()) return true; @@ -2935,12 +2941,17 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid, if( !HasPara() && !bSplitFlyAnchor && PrepareHint::MustFit != ePrep ) { - SetInvalidVert( true ); // Test OSL_ENSURE( !IsLocked(), "SwTextFrame::Prepare: three of a perfect pair" ); - if ( bNotify ) - InvalidateSize(); - else - InvalidateSize_(); + // check while ignoring frame width (testParagraphMarkInCell) + // because it's called from InvalidateAllContent() + if (!IsHiddenNowImpl()) + { + SetInvalidVert( true ); // Test + if ( bNotify ) + InvalidateSize(); + else + InvalidateSize_(); + } return bParaPossiblyInvalid; } commit a86eaf6a8ada3b3f0d0387ea71c9e2d20c11fc7a Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Nov 20 19:30:54 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 02:37:26 2025 +0200 sw: fix hiding/unhiding section via condition The problem was that when un-hiding a section, table rows that contained only empty paragraphs were not reformatted and remained at height 0. It turns out that the table row that became visible did so because the cells had a VertOrientation different from NONE and so SwContentNotify::ImplDestroy() invalidated the cells' printarea. However, the real problem isn't in the layout code at all, as it then turns out that the reason why anything is reformatted at all is that there are docinfo fields on the same page as the section and also in the paragraphs at the start of the section, and these get invalidated somehow after unhiding the section. Unhiding the section didn't actually invalidate anything in the layout because in ImplSetHiddenFlag() no change is detected, and that is because the section was first hidden by removing its (false) condition, which calls SwSection::SetSectionData() and that didn't call ImplSetHiddenFlag(), again relying on docinfo field update to trigger the relayouting. Change-Id: Ie5d9e4d5a0467c17c662f20f8d54aa6b22b382da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176914 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 53418541eb4c..87665f100f54 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -254,12 +254,14 @@ SwSection::~SwSection() void SwSection::SetSectionData(SwSectionData const& rData) { bool const bOldHidden( m_Data.IsHidden() ); + bool const bOldCondHidden{m_Data.IsCondHidden()}; m_Data = rData; // The next two may actually overwrite the m_Data.m_bProtect or EditInReadonly Flag // in Modify, which should result in same flag value as the old code! SetProtect(m_Data.IsProtectFlag()); SetEditInReadonly(m_Data.IsEditInReadonlyFlag()); - if (bOldHidden != m_Data.IsHidden()) // check if changed... + if (bOldHidden != m_Data.IsHidden() + || bOldCondHidden != m_Data.IsCondHidden()) // check if changed... { ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden()); } commit 521d683902a05638b97a7cc29a2eba684a276813 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Nov 19 13:54:50 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Aug 28 02:37:16 2025 +0200 sw: layout: fix unhiding section containing multiple page breaks With multiple page breaks in a hidden section, the following frames were only moved on the first break, and with the second break the frames go out of order in SwSectionFrame::SwClientNotify(). Also handle multiple columns there. (regression from commit a97e245ba11598050e1800fde9ace796d20e9df2) Conflicts: sw/qa/extras/layout/layout4.cxx Change-Id: I4120e72bf083f3bed75f9305fbd757efd55f0b3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176773 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt b/sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt new file mode 100644 index 000000000000..0ff4be45f1ee --- /dev/null +++ b/sw/qa/extras/layout/data/section-nested-with-pagebreaks.fodt @@ -0,0 +1,148 @@ +<?xml version='1.0' encoding='UTF-8'?> -e ... etc. - the rest is truncated