chart2/source/controller/main/ChartController_Window.cxx        |    2 
 chart2/source/controller/sidebar/ChartColorWrapper.cxx          |    4 
 chart2/source/controller/sidebar/ChartLinePanel.cxx             |    2 
 comphelper/source/misc/sequenceashashmap.cxx                    |   16 -
 compilerplugins/clang/test/unnecessarygetstr.cxx                |   47 ++++-
 compilerplugins/clang/unnecessarygetstr.cxx                     |   89 
++++------
 connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx |    2 
 desktop/qa/desktop_lib/test_desktop_lib.cxx                     |   12 -
 desktop/source/lib/init.cxx                                     |    4 
 docmodel/source/theme/ThemeColorJSON.cxx                        |    4 
 editeng/source/editeng/editview.cxx                             |    2 
 editeng/source/editeng/impedit.cxx                              |    2 
 helpcompiler/inc/HelpCompiler.hxx                               |    4 
 helpcompiler/source/HelpLinker.cxx                              |   18 --
 hwpfilter/source/hwpeq.cxx                                      |    2 
 lingucomponent/source/lingutil/lingutil.hxx                     |    2 
 lingucomponent/source/numbertext/numbertext.cxx                 |    6 
 lingucomponent/source/spellcheck/spell/sspellimp.cxx            |    6 
 o3tl/qa/test-string_view.cxx                                    |    2 
 oox/source/docprop/docprophandler.cxx                           |    2 
 oox/source/export/drawingml.cxx                                 |    2 
 sc/qa/unit/subsequent_export_test4.cxx                          |    5 
 sc/qa/unit/tiledrendering/tiledrendering.cxx                    |    8 
 sc/source/core/tool/formulalogger.cxx                           |    2 
 sc/source/ui/Accessibility/AccessibleCsvControl.cxx             |    2 
 sc/source/ui/app/inputhdl.cxx                                   |    2 
 sc/source/ui/docshell/datastream.cxx                            |    2 
 sc/source/ui/docshell/docsh4.cxx                                |    2 
 sc/source/ui/drawfunc/drawsh2.cxx                               |    2 
 sc/source/ui/view/gridwin.cxx                                   |    4 
 sc/source/ui/view/tabview.cxx                                   |    6 
 sc/source/ui/view/tabview3.cxx                                  |    2 
 sc/source/ui/view/tabview5.cxx                                  |    2 
 sc/source/ui/view/viewdata.cxx                                  |    2 
 sc/source/ui/view/viewfun2.cxx                                  |    2 
 sd/qa/unit/export-tests-ooxml2.cxx                              |    8 
 sd/qa/unit/tiledrendering/tiledrendering.cxx                    |    2 
 sd/source/ui/view/Outliner.cxx                                  |    4 
 sfx2/source/control/dispatch.cxx                                |    2 
 sfx2/source/doc/autoredactdialog.cxx                            |    4 
 sfx2/source/doc/objserv.cxx                                     |    2 
 sfx2/source/sidebar/SidebarController.cxx                       |   10 -
 sfx2/source/view/lokhelper.cxx                                  |    8 
 svtools/source/svhtml/parhtml.cxx                               |    4 
 svx/source/svdraw/svdmrkv.cxx                                   |    2 
 svx/source/xoutdev/xattr.cxx                                    |    2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx                  |   78 ++++----
 sw/qa/extras/uiwriter/uiwriter5.cxx                             |    4 
 sw/qa/extras/uiwriter/uiwriter6.cxx                             |    4 
 sw/qa/extras/uiwriter/uiwriter8.cxx                             |    5 
 sw/qa/uibase/uno/uno.cxx                                        |   16 -
 sw/source/core/doc/docredln.cxx                                 |    2 
 sw/source/core/model/SearchResultLocator.cxx                    |    2 
 sw/source/core/view/viewsh.cxx                                  |    7 
 sw/source/uibase/docvw/PostItMgr.cxx                            |    2 
 sw/source/uibase/uiview/viewling.cxx                            |    2 
 sw/source/uibase/uiview/viewsrch.cxx                            |    2 
 sw/source/uibase/uiview/viewtab.cxx                             |    2 
 tools/qa/cppunit/test_urlobj.cxx                                |    2 
 ucb/source/ucp/cmis/auth_provider.cxx                           |    2 
 ucb/source/ucp/cmis/cmis_repo_content.cxx                       |    2 
 unotools/source/i18n/resmgr.cxx                                 |    4 
 vcl/qa/cppunit/complextext.cxx                                  |    8 
 vcl/source/app/unohelp2.cxx                                     |    2 
 vcl/source/control/edit.cxx                                     |    2 
 vcl/source/control/field2.cxx                                   |    2 
 vcl/source/gdi/mtfxmldump.cxx                                   |    2 
 vcl/unx/gtk3/gtkinst.cxx                                        |    2 
 writerfilter/source/dmapper/NumberingManager.cxx                |    2 
 writerfilter/source/dmapper/TagLogger.cxx                       |    4 
 writerfilter/source/dmapper/domainmapperfactory.cxx             |    2 
 writerfilter/source/ooxml/OOXMLPropertySet.cxx                  |    2 
 writerfilter/source/rtftok/rtfsprm.cxx                          |    2 
 xmloff/source/style/XMLFontAutoStylePool.cxx                    |    2 
 74 files changed, 252 insertions(+), 237 deletions(-)

New commits:
commit 5c1561561a859c561fb2321420f1abb7f1cedde3
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Apr 24 11:37:48 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Apr 24 18:04:50 2023 +0200

    loplugin:unnecessarygetstr extend to more std::string checking
    
    suggested by mike kaganski
    
    Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index 81474c5295eb..1bdb1f2ed48a 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1300,7 +1300,7 @@ void ChartController::execute_Command( const 
CommandEvent& rCEvt )
 
                 std::stringstream aStream;
                 boost::property_tree::write_json(aStream, aRoot, true);
-                
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
aStream.str().c_str());
+                
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
OString(aStream.str()));
             }
         }
         else
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx 
b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
index fc2f8b79839b..7376f37070ff 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
@@ -126,11 +126,11 @@ void ChartColorWrapper::updateData()
     SfxViewShell* pViewShell = SfxViewShell::Current();
     if (comphelper::LibreOfficeKit::isActive() && pViewShell && 
(maPropertyName == aLineColor))
     {
-        std::string sCommand = OUStringToOString(aUrl.Complete, 
RTL_TEXTENCODING_ASCII_US).getStr();
+        OString sCommand = OUStringToOString(aUrl.Complete, 
RTL_TEXTENCODING_ASCII_US);
         sal_Int32 nColor = -1;
         aEvent.State >>= nColor;
         pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                               (sCommand + "=" + 
std::to_string(nColor)).c_str());
+                                               sCommand + "=" + 
OString::number(nColor));
     }
 }
 
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx 
b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index d9da9a2985ef..9dbcc08ebc04 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -284,7 +284,7 @@ void ChartLinePanel::updateLineWidth(bool bDisabled, bool 
bSetOrDefault, const S
     if (comphelper::LibreOfficeKit::isActive() && pViewShell)
     {
         pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                        (".uno:LineWidth=" + 
std::to_string(mnWidthCoreValue)).c_str());
+                        ".uno:LineWidth=" + OString::number(mnWidthCoreValue));
     }
 }
 
diff --git a/comphelper/source/misc/sequenceashashmap.cxx 
b/comphelper/source/misc/sequenceashashmap.cxx
index 50a4e0216cd0..270c005db259 100644
--- a/comphelper/source/misc/sequenceashashmap.cxx
+++ b/comphelper/source/misc/sequenceashashmap.cxx
@@ -77,7 +77,7 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& 
aTree)
             else if (aTypeClass == uno::TypeClass_BYTE)
                 aAny <<= static_cast<sal_Int8>(o3tl::toInt32(rValue));
             else if (aTypeClass == uno::TypeClass_BOOLEAN)
-                aAny <<= OString(rValue.c_str()).toBoolean();
+                aAny <<= OString(rValue).toBoolean();
             else if (aTypeClass == uno::TypeClass_SHORT)
                 aAny <<= static_cast<sal_Int16>(o3tl::toInt32(rValue));
             else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT)
@@ -87,7 +87,7 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& 
aTree)
             else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG)
                 aAny <<= static_cast<sal_uInt32>(o3tl::toInt32(rValue));
             else if (aTypeClass == uno::TypeClass_FLOAT)
-                aAny <<= OString(rValue.c_str()).toFloat();
+                aAny <<= OString(rValue).toFloat();
             else if (aTypeClass == uno::TypeClass_DOUBLE)
                 aAny <<= o3tl::toDouble(rValue);
             else if (aTypeClass == uno::TypeClass_STRING)
@@ -312,7 +312,7 @@ std::vector<css::beans::PropertyValue> 
JsonToPropertyValues(const OString& rJson
 {
     std::vector<beans::PropertyValue> aArguments;
     boost::property_tree::ptree aTree, aNodeNull, aNodeValue;
-    std::stringstream aStream(rJson.getStr());
+    std::stringstream aStream((std::string(rJson)));
     boost::property_tree::read_json(aStream, aTree);
 
     for (const auto& rPair : aTree)
@@ -325,9 +325,9 @@ std::vector<css::beans::PropertyValue> 
JsonToPropertyValues(const OString& rJson
         if (rType == "string")
             aValue.Value <<= OUString::fromUtf8(rValue);
         else if (rType == "boolean")
-            aValue.Value <<= OString(rValue.c_str()).toBoolean();
+            aValue.Value <<= OString(rValue).toBoolean();
         else if (rType == "float")
-            aValue.Value <<= OString(rValue.c_str()).toFloat();
+            aValue.Value <<= OString(rValue).toFloat();
         else if (rType == "long")
             aValue.Value <<= o3tl::toInt32(rValue);
         else if (rType == "short")
@@ -341,7 +341,7 @@ std::vector<css::beans::PropertyValue> 
JsonToPropertyValues(const OString& rJson
         else if (rType == "int16")
             aValue.Value <<= sal_Int16(o3tl::toInt32(rValue));
         else if (rType == "uint64")
-            aValue.Value <<= OString(rValue.c_str()).toUInt64();
+            aValue.Value <<= OString(rValue).toUInt64();
         else if (rType == "uint32")
             aValue.Value <<= o3tl::toUInt32(rValue);
         else if (rType == "uint16")
@@ -372,7 +372,7 @@ std::vector<css::beans::PropertyValue> 
JsonToPropertyValues(const OString& rJson
             aNodeValue = rPair.second.get_child("value", aNodeNull);
             std::stringstream s;
             boost::property_tree::write_json(s, aNodeValue);
-            std::vector<beans::PropertyValue> aPropertyValues = 
JsonToPropertyValues(s.str().c_str());
+            std::vector<beans::PropertyValue> aPropertyValues = 
JsonToPropertyValues(OString(s.str()));
             aValue.Value <<= comphelper::containerToSequence(aPropertyValues);
         }
         else if (rType == "[][]com.sun.star.beans.PropertyValue")
@@ -383,7 +383,7 @@ std::vector<css::beans::PropertyValue> 
JsonToPropertyValues(const OString& rJson
             {
                 std::stringstream s;
                 boost::property_tree::write_json(s, rItem.second);
-                std::vector<beans::PropertyValue> aPropertyValues = 
JsonToPropertyValues(s.str().c_str());
+                std::vector<beans::PropertyValue> aPropertyValues = 
JsonToPropertyValues(OString(s.str()));
                 
aSeqs.push_back(comphelper::containerToSequence(aPropertyValues));
             }
             aValue.Value <<= comphelper::containerToSequence(aSeqs);
diff --git a/compilerplugins/clang/test/unnecessarygetstr.cxx 
b/compilerplugins/clang/test/unnecessarygetstr.cxx
index 68ed153649ad..bb5fcc20d2ef 100644
--- a/compilerplugins/clang/test/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/test/unnecessarygetstr.cxx
@@ -28,13 +28,13 @@ struct Foo
 void test1(Foo& foo)
 {
     OString s;
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString constructor [loplugin:unnecessarygetstr]}}
     f1(true, s.getStr());
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString constructor [loplugin:unnecessarygetstr]}}
     foo.f1(true, s.getStr());
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString constructor [loplugin:unnecessarygetstr]}}
     foo.f1(true, OString::boolean(true).getStr());
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString constructor [loplugin:unnecessarygetstr]}}
     foo.f1(true, OString::number(12).getStr());
 
     // avoid false +
