basctl/inc/bitmaps.hlst             |   28 ++++++++++----------
 basctl/inc/helpids.h                |   26 ++++++++++--------
 basctl/inc/strings.hxx              |   50 ++++++++++++++++++------------------
 basctl/source/basicide/baside2.cxx  |    2 -
 basctl/source/basicide/baside2.hxx  |    2 -
 basctl/source/basicide/baside2b.cxx |    2 -
 basctl/source/basicide/baside3.cxx  |    2 -
 basctl/source/basicide/bastype2.cxx |    4 +-
 basctl/source/basicide/bastype3.cxx |    4 +-
 basctl/source/basicide/moduldl2.cxx |    4 +-
 basctl/source/inc/baside3.hxx       |    2 -
 basctl/source/inc/bastypes.hxx      |    2 -
 basctl/source/inc/dlgeddef.hxx      |   24 ++++++++---------
 13 files changed, 77 insertions(+), 75 deletions(-)

New commits:
commit 0011ed25344673d441e2ac59f455428b27fea9d3
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Nov 18 14:01:23 2021 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Nov 18 19:46:19 2021 +0100

    loplugin:stringliteraldefine in basctl
    
    Change-Id: Id9f1d2932b5f602602d0229b8dc9794c01f5cbb2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125277
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/basctl/inc/bitmaps.hlst b/basctl/inc/bitmaps.hlst
index 11d35b289d58..b316a2450a39 100644
--- a/basctl/inc/bitmaps.hlst
+++ b/basctl/inc/bitmaps.hlst
@@ -9,19 +9,19 @@
 
 #pragma once
 
-#define RID_BMP_BRKENABLED      "res/im30838.png"
-#define RID_BMP_BRKDISABLED     "res/im30839.png"
-#define RID_BMP_STEPMARKER      "res/im30840.png"
-#define RID_BMP_ERRORMARKER     "res/im30841.png"
-#define RID_BMP_LOCKED          "res/lock.png"
-#define RID_BMP_INSTALLATION    "res/harddisk_16.png"
-#define RID_BMP_DOCUMENT        "res/im30826.png"
-#define RID_BMP_MODLIB          "res/im30820.png"
-#define RID_BMP_MODLIBNOTLOADED "res/im30827.png"
-#define RID_BMP_MODULE          "res/im30821.png"
-#define RID_BMP_MACRO           "res/im30822.png"
-#define RID_BMP_DLGLIB          "res/dialogfolder_16.png"
-#define RID_BMP_DLGLIBNOTLOADED "res/dialogfoldernot_16.png"
-#define RID_BMP_DIALOG          "res/im30823.png"
+inline constexpr OUStringLiteral RID_BMP_BRKENABLED = u"res/im30838.png";
+inline constexpr OUStringLiteral RID_BMP_BRKDISABLED = u"res/im30839.png";
+inline constexpr OUStringLiteral RID_BMP_STEPMARKER = u"res/im30840.png";
+inline constexpr OUStringLiteral RID_BMP_ERRORMARKER = u"res/im30841.png";
+inline constexpr OUStringLiteral RID_BMP_LOCKED = u"res/lock.png";
+inline constexpr OUStringLiteral RID_BMP_INSTALLATION = u"res/harddisk_16.png";
+inline constexpr OUStringLiteral RID_BMP_DOCUMENT = u"res/im30826.png";
+inline constexpr OUStringLiteral RID_BMP_MODLIB = u"res/im30820.png";
+inline constexpr OUStringLiteral RID_BMP_MODLIBNOTLOADED = u"res/im30827.png";
+inline constexpr OUStringLiteral RID_BMP_MODULE = u"res/im30821.png";
+inline constexpr OUStringLiteral RID_BMP_MACRO = u"res/im30822.png";
+inline constexpr OUStringLiteral RID_BMP_DLGLIB = u"res/dialogfolder_16.png";
+inline constexpr OUStringLiteral RID_BMP_DLGLIBNOTLOADED = 
u"res/dialogfoldernot_16.png";
+inline constexpr OUStringLiteral RID_BMP_DIALOG = u"res/im30823.png";
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/basctl/inc/helpids.h b/basctl/inc/helpids.h
index 13e59eb7ef88..28b855ffb602 100644
--- a/basctl/inc/helpids.h
+++ b/basctl/inc/helpids.h
@@ -18,20 +18,22 @@
  */
 #pragma once
 
