summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-23 12:34:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-26 13:12:31 +0200
commit0193b284e880a659ab73160e42238e1d5fe5cf8f (patch)
treeda09299838a6afb43d7c601803a6bab787489854 /sw
parent2ef138de767c312188d41a7f206234eafac3108b (diff)
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/txtnode/justify.cxx12
-rw-r--r--sw/qa/core/uwriter.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx4
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx2
-rw-r--r--sw/qa/extras/uiwriter/uiwriter6.cxx2
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx12
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/docfld.cxx4
-rw-r--r--sw/source/core/doc/doclay.cxx2
-rw-r--r--sw/source/core/edit/edfcol.cxx2
-rw-r--r--sw/source/core/unocore/unodraw.cxx8
-rw-r--r--sw/source/core/view/printdata.cxx4
-rw-r--r--sw/source/filter/html/swhtml.cxx4
-rw-r--r--sw/source/filter/html/wrthtml.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx2
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx2
-rw-r--r--sw/source/filter/xml/swxml.cxx12
-rw-r--r--sw/source/filter/xml/xmlexp.cxx4
-rw-r--r--sw/source/filter/xml/xmlimp.cxx10
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx2
-rw-r--r--sw/source/ui/misc/glosbib.cxx2
-rw-r--r--sw/source/ui/misc/glossary.cxx2
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.cxx2
-rw-r--r--sw/source/uibase/app/docstyle.cxx2
-rw-r--r--sw/source/uibase/shells/langhelper.cxx6
-rw-r--r--sw/source/uibase/shells/textsh1.cxx14
-rw-r--r--sw/source/uibase/uno/unomailmerge.cxx2
27 files changed, 62 insertions, 62 deletions
diff --git a/sw/qa/core/txtnode/justify.cxx b/sw/qa/core/txtnode/justify.cxx
index 6a8afd2b52ef..f8f178543a1f 100644
--- a/sw/qa/core/txtnode/justify.cxx
+++ b/sw/qa/core/txtnode/justify.cxx
@@ -77,7 +77,7 @@ template <typename Function> void CharWidthArray::InvokeWithKernArray(Function f
CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionHalfSpace)
{
// Related to: tdf#149017
- static const OUStringLiteral aText = u"ne del pro";
+ static constexpr OUStringLiteral aText = u"ne del pro";
CharWidthArray aActual{ 720, 639, 360, 720, 639, 400, 360, 720, 480, 720 };
CharWidthArray aExpected{ 720, 851, 573, 720, 639, 612, 573, 720, 480, 720 };
@@ -89,7 +89,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionHalfSpace)
CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionNoHalfSpace)
{
// Related to: tdf#149017
- static const OUStringLiteral aText = u"ne del pro";
+ static constexpr OUStringLiteral aText = u"ne del pro";
CharWidthArray aActual{ 720, 639, 360, 720, 639, 400, 360, 720, 480, 720 };
CharWidthArray aExpected{ 720, 639, 785, 720, 639, 400, 785, 720, 480, 720 };
@@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionNoHalfSpace)
CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionUnicodeIVS)
{
// Related to: tdf#148594
- static const OUStringLiteral aText
+ static constexpr OUStringLiteral aText
= u"\u9B54\u9AD8\u4E00\U000E01E1\u4E08\u4F55\u9B54\u9AD8\u4E00\U000E01E1";
CharWidthArray aActual{ 1600, 1600, 1600, 0, 0, 1600, 1600, 1600, 1600, 1600, 0, 0 };
CharWidthArray aExpected{ 1800, 1800, 1800, 0, 0, 1800, 1800, 1800, 1800, 1800, 0, 0 };
@@ -114,7 +114,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGrid)
{
tools::Long nDelta = 0;
// "曰〈道高一尺化太平〉云云"
- static const OUStringLiteral aText
+ static constexpr OUStringLiteral aText
= u"\u66f0\u3008\u9053\u9ad8\u4e00\u5c3a\u5316\u592a\u5e73\u3009\u4e91\u4e91";
CharWidthArray aActual{ 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, 880 };
CharWidthArray aExpected{
@@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridMixWidth)
// Related to: tdf#149365
tools::Long nDelta = 0;
// "中中中ケコサシスセソカケコ" ( mixing fullwidth ideograph and half-width kana )
- static const OUStringLiteral aText
+ static constexpr OUStringLiteral aText
= u"\u4e2d\u4e2d\u4e2d\uff79\uff7a\uff7b\uff7c\uff7d\uff7e\uff7f\uff76\uff79\uff7a";
CharWidthArray aActual{ 640, 640, 640, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320 };
CharWidthArray aExpected{ 800, 800, 760, 400, 400, 400, 400, 400, 400, 400, 400, 400, 360 };
@@ -145,7 +145,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridIVS)
{
// Related to: tdf#149214
tools::Long nDelta = 0;
- static const OUStringLiteral aText = u"\u9053\u9ad8\u4e00\U000E01E2\u5c3a\u5316";
+ static constexpr OUStringLiteral aText = u"\u9053\u9ad8\u4e00\U000E01E2\u5c3a\u5316";
CharWidthArray aActual{ 800, 800, 800, 0, 0, 800, 800 };
CharWidthArray aExpected{ 800, 800, 800, 0, 0, 800, 800 };
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 7eea1b230e06..6875d63073d7 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1818,7 +1818,7 @@ void SwDocTest::test64kPageDescs()
CPPUNIT_ASSERT_EQUAL( OUString("Page65535"), rDesc.GetName() );
SwPageDesc aDesc( rDesc );
- static const OUStringLiteral aChanged(u"Changed01");
+ static constexpr OUStringLiteral aChanged(u"Changed01");
aDesc.SetName( aChanged );
m_pDoc->ChgPageDesc( nPageDescCount, aDesc );
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index aa1433f07ac0..a9742f1a3736 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -705,8 +705,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf38778)
loadAndSave("tdf38778_properties_in_run_for_field.doc");
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
- static const OUStringLiteral psz(u"20");
- static const OUStringLiteral pszCs(u"20");
+ static constexpr OUStringLiteral psz(u"20");
+ static constexpr OUStringLiteral pszCs(u"20");
// w:fldCharType="begin"
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:sz", "val", psz);
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 95e526f9c3a6..6b2b2243c3b8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1702,7 +1702,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf87533_bidi)
{
createSwDoc("tdf87533_bidi.docx");
// "w:bidi" (specified inside Default paragraph properties) should not be ignored
- static const OUStringLiteral writingMode = u"WritingMode"; //getPropertyName(PROP_WRITING_MODE);
+ static constexpr OUStringLiteral writingMode = u"WritingMode"; //getPropertyName(PROP_WRITING_MODE);
// check: "Default Style" master-style has RTL
{
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 78b5e9ac5ec1..dec2f5708470 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1566,7 +1566,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535)
SfxViewShell* pViewShell = SfxViewShell::Current();
{
- static const OUStringLiteral sApplyRule(u"Spelling_Baaed");
+ static constexpr OUStringLiteral sApplyRule(u"Spelling_Baaed");
SfxStringItem aApplyItem(FN_PARAM_1, sApplyRule);
pViewShell->GetViewFrame().GetDispatcher()->ExecuteList(
SID_SPELLCHECK_APPLY_SUGGESTION, SfxCallMode::SYNCHRON, { &aApplyItem });
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 61b9b524b399..429a8d4e0498 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -314,11 +314,11 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testXAutoTextGroup)
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
- static const OUStringLiteral sGroupName = u"TestGroup*1";
- static const OUStringLiteral sTextName = u"TEST";
- static const OUStringLiteral sTextNameNew = u"TESTRENAMED";
- static const OUStringLiteral sTextTitle = u"Test Auto Text";
- static const OUStringLiteral sTextTitleNew = u"Test Auto Text Renamed";
+ static constexpr OUStringLiteral sGroupName = u"TestGroup*1";
+ static constexpr OUStringLiteral sTextName = u"TEST";
+ static constexpr OUStringLiteral sTextNameNew = u"TESTRENAMED";
+ static constexpr OUStringLiteral sTextTitle = u"Test Auto Text";
+ static constexpr OUStringLiteral sTextTitleNew = u"Test Auto Text Renamed";
// Create new temporary group
uno::Reference<text::XAutoTextGroup> xAutoTextGroup
@@ -1187,7 +1187,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841)
// Get SwXCellRange for the same cell
css::uno::Reference<css::beans::XPropertySet> xCellRange(
xTableCellRange->getCellRangeByName("A1:A1"), css::uno::UNO_QUERY_THROW);
- static const OUStringLiteral sBackColor = u"BackColor";
+ static constexpr OUStringLiteral sBackColor = u"BackColor";
// Apply background color to table cursor, and read background color from cell range
css::uno::Any aRefColor(sal_Int32(0x00FF0000));
xTableCursor->setPropertyValue(sBackColor, aRefColor);
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 470a018eb0ef..1387ebfe65a9 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1122,7 +1122,7 @@ namespace
if( bRegExpRplc )
{
sal_Int32 nPos = 0;
- static const OUStringLiteral sPara(u"\\n");
+ static constexpr OUStringLiteral sPara(u"\\n");
for (;;)
{
nPos = rStr.indexOf( sPara, nPos );
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index b6e8f7267d33..01bcc1cd8483 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -934,8 +934,8 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode )
}
}
- static const OUStringLiteral sTrue(u"TRUE");
- static const OUStringLiteral sFalse(u"FALSE");
+ static constexpr OUStringLiteral sTrue(u"TRUE");
+ static constexpr OUStringLiteral sFalse(u"FALSE");
#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
bool bIsDBManager = nullptr != rDoc.GetDBManager();
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 02029856a09e..48e77a284d77 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -126,7 +126,7 @@ rtl::Reference<SdrObject> SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveW
uno::Reference< awt::XControlModel > xModel = static_cast<SdrUnoObj*>(pObj.get())->GetUnoControlModel();
uno::Any aVal;
uno::Reference< beans::XPropertySet > xSet(xModel, uno::UNO_QUERY);
- static const OUStringLiteral sName(u"Name");
+ static constexpr OUStringLiteral sName(u"Name");
if( xSet.is() )
aVal = xSet->getPropertyValue( sName );
if( bInsInPage )
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 1be771b89174..2d7f1e4f5884 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1322,7 +1322,7 @@ static std::vector<svx::ClassificationResult> lcl_CollectParagraphClassification
uno::Reference<text::XTextRange> xTextRange(xField, uno::UNO_QUERY);
const OUString aName = rdfNamePair.first;
const OUString aValue = rdfNamePair.second;
- static const OUStringLiteral sBlank(u"");
+ static constexpr OUStringLiteral sBlank(u"");
if (aKeyCreator.isMarkingTextKey(aName))
{
aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank });
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index cda4850d8671..422b1236c489 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -2592,7 +2592,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition )
if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER )
{
// determine current x-position
- static const OUStringLiteral aHoriPosPropStr(u"HoriOrientPosition");
+ static constexpr OUStringLiteral aHoriPosPropStr(u"HoriOrientPosition");
uno::Any aHoriPos( getPropertyValue( aHoriPosPropStr ) );
sal_Int32 dCurrX = 0;
aHoriPos >>= dCurrX;
@@ -2601,7 +2601,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition )
{
// adjust x-position orientation to text::HoriOrientation::NONE, if needed
// Note: has to be done before setting x-position attribute
- static const OUStringLiteral aHoriOrientPropStr(u"HoriOrient");
+ static constexpr OUStringLiteral aHoriOrientPropStr(u"HoriOrient");
uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) );
sal_Int16 eHoriOrient;
if (aHoriOrient >>= eHoriOrient) // may be void
@@ -2622,7 +2622,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition )
// handle y-position
{
// determine current y-position
- static const OUStringLiteral aVertPosPropStr(u"VertOrientPosition");
+ static constexpr OUStringLiteral aVertPosPropStr(u"VertOrientPosition");
uno::Any aVertPos( getPropertyValue( aVertPosPropStr ) );
sal_Int32 dCurrY = 0;
aVertPos >>= dCurrY;
@@ -2631,7 +2631,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition )
{
// adjust y-position orientation to text::VertOrientation::NONE, if needed
// Note: has to be done before setting y-position attribute
- static const OUStringLiteral aVertOrientPropStr(u"VertOrient");
+ static constexpr OUStringLiteral aVertOrientPropStr(u"VertOrient");
uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) );
sal_Int16 eVertOrient;
if (aVertOrient >>= eVertOrient) // may be void
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index a52473a6b8e8..62a2780f9c58 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -273,7 +273,7 @@ SwPrintUIOptions::SwPrintUIOptions(
aPrintRangeOpt );
// create a choice for the content to create
- static const OUStringLiteral aPrintRangeName( u"PrintContent" );
+ static constexpr OUStringLiteral aPrintRangeName( u"PrintContent" );
uno::Sequence< OUString > aChoices{ SwResId( STR_PRINTOPTUI_PRINTALLPAGES ),
SwResId( STR_PRINTOPTUI_PRINTPAGES ),
SwResId( STR_PRINTOPTUI_PRINTSELECTION ) };
@@ -332,7 +332,7 @@ SwPrintUIOptions::SwPrintUIOptions(
// create a bool option for brochure
bDefaultVal = rDefaultPrintData.IsPrintProspect();
- static const OUStringLiteral aBrochurePropertyName( u"PrintProspect" );
+ static constexpr OUStringLiteral aBrochurePropertyName( u"PrintProspect" );
m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("brochure", SwResId( STR_PRINTOPTUI_BROCHURE),
".HelpID:vcl:PrintDialog:PrintProspect:CheckBox",
aBrochurePropertyName,
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index e32eb6e85ce3..7c4532bf7015 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -169,7 +169,7 @@ OUString HTMLReader::GetTemplateName(SwDoc& rDoc) const
// HTML import into Writer, avoid loading the Writer/Web template.
return OUString();
- static const OUStringLiteral sTemplateWithoutExt(u"internal/html");
+ static constexpr OUStringLiteral sTemplateWithoutExt(u"internal/html");
SvtPathOptions aPathOpt;
// first search for OpenDocument Writer/Web template
@@ -5605,7 +5605,7 @@ void HTMLReader::SetupFilterOptions()
return;
OUString aFilterOptions = pItem->GetValue();
- static const OUStringLiteral aXhtmlNsKey(u"xhtmlns=");
+ static constexpr OUStringLiteral aXhtmlNsKey(u"xhtmlns=");
if (aFilterOptions.startsWith(aXhtmlNsKey))
{
OUString aNamespace = aFilterOptions.copy(aXhtmlNsKey.getLength());
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 9cbbdd5d9d4a..1c9d68a15fd5 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -237,7 +237,7 @@ void SwHTMLWriter::SetupFilterOptions(std::u16string_view rFilterOptions)
const uno::Sequence<OUString> aOptionSeq
= comphelper::string::convertCommaSeparated(rFilterOptions);
- static const OUStringLiteral aXhtmlNsKey(u"xhtmlns=");
+ static constexpr OUStringLiteral aXhtmlNsKey(u"xhtmlns=");
for (const auto& rOption : aOptionSeq)
{
if (rOption == "XHTML")
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index a5f1d6892fbb..894b76f94891 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2295,7 +2295,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr )
}
OUString sURL = "#" + sBookmarkName;
SwFormatINetFormat aURL( sURL, "" );
- static const OUStringLiteral sLinkStyle(u"Index Link");
+ static constexpr OUStringLiteral sLinkStyle(u"Index Link");
const sal_uInt16 nPoolId =
SwStyleNameMapper::GetPoolIdFromUIName( sLinkStyle, SwGetPoolIdFromName::ChrFmt );
aURL.SetVisitedFormatAndId( sLinkStyle, nPoolId);
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index f8a271825d39..09d34d2b893b 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -265,7 +265,7 @@ bool Customization::ImportMenu( SwCTBWrapper& rWrapper, CustomToolBarImportHelpe
if ( pCust )
{
// currently only support built-in menu
- static const OUStringLiteral sMenuBar( u"private:resource/menubar/menubar" );
+ static constexpr OUStringLiteral sMenuBar( u"private:resource/menubar/menubar" );
// Get menu name
SwTBC* pTBC = m_pWrapper->GetTBCAtOffset( rTBDelta.TBCStreamOffset() );
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index b679f111a3b6..d6496e779299 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -604,7 +604,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
if( xParentSet.is() )
{
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() );
- static const OUStringLiteral sPropName(u"BuildId" );
+ static constexpr OUStringLiteral sPropName(u"BuildId" );
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(sPropName) )
{
xInfoSet->setPropertyValue( sPropName, xParentSet->getPropertyValue(sPropName) );
@@ -742,9 +742,9 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
ErrCode nRet = ERRCODE_NONE;
// save redline mode into import info property set
- static const OUStringLiteral sShowChanges(u"ShowChanges");
- static const OUStringLiteral sRecordChanges(u"RecordChanges");
- static const OUStringLiteral sRedlineProtectionKey(u"RedlineProtectionKey");
+ static constexpr OUStringLiteral sShowChanges(u"ShowChanges");
+ static constexpr OUStringLiteral sRecordChanges(u"RecordChanges");
+ static constexpr OUStringLiteral sRedlineProtectionKey(u"RedlineProtectionKey");
xInfoSet->setPropertyValue( sShowChanges,
Any(IDocumentRedlineAccess::IsShowChanges(rDoc.getIDocumentRedlineAccess().GetRedlineFlags())) );
xInfoSet->setPropertyValue( sRecordChanges,
@@ -950,7 +950,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
if( xModelSet.is() )
{
uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() );
- static const OUStringLiteral sName(u"BuildId" );
+ static constexpr OUStringLiteral sName(u"BuildId" );
if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sName) )
{
xModelSet->setPropertyValue( sName, xInfoSet->getPropertyValue(sName) );
@@ -983,7 +983,7 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium,
try
{
xml::sax::InputSource aParserInput;
- static const OUStringLiteral sDocName( u"content.xml" );
+ static constexpr OUStringLiteral sDocName( u"content.xml" );
aParserInput.sSystemId = sDocName;
uno::Reference < io::XStream > xStm = xStg2->openStreamElement( sDocName, embed::ElementModes::READ );
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 693c2b7c6b7b..689206c9e92d 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -107,7 +107,7 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
Reference<XPropertySet> rInfoSet = getExportInfo();
if( rInfoSet.is() )
{
- static const OUStringLiteral sAutoTextMode(u"AutoTextMode");
+ static constexpr OUStringLiteral sAutoTextMode(u"AutoTextMode");
if( rInfoSet->getPropertySetInfo()->hasPropertyByName(
sAutoTextMode ) )
{
@@ -369,7 +369,7 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
Reference<XPropertySet> xInfoSet( getExportInfo() );
if ( xInfoSet.is() )
{
- static const OUStringLiteral sShowChanges( u"ShowChanges" );
+ static constexpr OUStringLiteral sShowChanges( u"ShowChanges" );
if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) )
{
bShowRedlineChanges = *o3tl::doAccess<bool>(xInfoSet->
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 43fe07ecff4a..4287a6848f4c 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -417,7 +417,7 @@ void SwXMLImport::startDocument()
}
bool bOverwrite = false;
- static const OUStringLiteral sStyleInsertModeOverwrite(u"StyleInsertModeOverwrite");
+ static constexpr OUStringLiteral sStyleInsertModeOverwrite(u"StyleInsertModeOverwrite");
if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeOverwrite) )
{
aAny = xImportInfo->getPropertyValue(sStyleInsertModeOverwrite);
@@ -433,7 +433,7 @@ void SwXMLImport::startDocument()
}
// text insert mode?
- static const OUStringLiteral sTextInsertModeRange(u"TextInsertModeRange");
+ static constexpr OUStringLiteral sTextInsertModeRange(u"TextInsertModeRange");
if( xPropertySetInfo->hasPropertyByName(sTextInsertModeRange) )
{
aAny = xImportInfo->getPropertyValue(sTextInsertModeRange);
@@ -443,7 +443,7 @@ void SwXMLImport::startDocument()
}
// auto text mode
- static const OUStringLiteral sAutoTextMode(u"AutoTextMode");
+ static constexpr OUStringLiteral sAutoTextMode(u"AutoTextMode");
if( xPropertySetInfo->hasPropertyByName(sAutoTextMode) )
{
aAny = xImportInfo->getPropertyValue(sAutoTextMode);
@@ -455,7 +455,7 @@ void SwXMLImport::startDocument()
}
// organizer mode
- static const OUStringLiteral sOrganizerMode(u"OrganizerMode");
+ static constexpr OUStringLiteral sOrganizerMode(u"OrganizerMode");
if( xPropertySetInfo->hasPropertyByName(sOrganizerMode) )
{
aAny = xImportInfo->getPropertyValue(sOrganizerMode);
@@ -467,7 +467,7 @@ void SwXMLImport::startDocument()
}
// default document properties
- static const OUStringLiteral sDefSettings(u"DefaultDocumentSettings");
+ static constexpr OUStringLiteral sDefSettings(u"DefaultDocumentSettings");
if (xPropertySetInfo->hasPropertyByName(sDefSettings))
{
aAny = xImportInfo->getPropertyValue(sDefSettings);
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index f596caca73e5..eb45452c2245 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -315,7 +315,7 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
+ OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG))
+ ":default_first");
uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
- static const OUStringLiteral sName(u"Name");
+ static constexpr OUStringLiteral sName(u"Name");
sal_Int32 nODT = -1;
while(xList->hasMoreElements()) {
comphelper::SequenceAsHashMap aFilter(xList->nextElement());
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 202a6222089c..ed74973a1b84 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -90,7 +90,7 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(weld::Window * pParent,
const size_t nCount = pHdl->GetGroupCnt();
/* tdf#111870 "My AutoText" comes from mytexts.bau but should be translated
here as well, see also SwGlossaryDlg::Init */
- static const OUStringLiteral sMyAutoTextEnglish(u"My AutoText");
+ static constexpr OUStringLiteral sMyAutoTextEnglish(u"My AutoText");
for( size_t i = 0; i < nCount; ++i)
{
OUString sTitle;
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 12145f1e74ed..c7183d5126e1 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -807,7 +807,7 @@ void SwGlossaryDlg::Init()
const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM));
const sal_Int32 nSelPath = o3tl::toInt32(o3tl::getToken(::GetCurrGlosGroup(), 1, GLOS_DELIM));
// #i66304# - "My AutoText" comes from mytexts.bau, but should be translated
- static const OUStringLiteral sMyAutoTextEnglish(u"My AutoText");
+ static constexpr OUStringLiteral sMyAutoTextEnglish(u"My AutoText");
const OUString sMyAutoTextTranslated(SwResId(STR_MY_AUTOTEXT));
for(size_t nId = 0; nId < nCnt; ++nId )
{
diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx
index c70478171cb2..1e08c8f1246a 100644
--- a/sw/source/ui/vba/vbaparagraphformat.cxx
+++ b/sw/source/ui/vba/vbaparagraphformat.cxx
@@ -184,7 +184,7 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel()
{
sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText;
OUString aHeading;
- static const OUStringLiteral HEADING = u"Heading";
+ static constexpr OUStringLiteral HEADING = u"Heading";
mxParaProps->getPropertyValue("ParaStyleName") >>= aHeading;
if( aHeading.startsWith( HEADING ) )
{
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index c78966a762e6..fe6835f9d8d4 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -985,7 +985,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit)
{
IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
- static const OUStringLiteral sPlus(u" + ");
+ static constexpr OUStringLiteral sPlus(u" + ");
if ( SfxStyleFamily::Page == nFamily )
{
if( !pSet )
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index 219b02cbca70..e97d1bdcbef8 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -121,9 +121,9 @@ namespace SwLangHelper
// setting the new language...
if (!aNewLangText.isEmpty())
{
- static const OUStringLiteral aSelectionLangPrefix(u"Current_");
- static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_");
- static const OUStringLiteral aDocumentLangPrefix(u"Default_");
+ static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_");
+ static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_");
+ static constexpr OUStringLiteral aDocumentLangPrefix(u"Default_");
sal_Int32 nPos = 0;
bool bForSelection = true;
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 02f4fced8aa9..e5c2416a9cbe 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -860,9 +860,9 @@ void SwTextShell::Execute(SfxRequest &rReq)
// setting the new language...
if (!aNewLangText.isEmpty())
{
- static const OUStringLiteral aSelectionLangPrefix(u"Current_");
- static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_");
- static const OUStringLiteral aDocumentLangPrefix(u"Default_");
+ static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_");
+ static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_");
+ static constexpr OUStringLiteral aDocumentLangPrefix(u"Default_");
SfxItemSetFixed
<RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
@@ -2071,8 +2071,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
if (pItem2)
sApplyText = pItem2->GetValue();
- static const OUStringLiteral sSpellingRule(u"Spelling_");
- static const OUStringLiteral sGrammarRule(u"Grammar_");
+ static constexpr OUStringLiteral sSpellingRule(u"Spelling_");
+ static constexpr OUStringLiteral sGrammarRule(u"Grammar_");
bool bGrammar = false;
sal_Int32 nPos = 0;
@@ -2442,8 +2442,8 @@ void SwTextShell::GetState( SfxItemSet &rSet )
OUString aStyleName;
std::vector<OUString> aList;
- static const OUStringLiteral sPhysical(u"IsPhysical");
- static const OUStringLiteral sDisplay(u"DisplayName");
+ static constexpr OUStringLiteral sPhysical(u"IsPhysical");
+ static constexpr OUStringLiteral sDisplay(u"DisplayName");
const OUString sHeaderOn(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn"));
uno::Reference< XStyleFamiliesSupplier > xSupplier(GetView().GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index 7399f71f5c44..e06c5bbf803b 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -718,7 +718,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
aURLObj.SetSmartURL( aCurOutputURL );
OUString aPath = aURLObj.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
- static const OUStringLiteral aDelim( u"/" );
+ static constexpr OUStringLiteral aDelim( u"/" );
if (!aPath.isEmpty() && !aPath.endsWith(aDelim))
aPath += aDelim;
if (bCurFileNameFromColumn)