[Libreoffice-commits] core.git: chart2/source comphelper/source compilerplugins/clang cui/source dbaccess/source desktop/source extensions/source fpicker/source reportdesign/source sc/source sdext/source sd/source sfx2/source solenv/CompilerTest_compilerplugins_clang.mk starmath/source svl/source svx/source sw/source toolkit/source ucb/source vcl/source writerfilter/source xmloff/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 2 20:48:45 UTC 2019


 chart2/source/controller/main/ChartController_Window.cxx                   |    2 
 comphelper/source/misc/profilezone.cxx                                     |    2 
 compilerplugins/clang/conditionalstring.cxx                                |  462 ++++++++++
 compilerplugins/clang/test/conditionalstring.cxx                           |   30 
 cui/source/options/dbregister.cxx                                          |    2 
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx                     |    2 
 desktop/source/deployment/registry/component/dp_component.cxx              |    2 
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx                               |    2 
 extensions/source/propctrlr/formcomponenthandler.cxx                       |    6 
 extensions/source/propctrlr/selectlabeldialog.cxx                          |    4 
 fpicker/source/office/fileview.cxx                                         |    2 
 reportdesign/source/ui/inspection/DataProviderHandler.cxx                  |    4 
 reportdesign/source/ui/inspection/GeometryHandler.cxx                      |    4 
 reportdesign/source/ui/misc/RptUndo.cxx                                    |    4 
 sc/source/core/tool/interpr1.cxx                                           |    2 
 sc/source/filter/excel/xiescher.cxx                                        |    2 
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx                        |    4 
 sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx |    2 
 sdext/source/pdfimport/tree/drawtreevisiting.cxx                           |    2 
 sdext/source/pdfimport/tree/writertreevisiting.cxx                         |    4 
 sfx2/source/bastyp/helper.cxx                                              |    2 
 sfx2/source/control/unoctitm.cxx                                           |    4 
 solenv/CompilerTest_compilerplugins_clang.mk                               |    1 
 starmath/source/ooxmlimport.cxx                                            |    2 
 svl/source/items/flagitem.cxx                                              |    2 
 svl/source/items/visitem.cxx                                               |    2 
 svx/source/fmcomp/fmgridif.cxx                                             |    2 
 sw/source/filter/html/css1atr.cxx                                          |    8 
 sw/source/filter/html/htmlftn.cxx                                          |    2 
 sw/source/filter/ww8/ww8par3.cxx                                           |    2 
 sw/source/ui/index/cnttab.cxx                                              |    4 
 sw/source/uibase/envelp/labelcfg.cxx                                       |    2 
 sw/source/uibase/uiview/view.cxx                                           |    2 
 toolkit/source/controls/unocontrol.cxx                                     |    2 
 ucb/source/ucp/cmis/cmis_content.cxx                                       |    4 
 ucb/source/ucp/file/filglob.cxx                                            |    4 
 ucb/source/ucp/package/pkgcontent.cxx                                      |    4 
 ucb/source/ucp/package/pkguri.cxx                                          |    4 
 vcl/source/gdi/pdfwriter_impl.cxx                                          |    2 
 writerfilter/source/dmapper/TablePropertiesHandler.cxx                     |    2 
 writerfilter/source/rtftok/rtfdispatchflag.cxx                             |   10 
 xmloff/source/style/prstylei.cxx                                           |    4 
 xmloff/source/style/xmlstyle.cxx                                           |    2 
 43 files changed, 556 insertions(+), 61 deletions(-)

New commits:
commit 7f305223fa6d6a1ad4a6f906b14f879cb01539be
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Nov 2 19:52:33 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Nov 2 21:47:38 2019 +0100

    New loplugin:conditionalstring
    
    Change-Id: I2eab990c15f845b44a3b598571aca361dadf9ff3
    Reviewed-on: https://gerrit.libreoffice.org/81946
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 921a9b94beb5..0de22676121a 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1008,7 +1008,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
         OUString aMenuName;
         if ( isShapeContext() )
             // #i12587# support for shapes in chart
-            aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUString( "drawtext" ) : OUString( "draw" );
+            aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUStringLiteral( "drawtext" ) : OUStringLiteral( "draw" );
         else
         {
             // todo: the context menu should be specified by an xml file in uiconfig
diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx
index 72d9bcde06b9..ff76a4f35e8d 100644
--- a/comphelper/source/misc/profilezone.cxx
+++ b/comphelper/source/misc/profilezone.cxx
@@ -57,7 +57,7 @@ long long addRecording(const char * aProfileId, long long aCreateTime)
 
     OUString sRecordingData(OUString::number(osl_getThreadIdentifier(nullptr)) + " " +
         OUString::number(aTime/1000000.0) + " " + aString + ": " +
-        (aCreateTime == 0 ? OUString("start") : OUString("stop")) +
+        (aCreateTime == 0 ? OUStringLiteral("start") : OUStringLiteral("stop")) +
         (aCreateTime != 0 ? (" " + OUString::number((aTime - aCreateTime)/1000.0) + " ms") : OUString("")));
 
     ::osl::MutexGuard aGuard( g_aMutex );
diff --git a/compilerplugins/clang/conditionalstring.cxx b/compilerplugins/clang/conditionalstring.cxx
new file mode 100644
index 000000000000..d09472c25446
--- /dev/null
+++ b/compilerplugins/clang/conditionalstring.cxx
@@ -0,0 +1,462 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include <cassert>
+
+#include "check.hxx"
+#include "compat.hxx"
+#include "plugin.hxx"
+
+// Find uses of OUString in conditional expressions that could be rewritten as OUStringLiteral, as
+// in
+//
+//   s += (b ? OUString("xy") : OUString(z");
+
+namespace
+{
+// Like Expr::IgnoreImplicit, but for an ImplicitCastExpr skips to getSubExprAsWritten (so skips a
+// CXXConstructExpr where Expr::IgnoreImplicit would stop):
+Expr const* ignoreImplicit(Expr const* expr)
+{
+    for (auto e = expr;;)
+    {
+        if (auto const e1 = dyn_cast<ImplicitCastExpr>(e))
+        {
+            e = e1->getSubExprAsWritten();
+        }
+#if CLANG_VERSION >= 80000
+        else if (auto const e2 = dyn_cast<FullExpr>(e))
+        {
+            e = e2->getSubExpr();
+        }
+#endif
+        else if (auto const e3 = dyn_cast<MaterializeTemporaryExpr>(e))
+        {
+            e = e3->GetTemporaryExpr();
+        }
+        else if (auto const e4 = dyn_cast<CXXBindTemporaryExpr>(e))
+        {
+            e = e4->getSubExpr();
+        }
+        else
+        {
+            return e;
+        }
+    }
+}
+
+class ConditionalString final : public loplugin::FilteringPlugin<ConditionalString>
+{
+public:
+    explicit ConditionalString(loplugin::InstantiationData const& data)
+        : FilteringPlugin(data)
+    {
+    }
+
+    bool VisitCallExpr(CallExpr const* expr)
+    {
+        if (ignoreLocation(expr))
+        {
+            return true;
+        }
+        auto const fn = expr->getDirectCallee();
+        if (fn == nullptr)
+        {
+            return true;
+        }
+        //TODO: Instead of a hardcoded list of functions, check that `fn` has overloads taking
+        // OUString and OUStringLiteral, respectively (and operator + is even more complicated than
+        // that, going via ToStringHelper<OUStringLiteral> specialization; the getNumArgs checks for
+        // the various functions are meant to guard against the unlikely case that the affected
+        // parameters get defaulted in the future; overloaded operators cannot generally have
+        // defaulted parameters):
+        loplugin::DeclCheck const dc(fn);
+        if (dc.Operator(OO_Equal).Class("OUString").Namespace("rtl").GlobalNamespace())
+        {
+            assert(fn->getNumParams() == 1);
+            if (isa<CXXOperatorCallExpr>(expr))
+            {
+                assert(expr->getNumArgs() == 2);
+                check(expr->getArg(1));
+            }
+            else
+            {
+                assert(expr->getNumArgs() == 1);
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Operator(OO_PlusEqual).Class("OUString").Namespace("rtl").GlobalNamespace())
+        {
+            assert(fn->getNumParams() == 1);
+            if (isa<CXXOperatorCallExpr>(expr))
+            {
+                assert(expr->getNumArgs() == 2);
+                check(expr->getArg(1));
+            }
+            else
+            {
+                assert(expr->getNumArgs() == 1);
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("reverseCompareTo").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 1)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("equalsIgnoreAsciiCase")
+                .Class("OUString")
+                .Namespace("rtl")
+                .GlobalNamespace()
+            && fn->getNumParams() == 1)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("match").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("matchIgnoreAsciiCase").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("startsWith").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("startsWithIgnoreAsciiCase")
+                .Class("OUString")
+                .Namespace("rtl")
+                .GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("endsWith").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("endsWithIgnoreAsciiCase")
+                .Class("OUString")
+                .Namespace("rtl")
+                .GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Operator(OO_EqualEqual)
+                .Namespace("rtl")
+                .GlobalNamespace()) //TODO: more precicse check
+        {
+            assert(fn->getNumParams() == 2);
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Operator(OO_ExclaimEqual)
+                .Namespace("rtl")
+                .GlobalNamespace()) //TODO: more precicse check
+        {
+            assert(fn->getNumParams() == 2);
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Operator(OO_Less).Namespace("rtl").GlobalNamespace()) //TODO: more precicse check
+        {
+            assert(fn->getNumParams() == 2);
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Operator(OO_LessEqual)
+                .Namespace("rtl")
+                .GlobalNamespace()) //TODO: more precicse check
+        {
+            assert(fn->getNumParams() == 2);
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Operator(OO_Greater).Namespace("rtl").GlobalNamespace()) //TODO: more precicse check
+        {
+            assert(fn->getNumParams() == 2);
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Operator(OO_GreaterEqual)
+                .Namespace("rtl")
+                .GlobalNamespace()) //TODO: more precicse check
+        {
+            assert(fn->getNumParams() == 2);
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Function("indexOf").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("lastIndexOf").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 1)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("replaceFirst").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 3)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            if (expr->getNumArgs() >= 2)
+            {
+                check(expr->getArg(1));
+            }
+            return true;
+        }
+        if (dc.Function("replaceAll").Class("OUString").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            if (expr->getNumArgs() >= 2)
+            {
+                check(expr->getArg(1));
+            }
+            return true;
+        }
+        if (dc.Operator(OO_Plus).Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2) //TODO: more precicse check
+        {
+            assert(expr->getNumArgs() == 2);
+            check(expr->getArg(0));
+            check(expr->getArg(1));
+            return true;
+        }
+        if (dc.Operator(OO_Equal).Class("OUStringBuffer").Namespace("rtl").GlobalNamespace())
+        {
+            assert(fn->getNumParams() == 1);
+            if (isa<CXXOperatorCallExpr>(expr))
+            {
+                assert(expr->getNumArgs() == 2);
+                check(expr->getArg(1));
+            }
+            else
+            {
+                assert(expr->getNumArgs() == 1);
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("append").Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 1)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("insert").Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 2)
+            {
+                check(expr->getArg(1));
+            }
+            return true;
+        }
+        if (dc.Function("indexOf").Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 2)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        if (dc.Function("lastIndexOf").Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
+            && fn->getNumParams() == 1)
+        {
+            if (expr->getNumArgs() >= 1)
+            {
+                check(expr->getArg(0));
+            }
+            return true;
+        }
+        return true;
+    }
+
+    bool preRun() override { return compiler.getLangOpts().CPlusPlus; }
+
+private:
+    enum class Kind
+    {
+        OUStringFromLiteral,
+        OUStringLiteralOrVoid,
+        Other
+    };
+
+    void run() override
+    {
+        if (preRun())
+        {
+            TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+        }
+    }
+
+    Kind getKind(Expr const* expr)
+    {
+        auto const tc = loplugin::TypeCheck(ignoreImplicit(expr)->getType());
+        if (tc.Struct("OUStringLiteral").Namespace("rtl").GlobalNamespace() || tc.Void())
+        {
+            return Kind::OUStringLiteralOrVoid;
+        }
+        if (loplugin::TypeCheck(expr->getType())
+                .Class("OUString")
+                .Namespace("rtl")
+                .GlobalNamespace())
+        {
+            // Check for both explicit
+            //
+            //   OUString("...")
+            //
+            // and implicit
+            //
+            //    "..."
+            //
+            // expressions:
+            auto e = expr->IgnoreParens();
+            if (auto const e1 = dyn_cast<CXXFunctionalCastExpr>(e))
+            {
+                e = e1->getSubExpr();
+            }
+            if (auto const e1
+                = dyn_cast<CXXConstructExpr>(compat::IgnoreImplicit(e)->IgnoreParens()))
+            {
+                if (e1->getNumArgs() != 0 //TODO
+                    && isa<clang::StringLiteral>(e1->getArg(0)->IgnoreParenImpCasts()))
+                {
+                    return Kind::OUStringFromLiteral;
+                }
+            }
+        }
+        return Kind::Other;
+    }
+
+    void check(Expr const* expr)
+    {
+        //TODO: skip `,`; handle ?: chains
+        auto const cond = dyn_cast<ConditionalOperator>(expr->IgnoreParenImpCasts());
+        if (cond == nullptr)
+        {
+            return;
+        }
+        auto const k1 = getKind(cond->getTrueExpr());
+        if (k1 == Kind::Other)
+        {
+            return;
+        }
+        auto const k2 = getKind(cond->getFalseExpr());
+        if (k2 == Kind::Other
+            || (k1 == Kind::OUStringLiteralOrVoid && k2 == Kind::OUStringLiteralOrVoid))
+        {
+            return;
+        }
+        if (k1 == Kind::OUStringFromLiteral && k2 == Kind::OUStringFromLiteral)
+        {
+            report(DiagnosticsEngine::Warning,
+                   ("replace both 2nd and 3rd operands of conditional expression with"
+                    " `rtl::OUStringLiteral`"),
+                   cond->getExprLoc())
+                << cond->getSourceRange();
+        }
+        else
+        {
+            assert((k1 == Kind::OUStringFromLiteral && k2 == Kind::OUStringLiteralOrVoid)
+                   || (k1 == Kind::OUStringLiteralOrVoid && k2 == Kind::OUStringFromLiteral));
+            auto const second = k1 == Kind::OUStringFromLiteral;
+            auto const sub
+                = (second ? cond->getTrueExpr() : cond->getFalseExpr())->IgnoreParenImpCasts();
+            report(DiagnosticsEngine::Warning,
+                   ("replace %select{2nd|3rd}0 operand of conditional expression with"
+                    " `rtl::OUStringLiteral`"),
+                   sub->getExprLoc())
+                << (second ? 0 : 1) << sub->getSourceRange();
+            report(DiagnosticsEngine::Note, "conditional expression is here", cond->getExprLoc())
+                << cond->getSourceRange();
+        }
+    }
+};
+
+loplugin::Plugin::Registration<ConditionalString> conditionalstring("conditionalstring");
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/conditionalstring.cxx b/compilerplugins/clang/test/conditionalstring.cxx
new file mode 100644
index 000000000000..e10b02519f8e
--- /dev/null
+++ b/compilerplugins/clang/test/conditionalstring.cxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <rtl/ustring.hxx>
+
+void f(OUString s, bool b)
+{
+    // expected-error at +2 {{replace 2nd operand of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}}
+    // expected-note at +1 {{conditional expression is here [loplugin:conditionalstring]}}
+    s += (b ? OUString("a") : throw 0);
+    // expected-error at +2 {{replace 2nd operand of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}}
+    // expected-note at +1 {{conditional expression is here [loplugin:conditionalstring]}}
+    s += (b ? OUString("a") : OUStringLiteral("b"));
+    // expected-error at +1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}}
+    b = (b ? ("x") : (OUString(("y")))) == s;
+    // expected-error at +1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}}
+    b = operator==(s, b ? OUString("x") : OUString("y"));
+    // expected-error at +1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}}
+    s.operator+=(b ? OUString("x") : OUString("y"));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 171e3f869ecc..24df2e4930c6 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -183,7 +183,7 @@ void DbRegistrationOptionsPage::FillUserData()
 {
     OUString aUserData = OUString::number( m_xPathBox->get_column_width(COL_TYPE) ) + ";";
     bool bUp = m_xPathBox->get_sort_order();
-    aUserData += (bUp ? OUString("1") : OUString("0"));
+    aUserData += (bUp ? OUStringLiteral("1") : OUStringLiteral("0"));
     SetUserData( aUserData );
 }
 
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 9dda10cfcecb..7a8f2d9cc8b3 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1729,7 +1729,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
         if ( !sFilter.isEmpty() && !aSQL.isEmpty() )
         {
             OUString sTemp(L_BRACKET + sFilter + R_BRACKET);
-            sTemp += andCriteria ? OUString(STR_AND) : OUString(STR_OR);
+            sTemp += andCriteria ? OUStringLiteral(STR_AND) : OUStringLiteral(STR_OR);
             sFilter = sTemp;
         }
         sFilter += aSQL;
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index cfecf6927496..064fd9645f2f 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -423,7 +423,7 @@ void BackendImpl::initServiceRdbFiles()
             &oldRDB, makeURL( getCachePath(), m_commonRDB_orig),
             xCmdEnv, false /* no throw */ );
     }
-    m_commonRDB = m_commonRDB_orig == "common.rdb" ? OUString("common_.rdb") : OUString("common.rdb");
+    m_commonRDB = m_commonRDB_orig == "common.rdb" ? OUStringLiteral("common_.rdb") : OUStringLiteral("common.rdb");
     if (oldRDB.get().is())
     {
         cacheDir.transferContent(
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index aea709bc8c6e..a76ea7dc5fc0 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -262,7 +262,7 @@ void printf_package(
         if (reg.IsAmbiguous)
             value = "unknown";
         else
-            value = reg.Value ? OUString("yes") : OUString("no");
+            value = reg.Value ? OUStringLiteral("yes") : OUStringLiteral("no");
     }
     else
         value = "n/a";
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 3983d241ea72..7feca01b5a55 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -997,8 +997,8 @@ namespace pcr
             aDescriptor.Control = new OFileUrlControl( impl_getDefaultDialogParent_nothrow() );
 
             aDescriptor.PrimaryButtonId = PROPERTY_ID_TARGET_URL == nPropId
-                ? OUString(UID_PROP_DLG_ATTR_TARGET_URL)
-                : OUString(UID_PROP_DLG_IMAGE_URL);
+                ? OUStringLiteral(UID_PROP_DLG_ATTR_TARGET_URL)
+                : OUStringLiteral(UID_PROP_DLG_IMAGE_URL);
         }
         break;
 
@@ -1371,7 +1371,7 @@ namespace pcr
             aDescriptor.HasSecondaryButton = true;
 
         bool bIsDataProperty = ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0;
-        aDescriptor.Category = bIsDataProperty ? OUString("Data") : OUString("General");
+        aDescriptor.Category = bIsDataProperty ? OUStringLiteral("Data") : OUStringLiteral("General");
         return aDescriptor;
     }
 
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx
index e1aee794cc63..2f963ea81c5c 100644
--- a/extensions/source/propctrlr/selectlabeldialog.cxx
+++ b/extensions/source/propctrlr/selectlabeldialog.cxx
@@ -88,8 +88,8 @@ namespace pcr
             // check which service the allowed components must support
             sal_Int16 nClassId = 0;
             try { nClassId = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); } catch(...) { }