-#define HID_BASICIDE_OBJECTCAT                            
"BASCTL_HID_BASICIDE_OBJECTCAT"
+#include <rtl/string.hxx>
 
-#define HID_BASICIDE_REMOVEWATCH                          
"BASCTL_HID_BASICIDE_REMOVEWATCH"
+inline constexpr OStringLiteral HID_BASICIDE_OBJECTCAT = 
"BASCTL_HID_BASICIDE_OBJECTCAT";
 
-#define HID_BASICIDE_MODULWINDOW                          
"BASCTL_HID_BASICIDE_MODULWINDOW"
-#define HID_BASICIDE_DIALOGWINDOW                         
"BASCTL_HID_BASICIDE_DIALOGWINDOW"
+inline constexpr OStringLiteral HID_BASICIDE_REMOVEWATCH = 
"BASCTL_HID_BASICIDE_REMOVEWATCH";
 
-#define HID_BASICIDE_EDITORWINDOW                         
"BASCTL_HID_BASICIDE_EDITORWINDOW"
-#define HID_BASICIDE_BREAKPOINTWINDOW                     
"BASCTL_HID_BASICIDE_BREAKPOINTWINDOW"
-#define HID_BASICIDE_WATCHWINDOW                          
"BASCTL_HID_BASICIDE_WATCHWINDOW"
-#define HID_BASICIDE_STACKWINDOW                          
"BASCTL_HID_BASICIDE_STACKWINDOW"
-#define HID_BASICIDE_TABBAR                               
"BASCTL_HID_BASICIDE_TABBAR"
-#define HID_BASICIDE_WATCHWINDOW_EDIT                     
"BASCTL_HID_BASICIDE_WATCHWINDOW_EDIT"
-#define HID_BASICIDE_WATCHWINDOW_LIST                     
"BASCTL_HID_BASICIDE_WATCHWINDOW_LIST"
-#define HID_BASICIDE_STACKWINDOW_LIST                     
"BASCTL_HID_BASICIDE_STACKWINDOW_LIST"
+inline constexpr OStringLiteral HID_BASICIDE_MODULWINDOW = 
"BASCTL_HID_BASICIDE_MODULWINDOW";
+inline constexpr OStringLiteral HID_BASICIDE_DIALOGWINDOW = 
"BASCTL_HID_BASICIDE_DIALOGWINDOW";
+
+inline constexpr OStringLiteral HID_BASICIDE_EDITORWINDOW = 
"BASCTL_HID_BASICIDE_EDITORWINDOW";
+inline constexpr OStringLiteral HID_BASICIDE_BREAKPOINTWINDOW = 
"BASCTL_HID_BASICIDE_BREAKPOINTWINDOW";
+inline constexpr OStringLiteral HID_BASICIDE_WATCHWINDOW = 
"BASCTL_HID_BASICIDE_WATCHWINDOW";
+inline constexpr OStringLiteral HID_BASICIDE_STACKWINDOW = 
"BASCTL_HID_BASICIDE_STACKWINDOW";
+inline constexpr OStringLiteral HID_BASICIDE_TABBAR = 
"BASCTL_HID_BASICIDE_TABBAR";
+inline constexpr OStringLiteral HID_BASICIDE_WATCHWINDOW_EDIT = 
"BASCTL_HID_BASICIDE_WATCHWINDOW_EDIT";
+inline constexpr OStringLiteral HID_BASICIDE_WATCHWINDOW_LIST = 
"BASCTL_HID_BASICIDE_WATCHWINDOW_LIST";
+inline constexpr OStringLiteral HID_BASICIDE_STACKWINDOW_LIST = 
"BASCTL_HID_BASICIDE_STACKWINDOW_LIST";
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/inc/strings.hxx b/basctl/inc/strings.hxx
index fc04eae43dc1..335eecb0bf00 100644
--- a/basctl/inc/strings.hxx
+++ b/basctl/inc/strings.hxx
@@ -11,30 +11,30 @@
 
 // Dialog Controls 
---------------------------------------------------------------
 
