sw/qa/extras/layout/data/table-split-bug.fodt |  440 ++++++++++++++++++++++++++
 sw/qa/extras/layout/layout.cxx                |   41 ++
 sw/source/core/layout/ssfrm.cxx               |    2 
 3 files changed, 482 insertions(+), 1 deletion(-)

New commits:
commit 225ce4b678f5f0241bf3757d9ab7e5223866c431
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jan 23 20:07:42 2025 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jan 24 20:22:56 2025 +0100

    sw: layout: fix bad split table resulting in empty cell
    
    The problem is that the table goes into an infinite loop of splitting
    and joining, because there is a temporarily negative PrtArea height in
    the top row's cells (-170), because of setting all heights to 0.
    
    This causes an inconsistency where it is first joined because in
    ShouldBwdMoved() another line of text in the right column cell can move
    backward, but then there isn't enough space for another row as the
    negative cell PrtArea height is added to the available space and so the
    line won't fit in SwTextFrameBreak::IsInside(); the same situation
    occurs until a "Looping Louie" aborts the iteration with a bad result.
    
    This is somehow caused by the hidden section following the table, but
    not sure how exactly (the "if (pNxt->IsHiddenNow()) bCalcNxt = false"
    suspect code was actually added in a later commit).
    
    Prevent it by preventing negative PrtArea heights.
    
    (regression from commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1)
    
    Change-Id: I36ce8a8bf750cf407cece5ad3cc23374182179de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180719
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/layout/data/table-split-bug.fodt 
b/sw/qa/extras/layout/data/table-split-bug.fodt
new file mode 100644
index 000000000000..935899af2a82
--- /dev/null
+++ b/sw/qa/extras/layout/data/table-split-bug.fodt
@@ -0,0 +1,440 @@
+<?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: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">21987</config:config-item>
+   <config:config-item config:name="ViewAreaHeight" 
config:type="long">17704</config:config-item>
+   <config:config-item config:name="ShowRedlineChanges" 
config:type="boolean">false</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">3401</config:config-item>
+     <config:config-item config:name="ViewTop" 
config:type="long">11201</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">21985</config:config-item>
+     <config:config-item config:name="VisibleBottom" 
config:type="long">17702</config:config-item>
+     <config:config-item config:name="ZoomType" 
config:type="short">3</config:config-item>
+     <config:config-item config:name="ViewLayoutColumns" 
config:type="short">0</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">84</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">true</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">true</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">false</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">true</config:config-item>
+   <config:config-item config:name="PropLineSpacingShrinksFirstLine" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ApplyParagraphMarkFormatToNumbering" 
config:type="boolean">true</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">true</config:config-item>
+   <config:config-item config:name="AllowPrintJobCancel" 
config:type="boolean">false</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">false</config:config-item>
+   <config:config-item config:name="UseOldNumbering" 
config:type="boolean">true</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">false</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">ADRESSEN</config:config-item>
+   <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">Adreßbuch</config:config-item>
+   <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" 
config:type="boolean">true</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-map-indexed config:name="ForbiddenCharacters">
+    <config:config-item-map-entry>
+     <config:config-item config:name="Language" 
config:type="string">de</config:config-item>
+     <config:config-item config:name="Country" 
config:type="string">DE</config:config-item>
+     <config:config-item config:name="Variant" config:type="string"/>
+     <config:config-item config:name="BeginLine" config:type="string"/>
+     <config:config-item config:name="EndLine" config:type="string"/>
+    </config:config-item-map-entry>
+    <config:config-item-map-entry>
+     <config:config-item config:name="Language" 
config:type="string">en</config:config-item>
+     <config:config-item config:name="Country" 
config:type="string">US</config:config-item>
+     <config:config-item config:name="Variant" config:type="string"/>
+     <config:config-item config:name="BeginLine" config:type="string"/>
+     <config:config-item config:name="EndLine" config:type="string"/>
+    </config:config-item-map-entry>
+   </config:config-item-map-indexed>
+   <config:config-item config:name="AddParaTableSpacingAtStart" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="Rsid" 
config:type="int">15857532</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="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">false</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">true</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">true</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">true</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">true</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">691202</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">true</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">true</config:config-item>
+   <config:config-item config:name="CollapseEmptyCellPara" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="TabOverflow" 
config:type="boolean">false</config:config-item>
+  </config:config-item-set>
+ </office:settings>
+ <office:font-face-decls>
+  <style:font-face style:name="Arial" svg:font-family="Arial" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Arial Unicode MS" svg:font-family="'Arial 
Unicode MS'" style:font-pitch="variable"/>
+  <style:font-face style:name="HG Mincho Light J" svg:font-family="'HG Mincho 
Light J'" style:font-pitch="variable"/>
+  <style:font-face style:name="Thorndale" svg:font-family="Thorndale" 
style:font-family-generic="roman" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <draw:gradient draw:name="gradient" draw:style="linear" 
draw:start-color="#000000" draw:end-color="#ffffff" draw:start-intensity="100%" 
draw:end-intensity="100%" draw:angle="0" draw:border="0%"/>
+  <draw:hatch draw:name="hatch" draw:style="single" draw:color="#3465a4" 
draw:distance="0.02cm" draw:rotation="0"/>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#808080" 
draw:fill-color="#cfe7f5" 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="true"/>
+   <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 fo:color="#000000" style:font-name="Thorndale" 
fo:font-size="12pt" fo:language="de" fo:country="DE" style:font-name-asian="HG 
Mincho Light J" style:font-size-asian="12pt" style:language-asian="zxx" 
style:country-asian="none" style:font-name-complex="Arial Unicode MS" 
style:font-size-complex="12pt" style:language-complex="zxx" 
style:country-complex="none"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" 
style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" 
style:line-break="strict" style:tab-stop-distance="1.27cm" 
style:writing-mode="lr-tb"/>
+   <style:text-properties fo:color="#000000" style:font-name="Thorndale" 
fo:font-size="12pt" fo:language="de" fo:country="DE" style:font-name-asian="HG 
Mincho Light J" style:font-size-asian="12pt" style:language-asian="zxx" 
style:country-asian="none" style:font-name-complex="Arial Unicode MS" 
style:font-size-complex="12pt" style:language-complex="zxx" 
style:country-complex="none" 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="separating"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="always"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false"/>
+   <style:text-properties style:font-name="Arial" fo:font-family="Arial" 
style:font-pitch="variable" fo:font-weight="350"/>
+  </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="0cm" 
loext:contextual-spacing="false" fo:hyphenation-ladder-count="no-limit"/>
+   <style:text-properties style:font-name="Arial" fo:font-family="Arial" 
style:font-pitch="variable" fo:hyphenate="true" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false"/>
+  </style:style>
+  <style:style style:name="Footer" style:family="paragraph" 
style:parent-style-name="Standard" style:class="extra">
+   <style:paragraph-properties>
+    <style:tab-stops>
+     <style:tab-stop style:position="8.5cm" style:type="center"/>
+     <style:tab-stop style:position="17.002cm" style:type="right"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+  </style:style>
+  <style:style style:name="Table_20_Contents" style:display-name="Table 
Contents" style:family="paragraph" style:parent-style-name="Text_20_body" 
style:class="extra">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" 
fo:margin-top="0cm" fo:margin-bottom="0cm" loext:contextual-spacing="false" 
fo:text-indent="0cm" style:auto-text-indent="false"/>
+  </style:style>
+  <style:style style:name="TVS_20_Standard" style:display-name="TVS Standard" 
style:family="paragraph" style:master-page-name="">
+   <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" 
style:page-number="auto"/>
+   <style:text-properties style:font-name="Arial" fo:font-family="Arial" 
style:font-pitch="variable" fo:hyphenate="true" 
fo:hyphenation-remain-char-count="4" fo:hyphenation-push-char-count="4" 
loext:hyphenation-no-caps="false"/>
+  </style:style>
+  <style:style style:name="TVS_20_KopfzeileFKB_5f_S2" style:display-name="TVS 
KopfzeileFKB_S2" style:family="paragraph" 
style:parent-style-name="TVS_20_Standard">
+   <style:paragraph-properties fo:text-align="center" 
style:justify-single-word="false"/>
+   <style:text-properties fo:font-size="8pt"/>
+  </style:style>
+  <style:style style:name="TVS_20_Anrede" style:display-name="TVS Anrede" 
style:family="paragraph" style:parent-style-name="TVS_20_Standard" 
style:next-style-name="TVS_20_Freitext">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.42cm" 
loext:contextual-spacing="false" fo:line-height="150%"/>
+  </style:style>
+  <style:style style:name="TVS_20_Freitext" style:display-name="TVS Freitext" 
style:family="paragraph" style:parent-style-name="TVS_20_Standard">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false" fo:line-height="150%" fo:text-align="justify" 
style:justify-single-word="false"/>
+  </style:style>
+  <style:style style:name="TVS_20_Betreff" style:display-name="TVS Betreff" 
style:family="paragraph" style:parent-style-name="TVS_20_Standard" 
style:next-style-name="TVS_20_Anrede" style:master-page-name="">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="1.06cm" 
loext:contextual-spacing="false" fo:line-height="150%" 
style:page-number="auto"/>
+   <style:text-properties fo:font-weight="bold"/>
+  </style:style>
+  <style:style style:name="Fließtext" style:family="paragraph" 
style:parent-style-name="Text_20_body" style:default-outline-level="">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.635cm" 
loext:contextual-spacing="false"/>
+  </style:style>
+  <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote 
Symbol" style:family="text"/>
+  <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote 
Symbol" style:family="text"/>
+  <style:style style:name="TVS_20_Fett" style:display-name="TVS Fett" 
style:family="text">
+   <style:text-properties fo:font-weight="bold"/>
+  </style:style>
+  <style:style style:name="Footnote_20_anchor" style:display-name="Footnote 
anchor" style:family="text">
+   <style:text-properties style:text-position="super 58%"/>
+  </style:style>
+  <style:style style:name="Endnote_20_anchor" style:display-name="Endnote 
anchor" style:family="text">
+   <style:text-properties style:text-position="super 58%"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties/>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" 
text:citation-style-name="Footnote_20_Symbol" 
text:citation-body-style-name="Footnote_20_anchor" 
text:master-page-name="Standard" style:num-format="1" text:start-value="0" 
text:footnotes-position="page" text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" 
text:citation-style-name="Endnote_20_Symbol" 
text:citation-body-style-name="Endnote_20_anchor" 
text:master-page-name="Endnote" style:num-format="1" 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"/>
+  <style:default-page-layout>
+   <style:page-layout-properties style:writing-mode="lr-tb" 
style:layout-grid-standard-mode="true"/>
+  </style:default-page-layout>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="Tabelle19" style:family="table">
+   <style:table-properties style:width="16.302cm" table:align="margins"/>
+  </style:style>
+  <style:style style:name="Tabelle19.A" style:family="table-column">
+   <style:table-column-properties style:column-width="0.504cm" 
style:rel-column-width="2028*"/>
+  </style:style>
+  <style:style style:name="Tabelle19.B" style:family="table-column">
+   <style:table-column-properties style:column-width="15.797cm" 
style:rel-column-width="63507*"/>
+  </style:style>
+  <style:style style:name="Tabelle19.1" style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:style>
+  <style:style style:name="Tabelle19.A1" style:family="table-cell">
+   <style:table-cell-properties fo:padding-left="0.101cm" 
fo:padding-right="0.101cm" fo:padding-top="0.101cm" fo:padding-bottom="0.199cm" 
fo:border="none" style:writing-mode="page"/>
+  </style:style>
+  <style:style style:name="P13" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext" style:master-page-name="">
+   <loext:graphic-properties draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false" fo:text-align="justify" 
style:justify-single-word="false" style:page-number="auto"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P24" style:family="paragraph" 
style:parent-style-name="Fließtext">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" 
fo:margin-top="0cm" fo:margin-bottom="0cm" loext:contextual-spacing="false" 
fo:line-height="150%" fo:text-align="start" style:justify-single-word="false" 
fo:text-indent="0cm" style:auto-text-indent="false" style:writing-mode="lr-tb"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P26" style:family="paragraph" 
style:parent-style-name="Fließtext">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" 
fo:margin-top="0cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" 
fo:line-height="150%" fo:text-align="start" style:justify-single-word="false" 
fo:text-indent="0cm" style:auto-text-indent="false" style:writing-mode="lr-tb"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P27" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <loext:graphic-properties draw:fill="none" draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" 
fo:margin-top="0cm" fo:margin-bottom="0.42cm" loext:contextual-spacing="false" 
fo:line-height="150%" fo:text-align="justify" style:justify-single-word="false" 
fo:hyphenation-ladder-count="no-limit" fo:text-indent="0cm" 
style:auto-text-indent="false" fo:background-color="transparent">
+    <style:tab-stops>
+     <style:tab-stop style:position="0.499cm"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+   <style:text-properties fo:hyphenate="true" 
fo:hyphenation-remain-char-count="4" fo:hyphenation-push-char-count="4" 
loext:hyphenation-no-caps="false"/>
+  </style:style>
+  <style:style style:name="P28" style:family="paragraph" 
style:parent-style-name="Table_20_Contents">
+   <style:paragraph-properties fo:text-align="justify" 
style:justify-single-word="false"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P30" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <style:paragraph-properties fo:text-align="justify" 
style:justify-single-word="false"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P31" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P37" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <loext:graphic-properties draw:fill-gradient-name="gradient" 
draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.42cm" 
loext:contextual-spacing="false"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P38" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <loext:graphic-properties draw:fill-gradient-name="gradient" 
draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.42cm" 
loext:contextual-spacing="false" fo:text-align="justify" 
style:justify-single-word="false"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P39" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <loext:graphic-properties draw:fill-gradient-name="gradient" 
draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-top="0.42cm" 
fo:margin-bottom="0.42cm" loext:contextual-spacing="false" 
fo:text-align="center" style:justify-single-word="false"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P40" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext">
+   <loext:graphic-properties draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false" fo:text-align="justify" 
style:justify-single-word="false"/>
+   <style:text-properties style:font-name="Arial"/>
+  </style:style>
+  <style:style style:name="P41" style:family="paragraph" 
style:parent-style-name="TVS_20_Freitext" style:master-page-name="">
+   <loext:graphic-properties draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false" fo:text-align="justify" 
style:justify-single-word="false" style:page-number="auto" 
fo:keep-with-next="always"/>
+   <style:text-properties style:font-name="Arial"/>
+  </style:style>
+  <style:style style:name="P46" style:family="paragraph" 
style:parent-style-name="TVS_20_Betreff" style:master-page-name="FABrief_5f_S1">
+   <style:paragraph-properties style:page-number="auto"/>
+  </style:style>
+  <style:style style:name="T7" style:family="text">
+   <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" 
style:font-weight-complex="bold"/>
+  </style:style>
+  <style:style style:name="Sect1" style:family="section">
+   <style:section-properties style:editable="false">
+    <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+   </style:section-properties>
+  </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:paper-tray-name="[From 
printer settings]" style:print-orientation="portrait" fo:margin-top="2cm" 
fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" 
fo:border="none" fo:padding="0cm" style:shadow="none" 
fo:background-color="transparent" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="44" 
style:layout-grid-base-height="0.55cm" style:layout-grid-ruby-height="0cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="true" style:layout-grid-display="true" 
style:layout-grid-base-width="0.37cm" style:layout-grid-snap-to="true" 
draw:fill="none" draw:fill-color="#cfe7f5" style:footnote-max-height="0cm">
+    <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="none" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:page-layout style:name="pm2" style:page-usage="mirrored">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:paper-tray-name="[From 
printer settings]" style:print-orientation="portrait" fo:margin-top="1.3cm" 
fo:margin-bottom="1.799cm" fo:margin-left="2.9cm" fo:margin-right="1.799cm" 
fo:border="none" fo:padding="0cm" style:shadow="none" 
fo:background-color="transparent" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="44" 
style:layout-grid-base-height="0.55cm" style:layout-grid-ruby-height="0cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="true" style:layout-grid-display="true" 
style:layout-grid-base-width="0.37cm" style:layout-grid-snap-to="true" 
draw:fill="none" draw:fill-color="#cfe7f5" style:footnote-max-height="0cm">
+    <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="none" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style>
+    <style:header-footer-properties svg:height="1.9cm" fo:margin-left="0cm" 
fo:margin-right="0cm" fo:margin-bottom="1.401cm" fo:border="none" 
fo:padding="0cm" style:shadow="none" fo:background-color="transparent" 
style:dynamic-spacing="false" draw:fill="none" draw:fill-color="#cfe7f5"/>
+   </style:header-style>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:page-layout style:name="pm4">
+   <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="44" 
style:layout-grid-base-height="0.55cm" style:layout-grid-ruby-height="0cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="true" style:layout-grid-display="true" 
style:layout-grid-base-width="0.37cm" style:layout-grid-snap-to="true" 
style:footnote-max-height="0cm">
+    <style:footnote-sep style:line-style="none" style:adjustment="left" 
style:rel-width="25%" style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:page-layout style:name="pm7">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:paper-tray-name="[From 
printer settings]" style:print-orientation="portrait" fo:margin-top="10.7cm" 
fo:margin-bottom="2.2cm" fo:margin-left="2.9cm" fo:margin-right="1.799cm" 
fo:border="none" fo:padding="0cm" style:shadow="none" 
fo:background-color="transparent" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="44" 
style:layout-grid-base-height="0.55cm" style:layout-grid-ruby-height="0cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="true" style:layout-grid-display="true" 
style:layout-grid-base-width="0.37cm" style:layout-grid-snap-to="true" 
draw:fill="none" draw:fill-color="#cfe7f5" style:footnote-max-height="0cm">
+    <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="none" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style>
+    <style:header-footer-properties svg:height="2.401cm" fo:margin-left="0cm" 
fo:margin-right="0cm" fo:margin-top="0.3cm" fo:border="none" fo:padding="0cm" 
style:shadow="none" fo:background-color="transparent" 
style:dynamic-spacing="false" draw:fill="none" draw:fill-color="#cfe7f5"/>
+   </style:footer-style>
+  </style:page-layout>
+  </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+  <style:master-page style:name="FABrief_5f_S2" 
style:display-name="FABrief_S2" style:page-layout-name="pm2">
+   <style:header>
+    <text:p text:style-name="TVS_20_KopfzeileFKB_5f_S2">- <text:page-number 
text:select-page="current">3</text:page-number><text:s/>-</text:p>
+   </style:header>
+  </style:master-page>
+  <style:master-page style:name="Endnote" style:page-layout-name="pm4"/>
+  <style:master-page style:name="FABrief_5f_S1" 
style:display-name="FABrief_S1" style:page-layout-name="pm7" 
style:next-style-name="FABrief_5f_S2">
+   <style:footer>
+    <text:p text:style-name="Footer"/>
+   </style:footer>
+  </style:master-page>
+  </office:master-styles>
+ <office:body>
+  <office:text text:use-soft-page-breaks="true">
+
+   <text:section text:style-name="Sect1" text:name="CopyA">
+    <text:p text:style-name="P46"><text:span 
text:style-name="TVS_20_Fett">Herrn Diego Säbelzahn</text:span></text:p>
+    <text:p text:style-name="TVS_20_Betreff"><text:line-break/></text:p>
+    <text:p text:style-name="TVS_20_Anrede">Sehr geehrte Damen und 
Herren,</text:p>
+    <text:section text:style-name="Sect1" text:name="CopyESt">
+     <text:p 
text:style-name="P37"><text:line-break/><text:line-break/></text:p>
+    </text:section>
+    <text:p text:style-name="P13"/>
+    <text:p text:style-name="P39"><text:span text:style-name="T7">bis zum 
</text:span></text:p>
+    <text:p text:style-name="P38">ein:</text:p>
+    <table:table table:name="Tabelle19" table:style-name="Tabelle19">
+     <table:table-column table:style-name="Tabelle19.A"/>
+     <table:table-column table:style-name="Tabelle19.B"/>
+     <table:table-row table:style-name="Tabelle19.1">
+      <table:table-cell table:style-name="Tabelle19.A1" 
office:value-type="string">
+       <text:p text:style-name="P28">-</text:p>
+      </table:table-cell>
+      <table:table-cell table:style-name="Tabelle19.A1" 
office:value-type="string">
+       <text:p text:style-name="P31">Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla 
Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla 
Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla 
Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla 
Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla 
Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla 
Bla Bla Bla Bla Bla Bla Bla Bla</text:p>
+       <text:p text:style-name="P31">A</text:p>
+       <text:p text:style-name="P31">B</text:p>
+       <text:p text:style-name="P24">C</text:p>
+       <text:p text:style-name="P24">D</text:p>
+       <text:p text:style-name="P24">E</text:p>
+       <text:p text:style-name="P24">F</text:p>
+       <text:p text:style-name="P24">G</text:p>
+       <text:p text:style-name="P24">H</text:p>
+       <text:p text:style-name="P26">I</text:p>
+       <text:p text:style-name="P31">J</text:p>
+       <text:p text:style-name="P31">K</text:p>
+      </table:table-cell>
+     </table:table-row>
+    </table:table>
+    <text:section text:style-name="Sect1" text:name="CopyFreitext" 
text:display="none">
+     <text:p text:style-name="P30">- <text:placeholder 
text:placeholder-type="text">&lt;TEXT&gt;</text:placeholder></text:p>
+    </text:section>
+    <text:p text:style-name="P40">Sie</text:p>
+    <text:p text:style-name="P41">Das</text:p>
+    <text:p text:style-name="P27">Be</text:p>
+   </text:section>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index f54d38504b36..d0f31b59ced7 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -277,6 +277,47 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588)
                 u"effectively by modern-day small to ");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableSplitBug)
