sw/qa/extras/layout/data/fdo56797-2-min.odt |binary
 sw/qa/extras/layout/layout.cxx              |   31 ++++++++++++++++++++++++++++
 sw/source/core/layout/layact.cxx            |    6 ++---
 3 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 70265179db368c1f3f5d4463bcb303be88c07e10
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Aug 14 17:27:52 2023 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Tue Aug 15 20:20:34 2023 +0200

    tdf#156724 tdf#156722 sw: layout: remove IsPaintLocked() check
    
    Get rid of the problematic IsPaintLocked() and only check for a column
    parent; effectively this prevents formatting frames in columns even when
    loaded from the UI, so the layout will hopefully be the same regardless
    of how it is invoked.
    
    Change-Id: Ib4cc2efdb68ef4db73dcad01c7e1bd4be35de071
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155673
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 61a78a523a6131ff98b5d846368e5626fe58d99c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155710
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 88185c8de95a..2de17673e0e2 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1365,7 +1365,7 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
             else if( !pLow->IsSctFrame() || 
static_cast<SwSectionFrame*>(pLow)->GetSection() )
                 bChanged |= FormatLayout( pRenderContext, 
static_cast<SwLayoutFrame*>(pLow), bAddRect );
         }
-        else if (m_pImp->GetShell()->IsPaintLocked() || 
!pLay->IsColBodyFrame())
+        else if (!pLay->IsColBodyFrame())
         {   // tdf#156724 unconditionally for frames in tables, so their 
footnotes exist before trying to split
             pLow->OptCalc();
         }
commit 46274983c3ac31a0580a4baeb26e3b5d79ed3c91
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Aug 14 17:13:17 2023 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Tue Aug 15 20:20:22 2023 +0200

    tdf#156724 tdf#156722 tdf#156745 sw: layout: partially remove 
IsPaintLocked()
    
    Having the layout algorithm dependend on IsPaintLocked() is very
    problematic; it is typically set when the layout is invoked from
    SwViewShell code, as happens several times when loading a document in
    response to window resize events etc., but not for idle formatting or
    from SwXTextDocument::getRendererCount(), hence these bugs only
    reproduce with soffice --convert-to pdf, not via UI.
    
    For tdf#156724 the problem is that the table is split, during formatting
    of the split row a new footnote is created on page 1, and this reduces
    the space, so splitting fails and is never attempted again.
    
    When the document is loaded from UI, when the table is split the
    footnote already exists and so splitting succeeds; it was created by
    a call from SwLayAction::FormatLayout() of the cell frame.
    
    It turns out that when the condition is removed completely, testUXTSOREL
    will take 5 minutes instead of 5 seconds, which seems excessive; the
    problem there appears to be that a text frame in a columned section
    moves forward and backward; plausibly columned section content should be
    formatted by ::CalcContent() only.
    
    (reportedly regression from commit c605283ad6785dea762feab5fdffd9d27e75c292 
and commit
    7e8b4756d95057f069467b34e7849f9354856578)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155672
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 610c6f02b11b4b4c555a78b0feb2a1eb35159e39)
    
    Change-Id: I9ed73588efeec654a769eee8aa825186bd51e059
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155689
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/qa/extras/layout/data/fdo56797-2-min.odt 
b/sw/qa/extras/layout/data/fdo56797-2-min.odt
new file mode 100644
index 000000000000..624149ec0248
Binary files /dev/null and b/sw/qa/extras/layout/data/fdo56797-2-min.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 11c502d4c09d..f72715fcba43 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3641,6 +3641,37 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155324)
     assertXPath(pXmlDoc, "/root/page[5]/ftncont/ftn", 5);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf156724)
+{
+    discardDumpedLayout();
+    if (mxComponent.is())
+        mxComponent->dispose();
+
+    OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"/fdo56797-2-min.odt");
+
+    // note: must set Hidden property, so that 
SfxFrameViewWindow_Impl::Resize()
+    // does *not* forward initial VCL Window Resize and thereby triggers a
+    // layout which does not happen on soffice --convert-to pdf.
+    std::vector<beans::PropertyValue> aFilterOptions = {
+        { beans::PropertyValue("Hidden", -1, uno::Any(true), 
beans::PropertyState_DIRECT_VALUE) },
+    };
+
+    // inline the loading because currently properties can't be passed...
+    mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument",
+                                  
comphelper::containerToSequence(aFilterOptions));
+    save("writer_pdf_Export", maTempFile);
+
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    // both pages have a tab frame and one footnote
+    assertXPath(pXmlDoc, "/root/page[1]/body/tab", 1);
+    assertXPath(pXmlDoc, "/root/page[1]/ftncont", 1);
+    assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn", 1);
+    assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1);
+    assertXPath(pXmlDoc, "/root/page[2]/ftncont", 1);
+    assertXPath(pXmlDoc, "/root/page[2]/ftncont/ftn", 1);
+    assertXPath(pXmlDoc, "/root/page", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 6a2fd2046ffb..88185c8de95a 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1365,10 +1365,10 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
             else if( !pLow->IsSctFrame() || 
static_cast<SwSectionFrame*>(pLow)->GetSection() )
                 bChanged |= FormatLayout( pRenderContext, 
static_cast<SwLayoutFrame*>(pLow), bAddRect );
         }
-        else if ( m_pImp->GetShell()->IsPaintLocked() )
-            // Shortcut to minimize the cycles. With Lock, the
-            // paint is coming either way (primarily for browse)
+        else if (m_pImp->GetShell()->IsPaintLocked() || 
!pLay->IsColBodyFrame())
+        {   // tdf#156724 unconditionally for frames in tables, so their 
footnotes exist before trying to split
             pLow->OptCalc();
+        }
 
         if ( IsAgain() )
             return false;

Reply via email to