sw/qa/extras/layout/data/U-min.fodt         |  364 ++++++++++++++++++++++++++++
 sw/qa/extras/layout/data/hiddensection.fodt |  128 +++++++++
 sw/qa/extras/layout/layout.cxx              |   99 +++++++
 sw/source/core/inc/frame.hxx                |    1 
 sw/source/core/inc/layfrm.hxx               |    1 
 sw/source/core/inc/txtfrm.hxx               |    2 
 sw/source/core/layout/frmtool.cxx           |   23 +
 sw/source/core/layout/sectfrm.cxx           |   25 +
 sw/source/core/layout/tabfrm.cxx            |    6 
 sw/source/core/text/txtfrm.cxx              |   12 
 10 files changed, 652 insertions(+), 9 deletions(-)

New commits:
commit 36c0a88e5094ff7db0684566bd280e4e45526b8f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Sep 6 14:09:15 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 6 18:08:26 2024 +0200

    sw: fix hiding of flys in hidden sections, part 3
    
    Sigh... the new section frame can be deleted! Missed that...
    
    (regression from commit e2f3ba12c238c895dfd61ad09fcd76789ebbfd53)
    
    Change-Id: I48f2b09ececf8fb8469c53a5ec0a3c75be5f7306
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172966
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 0c6ec63c81676ed675931d9aa8a78d91ed0d9b6e)

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index fe0407407c10..4093623976fc 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1828,10 +1828,6 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
             //section again.
             pActualSection.reset(pActualSection->GetUpper());
             pLay = pLay->FindSctFrame();
-            if (pLay->IsHiddenNow())
-            {
-                
newHiddenSections.push_back(static_cast<SwSectionFrame*>(pLay));
-            }
             if ( pActualSection )
             {
                 //Could be, that the last SectionFrame remains empty.
@@ -1846,6 +1842,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                 }
                 else
                 {
+                    if (pLay->IsHiddenNow())
+                    {
+                        
newHiddenSections.push_back(static_cast<SwSectionFrame*>(pLay));
+                    }
                     pPrv = pLay;
                     pLay = pLay->GetUpper();
                 }
@@ -1889,6 +1889,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
             }
             else
             {
+                if (pLay->IsHiddenNow())
+                {
+                    
newHiddenSections.push_back(static_cast<SwSectionFrame*>(pLay));
+                }
                 //Nothing more with sections, it goes on right behind
                 //the SectionFrame.
                 pPrv = pLay;
commit 42966da91effd9251f21693fb7fba305c6794708
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Sep 5 18:19:44 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 6 18:08:26 2024 +0200

    sw: fix problem with 0-height tables after unhiding section
    
    Mysteriously this works the first time the section is made visible, but
    then hide it again and unhide it and a table has height 0 because only
    the table itself is invalidated and none of the text frames inside it.
    
    SwTabFrame::MakeAll() does Prepare(PrepareHint::FramePositionChanged) on
    all contained text frames, but that may actually do nothing in common
    cases.
    
    So just recursively invalidate everything in the section, that should
    fix things.
    
    (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f)
    
    Change-Id: I26e72193947685fde52fb8da78e95592a3866c12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172920
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit c647937e6066fb911b8ddc5a77b2621d5cb874e4)

diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 9db351ab83b2..c4b0a8674cb3 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2638,6 +2638,24 @@ void SwSectionFrame::CalcEndAtEndFlag()
     }
 }
 
+static void InvalidateFramesInSection(SwFrame * pFrame)
+{
+    while (pFrame)
+    {
+        pFrame->InvalidateAll();
+        pFrame->InvalidateObjs(false);
+        if (pFrame->IsLayoutFrame())
+        {
+            InvalidateFramesInSection(pFrame->GetLower());
+        }
+        else if (pFrame->IsTextFrame())
+        {
+            pFrame->Prepare(PREP_CLEAR, nullptr, false);
+        }
+        pFrame = pFrame->GetNext();
+    }
+}
+
 void SwSectionFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew 
)
 {
     sal_uInt8 nInvFlags = 0;
@@ -2671,35 +2689,8 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem * pNew )
             SwRectFnSet(this).SetHeight(area, HUGE_POSITIVE);
         }
 
-        SwColumnFrame * pColumn{Lower()->IsColumnFrame()
-                ? static_cast<SwColumnFrame*>(Lower()) : nullptr};
-        auto IterateLower = [&pColumn](SwFrame *const pLowerFrame) -> SwFrame*
-        {
-            if (pLowerFrame->GetNext())
-            {
-                return pLowerFrame->GetNext();
-            }
-            if (pColumn)
-            {
-                pColumn = static_cast<SwColumnFrame*>(pColumn->GetNext());
-                if (pColumn)
-                {
-                    return 
static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower();
-                }
-            }
-            return nullptr;
-        };
-        for (SwFrame* pLowerFrame = pColumn
-                    ? static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower()
-                    : Lower();
-             pLowerFrame;
-             pLowerFrame = IterateLower(pLowerFrame))
-        {
-            pLowerFrame->Prepare(PREP_CLEAR, nullptr, false);
-            pLowerFrame->InvalidateAll();
-            pLowerFrame->InvalidateObjs(false);
-            pLowerFrame->HideAndShowObjects();
-        }
+        InvalidateFramesInSection(Lower());
+        Lower()->HideAndShowObjects(); // recursive
         // Check if any page-breaks have been unhidden, create the new pages.
         // Call IsHiddenNow() because a parent section could still hide.
         if (!IsFollow() && IsInDocBody() && !IsInTab() && !IsHiddenNow())