@@ -49,22 +49,36 @@ namespace test2
 {
 // call to param that takes string_view
 void f2(bool, std::string_view);
+void f2(bool, std::u16string_view);
 struct Foo2
 {
     void f2(bool, std::string_view);
+    void f2(bool, std::u16string_view);
 };
-void test2(Foo2& foo)
+void testOString(Foo2& foo)
 {
     OString s;
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
     f2(true, s.getStr());
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
     foo.f2(true, s.getStr());
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
     foo.f2(true, OString::boolean(true).getStr());
-    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
     foo.f2(true, OString::number(12).getStr());
 }
+void testOUString(Foo2& foo)
+{
+    OUString s;
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
+    f2(true, s.getStr());
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
+    foo.f2(true, s.getStr());
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
+    foo.f2(true, OUString::boolean(true).getStr());
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
+    foo.f2(true, OUString::number(12).getStr());
+}
 }
 
 namespace test3
@@ -78,9 +92,9 @@ struct Foo2
 void test3(Foo2& foo)
 {
     std::string s;
-    // expected-error@+1 {{unnecessary call to 'c_str' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'c_str' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
     f2(true, s.c_str());
-    // expected-error@+1 {{unnecessary call to 'c_str' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+    // expected-error@+1 {{unnecessary call to 'c_str' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
     foo.f2(true, s.c_str());
 }
 }
@@ -95,4 +109,15 @@ void test()
 }
 }
 
+namespace test5
+{
+void test(std::string v, OString o)
+{
+    // expected-error@+1 {{unnecessary call to 'c_str' when passing to 
string_view constructor [loplugin:unnecessarygetstr]}}
+    std::string_view s1(v.c_str());
+    // expected-error@+1 {{unnecessary call to 'getStr' when passing to string 
constructor [loplugin:unnecessarygetstr]}}
+    std::string s2(o.getStr());
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessarygetstr.cxx 
b/compilerplugins/clang/unnecessarygetstr.cxx
index 3caf3776e5f7..7a9610f7618b 100644
--- a/compilerplugins/clang/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/unnecessarygetstr.cxx
@@ -36,66 +36,52 @@ public:
     {
     }
 
-    bool VisitCallExpr(CallExpr* callExpr)
+    bool VisitCallExpr(const CallExpr* callExpr)
     {
         if (ignoreLocation(callExpr))
             return true;
         const FunctionDecl* func = callExpr->getDirectCallee();
         if (!func)
             return true;
-        unsigned const n = std::min(func->getNumParams(), 
callExpr->getNumArgs());
-        for (unsigned i = 0; i != n; ++i)
-        {
-            auto arg = callExpr->getArg(i);
-            if (auto matTemp = dyn_cast<MaterializeTemporaryExpr>(arg))
-            {
-                auto cxxConstruct = 
dyn_cast<CXXConstructExpr>(matTemp->IgnoreImplicit());
-                if (!cxxConstruct || cxxConstruct->getNumArgs() < 1
-                    || cxxConstruct->getNumArgs() > 2)
-                    continue;
-                auto const tc1 = 
loplugin::TypeCheck(cxxConstruct->getConstructor()->getParent());
-                if (!(tc1.Class("OString").Namespace("rtl").GlobalNamespace()
-                      || 
tc1.Class("OUString").Namespace("rtl").GlobalNamespace()))
-                    continue;
-                auto e = 
dyn_cast<CXXMemberCallExpr>(cxxConstruct->getArg(0)->IgnoreImplicit());
-                if (!e)
-                    continue;
-                auto const t = e->getObjectType();
-                auto const tc2 = loplugin::TypeCheck(t);
-                if (!(tc2.Class("OString").Namespace("rtl").GlobalNamespace()
-                      || 
tc2.Class("OUString").Namespace("rtl").GlobalNamespace()
-                      || 
tc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
-                      || 
tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
-                      || 
tc2.ClassOrStruct("StringNumber").Namespace("rtl").GlobalNamespace()))
-                    continue;
-                if 
(!loplugin::DeclCheck(e->getMethodDecl()).Function("getStr"))
-                    continue;
-                report(DiagnosticsEngine::Warning,
-                       "unnecessary call to 'getStr' when passing to OString 
arg", e->getExprLoc())
-                    << e->getSourceRange();
-            }
-            else if (auto impCast = dyn_cast<ImplicitCastExpr>(arg))
-            {
-                auto cxxConstruct = 
dyn_cast<CXXConstructExpr>(impCast->getSubExpr());
-                if (!cxxConstruct || cxxConstruct->getNumArgs() < 1
-                    || cxxConstruct->getNumArgs() > 2)
-                    continue;
-                auto const tc1 = 
loplugin::TypeCheck(cxxConstruct->getConstructor()->getParent());
-                if (!(tc1.ClassOrStruct("basic_string_view").StdNamespace()))
-                    continue;
-                checkForGetStr(cxxConstruct->getArg(0), "string_view arg");
-            }
-        }
         if (loplugin::DeclCheck(func)
                 .Function("createFromAscii")
                 .Class("OUString")
-                .Namespace("rtl"))
+                .Namespace("rtl")
+                .GlobalNamespace())
         {
             checkForGetStr(callExpr->getArg(0), "OUString::createFromAscii");
         }
         return true;
     }
 
