diff options
author | Justin Luth <justin.luth@collabora.com> | 2018-10-20 19:18:02 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2018-11-16 15:41:42 +0100 |
commit | 46c1a75b144a4c5fd1f4ab0113b87fe030bebd27 (patch) | |
tree | 42e35e1795d0f73b563e7efd4dba0ac26affb336 /writerfilter/source/dmapper | |
parent | 8def8ca39d28ad34106767d14273b7b7d1b0b882 (diff) |
tdf79435 doc/docx: round-trip legacy input formfields
GrabBag the settings which LO doesn't implement
(which is all of them) so that the document
round-trips without losing the config settings.
Change-Id: I00de6c483af68073634430dd74fd445e981573ab
Reviewed-on: https://gerrit.libreoffice.org/62241
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r-- | writerfilter/source/dmapper/FFDataHandler.cxx | 28 | ||||
-rw-r--r-- | writerfilter/source/dmapper/FFDataHandler.hxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/FormControlHelper.cxx | 43 |
3 files changed, 80 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/FFDataHandler.cxx b/writerfilter/source/dmapper/FFDataHandler.cxx index ebd4e2f6538a..2429a77c8f99 100644 --- a/writerfilter/source/dmapper/FFDataHandler.cxx +++ b/writerfilter/source/dmapper/FFDataHandler.cxx @@ -32,7 +32,8 @@ LoggedProperties("FFDataHandler"), m_nCheckboxHeight(0), m_bCheckboxAutoHeight(false), m_nCheckboxChecked(-1), -m_nCheckboxDefault(-1) +m_nCheckboxDefault(-1), +m_nTextMaxLength(0) { } @@ -72,6 +73,16 @@ void FFDataHandler::lcl_sprm(Sprm & r_Sprm) resolveSprm(r_Sprm); } break; + case NS_ooxml::LN_CT_FFData_entryMacro: + { + m_sEntryMacro = r_Sprm.getValue()->getString(); + } + break; + case NS_ooxml::LN_CT_FFData_exitMacro: + { + m_sExitMacro = r_Sprm.getValue()->getString(); + } + break; case NS_ooxml::LN_CT_FFCheckBox_size: { m_nCheckboxHeight = r_Sprm.getValue()->getInt(); @@ -112,11 +123,26 @@ void FFDataHandler::lcl_sprm(Sprm & r_Sprm) resolveSprm(r_Sprm); } break; + case NS_ooxml::LN_CT_FFTextInput_type: + { + m_sTextType = r_Sprm.getValue()->getString(); + } + break; case NS_ooxml::LN_CT_FFTextInput_default: { m_sTextDefault = r_Sprm.getValue()->getString(); } break; + case NS_ooxml::LN_CT_FFTextInput_maxLength: + { + m_nTextMaxLength = r_Sprm.getValue()->getInt(); + } + break; + case NS_ooxml::LN_CT_FFTextInput_format: + { + m_sTextFormat = r_Sprm.getValue()->getString(); + } + break; case NS_ooxml::LN_CT_FFData_textInput: { resolveSprm(r_Sprm); diff --git a/writerfilter/source/dmapper/FFDataHandler.hxx b/writerfilter/source/dmapper/FFDataHandler.hxx index 7289d6f6c09f..84ac070e50de 100644 --- a/writerfilter/source/dmapper/FFDataHandler.hxx +++ b/writerfilter/source/dmapper/FFDataHandler.hxx @@ -44,6 +44,9 @@ public: // member: statusText const OUString & getStatusText() const { return m_sStatusText;} + const OUString & getEntryMacro() const { return m_sEntryMacro;} + const OUString & getExitMacro() const { return m_sExitMacro;} + // member: checkboxHeight sal_uInt32 getCheckboxHeight() const { return m_nCheckboxHeight;} @@ -62,6 +65,10 @@ public: // member: textDefault const OUString & getTextDefault() const { return m_sTextDefault;} + const OUString & getTextType() const { return m_sTextType; } + const OUString & getTextFormat() const { return m_sTextFormat; } + sal_uInt16 getTextMaxLength() const { return m_nTextMaxLength; } + // sprm void resolveSprm(Sprm & r_sprm); @@ -69,6 +76,8 @@ private: OUString m_sName; OUString m_sHelpText; OUString m_sStatusText; + OUString m_sEntryMacro; + OUString m_sExitMacro; sal_uInt32 m_nCheckboxHeight; bool m_bCheckboxAutoHeight; int m_nCheckboxChecked; @@ -76,6 +85,9 @@ private: OUString m_sDropDownResult; DropDownEntries_t m_DropDownEntries; OUString m_sTextDefault; + OUString m_sTextType; + OUString m_sTextFormat; + sal_uInt16 m_nTextMaxLength; // sprm void lcl_sprm(Sprm & r_sprm) override; diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx index 3877763edab1..3088a4a27361 100644 --- a/writerfilter/source/dmapper/FormControlHelper.cxx +++ b/writerfilter/source/dmapper/FormControlHelper.cxx @@ -37,6 +37,7 @@ #include "FormControlHelper.hxx" #include <xmloff/odffields.hxx> #include <comphelper/sequence.hxx> +#include <tools/diagnose_ex.h> namespace writerfilter { namespace dmapper { @@ -205,14 +206,52 @@ void FormControlHelper::processField(uno::Reference<text::XFormField> const& xFo uno::Reference<container::XNamed> xNamed( xFormField, uno::UNO_QUERY ); if ( m_pFFData && xNamed.is() && xNameCont.is() ) { + OUString sTmp = m_pFFData->getEntryMacro(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "EntryMacro", uno::makeAny(sTmp) ); + sTmp = m_pFFData->getExitMacro(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "ExitMacro", uno::makeAny(sTmp) ); + + sTmp = m_pFFData->getHelpText(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "Help", uno::makeAny(sTmp) ); + + sTmp = m_pFFData->getStatusText(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "Hint", uno::makeAny(sTmp) ); if (m_pImpl->m_eFieldId == FIELD_FORMTEXT ) { xFormField->setFieldType(ODF_FORMTEXT); - if ( !m_pFFData->getName().isEmpty() ) + sTmp = m_pFFData->getName(); + try + { + if ( !sTmp.isEmpty() ) + xNamed->setName( sTmp ); + } + catch ( uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION("writerfilter","Set Formfield name failed"); + } + + sTmp = m_pFFData->getTextType(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "Type", uno::makeAny(sTmp) ); + + const sal_uInt16 nMaxLength = m_pFFData->getTextMaxLength(); + if ( nMaxLength ) { - xNamed->setName( m_pFFData->getName() ); + xNameCont->insertByName( "MaxLength", uno::makeAny(nMaxLength) ); } + + sTmp = m_pFFData->getTextDefault(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "Content", uno::makeAny(sTmp) ); + + sTmp = m_pFFData->getTextFormat(); + if ( !sTmp.isEmpty() ) + xNameCont->insertByName( "Format", uno::makeAny(sTmp) ); } else if (m_pImpl->m_eFieldId == FIELD_FORMCHECKBOX ) { |