diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-19 09:50:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-24 13:23:59 +0100 |
commit | a069fac4a08f93db74799d00f047e04f1a0735cd (patch) | |
tree | b16c457bab72bd6bc69435ba1a4b610b3cc8d6a0 | |
parent | d9c85f5059000b129ca627df9f971396e4ee30d2 (diff) |
loplugin:stringliteraldefine in comphelper
Change-Id: I60ccd6049db65fef2397798ab916b0d1e24c0fdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125531
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | extensions/source/activex/so_activex.cxx | 78 | ||||
-rw-r--r-- | filter/source/storagefilterdetect/filterdetect.cxx | 52 | ||||
-rw-r--r-- | include/comphelper/documentconstants.hxx | 71 | ||||
-rw-r--r-- | include/comphelper/storagehelper.hxx | 16 | ||||
-rw-r--r-- | package/source/manifest/ManifestExport.cxx | 4 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 2 | ||||
-rw-r--r-- | sot/source/base/exchange.cxx | 22 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/GradientStyle.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/TransGradientStyle.cxx | 2 |
13 files changed, 130 insertions, 129 deletions
diff --git a/extensions/source/activex/so_activex.cxx b/extensions/source/activex/so_activex.cxx index 5840e36b6521..c8e8828bdd93 100644 --- a/extensions/source/activex/so_activex.cxx +++ b/extensions/source/activex/so_activex.cxx @@ -178,43 +178,43 @@ const char* const aFileExt[] = { ".vor", ".sxw", ".sxc", ".sxi", ".sxd", ".sxg", ".sxm", ".ott", ".otg", ".otp", ".ots", ".otf", ".odt", ".oth", ".odm", ".odg", ".odp", ".ods", ".odf"}; -const char* const aMimeType[] = { - "application/vnd.stardivision.writer", - - "application/vnd.stardivision.chart", - "application/vnd.stardivision.draw", - "application/vnd.stardivision.impress", - "application/vnd.stardivision.impress-packed", - "application/vnd.stardivision.calc", - "application/vnd.stardivision.writer", - "application/vnd.stardivision.math", - - MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII, - - MIMETYPE_VND_SUN_XML_WRITER_ASCII, - MIMETYPE_VND_SUN_XML_CALC_ASCII, - MIMETYPE_VND_SUN_XML_IMPRESS_ASCII, - MIMETYPE_VND_SUN_XML_DRAW_ASCII, - MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII, - MIMETYPE_VND_SUN_XML_MATH_ASCII, - - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII, - - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII }; +const sal_Unicode* const aMimeType[] = { + u"application/vnd.stardivision.writer", + + u"application/vnd.stardivision.chart", + u"application/vnd.stardivision.draw", + u"application/vnd.stardivision.impress", + u"application/vnd.stardivision.impress-packed", + u"application/vnd.stardivision.calc", + u"application/vnd.stardivision.writer", + u"application/vnd.stardivision.math", + + MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII.getStr(), + + MIMETYPE_VND_SUN_XML_WRITER_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_CALC_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_IMPRESS_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_DRAW_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII.getStr(), + MIMETYPE_VND_SUN_XML_MATH_ASCII.getStr(), + + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII.getStr(), + + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII.getStr(), + MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII.getStr() }; const int nForModes[] = { 16, 1, 2, 4, 4, 8, 16, 32, @@ -423,7 +423,7 @@ static HRESULT DllRegisterServerNative_Impl( int nMode, bool bForAllUsers, REGSA { if (nForModes[ind] & nMode) { - wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind]); + wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%ls", aPrefix, aMimeType[ind]); HRegKey hkey; s.upd(RegCreateKeyExA(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, @@ -495,7 +495,7 @@ static HRESULT DllUnregisterServerNative_Impl( int nMode, bool bForAllUsers, REG if( nForModes[ind] & nMode ) { DWORD nSubKeys = 0, nValues = 0; - wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind]); + wsprintfA(aSubKey, "%sMIME\\DataBase\\Content Type\\%ls", aPrefix, aMimeType[ind]); Status s1(false); // no throw { HRegKey hkey; diff --git a/filter/source/storagefilterdetect/filterdetect.cxx b/filter/source/storagefilterdetect/filterdetect.cxx index 6784b12b780a..f45edd6cb5b6 100644 --- a/filter/source/storagefilterdetect/filterdetect.cxx +++ b/filter/source/storagefilterdetect/filterdetect.cxx @@ -40,34 +40,34 @@ namespace { OUString getInternalFromMediaType(std::u16string_view aMediaType) { // OpenDocument types - if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) return "writer8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) return "writer8_template"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) return "writerweb8_writer_template"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) return "writerglobal8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII ) return "writerglobal8_template"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) return "draw8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) return "draw8_template"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) return "impress8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) return "impress8_template"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) return "calc8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) return "calc8_template"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) return "chart8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) return "math8"; - else if ( aMediaType == u"" MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII ) return "StarBaseReportChart"; + if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) return "writer8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) return "writer8_template"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) return "writerweb8_writer_template"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) return "writerglobal8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII ) return "writerglobal8_template"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) return "draw8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) return "draw8_template"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) return "impress8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) return "impress8_template"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) return "calc8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) return "calc8_template"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) return "chart8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) return "math8"; + else if ( aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII ) return "StarBaseReportChart"; // OOo legacy types - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_WRITER_ASCII ) return "writer_StarOffice_XML_Writer"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII ) return "writer_StarOffice_XML_Writer_Template"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII ) return "writer_web_StarOffice_XML_Writer_Web_Template"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII ) return "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_DRAW_ASCII ) return "draw_StarOffice_XML_Draw"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII ) return "draw_StarOffice_XML_Draw_Template"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_IMPRESS_ASCII ) return "impress_StarOffice_XML_Impress"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII ) return "impress_StarOffice_XML_Impress_Template"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_CALC_ASCII ) return "calc_StarOffice_XML_Calc"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII ) return "calc_StarOffice_XML_Calc_Template"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_CHART_ASCII ) return "chart_StarOffice_XML_Chart"; - else if ( aMediaType == u"" MIMETYPE_VND_SUN_XML_MATH_ASCII ) return "math_StarOffice_XML_Math"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_WRITER_ASCII ) return "writer_StarOffice_XML_Writer"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII ) return "writer_StarOffice_XML_Writer_Template"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII ) return "writer_web_StarOffice_XML_Writer_Web_Template"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII ) return "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_DRAW_ASCII ) return "draw_StarOffice_XML_Draw"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII ) return "draw_StarOffice_XML_Draw_Template"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_IMPRESS_ASCII ) return "impress_StarOffice_XML_Impress"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII ) return "impress_StarOffice_XML_Impress_Template"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_CALC_ASCII ) return "calc_StarOffice_XML_Calc"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII ) return "calc_StarOffice_XML_Calc_Template"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_CHART_ASCII ) return "chart_StarOffice_XML_Chart"; + else if ( aMediaType == MIMETYPE_VND_SUN_XML_MATH_ASCII ) return "math_StarOffice_XML_Math"; // Unknown type return OUString(); diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx index 5957b818b8c7..aafa84e7591c 100644 --- a/include/comphelper/documentconstants.hxx +++ b/include/comphelper/documentconstants.hxx @@ -20,52 +20,53 @@ #define INCLUDED_COMPHELPER_DOCUMENTCONSTANTS_HXX #include <o3tl/typed_flags_set.hxx> +#include <rtl/ustring.hxx> // formats of SO6/7 -#define MIMETYPE_VND_SUN_XML_WRITER_ASCII "application/vnd.sun.xml.writer" -#define MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII "application/vnd.sun.xml.writer.web" -#define MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII "application/vnd.sun.xml.writer.global" -#define MIMETYPE_VND_SUN_XML_DRAW_ASCII "application/vnd.sun.xml.draw" -#define MIMETYPE_VND_SUN_XML_IMPRESS_ASCII "application/vnd.sun.xml.impress" -#define MIMETYPE_VND_SUN_XML_CALC_ASCII "application/vnd.sun.xml.calc" -#define MIMETYPE_VND_SUN_XML_CHART_ASCII "application/vnd.sun.xml.chart" -#define MIMETYPE_VND_SUN_XML_MATH_ASCII "application/vnd.sun.xml.math" -#define MIMETYPE_VND_SUN_XML_BASE_ASCII "application/vnd.sun.xml.base" +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_ASCII = u"application/vnd.sun.xml.writer"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII = u"application/vnd.sun.xml.writer.web"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII = u"application/vnd.sun.xml.writer.global"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_DRAW_ASCII = u"application/vnd.sun.xml.draw"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_IMPRESS_ASCII = u"application/vnd.sun.xml.impress"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_CALC_ASCII = u"application/vnd.sun.xml.calc"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_CHART_ASCII = u"application/vnd.sun.xml.chart"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_MATH_ASCII = u"application/vnd.sun.xml.math"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_BASE_ASCII = u"application/vnd.sun.xml.base"; // template formats of SO6/7 -#define MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII "application/vnd.sun.xml.writer.template" -#define MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII "application/vnd.sun.xml.draw.template" -#define MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII "application/vnd.sun.xml.impress.template" -#define MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII "application/vnd.sun.xml.calc.template" +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII = u"application/vnd.sun.xml.writer.template"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII = u"application/vnd.sun.xml.draw.template"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII = u"application/vnd.sun.xml.impress.template"; +inline constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII = u"application/vnd.sun.xml.calc.template"; // formats of SO8 -#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII "application/vnd.oasis.opendocument.text" -#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII "application/vnd.oasis.opendocument.text-web" -#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII "application/vnd.oasis.opendocument.text-master" -#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII "application/vnd.oasis.opendocument.graphics" -#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII "application/vnd.oasis.opendocument.presentation" -#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII "application/vnd.oasis.opendocument.spreadsheet" -#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII "application/vnd.oasis.opendocument.chart" -#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII "application/vnd.oasis.opendocument.formula" -#define MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII "application/vnd.oasis.opendocument.base" -#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII "application/vnd.sun.xml.report" -#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII "application/vnd.sun.xml.report.chart" +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII = u"application/vnd.oasis.opendocument.text"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII = u"application/vnd.oasis.opendocument.text-web"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII = u"application/vnd.oasis.opendocument.text-master"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII = u"application/vnd.oasis.opendocument.graphics"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII = u"application/vnd.oasis.opendocument.presentation"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII = u"application/vnd.oasis.opendocument.spreadsheet"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII = u"application/vnd.oasis.opendocument.chart"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII = u"application/vnd.oasis.opendocument.formula"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII = u"application/vnd.oasis.opendocument.base"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII = u"application/vnd.sun.xml.report"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII = u"application/vnd.sun.xml.report.chart"; // template formats of SO8 -#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII "application/vnd.oasis.opendocument.text-template" -#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII "application/vnd.oasis.opendocument.text-master-template" -#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII "application/vnd.oasis.opendocument.graphics-template" -#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII "application/vnd.oasis.opendocument.presentation-template" -#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII "application/vnd.oasis.opendocument.spreadsheet-template" -#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII "application/vnd.oasis.opendocument.chart-template" -#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII "application/vnd.oasis.opendocument.formula-template" +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.text-template"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.text-master-template"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.graphics-template"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.presentation-template"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.spreadsheet-template"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.chart-template"; +inline constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII = u"application/vnd.oasis.opendocument.formula-template"; // ODF versions -#define ODFVER_010_TEXT "1.0" -#define ODFVER_011_TEXT "1.1" -#define ODFVER_012_TEXT "1.2" -#define ODFVER_013_TEXT "1.3" +inline constexpr OUStringLiteral ODFVER_010_TEXT = u"1.0"; +inline constexpr OUStringLiteral ODFVER_011_TEXT = u"1.1"; +inline constexpr OUStringLiteral ODFVER_012_TEXT = u"1.2"; +inline constexpr OUStringLiteral ODFVER_013_TEXT = u"1.3"; // filter flags // TODO/LATER: The flags should be part of the UNO specification diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx index 839bad262db0..9e1c453b54ca 100644 --- a/include/comphelper/storagehelper.hxx +++ b/include/comphelper/storagehelper.hxx @@ -26,14 +26,14 @@ #include <memory> #include <string_view> -#define PACKAGE_STORAGE_FORMAT_STRING "PackageFormat" -#define ZIP_STORAGE_FORMAT_STRING "ZipFormat" -#define OFOPXML_STORAGE_FORMAT_STRING "OFOPXMLFormat" - -#define PACKAGE_ENCRYPTIONDATA_SHA256UTF8 "PackageSHA256UTF8EncryptionKey" -#define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 "PackageSHA1UTF8EncryptionKey" -#define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 "PackageSHA1MS1252EncryptionKey" -#define PACKAGE_ENCRYPTIONDATA_SHA1CORRECT "PackageSHA1CorrectEncryptionKey" +inline constexpr OUStringLiteral PACKAGE_STORAGE_FORMAT_STRING = u"PackageFormat"; +inline constexpr OUStringLiteral ZIP_STORAGE_FORMAT_STRING = u"ZipFormat"; +inline constexpr OUStringLiteral OFOPXML_STORAGE_FORMAT_STRING = u"OFOPXMLFormat"; + +inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA256UTF8 = u"PackageSHA256UTF8EncryptionKey"; +inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA1UTF8 = u"PackageSHA1UTF8EncryptionKey"; +inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA1MS1252 = u"PackageSHA1MS1252EncryptionKey"; +inline constexpr OUStringLiteral PACKAGE_ENCRYPTIONDATA_SHA1CORRECT = u"PackageSHA1CorrectEncryptionKey"; namespace com::sun::star { namespace beans { struct NamedValue; } diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 7ac46874f7ae..0c0e963e1c4b 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -188,7 +188,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con sCdataAttribute, MANIFEST_OASIS_NAMESPACE ); bAcceptNonemptyVersion = true; - if ( aDocVersion.compareTo( u"" ODFVER_012_TEXT ) >= 0 ) + if ( aDocVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) { // this is ODF12 or later generation, let encrypted // streams contain start-key-generation entry @@ -240,7 +240,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->ignorableWhitespace ( sWhiteSpace ); // ==== manifest:keyinfo & children - bool const isODF13(aDocVersion.compareTo(u"" ODFVER_013_TEXT) >= 0); + bool const isODF13(aDocVersion.compareTo(ODFVER_013_TEXT) >= 0); if (!isODF13) { xHandler->startElement(sManifestKeyInfoElement, nullptr); diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 3882bb887c99..81b8ee9f89a5 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -424,7 +424,7 @@ void ZipPackage::parseManifest() m_bInconsistent = m_xRootFolder->LookForUnexpectedODF12Streams( std::u16string_view() ); - bool bODF12AndNewer = ( m_xRootFolder->GetVersion().compareTo( u"" ODFVER_012_TEXT ) >= 0 ); + bool bODF12AndNewer = ( m_xRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 ); if ( !m_bForceRecovery && bODF12AndNewer ) { if ( m_bInconsistent ) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index da72e53b2118..9da250188825 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -965,7 +965,7 @@ void SfxObjectShell::CheckEncryption_Impl( const uno::Reference< task::XInteract { } - if ( aVersion.compareTo( u"" ODFVER_012_TEXT ) < 0 ) + if ( aVersion.compareTo( ODFVER_012_TEXT ) < 0 ) return; // this is ODF1.2 or later diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index bb5acfcfc89c..ac6717b921fe 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1789,7 +1789,7 @@ bool SfxObjectShell::PrepareForSigning(weld::Window* pDialogParent) OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(GetStorage())); if ( IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty() - || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(u"" ODFVER_012_TEXT) < 0 && !bHasSign)) + || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(ODFVER_012_TEXT) < 0 && !bHasSign)) { // the document might need saving ( new, modified or in ODF1.1 format without signature ) @@ -1970,7 +1970,7 @@ bool SfxObjectShell::SignDocumentContentUsingCertificate(const Reference<XCertif OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(GetStorage())); if (IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty() - || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(u"" ODFVER_012_TEXT) < 0 && !bHasSign)) + || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(ODFVER_012_TEXT) < 0 && !bHasSign)) { if (nVersion >= SvtSaveOptions::ODFSVER_012) { diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 68e3c842f405..89e458705efe 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1208,7 +1208,7 @@ bool SfxObjectShell::SaveTo_Impl // document, but technically this is not correct, so this prevents old // signatures to be copied over to a version 1.2 document bNoPreserveForOasis = ( - (0 <= aODFVersion.compareTo(u"" ODFVER_012_TEXT) && nVersion < SvtSaveOptions::ODFSVER_012) || + (0 <= aODFVersion.compareTo(ODFVER_012_TEXT) && nVersion < SvtSaveOptions::ODFSVER_012) || (aODFVersion.isEmpty() && nVersion >= SvtSaveOptions::ODFSVER_012) ); } diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 6594fcde6156..18c5cd291f9a 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -43,7 +43,7 @@ namespace { */ struct DataFlavorRepresentation { - const char* pMimeType; + OUString pMimeType; const char* pName; const css::uno::Type* pType; }; @@ -261,11 +261,11 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( const OUString& rMimeT const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl(); // test the default first - name for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; // then in the dynamic list @@ -320,7 +320,7 @@ bool SotExchange::GetFormatDataFlavor( SotClipboardFormatId nFormat, DataFlavor& if( SotClipboardFormatId::USER_END >= nFormat ) { const DataFlavorRepresentation& rData = FormatArray_Impl()[static_cast<int>(nFormat)]; - rFlavor.MimeType = OUString::createFromAscii( rData.pMimeType ); + rFlavor.MimeType = rData.pMimeType; rFlavor.HumanPresentableName = OUString::createFromAscii( rData.pName ); rFlavor.DataType = *rData.pType; @@ -359,7 +359,7 @@ OUString SotExchange::GetFormatMimeType( SotClipboardFormatId nFormat ) { OUString sMimeType; if( SotClipboardFormatId::USER_END >= nFormat ) - sMimeType = OUString::createFromAscii( FormatArray_Impl()[static_cast<int>(nFormat)].pMimeType ); + sMimeType = FormatArray_Impl()[static_cast<int>(nFormat)].pMimeType; else { tDataFlavorList& rL = InitFormats_Impl(); @@ -385,14 +385,14 @@ SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( const OUString& rMime { const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl(); for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; // BM: the chart format 105 ("StarChartDocument 5.0") was written // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0") // The registry only contains the entry for the 42 format id. for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50) ? SotClipboardFormatId::STARCHART_50 : i ); @@ -423,7 +423,7 @@ SotClipboardFormatId SotExchange::GetFormat( const DataFlavor& rFlavor ) const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl(); for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) - if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) + if( rMimeType.equals( pFormatArray_Impl[ static_cast<int>(i) ].pMimeType ) ) return i; // BM: the chart format 105 ("StarChartDocument 5.0") was written @@ -431,9 +431,9 @@ SotClipboardFormatId SotExchange::GetFormat( const DataFlavor& rFlavor ) // The registry only contains the entry for the 42 format id. for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) { - const char* const pFormatMimeType = pFormatArray_Impl[ static_cast<int>(i) ].pMimeType; - const sal_Int32 nFormatMimeTypeLen = rtl_str_getLength( pFormatMimeType ); - if( rMimeType.matchAsciiL( pFormatMimeType, nFormatMimeTypeLen ) && + const OUString& pFormatMimeType = pFormatArray_Impl[ static_cast<int>(i) ].pMimeType; + const sal_Int32 nFormatMimeTypeLen = pFormatMimeType.getLength(); + if( rMimeType.match( pFormatMimeType ) && ( rMimeType.getLength() == nFormatMimeTypeLen || rMimeType[ nFormatMimeTypeLen ] == ';' ) ) return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50) diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 0d47a7a813ef..5b4d006211ba 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1614,7 +1614,7 @@ bool SvXMLImport::IsODFVersionConsistent( const OUString& aODFVersion ) // the check returns sal_False only if the storage version could be retrieved bool bResult = true; - if ( !aODFVersion.isEmpty() && aODFVersion.compareTo( u"" ODFVER_012_TEXT ) >= 0 ) + if ( !aODFVersion.isEmpty() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) { // check the consistency only for the ODF1.2 and later ( according to content.xml ) // manifest.xml might have no version, it should be checked here and the correct version should be set diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 69c2cb059eee..2f450af819d7 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -115,7 +115,7 @@ void XMLGradientStyleImport::importXML( break; case XML_ELEMENT(DRAW, XML_GRADIENT_ANGLE): { - auto const cmp12(rImport.GetODFVersion().compareTo(u"" ODFVER_012_TEXT)); + auto const cmp12(rImport.GetODFVersion().compareTo(ODFVER_012_TEXT)); bool const bSuccess = ::sax::Converter::convertAngle(aGradient.Angle, aIter.toView(), // tdf#89475 try to detect borked OOo angles diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index 110c25061e27..e76ec666492a 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -132,7 +132,7 @@ void XMLTransGradientStyleImport::importXML( break; case XML_ELEMENT(DRAW, XML_GRADIENT_ANGLE): { - auto const cmp12(rImport.GetODFVersion().compareTo(u"" ODFVER_012_TEXT)); + auto const cmp12(rImport.GetODFVersion().compareTo(ODFVER_012_TEXT)); bool const bSuccess = ::sax::Converter::convertAngle(aGradient.Angle, aIter.toView(), // tdf#89475 try to detect borked OOo angles |