@@ -2726,8 +2717,24 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem * pNew )
                 pFirstOnPage = pFirstOnPage->GetUpper();
             }
             assert(pFirstOnPage->IsContentFrame() || 
pFirstOnPage->IsTabFrame());
-            pColumn = Lower()->IsColumnFrame()
-                ? static_cast<SwColumnFrame*>(Lower()) : nullptr;
+            SwColumnFrame * pColumn{Lower()->IsColumnFrame()
+                    ? static_cast<SwColumnFrame*>(Lower()) : nullptr};
+            auto IterateLower = [&pColumn](SwFrame *const pLowerFrame) -> 
SwFrame*
+            {
+                if (pLowerFrame->GetNext())
+                {
+                    return pLowerFrame->GetNext();
+                }
+                if (pColumn)
+                {
+                    pColumn = static_cast<SwColumnFrame*>(pColumn->GetNext());
+                    if (pColumn)
+                    {
+                        return 
static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower();
+                    }
+                }
+                return nullptr;
+            };
             for (SwFrame* pLowerFrame = pColumn
                         ? 
static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower()
                         : Lower();
commit 35804892af05169ee06e14d7667001c2050c07fc
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Sep 5 12:37:46 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 6 18:08:26 2024 +0200

    sw: fix empty pages after hiding section due to SwTabFrame
    
    The problem with a full customer doc is that a table doesn't MoveBwd
    because ShouldBwdMoved finds that the rows don't fit as the rows still
    have non-0 heights, and the result is an empty page at the end; also the
    table later splits.
    
    Turns out that setting bDontSplit prevents both problems; the inner
    frames are all set to 0 height by lcl_RecalcTable().
    
    (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f)
    
    Change-Id: I5012142a0019ee2e978d5b8a9eb445ff0949e569
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172910
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 8087f479b373299d45469ff3996dba793a9cdb28)

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index cc1a6c7634ba..5b8f6621b070 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2029,9 +2029,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
     // The beloved keep attribute
     const bool bKeep = IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), 
bEmulateTableKeep);
 
+    bool const isHiddenNow(IsHiddenNow());
     // All rows should keep together
-    const bool bDontSplit = !IsFollow() &&
-                            ( !GetFormat()->GetLayoutSplit().GetValue() );
+    const bool bDontSplit = isHiddenNow
+                || (!IsFollow() && !GetFormat()->GetLayoutSplit().GetValue());
 
     // The number of repeated headlines
     const sal_uInt16 nRepeat = GetTable()->GetRowsToRepeat();
@@ -2105,7 +2106,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
         }
     }
 
-    bool const isHiddenNow(IsHiddenNow());
     if (isHiddenNow)
         MakeValidZeroHeight();
 
commit 29ffa428f403560bd245661943fd23b3a98c307e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Sep 5 15:19:13 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 6 18:08:26 2024 +0200

    sw: fix hiding of flys in hidden sections, part 2
    
    Didn't notice that this depends on a global variable "bObjsDirect" so it
    only works for some documents; move the HideAndShowObjects() call to the
    end so it works in all cases.
    
    (follow-up to commit 8a13277f797c6e2f1b0d9060ad6e5e4d72eb76d0)
    
    Change-Id: I26a7cecdb660179f3ac1c3ea1e5d19067806b741
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172915
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit e2f3ba12c238c895dfd61ad09fcd76789ebbfd53)

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 4ec271e9d68f..fe0407407c10 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1529,6 +1529,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
     //the SwActualSection class has a member, which points to an 
upper(section).
     //When the "inner" section finishes, the upper will used instead.
 
+    std::vector<SwSectionFrame *> newHiddenSections;
+
     // Do not consider the end node. The caller (Section/MakeFrames()) has to
     // ensure that the end of this range is positioned before EndIndex!
     for ( ; nEndIndex == 0 || nIndex < nEndIndex; ++nIndex)
@@ -1827,12 +1829,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
             pActualSection.reset(pActualSection->GetUpper());
             pLay = pLay->FindSctFrame();
             if (pLay->IsHiddenNow())
-            {   // flys were created visible
-                for (SwFlowFrame * pSect = SwFlowFrame::CastFlowFrame(pLay);
-                        pSect; pSect = pSect->GetPrecede())
-                {   // flys were created visible
-                    pSect->GetFrame().HideAndShowObjects();
-                }
+            {
+                
newHiddenSections.push_back(static_cast<SwSectionFrame*>(pLay));
             }
             if ( pActualSection )
             {
@@ -1867,11 +1865,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                     }
                     else if (pOuterSectionFrame->IsHiddenNow())
                     {
-                        for (SwFlowFrame * pSect = 
SwFlowFrame::CastFlowFrame(pOuterSectionFrame);
-                                pSect; pSect = pSect->GetPrecede())
-                        {   // flys were created visible
-                            pSect->GetFrame().HideAndShowObjects();
-                        }
+                        newHiddenSections.push_back(pOuterSectionFrame);
                     }
                 }
                 else
@@ -1944,6 +1938,15 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
         bObjsDirect = true;
     }
 
+    // do it after AppendAllObjs()
+    for (SwSectionFrame * pNew : newHiddenSections)
+    {
+        for (SwFlowFrame * pSect = pNew; pSect; pSect = pSect->GetPrecede())
+        {   // flys were created visible; section may be paginated so iterate
+            pSect->GetFrame().HideAndShowObjects();
+        }
+    }
+
     if( pPageMaker )
     {
         pPageMaker->CheckFlyCache( pPage );
commit e72b961bbd3c6cab9fb1732b5108a6719d2736b1
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Sep 3 20:25:36 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 6 18:08:26 2024 +0200

    sw: fix hiding of flys in hidden sections
    
    There are 2 different ways to hide flys, either destroy the SwFlyFrames
    (as is done for delete redlines or fieldmarks) or move them to an
    invisible layer (as is done for field-hidden paragraphs).
    
    Previously for hidden sections the FlyFrames would be destroyed, but
    it's easier now to move them to invisible layer.
    
    HideAndShowObjects() needs to be recursive so it can hide flys that are
    anchored in a table.
    
    (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f)
    
    Change-Id: Ideab0343315e575c066eb9e2e901d2ee0acabe3a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172865
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 8a13277f797c6e2f1b0d9060ad6e5e4d72eb76d0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172892
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 8f7c8c091fbd2d1cf711450fc6c6f4664a73acaf)

