summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-05-29 17:26:57 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-30 08:43:22 +0200
commit6bb241ccc61c6904efec95978fa17e33c0eb1df3 (patch)
treed1d6b92a09402765e2581b8bf5be81b3aac52f4d /sw/qa/extras
parent18d0d8541432782e9bf761992a8bda5d29ee6564 (diff)
ODT export: fix lost <text:user-field-decl> for fields in tables in headers
The problem was that XMLTextFieldExport::ExportFieldAutoStyle() assumed that the text of a field anchor is always the toplevel XText, which is true in case of body vs header text, but false in case header text vs text-in-table-in-header. So add an UNO property which exposes the parent of a table cell, this way text in header (regardless of it's in a table or not) will have the same XText, leading to writing the necessary <text:user-field-decl> element for the matching <text:user-field-get> definition. Change-Id: I077b8d7e9dfae4062539894318637e266b925382 Reviewed-on: https://gerrit.libreoffice.org/73176 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/odfexport/data/user-field-decl.odtbin0 -> 8597 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx8
2 files changed, 8 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/user-field-decl.odt b/sw/qa/extras/odfexport/data/user-field-decl.odt
new file mode 100644
index 000000000000..f037f403ec68
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/user-field-decl.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 90a467b0d05c..8725efcc500b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -251,6 +251,14 @@ DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32( 408), rect.Height);
}
+DECLARE_ODFEXPORT_TEST(testUserFieldDecl, "user-field-decl.odt")
+{
+ if (xmlDocPtr pXmlDoc = parseExport("styles.xml"))
+ // Without the accompanying fix in place, this test would have failed with 'Expected: 2;
+ // Actual: 1', i.e. the in-table field had no declaration (in the header), while the
+ // outside-table one had the declaration.
+ assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
+}
DECLARE_ODFEXPORT_TEST(testFramebackgrounds, "framebackgrounds.odt")
{