+    bool VisitCXXConstructExpr(const CXXConstructExpr* constructExpr)
+    {
+        if (ignoreLocation(constructExpr))
+            return true;
+        auto tc = loplugin::TypeCheck(constructExpr->getType());
+        if (tc.ClassOrStruct("basic_string").StdNamespace())
+        {
+            if (constructExpr->getNumArgs() == 2)
+                checkForGetStr(constructExpr->getArg(0), "string constructor");
+        }
+        else if (tc.ClassOrStruct("basic_string_view").StdNamespace())
+        {
+            if (constructExpr->getNumArgs() == 1)
+                checkForGetStr(constructExpr->getArg(0), "string_view 
constructor");
+        }
+        else if (tc.Class("OString").Namespace("rtl").GlobalNamespace())
+        {
+            if (constructExpr->getNumArgs() == 1 || 
constructExpr->getNumArgs() == 2)
+                checkForGetStr(constructExpr->getArg(0), "OString 
constructor");
+        }
+        else if (tc.Class("OUString").Namespace("rtl").GlobalNamespace())
+        {
+            if (constructExpr->getNumArgs() == 2)
+                checkForGetStr(constructExpr->getArg(0), "OUString 
constructor");
+        }
+        return true;
+    }
+
     bool preRun() override
     {
         if (!compiler.getLangOpts().CPlusPlus)
@@ -108,7 +94,7 @@ public:
     }
 
 private:
-    void checkForGetStr(Expr* arg, const char* msg)
+    void checkForGetStr(const Expr* arg, const char* msg)
     {
         auto e = dyn_cast<CXXMemberCallExpr>(arg->IgnoreImplicit());
         if (!e)
@@ -122,9 +108,14 @@ private:
             || 
tc2.ClassOrStruct("StringNumber").Namespace("rtl").GlobalNamespace())
         {
             if (loplugin::DeclCheck(e->getMethodDecl()).Function("getStr"))
-                report(DiagnosticsEngine::Warning,
-                       "unnecessary call to 'getStr' when passing to %0", 
e->getExprLoc())
-                    << msg << e->getSourceRange();
+            {
+                StringRef fileName = getFilenameOfLocation(
+                    
compiler.getSourceManager().getSpellingLoc(e->getBeginLoc()));
+                if (!loplugin::hasPathnamePrefix(fileName, SRCDIR 
"/include/rtl/"))
+                    report(DiagnosticsEngine::Warning,
+                           "unnecessary call to 'getStr' when passing to %0", 
e->getExprLoc())
+                        << msg << e->getSourceRange();
+            }
         }
         else if (tc2.Class("basic_string").StdNamespace())
         {
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
index 3c1c6d88ec4a..7a8921f08557 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
@@ -433,7 +433,7 @@ void SAL_CALL 
OPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, co
             {
                 OString sAscii
                     = OUStringToOString(sValue, 
getOwnConnection()->getConnectionEncoding());
-                std::stringstream sStream{ sAscii.getStr() };
+                std::stringstream sStream{ std::string(sAscii) };
                 sStream >> nValue;
                 m_binds[nIndex].buffer_type = MYSQL_TYPE_DOUBLE;
                 mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, 
&nValue, MYSQL_TYPE_DOUBLE,
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index dfc6d59e125e..675ebfe82e8d 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -855,7 +855,7 @@ void DesktopLOKTest::testRowColumnHeaders()
     {
         sal_Int32 nSize = 
o3tl::toInt32(rValue.second.get<std::string>("size"));
         nSize = o3tl::convert(nSize, o3tl::Length::px, o3tl::Length::twip);
-        OString aText(rValue.second.get<std::string>("text").c_str());
+        OString aText(rValue.second.get<std::string>("text"));
 
         if (bFirstHeader)
         {
@@ -884,7 +884,7 @@ void DesktopLOKTest::testRowColumnHeaders()
     {
         sal_Int32 nSize = 
o3tl::toInt32(rValue.second.get<std::string>("size"));
         nSize = o3tl::convert(nSize, o3tl::Length::px, o3tl::Length::twip);
-        OString aText(rValue.second.get<std::string>("text").c_str());
+        OString aText(rValue.second.get<std::string>("text"));
         if (bFirstHeader)
         {
             CPPUNIT_ASSERT(nSize <= nX);
@@ -958,7 +958,7 @@ void DesktopLOKTest::testCellCursor()
 
     boost::property_tree::read_json(aStream, aTree);
 
-    OString aRectangle(aTree.get<std::string>("commandValues").c_str());
+    OString aRectangle(aTree.get<std::string>("commandValues"));
     // cell cursor geometry + col + row
     CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1274, 254, 0, 0"), aRectangle);
 }
@@ -990,7 +990,7 @@ void DesktopLOKTest::testCommandResult()
     m_aCommandResultCondition.wait(aTimeValue);
 
     boost::property_tree::ptree aTree;
-    std::stringstream aStream(m_aCommandResult.getStr());
+    std::stringstream aStream((std::string(m_aCommandResult)));
     boost::property_tree::read_json(aStream, aTree);
 
     CPPUNIT_ASSERT_EQUAL(std::string(".uno:Bold"), 
aTree.get_child("commandName").get_value<std::string>());
@@ -1990,14 +1990,14 @@ void DesktopLOKTest::testBinaryCallback()
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
 
     const tools::Rectangle rect1(Point(10,15),Size(20,25));
-    const std::string rect1String(rect1.toString().getStr());
+    const std::string rect1String(rect1.toString());
     // Verify that using queue() and 
libreOfficeKitViewInvalidateTilesCallback() has the same result.
     {
         std::vector<std::tuple<int, std::string>> notifs;
         std::unique_ptr<CallbackFlushHandler> handler(new 
CallbackFlushHandler(pDocument, callbackBinaryCallbackTest, &notifs));
         handler->setViewId(SfxLokHelper::getView());
 
-        handler->queue(LOK_CALLBACK_INVALIDATE_TILES, rect1String.c_str());
+        handler->queue(LOK_CALLBACK_INVALIDATE_TILES, OString(rect1String));
 
         Scheduler::ProcessEventsToIdle();
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 742539da15e3..bd9ecf36cd1d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2063,7 +2063,7 @@ bool CallbackFlushHandler::processWindowEvent(int type, 
CallbackData& aCallbackD
 {
     const OString& payload = aCallbackData.getPayload();
 
-    boost::property_tree::ptree& aTree = 
aCallbackData.setJson(payload.getStr());
+    boost::property_tree::ptree& aTree = 
aCallbackData.setJson(std::string(payload));
     const unsigned nLOKWindowId = aTree.get<unsigned>("id", 0);
     const std::string aAction = aTree.get<std::string>("action", "");
     if (aAction == "invalidate")
@@ -4340,7 +4340,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* 
pThis,
                     bFirst = false;
                 else
                     sPayload += ", ";
-                sPayload += "\"" + std::string(f.toUtf8().getStr()) + "\"";
+                sPayload += "\"" + std::string(f.toUtf8()) + "\"";
             }
             sPayload += " ] }";
             pCallback(LOK_CALLBACK_FONTS_MISSING, sPayload.c_str(), pData);
diff --git a/docmodel/source/theme/ThemeColorJSON.cxx 
b/docmodel/source/theme/ThemeColorJSON.cxx
index 6b2293ca1f64..24b39fc190da 100644
--- a/docmodel/source/theme/ThemeColorJSON.cxx
+++ b/docmodel/source/theme/ThemeColorJSON.cxx
@@ -19,7 +19,7 @@ namespace model::theme
 bool convertFromJSON(OString const& rJsonString, model::ThemeColor& 
rThemeColor)
 {
     model::ThemeColor aThemeColor;
-    std::stringstream aStream(rJsonString.getStr());
+    std::stringstream aStream((std::string(rJsonString)));
     boost::property_tree::ptree aRootTree;
     try
     {
@@ -95,7 +95,7 @@ OString convertToJSON(model::ThemeColor const& rThemeColor)
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
 
-    return OString(aStream.str().c_str());
+    return OString(aStream.str());
 }
 
 } // end model::theme
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index c6af2f4cb1e0..cc03a135cdcd 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -975,7 +975,7 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, 
LanguageType nGuessLa
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aRoot, true);
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
aStream.str().c_str());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
OString(aStream.str()));
 }
 
 bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const 
Link<SpellCallbackInfo&,void> &rCallBack)
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index b28e4fdca501..3074ca53d1ad 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1453,7 +1453,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
                             LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, 
aMessageParams);
                 else
                     
pThisShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
-                            
aMessageParams.get<std::string>("rectangle").c_str());
+                            
OString(aMessageParams.get<std::string>("rectangle")));
             }
         }
 
diff --git a/helpcompiler/inc/HelpCompiler.hxx 
b/helpcompiler/inc/HelpCompiler.hxx
index 04562e9c41a7..985d207529d0 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -72,7 +72,7 @@ namespace fs
             osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
             OString tmp(OUStringToOString(ustrSystemPath, FileNameEnc()));
             HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << 
std::endl);
-            return std::string(tmp.getStr());
+            return std::string(tmp);
         }
 #ifdef _WIN32
         std::wstring native_file_string_w() const
@@ -85,7 +85,7 @@ namespace fs
         std::string toUTF8() const
         {
             OString tmp(OUStringToOString(data, RTL_TEXTENCODING_UTF8));
-            return std::string(tmp.getStr());
+            return std::string(tmp);
         }
         bool empty() const { return data.isEmpty(); }
         path operator/(const std::string &in) const
diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index 708f12a64114..3d52834dbe6b 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -71,14 +71,14 @@ IndexerPreProcessor::~IndexerPreProcessor()
 
 static std::string getEncodedPath( const std::string& Path )
 {
-    std::string_view aOStr_Path( Path.c_str() );
+    std::string_view aOStr_Path( Path );
     OUString aOUStr_Path( OStringToOUString
         ( aOStr_Path, osl_getThreadTextEncoding() ) );
     OUString aPathURL;
     osl::File::getFileURLFromSystemPath( aOUStr_Path, aPathURL );
     OString aOStr_PathURL( OUStringToOString
         ( aPathURL, osl_getThreadTextEncoding() ) );
-    std::string aStdStr_PathURL( aOStr_PathURL.getStr() );
+    std::string aStdStr_PathURL( aOStr_PathURL );
     return aStdStr_PathURL;
 }
 
@@ -749,7 +749,7 @@ void HelpLinker::main( std::vector<std::string> &args,
 
         OString aOStr_IdxCaptionPathFileURL( OUStringToOString
             ( aIdxCaptionPathFileURL, osl_getThreadTextEncoding() ) );
-        std::string aStdStr_IdxCaptionPathFileURL( 
aOStr_IdxCaptionPathFileURL.getStr() );
+        std::string aStdStr_IdxCaptionPathFileURL( aOStr_IdxCaptionPathFileURL 
);
 
         idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
     }
@@ -773,7 +773,7 @@ void HelpLinker::main( std::vector<std::string> &args,
 
         OString aOStr_IdxContentPathFileURL( OUStringToOString
             ( aIdxContentPathFileURL, osl_getThreadTextEncoding() ) );
-        std::string aStdStr_IdxContentPathFileURL( 
aOStr_IdxContentPathFileURL.getStr() );
+        std::string aStdStr_IdxContentPathFileURL( aOStr_IdxContentPathFileURL 
);
 
         idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL );
     }
@@ -834,10 +834,8 @@ static void 
StructuredXMLErrorFunction(SAL_UNUSED_PARAMETER void *, xmlErrorPtr
 HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct 
HelpProcessingException& e )
 {
     m_eErrorClass = e.m_eErrorClass;
-    std::string_view tmpErrorMsg( e.m_aErrorMsg.c_str() );
-    m_aErrorMsg = OStringToOUString( tmpErrorMsg, osl_getThreadTextEncoding() 
);
-    std::string_view tmpXMLParsingFile( e.m_aXMLParsingFile.c_str() );
-    m_aXMLParsingFile = OStringToOUString( tmpXMLParsingFile, 
osl_getThreadTextEncoding() );
+    m_aErrorMsg = OStringToOUString( std::string_view(e.m_aErrorMsg), 
osl_getThreadTextEncoding() );
+    m_aXMLParsingFile = OStringToOUString( 
std::string_view(e.m_aXMLParsingFile), osl_getThreadTextEncoding() );
     m_nXMLParsingLine = e.m_nXMLParsingLine;
     return *this;
 }
@@ -860,14 +858,14 @@ bool compileExtensionHelp
     args.reserve(nXhpFileCount + 2);
     args.push_back(std::string("-mod"));
     OString aOExtensionName = OUStringToOString( aExtensionName, 
osl_getThreadTextEncoding() );
-    args.push_back(std::string(aOExtensionName.getStr()));
+    args.push_back(std::string(aOExtensionName));
 
     for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
     {
         OUString aXhpFile = pXhpFiles[iXhp];
 
         OString aOXhpFile = OUStringToOString( aXhpFile, 
osl_getThreadTextEncoding() );
-        args.push_back(std::string(aOXhpFile.getStr()));
+        args.push_back(std::string(aOXhpFile));
     }
 
     OString aOExtensionLanguageRoot = OUStringToOString( 
aExtensionLanguageRoot, osl_getThreadTextEncoding() );
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index 93469f68828f..3b078c81eb21 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -775,7 +775,7 @@ void eq2latex(OString& outs, char const *s)
 
   std::istringstream tstrm(s);
   bool eqnarray = eq_sentence(tstr, &tstrm);
-  std::istringstream strm(tstr.getStr());
+  std::istringstream strm((std::string(tstr)));
 
   if( eqnarray )
     outs += "\\begin{array}{rllll}" SAL_NEWLINE_STRING;
diff --git a/lingucomponent/source/lingutil/lingutil.hxx 
b/lingucomponent/source/lingutil/lingutil.hxx
index 4c4fe15ec47f..687c41482780 100644
--- a/lingucomponent/source/lingutil/lingutil.hxx
+++ b/lingucomponent/source/lingutil/lingutil.hxx
@@ -26,7 +26,7 @@
 
 #define OU2ENC(rtlOUString, rtlEncoding) \
     OString((rtlOUString).getStr(), (rtlOUString).getLength(), \
-    rtlEncoding, RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK).getStr()
+    rtlEncoding, RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK)
 
 struct SvtLinguConfigDictionaryEntry;
 
diff --git a/lingucomponent/source/numbertext/numbertext.cxx 
b/lingucomponent/source/numbertext/numbertext.cxx
index aec03e1f5e8e..b87b2cc5fc1e 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -102,7 +102,7 @@ void NumberText_Impl::EnsureInitialized()
     const rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
 #endif
     OString path = OUStringToOString(aPhysPath, eEnc);
-    m_aNumberText.set_prefix(path.getStr());
+    m_aNumberText.set_prefix(std::string(path));
 }
 
 OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const 
Locale& rLocale)
@@ -123,9 +123,9 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const 
OUString& rText, const Lo
     std::wstring sResult(o3tl::toW(rText.getStr()));
 #else
     OString aInput(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
-    std::wstring sResult = Numbertext::string2wstring(aInput.getStr());
+    std::wstring sResult = Numbertext::string2wstring(std::string(aInput));
 #endif
-    bool result = m_aNumberText.numbertext(sResult, aLangCode.getStr());
+    bool result = m_aNumberText.numbertext(sResult, std::string(aLangCode));
     DBG_ASSERT(result, "numbertext: false");
 #if defined(_WIN32)
     OUString aResult(o3tl::toU(sResult));
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 506d2c9dd014..193ddb2c32cb 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -332,7 +332,7 @@ sal_Int16 SpellChecker::GetSpellFailure(const OUString 
&rWord, const Locale &rLo
 
                 OString aWrd(OU2ENC(nWord,eEnc));
 #if defined(H_DEPRECATED)
-                bool bVal = pMS->spell(std::string(aWrd.getStr()), &rInfo);
+                bool bVal = pMS->spell(std::string(aWrd), &rInfo);
 #else
                 bool bVal = pMS->spell(aWrd.getStr(), &rInfo) != 0;
 #endif
@@ -355,7 +355,7 @@ sal_Int16 SpellChecker::GetSpellFailure(const OUString 
&rWord, const Locale &rLo
                         OUString aWord(aBuf.makeStringAndClear());
                         OString bWrd(OU2ENC(aWord, eEnc));
 #if defined(H_DEPRECATED)
-                        bVal = pMS->spell(std::string(bWrd.getStr()), &rInfo);
+                        bVal = pMS->spell(std::string(bWrd), &rInfo);
 #else
                         bVal = pMS->spell(bWrd.getStr(), &rInfo) != 0;
 #endif
@@ -472,7 +472,7 @@ Reference< XSpellAlternatives >
             {
                 OString aWrd(OU2ENC(nWord,eEnc));
 #if defined(H_DEPRECATED)
-                std::vector<std::string> suglst = 
pMS->suggest(std::string(aWrd.getStr()));
+                std::vector<std::string> suglst = 
pMS->suggest(std::string(aWrd));
                 if (!suglst.empty())
                 {
                     aStr.realloc(numsug + suglst.size());
diff --git a/o3tl/qa/test-string_view.cxx b/o3tl/qa/test-string_view.cxx
index a95afc923c2c..6569d9267705 100644
--- a/o3tl/qa/test-string_view.cxx
+++ b/o3tl/qa/test-string_view.cxx
@@ -27,7 +27,7 @@ template <>
 inline std::string
 CppUnit::assertion_traits<std::u16string_view>::toString(std::u16string_view 
const& x)
 {
-    return OUStringToOString(x, RTL_TEXTENCODING_UTF8).getStr();
+    return std::string(OUStringToOString(x, RTL_TEXTENCODING_UTF8));
 }
 
 namespace
diff --git a/oox/source/docprop/docprophandler.cxx 
b/oox/source/docprop/docprophandler.cxx
index b65ea16999c7..3f2d962c8f90 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -194,7 +194,7 @@ uno::Sequence< OUString > 
OOXMLDocPropHandler::GetKeywordsSet( std::u16string_vi
 {
     if ( !aChars.empty() )
     {
-        std::string aUtf8Chars = OUStringToOString( aChars, 
RTL_TEXTENCODING_UTF8 ).getStr();
+        std::string aUtf8Chars( OUStringToOString( aChars, 
RTL_TEXTENCODING_UTF8 ) );
         std::vector<std::string> aUtf8Result;
         boost::split( aUtf8Result, aUtf8Chars, boost::is_any_of(" ,;:\t"), 
boost::token_compress_on );
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c5047db88392..75541b084e3b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -363,7 +363,7 @@ OString getColorStr(const ::Color nColor)
 
         sBuf.append(sColor);
 
-        sColor = sBuf.getStr();
+        sColor = sBuf.toString();
     }
     return sColor;
 }
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 25eb30e19245..8cb9a73a5f4e 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1478,8 +1478,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, 
testAutofilterHiddenButton)
     CPPUNIT_ASSERT(pDocXml);
     for (int i = 1; i <= 5; i++)
     {
-        auto sPath = "/x:table/x:autoFilter/x:filterColumn[" + 
std::to_string(i) + "]";
-        assertXPath(pDocXml, sPath.c_str(), "hiddenButton", "1");
+        OString sPath
+            = OString::Concat("/x:table/x:autoFilter/x:filterColumn[") + 
OString::number(i) + "]";
+        assertXPath(pDocXml, sPath, "hiddenButton", "1");
     }
 }
 
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 6f9398f03736..5968cfc8fdd6 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -678,7 +678,7 @@ namespace
 void lcl_extractHandleParameters(std::string_view selection, sal_uInt32& id, 
sal_uInt32& x, sal_uInt32& y)
 {
     OString extraInfo( selection.substr(selection.find("{")) );
-    std::stringstream aStream(extraInfo.getStr());
+    std::stringstream aStream((std::string(extraInfo)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     boost::property_tree::ptree
@@ -2047,7 +2047,7 @@ struct SheetDimData
             }
 
             // Get the tree's value for the property key 
("sizes"/"hidden"/"filtered").
-            OString aTreeValue = 
rTree.get<std::string>(rEntry.aKey.getStr()).c_str();
+            OString aTreeValue(rTree.get<std::string>(rEntry.aKey.getStr()));
 
             CPPUNIT_ASSERT_EQUAL(aExpectedEncoding, aTreeValue);
         }
@@ -2075,10 +2075,10 @@ public:
     {
         // Assumes all flags passed to getSheetGeometryData() are true.
         boost::property_tree::ptree aTree;
-        std::stringstream aStream(rJSON.getStr());
+        std::stringstream aStream((std::string(rJSON)));
         boost::property_tree::read_json(aStream, aTree);
 
-        CPPUNIT_ASSERT_EQUAL(OString(".uno:SheetGeometryData"), 
OString(aTree.get<std::string>("commandName").c_str()));
+        CPPUNIT_ASSERT_EQUAL(OString(".uno:SheetGeometryData"), 
OString(aTree.get<std::string>("commandName")));
 
         aCols.testPropertyTree(aTree.get_child("columns"), true);
         aRows.testPropertyTree(aTree.get_child("rows"), false);
diff --git a/sc/source/core/tool/formulalogger.cxx 
b/sc/source/core/tool/formulalogger.cxx
index ac7f335facac..c3282e3c0046 100644
--- a/sc/source/core/tool/formulalogger.cxx
+++ b/sc/source/core/tool/formulalogger.cxx
@@ -293,7 +293,7 @@ void FormulaLogger::writeAscii( const char* s, size_t n )
 
 void FormulaLogger::write( std::u16string_view ou )
 {
-    OString s = OUStringToOString(ou, RTL_TEXTENCODING_UTF8).getStr();
+    OString s = OUStringToOString(ou, RTL_TEXTENCODING_UTF8);
     writeAscii(s.getStr(), s.getLength());
 }
 
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx 
b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index eeaee6e2f91c..6ebe5041ba14 100644
--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -420,7 +420,7 @@ OUString SAL_CALL ScAccessibleCsvRuler::getText()
 {
     SolarMutexGuard aGuard;
     ensureAlive();
-    return OUString( maBuffer.getStr(), implGetTextLength() );
+    return OUString(maBuffer.subView( 0, implGetTextLength() ));
 }
 
 OUString SAL_CALL ScAccessibleCsvRuler::getTextRange( sal_Int32 nStartIndex, 
sal_Int32 nEndIndex )
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 8184bac0b946..c0ee11966887 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -336,7 +336,7 @@ void ScInputHandler::SendReferenceMarks( const 
SfxViewShell* pViewShell,
 
     ss <<  " ] }";
 
-    OString aPayload = ss.str().c_str();
+    OString aPayload( ss.str() );
     pViewShell->libreOfficeKitViewCallback(
                 LOK_CALLBACK_REFERENCE_MARKS, aPayload );
 }
diff --git a/sc/source/ui/docshell/datastream.cxx 
b/sc/source/ui/docshell/datastream.cxx
index 55b2f93381f5..cbce943eda11 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -197,7 +197,7 @@ private:
                 rLine.maCells.clear();
                 mpStream->ReadLine(rLine.maLine);
                 CSVHandler aHdl(rLine, mnColCount);
-                orcus::csv_parser<CSVHandler> parser(rLine.maLine.getStr(), 
aHdl, maConfig);
+                orcus::csv_parser<CSVHandler> parser(rLine.maLine, aHdl, 
maConfig);
                 parser.parse();
             }
 
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 737acbddd80c..611d6537456e 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2585,7 +2585,7 @@ void 
ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const ScDocu
     while (pViewShell)
     {
         if (pThisViewShell == nullptr || pViewShell->GetDocId() == 
pThisViewShell->GetDocId())
-            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, 
aPayload.c_str());
+            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, 
OString(aPayload));
         pViewShell = SfxViewShell::GetNext(*pViewShell);
     }
 }
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index 775c00fefdbc..8556c18e6b94 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -353,7 +353,7 @@ static void setupFillColorForChart(const SfxViewShell* 
pShell, SfxItemSet& rSet)
 
         if (comphelper::LibreOfficeKit::isActive())
             pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                    (".uno:FillColor=" + std::to_string(nFillColor)).c_str());
+                    (".uno:FillColor=" + OString::number(nFillColor)));
     }
 
     if (!(comphelper::LibreOfficeKit::isActive() && 
xInfo->hasPropertyByName("FillGradientName")))
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d00d3c451d2f..2ff49c0a5dfe 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5007,7 +5007,7 @@ void ScGridWindow::updateLOKInputHelp(const OUString& 
title, const OUString& con
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_INPUT_HELP, 
aStream.str().c_str());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_INPUT_HELP, 
OString(aStream.str()));
 }
 
 void ScGridWindow::updateLOKValListButton( bool bVisible, const ScAddress& 
rPos ) const
@@ -5017,7 +5017,7 @@ void ScGridWindow::updateLOKValListButton( bool bVisible, 
const ScAddress& rPos
     std::stringstream ss;
     ss << nX << ", " << nY << ", " << static_cast<unsigned int>(bVisible);
     ScTabViewShell* pViewShell = mrViewData.GetViewShell();
-    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_LIST_BUTTON, 
ss.str().c_str());
+    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_LIST_BUTTON, 
OString(ss.str()));
 }
 
 void ScGridWindow::notifyKitCellFollowJump( ) const
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 093ebe4f89c5..b6c7a2bd8e66 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2688,7 +2688,7 @@ void lcl_ExtendTiledDimension(bool bColumn, const 
SCCOLROW nEnd, const SCCOLROW
     // Provide size in the payload, so clients don't have to query for that.
     std::stringstream ss;
     ss << aNewSize.Width() << ", " << aNewSize.Height();
-    OString sSize = ss.str().c_str();
+    OString sSize( ss.str() );
     ScModelObj* pModel = comphelper::getFromUnoTunnel<ScModelObj>(
         rViewData.GetViewShell()->GetCurrentDocument());
     SfxLokHelper::notifyDocumentSizeChanged(rViewData.GetViewShell(), sSize, 
pModel, false);
@@ -2945,7 +2945,7 @@ OString ScTabView::getSheetGeometryData(bool bColumns, 
bool bRows, bool bSizes,
     if ((!bSizes && !bHidden && !bFiltered && !bGroups) ||
         (!bColumns && !bRows))
     {
-        return getJSONString(aTree).c_str();
+        return OString(getJSONString(aTree));
     }
 
     struct GeomEntry
@@ -2997,7 +2997,7 @@ OString ScTabView::getSheetGeometryData(bool bColumns, 
bool bRows, bool bSizes,
         aTree.add_child(rDimEntry.pKey, aDimTree);
     }
 
-    return getJSONString(aTree).c_str();
+    return OString(getJSONString(aTree));
 }
 
 void ScTabView::extendTiledAreaIfNeeded()
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 395d959839d3..514341af267a 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -444,7 +444,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
     // call lok::Document::getDocumentSize().
     std::stringstream ss;
     ss << aNewSize.Width() << ", " << aNewSize.Height();
-    OString sSize = ss.str().c_str();
+    OString sSize( ss.str() );
     ScModelObj* pModel = 
comphelper::getFromUnoTunnel<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
     SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, 
pModel, false);
 }
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 77280b583cc7..670efabc1eb2 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -337,7 +337,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
     Size aDocSize = pModelObj->getDocumentSize();
     std::stringstream ss;
     ss << aDocSize.Width() << ", " << aDocSize.Height();
