[Libreoffice-commits] core.git: framework/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 2 10:58:03 UTC 2021


 framework/source/accelerators/acceleratorconfiguration.cxx         |   12 +-
 framework/source/accelerators/documentacceleratorconfiguration.cxx |    2 
 framework/source/accelerators/storageholder.cxx                    |    2 
 framework/source/dispatch/servicehandler.cxx                       |    5 -
 framework/source/dispatch/systemexec.cxx                           |    7 -
 framework/source/fwe/classes/addonsoptions.cxx                     |    6 -
 framework/source/fwe/helper/propertysetcontainer.cxx               |    2 
 framework/source/fwe/xml/menudocumenthandler.cxx                   |   44 +++++-----
 framework/source/fwe/xml/statusbardocumenthandler.cxx              |   42 ++++-----
 framework/source/fwe/xml/toolboxdocumenthandler.cxx                |    2 
 framework/source/fwi/classes/protocolhandlercache.cxx              |    4 
 framework/source/recording/dispatchrecorder.cxx                    |    2 
 framework/source/services/pathsettings.cxx                         |   10 +-
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx  |    8 -
 framework/source/uielement/menubarmanager.cxx                      |    8 -
 framework/source/uielement/newmenucontroller.cxx                   |    6 -
 framework/source/xml/imagesdocumenthandler.cxx                     |   24 ++---
 17 files changed, 92 insertions(+), 94 deletions(-)

New commits:
commit ae29e471ca0f8ccdd7a1906ce200dd24d96d2a5d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 2 08:45:52 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 2 12:57:28 2021 +0200

    convert #defines to OUStringLiteral
    
    mostly by doing
    
    $ git grep -l '#define.*\"' -- *.cxx
        | xargs perl -pi -e
    's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 =
    u\2;/g'
    
    Change-Id: I63a4b050f220f0a61749892cd47fb91813f7d088
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119844
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 35047ef8d3d6..fb5525e295f9 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -52,8 +52,8 @@
 #include <sal/log.hxx>
 #include <rtl/ustrbuf.hxx>
 
