summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-02-26 13:00:23 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-02-27 10:43:10 +0100
commitd55b26a093bdbced08985dbc7113190b52a8bc66 (patch)
treee26b4c8510f50e1c6e91cf1ef93d0b8b31f60546 /sw/qa
parent8fc1b60f62c213a0476f3acc9f89cd5eccbf335d (diff)
sw: DOCX export: for SwDropDownField, don't write FORMDROPDOWN
... because Word's funny limitation to 25 listEntry children causes data loss, as seen in commit d9634e3c9bfaf826b3d4d39e9a57d6c2d8d9a3dc "sw: DOCX export: limit FORMDROPDOWN listEntry to Word's abilities". Instead write SDT dropDownList, which appears to be able to store at least 26 listItem children without complaint from Word, so it's an improvement. Funnily domainmapper converts it to a form control on DOCX import. Change-Id: Ic0f24144cb2b5233f82c7b3bc67946a6e56448a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89541 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx30
1 files changed, 24 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index c3a8c4948397..9c1f362b8a70 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -452,13 +452,31 @@ DECLARE_OOXMLEXPORT_TEST(testParaAdjustDistribute, "para-adjust-distribute.docx"
getProperty<sal_Int16>(getParagraph(2), "ParaLastLineAdjust")));
}
-DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testInputListExport, "tdf122186_input_list.odt")
+DECLARE_OOXMLEXPORT_TEST(testInputListExport, "tdf122186_input_list.odt")
{
- // We need to make sure we don't export the text itself next to the input list field
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
-
- assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r", 5);
- assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", 0);
+ if (!mbExported) // importing the ODT, an input field
+ {
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ CPPUNIT_ASSERT(xFields->hasMoreElements());
+ uno::Any aField = xFields->nextElement();
+ uno::Reference<lang::XServiceInfo> xServiceInfo(aField, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown"));
+ }
+ else // importing the DOCX, a form control
+ {
+ uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.form.component.ComboBox"));
+ CPPUNIT_ASSERT(getProperty<bool>(xPropertySet, "Dropdown"));
+ auto const items(getProperty<uno::Sequence<OUString>>(xPropertySet, "StringItemList"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), items.getLength());
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), items[0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("2"), items[1]);
+ CPPUNIT_ASSERT_EQUAL(OUString("3"), items[2]);
+ }
}
DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt")