sw/inc/viewsh.hxx                      |    5 ++++-
 sw/qa/extras/layout/data/tdf122607.odt |binary
 sw/qa/extras/layout/layout.cxx         |   20 ++++++++++++++++++++
 sw/source/uibase/uno/unotxdoc.cxx      |    3 +++
 4 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit e41b09d0126ecb28cff277c9b4b40eae7cc7c3f4
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Thu Feb 7 11:17:21 2019 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Tue Feb 12 09:13:58 2019 +0100

    tdf#122607 Fix layout invalidation in headless mode
    
    Layout was not invalidated correctly since the visible area is 0
    in headless mode.
    So just reformat the whole doc when doing the pdf conversion headless.
    
    An attempt to fix this was already made with commit 
1ecca673b40fedc53db125e332b087d1c120a254
    but that didn't cover all cases.
    
    Change-Id: I3f620b2f2db2c4a6e5bf279b33e5c93697e4e2d4
    Reviewed-on: https://gerrit.libreoffice.org/67417
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 695347db06c6..71c5adc76d72 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -148,7 +148,7 @@ class SW_DLLPUBLIC SwViewShell : public 
sw::Ring<SwViewShell>
 
     inline void ResetInvalidRect();
 
-    SAL_DLLPRIVATE void Reformat();          // Invalidates complete Layout 
(ApplyViewOption).
+
 
     SAL_DLLPRIVATE void PaintDesktop(vcl::RenderContext& rRenderContext, const 
SwRect&);  // Collect values for painting of desktop
                                                         // and calling.
@@ -213,6 +213,9 @@ public:
 
     void InvalidateWindows( const SwRect &rRect );
 
+    /// Invalidates complete Layout (ApplyViewOption).
+    void Reformat();
+
     // #i72754# set of Pre/PostPaints with lock counter and initial target 
OutDev
 protected:
     std::stack<vcl::Region> mPrePostPaintRegions; // acts also as a lock 
counter (empty == not locked)
diff --git a/sw/qa/extras/layout/data/tdf122607.odt 
b/sw/qa/extras/layout/data/tdf122607.odt
new file mode 100644
index 000000000000..123e04702ef8
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf122607.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 83af848df67f..f02d8a3fbbbc 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -66,6 +66,7 @@ public:
     void testTdf120287c();
     void testTdf122878();
     void testTdf115094();
+    void testTdf122607();
 
     CPPUNIT_TEST_SUITE(SwLayoutWriter);
     CPPUNIT_TEST(testRedlineFootnotes);
@@ -105,6 +106,7 @@ public:
     CPPUNIT_TEST(testTdf120287c);
     CPPUNIT_TEST(testTdf122878);
     CPPUNIT_TEST(testTdf115094);
+    CPPUNIT_TEST(testTdf122607);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2767,6 +2769,24 @@ void SwLayoutWriter::testTdf115094()
     CPPUNIT_ASSERT_LESS(nTopOfB2Anchored, nTopOfB2);
 }
 
+void SwLayoutWriter::testTdf122607()
+{
+    createDoc("tdf122607.odt");
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
+                "fly/txt/Text[1]",
+                "nHeight", "253");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
+                "fly/txt/Text[1]",
+                "nWidth", "428");
+    assertXPath(pXmlDoc,
+                
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
+                "fly/txt/Text[1]",
+                "Portion", "Fax:");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 70c4647fd3ab..934072fd0cf9 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2640,6 +2640,9 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
             if( bStateChanged )
                 pRenderDocShell->EnableSetModified();
 
+            // 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();
             pViewShell->CalcPagesForPrint( pViewShell->GetPageCount() );
 
             // #122919# Force field update before PDF export, but after layout 
init (tdf#121962)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to