summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-27 11:40:59 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-28 08:07:09 +0200
commit33ecd0d5c4fff9511a8436513936a3f7044a775a (patch)
treec25809adda140ff89d9f2a2b6dfadba17e188fb0 /sfx2
parent554834484a3323f73b5aeace246bcd9635368967 (diff)
Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/SfxRedactionHelper.hxx12
-rw-r--r--sfx2/source/appl/sfxhelp.cxx4
-rw-r--r--sfx2/source/appl/workwin.cxx8
-rw-r--r--sfx2/source/bastyp/helper.cxx2
-rw-r--r--sfx2/source/control/unoctitm.cxx4
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx6
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx2
-rw-r--r--sfx2/source/doc/doctempl.cxx60
-rw-r--r--sfx2/source/doc/doctemplateslocal.cxx8
-rw-r--r--sfx2/source/doc/iframe.cxx18
-rw-r--r--sfx2/source/doc/objstor.cxx2
11 files changed, 63 insertions, 63 deletions
diff --git a/sfx2/inc/SfxRedactionHelper.hxx b/sfx2/inc/SfxRedactionHelper.hxx
index 86d563f7631d..12dfad8d88b9 100644
--- a/sfx2/inc/SfxRedactionHelper.hxx
+++ b/sfx2/inc/SfxRedactionHelper.hxx
@@ -127,16 +127,16 @@ public:
private:
static constexpr OUStringLiteral m_aPredefinedTargets[6] = {
- "\\b(?:\\d[ -]*?){13,16}\\b", //Credit card numbers
- "\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b", //Email addresses
- "\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
+ u"\\b(?:\\d[ -]*?){13,16}\\b", //Credit card numbers
+ u"\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b", //Email addresses
+ u"\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
"\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
"\\b", //IP addresses
- "([12]\\d{3}[./-](0[1-9]|1[0-2])[./"
+ u"([12]\\d{3}[./-](0[1-9]|1[0-2])[./"
"-](0[1-9]|[12]\\d|3[01]))|((0[1-9]|[12]\\d|3[01])[./-](0[1-9]|1[0-2])[./"
"-][12]\\d{3})", //Dates (numerical)
- "\\s*[a-zA-Z]{2}(?:\\s*\\d\\s*){6}[a-zA-Z]?\\s*", //National Insurance Number (UK)
- "([1-9])(?!\\1{2}-\\1{2}-\\1{4})[1-9]{2}-[1-9]{2}-[1-9]{4}" //Social Security Number (US)
+ u"\\s*[a-zA-Z]{2}(?:\\s*\\d\\s*){6}[a-zA-Z]?\\s*", //National Insurance Number (UK)
+ u"([1-9])(?!\\1{2}-\\1{2}-\\1{4})[1-9]{2}-[1-9]{2}-[1-9]{4}" //Social Security Number (US)
};
};
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 4b71403785a4..6f28580b0511 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -702,7 +702,7 @@ bool SfxHelp::Start(const OUString& rURL, weld::Widget* pWidget)
/// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org
static bool impl_showOnlineHelp( const OUString& rURL )
{
- static const OUStringLiteral aInternal("vnd.sun.star.help://");
+ static const OUStringLiteral aInternal(u"vnd.sun.star.help://");
if ( rURL.getLength() <= aInternal.getLength() || !rURL.startsWith(aInternal) )
return false;
@@ -851,7 +851,7 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
// /.../runtime/org.libreoffice.LibreOffice.Help/<arch>/<branch>/<sha>/files
// because the extension's files are stored at a different place than the app's files,
// so use this hack until flatpak itself provides a better solution:
- static constexpr auto segments = OUStringLiteral("/app/org.libreoffice.LibreOffice/");
+ static constexpr auto segments = OUStringLiteral(u"/app/org.libreoffice.LibreOffice/");
auto const i1 = path.lastIndexOf(segments);
// use lastIndexOf instead of indexOf, in case the user-controlled prefix /.../
// happens to contain such segments
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index e82c0a49d98a..63c7e106a2e3 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -127,7 +127,7 @@ const ResIdToResName pToolBarResToName[] =
// Sort the Children according their alignment
// The order corresponds to the enum SfxChildAlignment (->CHILDWIN.HXX).
-constexpr OUStringLiteral g_aLayoutManagerPropName = "LayoutManager";
+constexpr OUStringLiteral g_aLayoutManagerPropName = u"LayoutManager";
// Help to make changes to the alignment compatible!
LayoutManagerListener::LayoutManagerListener(
@@ -443,9 +443,9 @@ void SfxWorkWindow::Sort_Impl()
bSorted = true;
}
-constexpr OUStringLiteral g_aStatusBarResName( "private:resource/statusbar/statusbar" );
-constexpr OUStringLiteral g_aTbxTypeName( "private:resource/toolbar/" );
-constexpr OUStringLiteral g_aProgressBarResName( "private:resource/progressbar/progressbar" );
+constexpr OUStringLiteral g_aStatusBarResName( u"private:resource/statusbar/statusbar" );
+constexpr OUStringLiteral g_aTbxTypeName( u"private:resource/toolbar/" );
+constexpr OUStringLiteral g_aProgressBarResName( u"private:resource/progressbar/progressbar" );
// constructor for workwin of a Frame
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx
index a6bb0d05206b..7918cfcceec1 100644
--- a/sfx2/source/bastyp/helper.cxx
+++ b/sfx2/source/bastyp/helper.cxx
@@ -143,7 +143,7 @@ std::vector< OUString > SfxContentHelper::GetHelpTreeViewContents( const OUStrin
bool bFolder = xRow->getBoolean(2);
OUString aRow = aTitle + "\t" +
xContentAccess->queryContentIdentifierString() + "\t" +
- (bFolder ? OUStringLiteral("1") : OUStringLiteral("0"));
+ (bFolder ? OUStringLiteral(u"1") : OUStringLiteral(u"0"));
aProperties.push_back( aRow );
}
}
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index c3c48b5305c4..782e005a4247 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1063,7 +1063,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
}
else
{
- aBuffer.append(aEvent.IsEnabled ? OUStringLiteral("enabled") : OUStringLiteral("disabled"));
+ aBuffer.append(aEvent.IsEnabled ? OUStringLiteral(u"enabled") : OUStringLiteral(u"disabled"));
}
}
else if (aEvent.FeatureURL.Path == "Cut" ||
@@ -1160,7 +1160,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
aEvent.FeatureURL.Path == "LeaveGroup" ||
aEvent.FeatureURL.Path == "ResetAttributes")
{
- aBuffer.append(aEvent.IsEnabled ? OUStringLiteral("enabled") : OUStringLiteral("disabled"));
+ aBuffer.append(aEvent.IsEnabled ? OUStringLiteral(u"enabled") : OUStringLiteral(u"disabled"));
}
else if (aEvent.FeatureURL.Path == "AssignLayout" ||
aEvent.FeatureURL.Path == "StatusSelectionMode" ||
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index f05a33f1e2c2..1b7c1fca1b32 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -123,9 +123,9 @@ namespace
static const OUStringLiteral* GetLastFilterConfigId( FileDialogHelper::Context _eContext )
{
- static const OUStringLiteral aSD_EXPORT_IDENTIFIER("SdExportLastFilter");
- static const OUStringLiteral aSI_EXPORT_IDENTIFIER("SiExportLastFilter");
- static const OUStringLiteral aSW_EXPORT_IDENTIFIER("SwExportLastFilter");
+ static const OUStringLiteral aSD_EXPORT_IDENTIFIER(u"SdExportLastFilter");
+ static const OUStringLiteral aSI_EXPORT_IDENTIFIER(u"SiExportLastFilter");
+ static const OUStringLiteral aSW_EXPORT_IDENTIFIER(u"SwExportLastFilter");
const OUStringLiteral* pRet = nullptr;
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index a70b826b1306..38ba5b33b472 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1754,7 +1754,7 @@ SfxDocumentMetaData::loadFromStorage(
try {
xPropArg->getPropertyValue("BaseURI")
>>= input.sSystemId;
- input.sSystemId += OUStringLiteral("/") + s_meta;
+ input.sSystemId += OUStringLiteral(u"/") + s_meta;
} catch (const css::uno::Exception &) {
input.sSystemId = s_meta;
}
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index a6e88fe6a834..6e0950047007 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -460,36 +460,36 @@ OUString SfxDocumentTemplates::ConvertResourceString(const OUString& rString)
{
static const OUStringLiteral aTemplateNames[] =
{
- STR_TEMPLATE_NAME1_DEF,
- STR_TEMPLATE_NAME2_DEF,
- STR_TEMPLATE_NAME3_DEF,
- STR_TEMPLATE_NAME4_DEF,
- STR_TEMPLATE_NAME5_DEF,
- STR_TEMPLATE_NAME6_DEF,
- STR_TEMPLATE_NAME7_DEF,
- STR_TEMPLATE_NAME8_DEF,
- STR_TEMPLATE_NAME9_DEF,
- STR_TEMPLATE_NAME10_DEF,
- STR_TEMPLATE_NAME11_DEF,
- STR_TEMPLATE_NAME12_DEF,
- STR_TEMPLATE_NAME13_DEF,
- STR_TEMPLATE_NAME14_DEF,
- STR_TEMPLATE_NAME15_DEF,
- STR_TEMPLATE_NAME16_DEF,
- STR_TEMPLATE_NAME17_DEF,
- STR_TEMPLATE_NAME18_DEF,
- STR_TEMPLATE_NAME19_DEF,
- STR_TEMPLATE_NAME20_DEF,
- STR_TEMPLATE_NAME21_DEF,
- STR_TEMPLATE_NAME22_DEF,
- STR_TEMPLATE_NAME23_DEF,
- STR_TEMPLATE_NAME24_DEF,
- STR_TEMPLATE_NAME25_DEF,
- STR_TEMPLATE_NAME26_DEF,
- STR_TEMPLATE_NAME27_DEF,
- STR_TEMPLATE_NAME28_DEF,
- STR_TEMPLATE_NAME29_DEF,
- STR_TEMPLATE_NAME30_DEF
+ u"" STR_TEMPLATE_NAME1_DEF,
+ u"" STR_TEMPLATE_NAME2_DEF,
+ u"" STR_TEMPLATE_NAME3_DEF,
+ u"" STR_TEMPLATE_NAME4_DEF,
+ u"" STR_TEMPLATE_NAME5_DEF,
+ u"" STR_TEMPLATE_NAME6_DEF,
+ u"" STR_TEMPLATE_NAME7_DEF,
+ u"" STR_TEMPLATE_NAME8_DEF,
+ u"" STR_TEMPLATE_NAME9_DEF,
+ u"" STR_TEMPLATE_NAME10_DEF,
+ u"" STR_TEMPLATE_NAME11_DEF,
+ u"" STR_TEMPLATE_NAME12_DEF,
+ u"" STR_TEMPLATE_NAME13_DEF,
+ u"" STR_TEMPLATE_NAME14_DEF,
+ u"" STR_TEMPLATE_NAME15_DEF,
+ u"" STR_TEMPLATE_NAME16_DEF,
+ u"" STR_TEMPLATE_NAME17_DEF,
+ u"" STR_TEMPLATE_NAME18_DEF,
+ u"" STR_TEMPLATE_NAME19_DEF,
+ u"" STR_TEMPLATE_NAME20_DEF,
+ u"" STR_TEMPLATE_NAME21_DEF,
+ u"" STR_TEMPLATE_NAME22_DEF,
+ u"" STR_TEMPLATE_NAME23_DEF,
+ u"" STR_TEMPLATE_NAME24_DEF,
+ u"" STR_TEMPLATE_NAME25_DEF,
+ u"" STR_TEMPLATE_NAME26_DEF,
+ u"" STR_TEMPLATE_NAME27_DEF,
+ u"" STR_TEMPLATE_NAME28_DEF,
+ u"" STR_TEMPLATE_NAME29_DEF,
+ u"" STR_TEMPLATE_NAME30_DEF
};
const char* STR_TEMPLATE_NAME[] =
diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx
index 6243b913ad06..bb9b71df760a 100644
--- a/sfx2/source/doc/doctemplateslocal.cxx
+++ b/sfx2/source/doc/doctemplateslocal.cxx
@@ -34,10 +34,10 @@ namespace
{
// Relations info related strings
-const OUStringLiteral g_sGroupListElement("groupuinames:template-group-list");
-const OUStringLiteral g_sGroupElement("groupuinames:template-group");
-const OUStringLiteral g_sNameAttr("groupuinames:name");
-const OUStringLiteral g_sUINameAttr("groupuinames:default-ui-name");
+const OUStringLiteral g_sGroupListElement(u"groupuinames:template-group-list");
+const OUStringLiteral g_sGroupElement(u"groupuinames:template-group");
+const OUStringLiteral g_sNameAttr(u"groupuinames:name");
+const OUStringLiteral g_sUINameAttr(u"groupuinames:default-ui-name");
}
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index 17546c142136..e74ccc353b63 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -130,15 +130,15 @@ const SfxItemPropertyMapEntry* lcl_GetIFramePropertyMap_Impl()
{
static const SfxItemPropertyMapEntry aIFramePropertyMap_Impl[] =
{
- { "FrameIsAutoBorder", WID_FRAME_IS_AUTO_BORDER, cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameIsAutoScroll", WID_FRAME_IS_AUTO_SCROLL, cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameIsBorder", WID_FRAME_IS_BORDER, cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameIsScrollingMode", WID_FRAME_IS_SCROLLING_MODE,cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameMarginHeight", WID_FRAME_MARGIN_HEIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameMarginWidth", WID_FRAME_MARGIN_WIDTH, cppu::UnoType<sal_Int32>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameName", WID_FRAME_NAME, cppu::UnoType<OUString>::get(), PROPERTY_UNBOUND, 0 },
- { "FrameURL", WID_FRAME_URL, cppu::UnoType<OUString>::get(), PROPERTY_UNBOUND, 0 },
- { "", 0, css::uno::Type(), 0, 0 }
+ { u"FrameIsAutoBorder", WID_FRAME_IS_AUTO_BORDER, cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameIsAutoScroll", WID_FRAME_IS_AUTO_SCROLL, cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameIsBorder", WID_FRAME_IS_BORDER, cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameIsScrollingMode", WID_FRAME_IS_SCROLLING_MODE,cppu::UnoType<bool>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameMarginHeight", WID_FRAME_MARGIN_HEIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameMarginWidth", WID_FRAME_MARGIN_WIDTH, cppu::UnoType<sal_Int32>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameName", WID_FRAME_NAME, cppu::UnoType<OUString>::get(), PROPERTY_UNBOUND, 0 },
+ { u"FrameURL", WID_FRAME_URL, cppu::UnoType<OUString>::get(), PROPERTY_UNBOUND, 0 },
+ { u"", 0, css::uno::Type(), 0, 0 }
};
return aIFramePropertyMap_Impl;
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 3f3ac5d25279..83088354fad6 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1106,7 +1106,7 @@ private:
static OUString lcl_strip_template(const OUString &aString)
{
- static const OUStringLiteral sPostfix("_template");
+ static const OUStringLiteral sPostfix(u"_template");
OUString sRes(aString);
if (sRes.endsWith(sPostfix))
sRes = sRes.copy(0, sRes.getLength() - sPostfix.getLength());