diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-12-24 14:15:51 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-12-25 02:58:56 +0000 |
commit | 24b969d10cd81e6f5eb438ded075dd330a1cde29 (patch) | |
tree | b942c5da0eef516c7a2ca36122c28433090c634e | |
parent | df9f3f3fd81d4f81ee2ff984d1e19999abea2963 (diff) |
tdf#151548 DOCX formfield: export checkbox name
The two other fields are exporting the name,
(although it is getting somewhat lost in excess bookmarks),
because they are just using the Fieldmark name property.
See LO 7.5 8ad39b6f2aff3ca37aeaaaaff5373991e853c329
for tdf#151548 sw: use provided name for formfields
which saved the name for checkboxes and dropdowns.
ODF_FORMCHECKBOX_NAME was simply used as a grabbag
for ww8import. Since that is obsolete, get rid of it.
mostly introduced with ---
commit b547c0c2aa901667fef85233282ec84f34b7e5f4
Author: Noel Power on Thu Feb 10 16:18:40 2011 +0000
some form field import/export improvements
ODF_FORMDROPDOWN_NAME was dropped early on. ---
commit 79770ff55bd8c3bc5948c51373e8cb7867ce43d3
Author: Noel Power on Tue Mar 1 12:30:23 2011 +0000
partial revert of 803409125f4ed896b391acb99266d50691c6fd4a
remove currently unnecessary ( but possibly future )
odf attributes for form field controls to prevent those
attributes from being written to odf
Change-Id: I133028dce65361314e663bb5238f99c607f0ab14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144792
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r-- | include/xmloff/odffields.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf151548_activeContentDemo.docm | bin | 0 -> 47797 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 1 |
5 files changed, 13 insertions, 5 deletions
diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx index 8dd75e038189..d5439d873a0f 100644 --- a/include/xmloff/odffields.hxx +++ b/include/xmloff/odffields.hxx @@ -27,7 +27,6 @@ inline constexpr OUStringLiteral ODF_FORMTEXT = u"vnd.oasis.opendocument.field.F inline constexpr OUStringLiteral ODF_FORMCHECKBOX = u"vnd.oasis.opendocument.field.FORMCHECKBOX"; inline constexpr OUStringLiteral ODF_FORMCHECKBOX_HELPTEXT = u"Checkbox_HelpText"; -inline constexpr OUStringLiteral ODF_FORMCHECKBOX_NAME = u"Checkbox_Name"; inline constexpr OUStringLiteral ODF_FORMCHECKBOX_RESULT = u"Checkbox_Checked"; inline constexpr OUStringLiteral ODF_FORMDROPDOWN = u"vnd.oasis.opendocument.field.FORMDROPDOWN"; diff --git a/sw/qa/extras/ooxmlexport/data/tdf151548_activeContentDemo.docm b/sw/qa/extras/ooxmlexport/data/tdf151548_activeContentDemo.docm Binary files differnew file mode 100644 index 000000000000..80886d864a15 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf151548_activeContentDemo.docm diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 4378f3b1a0c7..bccfbddb7eb0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -1046,6 +1046,18 @@ DECLARE_OOXMLEXPORT_TEST(testN820509, "n820509.docx") } } +DECLARE_OOXMLEXPORT_TEST(testTdf151548_activeContentDemo, "tdf151548_activeContentDemo.docm") +{ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); + for(auto aIter = pMarkAccess->getFieldmarksBegin(); aIter != pMarkAccess->getFieldmarksEnd(); ++aIter) + { + const OUString sName = (*aIter)->GetName(); + CPPUNIT_ASSERT(sName == "Check1" || sName == "Text1" || sName == "Dropdown1"); + } +} + DECLARE_OOXMLEXPORT_TEST(testN830205, "n830205.docx") { // Previously import just crashed (due to infinite recursion). diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0bc7e87f1469..a30cabad7ea7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2263,11 +2263,9 @@ void DocxAttributeOutput::WriteFFData( const FieldInfos& rInfos ) } else if ( rInfos.eType == ww::eFORMCHECKBOX ) { - OUString sName; + const OUString sName = params.getName(); bool bChecked = false; - params.extractParam( ODF_FORMCHECKBOX_NAME, sName ); - const sw::mark::ICheckboxFieldmark* pCheckboxFm = dynamic_cast<const sw::mark::ICheckboxFieldmark*>(&rFieldmark); if ( pCheckboxFm && pCheckboxFm->IsChecked() ) bChecked = true; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 445e5442a0fe..451cae7b2778 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -231,7 +231,6 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, OUString& rStr ) if (pFieldmark!=nullptr) { IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters(); ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(pFieldmark); - (*pParameters)[ODF_FORMCHECKBOX_NAME] <<= aFormula.msTitle; (*pParameters)[ODF_FORMCHECKBOX_HELPTEXT] <<= aFormula.msToolTip; if(pCheckboxFm) |