summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-02-07 11:17:21 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-05-13 19:51:03 +0200
commitf0fcee564d848bf65bb5fa980d121b81455e2c44 (patch)
treec19936f48e77562ab3c7f640ab8f13f9267a915e
parentb7cf955981e064a14fead1368843d02ae1c72f9f (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. Reviewed-on: https://gerrit.libreoffice.org/67417 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit e41b09d0126ecb28cff277c9b4b40eae7cc7c3f4) Change-Id: I3f620b2f2db2c4a6e5bf279b33e5c93697e4e2d4
-rw-r--r--sw/inc/viewsh.hxx5
-rw-r--r--sw/qa/extras/layout/data/tdf122607.odtbin0 -> 23271 bytes
-rwxr-xr-xsw/qa/extras/layout/layout.cxx16
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx3
4 files changed, 23 insertions, 1 deletions
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 832f4f9dd878..da9146bf12ea 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -152,7 +152,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.
@@ -216,6 +216,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
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf122607.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 7d6eeccd18b8..b1ef14cbbad8 100755
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -32,6 +32,7 @@ public:
void testTdf117188();
void testTdf119875();
void testTdf116989();
+ void testTdf122607();
CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testTdf116830);
@@ -49,6 +50,7 @@ public:
CPPUNIT_TEST(testTdf117188);
CPPUNIT_TEST(testTdf119875);
CPPUNIT_TEST(testTdf116989);
+ CPPUNIT_TEST(testTdf122607);
CPPUNIT_TEST_SUITE_END();
private:
@@ -304,6 +306,20 @@ void SwLayoutWriter::testTdf116989()
}
}
+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");
+}
+
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 f33f5f033d9f..805bbf81b108 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2635,6 +2635,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() );
pViewShell->SetPDFExportOption( false );