-    OString sRect = ss.str().c_str();
+    OString sRect(ss.str());
     ScTabViewShell* pViewShell = aViewData.GetViewShell();
 
     // Invalidate first
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 936eb34d4805..a69ed16d4d5a 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2622,7 +2622,7 @@ OString ScViewData::describeCellCursorAt(SCCOL nX, SCROW 
nY, bool bPixelAligned)
             << nX << ", " << nY;
     }
 
-    return ss.str().c_str();
+    return OString(ss.str());
 }
 
 //      Number of cells on a screen
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 222ee4a61e98..24b3e6c86ff2 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2195,7 +2195,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* 
pSearchItem,
 
                 std::stringstream aStream;
                 boost::property_tree::write_json(aStream, aTree);
-                OString aPayload = aStream.str().c_str();
+                OString aPayload( aStream.str() );
                 SfxViewShell* pViewShell = GetViewData().GetViewShell();
                 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, 
aPayload);
 
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 7d04d29886ec..d3ef83cb0c04 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -60,12 +60,12 @@ static void assertMotionPath(std::u16string_view rStr1, 
std::u16string_view rStr
 
         if (checkBeginWithNumber(aToken1) && checkBeginWithNumber(aToken2))
             assertDoubleEquals(aToken1.toDouble(), aToken2.toDouble(), 
DBL_EPSILON, rSourceLine,
-                               sMessage.getStr());
+                               std::string(sMessage));
         else
-            assertEquals(aToken1, aToken2, rSourceLine, sMessage.getStr());
+            assertEquals(aToken1, aToken2, rSourceLine, std::string(sMessage));
     }
-    assertEquals(sal_Int32(-1), nIdx1, rSourceLine, sMessage.getStr());
-    assertEquals(sal_Int32(-1), nIdx2, rSourceLine, sMessage.getStr());
+    assertEquals(sal_Int32(-1), nIdx1, rSourceLine, std::string(sMessage));
+    assertEquals(sal_Int32(-1), nIdx2, rSourceLine, std::string(sMessage));
 }
 
 class SdOOXMLExportTest2 : public SdModelTestBase
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index ece4c3ad32e6..40eb72c1c098 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -2511,7 +2511,7 @@ namespace
 void lcl_extractHandleParameters(std::string_view selection, sal_uInt32& id, 
sal_uInt32& x, sal_uInt32& y)
 {
     OString extraInfo( selection.substr(selection.find("{")) );
-    std::stringstream aStream(extraInfo.getStr());
+    std::stringstream aStream((std::string(extraInfo)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     boost::property_tree::ptree
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 9f107d1488cc..aaf4cc6a8160 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -660,7 +660,7 @@ bool SdOutliner::SearchAndReplaceAll()
 
             std::stringstream aStream;
             boost::property_tree::write_json(aStream, aTree);
-            OString aPayload = aStream.str().c_str();
+            OString aPayload( aStream.str() );
             
rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, 
aPayload);
         }
     }
@@ -796,7 +796,7 @@ void SdOutliner::sendLOKSearchResultCallback(const 
std::shared_ptr<sd::ViewShell
 
         std::stringstream aStream;
         boost::property_tree::write_json(aStream, aTree);
-        aPayload = aStream.str().c_str();
+        aPayload = OString(aStream.str());
         
rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, 
aPayload);
 
         if (rVectorGraphicSearchContext.mbCurrentIsVectorGraphic)
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index f9b8ac53ea66..b1bb3c7aed27 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1852,7 +1852,7 @@ void SfxDispatcher::ExecutePopup( const OUString& 
rResName, vcl::Window* pWin, c
         std::stringstream aStream;
         boost::property_tree::write_json(aStream, aRoot, true);
         if (SfxViewShell* pViewShell = xImp->pFrame->GetViewShell())
-            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
aStream.str().c_str());
+            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
OString(aStream.str()));
     }
     else
     {
diff --git a/sfx2/source/doc/autoredactdialog.cxx 
b/sfx2/source/doc/autoredactdialog.cxx
index f84af9622f95..665e5c0ec781 100644
--- a/sfx2/source/doc/autoredactdialog.cxx
+++ b/sfx2/source/doc/autoredactdialog.cxx
@@ -402,7 +402,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, LoadHdl, 
sfx2::FileDialogHelper*, void)
     try
     {
         // Create path string, and read JSON from file
-        std::string sPathStr(OUStringToOString(sTargetsFile, 
RTL_TEXTENCODING_UTF8).getStr());
+        std::string sPathStr(OUStringToOString(sTargetsFile, 
RTL_TEXTENCODING_UTF8));
 
         boost::property_tree::ptree aTargetsJSON;
 
@@ -459,7 +459,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, SaveHdl, 
sfx2::FileDialogHelper*, void)
         aTargetsTree.add_child("RedactionTargets", aTargetsArray);
 
         // Create path string, and write JSON to file
-        std::string sPathStr(OUStringToOString(sTargetsFile, 
RTL_TEXTENCODING_UTF8).getStr());
+        std::string sPathStr(OUStringToOString(sTargetsFile, 
RTL_TEXTENCODING_UTF8));
 
         boost::property_tree::write_json(sPathStr, aTargetsTree);
     }
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 2d7b0c31ef6e..78c4fd01f667 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -465,7 +465,7 @@ static void sendErrorToLOK(ErrCode error)
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
 
-    SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, 
aStream.str().c_str());
+    SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, 
OString(aStream.str()));
 }
 
 namespace
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 1bd5dc58ee86..b967cbb10369 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -227,7 +227,7 @@ void SidebarController::disposeDecks()
             const std::string hide = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
             if (!hide.empty())
                 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                       (hide + 
"=false").c_str());
+                                                       OString(hide + 
"=false"));
         }
 
         if (mpParentWindow)
@@ -802,13 +802,13 @@ void SidebarController::SwitchToDeck (
                 const std::string hide = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
                 if (!hide.empty())
                     
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                           (hide + 
"=false").c_str());
+                                                           OString(hide + 
"=false"));
             }
 
             const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId, 
GetCurrentContext());
             if (!show.empty())
                 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                       (show + 
"=true").c_str());
+                                                       OString(show + 
"=true"));
         }
     }
 
@@ -1320,7 +1320,7 @@ void SidebarController::UpdateDeckOpenState()
                     const std::string uno = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
                     if (!uno.empty())
                         
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                                (uno + 
"=true").c_str());
+                                                                OString(uno + 
"=true"));
                 }
             }
         }
@@ -1358,7 +1358,7 @@ void SidebarController::UpdateDeckOpenState()
                     const std::string uno = UnoNameFromDeckId(msCurrentDeckId, 
GetCurrentContext());
                     if (!uno.empty())
                         
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                                (uno + 
"=false").c_str());
+                                                                OString(uno + 
"=false"));
                 }
             }
         }
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 513e9e2270b7..6f7f9ee60dd2 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/ui/ContextChangeEventObject.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <o3tl/string_view.hxx>
 #include <rtl/strbuf.hxx>
 #include <vcl/lok.hxx>
 #include <vcl/svapp.hxx>
@@ -408,8 +409,7 @@ static OString lcl_generateJSON(const SfxViewShell* pView, 
const boost::property
     aMessageProps.put("mode", pView->getEditMode());
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aMessageProps, false /* pretty 
*/);
-    const std::string aString = aStream.str();
-    return OString(aString.c_str(), aString.size()).trim();
+    return OString(o3tl::trim(aStream.str()));
 }
 
 static inline OString lcl_generateJSON(const SfxViewShell* pView, int nViewId, 
std::string_view rKey,
@@ -552,7 +552,7 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* 
pShell, const SfxPoolItem*
 
         std::stringstream aStream;
         boost::property_tree::write_json(aStream, aItem);
-        pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, 
aStream.str().c_str());
+        pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, 
OString(aStream.str()));
     }
 }
 
@@ -969,7 +969,7 @@ void 
SfxLokHelper::notifyMediaUpdate(boost::property_tree::ptree& json)
     boost::property_tree::write_json(aStream, json, /*pretty=*/ false);
     const std::string str = aStream.str();
 