diff --git a/sw/qa/extras/layout/data/U-min.fodt 
b/sw/qa/extras/layout/data/U-min.fodt
new file mode 100644
index 000000000000..404cf7b3ed84
--- /dev/null
+++ b/sw/qa/extras/layout/data/U-min.fodt
@@ -0,0 +1,364 @@
+<?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:font-face-decls>
+  <style:font-face style:name="Times New Roman" svg:font-family="'Times New 
Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Times New Roman1" svg:font-family="'Times New 
Roman'" style:font-adornments="Standard" style:font-family-generic="roman" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Arial" svg:font-family="Arial" 
style:font-adornments="Standard" style:font-family-generic="swiss" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Lucida Sans Unicode" svg:font-family="'Lucida 
Sans Unicode'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Tahoma" svg:font-family="Tahoma" 
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="#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="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties fo:color="#000000" style:font-name="Times New Roman" 
fo:font-size="12pt" fo:language="de" fo:country="DE" 
style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="12pt" 
style:language-asian="en" style:country-asian="US" 
style:font-name-complex="Tahoma" style:font-size-complex="12pt" 
style:language-complex="en" style:country-complex="US"/>
+  </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.997cm" 
style:writing-mode="page"/>
+   <style:text-properties fo:color="#000000" style:font-name="Times New Roman" 
fo:font-size="12pt" fo:language="de" fo:country="DE" 
style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="12pt" 
style:language-asian="en" style:country-asian="US" 
style:font-name-complex="Tahoma" style:font-size-complex="12pt" 
style:language-complex="en" style:country-complex="US" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Frame_20_contents" style:display-name="Frame 
contents" style:family="paragraph" style:class="extra"/>
+  <style:style style:name="VordruckGroß" style:family="paragraph" 
style:parent-style-name="Schrift1">
+   <style:text-properties fo:font-size="11pt" fo:font-weight="bold"/>
+  </style:style>
+  <style:style style:name="Schrift1" style:family="paragraph">
+   <style:paragraph-properties>
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:font-name="Arial" fo:font-family="Arial" 
style:font-style-name="Standard" style:font-family-generic="swiss" 
style:font-pitch="variable"/>
+  </style:style>
+  <style:style style:name="Schrift2" style:family="paragraph" 
style:master-page-name="">
+   <style:paragraph-properties style:page-number="auto"/>
+   <style:text-properties style:font-name="Times New Roman1" 
fo:font-family="'Times New Roman'" style:font-style-name="Standard" 
style:font-family-generic="roman" style:font-pitch="variable"/>
+  </style:style>
+  <style:style style:name="TextNormal" style:family="paragraph" 
style:parent-style-name="Schrift2" style:master-page-name="">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" 
loext:contextual-spacing="false" fo:line-height="150%" fo:orphans="2" 
fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:page-number="auto"/>
+   <style:text-properties 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="Vfg2" style:family="paragraph" 
style:parent-style-name="TextNormal" style:list-style-name="Numbering_20_1" 
style:master-page-name="">
+   <style:paragraph-properties fo:line-height="100%" style:page-number="auto" 
text:number-lines="true" text:line-number="2"/>
+  </style:style>
+  <style:style style:name="Kopfzeile_5f_OFD" 
style:display-name="Kopfzeile_OFD" style:family="paragraph" 
style:parent-style-name="VordruckGroß" style:class="extra">
+   <style:paragraph-properties fo:text-align="center" 
style:justify-single-word="false"/>
+   <style:text-properties style:font-name="Times New Roman" 
fo:font-family="'Times New Roman'" style:font-family-generic="roman" 
style:font-pitch="variable" fo:font-size="12pt"/>
+  </style:style>
+  <style:style style:name="Fusszeile_5f_OFD" 
style:display-name="Fusszeile_OFD" style:family="paragraph" 
style:parent-style-name="Schrift1" style:class="extra" 
style:master-page-name="">
+   <style:paragraph-properties fo:text-align="end" 
style:justify-single-word="false" style:page-number="auto">
+    <style:tab-stops>
+     <style:tab-stop style:position="17cm" style:type="right"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+   <style:text-properties style:font-name="Times New Roman1" 
fo:font-family="'Times New Roman'" style:font-style-name="Standard" 
style:font-family-generic="roman" style:font-pitch="variable" 
fo:font-size="12pt"/>
+  </style:style>
+  <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote 
Symbol" style:family="text"/>
+  <style:style style:name="Numbering_20_Symbols" style:display-name="Numbering 
Symbols" style:family="text"/>
+  <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote 
Symbol" style:family="text"/>
+  <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>
+  <style:style style:name="Frame" style:family="graphic">
+   <style:graphic-properties style:wrap="dynamic" 
style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false"/>
+  </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:list-style style:name="Numbering_20_1" style:display-name="Numbering 
1">
+   <text:list-level-style-number text:level="1" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1" text:start-value="2">
+    <style:list-level-properties text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="2" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="0.499cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="3" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="0.999cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="4" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="1.498cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="5" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="1.997cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="6" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="2.496cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="7" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="2.995cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="8" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="3.494cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="9" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="3.994cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+   <text:list-level-style-number text:level="10" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties text:space-before="4.493cm" 
text:min-label-width="0.499cm"/>
+   </text:list-level-style-number>
+  </text:list-style>
+  <text:notes-configuration text:note-class="footnote" 
text:citation-style-name="Footnote_20_Symbol" 
text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="page"/>
+  <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"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Schrift1">
+   <style:paragraph-properties>
+    <style:tab-stops>
+     <style:tab-stop style:position="17cm" style:type="right"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+  </style:style>
+  <style:style style:name="P3" style:family="paragraph" 
style:parent-style-name="VordruckGroß">
+   <style:paragraph-properties fo:margin-left="1.05cm" fo:margin-right="0cm" 
fo:text-indent="-1cm" style:auto-text-indent="false"/>
+  </style:style>
+  <style:style style:name="P33" style:family="paragraph" 
style:parent-style-name="Frame_20_contents">
+   <style:paragraph-properties fo:text-align="center" 
style:justify-single-word="false"/>
+  </style:style>
+  <style:style style:name="P37" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0.019cm" 
fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false" 
fo:text-indent="0cm" style:auto-text-indent="false">
+    <style:tab-stops>
+     <style:tab-stop style:position="7.976cm"/>
+     <style:tab-stop style:position="9.49cm"/>
+     <style:tab-stop style:position="16.508cm"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+   <style:text-properties fo:font-size="12pt" 
style:text-underline-style="none"/>
+  </style:style>
+  <style:style style:name="P40" style:family="paragraph" 
style:parent-style-name="TextNormal">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0.019cm" 
fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false" 
fo:text-indent="0cm" style:auto-text-indent="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties fo:font-size="8pt" style:text-underline-style="none" 
fo:font-weight="normal" style:font-size-asian="8pt" 
style:font-size-complex="8pt"/>
+  </style:style>
+  <style:style style:name="P46" style:family="paragraph" 
style:parent-style-name="TextNormal">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0.019cm" 
fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false" 
fo:text-indent="0cm" style:auto-text-indent="false">
+    <style:tab-stops>
+     <style:tab-stop style:position="7.976cm"/>
+     <style:tab-stop style:position="9.49cm"/>
+     <style:tab-stop style:position="16.508cm"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+   <style:text-properties fo:font-size="12pt" 
style:text-underline-style="none"/>
+  </style:style>
+  <style:style style:name="P52" style:family="paragraph" 
style:parent-style-name="TextNormal">
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0.019cm" 
fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false" 
fo:text-indent="0cm" style:auto-text-indent="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties fo:font-size="6pt" style:text-underline-style="none" 
fo:font-weight="normal" style:font-size-asian="6pt" 
style:font-size-complex="6pt"/>
+  </style:style>
+  <style:style style:name="P61" style:family="paragraph" 
style:parent-style-name="TextNormal" style:master-page-name="">
+   <style:paragraph-properties fo:text-align="start" 
style:justify-single-word="false" fo:keep-together="always" 
style:page-number="auto" fo:keep-with-next="always">
+    <style:tab-stops>
+     <style:tab-stop style:position="1.342cm"/>
+    </style:tab-stops>
+   </style:paragraph-properties>
+   <style:text-properties style:text-underline-style="none"/>
+  </style:style>
+  <style:style style:name="P83" style:family="paragraph" 
style:parent-style-name="TextNormal" style:master-page-name="FragebogenRechts">
+   <style:paragraph-properties style:page-number="auto" 
fo:break-before="page"/>
+  </style:style>
+  <style:style style:name="P85" style:family="paragraph" 
style:parent-style-name="Vfg2" style:list-style-name="">
+   <style:paragraph-properties fo:line-height="150%"/>
+   <style:text-properties style:text-underline-style="none"/>
+  </style:style>
+  <style:style style:name="T1" style:family="text">
+   <style:text-properties fo:font-size="10pt"/>
+  </style:style>
+  <style:style style:name="T4" style:family="text">
+   <style:text-properties fo:font-weight="normal"/>
+  </style:style>
+  <style:style style:name="fr3" style:family="graphic" 
style:parent-style-name="Frameformat">
+   <style:graphic-properties style:protect="content size position" 
style:vertical-pos="from-top" style:vertical-rel="paragraph" 
style:horizontal-pos="from-left" style:horizontal-rel="paragraph" 
fo:padding="0.049cm" fo:border-left="none" fo:border-right="none" 
fo:border-top="0.06pt solid #000000" fo:border-bottom="none"/>
+  </style:style>
+  <style:style style:name="fr7" style:family="graphic" 
style:parent-style-name="Frame">
+   <style:graphic-properties style:wrap="parallel" 
style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" 
style:vertical-rel="paragraph" style:horizontal-pos="from-left" 
style:horizontal-rel="paragraph"/>
+  </style:style>
+  <style:style style:name="fr8" style:family="graphic" 
style:parent-style-name="Frame">
+   <style:graphic-properties style:protect="size position" 
style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" 
style:vertical-pos="from-top" style:vertical-rel="paragraph" 
style:horizontal-pos="from-left" style:horizontal-rel="paragraph" 
fo:padding="0.049cm" fo:border="none">
+    <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+   </style:graphic-properties>
+  </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="20.999cm" 
fo:page-height="29.699cm" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="1cm" fo:margin-bottom="1cm" 
fo:margin-left="2.499cm" fo:margin-right="1.499cm" 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">
+    <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:header-footer-properties svg:height="0.9cm" fo:margin-left="0cm" 
fo:margin-right="0cm" fo:margin-top="0.3cm"/>
+   </style:footer-style>
+  </style:page-layout>
+  <style:page-layout style:name="pm8">
+   <style:page-layout-properties fo:page-width="20.999cm" 
fo:page-height="29.699cm" 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">
+    <style:footnote-sep 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:page-layout style:name="pm11">
+   <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="1cm" fo:margin-bottom="1cm" fo:margin-left="2.401cm" 
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">
+    <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:header-footer-properties svg:height="1.499cm" fo:margin-left="0cm" 
fo:margin-right="0cm" fo:margin-bottom="1cm"/>
+   </style:header-style>
+   <style:footer-style>
+    <style:header-footer-properties svg:height="0.9cm" fo:margin-left="0cm" 
fo:margin-right="0cm" fo:margin-top="0.3cm"/>
+   </style:footer-style>
+  </style:page-layout>
+  <style:page-layout style:name="pm12" style:page-usage="right">
+   <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="1cm" fo:margin-bottom="1cm" fo:margin-left="2.401cm" 
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">
+    <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:header-footer-properties svg:height="0.9cm" fo:margin-left="0cm" 
fo:margin-right="0cm" fo:margin-top="0.3cm"/>
+   </style:footer-style>
+  </style:page-layout>
+  <number:number-style style:name="N0">
+   <number:number number:min-integer-digits="1"/>
+  </number:number-style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1">
+   <style:footer>
+    <text:p text:style-name="P1"><text:tab/><text:span 
text:style-name="T1"><text:page-continuation text:string-value="- " 
text:select-page="next"/></text:span><text:span 
text:style-name="T1"><text:page-number text:select-page="current" 
text:page-adjust="1"/></text:span><text:span 
text:style-name="T1"><text:page-continuation text:string-value=" -" 
text:select-page="next"/></text:span></text:p>
+   </style:footer>
+  </style:master-page>
+  <style:master-page style:name="Endnote" style:page-layout-name="pm8"/>
+  <style:master-page style:name="Fragebogen" style:page-layout-name="pm11">
+   <style:header>
+    <text:p text:style-name="Kopfzeile_5f_OFD"><text:span 
text:style-name="T4">- </text:span><text:span 
text:style-name="T4"><text:page-number 
text:select-page="current">0</text:page-number></text:span><text:span 
text:style-name="T4"><text:s/>-</text:span></text:p>
+   </style:header>
+   <style:footer>
+    <text:p 
text:style-name="Fusszeile_5f_OFD"><text:tab/><text:page-continuation 
text:string-value="- " text:select-page="next"/><text:page-number 
text:select-page="current" text:page-adjust="1"/><text:page-continuation 
text:string-value=" -" text:select-page="next"/></text:p>
+   </style:footer>
+  </style:master-page>
+  <style:master-page style:name="FragebogenRechts" 
style:page-layout-name="pm12" style:next-style-name="Fragebogen">
+   <style:footer>
+    <text:p text:style-name="Fusszeile_5f_OFD"><text:tab/></text:p>
+   </style:footer>
+  </style:master-page>
+ </office:master-styles>
+ <office:body>
+  <office:text text:use-soft-page-breaks="true">
+   <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+   <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:user-field-decls>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Name1"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Postfach"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Plz2"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Ort"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Straße"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Plz1"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31Name2"/>
+    <text:user-field-decl office:value-type="string" office:string-value="" 
text:name="x31GrosskPLZ"/>
+    <text:user-field-decl office:value-type="float" office:value="0" 
text:name="Verfügung"/>
+   </text:user-field-decls>
+   <text:p text:style-name="P85"><text:hidden-paragraph 
text:condition="ooow:TRUE" text:is-hidden="true"/></text:p>
+   <text:p text:style-name="P61"/>
+   <text:section text:style-name="Sect1" text:name="Anlage" 
text:condition="ooow:Verfügung EQ 0" text:is-hidden="true" 
text:display="condition">
+    <text:p text:style-name="P83"><text:hidden-paragraph 
text:condition="ooow:Verfügung EQ 1"/></text:p>
+    <text:p text:style-name="P46"><draw:frame draw:style-name="fr8" 
draw:name="Rahmen19" text:anchor-type="paragraph" svg:x="0cm" svg:y="1.251cm" 
svg:width="7.997cm" draw:z-index="1">
+      <draw:text-box fo:min-height="3cm">
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:line-break/>Postfach <text:user-field-get 
text:name="x31Postfach"/><text:line-break/><text:user-field-get 
text:name="x31Plz2"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:NOT(x31Plz2 G 
&quot; &quot;) OR (x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)" text:is-hidden="true"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:line-break/><text:user-field-get 
text:name="x31Straße"/><text:line-break/><text:user-field-get 
text:name="x31Plz1"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:x31Plz2 G 
&quot; &quot; OR (x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:s/><text:user-field-get 
text:name="x31Name2"/><text:line-break/>Postfach <text:user-field-get 
text:name="x31Postfach"/><text:line-break/><text:user-field-get 
text:name="x31Plz2"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:NOT(x31Plz2 G 
&quot; &quot;) OR NOT(x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)" text:is-hidden="true"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:s/><text:user-field-get 
text:name="x31Name2"/><text:line-break/><text:user-field-get 
text:name="x31Straße"/><text:line-break/><text:user-field-get 
text:name="x31Plz1"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:x31Plz2 G 
&quot; &quot; OR NOT(x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)" text:is-hidden="true"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:line-break/><text:user-field-get 
text:name="x31GrosskPLZ"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:x31GrosskPLZ EQ 
&quot;&quot;" text:is-hidden="true"/></text:p>
+      </draw:text-box>
+     </draw:frame><draw:frame draw:style-name="fr3" draw:name="Rahmen21" 
text:anchor-type="paragraph" svg:x="-1.625cm" svg:y="5.907cm" 
svg:width="0.497cm" svg:height="0.497cm" draw:z-index="2">
+      <draw:text-box>
+       <text:p text:style-name="P3"/>
+      </draw:text-box>
+     </draw:frame></text:p>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"><draw:frame draw:style-name="fr7" 
draw:name="Rahmen22" text:anchor-type="paragraph" svg:x="9.615cm" 
svg:y="0.238cm" svg:width="6.863cm" draw:z-index="3">
+      <draw:text-box fo:min-height="0.826cm">
+       <text:p text:style-name="P33">(Nichtzutreffendes streichen bzw. 
Zutreffendes ankreuzen)</text:p>
+      </draw:text-box>
+     </draw:frame></text:p>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P52"/>
+    <text:p text:style-name="P40"/>
+    <text:p text:style-name="P37"><draw:frame draw:style-name="fr3" 
draw:name="Rahmen24" text:anchor-type="paragraph" svg:x="-1.625cm" 
svg:y="5.907cm" svg:width="0.497cm" svg:height="0.497cm" draw:z-index="6">
+      <draw:text-box>
+       <text:p text:style-name="P3"/>
+      </draw:text-box>
+     </draw:frame><draw:frame draw:style-name="fr8" draw:name="Rahmen25" 
text:anchor-type="paragraph" svg:x="0cm" svg:y="1.251cm" svg:width="7.997cm" 
draw:z-index="5">
+      <draw:text-box fo:min-height="3cm">
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:line-break/>Postfach <text:user-field-get 
text:name="x31Postfach"/><text:line-break/><text:user-field-get 
text:name="x31Plz2"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:NOT(x31Plz2 G 
&quot; &quot;) OR (x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)" text:is-hidden="true"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:line-break/><text:user-field-get 
text:name="x31Straße"/><text:line-break/><text:user-field-get 
text:name="x31Plz1"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:x31Plz2 G 
&quot; &quot; OR (x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:s/><text:user-field-get 
text:name="x31Name2"/><text:line-break/>Postfach <text:user-field-get 
text:name="x31Postfach"/><text:line-break/><text:user-field-get 
text:name="x31Plz2"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:NOT(x31Plz2 G 
&quot; &quot;) OR NOT(x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)" text:is-hidden="true"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:s/><text:user-field-get 
text:name="x31Name2"/><text:line-break/><text:user-field-get 
text:name="x31Straße"/><text:line-break/><text:user-field-get 
text:name="x31Plz1"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:x31Plz2 G 
&quot; &quot; OR NOT(x31Name2 G &quot; &quot;) OR (x31GrosskPLZ NEQ 
&quot;&quot;)" text:is-hidden="true"/></text:p>
+       <text:p text:style-name="TextNormal"><text:user-field-get 
text:name="x31Name1"/><text:line-break/><text:user-field-get 
text:name="x31GrosskPLZ"/> <text:user-field-get 
text:name="x31Ort"/><text:hidden-paragraph text:condition="ooow:x31GrosskPLZ EQ 
&quot;&quot;" text:is-hidden="true"/></text:p>
+      </draw:text-box>
+     </draw:frame></text:p>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"/>
+    <text:p text:style-name="P46"><draw:frame draw:style-name="fr7" 
draw:name="Rahmen18" text:anchor-type="paragraph" svg:x="9.615cm" 
svg:y="0.238cm" svg:width="6.863cm" draw:z-index="4">
+      <draw:text-box fo:min-height="0.826cm">
+       <text:p text:style-name="P33">(Nichtzutreffendes streichen bzw. 
Zutreffendes ankreuzen)</text:p>
+      </draw:text-box>
+     </draw:frame></text:p>
+    <text:p text:style-name="P46"/>
+   </text:section>
+   <text:p text:style-name="Standard"><text:hidden-paragraph 
text:condition="ooow:true" text:is-hidden="true"/></text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 75d5dd7a5cd0..619ff3f27567 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -23,6 +23,7 @@
 #include <editeng/fhgtitem.hxx>
 #include <editeng/postitem.hxx>
 #include <editeng/unolingu.hxx>
+#include <svx/svdpage.hxx>
 #include <fmtanchr.hxx>
 #include <fmtfsize.hxx>
 #include <fmtcntnt.hxx>
@@ -36,6 +37,8 @@
 #include <anchoredobject.hxx>
 #include <ndtxt.hxx>
 #include <frmatr.hxx>
+#include <drawdoc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <fldmgr.hxx>
 
@@ -4533,6 +4536,67 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testSectionUnhide)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testHiddenSectionFlys)
+{
+    SwDoc* pDoc = createDoc("U-min.fodt");
+
+    //NO! field update job masks if the visibility was created wrong when 
loading.
+    //Scheduler::ProcessEventsToIdle();
+
+    IDocumentDrawModelAccess const& rIDMA{ pDoc->getIDocumentDrawModelAccess() 
};
+    SdrPage const* pDrawPage{ rIDMA.GetDrawModel()->GetPage(0) };
+    int invisibleHeaven{ rIDMA.GetInvisibleHeavenId().get() };
+    int visibleHeaven{ rIDMA.GetHeavenId().get() };
+
+    // these are hidden by moving to invisible layer, they're still in layout
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, "//anchored/fly", 6);
+        discardDumpedLayout();
+
+        CPPUNIT_ASSERT_EQUAL(size_t(6), pDrawPage->GetObjCount());
+        for (int i = 0; i < 6; ++i)
+        {
+            CPPUNIT_ASSERT_EQUAL(invisibleHeaven, 
int(pDrawPage->GetObj(i)->GetLayer().get()));
+        }
+    }
+
+    // Show the section
+    uno::Reference<css::text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY_THROW);
+    auto xSections = xTextSectionsSupplier->getTextSections();
+    CPPUNIT_ASSERT(xSections);
+    uno::Reference<css::beans::XPropertySet> 
xSection(xSections->getByName("Anlage"), uno::UNO_QUERY_THROW);
+    xSection->setPropertyValue("IsVisible", css::uno::Any(true));
+    calcLayout();
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, "//anchored/fly", 6);
+        discardDumpedLayout();
+
+        CPPUNIT_ASSERT_EQUAL(size_t(6), pDrawPage->GetObjCount());
+        for (int i = 0; i < 6; ++i)
+        {
+            CPPUNIT_ASSERT_EQUAL(visibleHeaven, 
int(pDrawPage->GetObj(i)->GetLayer().get()));
+        }
+    }
+
+    xSection->setPropertyValue("IsVisible", css::uno::Any(false));
+    calcLayout();
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, "//anchored/fly", 6);
+        discardDumpedLayout();
+
+        CPPUNIT_ASSERT_EQUAL(size_t(6), pDrawPage->GetObjCount());
+        for (int i = 0; i < 6; ++i)
+        {
+            CPPUNIT_ASSERT_EQUAL(invisibleHeaven, 
int(pDrawPage->GetObj(i)->GetLayer().get()));
+        }
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testHiddenSectionPageDescs)
 {
     createDoc("hidden-sections-with-pagestyles.odt");
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 151f7686aab9..6a498a1bb316 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -863,6 +863,7 @@ public:
 
     virtual bool IsHiddenNow() const;
     void MakeValidZeroHeight();
+    virtual void HideAndShowObjects();
 
     bool IsColLocked()  const { return mbColLocked; }
     virtual bool IsDeleteForbidden() const { return mnForbidDelete > 0; }
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index 89d23f210f45..f5c8c508389c 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -84,6 +84,7 @@ public:
 
     virtual void Cut() override;
     virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) 
