sw/qa/extras/layout/data/tdf122607_leerzeile.odt |binary
 sw/qa/extras/layout/layout.cxx                   |   50 +++++++++++++++++++++++
 sw/source/uibase/uno/unotxdoc.cxx                |    7 +--
 3 files changed, 54 insertions(+), 3 deletions(-)

New commits:
commit 70c54e1503e2132fa9be908c9fda76f6902b7d7c
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Apr 29 17:40:45 2019 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Tue Apr 30 16:07:14 2019 +0200

    tdf#122607 sw: restore CalcLayout() call in getRendererCount()
    
    Effectively revert commit 1ecca673b40fedc53db125e332b087d1c120a254.
    
    There are some documents that aren't formatted correctly.
    
    (cherry picked from commit 5879351aeb1935e2bf86fda59703f7d49fdeb6ed)
    
    Change-Id: I4b0cf6313c249a0ed916c2630cd5194d809bfb48

diff --git a/sw/qa/extras/layout/data/tdf122607_leerzeile.odt 
b/sw/qa/extras/layout/data/tdf122607_leerzeile.odt
new file mode 100644
index 000000000000..9819a229344a
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf122607_leerzeile.odt 
differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 615061572ec1..a107d6472aa3 100755
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -34,6 +34,7 @@ public:
     void testTdf119875();
     void testTdf116989();
     void testTdf122607();
+    void testTdf122607_regression();
     void testTdf123898();
 
     CPPUNIT_TEST_SUITE(SwLayoutWriter);
@@ -53,6 +54,7 @@ public:
     CPPUNIT_TEST(testTdf119875);
     CPPUNIT_TEST(testTdf116989);
     CPPUNIT_TEST(testTdf122607);
+    CPPUNIT_TEST(testTdf122607_regression);
     CPPUNIT_TEST(testTdf123898);
     CPPUNIT_TEST_SUITE_END();
 
@@ -323,6 +325,54 @@ void SwLayoutWriter::testTdf122607()
                 "nWidth", "428");
 }
 
+void SwLayoutWriter::testTdf122607_regression()
+{
+    discardDumpedLayout();
+    if (mxComponent.is())
+        mxComponent->dispose();
+
+    auto const pName("tdf122607_leerzeile.odt");
+
+    OUString const url(m_directories.getURLFromSrc(DATA_DIRECTORY)
+                       + OUString::createFromAscii(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));
+
+    CPPUNIT_ASSERT(mxComponent.is());
+
+    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);
+
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    // somehow these 2 rows overlapped in the PDF unless CalcLayout() runs
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/infos/bounds", "mbFixSize",
+                "false");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/infos/bounds", "top", "2977");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[1]/infos/bounds", "height", "241");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "mbFixSize",
+                "true");
+    // this was 3034, causing the overlap
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "top", "3218");
+    assertXPath(pXmlDoc, 
"/root/page[1]/anchored/fly/tab[1]/row[2]/infos/bounds", "height", "164");
+
+    aTempFile.EnableKillingFile();
+}
+
 void SwLayoutWriter::testTdf123898()
 {
     createDoc("tdf123898.odt");
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index d2d512fd8c6f..f351dafdc4ec 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2622,9 +2622,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
             // should be set for printing as well ...
             pViewShell->SetPDFExportOption( true );
 
-            // tdf#122607 Re-layout the doc. Calling CalcLayout here is not 
enough, as it depends
-            // on the currently visible area which is 0 when doing headless 
conversion.
-            pViewShell->Reformat();
+            // there is some redundancy between those two function calls, but 
right now
+            // there is no time to sort this out.
+            //TODO: check what exactly needs to be done and make just one 
function for that
+            pViewShell->CalcLayout();
             pViewShell->CalcPagesForPrint( pViewShell->GetPageCount() );
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to