summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-04-16 16:36:15 +0300
committerJustin Luth <justin_luth@sil.org>2020-07-17 19:49:05 +0200
commite4635544b816d1ca27bd1ebba60f51444b0a898e (patch)
treee4af3fb130255955973daaa6cf4d98a0ef5903fe /sw/qa/extras
parentca2dfac3e790fb384e904502fe1ededd695001af (diff)
tdf#104596 sw COMPAT layout: wrap in header for in-table flies
You might have noticed that text in header/footers will not wrap around fly frames, but just run underneath, regardless of the wrap settings. Strange, eh? [This is also true in footnotes.] In an ancient effort to be compatible with MS strangeness, OOo decided to do this as well for interoperability reasons. http://openoffice.org/specs/writer/compatibility/adjust-text-wrapping.sxw Apparently, flies in tables are exempt from that rule in MSO, so this patch adds that exemption. TABLE EXEMPTION IS AN EXPERIMENTAL ASSUMPTION BASED ON VISUAL OBSERVATION FROM THIS BUG REPORT. IT IS NOT BASED ON DOCUMENTATION. I did look in DOC and DOCX manuals, and did a google search, but found nothing. A compat variable keeps older ODT files no-wrap, so that we don't break layout of existing documents. This variable is only read in the ODT import filter. If it doesn't exist for ODT, it is set to false. By default it is true, so it automatically is enabled for anything that doesn't modify it in its import filter, including all DOC/DOCX/RTF etc, and newly created ODT documents. In other words, allowing wrapping in the header for table-anchors is the new default behaviour unless an import filter turns it off. Headers/footers are the most common example. I also tested with footnotes, and found that Word 2016 does wrap in that case as well, even though the UI only allows AS_CHAR anchoring. FYI: Allowing wrapping at ALL times can be set with the Writer compatibility option "Use OpenOffice.org 1.1 text wrapping around objects". Change-Id: I9ad0c82df4af794079cce86fad9e401ea4575e59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92378 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/odfexport/data/tdf104596_breakingExample.odtbin0 -> 64455 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx6
-rw-r--r--sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.docbin0 -> 29184 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx10
4 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt b/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt
new file mode 100644
index 000000000000..19d0e85c42b7
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf104596_breakingExample.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index ddf37f102834..c084c008d59b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -449,6 +449,12 @@ DECLARE_ODFEXPORT_TEST(testredlineTextFrame, "redlineTextFrame.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
+DECLARE_ODFEXPORT_TEST(testTdf104596_breakingExample, "tdf104596_breakingExample.odt")
+{
+ //wrapping should be ignored on in-table flies for pre-LO7.1 documents. ALLOW_WRAP_WHEN_ANCHORED_IN_TABLE
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Fits on one page", 1, getPages() );
+}
+
DECLARE_ODFEXPORT_TEST(testTdf131621, "tdf131621.ott")
{
CPPUNIT_ASSERT_EQUAL(12, getShapes());
diff --git a/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc b/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc
new file mode 100644
index 000000000000..17fba79453a9
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 2de178221c8e..13da2fec9d1b 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -53,6 +53,16 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
}
+DECLARE_WW8EXPORT_TEST(testTdf104596_wrapInHeaderTable, "tdf104596_wrapInHeaderTable.doc")
+{
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+ sal_Int32 nRowHeight = getXPath(pXmlDoc, "//header/tab/row[1]/infos/bounds", "height").toInt32();
+ // The fly is supposed to be no-wrap, so the text should come underneath it, not wrap-through,
+ // thus making the row much higher. Before, height was 706. Now it is 1067.
+ CPPUNIT_ASSERT_MESSAGE("Text must wrap under green box", nRowHeight > 1000);
+}
+
DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
{
auto xNumberingRules