diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-02-07 11:17:21 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-02-12 09:13:58 +0100 |
commit | e41b09d0126ecb28cff277c9b4b40eae7cc7c3f4 (patch) | |
tree | f1664189feae1930cd817d1ad9e539e52ab8d4dc /sw | |
parent | fe2e315e21ccc53c2b15e1b2648001b638e13d58 (diff) |
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.Mehrbrodt@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/viewsh.hxx | 5 | ||||
-rw-r--r-- | sw/qa/extras/layout/data/tdf122607.odt | bin | 0 -> 23271 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 3 |
4 files changed, 27 insertions, 1 deletions
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 Binary files differnew file mode 100644 index 000000000000..123e04702ef8 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf122607.odt 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) |