-    SfxLokHelper::notifyAllViews(LOK_CALLBACK_MEDIA_SHAPE, str.c_str());
+    SfxLokHelper::notifyAllViews(LOK_CALLBACK_MEDIA_SHAPE, OString(str));
 }
 
 bool SfxLokHelper::testInPlaceComponentMouseEventHit(SfxViewShell* pViewShell, 
int nType, int nX,
diff --git a/svtools/source/svhtml/parhtml.cxx 
b/svtools/source/svhtml/parhtml.cxx
index 7031b443344e..7e8ac63fc61e 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -478,7 +478,7 @@ HtmlTokenId HTMLParser::ScanText( const sal_Unicode cBreak )
 
                     if( IsParserWorking() && !rInput.eof() )
                     {
-                        OUString sEntity(sEntityBuffer.getStr(), nPos);
+                        std::u16string_view sEntity(sEntityBuffer.subView(0, 
nPos));
                         cChar = GetHTMLCharName( sEntity );
 
                         // not found ( == 0 ): plain text
@@ -492,7 +492,7 @@ HtmlTokenId HTMLParser::ScanText( const sal_Unicode cBreak )
                             {
                                 nNextCh = sEntityBuffer[i];
                                 sEntityBuffer.setLength( i );
-                                sEntity = OUString(sEntityBuffer.getStr(), i);
+                                sEntity = sEntityBuffer.subView(0, i);
                                 cChar = GetHTMLCharName( sEntity );
                                 if( cChar )
                                 {
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 00193bebfe44..5d6ccea9a55c 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1131,7 +1131,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle 
const & rRect, const S
 
             std::stringstream aStream;
             boost::property_tree::write_json(aStream, aTableJsonTree);
-            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, 
aStream.str().c_str());
+            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, 
OString(aStream.str()));
         }
         else if (!getSdrModelFromSdrView().IsWriter())
         {
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 8df15b725634..42822d72649b 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -2145,7 +2145,7 @@ namespace
         StringMap aArgs;
         if (rJSON.size() && rJSON[0] != '\0')
         {
-            std::stringstream aStream(OUStringToOString(rJSON, 
RTL_TEXTENCODING_ASCII_US).getStr());
+            std::stringstream aStream(std::string(OUStringToOString(rJSON, 
RTL_TEXTENCODING_ASCII_US)));
             boost::property_tree::ptree aTree;
             boost::property_tree::read_json(aStream, aTree);
 
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index adbdb7dfeddb..19bd70fa78e4 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -274,8 +274,8 @@ void SwTiledRenderingTest::callbackImpl(int nType, const 
char* pPayload)
                     std::stringstream aStream(pPayload);
                     boost::property_tree::read_json(aStream, aTree);
                     boost::property_tree::ptree &aChild = 
aTree.get_child("hyperlink");
-                    m_sHyperlinkText = aChild.get("text", "").c_str();
-                    m_sHyperlinkLink = aChild.get("link", "").c_str();
+                    m_sHyperlinkText = OString(aChild.get("text", ""));
+                    m_sHyperlinkLink = OString(aChild.get("link", ""));
                 }
             }
             break;
@@ -813,7 +813,7 @@ namespace {
                             std::stringstream aStream(pPayload);
                             boost::property_tree::ptree aTree;
                             boost::property_tree::read_json(aStream, aTree);
-                            sRect = 
aTree.get_child("rectangle").get_value<std::string>().c_str();
+                            sRect = 
OString(aTree.get_child("rectangle").get_value<std::string>());
                             m_nOwnCursorInvalidatedBy = 
aTree.get_child("viewId").get_value<int>();
                         }
                         else
@@ -836,7 +836,7 @@ namespace {
                         std::stringstream aStream(pPayload);
                         boost::property_tree::ptree aTree;
                         boost::property_tree::read_json(aStream, aTree);
-                        OString aRect = 
aTree.get_child("rectangle").get_value<std::string>().c_str();
+                        OString aRect( 
aTree.get_child("rectangle").get_value<std::string>() );
 
                         uno::Sequence<OUString> aSeq = 
comphelper::string::convertCommaSeparated(OUString::fromUtf8(aRect));
                         if (std::string_view("EMPTY") == pPayload)
@@ -1756,7 +1756,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testRedlineColors)
     // Assert that info about exactly one author is returned.
     tools::JsonWriter aJsonWriter;
     pXTextDocument->getTrackedChangeAuthors(aJsonWriter);
-    std::stringstream aStream(aJsonWriter.finishAndGetAsOString().getStr());
+    std::stringstream 
aStream((std::string(aJsonWriter.finishAndGetAsOString())));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), 
aTree.get_child("authors").size());
@@ -1815,7 +1815,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testCommentInsert)
     ViewCallback aView;
     comphelper::dispatchCommand(".uno:InsertAnnotation", xFrame, 
aPropertyValues);
     Scheduler::ProcessEventsToIdle();
-    OString 
aAnchorPos(aView.m_aComment.get_child("anchorPos").get_value<std::string>().c_str());
+    OString 
aAnchorPos(aView.m_aComment.get_child("anchorPos").get_value<std::string>());
     // Without the accompanying fix in place, this test would have failed with
     // - Expected: 1418, 1418, 0, 0
     // - Actual  : 1418, 1418, 1024, 1024
@@ -3046,17 +3046,17 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButton)
 
     CPPUNIT_ASSERT(!m_aFormFieldButton.isEmpty());
     {
-        std::stringstream aStream(m_aFormFieldButton.getStr());
+        std::stringstream aStream((std::string(m_aFormFieldButton)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
 
-        OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+        OString sAction( aTree.get_child("action").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("show"), sAction);
 
-        OString sType = 
aTree.get_child("type").get_value<std::string>().c_str();
+        OString sType( aTree.get_child("type").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("drop-down"), sType);
 
-        OString sTextArea = 
aTree.get_child("textArea").get_value<std::string>().c_str();
+        OString sTextArea( 
aTree.get_child("textArea").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("1538, 1418, 1026, 275"), sTextArea);
 
         boost::property_tree::ptree aItems = 
aTree.get_child("params").get_child("items");
@@ -3070,10 +3070,10 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButton)
         }
         
CPPUNIT_ASSERT_EQUAL(OString("2019/2020;2020/2021;2021/2022;2022/2023;2023/2024;2024/2025;"),
 aItemList.toString());
 
-        OString sSelected = 
aTree.get_child("params").get_child("selected").get_value<std::string>().c_str();
+        OString sSelected( 
aTree.get_child("params").get_child("selected").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("1"), sSelected);
 
-        OString sPlaceholder = 
aTree.get_child("params").get_child("placeholderText").get_value<std::string>().c_str();
+        OString sPlaceholder( 
aTree.get_child("params").get_child("placeholderText").get_value<std::string>() 
);
         CPPUNIT_ASSERT_EQUAL(OString("No Item specified"), sPlaceholder);
     }
 