-#define RID_STR_CLASS_CONTROL           "Control"
-#define RID_STR_CLASS_DIALOG            "Dialog"
-#define RID_STR_CLASS_BUTTON            "CommandButton"
-#define RID_STR_CLASS_RADIOBUTTON       "OptionButton"
-#define RID_STR_CLASS_CHECKBOX          "CheckBox"
-#define RID_STR_CLASS_LISTBOX           "ListBox"
-#define RID_STR_CLASS_COMBOBOX          "ComboBox"
-#define RID_STR_CLASS_GROUPBOX          "FrameControl"
-#define RID_STR_CLASS_EDIT              "TextField"
-#define RID_STR_CLASS_FIXEDTEXT         "Label"
-#define RID_STR_CLASS_IMAGECONTROL      "ImageControl"
-#define RID_STR_CLASS_PROGRESSBAR       "ProgressBar"
-#define RID_STR_CLASS_SCROLLBAR         "ScrollBar"
-#define RID_STR_CLASS_FIXEDLINE         "FixedLine"
-#define RID_STR_CLASS_DATEFIELD         "DateField"
-#define RID_STR_CLASS_TIMEFIELD         "TimeField"
-#define RID_STR_CLASS_NUMERICFIELD      "NumericField"
-#define RID_STR_CLASS_CURRENCYFIELD     "CurrencyField"
-#define RID_STR_CLASS_FORMATTEDFIELD    "FormattedField"
-#define RID_STR_CLASS_PATTERNFIELD      "PatternField"
-#define RID_STR_CLASS_FILECONTROL       "FileControl"
-#define RID_STR_CLASS_TREECONTROL       "TreeControl"
-#define RID_STR_CLASS_GRIDCONTROL       "GridControl"
-#define RID_STR_CLASS_SPINCONTROL       "SpinButton"
-#define RID_STR_CLASS_HYPERLINKCONTROL  "HyperlinkControl"
+inline constexpr OUStringLiteral RID_STR_CLASS_CONTROL = u"Control";
+inline constexpr OUStringLiteral RID_STR_CLASS_DIALOG = u"Dialog";
+inline constexpr OUStringLiteral RID_STR_CLASS_BUTTON = u"CommandButton";
+inline constexpr OUStringLiteral RID_STR_CLASS_RADIOBUTTON = u"OptionButton";
+inline constexpr OUStringLiteral RID_STR_CLASS_CHECKBOX = u"CheckBox";
+inline constexpr OUStringLiteral RID_STR_CLASS_LISTBOX = u"ListBox";
+inline constexpr OUStringLiteral RID_STR_CLASS_COMBOBOX = u"ComboBox";
+inline constexpr OUStringLiteral RID_STR_CLASS_GROUPBOX = u"FrameControl";
+inline constexpr OUStringLiteral RID_STR_CLASS_EDIT = u"TextField";
+inline constexpr OUStringLiteral RID_STR_CLASS_FIXEDTEXT = u"Label";
+inline constexpr OUStringLiteral RID_STR_CLASS_IMAGECONTROL = u"ImageControl";
+inline constexpr OUStringLiteral RID_STR_CLASS_PROGRESSBAR = u"ProgressBar";
+inline constexpr OUStringLiteral RID_STR_CLASS_SCROLLBAR = u"ScrollBar";
+inline constexpr OUStringLiteral RID_STR_CLASS_FIXEDLINE = u"FixedLine";
+inline constexpr OUStringLiteral RID_STR_CLASS_DATEFIELD = u"DateField";
+inline constexpr OUStringLiteral RID_STR_CLASS_TIMEFIELD = u"TimeField";
+inline constexpr OUStringLiteral RID_STR_CLASS_NUMERICFIELD = u"NumericField";
+inline constexpr OUStringLiteral RID_STR_CLASS_CURRENCYFIELD = 
u"CurrencyField";
+inline constexpr OUStringLiteral RID_STR_CLASS_FORMATTEDFIELD = 
u"FormattedField";
+inline constexpr OUStringLiteral RID_STR_CLASS_PATTERNFIELD = u"PatternField";
+inline constexpr OUStringLiteral RID_STR_CLASS_FILECONTROL = u"FileControl";
+inline constexpr OUStringLiteral RID_STR_CLASS_TREECONTROL = u"TreeControl";
+inline constexpr OUStringLiteral RID_STR_CLASS_GRIDCONTROL = u"GridControl";
+inline constexpr OUStringLiteral RID_STR_CLASS_SPINCONTROL = u"SpinButton";
+inline constexpr OUStringLiteral RID_STR_CLASS_HYPERLINKCONTROL = 
u"HyperlinkControl";
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index ff14bd6ccdc2..c7f99e8b8e03 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1405,7 +1405,7 @@ void ModulWindow::OnNewDocument ()
     m_aXEditorWindow->SetLineNumberDisplay(bLineNumbers);
 }
 
