desktop/source/lib/init.cxx | 2 filter/Configuration_filter.mk | 2 filter/source/config/fragments/filters/calc_OOXML_VBA.xcu | 30 ++++++++++ filter/source/config/fragments/types/calc_OOXML_VBA.xcu | 27 +++++++++ include/test/unoapi_test.hxx | 2 officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu | 2 oox/source/core/filterdetect.cxx | 11 +++ 7 files changed, 72 insertions(+), 4 deletions(-)
New commits: commit 0b1340f5d5105951c855fae228f8d51bc004569d Author: Justin Luth <[email protected]> AuthorDate: Wed Jan 7 10:03:11 2026 -0500 Commit: Justin Luth <[email protected]> CommitDate: Sat Jan 10 16:34:40 2026 +0100 tdf#170261: introduce XLSM 2010 (VBA) filters This patch primarily allows exporting as an XLSM file without forcing lowestEdited = 4 (2007) Other than that, I don't think there will be any other impact (and at this point we don't even know of lowestEdited impacts). With this patch, the Excel 2010-365 (macro-enabled) filter will be the default for: - --convert-to (command line) xlsm - GUI (save-as) xlsm - LOKit download as xlsm - TestFilter::XLSM unit tests Change-Id: I5c5fac221b6a454a98df9034f59aba0a7d97880d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196867 Tested-by: Justin Luth <[email protected]> Reviewed-by: Justin Luth <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 009a57499e26..a965eae90058 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -356,7 +356,7 @@ constexpr ExtensionMap aCalcExtensionMap[] = { "pdf", u"calc_pdf_Export"_ustr }, { "xhtml", u"XHTML Calc File"_ustr }, { "xls", u"MS Excel 97"_ustr }, - { "xlsm", u"Calc MS Excel 2007 VBA XML"_ustr }, + { "xlsm", u"Calc Office Open XML VBA"_ustr }, { "xlsx", u"Calc Office Open XML"_ustr }, { "png", u"calc_png_Export"_ustr }, }; diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index 7dcf7c7489d2..68848df382ba 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -497,6 +497,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,f MS_Excel_2007_Binary \ calc_OOXML \ calc_OOXML_Template \ + calc_OOXML_VBA \ calc_MS_Works_Document \ calc_WPS_Lotus_Document \ calc_WPS_QPro_Document \ @@ -546,6 +547,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_filters.x calc_MS_Excel_2007_Binary \ calc_OOXML \ calc_OOXML_Template \ + calc_OOXML_VBA \ MS_Works_Calc \ WPS_Lotus_Calc \ WPS_QPro_Calc \ diff --git a/filter/source/config/fragments/filters/calc_OOXML_VBA.xcu b/filter/source/config/fragments/filters/calc_OOXML_VBA.xcu new file mode 100644 index 000000000000..2c3238a9c12a --- /dev/null +++ b/filter/source/config/fragments/filters/calc_OOXML_VBA.xcu @@ -0,0 +1,30 @@ +<!-- + * 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="Calc Office Open XML VBA" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED ENCRYPTION PASSWORDTOMODIFY SUPPORTSSIGNING</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"><value>com.sun.star.comp.oox.xls.ExcelFilter</value></prop> + <prop oor:name="UserData"><value>OOXML macro-enabled</value></prop> + <prop oor:name="FileFormatVersion"><value>1</value></prop> + <prop oor:name="Type"><value>Office Open XML Spreadsheet VBA</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">Excel 2010–365 (macro-enabled)</value> + </prop> + </node> diff --git a/filter/source/config/fragments/types/calc_OOXML_VBA.xcu b/filter/source/config/fragments/types/calc_OOXML_VBA.xcu new file mode 100644 index 000000000000..3e2082248734 --- /dev/null +++ b/filter/source/config/fragments/types/calc_OOXML_VBA.xcu @@ -0,0 +1,27 @@ +<!-- + * 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 Spreadsheet 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>xlsm</value></prop> + <prop oor:name="MediaType"><value>application/vnd.ms-excel.sheet.macroEnabled.12</value></prop> + <prop oor:name="Preferred"><value>true</value></prop> + <prop oor:name="PreferredFilter"><value>Calc Office Open XML VBA</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Excel XML VBA</value></prop> + <prop oor:name="ClipboardFormat"/> +</node> diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx index dbf046cb4abb..058581649c00 100644 --- a/include/test/unoapi_test.hxx +++ b/include/test/unoapi_test.hxx @@ -108,7 +108,7 @@ const std::unordered_map<TestFilter, OUString> TestFilterNames{ { TestFilter::XHTML_DRAW, u"XHTML Draw File"_ustr }, { TestFilter::XHTML_WRITER, u"XHTML Writer File"_ustr }, { TestFilter::XLS, u"MS Excel 97"_ustr }, - { TestFilter::XLSM, u"Calc MS Excel 2007 VBA XML"_ustr }, + { TestFilter::XLSM, u"Calc Office Open XML VBA"_ustr }, { TestFilter::XLST, u"Calc MS Excel 2007 XML Template"_ustr }, { TestFilter::XLSX, u"Calc Office Open XML"_ustr }, { TestFilter::XLSX_2007, u"Calc MS Excel 2007 XML"_ustr }, diff --git a/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu b/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu index f8dc51a005d0..3ed3136efec1 100644 --- a/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu +++ b/officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu @@ -21,7 +21,7 @@ <node oor:name="ModuleDependendFilterOrder"> <node oor:name="com.sun.star.sheet.SpreadsheetDocument" oor:op="replace" install:module="calc"> <prop oor:name="SortedFilterList"> - <value oor:separator=";">calc8;calc8_template;StarOffice XML (Calc);calc_StarOffice_XML_Calc_Template;OpenDocument Spreadsheet Flat XML;UOF spreadsheet;Calc Office Open XML;Calc Office Open XML Template;;MS Excel 97;MS Excel 97 Vorlage/Template;MS Excel 95;MS Excel 95 Vorlage/Template;MS Excel 5.0/95;MS Excel 5.0/95 Vorlage/Template;MS Excel 4.0;MS Excel 4.0 Vorlage/Template;;DIF;dBase;HTML (StarCalc);Lotus;Pocket Excel;Quattro Pro 6.0;Rich Text Format (StarCalc);SYLK;Text - txt - csv (StarCalc);calc_HTML_WebQuery;ADO Rowset XML;Calc MS Excel 2007 XML;Calc MS Excel 2007 XML Template;Calc MS Excel 2007 Binary;Calc MS Excel 2007 VBA XML;MS Excel 2003 XML</value> + <value oor:separator=";">calc8;calc8_template;StarOffice XML (Calc);calc_StarOffice_XML_Calc_Template;OpenDocument Spreadsheet Flat XML;UOF spreadsheet;Calc Office Open XML;Calc Office Open XML Template;Calc Office Open XML VBA;MS Excel 97;MS Excel 97 Vorlage/Template;MS Excel 95;MS Excel 95 Vorlage/Template;MS Excel 5.0/95;MS Excel 5.0/95 Vorlage/Template;MS Excel 4.0;MS Excel 4.0 Vorlage/Template;;DIF;dBase;HTML (StarCalc);Lotus;Pocket Excel;Quattro Pro 6.0;Rich Text Format (StarCalc);SYLK;Text - txt - csv (StarCalc);calc_HTML_WebQuery;ADO Rowset XML;Calc MS Excel 2007 XML;Calc MS Excel 2007 XML Template;Calc MS Excel 2007 Binary;Calc MS Excel 2007 VBA XML;MS Excel 2003 XML</value> </prop> </node> <node oor:name="com.sun.star.drawing.DrawingDocument" oor:op="replace" install:module="draw"> diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index cc75b51ee088..3b438af598b8 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -263,7 +263,16 @@ OUString FilterDetectDocHandler::getFilterNameFromContentType( std::u16string_vi } if (rContentType == u"application/vnd.ms-excel.sheet.macroEnabled.main+xml") - return u"MS Excel 2007 VBA XML"_ustr; + { + switch (maOOXMLVariant) + { + case OOXMLVariant::ISO_Transitional: + case OOXMLVariant::ISO_Strict: // Not supported, map to ISO transitional + return u"Office Open XML Spreadsheet VBA"_ustr; // Excel 2010+ + case OOXMLVariant::ECMA_Transitional: + return u"MS Excel 2007 VBA XML"_ustr; + } + } if( rContentType == u"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" || rContentType == u"application/vnd.ms-excel.template.macroEnabled.main+xml" )
