summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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() );