summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx1
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx24
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx1
3 files changed, 24 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index ccb2c196ae58..67745700cc04 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -480,6 +480,7 @@ DECLARE_OOXMLEXPORT_TEST(testInputListExport, "tdf122186_input_list.odt")
CPPUNIT_ASSERT_EQUAL(OUString("1"), items[0]);
CPPUNIT_ASSERT_EQUAL(OUString("2"), items[1]);
CPPUNIT_ASSERT_EQUAL(OUString("3"), items[2]);
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPropertySet, "DefaultText"));
}
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3686dba83df7..6b8d1f9a1085 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1960,6 +1960,17 @@ void DocxAttributeOutput::WriteSdtDropDownStart(
m_pSerializer->endElementNS(XML_w, XML_sdtPr);
m_pSerializer->startElementNS(XML_w, XML_sdtContent);
+}
+
+void DocxAttributeOutput::WriteSdtDropDownEnd(OUString const& rSelected,
+ uno::Sequence<OUString> const& rListItems)
+{
+ // note: rSelected might be empty?
+ sal_Int32 nId = comphelper::findValue(rListItems, rSelected);
+ if (nId == -1)
+ {
+ nId = 0;
+ }
// the lastValue only identifies the entry in the list, also export
// currently selected item's displayText as run content (if one exists)
@@ -1971,6 +1982,8 @@ void DocxAttributeOutput::WriteSdtDropDownStart(
m_pSerializer->endElementNS(XML_w, XML_t);
m_pSerializer->endElementNS(XML_w, XML_r);
}
+
+ WriteSdtEnd();
}
void DocxAttributeOutput::StartField_Impl( const SwTextNode* pNode, sal_Int32 nPos, FieldInfos const & rInfos, bool bWriteRun )
@@ -2217,12 +2230,19 @@ void DocxAttributeOutput::DoWriteFieldRunProperties( const SwTextNode * pNode, s
void DocxAttributeOutput::EndField_Impl( const SwTextNode* pNode, sal_Int32 nPos, FieldInfos& rInfos )
{
- if (rInfos.eType == ww::eFORMDATE
- || (rInfos.eType == ww::eFORMDROPDOWN && rInfos.pField))
+ if (rInfos.eType == ww::eFORMDATE)
{
WriteSdtEnd();
return;
}
+ if (rInfos.eType == ww::eFORMDROPDOWN && rInfos.pField)
+ {
+ // write selected item from End not Start to ensure that any bookmarks
+ // precede it
+ SwDropDownField const& rField(*static_cast<SwDropDownField const*>(rInfos.pField.get()));
+ WriteSdtDropDownEnd(rField.GetSelectedItem(), rField.GetItemSequence());
+ return;
+ }
// The command has to be written before for the hyperlinks
if ( rInfos.pField )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 8b7b8ac3c8cf..dc77baf08c0b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -719,6 +719,7 @@ private:
void WriteFormDateStart(const OUString& sFullDate, const OUString& sDateFormat, const OUString& sLang);
void WriteSdtDropDownStart(OUString const& rName, OUString const& rSelected, uno::Sequence<OUString> const& rListItems);
+ void WriteSdtDropDownEnd(OUString const& rSelected, uno::Sequence<OUString> const& rListItems);
void WriteSdtEnd();
void StartField_Impl( const SwTextNode* pNode, sal_Int32 nPos, FieldInfos const & rInfos, bool bWriteRun = false );