avmedia/source/framework/mediaitem.cxx                     |    2 
 chart2/qa/extras/chart2geometry.cxx                        |   24 +-
 compilerplugins/clang/stringstatic.cxx                     |  118 +++++++++----
 compilerplugins/clang/test/stringstatic.cxx                |    8 
 cui/source/dialogs/scriptdlg.cxx                           |    2 
 dbaccess/source/ui/dlg/dbadmin.cxx                         |    4 
 dbaccess/source/ui/dlg/dbfindex.cxx                        |    4 
 dbaccess/source/ui/misc/WCopyTable.cxx                     |    2 
 desktop/source/lib/init.cxx                                |    4 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   10 -
 fpicker/source/office/fileview.cxx                         |    2 
 jvmfwk/source/elements.cxx                                 |    2 
 l10ntools/source/merge.cxx                                 |    2 
 l10ntools/source/propmerge.cxx                             |    4 
 oox/qa/unit/export.cxx                                     |    2 
 oox/qa/unit/mcgr.cxx                                       |    8 
 oox/source/export/drawingml.cxx                            |    2 
 oox/source/export/vmlexport.cxx                            |    2 
 sc/qa/unit/ucalc.cxx                                       |    2 
 sc/qa/unit/ucalc_formula2.cxx                              |    2 
 sc/source/filter/excel/xestream.cxx                        |    2 
 sc/source/filter/lotus/lotform.cxx                         |    4 
 sc/source/filter/xml/xmlexprt.cxx                          |    2 
 sc/source/filter/xml/xmlimprt.cxx                          |    3 
 sd/qa/unit/export-tests-ooxml1.cxx                         |   18 +
 sd/qa/unit/export-tests-ooxml2.cxx                         |    8 
 sd/qa/unit/export-tests-ooxml3.cxx                         |   12 -
 sd/qa/unit/misc-tests.cxx                                  |   56 +++---
 sfx2/source/appl/sfxhelp.cxx                               |    2 
 sfx2/source/doc/guisaveas.cxx                              |    2 
 svl/qa/unit/items/test_IndexedStyleSheets.cxx              |    2 
 svtools/source/misc/langhelp.cxx                           |    5 
 svx/source/svdraw/svdtrans.cxx                             |    6 
 sw/qa/extras/tiledrendering/tiledrendering.cxx             |    8 
 sw/qa/extras/uiwriter/uiwriter6.cxx                        |    3 
 sw/source/core/crsr/findtxt.cxx                            |    2 
 test/source/screenshot_test.cxx                            |    2 
 ucb/source/core/ucbstore.cxx                               |    8 
 unotools/source/config/fontcfg.cxx                         |   10 -
 vcl/qa/cppunit/text.cxx                                    |    2 
 vcl/source/filter/FilterConfigCache.cxx                    |   14 -
 vcl/source/filter/ipdf/pdfdocument.cxx                     |    4 
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx            |   12 -
 writerperfect/source/impress/KeynoteImportFilter.cxx       |    4 
 writerperfect/source/writer/EPUBPackage.cxx                |    2 
 xmloff/source/core/xmlexp.cxx                              |    2 
 xmloff/source/draw/sdxmlimp.cxx                            |    2 
 xmloff/source/draw/shapeexport.cxx                         |    7 
 xmloff/source/text/XMLIndexTOCContext.cxx                  |    4 
 xmloff/source/text/txtstyli.cxx                            |    8 
 50 files changed, 245 insertions(+), 177 deletions(-)

New commits:
commit e266d448f45348f27f8291ea5d0542747d7c8168
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Jun 26 16:16:19 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jun 27 13:10:44 2023 +0200

    loplugin:stringstatic look for more strings
    
    that can be initialised at compile-time instead of runtime
    
    Change-Id: I08d516fdc13a3a79f93c079f89ac44cbc7a1ed71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153620
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/avmedia/source/framework/mediaitem.cxx 
b/avmedia/source/framework/mediaitem.cxx
index f177c8bea687..4699a0454359 100644
--- a/avmedia/source/framework/mediaitem.cxx
+++ b/avmedia/source/framework/mediaitem.cxx
@@ -469,7 +469,7 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
         uno::Reference<embed::XStorage> const xStorage(
                 xSBD->getDocumentStorage(), uno::UNO_SET_THROW);
 
-        OUString const media("Media");
+        static constexpr OUStringLiteral media(u"Media");
         uno::Reference<embed::XStorage> const xSubStorage(
             xStorage->openStorageElement(media, embed::ElementModes::WRITE));
 
diff --git a/chart2/qa/extras/chart2geometry.cxx 
b/chart2/qa/extras/chart2geometry.cxx
index f560d46ba054..fdd4e6daa11d 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -80,9 +80,10 @@ void Chart2GeometryTest::testTdf135184RoundLineCap()
     xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
-    const OString 
sStyleStart("/office:document-content/office:automatic-styles");
-    const OString 
sCap("/style:graphic-properties[@svg:stroke-linecap='round']");
-    const OString 
sChartStart("/office:document-content/office:body/office:chart/chart:chart");
+    static constexpr OStringLiteral 
sStyleStart("/office:document-content/office:automatic-styles");
+    static constexpr OStringLiteral 
sCap("/style:graphic-properties[@svg:stroke-linecap='round']");
+    static constexpr OStringLiteral sChartStart(
+        "/office:document-content/office:body/office:chart/chart:chart");
     OString sPredicate;
     // chart area
     const OUString sOUAreaStyleName = getXPathContent(pXmlDoc, sChartStart + 
"/@chart:style-name");
@@ -108,9 +109,10 @@ void Chart2GeometryTest::testTdf135184RoundLineCap2()
     xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
-    const OString 
sStyleStart("/office:document-content/office:automatic-styles");
-    const OString 
sCap("/style:graphic-properties[@svg:stroke-linecap='round']");
-    const OString 
sChartStart("/office:document-content/office:body/office:chart/chart:chart");
+    static constexpr OStringLiteral 
sStyleStart("/office:document-content/office:automatic-styles");
+    static constexpr OStringLiteral 
sCap("/style:graphic-properties[@svg:stroke-linecap='round']");
+    static constexpr OStringLiteral sChartStart(
+        "/office:document-content/office:body/office:chart/chart:chart");
     OString sPredicate;
     // legend
     const OString sLegend(sChartStart + "/chart:legend");
@@ -138,11 +140,11 @@ void Chart2GeometryTest::testTdf135184RoundLineCap3()
     xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart1.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
-    const OString sDash("/c:spPr/a:ln/a:prstDash");
+    static constexpr OStringLiteral sDash("/c:spPr/a:ln/a:prstDash");
     // chart area
     assertXPath(pXmlDoc, "/c:chartSpace" + sDash, "val", "dashDot");
     // data series line
-    const OString 
sStart("/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser");
+    static constexpr OStringLiteral 
sStart("/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser");
     assertXPath(pXmlDoc, sStart + sDash, "val", "dash");
     // regression-curve (trendline)
     assertXPath(pXmlDoc, sStart + "/c:trendline" + sDash, "val", "sysDot");
@@ -156,8 +158,8 @@ void Chart2GeometryTest::testTdf135184RoundLineCap4()
     xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart1.xml");
     CPPUNIT_ASSERT(pXmlDoc);
 
-    const OString sChartStart("/c:chartSpace/c:chart");
-    const OString sDash("/c:spPr/a:ln/a:prstDash");
+    static constexpr OStringLiteral sChartStart("/c:chartSpace/c:chart");
+    static constexpr OStringLiteral sDash("/c:spPr/a:ln/a:prstDash");
     assertXPath(pXmlDoc, sChartStart + "/c:legend" + sDash, "val", "sysDot");
     const OString sSeries(sChartStart + 
"/c:plotArea/c:pieChart/c:ser/c:dPt[3]");
     assertXPath(pXmlDoc, sSeries + sDash, "val", "dash");
@@ -472,7 +474,7 @@ void Chart2GeometryTest::testTdf135366_CustomLabelText()
     CPPUNIT_ASSERT(pXmlDoc);
 
     // Find custom text. As of version 7.0 it is in a <text:span> element.