@@ -3082,14 +3082,14 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButton)
 
     CPPUNIT_ASSERT(!m_aFormFieldButton.isEmpty());
     {
-        std::stringstream aStream(m_aFormFieldButton.getStr());
+        std::stringstream aStream((std::string(m_aFormFieldButton)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
 
-        OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+        OString sAction( aTree.get_child("action").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("hide"), sAction);
 
-        OString sType = 
aTree.get_child("type").get_value<std::string>().c_str();
+        OString sType( aTree.get_child("type").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("drop-down"), sType);
     }
 }
@@ -3120,11 +3120,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButtonEditing)
     // The item with the index '1' is selected by default
     CPPUNIT_ASSERT(!m_aFormFieldButton.isEmpty());
     {
-        std::stringstream aStream(m_aFormFieldButton.getStr());
+        std::stringstream aStream((std::string(m_aFormFieldButton)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
 
-        OString sSelected = 
aTree.get_child("params").get_child("selected").get_value<std::string>().c_str();
+        OString sSelected( 
aTree.get_child("params").get_child("selected").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("1"), sSelected);
     }
     m_aFormFieldButton = "";
@@ -3142,11 +3142,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButtonEditing)
 
     CPPUNIT_ASSERT(!m_aFormFieldButton.isEmpty());
     {
-        std::stringstream aStream(m_aFormFieldButton.getStr());
+        std::stringstream aStream((std::string(m_aFormFieldButton)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
 
-        OString sSelected = 
aTree.get_child("params").get_child("selected").get_value<std::string>().c_str();
+        OString sSelected( 
aTree.get_child("params").get_child("selected").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("3"), sSelected);
     }
 }
@@ -3177,11 +3177,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButtonNoSelectio
     // None of the items is selected
     CPPUNIT_ASSERT(!m_aFormFieldButton.isEmpty());
     {
-        std::stringstream aStream(m_aFormFieldButton.getStr());
+        std::stringstream aStream((std::string(m_aFormFieldButton)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
 
-        OString sSelected = 
aTree.get_child("params").get_child("selected").get_value<std::string>().c_str();
+        OString sSelected( 
aTree.get_child("params").get_child("selected").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("-1"), sSelected);
     }
 }
@@ -3189,7 +3189,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButtonNoSelectio
 static void lcl_extractHandleParameters(std::string_view selection, sal_Int32& 
id, sal_Int32& x, sal_Int32& y)
 {
     OString extraInfo( selection.substr(selection.find("{")) );
-    std::stringstream aStream(extraInfo.getStr());
+    std::stringstream aStream((std::string(extraInfo)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     boost::property_tree::ptree
@@ -3263,14 +3263,14 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButtonNoItem)
     // There is not item specified for the field
     CPPUNIT_ASSERT(!m_aFormFieldButton.isEmpty());
     {
-        std::stringstream aStream(m_aFormFieldButton.getStr());
+        std::stringstream aStream((std::string(m_aFormFieldButton)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
 
         boost::property_tree::ptree aItems = 
aTree.get_child("params").get_child("items");
         CPPUNIT_ASSERT_EQUAL(size_t(0), aItems.size());
 
-        OString sSelected = 
aTree.get_child("params").get_child("selected").get_value<std::string>().c_str();
+        OString sSelected( 
aTree.get_child("params").get_child("selected").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("-1"), sSelected);
     }
 }
@@ -3325,7 +3325,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testTableCommentRemoveCallback)
     Scheduler::ProcessEventsToIdle();
 
     //check for comment remove callback
-    OString 
sAction(aView.m_aComment.get_child("action").get_value<std::string>().c_str());
+    OString 
sAction(aView.m_aComment.get_child("action").get_value<std::string>());
     CPPUNIT_ASSERT_EQUAL(OString("Remove"), sAction);
 }
 
@@ -3569,17 +3569,17 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testContentControl)
     // Without the accompanying fix in place, this test would have failed, no 
callback was emitted.
     CPPUNIT_ASSERT(!m_aContentControl.isEmpty());
     {
-        std::stringstream aStream(m_aContentControl.getStr());
+        std::stringstream aStream((std::string(m_aContentControl)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
-        OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+        OString sAction( aTree.get_child("action").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("show"), sAction);
-        OString sRectangles = 
aTree.get_child("rectangles").get_value<std::string>().c_str();
+        OString sRectangles( 
aTree.get_child("rectangles").get_value<std::string>() );
         CPPUNIT_ASSERT(!sRectangles.isEmpty());
         // Without the accompanying fix in place, this test would have failed 
width:
         // uncaught exception of type std::exception (or derived).
         // - No such node (alias)
-        OString sAlias = 
aTree.get_child("alias").get_value<std::string>().c_str();
+        OString sAlias( aTree.get_child("alias").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("my alias"), sAlias);
     }
 
@@ -3587,10 +3587,10 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testContentControl)
     pWrtShell->SttEndDoc(/*bStt=*/true);
 
     // Then make sure that the callback is emitted again:
-    std::stringstream aStream(m_aContentControl.getStr());
+    std::stringstream aStream((std::string(m_aContentControl)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
-    OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+    OString sAction( aTree.get_child("action").get_value<std::string>() );
     CPPUNIT_ASSERT_EQUAL(OString("hide"), sAction);
 }
 
@@ -3637,12 +3637,12 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownContentControl)
     // Then make sure that the callback is emitted:
     CPPUNIT_ASSERT(!m_aContentControl.isEmpty());
     {
-        std::stringstream aStream(m_aContentControl.getStr());
+        std::stringstream aStream((std::string(m_aContentControl)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
-        OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+        OString sAction( aTree.get_child("action").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("show"), sAction);
-        OString sRectangles = 
aTree.get_child("rectangles").get_value<std::string>().c_str();
+        OString sRectangles( 
aTree.get_child("rectangles").get_value<std::string>() );
         CPPUNIT_ASSERT(!sRectangles.isEmpty());
         boost::optional<boost::property_tree::ptree&> oItems = 
aTree.get_child_optional("items");
         CPPUNIT_ASSERT(oItems);
@@ -3712,10 +3712,10 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testPictureContentControl)
     // Then make sure that the callback is emitted:
     // Without the accompanying fix in place, this test would have failed, no 
callback was emitted.
     CPPUNIT_ASSERT(!m_aContentControl.isEmpty());
-    std::stringstream aStream(m_aContentControl.getStr());
+    std::stringstream aStream((std::string(m_aContentControl)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
-    OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+    OString sAction( aTree.get_child("action").get_value<std::string>() );
     CPPUNIT_ASSERT_EQUAL(OString("change-picture"), sAction);
 
     // And when replacing the image:
@@ -3764,12 +3764,12 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDateContentControl)
     // Then make sure that the callback is emitted:
     CPPUNIT_ASSERT(!m_aContentControl.isEmpty());
     {
-        std::stringstream aStream(m_aContentControl.getStr());
+        std::stringstream aStream((std::string(m_aContentControl)));
         boost::property_tree::ptree aTree;
         boost::property_tree::read_json(aStream, aTree);
-        OString sAction = 
aTree.get_child("action").get_value<std::string>().c_str();
+        OString sAction( aTree.get_child("action").get_value<std::string>() );
         CPPUNIT_ASSERT_EQUAL(OString("show"), sAction);
-        OString sRectangles = 
aTree.get_child("rectangles").get_value<std::string>().c_str();
+        OString sRectangles( 
aTree.get_child("rectangles").get_value<std::string>() );
         CPPUNIT_ASSERT(!sRectangles.isEmpty());
         boost::optional<boost::property_tree::ptree&> oDate = 
aTree.get_child_optional("date");
         CPPUNIT_ASSERT(oDate);
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index aeb357f1b619..a0356dfec4e5 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -1216,13 +1216,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testImageComment)
     tools::JsonWriter aJsonWriter;
     pTextDoc->getPostIts(aJsonWriter);
     OString pChar = aJsonWriter.finishAndGetAsOString();
-    std::stringstream aStream(pChar.getStr());
+    std::stringstream aStream((std::string(pChar)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     for (const boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("comments"))
     {
         const boost::property_tree::ptree& rComment = rValue.second;
-        OString aAnchorPos(rComment.get<std::string>("anchorPos").c_str());
+        OString aAnchorPos(rComment.get<std::string>("anchorPos"));
         OString aExpected
             = OString::number(nFrameLeft) + ", " + OString::number(nFrameTop) 
+ ", 0, 0";
         CPPUNIT_ASSERT_EQUAL(aExpected, aAnchorPos);
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 7e2ddb31d1c6..9a3777fcc103 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1586,14 +1586,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535)
     tools::JsonWriter aJsonWriter;
     pTextDoc->getPostIts(aJsonWriter);
     OString pChar = aJsonWriter.finishAndGetAsOString();
-    std::stringstream aStream(pChar.getStr());
+    std::stringstream aStream((std::string(pChar)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     OString sCommentText;
     for (const boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("comments"))
     {
         const boost::property_tree::ptree& rComment = rValue.second;
-        sCommentText = OString(rComment.get<std::string>("text").c_str());
+        sCommentText = OString(rComment.get<std::string>("text"));
     }
     // This was false (lost comment with spelling replacement)
     CPPUNIT_ASSERT_EQUAL(OString("with comment"), sCommentText);
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index d6816c67eef4..65a1352dc79b 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -1634,13 +1634,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132603)
     tools::JsonWriter aJsonWriter;
     pTextDoc->getPostIts(aJsonWriter);
     OString pChar = aJsonWriter.finishAndGetAsOString();
-    std::stringstream aStream(pChar.getStr());
+    std::stringstream aStream((std::string(pChar)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     for (const boost::property_tree::ptree::value_type& rValue : 
aTree.get_child("comments"))
     {
         const boost::property_tree::ptree& rComment = rValue.second;
-        OString aText(rComment.get<std::string>("text").c_str());
+
+        OString aText(rComment.get<std::string>("text"));
         CPPUNIT_ASSERT_EQUAL(OString("Comment"), aText);
     }
 }
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 1336fb39ee6c..b9f03d42d5ee 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -235,7 +235,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormFields)
 
     // Then make sure we find the 2 items and ignore the bibliography:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     // Without the accompanying fix in place, this test would have failed with:
@@ -268,7 +268,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, 
testGetDocumentProperties)
 
     // Then make sure we find the 2 properties and ignore the other one:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     // Without the accompanying fix in place, this test would have failed with:
@@ -309,7 +309,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmarks)
 
     // Then make sure we get the 2 references but not the bibliography:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     // Without the accompanying fix in place, this test would have failed with:
@@ -346,7 +346,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetFields)
 
     // Then make sure we get the 1 refmark:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     // Without the accompanying fix in place, this test would have failed with:
@@ -401,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormField)
 
     // Then make sure we find the inserted fieldmark:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     // Without the accompanying fix in place, this test would have failed with:
@@ -433,7 +433,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetSections)
 
     // Make sure we find our just inserted section:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     // Without the accompanying fix in place, this test would have failed with:
@@ -465,7 +465,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmark)
 
     // Then make sure we find the inserted bookmark:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     boost::property_tree::ptree aBookmark = aTree.get_child("bookmark");
@@ -499,7 +499,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetField)
 
     // Then make sure we find the inserted refmark:
     OString pJSON(aJsonWriter.finishAndGetAsOString());
-    std::stringstream aStream(pJSON.getStr());
+    std::stringstream aStream((std::string(pJSON)));
     boost::property_tree::ptree aTree;
     boost::property_tree::read_json(aStream, aTree);
     boost::property_tree::ptree aBookmark = aTree.get_child("setRef");
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8904e8b14d4a..dec4181c4846 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -407,7 +407,7 @@ void 
SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe
     while (pViewShell)
     {
         if (pView && pView->GetDocId() == pViewShell->GetDocId())
-            pViewShell->libreOfficeKitViewCallback(nType == 
RedlineNotification::Modify ? LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED : 
LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED, aPayload.c_str());
+            pViewShell->libreOfficeKitViewCallback(nType == 
RedlineNotification::Modify ? LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED : 
LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED, OString(aPayload));
         pViewShell = SfxViewShell::GetNext(*pViewShell);
     }
 }
diff --git a/sw/source/core/model/SearchResultLocator.cxx 
b/sw/source/core/model/SearchResultLocator.cxx
index 8ce21c7255ec..c1b92c47a7cc 100644
--- a/sw/source/core/model/SearchResultLocator.cxx
+++ b/sw/source/core/model/SearchResultLocator.cxx
@@ -126,7 +126,7 @@ bool SearchResultLocator::tryParseJSON(const char* pPayload,
             OUString sObjectName;
             if (!sJsonObjectName.empty())
             {
-                OString sObjectNameOString(sJsonObjectName.c_str());
+                OString sObjectNameOString(sJsonObjectName);
                 sObjectName = OStringToOUString(sObjectNameOString, 
RTL_TEXTENCODING_UTF8);
             }
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index bc0102aef06a..18d0769cd3b4 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1142,12 +1142,11 @@ void SwViewShell::SizeChgNotify()
             if (comphelper::LibreOfficeKit::isActive())
             {
                 Size aDocSize = GetDocSize();
-                std::stringstream ss;
-                ss << aDocSize.Width() + 2 * DOCUMENTBORDER << ", " << 
aDocSize.Height() + 2 * DOCUMENTBORDER;
-                OString sSize = ss.str().c_str();
+                OString sPayload = OString::number(aDocSize.Width() + 2 * 
DOCUMENTBORDER) +
+                    ", " + OString::number(aDocSize.Height() + 2 * 
DOCUMENTBORDER);
 
                 SwXTextDocument* pModel = 
comphelper::getFromUnoTunnel<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument());
-                SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), 
sSize, pModel);
+                SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), 
sPayload, pModel);
             }
         }
     }
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index e0ceb396fc81..68c1a00221f7 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -186,7 +186,7 @@ namespace {
 
         if (pView)
         {
-            pView->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, 
aPayload.c_str());
+            pView->libreOfficeKitViewCallback(LOK_CALLBACK_COMMENT, 
OString(aPayload));
         }
     }
 
diff --git a/sw/source/uibase/uiview/viewling.cxx 
b/sw/source/uibase/uiview/viewling.cxx
index 8cf00ffe010f..87dea97768cc 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -788,7 +788,7 @@ bool SwView::ExecSpellPopup(const Point& rPt)
 
                                 std::stringstream aStream;
                                 boost::property_tree::write_json(aStream, 
aRoot, true);
-                                
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
aStream.str().c_str());
+                                
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, 
OString(aStream.str()));
                             }
                         }
                         else
diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 55b5217e132e..820ae0b63948 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -118,7 +118,7 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem 
const * pSearchItem, SwW
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
-    OString aPayload = aStream.str().c_str();
+    OString aPayload( aStream.str() );
 
     
pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION,
 aPayload);
 
diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index 5d41fadf67ea..9f1bf5f9ce36 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1615,7 +1615,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
 
                     std::stringstream aStream;
                     boost::property_tree::write_json(aStream, aRootTree);
-                    
rSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TAB_STOP_LIST, 
aStream.str().c_str());
+                    
rSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TAB_STOP_LIST, 
OString(aStream.str()));
                 }
             }
             break;
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index fb0c96f846a5..2c8ae1a36a25 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -16,7 +16,7 @@
 #include <tools/stream.hxx>
 #include <tools/urlobj.hxx>
 
-#define OUSTR_TO_STDSTR( oustr ) std::string( OUStringToOString( oustr, 
RTL_TEXTENCODING_ASCII_US ).getStr() )
+#define OUSTR_TO_STDSTR( oustr ) std::string( OUStringToOString( oustr, 
RTL_TEXTENCODING_ASCII_US ) )
 
 template<> inline std::string 