-char const* ModulWindow::GetHid () const
+OString ModulWindow::GetHid () const
 {
     return HID_BASICIDE_MODULWINDOW;
 }
diff --git a/basctl/source/basicide/baside2.hxx 
b/basctl/source/basicide/baside2.hxx
index ab6d7102bd15..e59c148bc3b5 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -378,7 +378,7 @@ public:
     virtual void Deactivating () override;
 
     virtual void OnNewDocument () override;
-    virtual char const* GetHid () const override;
+    virtual OString GetHid () const override;
     virtual ItemType GetType () const override;
     virtual bool HasActiveEditor () const override;
 
diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index d998193cc2a5..48f429848f66 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1419,7 +1419,7 @@ void BreakPointWindow::ShowMarker(vcl::RenderContext& 
rRenderContext)
     Size const aOutSz = GetOutDev()->GetOutputSize();
     tools::Long const nLineHeight = GetTextHeight();
 
-    Image aMarker = GetImage(OUString(bErrorMarker ? std::u16string_view(u"" 
RID_BMP_ERRORMARKER) : std::u16string_view(u"" RID_BMP_STEPMARKER)));
+    Image aMarker = GetImage(bErrorMarker ? OUString(RID_BMP_ERRORMARKER) : 
OUString(RID_BMP_STEPMARKER));
 
     Size aMarkerSz(aMarker.GetSizePixel());
     aMarkerSz = rRenderContext.PixelToLogic(aMarkerSz);
diff --git a/basctl/source/basicide/baside3.cxx 
b/basctl/source/basicide/baside3.cxx
index 23eb5ab1e0eb..920e82da3d0a 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1244,7 +1244,7 @@ css::uno::Reference< css::accessibility::XAccessible > 
DialogWindow::CreateAcces
     return new AccessibleDialogWindow(this);
 }
 
-char const* DialogWindow::GetHid () const
+OString DialogWindow::GetHid () const
 {
     return HID_BASICIDE_DIALOGWINDOW;
 }
