desktop/source/lib/init.cxx                                          |    2 
 filter/Configuration_filter.mk                                       |    2 
 filter/source/config/fragments/filters/OOXML_Text_VBA.xcu            |   31 
++++++++++
 filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu |    2 
 filter/source/config/fragments/types/writer_OOXML_VBA.xcu            |   29 
+++++++++
 include/test/unoapi_test.hxx                                         |    2 
 officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu      |    2 
 oox/source/core/filterdetect.cxx                                     |   11 +++
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                            |    5 -
 9 files changed, 79 insertions(+), 7 deletions(-)

New commits:
commit 0f7cf56ca10e8b6cf34767d25281d783b416fbeb
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Jan 7 14:19:52 2026 -0500
Commit:     Justin Luth <[email protected]>
CommitDate: Sat Jan 10 16:35:22 2026 +0100

    tdf#170261: introduce DOCM 2010 (VBA) filters
    
    This patch primarily allows exporting as an DOCM file
    without forcing compatibilityMode = 12 (2007)
    Other than that, I don't think there will be any other impact
    (although that simple fact has lots of layout implications).
    
    With this patch, the Word 2010-365 (macro-enabled) filter
    will be the default for:
    - --convert-to (command line) docm
    - GUI (save-as) docm
    - LOKit download as docm
    - TestFilter::DOCM unit tests
    
    Change-Id: Iabc9820096a100774157996b54e325c76d2440c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196868
    Reviewed-by: Miklos Vajna <[email protected]>
    Reviewed-by: Justin Luth <[email protected]>
    Tested-by: Justin Luth <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a965eae90058..459410748b1a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -330,7 +330,7 @@ TraceEventDumper *traceEventDumper = nullptr;
 constexpr ExtensionMap aWriterExtensionMap[] =
 {
     { "doc",   u"MS Word 97"_ustr },
-    { "docm",  u"MS Word 2007 XML VBA"_ustr },
+    { "docm",  u"Office Open XML Text VBA"_ustr },
     { "docx",  u"Office Open XML Text"_ustr },
     { "fodt",  u"OpenDocument Text Flat XML"_ustr },
     { "html",  u"HTML (StarWriter)"_ustr },
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 68848df382ba..d157a4c664d7 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -349,6 +349,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu
        writer_MS_Word_2007_XML_VBA \
        writer_OOXML \
        writer_OOXML_Template \
+       writer_OOXML_VBA \
        writer_layout_dump_xml \
        writer_indexing_export_xml \
        writer_BroadBand_eBook \
@@ -400,6 +401,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_filters
        MS_Word_2007_XML_VBA \
        OOXML_Text \
        OOXML_Text_Template \
+       OOXML_Text_VBA \
        writer_layout_dump \
        writer_indexing_export \
        BroadBand_eBook \
diff --git a/filter/source/config/fragments/filters/OOXML_Text_VBA.xcu 
b/filter/source/config/fragments/filters/OOXML_Text_VBA.xcu
new file mode 100644
index 000000000000..ee84d48fd50f
--- /dev/null
+++ b/filter/source/config/fragments/filters/OOXML_Text_VBA.xcu
@@ -0,0 +1,31 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="Office Open XML Text VBA" oor:op="replace">
+        <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER 
ENCRYPTION PASSWORDTOMODIFY SUPPORTSSIGNING</value></prop>
+        <prop oor:name="UIComponent"/>
+        <prop 
oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
+        <prop oor:name="UserData"><value>OXML</value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">Word 2010–365 (macro-enabled)</value>
+        </prop>
+        <!-- ISO/IEC 29500:2008 -->
+        <prop oor:name="FileFormatVersion"><value>1</value></prop>
+        <prop oor:name="Type"><value>writer_OOXML_VBA</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop 
oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+    </node>
diff --git 
a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu 
b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu
index 0519bcd7dac7..e94b666ddadc 100644
--- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu
+++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu
@@ -10,7 +10,7 @@
         <prop oor:name="URLPattern"/>
         <prop oor:name="Extensions"><value>docm</value></prop>
         <prop oor:name="MediaType"><value>application/msword</value></prop>
-        <prop oor:name="Preferred"><value>true</value></prop>
+        <prop oor:name="Preferred"><value>false</value></prop>
         <prop oor:name="PreferredFilter"><value>MS Word 2007 XML 
VBA</value></prop>
         <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 
VBA</value></prop>
         <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
diff --git a/filter/source/config/fragments/types/writer_OOXML_VBA.xcu 
b/filter/source/config/fragments/types/writer_OOXML_VBA.xcu
new file mode 100644
index 000000000000..e6e0b9229d9f
--- /dev/null
+++ b/filter/source/config/fragments/types/writer_OOXML_VBA.xcu
@@ -0,0 +1,29 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="writer_OOXML_VBA" oor:op="replace" >
+    <prop 
oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
+        <prop oor:name="URLPattern"/>
+        <prop oor:name="Extensions"><value>docm</value></prop>
+        <prop 
oor:name="MediaType"><value>application/vnd.ms-word.document.macroEnabled.main+xml</value></prop>
+        <prop oor:name="Preferred"><value>true</value></prop>
+        <prop oor:name="PreferredFilter"><value>Office Open XML Text 
VBA</value></prop>
+        <prop oor:name="UIName">
+            <value>Word XML VBA</value>
+        </prop>
+        <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
+    </node>
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index 058581649c00..32719a2af52a 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -73,7 +73,7 @@ const std::unordered_map<TestFilter, OUString> 
TestFilterNames{
     { TestFilter::CSV, u"Text - txt - csv (StarCalc)"_ustr },
     { TestFilter::DOC, u"MS Word 97"_ustr },
     { TestFilter::DOCBOOK, u"DocBook File"_ustr },
-    { TestFilter::DOCM, u"MS Word 2007 XML VBA"_ustr },
+    { TestFilter::DOCM, u"Office Open XML Text VBA"_ustr },
     { TestFilter::DOCX, u"Office Open XML Text"_ustr },
     { TestFilter::DOCX_2007, u"MS Word 2007 XML"_ustr },
     { TestFilter::DOTX, u"MS Word 2007 XML Template"_ustr },
diff --git a/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu 
b/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu
index 3ed3136efec1..712776e14058 100644
--- a/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu
+++ b/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu
@@ -46,7 +46,7 @@
     </node>
     <node oor:name="com.sun.star.text.TextDocument" oor:op="replace" 
install:module="writer">
       <prop oor:name="SortedFilterList">
-        <value oor:separator=";">writer8;writer8_template;StarOffice XML 
(Writer);writer_StarOffice_XML_Writer_Template;OpenDocument Text Flat XML;UOF 
text;Office Open XML Text;Office Open XML Text Template;MS Word 2007 XML;MS 
Word 2007 XML Template;MS Word 2003 XML;Rich Text Format;MS Word 97;MS Word 97 
Vorlage;MS Word 95;MS Word 95 Vorlage;MS WinWord 6.0;MS WinWord 
5;MS_Works;AportisDoc Palm DB;DocBook File;writer_MIZI_Hwp_97;HTML 
(StarWriter);LotusWordPro;PocketWord File;T602Document;Markdown;Text;Text 
(encoded);WordPerfect</value>
+        <value oor:separator=";">writer8;writer8_template;StarOffice XML 
(Writer);writer_StarOffice_XML_Writer_Template;OpenDocument Text Flat XML;UOF 
text;Office Open XML Text;Office Open XML Text Template;Office Open XML Text 
VBA;MS Word 2007 XML;MS Word 2007 XML Template;MS Word 2003 XML;Rich Text 
Format;MS Word 97;MS Word 97 Vorlage;MS Word 95;MS Word 95 Vorlage;MS WinWord 
6.0;MS WinWord 5;MS_Works;AportisDoc Palm DB;DocBook 
File;writer_MIZI_Hwp_97;HTML (StarWriter);LotusWordPro;PocketWord 
File;T602Document;Markdown;Text;Text (encoded);WordPerfect</value>
       </prop>
     </node>
     <node oor:name="com.sun.star.text.WebDocument" oor:op="replace" 
install:module="writer">
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 3b438af598b8..7a4a4180944d 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -235,7 +235,16 @@ OUString 
FilterDetectDocHandler::getFilterNameFromContentType( std::u16string_vi
     }
 
     if( rContentType == 
u"application/vnd.ms-word.document.macroEnabled.main+xml" || bDocm )
-        return u"writer_MS_Word_2007_VBA"_ustr;
+    {
+        switch (maOOXMLVariant)
+        {
+            case OOXMLVariant::ISO_Transitional:
+            case OOXMLVariant::ISO_Strict: // Not supported, map to ISO 
transitional
+                return u"writer_OOXML_VBA"_ustr;
+            case OOXMLVariant::ECMA_Transitional:
+                return u"wwriter_MS_Word_2007_VBA"_ustr;
+        }
+    }
 
     if( rContentType == 
u"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml"
 ||
         rContentType == 
u"application/vnd.ms-word.template.macroEnabledTemplate.main+xml" )
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 31b81c709138..f98b7c9cf579 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -108,13 +108,14 @@ CPPUNIT_TEST_FIXTURE(DocmTest, testDocmSave)
 
 CPPUNIT_TEST_FIXTURE(DocmTest, testBadDocm)
 {
+    // Given a compat15 (Word 2013+) document
     createSwDoc("bad.docm");
     // This was 'MS Word 2007 XML', broken docm files were not recognized.
-    CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, 
getSwDocShell()->GetMedium()->GetFilter()->GetName());
+    CPPUNIT_ASSERT_EQUAL(u"Office Open XML Text VBA"_ustr, 
getSwDocShell()->GetMedium()->GetFilter()->GetName());
 
     saveAndReload(TestFilter::DOCM);
     // This was 'MS Word 2007 XML', broken docm files were not recognized.
-    CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, 
getSwDocShell()->GetMedium()->GetFilter()->GetName());
+    CPPUNIT_ASSERT_EQUAL(u"Office Open XML Text VBA"_ustr, 
getSwDocShell()->GetMedium()->GetFilter()->GetName());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf109063)

Reply via email to