[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 2 08:21:30 UTC 2021
sw/source/core/doc/docbm.cxx | 2 +-
sw/source/core/doc/tblafmt.cxx | 4 ++--
sw/source/core/edit/edfcol.cxx | 2 +-
sw/source/core/unocore/unofield.cxx | 4 ++--
sw/source/filter/docx/swdocxreader.cxx | 4 ++--
sw/source/filter/ww8/docxattributeoutput.cxx | 6 +++---
sw/source/filter/ww8/wrtww8.cxx | 2 +-
sw/source/uibase/config/uinums.cxx | 4 ++--
sw/source/uibase/envelp/envimg.cxx | 4 ++--
sw/source/uibase/shells/grfsh.cxx | 2 +-
sw/source/uibase/sidebar/PageMarginControl.cxx | 10 +++++-----
sw/source/uibase/uno/SwXFilterOptions.cxx | 2 +-
12 files changed, 23 insertions(+), 23 deletions(-)
New commits:
commit 5f74a9c6b50b5689996ff93c95701eb4fc45b50f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 2 08:45:26 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 2 10:20:55 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: I140932a94914d3870f0d92e11a6ada2b42359e30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119842
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 825785fa9caa..ae3c2784ba5d 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -49,7 +49,7 @@
#include <libxml/xmlwriter.h>
#include <comphelper/lok.hxx>
-#define S_ANNOTATION_BOOKMARK u"____"
+constexpr OUStringLiteral S_ANNOTATION_BOOKMARK = u"____";
using namespace ::sw::mark;
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index ec1e7b9ff993..4a624c61cb63 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -97,7 +97,7 @@ const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50;
SwBoxAutoFormat* SwTableAutoFormat::s_pDefaultBoxAutoFormat = nullptr;
-#define AUTOTABLE_FORMAT_NAME "autotbl.fmt"
+constexpr OUStringLiteral AUTOTABLE_FORMAT_NAME = u"autotbl.fmt";
namespace
{
@@ -1044,7 +1044,7 @@ bool SwTableAutoFormatTable::Save() const
if (utl::ConfigManager::IsFuzzing())
return false;
SvtPathOptions aPathOpt;
- const OUString sNm( aPathOpt.GetUserConfigPath() + "/" AUTOTABLE_FORMAT_NAME );
+ const OUString sNm( aPathOpt.GetUserConfigPath() + "/" + AUTOTABLE_FORMAT_NAME );
SfxMedium aStream(sNm, StreamMode::STD_WRITE );
return Save( *aStream.GetOutStream() ) && aStream.Commit();
}
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 961c5062a5f3..6dcc594958b0 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -98,7 +98,7 @@
#include <SwStyleNameMapper.hxx>
#include <comphelper/lok.hxx>
-#define WATERMARK_NAME "PowerPlusWaterMarkObject"
+constexpr OUStringLiteral WATERMARK_NAME = u"PowerPlusWaterMarkObject";
#define WATERMARK_AUTO_SIZE sal_uInt32(1)
namespace
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 796ed4bf4576..425258b6741a 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -90,7 +90,7 @@ using namespace ::com::sun::star;
using namespace nsSwDocInfoSubType;
// case-corrected version of the first part for the service names (see #i67811)
-#define COM_TEXT_FLDMASTER_CC "com.sun.star.text.fieldmaster."
+constexpr OUStringLiteral COM_TEXT_FLDMASTER_CC = u"com.sun.star.text.fieldmaster.";
// note: this thing is indexed as an array, so do not insert/remove entries!
const sal_uInt16 aDocInfoSubTypeFromService[] =
@@ -2687,7 +2687,7 @@ SwXTextFieldMasters::~SwXTextFieldMasters()
static SwFieldIds lcl_GetIdByName( OUString& rName, OUString& rTypeName )
{
if (rName.startsWithIgnoreAsciiCase(COM_TEXT_FLDMASTER_CC))
- rName = rName.copy(RTL_CONSTASCII_LENGTH(COM_TEXT_FLDMASTER_CC));
+ rName = rName.copy(COM_TEXT_FLDMASTER_CC.getLength());
SwFieldIds nResId = SwFieldIds::Unknown;
sal_Int32 nIdx = 0;
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
index 790f91f0d344..06ac581de29c 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -36,7 +36,7 @@
#include <sfx2/docfile.hxx>
#include <tools/diagnose_ex.h>
-#define AUTOTEXT_GALLERY "autoTxt"
+constexpr OUStringLiteral AUTOTEXT_GALLERY = u"autoTxt";
using namespace css;
@@ -173,7 +173,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks )
// is AutoText?
bIsAutoText = aLNm.startsWith(AUTOTEXT_GALLERY);
- aLNm = aLNm.copy(strlen(AUTOTEXT_GALLERY) + 1);
+ aLNm = aLNm.copy(AUTOTEXT_GALLERY.getLength() + 1);
}
// Do not copy name
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5f325eaec6c9..9bed3f18b726 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7838,9 +7838,9 @@ void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink )
m_pSerializer->singleElementNS(XML_w, XML_effect, FSNS(XML_w, XML_val), "none");
}
-#define MSWORD_CH_SHADING_FILL "FFFFFF" // The attribute w:fill of w:shd, for MS-Word's character shading,
-#define MSWORD_CH_SHADING_COLOR "auto" // The attribute w:color of w:shd, for MS-Word's character shading,
-#define MSWORD_CH_SHADING_VAL "pct15" // The attribute w:value of w:shd, for MS-Word's character shading,
+constexpr OUStringLiteral MSWORD_CH_SHADING_FILL = u"FFFFFF"; // The attribute w:fill of w:shd, for MS-Word's character shading,
+constexpr OUStringLiteral MSWORD_CH_SHADING_COLOR = u"auto"; // The attribute w:color of w:shd, for MS-Word's character shading,
+constexpr OUStringLiteral MSWORD_CH_SHADING_VAL = u"pct15"; // The attribute w:value of w:shd, for MS-Word's character shading,
void DocxAttributeOutput::CharBackground( const SvxBrushItem& rBrush )
{
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 3114bf29c532..85605cadc510 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -446,7 +446,7 @@ void WW8_WrtFactoids::Write(WW8Export& rExport)
// Names of the storage streams
constexpr OUStringLiteral sMainStream = u"WordDocument";
-#define sCompObj "\1CompObj"
+constexpr OUStringLiteral sCompObj = u"\1CompObj";
static void WriteDop( WW8Export& rWrt )
{
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index 29b8a1f9a2c3..b1fbc22a6884 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -32,7 +32,7 @@
using namespace ::com::sun::star;
-#define CHAPTER_FILENAME "chapter.cfg"
+constexpr OUStringLiteral CHAPTER_FILENAME = u"chapter.cfg";
/*
Description: Saving a rule
@@ -52,7 +52,7 @@ void SwChapterNumRules::Save()
SvtPathOptions aPathOpt;
aURL.SetSmartURL( aPathOpt.GetUserConfigPath() );
aURL.setFinalSlash();
- aURL.Append(u"" CHAPTER_FILENAME);
+ aURL.Append(CHAPTER_FILENAME);
SfxMedium aMedium( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE );
SvStream* pStream = aMedium.GetOutStream();
diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx
index 7b44590d0b01..e1db006171dc 100644
--- a/sw/source/uibase/envelp/envimg.cxx
+++ b/sw/source/uibase/envelp/envimg.cxx
@@ -34,9 +34,9 @@
#include <unomid.h>
#ifdef _WIN32
-#define NEXTLINE "\r\n"
+constexpr OUStringLiteral NEXTLINE = u"\r\n";
#else
-#define NEXTLINE "\n"
+constexpr OUStringLiteral NEXTLINE = u"\n";
#endif
using namespace utl;
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 0bb9632f237d..a93432251a47 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -65,7 +65,7 @@
#include <unocrsr.hxx>
#include <memory>
-#define TOOLBOX_NAME u"colorbar"
+constexpr OUStringLiteral TOOLBOX_NAME = u"colorbar";
class SwGrfShell::SwExternalToolEdit
: public ExternalToolEdit
diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 19da13693b6a..0beedfe2a428 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -43,11 +43,11 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/frame/XFrame.hpp>
-#define SWPAGE_LEFT_GVALUE "Sw_Page_Left"
-#define SWPAGE_RIGHT_GVALUE "Sw_Page_Right"
-#define SWPAGE_TOP_GVALUE "Sw_Page_Top"
-#define SWPAGE_DOWN_GVALUE "Sw_Page_Down"
-#define SWPAGE_MIRROR_GVALUE "Sw_Page_Mirrored"
+constexpr OUStringLiteral SWPAGE_LEFT_GVALUE = u"Sw_Page_Left";
+constexpr OUStringLiteral SWPAGE_RIGHT_GVALUE = u"Sw_Page_Right";
+constexpr OUStringLiteral SWPAGE_TOP_GVALUE = u"Sw_Page_Top";
+constexpr OUStringLiteral SWPAGE_DOWN_GVALUE = u"Sw_Page_Down";
+constexpr OUStringLiteral SWPAGE_MIRROR_GVALUE = u"Sw_Page_Mirrored";
namespace
{
diff --git a/sw/source/uibase/uno/SwXFilterOptions.cxx b/sw/source/uibase/uno/SwXFilterOptions.cxx
index b36472bf54e1..d4092067fcff 100644
--- a/sw/source/uibase/uno/SwXFilterOptions.cxx
+++ b/sw/source/uibase/uno/SwXFilterOptions.cxx
@@ -36,7 +36,7 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::lang;
-#define FILTER_OPTIONS_NAME "FilterOptions"
+constexpr OUStringLiteral FILTER_OPTIONS_NAME = u"FilterOptions";
SwXFilterOptions::SwXFilterOptions()
{
More information about the Libreoffice-commits
mailing list