-    const OString sCustomTextPath(
+    static constexpr OStringLiteral sCustomTextPath(
         
"//office:document-content/office:body/office:chart/chart:chart/chart:plot-area"
         "/chart:series/chart:data-point[2]/chart:data-label/text:p/text:span");
     assertXPath(pXmlDoc, sCustomTextPath, 1);
diff --git a/compilerplugins/clang/stringstatic.cxx 
b/compilerplugins/clang/stringstatic.cxx
index a0b83c465235..5ad225b68d80 100644
--- a/compilerplugins/clang/stringstatic.cxx
+++ b/compilerplugins/clang/stringstatic.cxx
@@ -40,6 +40,7 @@ public:
     bool VisitReturnStmt(ReturnStmt const*);
     bool VisitDeclRefExpr(DeclRefExpr const*);
     bool VisitMemberExpr(MemberExpr const*);
+    bool VisitUnaryOperator(UnaryOperator const*);
 
 private:
     std::unordered_set<VarDecl const *> potentialVars;
@@ -59,6 +60,11 @@ bool StringStatic::preRun()
     // passing around pointers to global OUString
     if (loplugin::hasPathnamePrefix(fn, SRCDIR "/filter/source/svg/"))
          return false;
+    // call replaceAll on a 'const OUString", for which there is no 
OUStringLiteral equivalent
+    if (loplugin::hasPathnamePrefix(fn, SRCDIR 
"/i18npool/qa/cppunit/test_breakiterator.cxx"))
+         return false;
+    if (loplugin::hasPathnamePrefix(fn, SRCDIR 
"/sd/qa/unit/export-tests-ooxml2.cxx"))
+         return false;
     return true;
 }
 
@@ -80,53 +86,74 @@ bool StringStatic::VisitVarDecl(VarDecl const* varDecl)
     if (ignoreLocation(varDecl))
         return true;
     QualType qt = varDecl->getType();
-    if (!varDecl->hasGlobalStorage())
-        return true;
-    if (varDecl->hasGlobalStorage() && !varDecl->isStaticLocal()) {
-        //TODO: For a non-public static member variable from an included file, 
we could still
-        // examine it further if all its uses must be seen in that included 
file:
-        if (!compiler.getSourceManager().isInMainFile(varDecl->getLocation())) 
{
-            return true;
-        }
-    }
     if (!varDecl->isThisDeclarationADefinition()
         || !qt.isConstQualified())
         return true;
-    if (qt->isArrayType())
-        qt = qt->getAsArrayTypeUnsafe()->getElementType();
 
-    auto tc = loplugin::TypeCheck(qt);
-    if (!tc.Class("OUString").Namespace("rtl").GlobalNamespace()
-        && !tc.Class("OString").Namespace("rtl").GlobalNamespace())
-        return true;
-    if (varDecl->hasInit())
+    if (varDecl->hasGlobalStorage())
     {
-        Expr const * expr = varDecl->getInit();
-        while (true) {
-            if (ExprWithCleanups const * exprWithCleanups = 
dyn_cast<ExprWithCleanups>(expr)) {
-                expr = exprWithCleanups->getSubExpr();
-            }
-            else if (CastExpr const * castExpr = dyn_cast<CastExpr>(expr)) {
-                expr = castExpr->getSubExpr();
-            }
-            else if (MaterializeTemporaryExpr const * materializeExpr = 
dyn_cast<MaterializeTemporaryExpr>(expr)) {
-                expr = materializeExpr->getSubExpr();
-            }
-            else if (CXXBindTemporaryExpr const * bindExpr = 
dyn_cast<CXXBindTemporaryExpr>(expr)) {
-                expr = bindExpr->getSubExpr();
+        if (varDecl->hasGlobalStorage() && !varDecl->isStaticLocal()) {
+            //TODO: For a non-public static member variable from an included 
file, we could still
+            // examine it further if all its uses must be seen in that 
included file:
+            if 
(!compiler.getSourceManager().isInMainFile(varDecl->getLocation())) {
+                return true;
             }
-            else if (CXXConstructExpr const * constructExpr = 
dyn_cast<CXXConstructExpr>(expr)) {
-                if (constructExpr->getNumArgs() == 0) {
+        }
+        if (qt->isArrayType())
+            qt = qt->getAsArrayTypeUnsafe()->getElementType();
+
+        auto tc = loplugin::TypeCheck(qt);
+        if (!tc.Class("OUString").Namespace("rtl").GlobalNamespace()
+            && !tc.Class("OString").Namespace("rtl").GlobalNamespace())
+            return true;
+        if (varDecl->hasInit())
+        {
+            Expr const * expr = varDecl->getInit();
+            while (true) {
+                if (ExprWithCleanups const * exprWithCleanups = 
dyn_cast<ExprWithCleanups>(expr)) {
+                    expr = exprWithCleanups->getSubExpr();
+                }
+                else if (CastExpr const * castExpr = dyn_cast<CastExpr>(expr)) 
{
+                    expr = castExpr->getSubExpr();
+                }
+                else if (MaterializeTemporaryExpr const * materializeExpr = 
dyn_cast<MaterializeTemporaryExpr>(expr)) {
+                    expr = materializeExpr->getSubExpr();
+                }
+                else if (CXXBindTemporaryExpr const * bindExpr = 
dyn_cast<CXXBindTemporaryExpr>(expr)) {
+                    expr = bindExpr->getSubExpr();
+                }
+                else if (CXXConstructExpr const * constructExpr = 
dyn_cast<CXXConstructExpr>(expr)) {
+                    if (constructExpr->getNumArgs() == 0) {
+                        return true;
+                    }
+                    expr = constructExpr->getArg(0);
+                } else if (isa<CallExpr>(expr)) {
                     return true;
+                } else {
+                    break;
                 }
-                expr = constructExpr->getArg(0);
-            } else if (isa<CallExpr>(expr)) {
-                return true;
-            } else {
-                break;
             }
         }
     }
+    else
+    {
+        if (isa<ParmVarDecl>(varDecl))
+            return true;
+        loplugin::TypeCheck const tc(varDecl->getType());
+        if (!(tc.Class("OString").Namespace("rtl").GlobalNamespace()
+              || tc.Class("OUString").Namespace("rtl").GlobalNamespace()))
+        {
+            return true;
+        }
+        if (varDecl->hasInit())
+        {
+            auto cxxConstruct = 
dyn_cast<CXXConstructExpr>(varDecl->getInit()->IgnoreImplicit());
+            if (!cxxConstruct || cxxConstruct->getNumArgs() == 0)
+                return true;
+            if (!isa<clang::StringLiteral>(cxxConstruct->getArg(0)))
+                return true;
+        }
+    }
     potentialVars.insert(varDecl);
 
     return true;
@@ -193,6 +220,25 @@ bool StringStatic::VisitMemberExpr(MemberExpr const * expr)
     return true;
 }
 
+bool StringStatic::VisitUnaryOperator(UnaryOperator const * expr)
+{
+    if (ignoreLocation(expr))
+        return true;
+    if (expr->getOpcode() != UO_AddrOf)
+        return true;
+    if (this->ignoreLocation(expr))
+        return true;
+    auto const dre = dyn_cast<DeclRefExpr>(
+        expr->getSubExpr()->IgnoreParenImpCasts());
+    if (!dre)
+        return true;
+    auto const vd = dyn_cast<VarDecl>(dre->getDecl());
+    if (!vd)
+        return true;
+    excludeVars.insert(vd->getCanonicalDecl());
+    return true;
+}
+
 loplugin::Plugin::Registration<StringStatic> stringstatic("stringstatic");
 
 } // namespace
diff --git a/compilerplugins/clang/test/stringstatic.cxx 
b/compilerplugins/clang/test/stringstatic.cxx
index 3c26d961c6a8..20326101dc79 100644
--- a/compilerplugins/clang/test/stringstatic.cxx
+++ b/compilerplugins/clang/test/stringstatic.cxx
@@ -15,6 +15,7 @@
 static const OUString TEST1 = "xxx";
 
 void f(rtl_uString const*);
+void f(const OUString&);
 
 void test2()
 {
@@ -27,3 +28,10 @@ void test2()
     static const OUString DATA = "xxx";
     f(DATA.pData);
 }
+
+void test3()
+{
+    // expected-error@+1 {{rather declare this using 
OUStringLiteral/OStringLiteral/char[] [loplugin:stringstatic]}}
+    OUString const literal = u"foo";
+    f(literal);
+}
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index a2d798e80a78..f482c540294c 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -129,7 +129,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language 
 )
     Sequence< Reference< browse::XBrowseNode > > children;
 
     OUString userStr("user");