override;
+    virtual void HideAndShowObjects() override;
 
     /**
      * Finds the closest Content for the SPoint
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 7681324c7eed..8aec601eac38 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -546,7 +546,7 @@ public:
      * at/as a character of the paragraph, corresponding to the paragraph and
      * paragraph portion visibility.
      */
-    void HideAndShowObjects();
+    void HideAndShowObjects() override;
 
     /// Footnote
     void RemoveFootnote(TextFrameIndex nStart,
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 111623518f24..4ec271e9d68f 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1826,6 +1826,14 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
             //section again.
             pActualSection.reset(pActualSection->GetUpper());
             pLay = pLay->FindSctFrame();
+            if (pLay->IsHiddenNow())
+            {   // flys were created visible
+                for (SwFlowFrame * pSect = SwFlowFrame::CastFlowFrame(pLay);
+                        pSect; pSect = pSect->GetPrecede())
+                {   // flys were created visible
+                    pSect->GetFrame().HideAndShowObjects();
+                }
+            }
             if ( pActualSection )
             {
                 //Could be, that the last SectionFrame remains empty.
@@ -1857,6 +1865,14 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                         pOuterSectionFrame->DelEmpty( true );
                         SwFrame::DestroyFrame(pOuterSectionFrame);
                     }
+                    else if (pOuterSectionFrame->IsHiddenNow())
+                    {
+                        for (SwFlowFrame * pSect = 
SwFlowFrame::CastFlowFrame(pOuterSectionFrame);
+                                pSect; pSect = pSect->GetPrecede())
+                        {   // flys were created visible
+                            pSect->GetFrame().HideAndShowObjects();
+                        }
+                    }
                 }
                 else
                 {
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 44ef3bb8908d..9db351ab83b2 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2698,6 +2698,7 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem * pNew )
             pLowerFrame->Prepare(PREP_CLEAR, nullptr, false);
             pLowerFrame->InvalidateAll();
             pLowerFrame->InvalidateObjs(false);