+{
+    createSwDoc("table-split-bug.fodt");
+
+    {
+        xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]//txt[1]/infos/bounds",
+                    "height", u"276");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]/infos/bounds",
+                    "height", u"1274");
+    }
+
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+    pWrtShell->Down(false, 1);
+    pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    {
+        xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+        // the problem was that the paragraph in the left cell had height 0
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]//txt[1]/infos/bounds",
+                    "height", u"276");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]/infos/bounds",
+                    "height", u"1688");
+    }
+
+    pWrtShell->Undo();
+
+    {
+        xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+        // the problem was that the paragraph in the left cell had height 0
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]//txt[1]/infos/bounds",
+                    "height", u"276");
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/section[3]/tab[1]/row[1]/cell[1]/infos/bounds",
+                    "height", u"1274");
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 {
     createSwDoc();
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 32c11f4522a1..b7b8546859c9 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -174,7 +174,7 @@ void SwFrame::SetTopBottomMargins( tools::Long nTop, 
tools::Long nBot )
 {
     SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
     aPrt.Top( nTop );
-    aPrt.Height( getFrameArea().Height() - nTop - nBot );
+    aPrt.Height(::std::max<decltype(nTop)>(0, getFrameArea().Height() - nTop - 
nBot));
 }
 
 void SwFrame::SetLeftRightMargins( tools::Long nLeft, tools::Long nRight)

Reply via email to