configure.ac                                              |    2 
 sw/qa/extras/layout/data/table-in-section-split-loop.fodt |  161 +++++
 sw/qa/extras/layout/data/table-split-bug.fodt             |  440 ++++++++++++++
 sw/qa/extras/layout/layout.cxx                            |   67 ++
 sw/source/core/inc/layouter.hxx                           |    1 
 sw/source/core/layout/layact.cxx                          |   18 
 sw/source/core/layout/layouter.cxx                        |   14 
 sw/source/core/layout/ssfrm.cxx                           |    2 
 sw/source/core/layout/wsfrm.cxx                           |   24 
 sw/source/core/view/viewsh.cxx                            |    8 
 10 files changed, 731 insertions(+), 6 deletions(-)

New commits:
commit 60b436db3bc1f1c0aaf2cb32ca9f538c7c40c8e4
Author:     Thorsten Behrens <thorsten.behr...@allotropia.de>
AuthorDate: Thu Jan 30 07:49:45 2025 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Jan 30 07:49:45 2025 +0100

    Bump version to 6.4.0.31
    
    Change-Id: Ief4f2eb6dd257fc15c92c8d70c510accf67d6be5

diff --git a/configure.ac b/configure.ac
index 934455a21dc0..5df019c59ef7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for 
the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no 
idea.
 