+            pLowerFrame->HideAndShowObjects();
         }
         // Check if any page-breaks have been unhidden, create the new pages.
         // Call IsHiddenNow() because a parent section could still hide.
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 676210c0c800..62edda851bbd 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1646,6 +1646,18 @@ void SwTextFrame::HideAndShowObjects()
     }
 }
 
+void SwLayoutFrame::HideAndShowObjects()
+{
+    for (SwFrame * pLower = Lower(); pLower; pLower = pLower->GetNext())
+    {
+        pLower->HideAndShowObjects();
+    }
+}
+
+void SwFrame::HideAndShowObjects()
+{
+}
+
 /**
  * Returns the first possible break point in the current line.
  * This method is used in SwTextFrame::Format() to decide whether the previous
commit 2ab1f0a3f5b783c24c6481689bbc9b27824567d9
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Sep 2 18:24:53 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Sep 6 18:08:26 2024 +0200

    sw: fix problem with 0-height text frames after unhiding section
    
    Not sure how this happens, apparently only in some specific
    circumstance, but the problem is that the SwTextFrame::Format() does
    nothing because !aAccess.GetPara()->GetReformat().Len().
    
    Also adapt the loop in SwSectionFrame::SwClientNotify() to columns.
    
    (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f)
    
    Change-Id: Iba0b1657f915530ab9841823ad5ad1e7faa15e8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172776
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit d25f3a9eac1690e1d05840a4f00796d6ddba669b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172790
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 2b02d124e649a31dfb98dce531bd61f46b7f3e9d)

diff --git a/sw/qa/extras/layout/data/hiddensection.fodt 
b/sw/qa/extras/layout/data/hiddensection.fodt
new file mode 100644
index 000000000000..b760e308e9b4
--- /dev/null
+++ b/sw/qa/extras/layout/data/hiddensection.fodt
@@ -0,0 +1,128 @@
+<?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.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2024-09-02T14:59:23.392522133</meta:creation-date><dc:date>2024-09-02T18:22:43.232050806</dc:date><meta:editing-duration>PT6M</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/b350c056394d1e55bbb56b2c5b8bd619ab96c75a</meta:generator><meta:document-statistic
 meta:table-count="0" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="7" meta:word-count="8" 
meta:character-count="47" 
meta:non-whitespace-character-count="46"/></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Arial Unicode MS1" svg:font-family="'Arial 
Unicode MS'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <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="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="Arial Unicode MS1" 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="Arial Unicode MS1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" loext:num-list-format="%1%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" loext:num-list-format="%2%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" loext:num-list-format="%3%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" loext:num-list-format="%4%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" loext:num-list-format="%5%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" loext:num-list-format="%6%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" loext:num-list-format="%7%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" loext:num-list-format="%8%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" loext:num-list-format="%9%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" loext:num-list-format="%10%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties/>
+  </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:print-orientation="portrait" 
fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" 
fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" 
style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="false" style:layout-grid-display="false" 
style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:style style:name="dp1" style:family="drawing-page">
+   <style:drawing-page-properties draw:background-size="full"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1" 
draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1">Aaa</text:p>
+   <text:p text:style-name="P1">vcvacv</text:p>
+   <text:section text:style-name="Sect1" text:name="Section1">
+    <text:p text:style-name="P1">aav adf</text:p>
+    <text:p text:style-name="P1">acvcvdf</text:p>
+    <text:p text:style-name="P1">addfdff</text:p>
+    <text:p text:style-name="P1"/>
+   </text:section>
+   <text:p text:style-name="P1">asdcccf</text:p>
+   <text:p text:style-name="P1">asdbcvcvfc</text:p>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index b67a89ec0356..75d5dd7a5cd0 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -4498,6 +4498,41 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTdf160958_orphans)
     assertXPath(pExportDump, "//page[2]/body/txt[1]/LineBreak", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testSectionUnhide)
+{
+    createDoc("hiddensection.fodt");
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, 
"/root/page/body/section/txt/infos/bounds[@height='0']", 0);
+        discardDumpedLayout();
+    }
+
+    // Hide the section
+    uno::Reference<css::text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY_THROW);
+    auto xSections = xTextSectionsSupplier->getTextSections();
+    CPPUNIT_ASSERT(xSections);
+    uno::Reference<css::beans::XPropertySet> 
xSection(xSections->getByName("Section1"), uno::UNO_QUERY_THROW);
+    xSection->setPropertyValue("IsVisible", css::uno::Any(false));
+    calcLayout();
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        assertXPath(pXmlDoc, 
"/root/page/body/section/txt/infos/bounds[@height='0']", 4);
+        discardDumpedLayout();
+    }
+
+    xSection->setPropertyValue("IsVisible", css::uno::Any(true));
+    calcLayout();
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        // the problem was that 3 of the text frames had 0 height because 
Format was skipped
+        assertXPath(pXmlDoc, 
"/root/page/body/section/txt/infos/bounds[@height='0']", 0);
+        discardDumpedLayout();
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testHiddenSectionPageDescs)
 {
     createDoc("hidden-sections-with-pagestyles.odt");
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 05b769d9e6df..44ef3bb8908d 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2671,8 +2671,31 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem * pNew )
             SwRectFnSet(this).SetHeight(area, HUGE_POSITIVE);
         }
 
-        for (SwFrame* pLowerFrame = Lower(); pLowerFrame; pLowerFrame = 
pLowerFrame->GetNext())
+        SwColumnFrame * pColumn{Lower()->IsColumnFrame()
+                ? static_cast<SwColumnFrame*>(Lower()) : nullptr};
+        auto IterateLower = [&pColumn](SwFrame *const pLowerFrame) -> SwFrame*
         {
+            if (pLowerFrame->GetNext())
+            {
+                return pLowerFrame->GetNext();
+            }
+            if (pColumn)
+            {
+                pColumn = static_cast<SwColumnFrame*>(pColumn->GetNext());
+                if (pColumn)
+                {
+                    return 
static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower();
+                }
+            }
+            return nullptr;
+        };
+        for (SwFrame* pLowerFrame = pColumn
+                    ? static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower()
+                    : Lower();
+             pLowerFrame;
+             pLowerFrame = IterateLower(pLowerFrame))
+        {
+            pLowerFrame->Prepare(PREP_CLEAR, nullptr, false);
             pLowerFrame->InvalidateAll();
             pLowerFrame->InvalidateObjs(false);
         }
@@ -2702,24 +2725,8 @@ void SwSectionFrame::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem * pNew )
                 pFirstOnPage = pFirstOnPage->GetUpper();
             }
             assert(pFirstOnPage->IsContentFrame() || 
pFirstOnPage->IsTabFrame());
-            SwColumnFrame * pColumn{Lower()->IsColumnFrame()
-                    ? static_cast<SwColumnFrame*>(Lower()) : nullptr};
-            auto IterateLower = [&pColumn](SwFrame *const pLowerFrame) -> 
SwFrame*
-            {
-                if (pLowerFrame->GetNext())
-                {
-                    return pLowerFrame->GetNext();
-                }
-                if (pColumn)
-                {
-                    pColumn = static_cast<SwColumnFrame*>(pColumn->GetNext());
-                    if (pColumn)
-                    {
-                        return 
static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower();
-                    }
-                }
-                return nullptr;
-            };
+            pColumn = Lower()->IsColumnFrame()
+                ? static_cast<SwColumnFrame*>(Lower()) : nullptr;
             for (SwFrame* pLowerFrame = pColumn
                         ? 
static_cast<SwLayoutFrame*>(pColumn->Lower())->Lower()
                         : Lower();

Reply via email to