sfx2/source/appl/shutdownicon.hxx    |   16 ++++++++--------
 sfx2/source/appl/shutdowniconaqua.mm |    6 +++---
 sfx2/source/appl/shutdowniconw32.cxx |   12 +++++-------
 3 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 9de3aa9328e46aed6ca7fdd9485085b7355c3e25
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Dec 27 18:13:55 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Dec 28 05:43:18 2021 +0100

    Use OUStringLiteral
    
    Change-Id: Id337f2c9cfa192663f2ddb226c786cdb9f6b3265
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127590
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sfx2/source/appl/shutdownicon.hxx 
b/sfx2/source/appl/shutdownicon.hxx
index cb352e60b443..c551a190a01d 100644
--- a/sfx2/source/appl/shutdownicon.hxx
+++ b/sfx2/source/appl/shutdownicon.hxx
@@ -50,14 +50,14 @@ typedef comphelper::WeakComponentImplHelper<
     css::lang::XServiceInfo,
     css::beans::XFastPropertySet > ShutdownIconServiceBase;
 
-#define WRITER_URL          "private:factory/swriter"
-#define CALC_URL            "private:factory/scalc"
-#define IMPRESS_URL         "private:factory/simpress"
-#define IMPRESS_WIZARD_URL  "private:factory/simpress?slot=6686"
-#define DRAW_URL            "private:factory/sdraw"
-#define MATH_URL            "private:factory/smath"
-#define BASE_URL            "private:factory/sdatabase?Interactive"
-#define STARTMODULE_URL     ".uno:ShowStartModule"
+inline constexpr OUStringLiteral WRITER_URL          = 
u"private:factory/swriter";
+inline constexpr OUStringLiteral CALC_URL            = 
u"private:factory/scalc";
+inline constexpr OUStringLiteral IMPRESS_URL         = 
u"private:factory/simpress";
+inline constexpr OUStringLiteral IMPRESS_WIZARD_URL  = 
u"private:factory/simpress?slot=6686";
+inline constexpr OUStringLiteral DRAW_URL            = 
u"private:factory/sdraw";
+inline constexpr OUStringLiteral MATH_URL            = 
u"private:factory/smath";
+inline constexpr OUStringLiteral BASE_URL            = 
u"private:factory/sdatabase?Interactive";
+inline constexpr OUStringLiteral STARTMODULE_URL     = u".uno:ShowStartModule";
 
 class ShutdownIcon : public ShutdownIconServiceBase
 {
diff --git a/sfx2/source/appl/shutdowniconaqua.mm 
b/sfx2/source/appl/shutdowniconaqua.mm
index 74a9602e6ce1..1a692f7ed164 100644
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -407,8 +407,8 @@ void aqua_init_systray()
             {
                 SvtModuleOptions::EModule   eModuleIdentifier;
                 int                         nMenuTag;
-                const char*                 pAsciiURLDescription;
-            }   aMenuItems[] =
+                rtl::OUStringConstExpr      sURLDescription;
+            } static const aMenuItems[] =
             {
                 { SvtModuleOptions::EModule::WRITER,    MI_WRITER,  WRITER_URL 
},
                 { SvtModuleOptions::EModule::CALC,      MI_CALC,    CALC_URL },
@@ -436,7 +436,7 @@ void aqua_init_systray()
                     // the complete application is not even installed
                     continue;
 
-                OUString sURL( OUString::createFromAscii( 
aMenuItems[i].pAsciiURLDescription ) );
+                const OUString& sURL( aMenuItems[i].sURLDescription );
 
                 if ( aFileNewAppsAvailable.find( sURL ) == 
aFileNewAppsAvailable.end() )
                     // the application is installed, but the entry has been 
configured to *not* appear in the File/New
diff --git a/sfx2/source/appl/shutdowniconw32.cxx 
b/sfx2/source/appl/shutdowniconw32.cxx
index f27fb4db6bc8..3c0c62359fe9 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -160,8 +160,8 @@ static HMENU createSystrayMenu( )
         SvtModuleOptions::EModule   eModuleIdentifier;
         UINT                        nMenuItemID;
         UINT                        nMenuIconID;
-        const char*                 pAsciiURLDescription;
-    }   aMenuItems[] =
+        rtl::OUStringConstExpr      sURLDescription;
+    } static const aMenuItems[] =
     {
         { SvtModuleOptions::EModule::WRITER,    IDM_WRITER, 
ICON_TEXT_DOCUMENT,         WRITER_URL },
         { SvtModuleOptions::EModule::CALC,      IDM_CALC,   
ICON_SPREADSHEET_DOCUMENT,  CALC_URL },
@@ -172,20 +172,18 @@ static HMENU createSystrayMenu( )
     };
 
     // insert the menu entries for launching the applications
-    for ( size_t i = 0; i < SAL_N_ELEMENTS(aMenuItems); ++i )
+    for (const auto& [eModuleIdentifier, nMenuItemID, nMenuIconID, sURL] : 
aMenuItems)
     {
-        if ( !aModuleOptions.IsModuleInstalled( 
aMenuItems[i].eModuleIdentifier ) )
+        if ( !aModuleOptions.IsModuleInstalled( eModuleIdentifier ) )
             // the complete application is not even installed
             continue;
 
-        OUString sURL( OUString::createFromAscii( 
aMenuItems[i].pAsciiURLDescription ) );
-
         if ( aFileNewAppsAvailable.find( sURL ) == aFileNewAppsAvailable.end() 
)
             // the application is installed, but the entry has been configured 
to *not* appear in the File/New
             // menu => also let not appear it in the quickstarter
             continue;
 
-        addMenuItem( hMenu, aMenuItems[i].nMenuItemID, 
aMenuItems[i].nMenuIconID,
+        addMenuItem( hMenu, nMenuItemID, nMenuIconID,
             ShutdownIcon::GetUrlDescription( sURL ), pos, true, "" );
     }
 

Reply via email to