sw/qa/extras/layout/data/in_056132_mod.odt |binary
 sw/qa/extras/layout/layout.cxx             |   49 +++++++++++++++++++++++++++++
 sw/source/core/layout/calcmove.cxx         |    7 ----
 3 files changed, 49 insertions(+), 7 deletions(-)

New commits:
commit dc1f177b42658a5e02a2745545dba25203a81536
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Sep 21 18:33:43 2022 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Sat Sep 24 12:50:39 2022 +0200

    tdf#150616 sw: fix bad 0 height of SwTextFrame in table cell
    
    The bugdoc has a text frame 42 immediately following a section which
    contains a nested table, both inside a table cell 29.
    
    The problem is that with soffice --convert-to pdf, the height of frame
    42 ends up as 0, after a single layout action; this does not happen when
    loading it from UI.
    
    When the frame 42 is formatted, it calculates the needed height, and
    grows, but in SwTextFrame::AdjustFrame() it doesn't fit into its upper
    cell frame with a negative nRstHeight at this point, and the text frame
    is reduced to height 0.
    
    The odd code in SwContentFrame::MakeAll() exists unchanged since CVS
    initial import and is poorly motivated. It is highly suspicious that it
    simply grows the upper frame, without invalidating the size of the
    current one (which was already shrunk), and/or clearing the
    m_bUndersized flag.
    
    If this code is removed, on formatting the next frame 43, it goes up and
    formats the cell frame, which grows and at the same time importantly
    invalidates the text frame 42, so it will be formatted again and full
    height.
    
    At the point when the frame 42 was formatted, its upper cell frame was
    size-invalid, so it looks like that will be formatted eventually in any
    case and then invalidate 42.
    
    (regression from commit e7874c936dd1ff9b3423eb7477cbee2494535176
     but unclear why)
    
    Change-Id: I1ac0999a8fda39f7717bc183a10e3b513fbb8911
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140355
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140473
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/qa/extras/layout/data/in_056132_mod.odt 
b/sw/qa/extras/layout/data/in_056132_mod.odt
new file mode 100644
index 000000000000..548401063bdd
Binary files /dev/null and b/sw/qa/extras/layout/data/in_056132_mod.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index e085fdf9ce66..431bd5a2cca2 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3667,6 +3667,55 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTdf122607_regression)
     aTempFile.EnableKillingFile();
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150616)
+{
+    discardDumpedLayout();
+    if (mxComponent.is())
+        mxComponent->dispose();
+
+    OUString const pName("in_056132_mod.odt");
+
+    OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY) + pName);
+
+    // 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) },
+    };
+
+    std::cout << pName << ":\n";
+
+    // inline the loading because currently properties can't be passed...
+    mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument",
+                                  
comphelper::containerToSequence(aFilterOptions));
+    uno::Sequence<beans::PropertyValue> 
props(comphelper::InitPropertySequence({
+        { "FilterName", uno::Any(OUString("writer_pdf_Export")) },
+    }));
+    utl::TempFile aTempFile;
+    uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+    xStorable->storeToURL(aTempFile.GetURL(), props);
+
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // this one was 0 height
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/LineBreak", "Line",
+                "Important information here!");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "height",
+                "253");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[2]/infos/bounds", "top",
+                "7925");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/LineBreak", "Line",
+                "xxx 111 ");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "height",
+                "697");
+    assertXPath(pXmlDoc, 
"/root/page[1]/body/tab[3]/row[2]/cell[2]/txt[3]/infos/bounds", "top",
+                "8178");
+
+    aTempFile.EnableKillingFile();
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell)
 {
     SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "btlr-cell.odt");
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index e40e1dab6ef3..4894c8524cf3 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1727,13 +1727,6 @@ void SwContentFrame::MakeAll(vcl::RenderContext* 
/*pRenderContext*/)
         // an unsolvable problem: We ignore it with all our power.
         if ( !bMoveable || IsUndersized() )
         {
-            if( !bMoveable && IsInTab() )
-            {
-                tools::Long nDiff = -aRectFnSet.BottomDist( getFrameArea(), 
aRectFnSet.GetPrtBottom(*GetUpper()) );
-                tools::Long nReal = GetUpper()->Grow( nDiff );
-                if( nReal )
-                    continue;
-            }
             break;
         }
 

Reply via email to