sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |    6 ++++++
 sw/source/filter/ww8/ww8par.cxx            |   15 +++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit a7e0a5a6d0054483d3ed5a753bbba2e8ab599e90
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Mar 12 21:00:24 2020 +0300
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu Jun 30 00:59:20 2022 +0200

    tdf#131304 .doc: provide compatibilityMode value for .docx
    
    In case a .doc file will be exported as a .docx format,
    populate the appropriate compatibilityMode setting.
    
    11: Use features specified in MS-DOC.
    
    Change-Id: I5c03d2f7aed9d5fa2577853908d05d88ddf4c122
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90437
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 8b4fc39dd02d..24fc6d7f7995 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -769,6 +769,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf79435_legacyInputFields)
     xParameters.set(xFormField->getParameters());
     xParameters->getByName("Type") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("date"), sTmp);
+
+    xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
+    assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[1]", "name", 
"compatibilityMode");
+    assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[1]", "uri",
+                "http://schemas.microsoft.com/office/word";);
+    assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting[1]", "val", 
"11");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, 
"tdf120224_textControlCrossRef.docx")
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9dab410cd66b..5195e1484de3 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1906,6 +1906,21 @@ void SwWW8ImplReader::ImportDop()
             if (xInfo->hasPropertyByName("ApplyFormDesignMode"))
                 xDocProps->setPropertyValue("ApplyFormDesignMode", 
css::uno::Any(false));
         }
+
+        // for the benefit of DOCX - if this is ever saved in that format.
+        comphelper::SequenceAsHashMap 
aGrabBag(xDocProps->getPropertyValue("InteropGrabBag"));
+        uno::Sequence<beans::PropertyValue> aCompatSetting( 
comphelper::InitPropertySequence({
+                { "name", uno::Any(OUString("compatibilityMode")) },
+                { "uri", 
uno::Any(OUString("http://schemas.microsoft.com/office/word";)) },
+                { "val", uno::Any(OUString("11")) }  //11: Use features 
specified in MS-DOC.
+        }));
+
+        uno::Sequence< beans::PropertyValue > 
aValue(comphelper::InitPropertySequence({
+            { "compatSetting", uno::Any(aCompatSetting) }
+        }));
+
+        aGrabBag["CompatSettings"] <<= aValue;
+        xDocProps->setPropertyValue("InteropGrabBag", 
uno::Any(aGrabBag.getAsConstPropertyValueList()));
     }
 
     // The password can force read-only, comments-only, fill-in-form-only, or 
require track-changes.

Reply via email to