-#define PRESET_DEFAULT u"default"
-#define TARGET_CURRENT "current"
+constexpr OUStringLiteral PRESET_DEFAULT = u"default";
+constexpr OUStringLiteral TARGET_CURRENT = u"current";
 
 namespace framework
 {
@@ -217,7 +217,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reload()
     css::uno::Reference< css::io::XStream > xStreamNoLang;
     {
         SolarMutexGuard g;
-        xStream = m_aPresetHandler.openTarget(u"" TARGET_CURRENT,
+        xStream = m_aPresetHandler.openTarget(TARGET_CURRENT,
                 css::embed::ElementModes::READ);
         try
         {
@@ -257,7 +257,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::store()
     css::uno::Reference< css::io::XStream > xStream;
     {
         SolarMutexGuard g;
-        xStream = m_aPresetHandler.openTarget(u"" TARGET_CURRENT,
+        xStream = m_aPresetHandler.openTarget(TARGET_CURRENT,
                css::embed::ElementModes::READWRITE); // open or create!
     }
 
@@ -308,7 +308,7 @@ sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly()
     css::uno::Reference< css::io::XStream > xStream;
     {
         SolarMutexGuard g;
-        xStream = m_aPresetHandler.openTarget(u"" TARGET_CURRENT,
+        xStream = m_aPresetHandler.openTarget(TARGET_CURRENT,
                 css::embed::ElementModes::READWRITE); // open or create!
     }
 
@@ -343,7 +343,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reset()
 {
     {
         SolarMutexGuard g;
-        m_aPresetHandler.copyPresetToTarget(PRESET_DEFAULT, u"" TARGET_CURRENT);
+        m_aPresetHandler.copyPresetToTarget(PRESET_DEFAULT, TARGET_CURRENT);
     }
 
     reload();
diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx
index 31f76fc92bf2..c86895f0de32 100644
--- a/framework/source/accelerators/documentacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx
@@ -30,7 +30,7 @@
 
 using namespace framework;
 
-#define RESOURCETYPE_ACCELERATOR u"accelerator"
+constexpr OUStringLiteral RESOURCETYPE_ACCELERATOR = u"accelerator";
 
 namespace {
 
diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx
index e8a26845f489..a42e932ac259 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -29,7 +29,7 @@
 
 #include <algorithm>
 
-#define PATH_SEPARATOR "/"
+constexpr OUStringLiteral PATH_SEPARATOR = u"/";
 #define PATH_SEPARATOR_UNICODE      u'/'
 
 namespace framework
diff --git a/framework/source/dispatch/servicehandler.cxx b/framework/source/dispatch/servicehandler.cxx
index cf99c16c27a0..a4eac242aa11 100644
--- a/framework/source/dispatch/servicehandler.cxx
+++ b/framework/source/dispatch/servicehandler.cxx
@@ -29,8 +29,7 @@
 
 namespace framework{
 
-#define PROTOCOL_VALUE      "service:"
-#define PROTOCOL_LENGTH     8
+constexpr OUStringLiteral PROTOCOL_VALUE = u"service:";
 
 // XInterface, XTypeProvider, XServiceInfo
 
@@ -178,7 +177,7 @@ css::uno::Reference< css::uno::XInterface > ServiceHandler::implts_dispatch( con
 {
     // extract service name and may optional given parameters from given URL
     // and use it to create and start the component
-    OUString sServiceAndArguments = aURL.Complete.copy(PROTOCOL_LENGTH);
+    OUString sServiceAndArguments = aURL.Complete.copy(PROTOCOL_VALUE.getLength());
     OUString sServiceName;
     OUString sArguments;
 
diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx
index ec2d20413614..7ee48b7fc676 100644
--- a/framework/source/dispatch/systemexec.cxx
+++ b/framework/source/dispatch/systemexec.cxx
@@ -29,8 +29,7 @@
 
 namespace framework{
 
-#define PROTOCOL_VALUE      "systemexecute:"
-#define PROTOCOL_LENGTH     14
+constexpr OUStringLiteral PROTOCOL_VALUE = u"systemexecute:";
 
 // XInterface, XTypeProvider, XServiceInfo
 
@@ -93,13 +92,13 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL&
                                                     const css::uno::Reference< css::frame::XDispatchResultListener >& xListener )
 {
     // convert "systemexec:file:///c:/temp/test.html" => "file:///c:/temp/test.html"
-    sal_Int32 c = aURL.Complete.getLength()-PROTOCOL_LENGTH;
+    sal_Int32 c = aURL.Complete.getLength()-PROTOCOL_VALUE.getLength();
     if (c<1) // we don't check for valid URLs here! The system will show an error message ...
     {
         impl_notifyResultListener(xListener, css::frame::DispatchResultState::FAILURE);
         return;
     }
-    OUString sSystemURLWithVariables = aURL.Complete.copy(PROTOCOL_LENGTH, c);
+    OUString sSystemURLWithVariables = aURL.Complete.copy(PROTOCOL_VALUE.getLength(), c);
 
     // TODO check security settings ...
 
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index ba3693404d93..6ef5f46f440c 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -51,9 +51,9 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star;
 
-#define ROOTNODE_ADDONMENU                              "Office.Addons"
+constexpr OUStringLiteral ROOTNODE_ADDONMENU = u"Office.Addons";
 constexpr OUStringLiteral PATHDELIMITER = u"/";
-#define SEPARATOR_URL                                   "private:separator"
+constexpr OUStringLiteral SEPARATOR_URL = u"private:separator";
 
 #define PROPERTYNAME_URL                                ADDONSMENUITEM_STRING_URL
 #define PROPERTYNAME_TITLE                              ADDONSMENUITEM_STRING_TITLE
@@ -62,7 +62,7 @@ constexpr OUStringLiteral PATHDELIMITER = u"/";
 #define PROPERTYNAME_CONTEXT                            ADDONSMENUITEM_STRING_CONTEXT
 #define PROPERTYNAME_SUBMENU                            ADDONSMENUITEM_STRING_SUBMENU
 
-#define IMAGES_NODENAME                                 "UserDefinedImages"
+constexpr OUStringLiteral IMAGES_NODENAME = u"UserDefinedImages";
 
 // The following order is mandatory. Please add properties at the end!
 #define INDEX_URL               0
diff --git a/framework/source/fwe/helper/propertysetcontainer.cxx b/framework/source/fwe/helper/propertysetcontainer.cxx
index e2c304ce4808..9707b4fac4ae 100644
--- a/framework/source/fwe/helper/propertysetcontainer.cxx
+++ b/framework/source/fwe/helper/propertysetcontainer.cxx
@@ -23,7 +23,7 @@
 #include <cppuhelper/queryinterface.hxx>
 #include <vcl/svapp.hxx>
 
-#define WRONG_TYPE_EXCEPTION    "Only XPropertSet allowed!"
+constexpr OUStringLiteral WRONG_TYPE_EXCEPTION = u"Only XPropertSet allowed!";
 
 using namespace cppu;
 using namespace com::sun::star::uno;
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx
index 7e697a667dd1..c2c44447f3cc 100644
--- a/framework/source/fwe/xml/menudocumenthandler.cxx
+++ b/framework/source/fwe/xml/menudocumenthandler.cxx
@@ -37,35 +37,35 @@
 #undef ATTRIBUTE_HELPID
 #endif
 
-#define XMLNS_MENU                  "http://openoffice.org/2001/menu"
+constexpr OUStringLiteral XMLNS_MENU = u"http://openoffice.org/2001/menu";
 
-#define ELEMENT_MENUBAR             "http://openoffice.org/2001/menu^menubar"
-#define ELEMENT_MENU                "http://openoffice.org/2001/menu^menu"
-#define ELEMENT_MENUPOPUP           "http://openoffice.org/2001/menu^menupopup"
-#define ELEMENT_MENUITEM            "http://openoffice.org/2001/menu^menuitem"
-#define ELEMENT_MENUSEPARATOR       "http://openoffice.org/2001/menu^menuseparator"
+constexpr OUStringLiteral ELEMENT_MENUBAR = u"http://openoffice.org/2001/menu^menubar";
+constexpr OUStringLiteral ELEMENT_MENU = u"http://openoffice.org/2001/menu^menu";
+constexpr OUStringLiteral ELEMENT_MENUPOPUP = u"http://openoffice.org/2001/menu^menupopup";
+constexpr OUStringLiteral ELEMENT_MENUITEM = u"http://openoffice.org/2001/menu^menuitem";
+constexpr OUStringLiteral ELEMENT_MENUSEPARATOR = u"http://openoffice.org/2001/menu^menuseparator";
 
-#define ELEMENT_NS_MENUBAR          "menu:menubar"
-#define ELEMENT_NS_MENU             "menu:menu"
-#define ELEMENT_NS_MENUPOPUP        "menu:menupopup"
-#define ELEMENT_NS_MENUITEM         "menu:menuitem"
-#define ELEMENT_NS_MENUSEPARATOR    "menu:menuseparator"
+constexpr OUStringLiteral ELEMENT_NS_MENUBAR = u"menu:menubar";
+constexpr OUStringLiteral ELEMENT_NS_MENU = u"menu:menu";
+constexpr OUStringLiteral ELEMENT_NS_MENUPOPUP = u"menu:menupopup";
+constexpr OUStringLiteral ELEMENT_NS_MENUITEM = u"menu:menuitem";
+constexpr OUStringLiteral ELEMENT_NS_MENUSEPARATOR = u"menu:menuseparator";
 
-#define ATTRIBUTE_ID                "http://openoffice.org/2001/menu^id"
-#define ATTRIBUTE_LABEL             "http://openoffice.org/2001/menu^label"
-#define ATTRIBUTE_HELPID            "http://openoffice.org/2001/menu^helpid"
-#define ATTRIBUTE_STYLE             "http://openoffice.org/2001/menu^style"
+constexpr OUStringLiteral ATTRIBUTE_ID = u"http://openoffice.org/2001/menu^id";
+constexpr OUStringLiteral ATTRIBUTE_LABEL = u"http://openoffice.org/2001/menu^label";
+constexpr OUStringLiteral ATTRIBUTE_HELPID = u"http://openoffice.org/2001/menu^helpid";
+constexpr OUStringLiteral ATTRIBUTE_STYLE = u"http://openoffice.org/2001/menu^style";
 
-#define ATTRIBUTE_NS_ID             "menu:id"
-#define ATTRIBUTE_NS_LABEL          "menu:label"
-#define ATTRIBUTE_NS_HELPID         "menu:helpid"
-#define ATTRIBUTE_NS_STYLE          "menu:style"
+constexpr OUStringLiteral ATTRIBUTE_NS_ID = u"menu:id";
+constexpr OUStringLiteral ATTRIBUTE_NS_LABEL = u"menu:label";
+constexpr OUStringLiteral ATTRIBUTE_NS_HELPID = u"menu:helpid";
+constexpr OUStringLiteral ATTRIBUTE_NS_STYLE = u"menu:style";
 
-#define ATTRIBUTE_XMLNS_MENU        "xmlns:menu"
+constexpr OUStringLiteral ATTRIBUTE_XMLNS_MENU = u"xmlns:menu";
 
-#define ATTRIBUTE_TYPE_CDATA        "CDATA"
+constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA";
 
-#define MENUBAR_DOCTYPE             "<!DOCTYPE menu:menubar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"menubar.dtd\">"
+constexpr OUStringLiteral MENUBAR_DOCTYPE = u"<!DOCTYPE menu:menubar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"menubar.dtd\">";
 
 #define ATTRIBUTE_ITEMSTYLE_TEXT    "text"
 #define ATTRIBUTE_ITEMSTYLE_IMAGE    "image"
diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx
index f75bd1e720c0..16f10f157660 100644
--- a/framework/source/fwe/xml/statusbardocumenthandler.cxx
+++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx
@@ -38,12 +38,12 @@ using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::ui;
 using namespace ::com::sun::star::container;
 
-#define XMLNS_STATUSBAR             "http://openoffice.org/2001/statusbar"
-#define XMLNS_XLINK                 "http://www.w3.org/1999/xlink"
-#define XMLNS_STATUSBAR_PREFIX      "statusbar:"
-#define XMLNS_XLINK_PREFIX          "xlink:"
+constexpr OUStringLiteral XMLNS_STATUSBAR = u"http://openoffice.org/2001/statusbar";
+constexpr OUStringLiteral XMLNS_XLINK = u"http://www.w3.org/1999/xlink";
+constexpr OUStringLiteral XMLNS_STATUSBAR_PREFIX = u"statusbar:";
+constexpr OUStringLiteral XMLNS_XLINK_PREFIX = u"xlink:";
 
-#define XMLNS_FILTER_SEPARATOR      "^"
+constexpr OUStringLiteral XMLNS_FILTER_SEPARATOR = u"^";
 
 #define ELEMENT_STATUSBAR           "statusbar"
 #define ELEMENT_STATUSBARITEM       "statusbaritem"
@@ -58,26 +58,26 @@ using namespace ::com::sun::star::container;
 #define ATTRIBUTE_HELPURL           "helpid"
 #define ATTRIBUTE_MANDATORY         "mandatory"
 
-#define ELEMENT_NS_STATUSBAR        "statusbar:statusbar"
-#define ELEMENT_NS_STATUSBARITEM    "statusbar:statusbaritem"
+constexpr OUStringLiteral ELEMENT_NS_STATUSBAR = u"statusbar:statusbar";
+constexpr OUStringLiteral ELEMENT_NS_STATUSBARITEM = u"statusbar:statusbaritem";
 
-#define ATTRIBUTE_XMLNS_STATUSBAR   "xmlns:statusbar"
-#define ATTRIBUTE_XMLNS_XLINK       "xmlns:xlink"
+constexpr OUStringLiteral ATTRIBUTE_XMLNS_STATUSBAR = u"xmlns:statusbar";
+constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink";
 
-#define ATTRIBUTE_TYPE_CDATA        "CDATA"
+constexpr OUStringLiteral ATTRIBUTE_TYPE_CDATA = u"CDATA";
 
-#define ATTRIBUTE_BOOLEAN_TRUE      "true"
-#define ATTRIBUTE_BOOLEAN_FALSE     "false"
+constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_TRUE = u"true";
+constexpr OUStringLiteral ATTRIBUTE_BOOLEAN_FALSE = u"false";
 
-#define ATTRIBUTE_ALIGN_LEFT        "left"
-#define ATTRIBUTE_ALIGN_RIGHT       "right"
-#define ATTRIBUTE_ALIGN_CENTER      "center"
+constexpr OUStringLiteral ATTRIBUTE_ALIGN_LEFT = u"left";
+constexpr OUStringLiteral ATTRIBUTE_ALIGN_RIGHT = u"right";
+constexpr OUStringLiteral ATTRIBUTE_ALIGN_CENTER = u"center";
 
-#define ATTRIBUTE_STYLE_IN          "in"
-#define ATTRIBUTE_STYLE_OUT         "out"
-#define ATTRIBUTE_STYLE_FLAT        "flat"
+constexpr OUStringLiteral ATTRIBUTE_STYLE_IN = u"in";
+constexpr OUStringLiteral ATTRIBUTE_STYLE_OUT = u"out";
+constexpr OUStringLiteral ATTRIBUTE_STYLE_FLAT = u"flat";
 
-#define STATUSBAR_DOCTYPE           "<!DOCTYPE statusbar:statusbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"statusbar.dtd\">"
+constexpr OUStringLiteral STATUSBAR_DOCTYPE = u"<!DOCTYPE statusbar:statusbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"statusbar.dtd\">";
 
 namespace framework
 {
@@ -158,13 +158,13 @@ OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
     {
         if ( StatusBarEntries[i].nNamespace == SB_NS_STATUSBAR )
         {
-            OUString temp = XMLNS_STATUSBAR XMLNS_FILTER_SEPARATOR +
+            OUString temp = XMLNS_STATUSBAR + XMLNS_FILTER_SEPARATOR +
                 OUString::createFromAscii( StatusBarEntries[i].aEntryName );
             m_aStatusBarMap.emplace( temp, static_cast<StatusBar_XML_Entry>(i) );
         }
         else
         {
-            OUString temp = XMLNS_XLINK XMLNS_FILTER_SEPARATOR +
+            OUString temp = XMLNS_XLINK + XMLNS_FILTER_SEPARATOR +
                 OUString::createFromAscii( StatusBarEntries[i].aEntryName );
             m_aStatusBarMap.emplace( temp, static_cast<StatusBar_XML_Entry>(i) );
         }
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index 401a08fbeca1..c5dc0f429483 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::xml::sax;
 
-#define TOOLBAR_DOCTYPE             "<!DOCTYPE toolbar:toolbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"toolbar.dtd\">"
+constexpr OUStringLiteral TOOLBAR_DOCTYPE = u"<!DOCTYPE toolbar:toolbar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"toolbar.dtd\">";
 
 namespace framework
 {
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index 1879554c7bed..41aa74a02f17 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -31,7 +31,7 @@
 #include <sal/log.hxx>
 #include <vcl/svapp.hxx>
 
-#define SETNAME_HANDLER "HandlerSet" // name of configuration set inside package
+constexpr OUStringLiteral SETNAME_HANDLER = u"HandlerSet"; // name of configuration set inside package
 
 namespace framework{
 
@@ -200,7 +200,7 @@ void HandlerCFGAccess::read( HandlerHash& rHandlerHash, PatternHash& rPatternHas
     for( nSource=0; nSource<nSourceCount; ++nSource )
     {
         lFullNames[nTarget] =
-            SETNAME_HANDLER
+            SETNAME_HANDLER +
             CFG_PATH_SEPARATOR +
             lNames[nSource] +
             CFG_PATH_SEPARATOR
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index 71639beb0bb5..2afa8926d684 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -34,7 +34,7 @@ using namespace ::com::sun::star::uno;
 namespace framework{
 
 // used to mark a dispatch as comment (mostly it indicates an error) Changing of this define will impact all using of such comments...
-#define REM_AS_COMMENT    "rem "
+constexpr OUStringLiteral REM_AS_COMMENT = u"rem ";
 
 //  XInterface, XTypeProvider, XServiceInfo
 
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 6dcef5a80061..865028876400 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -53,8 +53,8 @@
 
 using namespace framework;
 
-#define CFGPROP_USERPATHS "UserPaths"
-#define CFGPROP_WRITEPATH "WritePath"
+constexpr OUStringLiteral CFGPROP_USERPATHS = u"UserPaths";
+constexpr OUStringLiteral CFGPROP_WRITEPATH = u"WritePath";
 
 /*
     0 : old style              "Template"              string using ";" as separator
@@ -63,9 +63,9 @@ using namespace framework;
     3 : write path             "Template_write"        string
  */
 
-#define POSTFIX_INTERNAL_PATHS "_internal"
-#define POSTFIX_USER_PATHS "_user"
-#define POSTFIX_WRITE_PATH "_writable"
+constexpr OUStringLiteral POSTFIX_INTERNAL_PATHS = u"_internal";
+constexpr OUStringLiteral POSTFIX_USER_PATHS = u"_user";
+constexpr OUStringLiteral POSTFIX_WRITE_PATH = u"_writable";
 
 namespace {
 
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index d59c0158afac..8aeea629694a 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -68,10 +68,10 @@ using namespace com::sun::star::container;
 using namespace com::sun::star::beans;
 using namespace framework;
 
-#define RESOURCETYPE_MENUBAR   "menubar"
-#define RESOURCETYPE_TOOLBAR   "toolbar"
-#define RESOURCETYPE_STATUSBAR "statusbar"
-#define RESOURCETYPE_POPUPMENU "popupmenu"
+constexpr OUStringLiteral RESOURCETYPE_MENUBAR = u"menubar";
+constexpr OUStringLiteral RESOURCETYPE_TOOLBAR = u"toolbar";
+constexpr OUStringLiteral RESOURCETYPE_STATUSBAR = u"statusbar";
+constexpr OUStringLiteral RESOURCETYPE_POPUPMENU = u"popupmenu";
 
 namespace {
 
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 0357eb0a6be0..1b57b7430da6 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -74,10 +74,10 @@ const sal_uInt16 ITEMID_ADDONLIST             = 6678; // used to be a SID in sfx
 namespace framework
 {
 
-#define aCmdHelpIndex ".uno:HelpIndex"
-#define aCmdToolsMenu ".uno:ToolsMenu"
-#define aCmdHelpMenu ".uno:HelpMenu"
-#define aSpecialWindowCommand ".uno:WindowList"
+constexpr OUStringLiteral aCmdHelpIndex = u".uno:HelpIndex";
+constexpr OUStringLiteral aCmdToolsMenu = u".uno:ToolsMenu";
+constexpr OUStringLiteral aCmdHelpMenu = u".uno:HelpMenu";
+constexpr OUStringLiteral aSpecialWindowCommand = u".uno:WindowList";
 
 MenuBarManager::MenuBarManager(
     const Reference< XComponentContext >& rxContext,
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx
index 579fff015582..e8abbe0ceb0f 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -43,8 +43,8 @@
 #include <cppuhelper/supportsservice.hxx>
 
 //  Defines
-#define aSlotNewDocDirect ".uno:AddDirect"
-#define aSlotAutoPilot ".uno:AutoPilotMenu"
+constexpr OUStringLiteral aSlotNewDocDirect = u".uno:AddDirect";
+constexpr OUStringLiteral aSlotAutoPilot = u".uno:AutoPilotMenu";
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -319,7 +319,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const &
 
     Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     URL aTargetURL;
-    aTargetURL.Complete = OUString::createFromAscii(m_bNewMenu ? aSlotNewDocDirect : aSlotAutoPilot);
+    aTargetURL.Complete = m_bNewMenu ? OUString(aSlotNewDocDirect) : OUString(aSlotAutoPilot);
     m_xURLTransformer->parseStrict( aTargetURL );
     Reference< XDispatch > xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
     if(xMenuItemDispatch == nullptr)
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index c3007397ea33..faa34f93eea1 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -36,9 +36,9 @@ using namespace ::com::sun::star::xml::sax;
 #define ELEMENT_EXTERNALIMAGES      "externalimages"
 #define ELEMENT_EXTERNALENTRY       "externalentry"
 
-#define ELEMENT_NS_IMAGESCONTAINER  "image:imagescontainer"
-#define ELEMENT_NS_IMAGES           "image:images"
-#define ELEMENT_NS_ENTRY            "image:entry"
+constexpr OUStringLiteral ELEMENT_NS_IMAGESCONTAINER = u"image:imagescontainer";
+constexpr OUStringLiteral ELEMENT_NS_IMAGES = u"image:images";
+constexpr OUStringLiteral ELEMENT_NS_ENTRY = u"image:entry";
 
 #define ATTRIBUTE_HREF                  "href"
 #define ATTRIBUTE_MASKCOLOR             "maskcolor"
@@ -50,19 +50,19 @@ using namespace ::com::sun::star::xml::sax;
 #define ATTRIBUTE_HIGHCONTRASTMASKURL   "highcontrastmaskurl"
 #define ATTRIBUTE_TYPE_CDATA            "CDATA"
 
-#define ATTRIBUTE_XMLNS_IMAGE       "xmlns:image"
-#define ATTRIBUTE_XMLNS_XLINK       "xmlns:xlink"
+constexpr OUStringLiteral ATTRIBUTE_XMLNS_IMAGE = u"xmlns:image";
+constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK = u"xmlns:xlink";
 
-#define ATTRIBUTE_XLINK_TYPE        "xlink:type"
-#define ATTRIBUTE_XLINK_TYPE_VALUE  "simple"
+constexpr OUStringLiteral ATTRIBUTE_XLINK_TYPE = u"xlink:type";
+constexpr OUStringLiteral ATTRIBUTE_XLINK_TYPE_VALUE = u"simple";
 
-#define XMLNS_IMAGE                 "http://openoffice.org/2001/image"
-#define XMLNS_XLINK                 "http://www.w3.org/1999/xlink"
-#define XMLNS_IMAGE_PREFIX          "image:"
+constexpr OUStringLiteral XMLNS_IMAGE = u"http://openoffice.org/2001/image";
+constexpr OUStringLiteral XMLNS_XLINK = u"http://www.w3.org/1999/xlink";
+constexpr OUStringLiteral XMLNS_IMAGE_PREFIX = u"image:";
 
-#define XMLNS_FILTER_SEPARATOR      "^"
+constexpr OUStringLiteral XMLNS_FILTER_SEPARATOR = u"^";
 
-#define IMAGES_DOCTYPE  "<!DOCTYPE image:imagecontainer PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"image.dtd\">"
+constexpr OUStringLiteral IMAGES_DOCTYPE = u"<!DOCTYPE image:imagecontainer PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"image.dtd\">";
 
 namespace framework
 {


More information about the Libreoffice-commits mailing list