-            m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? OUString(SERVICE_COMPONENT_GROUPBOX) : OUString(SERVICE_COMPONENT_FIXEDTEXT);
-            m_aRequiredControlImage = (FormComponentType::RADIOBUTTON == nClassId) ? OUString(RID_EXTBMP_GROUPBOX) : OUString(RID_EXTBMP_FIXEDTEXT);
+            m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? OUStringLiteral(SERVICE_COMPONENT_GROUPBOX) : OUStringLiteral(SERVICE_COMPONENT_FIXEDTEXT);
+            m_aRequiredControlImage = (FormComponentType::RADIOBUTTON == nClassId) ? OUStringLiteral(RID_EXTBMP_GROUPBOX) : OUStringLiteral(RID_EXTBMP_FIXEDTEXT);
 
             // calc the currently set label control (so InsertEntries can calc m_xInitialSelection)
             Any aCurrentLabelControl( m_xControlModel->getPropertyValue(PROPERTY_CONTROLLABEL) );
diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx
index 127a8800be52..671e75a6e2d1 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -1055,7 +1055,7 @@ OUString SvtFileView::GetConfigString() const
     OUString sRet = OUString::number( mpImpl->mnSortColumn ) + ";";
 
     bool bUp = mpImpl->mbAscending;
-    sRet += (bUp ? OUString("1") : OUString("0")) + ";";
+    sRet += (bUp ? OUStringLiteral("1") : OUStringLiteral("0")) + ";";
 
     weld::TreeView* pView = mpImpl->mxView->getWidget();
     sal_uInt16 nCount = mpImpl->mxView->TypeColumnVisible() ? 4 : 3;
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
index 6688bce10052..90123eef170e 100644
--- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -282,9 +282,9 @@ inspection::LineDescriptor SAL_CALL DataProviderHandler::describePropertyLine(co
     if ( nId != -1 )
     {
         aOut.Category = (OPropertyInfoService::getPropertyUIFlags(nId ) & PropUIFlags::DataProperty) ?
-                                    OUString("Data")
+                                    OUStringLiteral("Data")
                                                         :
-                                    OUString("General");
+                                    OUStringLiteral("General");
         aOut.HelpURL = HelpIdUrl::getHelpURL( OPropertyInfoService::getPropertyHelpId( nId ) );
         aOut.DisplayName = OPropertyInfoService::getPropertyTranslation(nId);
     }
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index eaf9d679f509..35dd83e3c717 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -843,9 +843,9 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
     if ( nId != -1 )
     {
         aOut.Category = (OPropertyInfoService::getPropertyUIFlags(nId ) & PropUIFlags::DataProperty) ?
-                                    OUString("Data")
+                                    OUStringLiteral("Data")
                                                         :
-                                    OUString("General");
+                                    OUStringLiteral("General");
         aOut.HelpURL = HelpIdUrl::getHelpURL( OPropertyInfoService::getPropertyHelpId( nId ) );
         aOut.DisplayName = OPropertyInfoService::getPropertyTranslation(nId);
     }
diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx
index 121f8e76d3be..3320dc18b92a 100644
--- a/reportdesign/source/ui/misc/RptUndo.cxx
+++ b/reportdesign/source/ui/misc/RptUndo.cxx
@@ -284,7 +284,7 @@ void OGroupSectionUndo::implReInsert( )
 {
     uno::Sequence< beans::PropertyValue > aArgs(2);
 
-    aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? OUString(PROPERTY_HEADERON) : OUString(PROPERTY_FOOTERON);
+    aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? OUStringLiteral(PROPERTY_HEADERON) : OUStringLiteral(PROPERTY_FOOTERON);
     aArgs[0].Value <<= true;
     aArgs[1].Name = PROPERTY_GROUP;
     aArgs[1].Value <<= m_aGroupHelper.getGroup();
@@ -303,7 +303,7 @@ void OGroupSectionUndo::implReRemove( )
 
     uno::Sequence< beans::PropertyValue > aArgs(2);
 
-    aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? OUString(PROPERTY_HEADERON) : OUString(PROPERTY_FOOTERON);
+    aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? OUStringLiteral(PROPERTY_HEADERON) : OUStringLiteral(PROPERTY_FOOTERON);
     aArgs[0].Value <<= false;
     aArgs[1].Name = PROPERTY_GROUP;
     aArgs[1].Value <<= m_aGroupHelper.getGroup();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 9b907f429688..151247180655 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8309,7 +8309,7 @@ void ScInterpreter::ScAddressFunc()
         if (!aDoc.isEmpty())
             sTabStr = aDoc + sTabStr;
         sTabStr += (eConv == FormulaGrammar::CONV_XL_R1C1 || eConv == FormulaGrammar::CONV_XL_A1) ?
-            OUString("!") : OUString(".");
+            OUStringLiteral("!") : OUStringLiteral(".");
         sTabStr += aRefStr;
         PushString( sTabStr );
     }
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 6e6567163ab3..fe59a3495ba4 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -2915,7 +2915,7 @@ OUString XclImpPictureObj::GetOleStorageName() const
     OUStringBuffer aStrgName;
     if( (mbEmbedded || mbLinked) && !mbControl && (mnStorageId > 0) )
     {
-        aStrgName = mbEmbedded ? OUString(EXC_STORAGE_OLE_EMBEDDED) : OUString(EXC_STORAGE_OLE_LINKED);
+        aStrgName = mbEmbedded ? OUStringLiteral(EXC_STORAGE_OLE_EMBEDDED) : OUStringLiteral(EXC_STORAGE_OLE_LINKED);
         static const sal_Char spcHexChars[] = "0123456789ABCDEF";
         for( sal_uInt8 nIndex = 32; nIndex > 0; nIndex -= 4 )
             aStrgName.append(OUStringChar( spcHexChars[ ::extract_value< sal_uInt8 >( mnStorageId, nIndex - 4, 4 ) ] ));
diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
index ce7208155a76..4441f041e3ef 100644
--- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
@@ -362,7 +362,7 @@ void ScRegressionDialog::WriteRawRegressionResults(AddressWalkerWriter& rOutput,
 
     rTemplate.setTemplate(constTemplateLINEST[nRegressionIndex].
                           replaceFirst("%CALC_INTERCEPT%",
-                                       mbCalcIntercept ? OUString("TRUE") : OUString("FALSE")));
+                                       mbCalcIntercept ? OUStringLiteral("TRUE") : OUStringLiteral("FALSE")));
     rOutput.writeMatrixFormula(rTemplate.getTemplate(), 1 + mnNumIndependentVars, 5);
     // Add LINEST result components to template
     // 1. Add ranges for coefficients and standard errors for indep. vars and the intercept.
@@ -408,7 +408,7 @@ void ScRegressionDialog::WriteRegressionStatistics(AddressWalkerWriter& rOutput,
         "=" + OUString::number(mnNumIndependentVars),
         "=" + OUString::number(mnNumObservations),
         "=1 - (1 - %RSQUARED_ADDR%)*(%NUMOBS_ADDR% - 1)/(%NUMOBS_ADDR% - %NUMXVARS_ADDR%" +
-            (mbCalcIntercept ? OUString(" - 1)") : OUString(")"))
+            (mbCalcIntercept ? OUStringLiteral(" - 1)") : OUStringLiteral(")"))
     };
 
     rTemplate.autoReplaceAddress("%NUMXVARS_ADDR%", rOutput.current(1, 2));
diff --git a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx
index fc9043270343..77b89df058e5 100644
--- a/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx
+++ b/sd/source/ui/framework/configuration/GenericConfigurationChangeRequest.cxx
@@ -63,7 +63,7 @@ void SAL_CALL GenericConfigurationChangeRequest::execute (
 OUString SAL_CALL GenericConfigurationChangeRequest::getName()
 {
     return "GenericConfigurationChangeRequest "
-        + (meMode==Activation ? OUString("activate ") : OUString("deactivate "))
+        + (meMode==Activation ? OUStringLiteral("activate ") : OUStringLiteral("deactivate "))
         + FrameworkHelper::ResourceIdToString(mxResourceId);
 }
 
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index f4376d41af25..e5037c60944f 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -1035,7 +1035,7 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_pt
     aPageLayoutProps[ "fo:margin-right" ]   =  unitMMString( right_margin );
     aPageLayoutProps[ "fo:page-width" ]     =  unitMMString( page_width );
     aPageLayoutProps[ "fo:page-height" ]    =  unitMMString( page_height );
-    aPageLayoutProps[ "style:print-orientation" ]= elem.w < elem.h ? OUString("portrait") : OUString("landscape");
+    aPageLayoutProps[ "style:print-orientation" ]= elem.w < elem.h ? OUStringLiteral("portrait") : OUStringLiteral("landscape");
     aPageLayoutProps[ "style:writing-mode" ]= "lr-tb";
 
     StyleContainer::Style aStyle( "style:page-layout", aPageProps);
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 00cbad2ac47c..b6396885704f 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -126,7 +126,7 @@ void WriterXmlEmitter::fillFrameProps( DrawElement&       rElem,
         if (pParaElt)
         {
             rProps[ "text:anchor-type" ] = rElem.isCharacter
-                ? OUString("character") : OUString("paragraph");
+                ? OUStringLiteral("character") : OUStringLiteral("paragraph");
         }
         else
         {
@@ -1160,7 +1160,7 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_
     aPageLayoutProps[ "fo:page-width" ]     = unitMMString( page_width );
     aPageLayoutProps[ "fo:page-height" ]    = unitMMString( page_height );
     aPageLayoutProps[ "style:print-orientation" ]
-        = elem.w < elem.h ? OUString("portrait") : OUString("landscape");
+        = elem.w < elem.h ? OUStringLiteral("portrait") : OUStringLiteral("landscape");
     aPageLayoutProps[ "fo:margin-top" ]     = unitMMString( top_margin );
     aPageLayoutProps[ "fo:margin-bottom" ]  = unitMMString( bottom_margin );
     aPageLayoutProps[ "fo:margin-left" ]    = unitMMString( left_margin );
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx
index d549ab6c0d42..6c357ddcc6c8 100644
--- a/sfx2/source/bastyp/helper.cxx
+++ b/sfx2/source/bastyp/helper.cxx
@@ -158,7 +158,7 @@ std::vector< OUString > SfxContentHelper::GetHelpTreeViewContents( const OUStrin
                     bool bFolder = xRow->getBoolean(2);
                     OUString aRow = aTitle + "\t";
                     aRow += xContentAccess->queryContentIdentifierString() + "\t";
-                    aRow += bFolder ? OUString("1") : OUString("0");
+                    aRow += bFolder ? OUStringLiteral("1") : OUStringLiteral("0");
                     aProperties.push_back( aRow );
                 }
             }
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 3cc88838a489..f8e1b2821b6b 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1050,7 +1050,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
         }
         else
         {
-            aBuffer.append(aEvent.IsEnabled ? OUString("enabled") : OUString("disabled"));
+            aBuffer.append(aEvent.IsEnabled ? OUStringLiteral("enabled") : OUStringLiteral("disabled"));
         }
     }
     else if (aEvent.FeatureURL.Path == "Cut" ||
@@ -1090,7 +1090,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
              aEvent.FeatureURL.Path == "ThesaurusDialog")
 
     {
-        aBuffer.append(aEvent.IsEnabled ? OUString("enabled") : OUString("disabled"));
+        aBuffer.append(aEvent.IsEnabled ? OUStringLiteral("enabled") : OUStringLiteral("disabled"));
     }
     else if (aEvent.FeatureURL.Path == "AssignLayout" ||
              aEvent.FeatureURL.Path == "StatusSelectionMode" ||
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index 27144e953407..9f3c7310657e 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/classmemaccess \
     compilerplugins/clang/test/collapseif \
     compilerplugins/clang/test/commaoperator \
+    compilerplugins/clang/test/conditionalstring \
     $(if $(filter-out WNT,$(OS)),compilerplugins/clang/test/constfields) \
     compilerplugins/clang/test/constparams \
     compilerplugins/clang/test/constmethod \
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index 7ed692b432f4..f0913f157078 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -436,7 +436,7 @@ OUString SmOoxmlImport::handleLimLowUpp( LimLowUpp_t limlowupp )
     if( limlowupp == LimLow && e.endsWith( " underbrace { }" ))
         return e.copy( 0, e.getLength() - 2 ) + lim + "}";
     return e
-        + ( limlowupp == LimLow ? OUString( " csub {" ) : OUString( " csup {" ))
+        + ( limlowupp == LimLow ? OUStringLiteral( " csub {" ) : OUStringLiteral( " csup {" ))
         + lim + "}";
 }
 
diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx
index fb2732a56a67..33a28718ba90 100644
--- a/svl/source/items/flagitem.cxx
+++ b/svl/source/items/flagitem.cxx
@@ -41,7 +41,7 @@ bool SfxFlagItem::GetPresentation
 {
     rText.clear();
     for ( sal_uInt8 nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
-        rText += GetFlag(nFlag) ? OUString("true") : OUString("false");
+        rText += GetFlag(nFlag) ? OUStringLiteral("true") : OUStringLiteral("false");
     return true;
 }
 
diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx
index ae821abcd5b5..515572de7913 100644
--- a/svl/source/items/visitem.cxx
+++ b/svl/source/items/visitem.cxx
@@ -36,7 +36,7 @@ bool SfxVisibilityItem::GetPresentation(SfxItemPresentation,
                                         OUString & rText,
                                         const IntlWrapper&) const
 {
-    rText = m_nValue.bVisible ? OUString("TRUE") : OUString("FALSE");
+    rText = m_nValue.bVisible ? OUStringLiteral("TRUE") : OUStringLiteral("FALSE");
     return true;
 }
 
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 80d4bee1aca9..d5adc465855f 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -743,7 +743,7 @@ void SAL_CALL FmXGridControl::setDesignMode(sal_Bool bOn)
 
         // prepare firing an event
         aModeChangeEvent.Source = *this;
-        aModeChangeEvent.NewMode = mbDesignMode ? OUString( "design" ) : OUString( "alive" );
+        aModeChangeEvent.NewMode = mbDesignMode ? OUStringLiteral( "design" ) : OUStringLiteral( "alive" );
     }
 
     // --- </mutex_lock> ---
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 8a894fe58701..62b0071e13c3 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -1742,8 +1742,8 @@ static Writer& OutCSS1_SwFootnoteInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
     if( bHasNotes )
     {
         aSelector = OOO_STRING_SVTOOLS_HTML_anchor "." +
-                    ( bEndNote ? OUString(OOO_STRING_SVTOOLS_HTML_sdendnote_anc)
-                               : OUString(OOO_STRING_SVTOOLS_HTML_sdfootnote_anc) );
+                    ( bEndNote ? OUStringLiteral(OOO_STRING_SVTOOLS_HTML_sdendnote_anc)
+                               : OUStringLiteral(OOO_STRING_SVTOOLS_HTML_sdfootnote_anc) );
         SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
                              &aSelector );
         rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size,
@@ -1773,8 +1773,8 @@ static Writer& OutCSS1_SwFootnoteInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
         if( aItemSet.Count() )
         {
             aSelector = OOO_STRING_SVTOOLS_HTML_anchor "." +
-                        ( bEndNote ? OUString(OOO_STRING_SVTOOLS_HTML_sdendnote_sym)
-                                   : OUString(OOO_STRING_SVTOOLS_HTML_sdfootnote_sym));
+                        ( bEndNote ? OUStringLiteral(OOO_STRING_SVTOOLS_HTML_sdendnote_sym)
+                                   : OUStringLiteral(OOO_STRING_SVTOOLS_HTML_sdfootnote_sym));
             if( OutCSS1Rule( rHTMLWrt, aSelector, aItemSet, true, false ))
                 rHTMLWrt.m_aScriptTextStyles.insert( pSymCharFormat->GetName() );
         }
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index 11bd6556e387..4e58dc4a3e27 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -534,7 +534,7 @@ void SwHTMLWriter::OutFootEndNoteInfo()
         int nParts = lcl_html_fillEndNoteInfo( rInfo, aParts, false );
         if( rInfo.eNum != FTNNUM_DOC )
         {
-            aParts[4] = rInfo.eNum == FTNNUM_CHAPTER ? OUString( "C" ) : OUString( "P" );
+            aParts[4] = rInfo.eNum == FTNNUM_CHAPTER ? OUStringLiteral( "C" ) : OUStringLiteral( "P" );
             nParts = 5;
         }
         if( rInfo.ePos != FTNPOS_PAGE)
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index e62e13f6572d..c07da7e81efb 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2168,7 +2168,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich,
         {
             if ( iRes != 25 )
                 mnChecked = iRes;
-            msDefault = ( wDef == 0 ) ? OUString( "0" ) :  OUString( "1" );
+            msDefault = ( wDef == 0 ) ? OUStringLiteral( "0" ) :  OUStringLiteral( "1" );
         }
     }
     // xstzTextFormat
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 6873180815ea..0238c3138638 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3852,8 +3852,8 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
                          pEntry->sAlternative + ";" +
                          pEntry->sPrimKey  + ";" +
                          pEntry->sSecKey + ";" +
-                         (pEntry->bCase ? OUString("1") : OUString("0")) + ";" +
-                         (pEntry->bWord ? OUString("1") : OUString("0")) );
+                         (pEntry->bCase ? OUStringLiteral("1") : OUStringLiteral("0")) + ";" +
+                         (pEntry->bWord ? OUStringLiteral("1") : OUStringLiteral("0")) );
 
         if( sWrite.getLength() > 5 )
             rOutStr.WriteByteStringLine( sWrite, eTEnc );
diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx
index 29585f463fda..b2b7d743a7da 100644
--- a/sw/source/uibase/envelp/labelcfg.cxx
+++ b/sw/source/uibase/envelp/labelcfg.cxx
@@ -227,7 +227,7 @@ static Sequence<PropertyValue> lcl_CreateProperties(
             case 1:
             {
                 rMeasure.clear();
-                rMeasure += rRec.m_bCont ? OUString( "C" ) : OUString( "S" );      rMeasure += sColon;
+                rMeasure += rRec.m_bCont ? OUStringLiteral( "C" ) : OUStringLiteral( "S" );      rMeasure += sColon;
                 rMeasure += OUString::number( convertTwipToMm100( rRec.m_nHDist ) );   rMeasure += sColon;
                 rMeasure += OUString::number( convertTwipToMm100( rRec.m_nVDist ) );   rMeasure += sColon;
                 rMeasure += OUString::number( convertTwipToMm100( rRec.m_nWidth ) );   rMeasure += sColon;
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 4f25d13563f4..ba17271dfd6d 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1158,7 +1158,7 @@ void SwView::WriteUserData( OUString &rUserData, bool bBrowse )
     rUserData += OUString::number(
             static_cast<sal_uInt16>(m_pWrtShell->GetViewOptions()->GetZoomType()));//eZoom;
     rUserData += ";";
-    rUserData += FrameTypeFlags::NONE == m_pWrtShell->GetSelFrameType() ? OUString("0") : OUString("1");
+    rUserData += FrameTypeFlags::NONE == m_pWrtShell->GetSelFrameType() ? OUStringLiteral("0") : OUStringLiteral("1");
 }
 
 // Set CursorPos
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index c5c9450a6eb4..9aa4a5e22277 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1386,7 +1386,7 @@ void UnoControl::setDesignMode( sal_Bool bOn )
         maAccessibleContext.clear();
 
         aModeChangeEvent.Source = *this;
-        aModeChangeEvent.NewMode = mbDesignMode ? OUString("design") : OUString("alive" );
+        aModeChangeEvent.NewMode = mbDesignMode ? OUStringLiteral("design") : OUStringLiteral("alive" );
     }
 
     // dispose current AccessibleContext, if we have one - without Mutex lock
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 7d146a52bbaf..c9fdfe8c6552 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1715,8 +1715,8 @@ namespace cmis
         try
         {
             sRet = isFolder( uno::Reference< ucb::XCommandEnvironment >() )
-                ? OUString(CMIS_FOLDER_TYPE)
-                : OUString(CMIS_FILE_TYPE);
+                ? OUStringLiteral(CMIS_FOLDER_TYPE)
+                : OUStringLiteral(CMIS_FILE_TYPE);
         }
         catch (const uno::RuntimeException&)
         {
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 18610efd92ba..15277a2bc8bd 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -498,8 +498,8 @@ namespace fileaccess {
             Sequence< OUString > aSeq( 1 );
             aSeq[0] =
                 ( errorCode == TASKHANDLING_NONAMESET_INSERT_COMMAND )  ?
-                OUString("Title")               :
-                OUString("ContentType");
+                OUStringLiteral("Title")               :
+                OUStringLiteral("ContentType");
 
             aAny <<= MissingPropertiesException(
                 "a property is missing, necessary to create a content",
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index 08e5129b1cfb..19f2017716bb 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -224,8 +224,8 @@ OUString Content::getContentType(
     return ( "application/"
              + aScheme
              + ( bFolder
-                 ? OUString("-folder")
-                 : OUString("-stream") ) );
+                 ? OUStringLiteral("-folder")
+                 : OUStringLiteral("-stream") ) );
 }
 
 
diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx
index d259448cdf07..d1f530d4634d 100644
--- a/ucb/source/ucp/package/pkguri.cxx
+++ b/ucb/source/ucp/package/pkguri.cxx
@@ -109,8 +109,8 @@ void PackageUri::init() const
         {
             m_aParam +=
                 ( !m_aParam.isEmpty()
-                  ? OUString( "&purezip" )
-                  : OUString( "?purezip" ) );
+                  ? OUStringLiteral( "&purezip" )
+                  : OUStringLiteral( "?purezip" ) );
         }
 
         aPureUri = aPureUri.replaceAt( 0,
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 52fa15422494..231872b72c45 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11178,7 +11178,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
             rNewWidget.m_nTextStyle =
                 DrawTextFlags::VCenter | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak;
 
-        rNewWidget.m_aValue = rBox.Checked ? OUString("Yes") : OUString("Off" );
+        rNewWidget.m_aValue = rBox.Checked ? OUStringLiteral("Yes") : OUStringLiteral("Off" );
         // create default appearance before m_aRect gets transformed
         createDefaultCheckBoxAppearance( rNewWidget, rBox );
     }
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index 837b0b101b8c..2ae01bdeb742 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -354,7 +354,7 @@ namespace dmapper {
                     if (m_pCurrentInteropGrabBag)
                     {
                         beans::PropertyValue aValue;
-                        aValue.Name = (nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize ? OUString("tblStyleRowBandSize") : OUString("tblStyleColBandSize"));
+                        aValue.Name = (nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize ? OUStringLiteral("tblStyleRowBandSize") : OUStringLiteral("tblStyleColBandSize"));
                         aValue.Value <<= nIntValue;
                         m_pCurrentInteropGrabBag->push_back(aValue);
                     }
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index b8f2ad826862..c5c5a4b47267 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1040,8 +1040,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         case RTF_DOBYMARGIN:
         {
             beans::PropertyValue aPropertyValue;
-            aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation")
-                                                              : OUString("VertOrientRelation"));
+            aPropertyValue.Name
+                = (nKeyword == RTF_DOBXMARGIN ? OUStringLiteral("HoriOrientRelation")
+                                              : OUStringLiteral("VertOrientRelation"));
             aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA;
             m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue);
         }
