include/unotest/macros_test.hxx | 33 ++ 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/layout3.cxx | 96 +++++ sw/qa/inc/swmodeltestbase.hxx | 24 - sw/source/core/inc/txtfrm.hxx | 3 sw/source/core/layout/calcmove.cxx | 44 ++ sw/source/core/layout/layact.cxx | 2 sw/source/core/layout/tabfrm.cxx | 12 sw/source/core/layout/trvlfrm.cxx | 1 sw/source/core/text/txtfrm.cxx | 21 - unotest/source/cpp/macros_test.cxx | 58 +++ xmlsecurity/qa/unit/signing/signing.cxx | 24 - 13 files changed, 643 insertions(+), 67 deletions(-)
New commits: commit d4b26104df0719e7c2a7deb7377c78e4be71b83e Author: Michael Stahl <[email protected]> AuthorDate: Fri Nov 29 11:49:39 2024 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Dec 2 19:37:56 2024 +0100 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 <[email protected]> Tested-by: Jenkins (cherry picked from commit 0795698c1c82b4026a0f6acdfba5c6b93c8e1412) 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 63994d60e3f0..a61059256f3d 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1143,6 +1143,53 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFollowFrame) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFlys) +{ + createDoc("hidden-para-as-char-fly.fodt"); + + uno::Any aOldValue{ queryDispatchStatus(mxComponent, m_xContext, ".uno:ShowHiddenParagraphs") }; + + Resetter g([this, aOldValue] { + uno::Sequence<beans::PropertyValue> argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", aOldValue } })); + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + }); + + uno::Sequence<beans::PropertyValue> argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } })); + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + uno::Sequence<beans::PropertyValue> args( + comphelper::InitPropertySequence({ { "Fieldnames", uno::Any(false) } })); + lcl_dispatchCommand(mxComponent, ".uno:Fieldnames", args); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt[3]/anchored/fly/infos/bounds", "height", + u"724"); + discardDumpedLayout(); + } + + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocPtr pXmlDoc = parseLayoutDump(); + // the problem was that this did not shrink + assertXPath(pXmlDoc, "/root/page/body/txt[3]/anchored/fly/infos/bounds", "height", + u"448"); + discardDumpedLayout(); + } + + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt[3]/anchored/fly/infos/bounds", "height", + u"724"); + discardDumpedLayout(); + } +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testSectionUnhide) { createDoc("hiddensection.fodt"); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index ef88c4aaf202..221686d4306f 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -960,9 +960,6 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) const SwLayNotify aNotify( this ); bool bVert = IsVertical(); - if (IsHiddenNow()) - MakeValidZeroHeight(); - SwRectFn fnRect = ( IsNeighbourFrame() == bVert )? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ); std::unique_ptr<SwBorderAttrAccess> pAccess; @@ -971,7 +968,14 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) while ( !isFrameAreaPositionValid() || !isFrameAreaSizeValid() || !isFramePrintAreaValid() ) { if ( !isFrameAreaPositionValid() ) + { MakePos(); + } + + if (IsHiddenNow()) + { + MakeValidZeroHeight(); + } if ( GetUpper() ) { @@ -1247,7 +1251,6 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { static_cast<SwTextFrame&>(*this).JoinFrame(); } - MakeValidZeroHeight(); HideAndShowObjects(); } @@ -1424,10 +1427,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 3277940eef3e..e57ba525df0b 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2106,9 +2106,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } } - if (isHiddenNow) - MakeValidZeroHeight(); - int nUnSplitted = 5; // Just another loop control :-( int nThrowAwayValidLayoutLimit = 5; // And another one :-( SwRectFnSet aRectFnSet(this); @@ -2130,6 +2127,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 55bca7ddac2c..9f6e7a074943 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1708,7 +1708,6 @@ void SwFrame::MakeValidZeroHeight() } setFrameAreaSizeValid(true); setFramePrintAreaValid(true); - setFrameAreaPositionValid(false); } /** @return the physical page number */ commit 49cbfdaec4e372c1bdf1adf3d999eeb999c65ed6 Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 28 17:08:41 2024 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Dec 2 19:32:10 2024 +0100 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 <[email protected]> Tested-by: Jenkins (cherry picked from commit a60f016a89787a818e868fbfa5b714853ff44a78) 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 7a3520fb9d7c..63994d60e3f0 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1094,6 +1094,55 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128399) CPPUNIT_ASSERT_EQUAL(nExpected, aPosition.nNode.GetIndex()); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFollowFrame) +{ + createDoc("hidden-para-follow-frame.fodt"); + + uno::Any aOldValue{ queryDispatchStatus(mxComponent, m_xContext, ".uno:ShowHiddenParagraphs") }; + + Resetter g([this, aOldValue] { + uno::Sequence<beans::PropertyValue> argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", aOldValue } })); + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + }); + + uno::Sequence<beans::PropertyValue> argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } })); + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + uno::Sequence<beans::PropertyValue> args( + comphelper::InitPropertySequence({ { "Fieldnames", uno::Any(false) } })); + lcl_dispatchCommand(mxComponent, ".uno:Fieldnames", args); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/txt", 2); + discardDumpedLayout(); + } + + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocPtr 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); + discardDumpedLayout(); + } + + lcl_dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", {}); + + { + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page", 2); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2); + assertXPath(pXmlDoc, "/root/page[2]/body/txt", 2); + discardDumpedLayout(); + } +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testSectionUnhide) { createDoc("hiddensection.fodt"); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index a3c86784ca1d..ef88c4aaf202 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1243,6 +1243,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 553c0555fc9cd079f91af8d172d97ccfbab35bfb Author: Michael Stahl <[email protected]> AuthorDate: Thu Nov 28 14:28:58 2024 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Dec 2 19:32:10 2024 +0100 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 <[email protected]> (cherry picked from commit 0a3f5169acc6708c352cad0fa07fdb4af8c8b2dd) diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 8aec601eac38..260dd21333c9 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -537,7 +537,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 7600522869f0..a3c86784ca1d 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1240,8 +1240,12 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) return; } - if (IsHiddenNow()) + bool const isHiddenNow(static_cast<SwTextFrame*>(this)->IsHiddenNowImpl()); + if (isHiddenNow) + { MakeValidZeroHeight(); + HideAndShowObjects(); + } auto xDeleteGuard = std::make_unique<SwFrameDeleteGuard>(this); LockJoin(); @@ -1414,11 +1418,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. @@ -1455,6 +1466,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } if ( !isFramePrintAreaValid() ) { + assert(!isHiddenNow); // hidden frame must not be formatted const long nOldW = aRectFnSet.GetWidth(getFramePrintArea()); // #i34730# - keep current frame height const SwTwips nOldH = aRectFnSet.GetHeight(getFrameArea()); @@ -1491,7 +1503,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()); @@ -1517,6 +1529,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } if ( !isFrameAreaSizeValid() ) { + assert(!isHiddenNow); // hidden frame must not be formatted setFrameAreaSizeValid(true); bFormatted = true; ++nFormatCount; @@ -1555,8 +1568,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 2a08b22fbcdb..b910680316bc 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1084,7 +1084,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 5b8f6621b070..3277940eef3e 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2724,6 +2724,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 62edda851bbd..6a41978b1a4a 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1373,6 +1373,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; @@ -2809,12 +2815,17 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid, if( !HasPara() && PREP_MUST_FIT != 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 24a9f228adc8b6794695cb1eb0e94dcae47e4f6e Author: Michael Stahl <[email protected]> AuthorDate: Mon Dec 2 15:21:24 2024 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Dec 2 19:32:10 2024 +0100 unotest,sw: introduce queryDispatchStatus() ... and reset the view options that are toggled in testHiddenParagraphFollowFrame and testHiddenParagraphFlys. Backporting these tests to the libreoffice-24-8 branch broke 2 unrelated tests because of the changed view settings: Test name: (anonymous namespace)::testHiddenSectionPageDescs::TestBody equality assertion failed - Expected: 532 - Actual : 798 - In <>, attribute 'height' of '/root/page[2]/body/section[1]/infos/bounds' incorrect value. xmltesttools.cxx:203:Assertion Test name: (anonymous namespace)::testTable0HeightRows::TestBody equality assertion failed - Expected: 28 - Actual : 22 - In <>, XPath '/root/page[1]/body/tab/row' number of nodes is incorrect Change-Id: Ie58242348fecabe163e54048f3896c6d427d2608 diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 126b5c1bff6d..731845441e96 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -17,6 +17,8 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/frame/XDesktop2.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/Any.h> struct TestMacroInfo { @@ -56,6 +58,11 @@ public: css::uno::Reference< css::lang::XComponent > loadFromDesktop(const OUString& rURL, const OUString& rDocService = OUString(), const css::uno::Sequence<css::beans::PropertyValue>& rExtra_args = css::uno::Sequence<css::beans::PropertyValue>() ); + static css::uno::Any + queryDispatchStatus(css::uno::Reference<css::lang::XComponent> const& xComponent, + css::uno::Reference<css::uno::XComponentContext> const& xContext, + OUString const& rURL); + protected: css::uno::Reference< css::frame::XDesktop2> mxDesktop; }; diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index ffc2b970393c..437dae69a31e 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -13,9 +13,11 @@ #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <cppunit/TestAssert.h> #include <rtl/ustrbuf.hxx> +#include <cppuhelper/implbase.hxx> #include <comphelper/sequence.hxx> using namespace css; @@ -51,6 +53,62 @@ uno::Reference<css::lang::XComponent> MacrosTest::loadFromDesktop(const OUString return xComponent; } +namespace +{ +class StateGetter : public ::cppu::WeakImplHelper<frame::XStatusListener> +{ +public: + uno::Any& m_rOldValue; + bool m_Received{ false }; + StateGetter(uno::Any& rOldValue) + : m_rOldValue(rOldValue) + { + } + + virtual void SAL_CALL disposing(lang::EventObject const&) override + { + CPPUNIT_ASSERT(m_Received); + } + virtual void SAL_CALL statusChanged(frame::FeatureStateEvent const& rEvent) override + { + if (!m_Received) + { + m_rOldValue = rEvent.State; + m_Received = true; + } + } +}; + +} // namespace + +uno::Any MacrosTest::queryDispatchStatus(uno::Reference<lang::XComponent> const& xComponent, + uno::Reference<uno::XComponentContext> const& xContext, + OUString const& rURL) +{ + uno::Any ret; + + util::URL url; + url.Complete = rURL; + { + uno::Reference<css::util::XURLTransformer> const xParser( + css::util::URLTransformer::create(xContext)); + CPPUNIT_ASSERT(xParser.is()); + xParser->parseStrict(url); + } + + uno::Reference<frame::XController> const xController + = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController(); + uno::Reference<frame::XDispatchProvider> const xFrame(xController->getFrame(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFrame.is()); + uno::Reference<frame::XDispatch> const xDisp(xFrame->queryDispatch(url, "", 0)); + CPPUNIT_ASSERT(xDisp.is()); + + uno::Reference<frame::XStatusListener> const xListener{ new StateGetter(ret) }; + xDisp->addStatusListener(xListener, url); + + return ret; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 95d1b5ea71f1edbcc87babc616bb94994f787d3a Author: Miklos Vajna <[email protected]> AuthorDate: Wed Aug 5 21:12:44 2020 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Dec 2 19:01:24 2024 +0100 unotest: one Resetter is enough It seems all 3 places derive from unotest::MacrosTest, so extract the common code there. Change-Id: I71a2474a7d6b1623f50575f9e9c43580ba076330 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100185 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit f016f9016f5139791d544b5e5aa2ac438227b735) diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 6ec5c25167df..126b5c1bff6d 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -10,6 +10,8 @@ #ifndef INCLUDED_UNOTEST_MACROS_TEST_HXX #define INCLUDED_UNOTEST_MACROS_TEST_HXX +#include <functional> + #include <rtl/ustring.hxx> #include <unotest/detail/unotestdllapi.hxx> @@ -27,6 +29,30 @@ namespace unotest { class OOO_DLLPUBLIC_UNOTEST MacrosTest { public: + class Resetter + { + private: + std::function<void ()> m_Func; + + public: + Resetter(std::function<void ()> const& rFunc) + : m_Func(rFunc) + { + } + ~Resetter() + { + try + { + m_Func(); + } + catch (...) // has to be reliable + { + fprintf(stderr, "resetter failed with exception "); + abort(); + } + } + }; + css::uno::Reference< css::lang::XComponent > loadFromDesktop(const OUString& rURL, const OUString& rDocService = OUString(), const css::uno::Sequence<css::beans::PropertyValue>& rExtra_args = css::uno::Sequence<css::beans::PropertyValue>() ); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 6119365c6392..f6adbb093309 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -166,30 +166,6 @@ protected: protected: - class Resetter - { - private: - std::function<void ()> m_Func; - - public: - Resetter(std::function<void ()> const& rFunc) - : m_Func(rFunc) - { - } - ~Resetter() - { - try - { - m_Func(); - } - catch (...) // has to be reliable - { - fprintf(stderr, "resetter failed with exception "); - abort(); - } - } - }; - virtual OUString getTestName() { return OUString(); } /// Copy&paste helper. diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 66e0594ec9c6..53b4045c981a 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -1401,30 +1401,6 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) SignatureState::NOSIGNATURES, ODFVER_012_TEXT); } -class Resetter -{ -private: - std::function<void()> m_Func; - -public: - Resetter(std::function<void()> const& rFunc) - : m_Func(rFunc) - { - } - ~Resetter() - { - try - { - m_Func(); - } - catch (...) // has to be reliable - { - fprintf(stderr, "resetter failed with exception "); - abort(); - } - } -}; - /// Test if a macro signature from a OTT 1.0 template is preserved for ODT 1.0 CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) {