-    OUString const shareStr("share");
+    static constexpr OUStringLiteral shareStr(u"share");
 
     try
     {
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx 
b/dbaccess/source/ui/dlg/dbadmin.cxx
index 1744f6929c35..105f9ab6b286 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -271,14 +271,14 @@ void 
ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Ref
     _rpPool = nullptr;
     _rpDefaults = nullptr;
 
-    const OUString sFilterAll( "%" );
+    static constexpr OUStringLiteral sFilterAll( u"%" );
     // create and initialize the defaults
     _rpDefaults = new std::vector<SfxPoolItem*>(DSID_LAST_ITEM_ID - 
DSID_FIRST_ITEM_ID + 1);
     SfxPoolItem** pCounter = _rpDefaults->data();  // want to modify this 
without affecting the out param _rppDefaults
     *pCounter++ = new SfxStringItem(DSID_NAME, OUString());
     *pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, OUString());
     *pCounter++ = new SfxStringItem(DSID_CONNECTURL, OUString());
-    *pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< OUString 
>(&sFilterAll, 1));
+    *pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< OUString 
>{sFilterAll});
     *pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, 
_pTypeCollection);
     *pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, false);
     *pCounter++ = new SfxBoolItem(DSID_READONLY, false);
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx 
b/dbaccess/source/ui/dlg/dbfindex.cxx
index 061486e91201..e5f62afc6be3 100644
--- a/dbaccess/source/ui/dlg/dbfindex.cxx
+++ b/dbaccess/source/ui/dlg/dbfindex.cxx
@@ -254,8 +254,8 @@ void ODbaseIndexDialog::Init()
 
     // first assume for all indexes they're free
 