@@ -1050,8 +1051,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         case RTF_DOBYPAGE:
         {
             beans::PropertyValue aPropertyValue;
-            aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation")
-                                                            : OUString("VertOrientRelation"));
+            aPropertyValue.Name
+                = (nKeyword == RTF_DOBXPAGE ? OUStringLiteral("HoriOrientRelation")
+                                            : OUStringLiteral("VertOrientRelation"));
             aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME;
             m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue);
         }
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index afe71f2b5d06..abe719c7c7fe 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -344,8 +344,8 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
                 {
                     Sequence< OUString > aPropNames(1);
                     aPropNames[0] = GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ?
-                        OUString("ParaAutoStyleName") :
-                        OUString("CharAutoStyleName");
+                        OUStringLiteral("ParaAutoStyleName") :
+                        OUStringLiteral("CharAutoStyleName");
                     Sequence< Any > aAny = xAutoStyle->getPropertyValues( aPropNames );
                     if( aAny.hasElements() )
                     {
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index d1e7eb78fa52..4d3f2e21f816 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -653,7 +653,7 @@ Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFa
             xAutoStyles = mxParaAutoStyles;
         else
         {
-            sName = bPara ? OUString( "ParagraphStyles" ): OUString( "CharacterStyles" );
+            sName = bPara ? OUStringLiteral( "ParagraphStyles" ): OUStringLiteral( "CharacterStyles" );
             Reference< XAutoStylesSupplier > xAutoStylesSupp(   GetImport().GetModel(), UNO_QUERY );
             Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
             if (xAutoStyleFamilies->hasByName(sName))


More information about the Libreoffice-commits mailing list