summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-04-29 17:40:45 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-05-13 19:51:05 +0200
commit911c76ff790ecc8a3fd3cdeeff527ac5598375d8 (patch)
tree71f248b9376d1ad6983d3e5043a7320c12712599
parente8e60be122f354e59582687a6dba5beab76f4802 (diff)
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
-rw-r--r--sw/qa/extras/layout/data/tdf122607_leerzeile.odtbin0 -> 23398 bytes
-rwxr-xr-xsw/qa/extras/layout/layout.cxx50
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx7
3 files changed, 54 insertions, 3 deletions
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
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf122607_leerzeile.odt
Binary files 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() );