summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-08-05 12:57:57 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-08-09 09:47:09 +0200
commit07e20e619919114def34ddc4d6241b1f891c443b (patch)
tree5cb2bc7242e216dc16871e874577c00d35d13884 /writerfilter
parente6b9fab8be5f4a8de5126d1f3be82e0c738af9a0 (diff)
tdf#148518 writerfilter,sw: RTF import/export of FORMDROPDOWN field
On import, the values overwrote each other; export of the form data was missing completely. Change-Id: I918b3cfced39dc2602c6de03cdaf5848a9825dd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137861 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 47b08551a77918e4d35a98197ac99c1c3d5dec73) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137970 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/FormControlHelper.cxx5
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx4
2 files changed, 7 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx
index 0ce84f198aaf..e00c4bebdbc0 100644
--- a/writerfilter/source/dmapper/FormControlHelper.cxx
+++ b/writerfilter/source/dmapper/FormControlHelper.cxx
@@ -34,6 +34,8 @@
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/uno/Any.hxx>
+#include <o3tl/safeint.hxx>
+
#include "FormControlHelper.hxx"
#include <xmloff/odffields.hxx>
#include <comphelper/sequence.hxx>
@@ -285,7 +287,8 @@ void FormControlHelper::processField(uno::Reference<text::XFormField> const& xFo
xNameCont->insertByName(ODF_FORMDROPDOWN_LISTENTRY, uno::Any(comphelper::containerToSequence(rEntries)));
sal_Int32 nResult = m_pFFData->getDropDownResult().toInt32();
- if ( nResult )
+ // 0 is valid, but also how toInt32 reports parse error, but it's a sensible default...
+ if (0 <= nResult && o3tl::make_unsigned(nResult) < rEntries.size())
{
if ( xNameCont->hasByName(ODF_FORMDROPDOWN_RESULT) )
xNameCont->replaceByName(ODF_FORMDROPDOWN_RESULT, uno::Any( nResult ) );
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e8db8d68f12e..cbe36e5c277c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2544,7 +2544,9 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
break; // not for nested group
auto pValue
= new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue);
+ // OOXML puts these into a LN_CT_FFData_ddList but FFDataHandler should handle this too
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue,
+ RTFOverwrite::NO_APPEND);
}
break;
case Destination::DATAFIELD: