[Libreoffice-commits] core.git: sfx2/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 2 11:47:25 UTC 2021
sfx2/source/appl/newhelp.cxx | 36 ++++++++++----------
sfx2/source/appl/sfxhelp.cxx | 12 +++---
sfx2/source/dialog/basedlgs.cxx | 2 -
sfx2/source/dialog/filedlghelper.cxx | 10 ++---
sfx2/source/dialog/splitwin.cxx | 2 -
sfx2/source/dialog/tabdlg.cxx | 2 -
sfx2/source/doc/autoredactdialog.cxx | 2 -
sfx2/source/doc/docinf.cxx | 4 +-
sfx2/source/doc/doctempl.cxx | 6 +--
sfx2/source/doc/doctemplates.cxx | 38 +++++++++++-----------
sfx2/source/doc/zoomitem.cxx | 6 +--
sfx2/source/notebookbar/NotebookbarTabControl.cxx | 2 -
sfx2/source/notebookbar/SfxNotebookBar.cxx | 2 -
sfx2/source/sidebar/Context.cxx | 4 +-
sfx2/source/view/viewfrm.cxx | 2 -
15 files changed, 65 insertions(+), 65 deletions(-)
New commits:
commit 914762f837cd4c1ff3a2d55284fdd631993e5e92
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 2 08:45:17 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 2 13:46:48 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: Ie80ce34d2c7d2726a04b8758903329854fdeeb07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119841
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 346699fbfa41..2f935388f068 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -109,24 +109,24 @@ using namespace ::comphelper;
// defines ---------------------------------------------------------------
-#define CONFIGNAME_HELPWIN "OfficeHelp"
-#define CONFIGNAME_INDEXWIN "OfficeHelpIndex"
-#define CONFIGNAME_SEARCHPAGE "OfficeHelpSearch"
-#define IMAGE_URL "private:factory/"
-
-#define PROPERTY_KEYWORDLIST "KeywordList"
-#define PROPERTY_KEYWORDREF "KeywordRef"
-#define PROPERTY_ANCHORREF "KeywordAnchorForRef"
-#define PROPERTY_TITLEREF "KeywordTitleForRef"
-#define PROPERTY_TITLE "Title"
-#define HELP_URL "vnd.sun.star.help://"
-#define HELP_SEARCH_TAG "/?Query="
-#define USERITEM_NAME "UserItem"
-
-#define PACKAGE_SETUP "/org.openoffice.Setup"
-#define PATH_OFFICE_FACTORIES "Office/Factories/"
-#define KEY_HELP_ON_OPEN "ooSetupFactoryHelpOnOpen"
-#define KEY_UI_NAME "ooSetupFactoryUIName"
+constexpr OUStringLiteral CONFIGNAME_HELPWIN = u"OfficeHelp";
+constexpr OUStringLiteral CONFIGNAME_INDEXWIN = u"OfficeHelpIndex";
+constexpr OUStringLiteral CONFIGNAME_SEARCHPAGE = u"OfficeHelpSearch";
+constexpr OUStringLiteral IMAGE_URL = u"private:factory/";
+
+constexpr OUStringLiteral PROPERTY_KEYWORDLIST = u"KeywordList";
+constexpr OUStringLiteral PROPERTY_KEYWORDREF = u"KeywordRef";
+constexpr OUStringLiteral PROPERTY_ANCHORREF = u"KeywordAnchorForRef";
+constexpr OUStringLiteral PROPERTY_TITLEREF = u"KeywordTitleForRef";
+constexpr OUStringLiteral PROPERTY_TITLE = u"Title";
+constexpr OUStringLiteral HELP_URL = u"vnd.sun.star.help://";
+constexpr OUStringLiteral HELP_SEARCH_TAG = u"/?Query=";
+constexpr OUStringLiteral USERITEM_NAME = u"UserItem";
+
+constexpr OUStringLiteral PACKAGE_SETUP = u"/org.openoffice.Setup";
+constexpr OUStringLiteral PATH_OFFICE_FACTORIES = u"Office/Factories/";
+constexpr OUStringLiteral KEY_HELP_ON_OPEN = u"ooSetupFactoryHelpOnOpen";
+constexpr OUStringLiteral KEY_UI_NAME = u"ooSetupFactoryUIName";
namespace sfx2
{
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 541352697fb0..10be8b1fa7ac 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -929,11 +929,11 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
// add <noscript> meta for browsers without javascript
-#define SHTML1 "<!DOCTYPE HTML><html lang=\"en-US\"><head><meta charset=\"UTF-8\">"
-#define SHTML2 "<noscript><meta http-equiv=\"refresh\" content=\"0; url='"
-#define SHTML3 "/noscript.html'\"></noscript><meta http-equiv=\"refresh\" content=\"1; url='"
-#define SHTML4 "'\"><script type=\"text/javascript\"> window.location.href = \""
-#define SHTML5 "\";</script><title>Help Page Redirection</title></head><body></body></html>"
+constexpr OUStringLiteral SHTML1 = u"<!DOCTYPE HTML><html lang=\"en-US\"><head><meta charset=\"UTF-8\">";
+constexpr OUStringLiteral SHTML2 = u"<noscript><meta http-equiv=\"refresh\" content=\"0; url='";
+constexpr OUStringLiteral SHTML3 = u"/noscript.html'\"></noscript><meta http-equiv=\"refresh\" content=\"1; url='";
+constexpr OUStringLiteral SHTML4 = u"'\"><script type=\"text/javascript\"> window.location.href = \"";
+constexpr OUStringLiteral SHTML5 = u"\";</script><title>Help Page Redirection</title></head><body></body></html>";
// use a tempfile since e.g. xdg-open doesn't support URL-parameters with file:// URLs
static bool impl_showOfflineHelp( const OUString& rURL )
@@ -962,7 +962,7 @@ static bool impl_showOfflineHelp( const OUString& rURL )
SvStream* pStream = aTempFile.GetStream(StreamMode::WRITE);
pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8);
- OUString aTempStr = SHTML1 SHTML2 +
+ OUString aTempStr = SHTML1 + SHTML2 +
aBaseInstallPath + "/" + HelpLocaleString() + SHTML3 +
aHelpLink + SHTML4 +
aHelpLink + SHTML5;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 1f10f73ce5e4..daa43f456738 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -33,7 +33,7 @@
using namespace ::com::sun::star::uno;
-#define USERITEM_NAME "UserItem"
+constexpr OUStringLiteral USERITEM_NAME = u"UserItem";
class SfxModelessDialog_Impl : public SfxListener
{
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 82abdc7321a6..8551227b3c33 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -108,9 +108,9 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::cppu;
-#define IODLG_CONFIGNAME "FilePicker_Save"
-#define IMPGRF_CONFIGNAME "FilePicker_Graph"
-#define USERITEM_NAME "UserItem"
+constexpr OUStringLiteral IODLG_CONFIGNAME = u"FilePicker_Save";
+constexpr OUStringLiteral IMPGRF_CONFIGNAME = u"FilePicker_Graph";
+constexpr OUStringLiteral USERITEM_NAME = u"UserItem";
namespace sfx2
{
@@ -1946,8 +1946,8 @@ void FileDialogHelper_Impl::addGraphicFilter()
}
}
-#define GRF_CONFIG_STR " "
-#define STD_CONFIG_STR "1 "
+constexpr OUStringLiteral GRF_CONFIG_STR = u" ";
+constexpr OUStringLiteral STD_CONFIG_STR = u"1 ";
static void SetToken( OUString& rOrigStr, sal_Int32 nToken, sal_Unicode cTok, const OUString& rStr)
{
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 2e910f8d2fb0..cb27aed0c23f 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -43,7 +43,7 @@ using namespace ::com::sun::star::uno;
#define VERSION 1
#define nPixel 30L
-#define USERITEM_NAME "UserItem"
+constexpr OUStringLiteral USERITEM_NAME = u"UserItem";
namespace {
// helper class to deactivate UpdateMode, if needed, for the life time of an instance
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 18bfd7bd18f1..985f4169add7 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -38,7 +38,7 @@
using namespace ::com::sun::star::uno;
-#define USERITEM_NAME "UserItem"
+constexpr OUStringLiteral USERITEM_NAME = u"UserItem";
struct TabPageImpl
diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx
index 0ccc622234e3..2e47a702d2f9 100644
--- a/sfx2/source/doc/autoredactdialog.cxx
+++ b/sfx2/source/doc/autoredactdialog.cxx
@@ -23,7 +23,7 @@
#include <boost/property_tree/json_parser.hpp>
-#define FILEDIALOG_FILTER_JSON "*.json"
+constexpr OUStringLiteral FILEDIALOG_FILTER_JSON = u"*.json";
int TargetsTable::GetRowByTargetName(std::u16string_view sName)
{
diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx
index f86cf5c0f8cf..949e1f19f361 100644
--- a/sfx2/source/doc/docinf.cxx
+++ b/sfx2/source/doc/docinf.cxx
@@ -37,8 +37,8 @@
// stream names
-#define STREAM_SUMMARYINFO "\005SummaryInformation"
-#define STREAM_DOCSUMMARYINFO "\005DocumentSummaryInformation"
+constexpr OUStringLiteral STREAM_SUMMARYINFO = u"\005SummaryInformation";
+constexpr OUStringLiteral STREAM_DOCSUMMARYINFO = u"\005DocumentSummaryInformation";
// usings
using namespace ::com::sun::star;
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index cea3d30f4f1d..b4de76f63a38 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -80,10 +80,10 @@ using namespace ::ucbhelper;
#include <vector>
-#define TITLE "Title"
-#define TARGET_URL "TargetURL"
+constexpr OUStringLiteral TITLE = u"Title";
+constexpr OUStringLiteral TARGET_URL = u"TargetURL";
-#define COMMAND_TRANSFER "transfer"
+constexpr OUStringLiteral COMMAND_TRANSFER = u"transfer";
namespace {
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index a56f9a36db88..f4fdb55037db 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -85,28 +85,28 @@
#include <memory>
#include <vector>
-#define SERVICENAME_TYPEDETECTION "com.sun.star.document.TypeDetection"
+constexpr OUStringLiteral SERVICENAME_TYPEDETECTION = u"com.sun.star.document.TypeDetection";
-#define TEMPLATE_ROOT_URL "vnd.sun.star.hier:/templates"
-#define TITLE "Title"
-#define IS_FOLDER "IsFolder"
-#define IS_DOCUMENT "IsDocument"
-#define TARGET_URL "TargetURL"
-#define TEMPLATE_VERSION "TemplateComponentVersion"
-#define TEMPLATE_VERSION_VALUE "2"
-#define TYPE_FOLDER "application/vnd.sun.star.hier-folder"
-#define TYPE_LINK "application/vnd.sun.star.hier-link"
-#define TYPE_FSYS_FOLDER "application/vnd.sun.staroffice.fsys-folder"
-#define TYPE_FSYS_FILE "application/vnd.sun.staroffice.fsys-file"
+constexpr OUStringLiteral TEMPLATE_ROOT_URL = u"vnd.sun.star.hier:/templates";
+constexpr OUStringLiteral TITLE = u"Title";
+constexpr OUStringLiteral IS_FOLDER = u"IsFolder";
+constexpr OUStringLiteral IS_DOCUMENT = u"IsDocument";
+constexpr OUStringLiteral TARGET_URL = u"TargetURL";
+constexpr OUStringLiteral TEMPLATE_VERSION = u"TemplateComponentVersion";
+constexpr OUStringLiteral TEMPLATE_VERSION_VALUE = u"2";
+constexpr OUStringLiteral TYPE_FOLDER = u"application/vnd.sun.star.hier-folder";
+constexpr OUStringLiteral TYPE_LINK = u"application/vnd.sun.star.hier-link";
+constexpr OUStringLiteral TYPE_FSYS_FOLDER = u"application/vnd.sun.staroffice.fsys-folder";
+constexpr OUStringLiteral TYPE_FSYS_FILE = u"application/vnd.sun.staroffice.fsys-file";
-#define PROPERTY_DIRLIST u"DirectoryList"
-#define PROPERTY_NEEDSUPDATE "NeedsUpdate"
-#define PROPERTY_TYPE "TypeDescription"
+constexpr OUStringLiteral PROPERTY_DIRLIST = u"DirectoryList";
+constexpr OUStringLiteral PROPERTY_NEEDSUPDATE = u"NeedsUpdate";
+constexpr OUStringLiteral PROPERTY_TYPE = u"TypeDescription";
-#define TARGET_DIR_URL u"TargetDirURL"
-#define COMMAND_DELETE "delete"
+constexpr OUStringLiteral TARGET_DIR_URL = u"TargetDirURL";
+constexpr OUStringLiteral COMMAND_DELETE = u"delete";
-#define STANDARD_FOLDER "standard"
+constexpr OUStringLiteral STANDARD_FOLDER = u"standard";
#define C_DELIM ';'
@@ -395,7 +395,7 @@ void SfxDocTplService_Impl::init_Impl()
// set maRootContent to the root of the templates hierarchy. Create the
// entry if necessary
- maRootURL = ( TEMPLATE_ROOT_URL "/" ) + LanguageTag::convertToBcp47(maLocale);
+ maRootURL = TEMPLATE_ROOT_URL + "/" + LanguageTag::convertToBcp47(maLocale);
const OUString aTemplVersPropName( TEMPLATE_VERSION );
const OUString aTemplVers( TEMPLATE_VERSION_VALUE );
diff --git a/sfx2/source/doc/zoomitem.cxx b/sfx2/source/doc/zoomitem.cxx
index 54855aff8a80..ff30802cc863 100644
--- a/sfx2/source/doc/zoomitem.cxx
+++ b/sfx2/source/doc/zoomitem.cxx
@@ -25,9 +25,9 @@
SfxPoolItem* SvxZoomItem::CreateDefault() { return new SvxZoomItem; }
-#define ZOOM_PARAM_VALUE "Value"
-#define ZOOM_PARAM_VALUESET "ValueSet"
-#define ZOOM_PARAM_TYPE "Type"
+constexpr OUStringLiteral ZOOM_PARAM_VALUE = u"Value";
+constexpr OUStringLiteral ZOOM_PARAM_VALUESET = u"ValueSet";
+constexpr OUStringLiteral ZOOM_PARAM_TYPE = u"Type";
#define ZOOM_PARAMS 3
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 485b7f8da3a6..b4c98cba61d5 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -37,7 +37,7 @@
#include <cppuhelper/implbase.hxx>
#define ICON_SIZE 25
-#define TOOLBAR_STR "private:resource/toolbar/notebookbarshortcuts"
+constexpr OUStringLiteral TOOLBAR_STR = u"private:resource/toolbar/notebookbarshortcuts";
using namespace css::uno;
using namespace css::ui;
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index ce7c416a8c39..1589e417bd69 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -36,7 +36,7 @@ using namespace css::uno;
using namespace css::ui;
using namespace css;
-#define MENUBAR_STR "private:resource/menubar/menubar"
+constexpr OUStringLiteral MENUBAR_STR = u"private:resource/menubar/menubar";
const char MERGE_NOTEBOOKBAR_URL[] = "URL";
diff --git a/sfx2/source/sidebar/Context.cxx b/sfx2/source/sidebar/Context.cxx
index b2bfd68a3791..8a254ebbe2f7 100644
--- a/sfx2/source/sidebar/Context.cxx
+++ b/sfx2/source/sidebar/Context.cxx
@@ -19,8 +19,8 @@
#include <sfx2/sidebar/Context.hxx>
-#define AnyApplicationName "any"
-#define AnyContextName "any"
+constexpr OUStringLiteral AnyApplicationName = u"any";
+constexpr OUStringLiteral AnyContextName = u"any";
namespace sfx2::sidebar {
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 1809c9c136cc..628b436dc81e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -142,7 +142,7 @@ using ::com::sun::star::container::XIndexContainer;
#include <sfxslots.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
-#define CHANGES_STR "private:resource/toolbar/changes"
+constexpr OUStringLiteral CHANGES_STR = u"private:resource/toolbar/changes";
SFX_IMPL_SUPERCLASS_INTERFACE(SfxViewFrame,SfxShell)
More information about the Libreoffice-commits
mailing list