diff --git a/basctl/source/basicide/bastype2.cxx 
b/basctl/source/basicide/bastype2.cxx
index 20350b41b9f2..afff27b75dfd 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -243,9 +243,9 @@ void SbTreeListBox::ImpCreateLibEntries(const 
weld::TreeIter& rIter, const Scrip
             // create tree list box entry
             OUString sId;
             if ( ( nMode & BrowseMode::Dialogs ) && !( nMode & 
BrowseMode::Modules ) )
-                sId = bLoaded ? std::u16string_view(u"" RID_BMP_DLGLIB) : 
std::u16string_view(u"" RID_BMP_DLGLIBNOTLOADED);
+                sId = bLoaded ? OUString(RID_BMP_DLGLIB) : 
OUString(RID_BMP_DLGLIBNOTLOADED);
             else
-                sId = bLoaded ? std::u16string_view(u"" RID_BMP_MODLIB) : 
std::u16string_view(u"" RID_BMP_MODLIBNOTLOADED);
+                sId = bLoaded ? OUString(RID_BMP_MODLIB) : 
OUString(RID_BMP_MODLIBNOTLOADED);
             std::unique_ptr<weld::TreeIter> 
xLibRootEntry(m_xControl->make_iterator(&rIter));
             bool bLibRootEntry = FindEntry(aLibName, OBJ_TYPE_LIBRARY, 
*xLibRootEntry);
             if (bLibRootEntry)
diff --git a/basctl/source/basicide/bastype3.cxx 
b/basctl/source/basicide/bastype3.cxx
index c85fcb734878..edf4c5bae04a 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -101,8 +101,8 @@ IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, const 
weld::TreeIter&, rEntry, b
 
                 // exchange image
                 const bool bDlgMode = (nMode & BrowseMode::Dialogs) && !(nMode 
& BrowseMode::Modules);
-                auto const aImage(bDlgMode ? std::u16string_view(u"" 
RID_BMP_DLGLIB) : std::u16string_view(u"" RID_BMP_MODLIB));
-                SetEntryBitmaps(rEntry, OUString(aImage));
+                auto const aImage(bDlgMode ? OUString(RID_BMP_DLGLIB) : 
OUString(RID_BMP_MODLIB));
+                SetEntryBitmaps(rEntry, aImage);
             }
             else
             {
diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index 6c183c33035e..7786ab408de4 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1338,8 +1338,8 @@ void createLibImpl(weld::Window* pWin, const 
ScriptDocument& rDocument,
 
                 BrowseMode nMode = pBasicBox->GetMode();
                 bool bDlgMode = ( nMode & BrowseMode::Dialogs ) && !( nMode & 
BrowseMode::Modules );
-                const auto sId = bDlgMode ? std::u16string_view(u"" 
RID_BMP_DLGLIB) : std::u16string_view(u"" RID_BMP_MODLIB);
-                pBasicBox->AddEntry(aLibName, OUString(sId), xRootEntry.get(), 
false, std::make_unique<Entry>(OBJ_TYPE_LIBRARY));
+                const auto sId = bDlgMode ? OUString(RID_BMP_DLGLIB) : 
OUString(RID_BMP_MODLIB);
+                pBasicBox->AddEntry(aLibName, sId, xRootEntry.get(), false, 
std::make_unique<Entry>(OBJ_TYPE_LIBRARY));
                 pBasicBox->AddEntry(aModName, RID_BMP_MODULE, 
xRootEntry.get(), false, std::make_unique<Entry>(OBJ_TYPE_MODULE));
                 pBasicBox->set_cursor(*xRootEntry);
                 pBasicBox->select(*xRootEntry);
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index f5d367182d0a..cc53d0f11f69 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -107,7 +107,7 @@ public:
 
     virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
 
-    virtual char const* GetHid () const override;
+    virtual OString GetHid () const override;
     virtual ItemType GetType () const override;
 };
 
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index e6e306a73b5a..e150635befb7 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -233,7 +233,7 @@ public:
     void            SetName( const OUString& aName ) { m_aName = aName; }
 
     virtual void OnNewDocument ();
-    virtual char const* GetHid () const = 0;
+    virtual OString GetHid () const = 0;
     virtual ItemType GetType () const = 0;
     void InsertLibInfo () const;
     bool Is (ScriptDocument const&, std::u16string_view, std::u16string_view, 
ItemType, bool bFindSuspended);
diff --git a/basctl/source/inc/dlgeddef.hxx b/basctl/source/inc/dlgeddef.hxx
index 0cb0a6dc8573..511575a4b9ee 100644
--- a/basctl/source/inc/dlgeddef.hxx
+++ b/basctl/source/inc/dlgeddef.hxx
@@ -26,20 +26,20 @@ namespace basctl
 
 // control properties
 #define DLGED_PROP_BACKGROUNDCOLOR   "BackgroundColor"
-#define DLGED_PROP_DROPDOWN          "Dropdown"
-#define DLGED_PROP_FORMATSSUPPLIER   "FormatsSupplier"
-#define DLGED_PROP_HEIGHT            "Height"
-#define DLGED_PROP_LABEL             "Label"
-#define DLGED_PROP_NAME              "Name"
-#define DLGED_PROP_ORIENTATION       "Orientation"
-#define DLGED_PROP_POSITIONX         "PositionX"
-#define DLGED_PROP_POSITIONY         "PositionY"
-#define DLGED_PROP_STEP              "Step"
-#define DLGED_PROP_TABINDEX          "TabIndex"
+inline constexpr OUStringLiteral DLGED_PROP_DROPDOWN = u"Dropdown";
+inline constexpr OUStringLiteral DLGED_PROP_FORMATSSUPPLIER = 
u"FormatsSupplier";
+inline constexpr OUStringLiteral DLGED_PROP_HEIGHT = u"Height";
+inline constexpr OUStringLiteral DLGED_PROP_LABEL = u"Label";
+inline constexpr OUStringLiteral DLGED_PROP_NAME = u"Name";
+inline constexpr OUStringLiteral DLGED_PROP_ORIENTATION = u"Orientation";
+inline constexpr OUStringLiteral DLGED_PROP_POSITIONX = u"PositionX";
+inline constexpr OUStringLiteral DLGED_PROP_POSITIONY = u"PositionY";
+inline constexpr OUStringLiteral DLGED_PROP_STEP = u"Step";
+inline constexpr OUStringLiteral DLGED_PROP_TABINDEX = u"TabIndex";
 #define DLGED_PROP_TEXTCOLOR         "TextColor"
 #define DLGED_PROP_TEXTLINECOLOR     "TextLineColor"
-#define DLGED_PROP_WIDTH             "Width"
-#define DLGED_PROP_DECORATION        "Decoration"
+inline constexpr OUStringLiteral DLGED_PROP_WIDTH = u"Width";
+inline constexpr OUStringLiteral DLGED_PROP_DECORATION = u"Decoration";
 
 
 } // namespace basctl

Reply via email to