CPPUNIT_NS::assertion_traits<INetProtocol>::toString(
     const INetProtocol& x )
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx 
b/ucb/source/ucp/cmis/auth_provider.cxx
index c3f99f5f3de5..2e81cfb23b5e 100644
--- a/ucb/source/ucp/cmis/auth_provider.cxx
+++ b/ucb/source/ucp/cmis/auth_provider.cxx
@@ -7,7 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#define OUSTR_TO_STDSTR(s) std::string( OUStringToOString( s, 
RTL_TEXTENCODING_UTF8 ).getStr() )
+#define OUSTR_TO_STDSTR(s) std::string( OUStringToOString( s, 
RTL_TEXTENCODING_UTF8 ) )
 #define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), 
RTL_TEXTENCODING_UTF8 )
 
 #include <com/sun/star/task/XInteractionHandler.hpp>
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx 
b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index b6ee48ab7906..0ffd6abf3769 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -41,7 +41,7 @@
 #include "cmis_resultset.hxx"
 #include <memory>
 
-#define OUSTR_TO_STDSTR(s) std::string( OUStringToOString( s, 
RTL_TEXTENCODING_UTF8 ).getStr() )
+#define OUSTR_TO_STDSTR(s) std::string( OUStringToOString( s, 
RTL_TEXTENCODING_UTF8 ) )
 #define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), 
RTL_TEXTENCODING_UTF8 )
 
 using namespace com::sun::star;
diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 04f27b916db3..71303b211cec 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -154,7 +154,7 @@ namespace Translate
 #endif
         OString sPath(OUStringToOString(path, eEncoding));
 #endif
-        gen.add_messages_path(sPath.getStr());
+        gen.add_messages_path(std::string(sPath));
 #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && 
!defined EMSCRIPTEN
         // allow gettext to find these .mo files e.g. so gtk dialogs can use 
them
         bindtextdomain(aPrefixName.data(), sPath.getStr());
@@ -202,7 +202,7 @@ namespace Translate
 
 #endif
 
-        std::locale aRet(gen(sIdentifier.getStr()));
+        std::locale aRet(gen(std::string(sIdentifier)));
 
         aCache[sUnique] = aRet;
         return aRet;
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index daf70a1c589d..94af8f8b0af5 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -134,8 +134,8 @@ static void checkCompareGlyphs( const SalLayoutGlyphs& 
aGlyphs1, const SalLayout
     // And check it's the same.
     for( int level = 0; level < MAX_FALLBACK; ++level )
     {
-        const std::string messageLevel = OString(message.c_str()
-            + OString::Concat(", level: ") + OString::number(level)).getStr();
+        const std::string messageLevel( 
Concat2View(OString::Concat(std::string_view(message))
+            + ", level: " + OString::number(level)) );
         if( aGlyphs1.Impl(level) == nullptr)
         {
             CPPUNIT_ASSERT_MESSAGE(messageLevel, aGlyphs2.Impl(level) == 
nullptr);
@@ -155,7 +155,7 @@ static void checkCompareGlyphs( const SalLayoutGlyphs& 
aGlyphs1, const SalLayout
 
 static void testCachedGlyphs( const OUString& aText, const OUString& aFontName 
)
 {
-    const std::string message = OUString("Font: " + aFontName + ", text: '" + 
aText + "'").toUtf8().getStr();
+    const std::string message( OUString("Font: " + aFontName + ", text: '" + 
aText + "'").toUtf8() );
     ScopedVclPtrInstance<VirtualDevice> pOutputDevice;
     vcl::Font aFont( aFontName, Size(0, 12));
     pOutputDevice->SetFont( aFont );
@@ -188,7 +188,7 @@ void VclComplexTextTest::testCaching()
 
 static void testCachedGlyphsSubstring( const OUString& aText, const OUString& 
aFontName, bool rtl )
 {
-    const std::string prefix = OUString("Font: " + aFontName + ", text: '" + 
aText + "'").toUtf8().getStr();
+    const std::string prefix( OUString("Font: " + aFontName + ", text: '" + 
aText + "'").toUtf8() );
     ScopedVclPtrInstance<VirtualDevice> pOutputDevice;
     // BiDiStrong is needed, otherwise SalLayoutGlyphsImpl::cloneCharRange() 
will not do anything.
     vcl::text::ComplexTextLayoutFlags layoutFlags = 
vcl::text::ComplexTextLayoutFlags::BiDiStrong;
diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx
index 5bdb6c8388e5..575b9c74417c 100644
--- a/vcl/source/app/unohelp2.cxx
+++ b/vcl/source/app/unohelp2.cxx
@@ -69,7 +69,7 @@ namespace vcl::unohelper {
                 aTree.put("mimeType", "text/plain");
                 std::stringstream aStream;
                 boost::property_tree::write_json(aStream, aTree);
-                
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_CLIPBOARD_CHANGED, 
aStream.str().c_str());
+                
pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_CLIPBOARD_CHANGED, 
OString(aStream.str()));
             }
         }
         catch( const uno::Exception& )
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index d0eca8ab0acf..10c68412a627 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -835,7 +835,7 @@ void Edit::ImplInsertText( const OUString& rStr, const 
Selection* pNewSel, bool
 
                 // the text that needs to be checked is only the one
                 // before the current cursor position
-                const OUString aOldText( maText.getStr(), nTmpPos);
+                const OUString aOldText( maText.subView(0, nTmpPos) );
                 OUString aTmpText( aOldText );
                 if 
(officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingTypeAndReplace::get())
                 {
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 726af088d89c..3142106609ed 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2318,7 +2318,7 @@ static bool ImplIsValidTimePortion( bool 
_bSkipInvalidCharacters, const OUString
 
 static bool ImplCutTimePortion( OUStringBuffer& _rStr, sal_Int32 _nSepPos, 
bool _bSkipInvalidCharacters, short* _pPortion )
 {
-    OUString sPortion(_rStr.getStr(), _nSepPos );
+    OUString sPortion(_rStr.subView(0, _nSepPos));
 
     if (_nSepPos < _rStr.getLength())
         _rStr.remove(0, _nSepPos + 1);
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index fc38ee0a5a97..1b85e23fb584 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -575,7 +575,7 @@ OString toHexString(const std::vector<unsigned char>& a)
         aStrm << std::setw(2) << std::setfill('0') << std::hex << 
static_cast<int>(i);
     }
 
-    return OString(aStrm.str().c_str());
+    return OString(aStrm.str());
 }
 
 void writeBitmapContentChecksum(tools::XmlWriter& rWriter, Bitmap const& 
rBitmap)
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index f4fd53618960..7612c1128af3 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21281,7 +21281,7 @@ private:
             nRet += (m_nMRUCount + 1);
         }
 
-        OString aStr(OUStringToOString(rStr, RTL_TEXTENCODING_UTF8).getStr());
+        OString aStr(OUStringToOString(rStr, RTL_TEXTENCODING_UTF8));
         do
         {
             gchar* pStr;
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 717eb5ea9788..a9535323b480 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -694,7 +694,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal )
                 //replace it with a hard-hyphen (0x2d)
                 //-> this fixes missing hyphen export in PDF etc.
                 // see tdf#101626
-                std::string sLevelText = rVal.getString().replace(0xad, 
0x2d).toUtf8().getStr();
+                std::string sLevelText( rVal.getString().replace(0xad, 
0x2d).toUtf8() );
 
                 // DOCX level-text contains levels definition in format 
"%1.%2.%3"
                 // we need to convert it to LO internal representation: 
"%1%.%2%.%3%"
diff --git a/writerfilter/source/dmapper/TagLogger.cxx 
b/writerfilter/source/dmapper/TagLogger.cxx
index 7116ef2a5e58..7a96b4aa6041 100644
--- a/writerfilter/source/dmapper/TagLogger.cxx
+++ b/writerfilter/source/dmapper/TagLogger.cxx
@@ -162,7 +162,7 @@ namespace writerfilter
 #ifdef DBG_UTIL
     void TagLogger::attribute(const std::string & name, std::u16string_view 
value)
     {
-        attribute( name, OUStringToOString( value, RTL_TEXTENCODING_ASCII_US 
).getStr() );
+        attribute( name, std::string(OUStringToOString( value, 
RTL_TEXTENCODING_ASCII_US )) );
     }
 
     void TagLogger::attribute(const std::string & name, sal_uInt32 value)
@@ -223,7 +223,7 @@ namespace writerfilter
 
     void TagLogger::chars(std::u16string_view rChars)
     {
-        chars(OUStringToOString(rChars, RTL_TEXTENCODING_ASCII_US).getStr());
+        chars(std::string(OUStringToOString(rChars, 
RTL_TEXTENCODING_ASCII_US)));
     }
 
     void TagLogger::endElement()
diff --git a/writerfilter/source/dmapper/domainmapperfactory.cxx 
b/writerfilter/source/dmapper/domainmapperfactory.cxx
index eab017c57a2b..e52d5d2e8dec 100644
--- a/writerfilter/source/dmapper/domainmapperfactory.cxx
+++ b/writerfilter/source/dmapper/domainmapperfactory.cxx
@@ -23,7 +23,7 @@ 
DomainMapperFactory::createMapper(css::uno::Reference<css::uno::XComponentContex
 #ifdef DBG_UTIL
     OUString sURL
         = rMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, 
OUString());
-    ::std::string sURLc = OUStringToOString(sURL, 
RTL_TEXTENCODING_ASCII_US).getStr();
+    ::std::string sURLc(OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US));
 
     if (getenv("SW_DEBUG_WRITERFILTER"))
         TagLogger::getInstance().setFileName(sURLc);
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index fd18e04e6908..36c41187a560 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -281,7 +281,7 @@ OUString OOXMLStringValue::getString() const
 #ifdef DBG_UTIL
 std::string OOXMLStringValue::toString() const
 {
-    return OUStringToOString(mStr, RTL_TEXTENCODING_ASCII_US).getStr();
+    return std::string(OUStringToOString(mStr, RTL_TEXTENCODING_ASCII_US));
 }
 #endif
 
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx 
b/writerfilter/source/rtftok/rtfsprm.cxx
index dfbb6093bd28..3efb60eb29d8 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -49,7 +49,7 @@ std::string RTFSprm::toString() const
         aBuf.append(sResult.c_str());
     aBuf.append("', '" + m_pValue->toString() + "')");
 
-    return aBuf.makeStringAndClear().getStr();
+    return std::string(aBuf);
 }
 #endif
 
diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx 
b/xmloff/source/style/XMLFontAutoStylePool.cxx
index 5b00bbd7d97a..d7b880208be5 100644
--- a/xmloff/source/style/XMLFontAutoStylePool.cxx
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -573,7 +573,7 @@ static OString convertToHashString(std::vector<unsigned 
char> const & rHash)
         aStringStream << std::setw(2) << std::setfill('0') << std::hex << 
int(rByte);
     }
 
-    return aStringStream.str().c_str();
+    return OString(aStringStream.str());
 }
 
 static OString getFileHash(OUString const & rFileUrl)

Reply via email to