-    OUString const aIndexExt("ndx");
-    OUString const aTableExt("dbf");
+    static constexpr OUStringLiteral aIndexExt(u"ndx");
+    static constexpr OUStringLiteral aTableExt(u"dbf");
 
     std::vector< OUString > aUsedIndexes;
 
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx 
b/dbaccess/source/ui/misc/WCopyTable.cxx
index 590b3f9adce5..40b8c0edd4c8 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -992,7 +992,7 @@ void OCopyTableWizard::loadData(  const 
ICopyTableSourceObject& _rSourceObject,
     _rColumns.clear();
 
     OFieldDescription* pActFieldDescr = nullptr;
-    OUString const sCreateParam("x");
+    static constexpr OUStringLiteral sCreateParam(u"x");
     // ReadOnly-Flag
     // On drop no line must be editable.
     // On add only empty lines must be editable.
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4311b501ad16..971e1ecc75e4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -416,8 +416,8 @@ static bool extractLinks(const uno::Reference< 
container::XNameAccess >& xLinks,
 
     const sal_uLong nLinks = aNames.getLength();
     const OUString* pNames = aNames.getConstArray();
-    const OUString aProp_LinkDisplayName( "LinkDisplayName" );
-    const OUString aProp_LinkTarget( "com.sun.star.document.LinkTarget" );
+    static constexpr OUStringLiteral aProp_LinkDisplayName( u"LinkDisplayName" 
);
+    static constexpr OUStringLiteral aProp_LinkTarget( 
u"com.sun.star.document.LinkTarget" );
     bool bIsTarget = false;
     for( sal_uLong i = 0; i < nLinks; i++ )
     {
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 39ffdf05e318..b774848cc3a4 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1239,7 +1239,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
 {
     // support for FIELD_SEQ_BEGIN, FIELD_SEQ_END and URL. It wraps text 
primitives (but is not limited to)
     // thus do the MetafileAction embedding stuff but just handle recursively.
-    const OString aCommentStringCommon("FIELD_SEQ_BEGIN");
+    static constexpr OStringLiteral aCommentStringCommon("FIELD_SEQ_BEGIN");
     OUString aURL;
 
     switch (rFieldPrimitive.getType())
@@ -1333,7 +1333,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D(
 void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(
     const primitive2d::TextHierarchyParagraphPrimitive2D& rParagraphPrimitive)
 {
-    const OString aCommentString("XTEXT_EOP");
+    static constexpr OStringLiteral aCommentString("XTEXT_EOP");
     static bool bSuppressPDFExtOutDevDataSupport(false); // 
loplugin:constvars:ignore
 
     if (nullptr == mpPDFExtOutDevData || bSuppressPDFExtOutDevDataSupport)
@@ -1495,9 +1495,9 @@ void 
VclMetafileProcessor2D::processTextSimplePortionPrimitive2D(
                 rTxt, nTextPosition, rLocale, css::i18n::WordType::ANY_WORD, 
true));
             sal_Int32 nNextSentenceBreak(
                 rBreakIterator.endOfSentence(rTxt, nTextPosition, rLocale));
-            const OString aCommentStringA("XTEXT_EOC");
-            const OString aCommentStringB("XTEXT_EOW");
-            const OString aCommentStringC("XTEXT_EOS");
+            static constexpr OStringLiteral aCommentStringA("XTEXT_EOC");
+            static constexpr OStringLiteral aCommentStringB("XTEXT_EOW");
+            static constexpr OStringLiteral aCommentStringC("XTEXT_EOS");
 
             for (sal_Int32 i(nTextPosition); i < nTextPosition + nTextLength; 
i++)
             {
diff --git a/fpicker/source/office/fileview.cxx 
b/fpicker/source/office/fileview.cxx
index 4e3b5e2b50a9..9d8d0f347449 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -1499,7 +1499,7 @@ void SvtFileView_Impl::CreateDisplayText_Impl()
 {
     ::osl::MutexGuard aGuard( maMutex );
 
-    OUString const aDateSep( ", " );
+    static constexpr OUStringLiteral aDateSep( u", " );
 
     for (auto const& elem : maContent)
     {
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index c48f942ef8e8..ebbf8abf0fd2 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -177,7 +177,7 @@ NodeJava::NodeJava(Layer layer):
 
 void NodeJava::load()
 {
-    const OString sExcMsg("[Java framework] Error in function NodeJava::load"
+    static constexpr OStringLiteral sExcMsg("[Java framework] Error in 
function NodeJava::load"
                              "(elements.cxx).");
     if (SHARED == m_layer)
     {
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 263e3d588121..8327442b0af2 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -150,7 +150,7 @@ MergeDataFile::MergeDataFile(
         OString sLang;
         //Get language id from path
         {
-            const OString sTransSource("translations/source/");
+            static constexpr OStringLiteral 
sTransSource("translations/source/");
             const sal_Int32 nStart =
                 sPoFileName.indexOf(sTransSource)+sTransSource.getLength();
             const sal_Int32 nCount =
diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx
index c17519364443..99c2885ce5a3 100644
--- a/l10ntools/source/propmerge.cxx
+++ b/l10ntools/source/propmerge.cxx
@@ -28,7 +28,7 @@ namespace
     sal_Int32 lcl_IndexOfUnicode(
         std::string_view rSource, const sal_Int32 nFrom = 0 )
     {
-        const OString sHexDigits = "0123456789abcdefABCDEF";
+        static constexpr std::string_view sHexDigits = 
"0123456789abcdefABCDEF";
         size_t nIndex = rSource.find( "\\u", nFrom );
         if( nIndex == std::string_view::npos )
         {
@@ -37,7 +37,7 @@ namespace
         bool bIsUnicode = true;
         for( short nDist = 2; nDist <= 5; ++nDist )
         {
-            if( sHexDigits.indexOf( rSource[nIndex + nDist] ) == -1 )
+            if( sHexDigits.find( rSource[nIndex + nDist] ) == 
std::string_view::npos )
             {
                 bIsUnicode = false;
             }
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index 9b62dc337c1b..042f0cd4ffaa 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -920,7 +920,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkDirectColor)
 
     // Examine the saved markup.
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-    const OString sElement = "//w:txbxContent/w:p/w:r/w:rPr/";
+    static constexpr OStringLiteral sElement = 
"//w:txbxContent/w:p/w:r/w:rPr/";
 
     // Make sure the fallback in <w:color> has correct value.
     assertXPath(pXmlDoc, sElement + "w:color", "val", "2E8B57");
diff --git a/oox/qa/unit/mcgr.cxx b/oox/qa/unit/mcgr.cxx
index 1fb06bb3f1f1..1158da7fc35e 100644
--- a/oox/qa/unit/mcgr.cxx
+++ b/oox/qa/unit/mcgr.cxx
@@ -34,7 +34,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradient)
     // linear gradient with 30deg angle
     assertXPath(pXmlDoc, "//a:r/a:rPr/a:gradFill/a:lin", "ang", "3600000");
     // three color stops, no transparency
-    const OString sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/";
+    static constexpr OStringLiteral sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/";
     assertXPath(pXmlDoc, sPath + "a:gs", 3);
     assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", "0");
     assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", "ff1493");
@@ -57,7 +57,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord)
     // linear gradient with 30deg angle
     assertXPath(pXmlDoc, "//w14:lin", "ang", "3600000");
     // three color stops, no transparency
-    const OString sPath = "//w14:gradFill/w14:gsLst/";
+    static constexpr OStringLiteral sPath = "//w14:gradFill/w14:gsLst/";
     assertXPath(pXmlDoc, sPath + "w14:gs", 3);
     assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos", "0");
     assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val", "ff1493");
@@ -88,7 +88,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testStepCount)
     // Without the fix the colors in the sections were wrong. And when opening 
a file with StepCount
     // and saving it immediately to pptx, a continuous gradient might be 
produced.
 
-    const OString sPath = "//a:gradFill/a:gsLst/";
+    static constexpr OStringLiteral sPath = "//a:gradFill/a:gsLst/";
     // The default way of load and save would have produced 2 stops, but we 
need start stop, end stop
     // and 3*2 inner stops.
     assertXPath(pXmlDoc, sPath + "a:gs", 8);
@@ -115,7 +115,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans)
     // method will be changed, the test needs to be adjusted.
 
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString sPath = "//a:gradFill/a:gsLst/";
+    static constexpr OStringLiteral sPath = "//a:gradFill/a:gsLst/";
     assertXPath(pXmlDoc, sPath + "a:gs", 3);
     assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", "0");
     assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", "00ffff");
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d4996a6eb9cf..01328fa2576a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1512,7 +1512,7 @@ OUString GraphicExport::writeToStorage(const Graphic& 
rGraphic , bool bRelPathTo
         xOutStream->writeBytes(Sequence<sal_Int8>(static_cast<const 
sal_Int8*>(aData), nDataSize));
         xOutStream->closeOutput();
 
-        const OString sRelPathToMedia = "media/image";
+        static constexpr OStringLiteral sRelPathToMedia = "media/image";
         OString sRelationCompPrefix;
         if (bRelPathToMedia)
             sRelationCompPrefix = "../";
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 38d3b9feacd1..5923e13d0def 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1134,7 +1134,7 @@ void VMLExport::AddLineDimensions( const 
tools::Rectangle& rRectangle )
 
     if ( mnGroupLevel == 1 )
     {
-        const OString aPt( "pt" );
+        static constexpr OStringLiteral aPt( "pt" );
         aLeft = OString::number( double( rRectangle.Left() ) / 20 ) + aPt;
         aTop = OString::number( double( rRectangle.Top() ) / 20 ) + aPt;
         aRight = OString::number( double( rRectangle.Right() ) / 20 ) + aPt;
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5642654a0d2e..a72fb326029c 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -463,7 +463,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf113027)
 
     // Add a formula containing a remote reference, i.e., to another sheet
     const ScAddress aScAddress(0, 0, 0);
-    const OUString aFormula = "='Sheet 2'!RC";
+    static constexpr OUStringLiteral aFormula = u"='Sheet 2'!RC";
     m_pDoc->SetString(aScAddress, aFormula);
 
     // Switch from relative to absolute cell reference
diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx
index 20d2326887fc..87f858ff4dc9 100644
--- a/sc/qa/unit/ucalc_formula2.cxx
+++ b/sc/qa/unit/ucalc_formula2.cxx
@@ -3452,7 +3452,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testFuncMDETERM)
 
     m_pDoc->InsertTab(0, "MDETERM_test");
     ScAddress aPos(8, 0, 0);
-    OUString const aColCodes("ABCDEFGH");
+    static constexpr std::u16string_view aColCodes(u"ABCDEFGH");
     OUStringBuffer aFormulaBuffer("=MDETERM(A1:B2)");
     for (SCSIZE nSize = 3; nSize <= 8; nSize++)
     {
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 8d31023e4a57..b8fd323aa400 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1066,7 +1066,7 @@ bool XclExpXmlStream::exportDocument()
         }
     }
 
-    OUString const workbook = "xl/workbook.xml";
+    static constexpr OUStringLiteral workbook = u"xl/workbook.xml";
     const char* pWorkbookContentType = nullptr;
     if (mbExportVBA)
     {
diff --git a/sc/source/filter/lotus/lotform.cxx 
b/sc/source/filter/lotus/lotform.cxx
index d20f0a38fcec..5442145dda3b 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -50,13 +50,13 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nCnt, 
const char* pExtString )
         OString t;
         if( pExtString )
         {
-            const OString s("@<<@123>>");
+            static constexpr std::string_view s("@<<@123>>");
 
             t = pExtString;
 
             sal_Int32 n = t.indexOf(s);
             if( n != -1 )
-                t = t.copy(n + s.getLength());
+                t = t.copy(n + s.size());
 
             t = comphelper::string::stripEnd(t, '(');
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index d6afd59f5dc3..f484c20b5710 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1826,7 +1826,7 @@ void ScXMLExport::CopySourceStream( sal_Int32 
nStartOffset, sal_Int32 nEndOffset
 
     if ( getExportFlags() & SvXMLExportFlags::PRETTY )
     {
-        const OString aOutStr("\n   ");
+        static constexpr OStringLiteral aOutStr("\n   ");
         uno::Sequence<sal_Int8> aOutSeq( reinterpret_cast<sal_Int8 const 
*>(aOutStr.getStr()), aOutStr.getLength() );
         xDestStream->writeBytes( aOutSeq );
     }
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index 1f5002964684..c2327e41b290 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1170,8 +1170,7 @@ void SAL_CALL ScXMLImport::startDocument()
             xImportInfo.is() ? xImportInfo->getPropertySetInfo() : nullptr);
     if (xPropertySetInfo.is())
     {
-        OUString const sOrganizerMode(
-            "OrganizerMode");
+        static constexpr OUStringLiteral sOrganizerMode(u"OrganizerMode");
         if (xPropertySetInfo->hasPropertyByName(sOrganizerMode))
         {
             bool bStyleOnly(false);
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 9140eddf143c..ffc3530f40b6 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1326,8 +1326,8 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testRoundtripPrstDash)
         = { "dash",         "dashDot", "dot",        "lgDash",        
"lgDashDot",
             "lgDashDotDot", "sysDash", "sysDashDot", "sysDashDotDot", "sysDot" 
};
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString sStart = "/p:sld/p:cSld/p:spTree/p:sp[";
-    const OString sEnd = "]/p:spPr/a:ln/a:prstDash";
+    static constexpr OStringLiteral sStart = "/p:sld/p:cSld/p:spTree/p:sp[";
+    static constexpr OStringLiteral sEnd = "]/p:spPr/a:ln/a:prstDash";
     for (sal_uInt16 i = 0; i < 10; i++)
     {
         OString sXmlPath = sStart + OString::number(i + 1) + sEnd;
@@ -1410,7 +1410,8 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testTdf100348FontworkBitmapFill)
     // Make sure the fontwork shape has a blip bitmap fill and a colored 
outline.
     // Without the patch, fill and outline were black.
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString 
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr");
+    static constexpr OStringLiteral sPathStart(
+        "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr");
     assertXPath(pXmlDoc, sPathStart + "/a:blipFill/a:blip", 1);
     assertXPath(pXmlDoc, sPathStart + "/a:ln/a:solidFill/a:srgbClr", "val", 
"ffbf00");
 }
@@ -1423,7 +1424,8 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testTdf100348FontworkGradientGlow)
     // Make sure the fontwork shape has a gradient fill and a colored glow.
     // Without the patch, fill was black and no glow applied.
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString 
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr");
+    static constexpr OStringLiteral sPathStart(
+        "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr");
     assertXPath(pXmlDoc, sPathStart + "/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", 
"val", "8d281e");
     assertXPath(pXmlDoc, sPathStart + "/a:effectLst/a:glow", "rad", "63360");
     assertXPath(pXmlDoc, sPathStart + "/a:effectLst/a:glow/a:srgbClr", "val", 
"ff4500");
@@ -1446,7 +1448,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testTdf128345GradientLinear)
 
     // Make sure the shape has a lin fill. Without the patch, fill was solid 
red.
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
+    static constexpr OStringLiteral 
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
     assertXPath(pXmlDoc, sPathStart + "/a:lin", "ang", "3600000");
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]", "pos", "25000");
@@ -1465,7 +1467,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testTdf128345GradientRadial)
     // Make sure the shape has transparency. In OOXML alpha means 'opacity' 
with default
     // 100000 for full opak, so only the full transparency with val 0 should 
be written.
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
+    static constexpr OStringLiteral 
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr", "val", 
"ff0000");
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 0);
@@ -1504,7 +1506,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testTdf134969TransparencyOnColorGradien
 
     // Make sure the shape has a transparency in gradient stops.
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
+    static constexpr OStringLiteral 
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill");
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 
"val", "60000");
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", 
"val", "60000");
@@ -1516,7 +1518,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testArcTo)
     save("Impress Office Open XML");
 
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString sPath("//a:custGeom/a:pathLst/a:path/a:arcTo");
+    static constexpr OStringLiteral 
sPath("//a:custGeom/a:pathLst/a:path/a:arcTo");
     assertXPath(pXmlDoc, sPath, "wR", "3");
     assertXPath(pXmlDoc, sPath, "hR", "3");
     assertXPath(pXmlDoc, sPath, "stAng", "1800000");
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index d4521b1ad87f..db9e19e98662 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -728,10 +728,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, 
testPresetShapesExport)
     xmlDocUniquePtr pXmlDocCT = parseExport("ppt/slides/slide1.xml");
     const OString sPattern(
         
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]");
-    const OString sT("_T_");
-    const OString sN("_N_");
-    const OString sPropertyName("name");
-    const OString sPropertyFmla("fmla");
+    static constexpr OStringLiteral sT("_T_");
+    static constexpr OStringLiteral sN("_N_");
+    static constexpr OStringLiteral sPropertyName("name");
+    static constexpr OStringLiteral sPropertyFmla("fmla");
 
     size_t i = 0;
     while (i < SAL_N_ELEMENTS(sShapeTypeAndValues))
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index bd343497ff59..32a64cc5fba4 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -513,7 +513,8 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, 
testTdf100348_convert_Fontwork2TextWarp
 
     // Resulting pptx has to contain the TextWarp shape
     xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
-    const OString 
sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp");
+    static constexpr OStringLiteral sPathStart(
+        "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp");
     assertXPath(pXmlDocContent, sPathStart + "[@prst='textWave1']");
     const OString sPathAdj(sPathStart + "/a:avLst/a:gd");
     assertXPath(pXmlDocContent, sPathAdj + "[@name='adj1' and  @fmla='val 
18750']");
@@ -599,7 +600,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, 
testTdf99497_keepAppearanceOfCircleKind
 
     // slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> 
exists
     xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
-    const OString sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
+    static constexpr OStringLiteral 
sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
     assertXPath(pXmlDocContent1, sPathStart1 + "[@prst='arc']");
     const OString sPathAdj1(sPathStart1 + "/a:avLst/a:gd");
     assertXPath(pXmlDocContent1, sPathAdj1 + "[@name='adj1' and  @fmla='val 
20493903']");
@@ -608,7 +609,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, 
testTdf99497_keepAppearanceOfCircleKind
 
     // slide 2 270° -> adj1 = 5400000, 180° -> adj2 = 10800000
     xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
-    const OString sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
+    static constexpr OStringLiteral 
sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
     assertXPath(pXmlDocContent2, sPathStart2 + "[@prst='chord']");
     const OString sPathAdj2(sPathStart2 + "/a:avLst/a:gd");
     assertXPath(pXmlDocContent2, sPathAdj2 + "[@name='adj1' and  @fmla='val 
5400000']");
@@ -616,7 +617,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, 
testTdf99497_keepAppearanceOfCircleKind
 
     // slide 3 120° -> adj1 = 12600000, 30° -> adj2 = 20946396
     xmlDocUniquePtr pXmlDocContent3 = parseExport("ppt/slides/slide3.xml");
-    const OString sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
+    static constexpr OStringLiteral 
sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
     assertXPath(pXmlDocContent3, sPathStart3 + "[@prst='pie']");
     const OString sPathAdj3(sPathStart3 + "/a:avLst/a:gd");
     assertXPath(pXmlDocContent3, sPathAdj3 + "[@name='adj1' and  @fmla='val 
12600000']");
@@ -965,7 +966,8 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf135843)
     save("Impress Office Open XML");
 
     xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
-    const OString 
sPathStart("/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl");
+    static constexpr OStringLiteral sPathStart(
+        "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl");
     assertXPath(pXmlDoc, sPathStart + 
"/a:tr[1]/a:tc[1]/a:tcPr/a:lnL/a:solidFill");
     assertXPath(pXmlDoc, sPathStart + 
"/a:tr[1]/a:tc[1]/a:tcPr/a:lnR/a:solidFill");
     assertXPath(pXmlDoc, sPathStart + 
"/a:tr[1]/a:tc[1]/a:tcPr/a:lnT/a:solidFill");
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index b0dedac84636..2d914c2947b8 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -475,7 +475,7 @@ void SdMiscTest::testTdf101242_ODF_add_settings()
     // Verify, that the saved document still has the ODF attributes
     xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
-    const OString sPathStart(
+    static constexpr OStringLiteral sPathStart(
         
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
     assertXPath(pXmlDoc,
                 sPathStart + "[@draw:name='backgroundobjects' and 
@draw:protected='true']");
@@ -485,10 +485,11 @@ void SdMiscTest::testTdf101242_ODF_add_settings()
     // Verify, that the saved document has got the items in settings.xml
     xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
-    const OString sPathStart2("/office:document-settings/office:settings/"
-                              
"config:config-item-set[@config:name='ooo:view-settings']/"
-                              
"config:config-item-map-indexed[@config:name='Views']/"
-                              "config:config-item-map-entry");
+    static constexpr OStringLiteral sPathStart2(
+        "/office:document-settings/office:settings/"
+        "config:config-item-set[@config:name='ooo:view-settings']/"
+        "config:config-item-map-indexed[@config:name='Views']/"
+        "config:config-item-map-entry");
     // Value is a bitfield with first Byte in order '* * * measurelines 
controls backgroundobjects background layout'
     // The first three bits depend on initialization and may change. The 
values in file are Base64 encoded.
     OUString sBase64;
@@ -529,7 +530,7 @@ void SdMiscTest::testTdf101242_ODF_no_settings()
     // Verify, that the saved document still has the ODF attributes
     xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
-    const OString sPathStart(
+    static constexpr OStringLiteral sPathStart(
         
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
     assertXPath(pXmlDoc,
                 sPathStart + "[@draw:name='backgroundobjects' and 
@draw:protected='true']");
@@ -539,10 +540,11 @@ void SdMiscTest::testTdf101242_ODF_no_settings()
     // Verify, that the saved document has no layer items in settings.xml
     xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
-    const OString sPathStart2("/office:document-settings/office:settings/"
-                              
"config:config-item-set[@config:name='ooo:view-settings']/"
-                              
"config:config-item-map-indexed[@config:name='Views']/"
-                              "config:config-item-map-entry");
+    static constexpr OStringLiteral sPathStart2(
+        "/office:document-settings/office:settings/"
+        "config:config-item-set[@config:name='ooo:view-settings']/"
+        "config:config-item-map-indexed[@config:name='Views']/"
+        "config:config-item-map-entry");
     assertXPath(pXmlDoc2, sPathStart2 + 
"/config:config-item[@config:name='VisibleLayers']", 0);
     assertXPath(pXmlDoc2, sPathStart2 + 
"/config:config-item[@config:name='PrintableLayers']", 0);
     assertXPath(pXmlDoc2, sPathStart2 + 
"/config:config-item[@config:name='LockedLayers']", 0);
@@ -566,7 +568,7 @@ void SdMiscTest::testTdf101242_settings_keep()
     // Verify, that the saved document has the ODF attributes
     xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
-    const OString sPathStart(
+    static constexpr OStringLiteral sPathStart(
         
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
     assertXPath(pXmlDoc,
                 sPathStart + "[@draw:name='backgroundobjects' and 
@draw:protected='true']");
@@ -576,10 +578,11 @@ void SdMiscTest::testTdf101242_settings_keep()
     // Verify, that the saved document still has the items in settings.xml
     xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
-    const OString sPathStart2("/office:document-settings/office:settings/"
-                              
"config:config-item-set[@config:name='ooo:view-settings']/"
-                              
"config:config-item-map-indexed[@config:name='Views']/"
-                              "config:config-item-map-entry");
+    static constexpr OStringLiteral sPathStart2(
+        "/office:document-settings/office:settings/"
+        "config:config-item-set[@config:name='ooo:view-settings']/"
+        "config:config-item-map-indexed[@config:name='Views']/"
+        "config:config-item-map-entry");
     // Value is a bitfield with first Byte in order '* * * measurelines 
controls backgroundobjects background layout'
     // The first three bits depend on initialization and may change. The 
values in file are Base64 encoded.
     OUString sBase64;
@@ -621,7 +624,7 @@ void SdMiscTest::testTdf101242_settings_remove()
     // Verify, that the saved document has the ODF attributes
     xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc);
-    const OString sPathStart(
+    static constexpr OStringLiteral sPathStart(
         
"/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
     assertXPath(pXmlDoc,
                 sPathStart + "[@draw:name='backgroundobjects' and 
@draw:protected='true']");
@@ -631,10 +634,11 @@ void SdMiscTest::testTdf101242_settings_remove()
     // Verify, that the saved document has no layer items in settings.xml
     xmlDocUniquePtr pXmlDoc2 = parseExport("settings.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2);
-    const OString sPathStart2("/office:document-settings/office:settings/"
-                              
"config:config-item-set[@config:name='ooo:view-settings']/"
-                              
"config:config-item-map-indexed[@config:name='Views']/"
-                              "config:config-item-map-entry");
+    static constexpr OStringLiteral sPathStart2(
+        "/office:document-settings/office:settings/"
+        "config:config-item-set[@config:name='ooo:view-settings']/"
+        "config:config-item-map-indexed[@config:name='Views']/"
+        "config:config-item-map-entry");
     assertXPath(pXmlDoc2, sPathStart2 + 
"/config:config-item[@config:name='VisibleLayers']", 0);
     assertXPath(pXmlDoc2, sPathStart2 + 
"/config:config-item[@config:name='PrintableLayers']", 0);
     assertXPath(pXmlDoc2, sPathStart2 + 
"/config:config-item[@config:name='LockedLayers']", 0);
@@ -666,10 +670,11 @@ void SdMiscTest::testTdf119392()
     // Verify correct bit order in bitfield in the config items in settings.xml
     xmlDocUniquePtr pXmlDoc = parseExport("settings.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc);
-    const OString sPathStart("/office:document-settings/office:settings/"
-                             
"config:config-item-set[@config:name='ooo:view-settings']/"
-                             
"config:config-item-map-indexed[@config:name='Views']/"
-                             "config:config-item-map-entry");
+    static constexpr OStringLiteral sPathStart(
+        "/office:document-settings/office:settings/"
+        "config:config-item-set[@config:name='ooo:view-settings']/"
+        "config:config-item-map-indexed[@config:name='Views']/"
+        "config:config-item-map-entry");
     // First Byte is in order 'V-L -P- V-- measurelines controls 
backgroundobjects background layout'
     // Bits need to be: visible=10111111=0xbf=191 printable=01011111=0x5f=95 
locked=10000000=0x80=128
     // The values in file are Base64 encoded.
@@ -766,7 +771,8 @@ void SdMiscTest::testTdf98839_ShearVFlipH()
     save("draw8");
     xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
     CPPUNIT_ASSERT_MESSAGE("Failed to get 'content.xml'", pXmlDoc);
-    const OString 
sPathStart("/office:document-content/office:body/office:drawing/draw:page");
+    static constexpr OStringLiteral sPathStart(
+        "/office:document-content/office:body/office:drawing/draw:page");
     assertXPath(pXmlDoc, sPathStart);
     const OUString sTransform = getXPath(pXmlDoc, sPathStart + 
"/draw:custom-shape", "transform");
 
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 060ec181b60e..2980336bcea1 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -951,7 +951,7 @@ static bool impl_showOfflineHelp(const OUString& rURL, 
weld::Widget* pDialogPare
 
     // Get a html tempfile (for the flatpak case, create it in XDG_CACHE_HOME 
instead of /tmp for
     // technical reasons, so that it can be accessed by the browser running 
outside the sandbox):
-    OUString const aExtension(".html");
+    static constexpr OUStringLiteral aExtension(u".html");
     OUString * parent = nullptr;
     if (flatpak::isFlatpak() && 
!flatpak::createTemporaryHtmlDirectory(&parent)) {
         return false;
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 0f9df1ccd124..fea914e0b7ba 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -443,7 +443,7 @@ OUString ModelData_Impl::GetDocServiceName()
 
 void ModelData_Impl::CheckInteractionHandler()
 {
-    const OUString sInteractionHandler {"InteractionHandler"};
+    static constexpr OUStringLiteral sInteractionHandler 
{u"InteractionHandler"};
     ::comphelper::SequenceAsHashMap::const_iterator aInteractIter =
             m_aMediaDescrHM.find( sInteractionHandler );
 
diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx 
b/svl/qa/unit/items/test_IndexedStyleSheets.cxx
index 5c12acc250a5..f5014a261e13 100644
--- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx
+++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx
@@ -146,7 +146,7 @@ void 
IndexedStyleSheetsTest::StyleSheetsCanBeRetrievedByTheirName()
 
 void IndexedStyleSheetsTest::KnowsThatItStoresAStyleSheet()
 {
-    OUString const name1("name1");
+    static constexpr OUStringLiteral name1(u"name1");
     rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1));
     rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name1));
     rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet("name2"));
diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx
index 793e3f7d0e10..afc6830fde54 100644
--- a/svtools/source/misc/langhelp.cxx
+++ b/svtools/source/misc/langhelp.cxx
@@ -16,6 +16,7 @@
 #include <i18nlangtag/mslangid.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/System.hxx>
+#include <o3tl/string_view.hxx>
 #include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
 #include <rtl/ustring.hxx>
 #include <svtools/langhelp.hxx>
@@ -117,12 +118,12 @@ OUString getInstalledLocaleForSystemUILanguage(const 
css::uno::Sequence<OUString
         {
             // Get the list of langpacks that this build was configured to 
include
             std::vector<OUString> aPackages;
-            OUString const sAvailableLocales(WITH_LANG);
+            static constexpr std::u16string_view sAvailableLocales(u"" 
WITH_LANG);
             std::vector<OUString> aAvailable;
             sal_Int32 nIndex = 0;
             do
             {
-                aAvailable.emplace_back(sAvailableLocales.getToken(0, ' ', 
nIndex));
+                aAvailable.emplace_back(o3tl::getToken(sAvailableLocales, 0, ' 
', nIndex));
             }
             while (nIndex >= 0);
             // See which one matches the desired ui locale
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index ad44aa230e17..563b268f67d9 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -686,7 +686,7 @@ void SdrFormatter::Undirty()
 
 OUString SdrFormatter::GetStr(tools::Long nVal) const
 {
-    const OUString aNullCode("0");
+    static constexpr OUStringLiteral aNullCode(u"0");
 
     if(!nVal)
     {
@@ -753,7 +753,7 @@ OUString SdrFormatter::GetStr(tools::Long nVal) const
     {
         // insert comma char (decimal separator)
         // remove trailing zeros
-        while(nC > 0 && aStr[aStr.getLength() - 1] == aNullCode[0])
+        while(nC > 0 && aStr[aStr.getLength() - 1] == aNullCode.getStr()[0])
         {
             aStr.remove(aStr.getLength() - 1, 1);
             nC--;
@@ -787,7 +787,7 @@ OUString SdrFormatter::GetStr(tools::Long nVal) const
     if(aStr.isEmpty())
         aStr.append(aNullCode);
 
-    if(bNeg && (aStr.getLength() > 1 || aStr[0] != aNullCode[0]))
+    if(bNeg && (aStr.getLength() > 1 || aStr[0] != aNullCode.getStr()[0]))
     {
         aStr.insert(0, "-");
     }
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index a0345e712714..a5450d29b673 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -3971,11 +3971,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDateContentControl)
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testAuthorField)
 {
     SwXTextDocument* pXTextDocument = createDoc();
-    const OUString sAuthor("Abcd Xyz");
+    static constexpr OUStringLiteral sAuthor(u"Abcd Xyz");
 
     uno::Sequence<beans::PropertyValue> 
aPropertyValues1(comphelper::InitPropertySequence(
     {
-        {".uno:Author", uno::Any(sAuthor)},
+        {".uno:Author", uno::Any(OUString(sAuthor))},
     }));
     pXTextDocument->initializeForTiledRendering(aPropertyValues1);
 
@@ -4010,10 +4010,10 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testAuthorField)
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSavedAuthorField)
 {
     SwXTextDocument* pXTextDocument = createDoc("savedauthorfield.odt");
-    const OUString sAuthor("XYZ ABCD");
+    static constexpr OUStringLiteral sAuthor(u"XYZ ABCD");
     uno::Sequence<beans::PropertyValue> 
aPropertyValues1(comphelper::InitPropertySequence(
     {
-        {".uno:Author", uno::Any(sAuthor)},
+        {".uno:Author", uno::Any(OUString(sAuthor))},
     }));
     pXTextDocument->initializeForTiledRendering(aPropertyValues1);
 
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index dec2f5708470..80eecbaa5edd 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1440,7 +1440,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testInconsistentBookmark)
 
         // load only content.xml
         xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
-        const OString 
aPath("/office:document-content/office:body/office:text/text:p");
+        static constexpr OStringLiteral aPath(
+            "/office:document-content/office:body/office:text/text:p");
 
         const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
         const int pos2 = getXPathPosition(pXmlDoc, aPath, "control");
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 26805b281adc..498a89054880 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -1132,7 +1132,7 @@ std::optional<OUString> ReplaceBackReferences(const 
i18nutil::SearchOptions2& rS
             OUString aReplaceStr( rSearchOpt.replaceString );
             if (bParaEnd)
             {
-                OUString const aStr("\\n");
+                static constexpr OUStringLiteral aStr(u"\\n");
                 aResult.subRegExpressions = 1;
                 aResult.startOffset = { 0 };
                 aResult.endOffset = { aStr.getLength() };
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index e699072f37ac..8246db7f8492 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -247,7 +247,7 @@ void 
ScreenshotTest::processDialogBatchFile(std::u16string_view rFile)
     const OUString aURL(aDirectories.getURLFromSrc(rFile));
     SvFileStream aStream(aURL, StreamMode::READ);
     OString aNextUIFile;
-    const OString aComment("#");
+    static constexpr OStringLiteral aComment("#");
 
     while (aStream.ReadLine(aNextUIFile))
     {
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index a06e430c3586..52b3a8b4a341 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -681,10 +681,10 @@ void PropertySetRegistry::renamePropertySet( const 
OUString& rOldKey,
 
                         aOldValuesKey += "/";
 
-                        OUString const aHandleKey("/Handle");
-                        OUString const aValueKey("/Value");
-                        OUString const aStateKey("/State");
-                        OUString const aAttrKey("/Attributes");
+                        static constexpr OUStringLiteral 
aHandleKey(u"/Handle");
+                        static constexpr OUStringLiteral aValueKey(u"/Value");
+                        static constexpr OUStringLiteral aStateKey(u"/State");
+                        static constexpr OUStringLiteral 
aAttrKey(u"/Attributes");
 
                         for ( const OUString& rPropName : aElems )
                         {
diff --git a/unotools/source/config/fontcfg.cxx 
b/unotools/source/config/fontcfg.cxx
index beeba82030d0..26ceda82d5fa 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -994,11 +994,11 @@ void FontSubstConfiguration::readLocaleSubst( const 
OUString& rBcp47 ) const
     it->second.aSubstAttributes.reserve( nFonts );
 
     // strings for subst retrieval, construct only once
-    OUString const aSubstFontsStr     ( "SubstFonts" );
-    OUString const aSubstFontsMSStr   ( "SubstFontsMS" );
-    OUString const aSubstWeightStr    ( "FontWeight" );
-    OUString const aSubstWidthStr     ( "FontWidth" );
-    OUString const aSubstTypeStr      ( "FontType" );
+    static constexpr OUStringLiteral aSubstFontsStr  ( u"SubstFonts" );
+    static constexpr OUStringLiteral aSubstFontsMSStr( u"SubstFontsMS" );
+    static constexpr OUStringLiteral aSubstWeightStr ( u"FontWeight" );
+    static constexpr OUStringLiteral aSubstWidthStr  ( u"FontWidth" );
+    static constexpr OUStringLiteral aSubstTypeStr   ( u"FontType" );
     for( const OUString& rFontName : aFonts )
     {
         Reference< XNameAccess > xFont;
diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 4301c89bfadd..4d55b1bd91d5 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -518,7 +518,7 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, 
testImplLayoutArgs_PrepareFallback_precalculat
     ScopedVclPtrInstance<VirtualDevice> pVirDev;
     pVirDev->SetFont(aFont);
 
-    const OString sUTF8String(u8"Тхе яуицк\n ыумпед овер");
+    static constexpr OStringLiteral sUTF8String(u8"Тхе яуицк\n ыумпед овер");
     const OUString sTestString(OUString::fromUtf8(sUTF8String));
     std::unique_ptr<SalLayout> pLayout
         = pVirDev->ImplLayout(sTestString, 0, sTestString.getLength(), 
Point(0, 0), 0, {}, {},
diff --git a/vcl/source/filter/FilterConfigCache.cxx 
b/vcl/source/filter/FilterConfigCache.cxx
index 9f3668ccc5a6..fd3ce0cea8a7 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -119,13 +119,13 @@ static Reference< XInterface > openConfig(const char* 
sPackage)
 
 void FilterConfigCache::ImplInit()
 {
-    OUString const STYPE                ( "Type"                );
-    OUString const SUINAME              ( "UIName"              );
-    OUString const SFLAGS               ( "Flags"               );
-    OUString const SMEDIATYPE           ( "MediaType"           );
-    OUString const SEXTENSIONS          ( "Extensions"          );
-    OUString const SFORMATNAME          ( "FormatName"          );
-    OUString const SREALFILTERNAME      ( "RealFilterName"      );
+    static constexpr OUStringLiteral STYPE                ( u"Type"            
    );
+    static constexpr OUStringLiteral SUINAME              ( u"UIName"          
    );
+    static constexpr OUStringLiteral SFLAGS               ( u"Flags"           
    );
+    static constexpr OUStringLiteral SMEDIATYPE           ( u"MediaType"       
    );
+    static constexpr OUStringLiteral SEXTENSIONS          ( u"Extensions"      
    );
+    static constexpr OUStringLiteral SFORMATNAME          ( u"FormatName"      
    );
+    static constexpr OUStringLiteral SREALFILTERNAME      ( u"RealFilterName"  
    );
 
     // get access to config
     Reference< XNameAccess > xTypeAccess  ( openConfig("types"  ), UNO_QUERY );
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index be6375d10675..53d3d37b4e86 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -112,11 +112,11 @@ sal_uInt32 PDFDocument::GetNextSignature()
             continue;
 
         const OString& rValue = pT->GetValue();
-        const OString aPrefix = "Signature";
+        static constexpr std::string_view aPrefix = "Signature";
         if (!rValue.startsWith(aPrefix))
             continue;
 
-        nRet = std::max(nRet, 
o3tl::toUInt32(rValue.subView(aPrefix.getLength())));
+        nRet = std::max(nRet, o3tl::toUInt32(rValue.subView(aPrefix.size())));
     }
 
     return nRet + 1;
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx 
b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 3a7359df22e4..26d8100f7e2b 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -719,12 +719,12 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
     
xRelationshipAccess.set(dynamic_cast<OOXMLStreamImpl&>(*pStream).accessDocumentStream(),
 uno::UNO_QUERY);
     if (xRelationshipAccess.is())
     {
-        OUString const 
sChartType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";);
-        OUString const 
sChartTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/chart";);
-        OUString const 
sFootersType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";);
-        OUString const 
sFootersTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/footer";);
-        OUString const 
sHeaderType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";);
-        OUString const 
sHeaderTypeStrict("http://purl.oclc.org/ooxml/officeDocument/relationships/header";);
+        static constexpr OUStringLiteral 
sChartType(u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";);
+        static constexpr OUStringLiteral 
sChartTypeStrict(u"http://purl.oclc.org/ooxml/officeDocument/relationships/chart";);
+        static constexpr OUStringLiteral 
sFootersType(u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";);
+        static constexpr OUStringLiteral 
sFootersTypeStrict(u"http://purl.oclc.org/ooxml/officeDocument/relationships/footer";);
+        static constexpr OUStringLiteral 
sHeaderType(u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";);
+        static constexpr OUStringLiteral 
sHeaderTypeStrict(u"http://purl.oclc.org/ooxml/officeDocument/relationships/header";);
 
         bool bFound = false;
         bool bHeaderFooterFound = false;
diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx 
b/writerperfect/source/impress/KeynoteImportFilter.cxx
index ccd93e3d2aaa..abf7d21e4055 100644
--- a/writerperfect/source/impress/KeynoteImportFilter.cxx
+++ b/writerperfect/source/impress/KeynoteImportFilter.cxx
@@ -215,8 +215,8 @@ 
KeynoteImportFilter::detect(css::uno::Sequence<css::beans::PropertyValue>& Descr
     if (bUCBContentChanged)
         pDescriptor[nUCBContentLocation].Value <<= xContent;
 
-    const OUString sTypeName("impress_AppleKeynote");
-    pDescriptor[nTypeNameLocation].Value <<= sTypeName;
+    static constexpr OUStringLiteral sTypeName(u"impress_AppleKeynote");
+    pDescriptor[nTypeNameLocation].Value <<= OUString(sTypeName);
 
     return sTypeName;
 }
diff --git a/writerperfect/source/writer/EPUBPackage.cxx 
b/writerperfect/source/writer/EPUBPackage.cxx
index c08b60ad70ed..ba8bac1d91ce 100644
--- a/writerperfect/source/writer/EPUBPackage.cxx
+++ b/writerperfect/source/writer/EPUBPackage.cxx
@@ -43,7 +43,7 @@ 
EPUBPackage::EPUBPackage(uno::Reference<uno::XComponentContext> xContext,
     mxOutputStream.set(
         mxStorage->openStreamElementByHierarchicalName("mimetype", 
embed::ElementModes::READWRITE),
         uno::UNO_QUERY);
-    const OString aMimeType("application/epub+zip");
+    static constexpr OStringLiteral aMimeType("application/epub+zip");
     uno::Sequence<sal_Int8> aData(reinterpret_cast<const 
sal_Int8*>(aMimeType.getStr()),
                                   aMimeType.getLength());
     mxOutputStream->writeBytes(aData);
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 36e0a8454ebf..1202d797972e 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -866,7 +866,7 @@ uno::Sequence< OUString > SAL_CALL 
SvXMLExport::getSupportedServiceNames(  )
 OUString
 SvXMLExport::EnsureNamespace(OUString const & i_rNamespace)
 {
-    OUString const aPreferredPrefix("gen");
+    static constexpr OUStringLiteral aPreferredPrefix(u"gen");
     OUString sPrefix;
     sal_uInt16 nKey( GetNamespaceMap_().GetKeyByName( i_rNamespace ) );
     if( XML_NAMESPACE_UNKNOWN == nKey )
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 6e556ac84a31..ebeae2a62258 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -375,7 +375,7 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< 
uno::Any >& aArgumen
 {
     SvXMLImport::initialize( aArguments );
 
-    OUString const sOrganizerMode("OrganizerMode");
+    static constexpr OUStringLiteral sOrganizerMode(u"OrganizerMode");
     bool bStyleOnly(false);
 
     css::beans::PropertyValue aPropValue;
diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index a7f91d9326ef..70c95e31c055 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3524,20 +3524,21 @@ void XMLShapeExport::ImpExportMediaShape(
     auto pPluginOBJ = std::make_unique<SvXMLElementExport>(mrExport, 
XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & XMLShapeExportFlags::NO_WS ), 
true);
 
     // export parameters
-    const OUString aFalseStr(  "false"  ), aTrueStr(  "true"  );
+    static constexpr OUStringLiteral aFalseStr( u"false" );
+    static constexpr OUStringLiteral aTrueStr( u"true" );
 
     bool bLoop = false;
     static constexpr OUStringLiteral aLoopStr(  u"Loop"  );
     xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
     mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
-    mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : 
aFalseStr );
+    mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? 
OUString(aTrueStr) : OUString(aFalseStr) );
     delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, 
false, true );
 
     bool bMute = false;
     static constexpr OUStringLiteral aMuteStr(  u"Mute"  );
     xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
     mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
-    mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : 
aFalseStr );
+    mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? 
OUString(aTrueStr) : OUString(aFalseStr) );
     delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, 
false, true );
 
     sal_Int16 nVolumeDB = 0;
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx 
b/xmloff/source/text/XMLIndexTOCContext.cxx
index 85ea6ecf231f..2e3f1e3a475b 100644
--- a/xmloff/source/text/XMLIndexTOCContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -188,9 +188,9 @@ void XMLIndexTOCContext::startFastElement(
 
             // preliminaries
 #ifndef DBG_UTIL
-            OUString const sMarker(" ");
+            static constexpr OUStringLiteral sMarker(u" ");
 #else
-            OUString const sMarker("Y");
+            static constexpr OUStringLiteral sMarker(u"Y");
 #endif
             rtl::Reference<XMLTextImportHelper> rImport =
                 GetImport().GetTextImport();
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index bd21e35ad6a2..fa78300b730f 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -197,7 +197,7 @@ void XMLTextStyleContext::CreateAndInsert( bool bOverwrite )
     Reference< XPropertySetInfo > xPropSetInfo =
                 xPropSet->getPropertySetInfo();
 
-    OUString const sIsAutoUpdate("IsAutoUpdate");
+    static constexpr OUStringLiteral sIsAutoUpdate(u"IsAutoUpdate");
     if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
     {
         xPropSet->setPropertyValue( sIsAutoUpdate, Any(m_isAutoUpdate) );
@@ -264,7 +264,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
     Reference< XPropertySetInfo > xPropSetInfo =
                 xPropSet->getPropertySetInfo();
 
-    OUString const sOutlineLevel("OutlineLevel");
+    static constexpr OUStringLiteral sOutlineLevel(u"OutlineLevel");
     if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
     {
         if (m_nOutlineLevel >= 0)
@@ -274,7 +274,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
     }
 
     // Consider set empty list style (#i69523#)
-    OUString const sNumberingStyleName("NumberingStyleName");
+    static constexpr OUStringLiteral 
sNumberingStyleName(u"NumberingStyleName");
     if (m_bListStyleSet &&
          xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
     {
@@ -362,7 +362,7 @@ void XMLTextStyleContext::Finish( bool bOverwrite )
     const Reference < XNameContainer >& rPageStyles =
         GetImport().GetTextImport()->GetPageStyles();
 
-    OUString const sPageDescName("PageDescName");
+    static constexpr OUStringLiteral sPageDescName(u"PageDescName");
     if( ( sDisplayName.isEmpty() ||
           (rPageStyles.is() &&
            rPageStyles->hasByName( sDisplayName )) ) &&

Reply via email to