diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf126792.odt | bin | 0 -> 8403 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 27 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 3 |
3 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf126792.odt b/sw/qa/extras/ooxmlexport/data/tdf126792.odt Binary files differnew file mode 100644 index 000000000000..7eb43e78a71c --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf126792.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 9e5fc9ccb3d4..d716ad535f84 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -711,6 +711,33 @@ DECLARE_OOXMLEXPORT_TEST( testDateFieldAtEndOfParagraph, "date_field_at_end_of_p CPPUNIT_ASSERT_EQUAL(OUString("Click here to enter a date."), pFieldmark->GetContent()); } +DECLARE_OOXMLEXPORT_TEST(testDropDownFieldEntryLimit, "tdf126792.odt" ) +{ + // In MSO, there is a limit of 25 for the items in a drop-down form field. + // So we truncate the list of items to not exceed this limit. + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); + + ::sw::mark::IFieldmark* pFieldmark + = dynamic_cast<::sw::mark::IFieldmark*>(*pMarkAccess->getAllMarksBegin()); + CPPUNIT_ASSERT(pFieldmark); + CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDROPDOWN), pFieldmark->GetFieldname()); + + const sw::mark::IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters(); + auto pListEntries = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY); + CPPUNIT_ASSERT(bool(pListEntries != pParameters->end())); + css::uno::Sequence<OUString> vListEntries; + pListEntries->second >>= vListEntries; + if (!mbExported) + CPPUNIT_ASSERT_EQUAL(sal_Int32(26), vListEntries.getLength()); + else + CPPUNIT_ASSERT_EQUAL(sal_Int32(25), vListEntries.getLength()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 8746deaa6397..4a087e8188a4 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1837,6 +1837,9 @@ void DocxAttributeOutput::WriteFFData( const FieldInfos& rInfos ) OUString sName, sSelected; params.extractParam( ODF_FORMDROPDOWN_LISTENTRY, vListEntries ); + if (vListEntries.getLength() > ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT) + vListEntries = uno::Sequence< OUString>(vListEntries.getArray(), ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT); + sName = params.getName(); sal_Int32 nSelectedIndex = 0; |