-AC_INIT([CIB Office],[6.4.0.30],[],[],[https://www.cib.de/office/])
+AC_INIT([CIB Office],[6.4.0.31],[],[],[https://www.cib.de/office/])
 
 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just 
fine if it is installed
 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails 
hard
commit e92286a36fa838905b0ace92a7102cfaecf9d21d
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jan 29 16:22:43 2025 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 29 16:27:12 2025 +0100

    sw: fix bad layout due to stale SwLayouter
    
    The previous commit still leaves a problem on this branch, which happens
    after toggling Ctrl+F9 a dozen or so times, the layout is broken with:
    
    warn:legacy.osl:1814070:1814070:sw/source/core/layout/flowfrm.cxx:2531: 
<SwFlowFrame::MoveBwd(..)> - layout loop control for layout action <Move 
Backward> applied!
    
    The problem is that SwLayouter contains stale entries from the previous
    layout action that need to be cleared before starting the next one.
    
    This is part of master commit b0e2b60fa45f236f6a993cc1295a7afddabb5098
    but that is too risky to backport as a whole.
    
    Change-Id: Ib4ac6345acd1e94370dd799e685a4c378228d908

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index bf160861ee3c..98adfa55682f 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -73,6 +73,7 @@
 #include <anchoredobject.hxx>
 #include <wrtsh.hxx>
 #include <DocumentSettingManager.hxx>
+#include <DocumentLayoutManager.hxx>
 
 #include <unotxdoc.hxx>
 #include <view.hxx>
@@ -2192,6 +2193,7 @@ void SwViewShell::ImplApplyViewOptions( const 
SwViewOption &rOpt )
     // - fieldnames apply or not ...
     // ( - SwEndPortion must _no_ longer be generated. )
     // - Of course, the screen is something completely different than the 
printer ...
+    bool const isToggleFieldNames(mpOpt->IsFieldName() != rOpt.IsFieldName());
     bReformat = bReformat || mpOpt->IsFieldName() != rOpt.IsFieldName();
 
     // The map mode is changed, minima/maxima will be attended by UI
@@ -2280,6 +2282,12 @@ void SwViewShell::ImplApplyViewOptions( const 
SwViewOption &rOpt )
         EndAction();
     }
 
+    if (isToggleFieldNames)
+    {
+        // the layout changes but SetModified() wasn't called so do it here:
+        mxDoc->GetDocumentLayoutManager().ClearSwLayouterEntries();
+    }
+
     if( bOnlineSpellChgd )
     {
         bool bOnlineSpl = rOpt.IsOnlineSpell();
commit 88e03a830e9b8b8847feabfd7f47aaf2ace25388
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Jan 28 18:10:55 2025 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 29 16:27:12 2025 +0100

    sw: layout: fix loop with table at the end of a section
    
    There is a table alone in a section, and there are 2 rows in the table,
    with the 2nd row split across page 1 and page 2.
    
    Due to space for another line of text being available, the table frame
    first does RemoveFollowFlowLine() etc and grows much higher than the
    section frame upper.
    
    Then in SwTabFrame::Join(), the section frame on page 2 is destroyed via
    SwSectionFrame::DelEmpty() so the section frame on page 1 doesn't have a
    follow.
    
    Then a SwTabFrame::Split() happens, and lcl_ShrinkCellsAndAllContent()
    ends up shrinking the section frame to 0 height (because there is no
    follow currently seen by SwSectionFrame::ToMaximize()), which is wrong
    as there is a 1st row in the table, so the table is still height 3712.
    
    If the table is directly in the body, then this works because the body
    frame doesn't shrink or grow.
    
    Then when the text frame in the 2nd row is formatted, it can't grow
    because SetRestrictTableGrowth(true) was called as a follow flow line
    exists, and in SwTabFrame::GrowFrame() nReal is -2777 due to the
    SwTabFrame being higher than the upper; the result is that the text
    frame is the same height/split at the same line as before
    SwTabFrame::MakeAll().
    
    Then the whole thing happens again until eventually
    warn:sw.layout:875613:875613:sw/source/core/layout/layouter.cxx:194: 
Looping Louie: Stage 1!
    
    Try to detect situation of too high table in section and propagate
    Shrink only until the section is the same height as the table.
    
    Change-Id: If4b6db8b03d93a3227ad223203f2b0c3f73d3cc8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180857
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit f747378c4d5c3b2af0dc6ed2dc8cdbd2c4bf09c9)

diff --git a/sw/qa/extras/layout/data/table-in-section-split-loop.fodt 
b/sw/qa/extras/layout/data/table-in-section-split-loop.fodt
new file mode 100644
index 000000000000..c56254aba03a
--- /dev/null
+++ b/sw/qa/extras/layout/data/table-in-section-split-loop.fodt
@@ -0,0 +1,161 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:initial-creator>gcc</meta:initial-creator><meta:creation-date>2025-01-28T13:52:39.048482856</meta:creation-date><dc:date>2025-01-28T14:44:09.682881525</dc:date><dc:creator>gcc</dc:creator><meta:editing-duration>PT12M50S</meta:editing-duration><meta:editing-cycles>7</meta:editing-cycles><meta:generator>LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/4b681ded88231674d8b7c133dd211f3c024a7118</meta:generator><meta:document-statistic
 meta:table-count="1" meta:image-count="0" meta:object-count="0" 
meta:page-count="2" meta:paragraph-count="2" meta:word-count="157" 
meta:character-count="834" 
meta:non-whitespace-character-count="663"/></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" 
style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif 
CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" 
style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0cm" 
style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="de" fo:country="DE" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" 
loext:hyphenation-keep-type="column" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="de" fo:country="DE" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Table_20_Contents" style:display-name="Table 
Contents" style:family="paragraph" style:parent-style-name="Standard" 
style:class="extra">
+   <style:paragraph-properties fo:orphans="0" fo:widows="0" 
text:number-lines="false" text:line-number="0"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" loext:num-list-format="%1%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" loext:num-list-format="%2%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" loext:num-list-format="%3%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" loext:num-list-format="%4%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" loext:num-list-format="%5%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" loext:num-list-format="%6%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" loext:num-list-format="%7%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" loext:num-list-format="%8%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" loext:num-list-format="%9%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" loext:num-list-format="%10%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="Table1" style:family="table">
+   <style:table-properties style:width="6.5cm" table:align="margins"/>
+  </style:style>
+  <style:style style:name="Table1.A" style:family="table-column">
+   <style:table-column-properties style:column-width="6.5cm" 
style:rel-column-width="65535*"/>
+  </style:style>
+  <style:style style:name="Table1.1" style:family="table-row">
+   <style:table-row-properties style:min-row-height="0.002cm"/>
+  </style:style>
+  <style:style style:name="Table1.A1" style:family="table-cell">
+   <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt 
solid #000000" fo:border-right="0.5pt solid #000000" fo:border-top="0.5pt solid 
#000000" fo:border-bottom="none"/>
+  </style:style>
+  <style:style style:name="Table1.2" style:family="table-row">
+   <style:table-row-properties style:min-row-height="1.644cm"/>
+  </style:style>
+  <style:style style:name="Table1.A2" style:family="table-cell">
+   <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt 
solid #000000" fo:border-right="0.5pt solid #000000" fo:border-top="none" 
fo:border-bottom="0.5pt solid #000000"/>
+  </style:style>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Table_20_Contents">
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" 
style:parent-style-name="Table_20_Contents">
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Sect1" style:family="section">
+   <style:section-properties fo:background-color="#158466" 
text:dont-balance-text-columns="false" style:editable="false">
+    <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+    <style:background-image/>
+   </style:section-properties>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="10.5cm" 
fo:page-height="14.801cm" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" 
fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" 
style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="false" style:layout-grid-display="false" 
style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:style style:name="dp1" style:family="drawing-page">
+   <style:drawing-page-properties draw:background-size="full"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1" 
draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text text:use-soft-page-breaks="true">
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="Standard"/>
+   <text:p text:style-name="Standard"/>
+   <text:section text:style-name="Sect1" text:name="Section1">
+    <table:table table:name="Table1" table:style-name="Table1">
+     <table:table-column table:style-name="Table1.A"/>
+     <table:table-row table:style-name="Table1.1">
+      <table:table-cell table:style-name="Table1.A1" 
office:value-type="string">
+       <text:p text:style-name="P1">There<text:line-break/> 
is<text:line-break/> quite<text:line-break/> some<text:line-break/> 
text<text:line-break/> here<text:line-break/> to<text:line-break/> 
take<text:line-break/> up<text:line-break/> some<text:line-break/> 
but<text:line-break/> not<text:line-break/> all<text:line-break/> 
of<text:line-break/> the<text:line-break/> available<text:line-break/> 
space</text:p>
+      </table:table-cell>
+     </table:table-row>
+     <table:table-row table:style-name="Table1.2">
+      <table:table-cell table:style-name="Table1.A2" 
office:value-type="string">
+       <text:p text:style-name="P2">He heard quiet steps behind him. That 
didn't bode well. Who could be <text:soft-page-break/>following him this late 
at night and in this deadbeat part of town? And at this particular moment, just 
after he pulled off the big time and was making off with the greenbacks. Was 
there another crook who'd had the same idea, and was now watching him and 
waiting for a chance to grab the fruit of his labor? Or did the steps behind 
him mean that one of many law officers in town was on to him and just waiting 
to pounce and snap those cuffs on his wrists? He nervously looked all around. 
Suddenly he saw the alley. Like lightning he darted off to the left and 
disappeared between the two warehouses almost falling over the trash can lying 
in the middle of the sidewalk.</text:p>
+      </table:table-cell>
+     </table:table-row>
+    </table:table>
+   </text:section>
+   <text:p text:style-name="Standard"/>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index a888e6bf879e..29d6d216f7a5 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -9,6 +9,8 @@
 
 #include <swmodeltestbase.hxx>
 #include <unotest/bootstrapfixturebase.hxx>
+#include <osl/process.h>
+#include <comphelper/scopeguard.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
 #include <com/sun/star/frame/DispatchHelper.hpp>
@@ -24,6 +26,8 @@
 #include <editeng/postitem.hxx>
 #include <editeng/unolingu.hxx>
 #include <svx/svdpage.hxx>
+
+#include <layouter.hxx>
 #include <fmtanchr.hxx>
 #include <fmtfsize.hxx>
 #include <fmtcntnt.hxx>
@@ -281,6 +285,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableSplitBug)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableInSectionSplitLoop)
+{
+    createDoc("table-in-section-split-loop.fodt");
+
+    static OUString const var{ "TEST_NO_LOOP_CONTROLS" };
+    osl_setEnvironment(var.pData, OUString("1").pData);
+    comphelper::ScopeGuard g([] { osl_clearEnvironment(var.pData); });
+
+    CPPUNIT_ASSERT_EQUAL(0, SwLayouter::GetLastLoopControlStage());
+
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    CPPUNIT_ASSERT_EQUAL(0, SwLayouter::GetLastLoopControlStage());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 {
     loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/inc/layouter.hxx b/sw/source/core/inc/layouter.hxx
index a3979cf4670a..34d025843ccd 100644
--- a/sw/source/core/inc/layouter.hxx
+++ b/sw/source/core/inc/layouter.hxx
@@ -102,6 +102,7 @@ public:
 
     void LoopControl( SwPageFrame* pPage );
     void EndLoopControl();
+    SW_DLLPUBLIC static int GetLastLoopControlStage();
     void LoopingLouieLight( const SwDoc& rDoc, const SwTextFrame& rFrame );
 
     static void CollectEndnotes( SwDoc* pDoc, SwSectionFrame* pSect );
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index b910680316bc..bc228ad3c76f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -594,7 +594,11 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
 
                         if ( ++nLoopControlRuns_1 > nLoopControlMax )
                         {
-                            OSL_FAIL( "LoopControl_1 in 
SwLayAction::InternalAction" );
+                            SAL_WARN("sw.layout", "LoopControl_1 in 
SwLayAction::InternalAction");
+                            if (::std::getenv("TEST_NO_LOOP_CONTROLS"))
+                            {
+                                throw std::exception{}; // => fail test
+                            }
                             break;
                         }
 
@@ -776,7 +780,11 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
 
                     if ( ++nLoopControlRuns_3 > nLoopControlMax )
                     {
-                        OSL_FAIL( "LoopControl_3 in Interrupt formatting in 
SwLayAction::InternalAction" );
+                        SAL_WARN("sw.layout", "LoopControl_3 in Interrupt 
formatting in SwLayAction::InternalAction");
+                        if (::std::getenv("TEST_NO_LOOP_CONTROLS"))
+                        {
+                            throw std::exception{}; // => fail test
+                        }
                         break;
                     }
 
@@ -795,7 +803,11 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
 
                     if ( ++nLoopControlRuns_2 > nLoopControlMax )
                     {
-                        OSL_FAIL( "LoopControl_2 in Interrupt formatting in 
SwLayAction::InternalAction" );
+                        SAL_WARN("sw.layout", "LoopControl_2 in Interrupt 
formatting in SwLayAction::InternalAction");
+                        if (::std::getenv("TEST_NO_LOOP_CONTROLS"))
+                        {
+                            throw std::exception{}; // => fail test
+                        }
                         break;
                     }
 
diff --git a/sw/source/core/layout/layouter.cxx 
b/sw/source/core/layout/layouter.cxx
index dbb5757bbd1b..8b7f14fd31ad 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -33,11 +33,11 @@
 
 class SwLooping
 {
+public:
     sal_uInt16 nMinPage;
     sal_uInt16 nMaxPage;
     sal_uInt16 nCount;
     sal_uInt16 mnLoopControlStage;
-public:
     explicit SwLooping( SwPageFrame const * pPage );
     void Control( SwPageFrame* pPage );
     void Drastic( SwFrame* pFrame );
@@ -250,6 +250,14 @@ void SwLayouter::LoopingLouieLight( const SwDoc& rDoc, 
const SwTextFrame& rFrame
     }
 }
 
+// this is just for tests
+static int g_LastLoopControlStage;
+
+int SwLayouter::GetLastLoopControlStage()
+{
+    return g_LastLoopControlStage;
+}
+
 bool SwLayouter::StartLooping( SwPageFrame const * pPage )
 {
     if( mpLooping )
@@ -260,6 +268,10 @@ bool SwLayouter::StartLooping( SwPageFrame const * pPage )
 
 void SwLayouter::EndLoopControl()
 {
+    if (mpLooping)
+    {
+        g_LastLoopControlStage = mpLooping->mnLoopControlStage;
+    }
     mpLooping.reset();
 }
 
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index f46c3987cd3a..453d19fcf4e2 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2868,6 +2868,30 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool 
bTst, bool bInfo )
             pToShrink = rEndCell.GetUpper();
         }
 
+        // A table frame may have grown beyond its parent frame after
+        // RemoveFollowFlowLine(), which is a problem in case the parent is a
+        // section: prevent shrinking the section smaller than the contained
+        // table.
+        if (IsTabFrame()
+            && static_cast<SwTabFrame*>(this)->IsRebuildLastLine()
+            && pToShrink == GetUpper()
+            && pToShrink->IsSctFrame()) // not required for page body, unsure 
about others
+        {
+            SwTwips nUpperMin{0};
+            for (SwFrame const* pFrame = pToShrink->GetLower();
+                 pFrame != GetNext(); pFrame = pFrame->GetNext())
+            {
+                nUpperMin += aRectFnSet.GetHeight(pFrame->getFrameArea());
+            }
+            if (aRectFnSet.GetHeight(pToShrink->getFramePrintArea()) - nShrink 
< nUpperMin)
+            {
+                nShrink = aRectFnSet.GetHeight(pToShrink->getFramePrintArea()) 
- nUpperMin;
+                if (nShrink <= 0)
+                {
+                    return 0; // nothing to do
+                }
+            }
+        }
         nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0;
         if( ( SwNeighbourAdjust::GrowAdjust == nAdjust || 
SwNeighbourAdjust::AdjustGrow == nAdjust )
             && nReal < nShrink )
commit c6dbfba6edc2711d812f09fcb3ae8fa863191aa0
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jan 23 20:07:42 2025 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 29 16:27:12 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

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 6ae522c346c2..a888e6bf879e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -236,6 +236,51 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes)
     CheckRedlineFootnotesHidden();
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableSplitBug)
+{
+    createDoc("table-split-bug.fodt");
+
+    {
+        xmlDocPtr 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");
+        discardDumpedLayout();
+    }
+
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->Down(false, 1);
+    pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+    pWrtShell->Delete();
+
+    {
+        xmlDocPtr 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");
+        discardDumpedLayout();
+    }
+
+    pWrtShell->Undo();
+
+    {
+        xmlDocPtr 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");
+        discardDumpedLayout();
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 {
     loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 6905c1e06134..a7b73aa20d20 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -169,7 +169,7 @@ void SwFrame::SetTopBottomMargins( long nTop, 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( long nLeft, long nRight)

Reply via email to