include/xmloff/odffields.hxx                                   |    1 
 sw/qa/extras/ooxmlexport/data/tdf151548_activeContentDemo.docm |binary
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx                      |   12 
++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx                   |    4 ---
 sw/source/filter/ww8/ww8par3.cxx                               |    1 
 5 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 8520e970d81760d6a9c3931bd43f7d6d3d6ca9a4
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Sat Dec 24 14:15:51 2022 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jan 3 08:05:23 2023 +0000

    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 <jl...@mail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144817
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx
index 89c2e6174335..c4f9a2f788fc 100644
--- a/include/xmloff/odffields.hxx
+++ b/include/xmloff/odffields.hxx
@@ -25,7 +25,6 @@
 
 #define ODF_FORMCHECKBOX u"vnd.oasis.opendocument.field.FORMCHECKBOX"
 #define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText"
-#define ODF_FORMCHECKBOX_NAME "Checkbox_Name"
 #define ODF_FORMCHECKBOX_RESULT "Checkbox_Checked"
 
 #define 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
new file mode 100644
index 000000000000..80886d864a15
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf151548_activeContentDemo.docm differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 20c1fc95bdde..431fdb526713 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1070,6 +1070,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 b190bf38e581..d24f5f77393f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2254,11 +2254,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 aab719c99d7d..89eb9833491c 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)

Reply via email to