From 4e2b089020d6af65080ba54b5aa64c2595f1b341 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 1 Dec 2025 12:02:39 +0200 Subject: [PATCH] loplugin:stringloop resurrect the plugin and run it over the codebase Change-Id: I443a75961124aabd1e62b3c4bc166d52e4621b52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194870 Reviewed-by: Noel Grandin Tested-by: Jenkins --- chart2/qa/extras/charttest.hxx | 6 +- compilerplugins/clang/stringloop.cxx | 307 ++++++++++++++++++ compilerplugins/clang/test/stringloop.cxx | 41 +++ cui/source/dialogs/cuigaldlg.cxx | 16 +- cui/source/options/appearance.cxx | 7 +- cui/source/options/connpooloptions.cxx | 9 +- cui/source/options/fontsubs.cxx | 9 +- cui/source/options/optaccessibility.cxx | 9 +- cui/source/options/optasian.cxx | 11 +- cui/source/options/optbasic.cxx | 9 +- cui/source/options/optchart.cxx | 9 +- cui/source/options/optctl.cxx | 11 +- cui/source/options/optdeepl.cxx | 9 +- cui/source/options/optfltr.cxx | 19 +- cui/source/options/optgdlg.cxx | 28 +- cui/source/options/optgenrl.cxx | 8 +- cui/source/options/opthtml.cxx | 9 +- cui/source/options/optinet2.cxx | 22 +- cui/source/options/optjava.cxx | 10 +- cui/source/options/optjsearch.cxx | 9 +- cui/source/options/optlanguagetool.cxx | 11 +- cui/source/options/optlingu.cxx | 8 +- cui/source/options/optsave.cxx | 9 +- cui/source/options/optupdt.cxx | 25 +- cui/source/tabpages/tparea.cxx | 7 +- dbaccess/source/ui/misc/UITools.cxx | 3 +- desktop/source/lib/init.cxx | 10 +- emfio/source/reader/emfreader.cxx | 15 +- filter/source/msfilter/util.cxx | 8 +- fpicker/source/office/fileview.cxx | 10 +- jvmfwk/source/framework.cxx | 7 +- oox/source/vml/vmlinputstream.cxx | 11 +- sax/qa/cppunit/xmlimport.cxx | 4 +- sc/qa/unit/functions_test.cxx | 16 +- sc/qa/unit/tiledrendering/tiledrendering.cxx | 8 +- sc/source/core/data/olinetab.cxx | 12 +- sc/source/ui/optdlg/opredlin.cxx | 6 +- sc/source/ui/optdlg/tpcalc.cxx | 10 +- sc/source/ui/optdlg/tpcompatibility.cxx | 7 +- sc/source/ui/optdlg/tpdefaults.cxx | 8 +- sc/source/ui/optdlg/tpformula.cxx | 12 +- sc/source/ui/optdlg/tpprint.cxx | 8 +- sc/source/ui/optdlg/tpusrlst.cxx | 8 +- sc/source/ui/optdlg/tpview.cxx | 18 +- sd/source/ui/dlg/prntopts.cxx | 11 +- sd/source/ui/dlg/tpoption.cxx | 16 +- .../devtools/ObjectInspectorTreeHandler.cxx | 22 +- sfx2/source/dialog/printopt.cxx | 12 +- sfx2/source/sidebar/uiobject.cxx | 7 +- solenv/CompilerTest_compilerplugins_clang.mk | 1 + starmath/source/dialog.cxx | 10 +- svl/source/numbers/zforscan.cxx | 7 +- .../passwordcontainer/passwordcontainer.cxx | 6 +- svtools/source/misc/embedhlp.cxx | 29 +- svx/source/dialog/optgrid.cxx | 9 +- svx/source/svdraw/svdmrkv.cxx | 8 +- svx/source/svdraw/svdpdf.cxx | 12 +- sw/qa/extras/globalfilter/globalfilter.cxx | 6 +- sw/qa/extras/odfexport/odfexport.cxx | 6 +- sw/qa/extras/uiwriter/uiwriter5.cxx | 6 +- sw/source/core/access/acctable.cxx | 13 +- sw/source/core/doc/number.cxx | 8 +- sw/source/core/unocore/unochart.cxx | 14 +- sw/source/filter/html/htmlforw.cxx | 42 +-- sw/source/ui/config/mailconfigpage.cxx | 11 +- sw/source/ui/config/optload.cxx | 18 +- sw/source/ui/config/optpage.cxx | 67 ++-- sw/source/uibase/uno/loktxdoc.cxx | 12 +- test/source/a11y/AccessibilityTools.cxx | 8 +- tools/qa/cppunit/test_reversemap.cxx | 9 +- vcl/backendtest/GraphicsRenderTests.cxx | 19 +- vcl/qa/cppunit/FontFeatureTest.cxx | 18 +- vcl/qa/cppunit/pdfexport/pdfexport.cxx | 6 +- vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 6 +- vcl/skia/SkiaHelper.cxx | 7 +- .../AccessibleTextAttributeHelper.cxx | 15 +- vcl/source/control/button.cxx | 6 +- vcl/source/gdi/embeddedfontsmanager.cxx | 6 +- .../source/dialogs/certificatechooser.cxx | 10 +- 79 files changed, 820 insertions(+), 442 deletions(-) create mode 100644 compilerplugins/clang/stringloop.cxx create mode 100644 compilerplugins/clang/test/stringloop.cxx diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index a8edb86bbde9..9935456215fb 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -452,11 +452,11 @@ OUString ChartTest::getTitleString( const Reference& xTitled ) uno::Reference xTitle = xTitled->getTitleObject(); CPPUNIT_ASSERT(xTitle.is()); const uno::Sequence > aFSSeq = xTitle->getText(); - OUString aText; + OUStringBuffer aText; for (auto const & fs : aFSSeq) - aText += fs->getString(); + aText.append(fs->getString()); - return aText; + return aText.makeStringAndClear(); } sal_Int32 ChartTest::getNumberFormatFromAxis( const Reference& xAxis ) diff --git a/compilerplugins/clang/stringloop.cxx b/compilerplugins/clang/stringloop.cxx new file mode 100644 index 000000000000..92d8a1d395d0 --- /dev/null +++ b/compilerplugins/clang/stringloop.cxx @@ -0,0 +1,307 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "check.hxx" +#include "plugin.hxx" +#include "config_clang.h" +#include + +/** Look for OUString/OString being appended to inside a loop, where OUStringBuffer/OStringBuffer would be a better idea + */ +namespace +{ +class StringLoop : public clang::RecursiveASTVisitor, public loplugin::Plugin +{ +public: + explicit StringLoop(loplugin::InstantiationData const& rData) + : Plugin(rData) + { + } + + void run() override; + bool TraverseForStmt(ForStmt*); + bool TraverseCXXForRangeStmt(CXXForRangeStmt*); + bool TraverseDoStmt(DoStmt*); + bool TraverseWhileStmt(WhileStmt*); + bool VisitVarDecl(VarDecl const*); + bool VisitCallExpr(CallExpr const*); + +private: + int m_insideLoop = 0; + using VarDeclList = std::vector; + std::vector m_varsPerLoopLevel; +}; + +void StringLoop::run() +{ + // Various places are not worth changing, the code becomes too awkward + // Just exclude stuff as I go + StringRef fn(handler.getMainFileName()); + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/bridges/")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/cppuhelper/source/shlib.cxx")) + return; + // if (loplugin::hasPathnamePrefix(fn, SRCDIR "/tools/qa/")) + // return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/svl/source/numbers/zformat.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/svl/source/numbers/zforscan.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/control/combobox.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/control/calendar.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/treelist/svtabbx.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/pdf/pdfwriter_impl.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/jsdialog/jsdialogregister.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/idl/source/prj/command.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/framework/source/accelerators/storageholder.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/basic/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sfx2/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/connectivity/source/drivers/odbc/OConnection.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/connectivity/source/parse/sqliterator.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/editeng/source/editeng/eertfpar.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/editeng/source/rtf/svxrtf.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/svx/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/basctl/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/filter/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/hwpfilter/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/cui/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/dbaccess/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/desktop/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/extensions/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/lingucomponent/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/i18npool/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/embeddedobj/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sd/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/xmloff/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/xmlhelp/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/forms/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/tool/address.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/view/gridwin2.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/tool/compiler.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/tool/interpr1.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/docshell/impex.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/miscdlgs/acredlin.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/pagedlg/areasdlg.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/dbgui/scuiasciiopt.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/data/SolverSettings.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/unoobj/solveruno.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/filter/html/htmlpars.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sdext/")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/layout/dbg_lay.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/edit/edattr.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/tox/ToxTextGenerator.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/html/parcss1.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/html/svxcss1.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/fields/authfld.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ascii/ascatr.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/unocore/unosect.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/unocore/unoobj.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/edit/acorrect.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/html/swhtml.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/uibase/utlui/gloslst.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/doc/doctxm.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/uibase/docvw/edtwin.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ww8/ww8atr.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ww8/ww8scan.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ww8/ww8par5.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/ui/fldui/fldfunc.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/ui/dbui/dbinsdlg.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/ui/index/cnttab.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/ui/dbui/mmlayoutpage.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/ui/dbui/mmresultdialogs.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/uibase/shells/textsh1.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/uibase/utlui/content.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, + SRCDIR "/sw/source/writerfilter/dmapper/NumberingManager.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, + SRCDIR "/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx")) + return; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/ucb/source/ucp/file/bc.cxx")) + return; + + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); +} + +bool StringLoop::TraverseForStmt(ForStmt* stmt) +{ + ++m_insideLoop; + m_varsPerLoopLevel.push_back({}); + auto const ret = RecursiveASTVisitor::TraverseForStmt(stmt); + m_varsPerLoopLevel.pop_back(); + --m_insideLoop; + return ret; +} + +bool StringLoop::TraverseCXXForRangeStmt(CXXForRangeStmt* stmt) +{ + ++m_insideLoop; + m_varsPerLoopLevel.push_back({}); + auto const ret = RecursiveASTVisitor::TraverseCXXForRangeStmt(stmt); + m_varsPerLoopLevel.pop_back(); + --m_insideLoop; + return ret; +} + +bool StringLoop::TraverseDoStmt(DoStmt* stmt) +{ + ++m_insideLoop; + m_varsPerLoopLevel.push_back({}); + auto const ret = RecursiveASTVisitor::TraverseDoStmt(stmt); + m_varsPerLoopLevel.pop_back(); + --m_insideLoop; + return ret; +} + +bool StringLoop::TraverseWhileStmt(WhileStmt* stmt) +{ + ++m_insideLoop; + m_varsPerLoopLevel.push_back({}); + auto const ret = RecursiveASTVisitor::TraverseWhileStmt(stmt); + m_varsPerLoopLevel.pop_back(); + --m_insideLoop; + return ret; +} + +bool StringLoop::VisitVarDecl(VarDecl const* varDecl) +{ + if (ignoreLocation(varDecl)) + return true; + if (!m_insideLoop) + return true; + m_varsPerLoopLevel.back().push_back(varDecl); + return true; +} + +bool StringLoop::VisitCallExpr(CallExpr const* callExpr) +{ + if (ignoreLocation(callExpr)) + return true; + if (!m_insideLoop) + return true; + auto operatorCallExpr = dyn_cast(callExpr); + if (!operatorCallExpr) + return true; + if (operatorCallExpr->getOperator() != OO_PlusEqual) + return true; + + if (auto memberExpr = dyn_cast(callExpr->getArg(0))) + { + auto tc = loplugin::TypeCheck(memberExpr->getType()); + if (!tc.Class("OUString").Namespace("rtl").GlobalNamespace() + && !tc.Class("OString").Namespace("rtl").GlobalNamespace()) + return true; + auto fieldDecl = dyn_cast(memberExpr->getMemberDecl()); + if (isInUnoIncludeFile( + compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocation()))) + return true; + if (ignoreLocation(compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocation()))) + return true; + report(DiagnosticsEngine::Warning, + "appending to OUString in loop, rather use OUStringBuffer", + operatorCallExpr->getBeginLoc()) + << operatorCallExpr->getSourceRange(); + report(DiagnosticsEngine::Note, "field here", fieldDecl->getBeginLoc()) + << fieldDecl->getSourceRange(); + } + else if (auto declRefExpr = dyn_cast(callExpr->getArg(0))) + { + if (auto varDecl = dyn_cast(declRefExpr->getDecl())) + { + auto tc = loplugin::TypeCheck(varDecl->getType()); + if (!tc.Class("OUString").Namespace("rtl").GlobalNamespace() + && !tc.Class("OString").Namespace("rtl").GlobalNamespace()) + return true; + // if the var is at the same block scope as the +=, not interesting + auto vars = m_varsPerLoopLevel.back(); + if (std::find(vars.begin(), vars.end(), varDecl) != vars.end()) + return true; + report(DiagnosticsEngine::Warning, + "appending to OUString in loop, rather use OUStringBuffer", + operatorCallExpr->getBeginLoc()) + << operatorCallExpr->getSourceRange(); + report(DiagnosticsEngine::Note, "var here", varDecl->getBeginLoc()) + << varDecl->getSourceRange(); + } + } + return true; +} + +/** off by default because it needs hand-holding */ +loplugin::Plugin::Registration X("stringloop", false); + +} // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/test/stringloop.cxx b/compilerplugins/clang/test/stringloop.cxx new file mode 100644 index 000000000000..7a02cd9ceb07 --- /dev/null +++ b/compilerplugins/clang/test/stringloop.cxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "sal/config.h" +#include "rtl/string.hxx" +#include "rtl/ustring.hxx" + +#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13 +#pragma clang diagnostic ignored "-Wunused-but-set-variable" + +struct Foo +{ + OUString m_field; // expected-note {{field here [loplugin:stringloop]}} + void func1() + { + for (int i = 0; i < 10; ++i) + m_field += "xxx"; + // expected-error@-1 {{appending to OUString in loop, rather use OUStringBuffer [loplugin:stringloop]}} + // no warning expected + m_field += "xxx"; + } +}; + +void func2() +{ + OUString s; // expected-note {{var here [loplugin:stringloop]}} + for (int i = 0; i < 10; ++i) + s += "xxx"; // expected-error {{appending to OUString in loop, rather use OUStringBuffer [loplugin:stringloop]}} + + // no warning expected + OUString s2; + s2 += "xxx"; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 57fa59221398..77345d17526f 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -672,7 +672,7 @@ void TPGalleryThemeProperties::FillFilterList() aName = rFilter.GetImportFormatName( i ); bool bInList = false; - OUString aExtensions; + OUStringBuffer aExtensions; int j = 0; OUString sWildcard; while( true ) @@ -683,8 +683,8 @@ void TPGalleryThemeProperties::FillFilterList() if ( aExtensions.indexOf( sWildcard ) == -1 ) { if ( !aExtensions.isEmpty() ) - aExtensions += ";"; - aExtensions += sWildcard; + aExtensions.append(";"); + aExtensions.append(sWildcard); } } aName = addExtension( aName, aExtensions ); @@ -720,7 +720,7 @@ void TPGalleryThemeProperties::FillFilterList() #endif // 'All' filters - OUString aExtensions; + OUStringBuffer aExtensions; // graphic filters for ( i = 0; i < nKeyCount; ++i ) @@ -735,9 +735,9 @@ void TPGalleryThemeProperties::FillFilterList() if ( aExtensions.indexOf( sWildcard ) == -1 ) { if ( !aExtensions.isEmpty() ) - aExtensions += ";"; + aExtensions.append(";"); - aExtensions += sWildcard; + aExtensions.append(sWildcard); } } } @@ -749,8 +749,8 @@ void TPGalleryThemeProperties::FillFilterList() for( sal_Int32 nIndex = 0; nIndex >= 0; ) { if ( !aExtensions.isEmpty() ) - aExtensions += ";"; - aExtensions += OUString::Concat(aWildcard) + o3tl::getToken(aFilter.second, 0, ';', nIndex ); + aExtensions.append(";"); + aExtensions.append(OUString::Concat(aWildcard) + o3tl::getToken(aFilter.second, 0, ';', nIndex )); } } #endif diff --git a/cui/source/options/appearance.cxx b/cui/source/options/appearance.cxx index 0244e83fb9bd..fa3b39b14f58 100644 --- a/cui/source/options/appearance.cxx +++ b/cui/source/options/appearance.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -177,17 +178,17 @@ std::unique_ptr SvxAppearanceTabPage::Create(weld::Container* pPage, OUString SvxAppearanceTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"libreofficethemeslb"_ustr, u"optionslb"_ustr, u"appearancelb"_ustr, u"itemslb"_ustr, u"colorlb"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxAppearanceTabPage::FillItemSet(SfxItemSet* /* rSet */) diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx index a0f3bafa0426..c55b58449ace 100644 --- a/cui/source/options/connpooloptions.cxx +++ b/cui/source/options/connpooloptions.cxx @@ -21,6 +21,7 @@ #include #include "connpooloptions.hxx" #include "connpoolsettings.hxx" +#include #include #include #include @@ -173,13 +174,13 @@ namespace offapp OUString ConnectionPoolOptionsPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"driverslabel"_ustr, u"driverlabel"_ustr, u"timeoutlabel"_ustr, u"driver"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"connectionpooling"_ustr, u"enablepooling"_ustr }; @@ -187,10 +188,10 @@ namespace offapp for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ConnectionPoolOptionsPage::FillItemSet(SfxItemSet* _rSet) diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index ad7e4e8d8011..ffa2d321283a 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -25,6 +25,7 @@ #include #include "fontsubs.hxx" #include +#include /*********************************************************************/ /* */ @@ -148,13 +149,13 @@ std::unique_ptr SvxFontSubstTabPage::Create( weld::Container* pPage, OUString SvxFontSubstTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label4"_ustr, u"label2"_ustr, u"label3"_ustr, u"label1"_ustr, u"label8"_ustr, u"label9"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"usetable"_ustr, u"nonpropfontonly"_ustr }; @@ -162,10 +163,10 @@ OUString SvxFontSubstTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxFontSubstTabPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 57f2312674d6..fc4b210929ed 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -22,6 +22,7 @@ #include #include #include +#include namespace { @@ -113,7 +114,7 @@ std::unique_ptr SvxAccessibilityOptionsTabPage::Create(weld::Contain OUString SvxAccessibilityOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label13"_ustr, u"animationframelabel"_ustr, u"animatedgraphiclabel"_ustr, u"animatedtextlabel"_ustr, u"animatedotherslabel"_ustr, u"label11"_ustr }; @@ -121,7 +122,7 @@ OUString SvxAccessibilityOptionsTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"textselinreadonly"_ustr, @@ -130,10 +131,10 @@ OUString SvxAccessibilityOptionsTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index e9fc8f0f13da..5fe916b3026e 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -143,14 +144,14 @@ std::unique_ptr SvxAsianLayoutPage::Create(weld::Container* pPage, w OUString SvxAsianLayoutPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr, u"languageft"_ustr, u"startft"_ustr, u"endft"_ustr, u"hintft"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"charkerning"_ustr, u"charpunctkerning"_ustr, u"nocompression"_ustr, @@ -159,12 +160,12 @@ OUString SvxAsianLayoutPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xStandardCB->get_label() + " "; + sAllStrings.append(m_xStandardCB->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx index 3b105f27d16d..e544c218b1e4 100644 --- a/cui/source/options/optbasic.cxx +++ b/cui/source/options/optbasic.cxx @@ -20,6 +20,7 @@ #include "optbasic.hxx" #include #include +#include SvxBasicIDEOptionsPage::SvxBasicIDEOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, u"cui/ui/optbasicidepage.ui"_ustr, u"OptBasicIDEPage"_ustr, &rSet) @@ -55,13 +56,13 @@ void SvxBasicIDEOptionsPage::LoadConfig() OUString SvxBasicIDEOptionsPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"codecomplete_enable"_ustr, u"autocorrect"_ustr, u"autoclose_quotes"_ustr, @@ -70,10 +71,10 @@ OUString SvxBasicIDEOptionsPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ ) diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index dce4513adc6a..e90b7289c31c 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -19,6 +19,7 @@ #include "optchart.hxx" #include +#include #include #include #include @@ -189,13 +190,13 @@ std::unique_ptr SvxDefaultColorOptPage::Create( weld::Container* pPa OUString SvxDefaultColorOptPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label20"_ustr, u"label1"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString buttons[] = { u"add"_ustr, u"delete"_ustr, u"default"_ustr }; @@ -203,10 +204,10 @@ OUString SvxDefaultColorOptPage::GetAllStrings() for (const auto& btn : buttons) { if (const auto pString = m_xBuilder->weld_button(btn)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet* rOutAttrs ) diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx index fca642fdbb38..4fb03618f85d 100644 --- a/cui/source/options/optctl.cxx +++ b/cui/source/options/optctl.cxx @@ -18,6 +18,7 @@ */ #include "optctl.hxx" +#include #include #include #include @@ -60,13 +61,13 @@ std::unique_ptr SvxCTLOptionsPage::Create( weld::Container* pPage, w OUString SvxCTLOptionsPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr, u"label4"_ustr, u"label5"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"sequencechecking"_ustr, u"restricted"_ustr, u"typeandreplace"_ustr }; @@ -74,7 +75,7 @@ OUString SvxCTLOptionsPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"movementlogical"_ustr, u"movementvisual"_ustr }; @@ -82,10 +83,10 @@ OUString SvxCTLOptionsPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxCTLOptionsPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx index 5b51e556cc85..cd5f5f0fec03 100644 --- a/cui/source/options/optdeepl.cxx +++ b/cui/source/options/optdeepl.cxx @@ -19,6 +19,7 @@ #include "optdeepl.hxx" #include +#include OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) @@ -45,19 +46,19 @@ void OptDeeplTabPage::Reset(const SfxItemSet*) OUString OptDeeplTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } if (const auto pString = m_xBuilder->weld_link_button(u"privacy"_ustr)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OptDeeplTabPage::FillItemSet(SfxItemSet*) diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx index 14bb0c9463f0..10f070e5404a 100644 --- a/cui/source/options/optfltr.cxx +++ b/cui/source/options/optfltr.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include "optfltr.hxx" #include #include @@ -85,13 +86,13 @@ std::unique_ptr OfaMSFilterTabPage::Create( weld::Container* pPage, OUString OfaMSFilterTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"wo_basic"_ustr, u"wo_exec"_ustr, u"wo_saveorig"_ustr, u"ex_basic"_ustr, @@ -100,10 +101,10 @@ OUString OfaMSFilterTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OfaMSFilterTabPage::FillItemSet( SfxItemSet* ) @@ -211,13 +212,13 @@ std::unique_ptr OfaMSFilterTabPage2::Create( weld::Container* pPage, OUString OfaMSFilterTabPage2::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr, u"label4"_ustr, u"label5"_ustr, u"label6"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"highlighting"_ustr, u"shading"_ustr }; @@ -225,12 +226,12 @@ OUString OfaMSFilterTabPage2::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xMSOLockFileCB->get_label() + " "; + sAllStrings.append(m_xMSOLockFileCB->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } namespace diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 731083412080..9f9ece1304d8 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -218,14 +218,14 @@ std::unique_ptr OfaMiscTabPage::Create( weld::Container* pPage, weld OUString OfaMiscTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label4"_ustr, u"label5"_ustr, u"yearslabel"_ustr, u"toyear"_ustr, u"label8"_ustr, u"label9"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -235,13 +235,13 @@ OUString OfaMiscTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } if (const auto pString = m_xBuilder->weld_button(u"assocfiles"_ustr)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) @@ -649,7 +649,7 @@ std::unique_ptr OfaViewTabPage::Create( weld::Container* pPage, weld OUString OfaViewTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label16"_ustr, u"label1"_ustr, u"label6"_ustr, u"label15"_ustr, u"label14"_ustr, u"label8"_ustr, u"label9"_ustr, u"label4"_ustr, u"label12"_ustr, u"label2"_ustr, u"skiaenabled"_ustr, u"skiadisabled"_ustr, u"label5"_ustr, u"aafrom"_ustr }; @@ -657,7 +657,7 @@ OUString OfaViewTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -666,12 +666,12 @@ OUString OfaViewTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xSkiaLog->get_label() + " " + m_xRunGPTests->get_label() + " "; + sAllStrings.append(m_xSkiaLog->get_label() + " " + m_xRunGPTests->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OfaViewTabPage::FillItemSet( SfxItemSet* ) @@ -1071,7 +1071,7 @@ std::unique_ptr OfaLanguagesTabPage::Create( weld::Container* pPage, OUString OfaLanguagesTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label4"_ustr, u"label7"_ustr, u"localesettingFT"_ustr, u"defaultcurrency"_ustr, u"label6"_ustr, u"dataaccpatterns"_ustr, u"label2"_ustr, u"western"_ustr, u"label3"_ustr }; @@ -1079,7 +1079,7 @@ OUString OfaLanguagesTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -1088,10 +1088,10 @@ OUString OfaLanguagesTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet ) diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx index 770b94c94482..105dde530e4b 100644 --- a/cui/source/options/optgenrl.cxx +++ b/cui/source/options/optgenrl.cxx @@ -404,7 +404,7 @@ std::unique_ptr SvxGeneralTabPage::Create( weld::Container* pPage, w OUString SvxGeneralTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"companyft"_ustr, u"nameft"_ustr, u"rusnameft"_ustr, u"eastnameft"_ustr, u"streetft"_ustr, u"russtreetft"_ustr, u"icityft"_ustr, @@ -414,12 +414,12 @@ OUString SvxGeneralTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xUseDataCB->get_label() + " " + m_xEncryptToSelfCB->get_label() + " "; + sAllStrings.append(m_xUseDataCB->get_label() + " " + m_xEncryptToSelfCB->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxGeneralTabPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx index 619f46c0fc29..c19ffa27204a 100644 --- a/cui/source/options/opthtml.cxx +++ b/cui/source/options/opthtml.cxx @@ -21,6 +21,7 @@ #include #include #include "opthtml.hxx" +#include OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) @@ -83,14 +84,14 @@ std::unique_ptr OfaHtmlTabPage::Create( weld::Container* pPage, weld OUString OfaHtmlTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr, u"size1FT"_ustr, u"size2FT"_ustr, u"size3FT"_ustr, u"size4FT"_ustr, u"size5FT"_ustr, u"size6FT"_ustr, u"size7FT"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"numbersenglishus"_ustr, u"unknowntag"_ustr, u"ignorefontnames"_ustr, u"starbasic"_ustr, @@ -99,10 +100,10 @@ OUString OfaHtmlTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OfaHtmlTabPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index f3a70342a90d..50a74cce5c51 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -310,17 +310,17 @@ void SvxProxyTabPage::Reset(const SfxItemSet*) OUString SvxProxyTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"httpft"_ustr, u"httpsft"_ustr, u"noproxyft"_ustr, u"httpportft"_ustr, u"httpsportft"_ustr, u"noproxydesc"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxProxyTabPage::FillItemSet(SfxItemSet* ) @@ -835,7 +835,7 @@ DeactivateRC SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet ) OUString SvxSecurityTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label4"_ustr, u"label2"_ustr, u"masterpasswordtext"_ustr, u"nopasswordsave"_ustr, u"label3"_ustr, u"label5"_ustr, u"label8"_ustr, u"label7"_ustr, u"label10"_ustr, u"label9"_ustr, u"label12"_ustr, @@ -844,7 +844,7 @@ OUString SvxSecurityTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"savepassword"_ustr, u"usemasterpassword"_ustr }; @@ -852,7 +852,7 @@ OUString SvxSecurityTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } // TODO: Should we exclude button strings from the search? @@ -862,10 +862,10 @@ OUString SvxSecurityTabPage::GetAllStrings() for (const auto& btn : buttons) { if (const auto pString = m_xBuilder->weld_button(btn)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxSecurityTabPage::FillItemSet( SfxItemSet* ) @@ -945,16 +945,16 @@ std::unique_ptr SvxEMailTabPage::Create( weld::Container* pPage, wel OUString SvxEMailTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"browsetitle"_ustr, u"suppress"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } /* -------------------------------------------------------------------------*/ diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 6166691db9c4..03637c0f00e0 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -476,13 +476,13 @@ std::unique_ptr SvxJavaOptionsPage::Create(weld::Container* pPage, w OUString SvxJavaOptionsPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"javapath"_ustr, u"selectruntime"_ustr, u"label12"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"javaenabled"_ustr, u"experimental"_ustr, u"macrorecording"_ustr }; @@ -490,7 +490,7 @@ OUString SvxJavaOptionsPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString buttons[] = { u"add"_ustr, u"parameters"_ustr, u"classpath"_ustr, u"expertconfig"_ustr }; @@ -498,10 +498,10 @@ OUString SvxJavaOptionsPage::GetAllStrings() for (const auto& btn : buttons) { if (const auto pString = m_xBuilder->weld_button(btn)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ ) diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx index 4d9048155c17..2b414581473a 100644 --- a/cui/source/options/optjsearch.cxx +++ b/cui/source/options/optjsearch.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include "optjsearch.hxx" @@ -201,13 +202,13 @@ void SvxJSearchOptionsPage::Reset( const SfxItemSet* ) OUString SvxJSearchOptionsPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"matchcase"_ustr, @@ -233,10 +234,10 @@ OUString SvxJSearchOptionsPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxJSearchOptionsPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/options/optlanguagetool.cxx b/cui/source/options/optlanguagetool.cxx index db4e89092386..d2fa9107feaa 100644 --- a/cui/source/options/optlanguagetool.cxx +++ b/cui/source/options/optlanguagetool.cxx @@ -19,6 +19,7 @@ #include "optlanguagetool.hxx" #include +#include #include #include @@ -111,7 +112,7 @@ void OptLanguageToolTabPage::Reset(const SfxItemSet*) OUString OptLanguageToolTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"langtoolsettings"_ustr, u"disclaimer"_ustr, u"apisettingsheader"_ustr, u"base"_ustr, u"urldesc"_ustr, u"usernamelbl"_ustr, u"usernamedesc"_ustr, u"apikeylbl"_ustr, @@ -121,7 +122,7 @@ OUString OptLanguageToolTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"activate"_ustr, u"verifyssl"_ustr }; @@ -129,13 +130,13 @@ OUString OptLanguageToolTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } if (const auto pString = m_xBuilder->weld_link_button(u"policy"_ustr)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool OptLanguageToolTabPage::FillItemSet(SfxItemSet*) diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 043e32c47a04..0b5ed363f84c 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -878,18 +878,18 @@ std::unique_ptr SvxLinguTabPage::Create( weld::Container* pPage, wel OUString SvxLinguTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"lingumodulesft"_ustr, u"lingudictsft"_ustr, u"label4"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xMoreDictsLink->get_label() + " "; + sAllStrings.append(m_xMoreDictsLink->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index eea1be7952fc..c1ab9387ea7f 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -223,14 +224,14 @@ std::unique_ptr SvxSaveTabPage::Create(weld::Container* pPage, weld: OUString SvxSaveTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"autosave_mins"_ustr, u"label3"_ustr, u"label5"_ustr, u"label6"_ustr, u"saveas_label"_ustr, u"odfwarning_label"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -241,10 +242,10 @@ OUString SvxSaveTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet ) diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index a2e0839b0416..7eade4e06847 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -197,21 +197,20 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText() static inline OUString WrapString(const OUString& aStr) { - OUString sResult; - OUString sPos; + OUStringBuffer sResult; int nPos = 0; for (int i = 0; i < aStr.getLength(); i++) { - sPos = aStr.subView(i, 1); - sResult += sPos; - if ((nPos > 50) && (sPos == ";")) + std::u16string_view sPos = aStr.subView(i, 1); + sResult.append(sPos); + if ((nPos > 50) && (sPos == u";")) { - sResult += "\n"; + sResult.append("\n"); nPos = 0; } nPos++; } - return sResult; + return sResult.toString(); } void SvxOnlineUpdateTabPage::UpdateUserAgent() @@ -249,14 +248,14 @@ std::unique_ptr SvxOnlineUpdateTabPage::Create( weld::Container* pPa OUString SvxOnlineUpdateTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"lastchecked"_ustr, u"neverchecked"_ustr, u"labeldest"_ustr, u"destpathlabel"_ustr, u"labelagent"_ustr, u"useragent_label"_ustr, u"useragent_changed"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"autocheck"_ustr, u"autodownload"_ustr, u"extrabits"_ustr }; @@ -264,7 +263,7 @@ OUString SvxOnlineUpdateTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"everyday"_ustr, u"everyweek"_ustr, u"everymonth"_ustr }; @@ -272,13 +271,13 @@ OUString SvxOnlineUpdateTabPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } // some buttons are not included - sAllStrings += m_xPrivacyPolicyButton->get_label() + " "; + sAllStrings.append(m_xPrivacyPolicyButton->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index cf34950444df..59c5d273f552 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -273,17 +274,17 @@ bool SvxAreaTabPage::FillItemSet_Impl( SfxItemSet* rAttrs) OUString SvxAreaTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString toggleButton[] = { u"btnnone"_ustr, u"btncolor"_ustr, u"btngradient"_ustr, u"btnbitmap"_ustr, u"btnpattern"_ustr, u"btnhatch"_ustr, u"btnusebackground"_ustr }; for (const auto& toggle : toggleButton) { if (const auto pString = m_xBuilder->weld_toggle_button(toggle)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs ) diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 6d11eb21340d..5449ef24ed03 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -583,8 +583,7 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, } if ( !aName.empty() ) { - pInfo->aUIName = aName; - pInfo->aUIName += " [ "; + pInfo->aUIName = OUString::Concat(aName) + " [ "; } pInfo->aUIName += pInfo->aTypeName; if ( !aName.empty() ) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4cb16c203176..c248e25517a1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4744,18 +4744,18 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, if (!pDocument->maFontsMissing.empty()) { - OString sPayload = "{ \"fontsmissing\": [ "_ostr; + OStringBuffer sPayload("{ \"fontsmissing\": [ "); bool bFirst = true; for (const auto &f : pDocument->maFontsMissing) { if (bFirst) bFirst = false; else - sPayload += ", "; - sPayload += "\"" + f.toUtf8() + "\""; + sPayload.append(", "); + sPayload.append("\"" + f.toUtf8() + "\""); } - sPayload += " ] }"; - pCallback(LOK_CALLBACK_FONTS_MISSING, sPayload.getStr(), pData); + sPayload.append(" ] }"); + pCallback(LOK_CALLBACK_FONTS_MISSING, sPayload.toString().getStr(), pData); pDocument->maFontsMissing.clear(); } diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 4a73b5cb3338..c90db53b7dbc 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -442,7 +443,7 @@ namespace emfio sal_uInt32 nDescChars(0); mpInputStream->ReadUInt32(nDescChars); - OUString aDesc; + OUStringBuffer aDesc; for (sal_uInt32 i=0; i < nDescChars; i++) { sal_uInt16 cChar(0); @@ -451,10 +452,10 @@ namespace emfio break; sal_Unicode cUniChar = static_cast(cChar); - aDesc += OUStringChar(cUniChar); + aDesc.append(OUStringChar(cUniChar)); } - SAL_INFO("emfio", "\t\tDescription: " << aDesc); + SAL_INFO("emfio", "\t\tDescription: " << aDesc.toString()); } break; @@ -2186,18 +2187,18 @@ namespace emfio sal_Int32 ihCS(0); mpInputStream->ReadInt32(ihCS); sal_Int32 nDescChars = nRemainingRecSize - 4; - OUString aDesc; + OUStringBuffer aDesc; for (sal_Int32 i=0; i < nDescChars; i++) { unsigned char cChar(0); mpInputStream->ReadUChar(cChar); if (cChar == 0) break; - aDesc += OUStringChar(static_cast(cChar)); + aDesc.append(OUStringChar(static_cast(cChar))); } // if it's the standard color space name, no need to do anything - if (aDesc != "COSP") - SAL_WARN("emfio", "TODO: color space change for EMR_CREATECOLORSPACE not implemented: '" << aDesc << "' " << nDescChars); + if (std::u16string_view(aDesc) != u"COSP") + SAL_WARN("emfio", "TODO: color space change for EMR_CREATECOLORSPACE not implemented: '" << aDesc.toString() << "' " << nDescChars); } } break; diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 0d9ffbc7b5ab..04507ebc2ef6 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -568,7 +568,7 @@ static EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam) { EquationResult aResult; - OUString sCombinedCharacters; + OUStringBuffer sCombinedCharacters; WW8ReadFieldParams aOriFldParam = rReadParam; const sal_Int32 cGetChar = rReadParam.SkipToNextToken(); switch( cGetChar ) @@ -607,8 +607,8 @@ static EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam) if (nBegin != -1 && nEnd != -1) { - sCombinedCharacters += - sPart.subView(nBegin+1,nEnd-nBegin-1); + sCombinedCharacters.append( + sPart.subView(nBegin+1,nEnd-nBegin-1)); } } } @@ -641,7 +641,7 @@ static EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam) else break; } - sCombinedCharacters = sPart.copy( nBegin+1, nEnd-nBegin-1 ); + sCombinedCharacters = sPart.subView( nBegin+1, nEnd-nBegin-1 ); if ( !sCombinedCharacters.isEmpty() ) { aResult.sType = "Input"; diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index a5756f5d28d4..f7eed3217ce4 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -1066,10 +1066,10 @@ IMPL_LINK(SvtFileView, HeaderSelect_Impl, int, nColumn, void) OUString SvtFileView::GetConfigString() const { // sort order - OUString sRet = OUString::number( mpImpl->mnSortColumn ) + ";"; + OUStringBuffer sRet = OUString::number( mpImpl->mnSortColumn ) + ";"; bool bUp = mpImpl->mbAscending; - sRet += OUString::Concat(bUp ? std::u16string_view(u"1") : std::u16string_view(u"0")) + ";"; + sRet.append(OUString::Concat(bUp ? std::u16string_view(u"1") : std::u16string_view(u"0")) + ";"); weld::TreeView* pView = mpImpl->mxView->getWidget(); sal_uInt16 nCount = mpImpl->mxView->TypeColumnVisible() ? 4 : 3; @@ -1080,13 +1080,13 @@ OUString SvtFileView::GetConfigString() const if (!mpImpl->mxView->TypeColumnVisible() && nId != COLUMN_TITLE) ++nId; - sRet += OUString::number( nId ) + sRet.append(OUString::number( nId ) + ";" + OUString::number(pView->get_column_width(i)) - + ";"; + + ";"); } - return comphelper::string::stripEnd(sRet, ';'); + return comphelper::string::stripEnd(sRet.toString(), ';'); } ::std::vector< SvtContentEntry > SvtFileView::GetContent() diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 4c7e4f950ed5..a71f7a0c1b3c 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #ifdef _WIN32 @@ -233,18 +234,18 @@ javaFrameworkError jfw_startVM( // Expand user classpath (might contain bootstrap vars) const OUString& sUserPath(settings.getUserClassPath()); std::vector paths = jfw_convertUserPathList(sUserPath); - OUString sUserPathExpanded; + OUStringBuffer sUserPathExpanded; for (auto& path : paths) { if (!sUserPathExpanded.isEmpty()) - sUserPathExpanded += OUStringChar(SAL_PATHSEPARATOR); + sUserPathExpanded.append(OUStringChar(SAL_PATHSEPARATOR)); if (path.startsWith("$")) { OUString sURL = path; rtl::Bootstrap::expandMacros(sURL); osl::FileBase::getSystemPathFromFileURL(sURL, path); } - sUserPathExpanded += path; + sUserPathExpanded.append(path); } sUserClassPath = jfw::makeClassPathOption(sUserPathExpanded); } // end mode FWK_MODE_OFFICE diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx index 26371748ee99..d25a7675d304 100644 --- a/oox/source/vml/vmlinputstream.cxx +++ b/oox/source/vml/vmlinputstream.cxx @@ -26,6 +26,7 @@ #include #include #include +#include namespace oox::vml { @@ -354,20 +355,20 @@ void InputStream::updateBuffer() if( bHasOpeningBracket && !mxTextStrm->isEOF() ) { // read the element text (add the leading opening bracket manually) - OString aElement = "<" + readToElementEnd(); + OStringBuffer aElement = "<" + readToElementEnd(); // check for CDATA part, starting with '' - while( ((aElement.getLength() < gaClosingCData.getLength()) || !aElement.endsWith( gaClosingCData )) && !mxTextStrm->isEOF() ) - aElement += readToElementEnd(); + while( ((aElement.getLength() < gaClosingCData.getLength()) || !o3tl::ends_with(aElement, gaClosingCData)) && !mxTextStrm->isEOF() ) + aElement.append(readToElementEnd()); // copy the entire CDATA part aBuffer.append( aElement ); } else { // no CDATA part - process the contents of the element - lclProcessElement( aBuffer, aElement ); + lclProcessElement( aBuffer, aElement.toString() ); } } diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx index 08014b6c8eb1..a23c34761018 100644 --- a/sax/qa/cppunit/xmlimport.cxx +++ b/sax/qa/cppunit/xmlimport.cxx @@ -148,7 +148,7 @@ void SAL_CALL TestDocumentHandler::endDocument() void SAL_CALL TestDocumentHandler::startElement( const OUString& aName, const Reference< XAttributeList >& xAttribs ) { - OUString sAttributes; + OUStringBuffer sAttributes; m_aCountStack.push(0); sal_uInt16 len = xAttribs->getLength(); for (sal_uInt16 i=0; igetValueByIndex(i); OUString sAttrName = canonicalform(xAttribs->getNameByIndex(i), sAttrValue, false); if (!sAttrName.isEmpty()) - sAttributes += sAttrName + sAttrValue; + sAttributes.append(sAttrName + sAttrValue); } m_aStr.append(canonicalform(aName, u""_ustr, true) + sAttributes); } diff --git a/sc/qa/unit/functions_test.cxx b/sc/qa/unit/functions_test.cxx index d80283fcf04f..8d7739b2f5d6 100644 --- a/sc/qa/unit/functions_test.cxx +++ b/sc/qa/unit/functions_test.cxx @@ -70,8 +70,8 @@ bool FunctionsTest::load(const OUString& rFilter, const OUString& rURL, continue; if (!rtl::math::approxEqual(1.0, rDoc.GetValue(nCorrectCol, row, tab))) { - OUString result; - OUString expected; + OUStringBuffer result; + OUStringBuffer expected; for (SCCOL nOffset = 0; nOffset < nExpectedCol; ++ nOffset) { if (rDoc.HasValueData(nExpectedCol + nOffset, row, tab)) @@ -80,20 +80,20 @@ bool FunctionsTest::load(const OUString& rFilter, const OUString& rURL, // rounds to 15 decimals char buf[25]; int len = snprintf(buf, 25, "%.17G", rDoc.GetValue(0 + nOffset, row, tab)); - result += OUString::createFromAscii(std::string_view(buf, len)); + result.append( OUString::createFromAscii(std::string_view(buf, len)) ); len = snprintf(buf, 25, "%.17G", rDoc.GetValue(nExpectedCol + nOffset, row, tab)); - expected += OUString::createFromAscii(std::string_view(buf, len)); + expected.append( OUString::createFromAscii(std::string_view(buf, len)) ); } else { - result += rDoc.GetString(0 + nOffset, row, tab); - expected += rDoc.GetString(nExpectedCol + nOffset, row, tab); + result.append(rDoc.GetString(0 + nOffset, row, tab)); + expected.append(rDoc.GetString(nExpectedCol + nOffset, row, tab)); } if (nOffset < nExpectedCol - 1) { - result += ", "; - expected += ", "; + result.append(", "); + expected.append(", "); } } CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, " diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 3346d20e54fe..67e7ad0be877 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1787,7 +1787,7 @@ struct SheetDimData continue; bool bBooleanValue = rEntry.aKey != "sizes"; - OString aExpectedEncoding; + OStringBuffer aExpectedEncoding; bool bFirst = true; for (const auto& rSpan : rEntry.rSpanList) { @@ -1795,15 +1795,15 @@ struct SheetDimData if (bBooleanValue && bFirst) nVal = static_cast(!!nVal); if (!bBooleanValue || bFirst) - aExpectedEncoding += OString::number(nVal) + ":"; - aExpectedEncoding += OString::number(rSpan.nEnd) + " "; + aExpectedEncoding.append(OString::number(nVal) + ":"); + aExpectedEncoding.append(OString::number(rSpan.nEnd) + " "); bFirst = false; } // Get the tree's value for the property key ("sizes"/"hidden"/"filtered"). OString aTreeValue(rTree.get(rEntry.aKey.getStr())); - CPPUNIT_ASSERT_EQUAL(aExpectedEncoding, aTreeValue); + CPPUNIT_ASSERT_EQUAL(aExpectedEncoding.toString(), aTreeValue); } } }; diff --git a/sc/source/core/data/olinetab.cxx b/sc/source/core/data/olinetab.cxx index 13fc17a7b35f..82a70f0a04ab 100644 --- a/sc/source/core/data/olinetab.cxx +++ b/sc/source/core/data/olinetab.cxx @@ -143,12 +143,12 @@ ScOutlineCollection::iterator ScOutlineCollection::FindStart(SCCOLROW nMinStart) OString ScOutlineCollection::dumpAsString() const { - OString aOutput; + OStringBuffer aOutput; const char* const pGroupEntrySep = ","; for (const auto& rKeyValuePair : m_Entries) - aOutput += rKeyValuePair.second.dumpAsString() + pGroupEntrySep; + aOutput.append(rKeyValuePair.second.dumpAsString() + pGroupEntrySep); - return aOutput; + return aOutput.toString(); } ScOutlineArray::ScOutlineArray() : @@ -730,16 +730,16 @@ void ScOutlineArray::finalizeImport(const ScTable& rTable) OString ScOutlineArray::dumpAsString() const { - OString aOutput; + OStringBuffer aOutput; const char* const pLevelSep = " "; for (const auto& rCollection : aCollections) { if (rCollection.empty()) continue; - aOutput += rCollection.dumpAsString() + pLevelSep; + aOutput.append(rCollection.dumpAsString() + pLevelSep); } - return aOutput; + return aOutput.toString(); } ScOutlineTable::ScOutlineTable() diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index 650e5b78fb12..1964de7a1c5c 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -65,16 +65,16 @@ std::unique_ptr ScRedlineOptionsTabPage::Create( weld::Container* pP OUString ScRedlineOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"label3"_ustr, u"label4"_ustr, u"label5"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 9cefe920079d..ee520e9b11b4 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -273,7 +273,7 @@ void ScTpCalcOptions::Reset(const SfxItemSet* rCoreAttrs) OUString ScTpCalcOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label5"_ustr, u"label1"_ustr, u"precft"_ustr, u"label2"_ustr, u"stepsft"_ustr, u"minchangeft"_ustr, u"label4"_ustr, u"label3"_ustr, u"openclframe"_ustr }; @@ -281,7 +281,7 @@ OUString ScTpCalcOptions::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -290,7 +290,7 @@ OUString ScTpCalcOptions::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"formulawildcards"_ustr, u"formularegex"_ustr, u"formulaliteral"_ustr, @@ -299,10 +299,10 @@ OUString ScTpCalcOptions::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpCalcOptions::FillItemSet( SfxItemSet* rCoreAttrs ) diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx index 7df3547b53eb..02a287b339e6 100644 --- a/sc/source/ui/optdlg/tpcompatibility.cxx +++ b/sc/source/ui/optdlg/tpcompatibility.cxx @@ -9,6 +9,7 @@ #undef SC_DLLIMPLEMENTATION +#include #include #include #include @@ -37,18 +38,18 @@ std::unique_ptr ScTpCompatOptions::Create(weld::Container* pPage, we OUString ScTpCompatOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } // id "keybindings" GtkComboBoxText is not included - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpCompatOptions::FillItemSet(SfxItemSet *rCoreAttrs) diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index 8cb4c4609405..2fd47745e6b2 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -46,18 +46,18 @@ std::unique_ptr ScTpDefaultsOptions::Create(weld::Container* pPage, OUString ScTpDefaultsOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"textsheetsnumber"_ustr, u"textsheetprefix"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xEdJumboSheets->get_label() + " "; + sAllStrings.append(m_xEdJumboSheets->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 877ca4381cb1..8b0a8f7713dd 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -261,7 +261,7 @@ std::unique_ptr ScTpFormulaOptions::Create(weld::Container* pPage, w OUString ScTpFormulaOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"formulasyntaxlabel"_ustr, u"label3"_ustr, u"label6"_ustr, u"label7"_ustr, u"label8"_ustr, @@ -271,7 +271,7 @@ OUString ScTpFormulaOptions::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"calcdefault"_ustr, u"calccustom"_ustr }; @@ -279,7 +279,7 @@ OUString ScTpFormulaOptions::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString buttons[] = { u"reset"_ustr, u"details"_ustr }; @@ -287,13 +287,13 @@ OUString ScTpFormulaOptions::GetAllStrings() for (const auto& btn : buttons) { if (const auto pString = m_xBuilder->weld_button(btn)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } // check button - sAllStrings += mxCbEnglishFuncName->get_label() + " "; + sAllStrings.append(mxCbEnglishFuncName->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpFormulaOptions::FillItemSet(SfxItemSet* rCoreSet) diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx index a87b93b25804..9a17091a8325 100644 --- a/sc/source/ui/optdlg/tpprint.cxx +++ b/sc/source/ui/optdlg/tpprint.cxx @@ -95,13 +95,13 @@ void ScTpPrintOptions::Reset( const SfxItemSet* rCoreSet ) OUString ScTpPrintOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"suppressCB"_ustr, u"forceBreaksCB"_ustr, u"printCB"_ustr }; @@ -109,10 +109,10 @@ OUString ScTpPrintOptions::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpPrintOptions::FillItemSet( SfxItemSet* rCoreAttrs ) diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index a42961df0b2c..170028b9d488 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -189,13 +189,13 @@ void ScTpUserLists::Reset( const SfxItemSet* rCoreAttrs ) OUString ScTpUserLists::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"listslabel"_ustr, u"entrieslabel"_ustr, u"copyfromlabel"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString buttons[] = { u"new"_ustr, u"discard"_ustr, u"add"_ustr, u"modify"_ustr, u"delete"_ustr, u"copy"_ustr }; @@ -203,10 +203,10 @@ OUString ScTpUserLists::GetAllStrings() for (const auto& btn : buttons) { if (const auto pString = m_xBuilder->weld_button(btn)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpUserLists::FillItemSet( SfxItemSet* rCoreAttrs ) diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 9364f2c62194..3aa079ec7d54 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -128,14 +128,14 @@ std::unique_ptr ScTpContentOptions::Create( weld::Container* pPage, OUString ScTpContentOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label4"_ustr, u"label5"_ustr, u"label3"_ustr, u"label1"_ustr, u"grid_label"_ustr, u"lbCursor"_ustr, u"label2"_ustr, u"objgrf_label"_ustr, u"diagram_label"_ustr, u"draw_label"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -146,10 +146,10 @@ OUString ScTpContentOptions::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) @@ -550,13 +550,13 @@ std::unique_ptr ScTpLayoutOptions::Create( weld::Container* pPage, w OUString ScTpLayoutOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label4"_ustr, u"label5"_ustr, u"label6"_ustr, u"label3"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"aligncb"_ustr, u"editmodecb"_ustr, u"enter_paste_mode_cb"_ustr, @@ -567,7 +567,7 @@ OUString ScTpLayoutOptions::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"alwaysrb"_ustr, u"requestrb"_ustr, u"neverrb"_ustr }; @@ -575,10 +575,10 @@ OUString ScTpLayoutOptions::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool ScTpLayoutOptions::FillItemSet( SfxItemSet* rCoreSet ) diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx index d26e80f1af82..c29249a4bfc8 100644 --- a/sd/source/ui/dlg/prntopts.cxx +++ b/sd/source/ui/dlg/prntopts.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -84,13 +85,13 @@ SdPrintOptions::~SdPrintOptions() OUString SdPrintOptions::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label3"_ustr, u"label2"_ustr, u"printlbl"_ustr, u"contentlbl"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"frontcb"_ustr, u"backcb"_ustr, u"papertryfrmprntrcb"_ustr, u"pagenmcb"_ustr, @@ -100,7 +101,7 @@ OUString SdPrintOptions::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"pagedefaultrb"_ustr, u"fittopgrb"_ustr, u"tilepgrb"_ustr, u"brouchrb"_ustr, @@ -109,10 +110,10 @@ OUString SdPrintOptions::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SdPrintOptions::FillItemSet( SfxItemSet* rAttrs ) diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index f92c9435feea..dee5ccb9737d 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -241,13 +241,13 @@ SdTpOptionsContents::~SdTpOptionsContents() {} OUString SdTpOptionsContents::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -256,10 +256,10 @@ OUString SdTpOptionsContents::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SdTpOptionsContents::FillItemSet(SfxItemSet*) @@ -540,7 +540,7 @@ DeactivateRC SdTpOptionsMisc::DeactivatePage(SfxItemSet* pActiveSet) OUString SdTpOptionsMisc::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"newdoclbl"_ustr, u"label4"_ustr, u"label6"_ustr, u"tabstoplabel"_ustr, u"label1"_ustr, u"label7"_ustr, u"label2"_ustr, u"label5"_ustr, u"label8"_ustr, u"widthlbl"_ustr, u"info1"_ustr, u"heightlbl"_ustr, @@ -549,7 +549,7 @@ OUString SdTpOptionsMisc::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -560,10 +560,10 @@ OUString SdTpOptionsMisc::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SdTpOptionsMisc::FillItemSet(SfxItemSet* rAttrs) diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index f09817851886..22c879ecd466 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -440,39 +440,39 @@ public: auto xClass = mxMethod->getReturnType(); aOutString = simpleTypeName(xClass); - OUString aInString; + OUStringBuffer aInString; const auto aParameters = mxMethod->getParameterInfos(); bool bFirst = true; for (auto const& rParameterInfo : aParameters) { if (!bFirst) - aInString += ", "; + aInString.append(", "); else bFirst = false; switch (rParameterInfo.aMode) { case reflection::ParamMode_IN: - aInString += SfxResId(STR_PARMETER_MODE_IN) + " "; + aInString.append(SfxResId(STR_PARMETER_MODE_IN) + " "); break; case reflection::ParamMode_OUT: - aInString += SfxResId(STR_PARMETER_MODE_OUT) + " "; + aInString.append(SfxResId(STR_PARMETER_MODE_OUT) + " "); break; case reflection::ParamMode_INOUT: - aInString += SfxResId(STR_PARMETER_MODE_IN_AND_OUT) + " "; + aInString.append(SfxResId(STR_PARMETER_MODE_IN_AND_OUT) + " "); break; default: break; } - aInString += rParameterInfo.aName + " : " + simpleTypeName(rParameterInfo.aType); + aInString.append(rParameterInfo.aName + " : " + simpleTypeName(rParameterInfo.aType)); } OUString aImplementationClass = mxMethod->getDeclaringClass()->getName(); return { { 1, aOutString }, - { 2, aInString }, + { 2, aInString.toString() }, { 3, aImplementationClass }, }; } @@ -827,19 +827,19 @@ void GenericPropertiesNode::fillChildren(std::unique_ptr& pTree, aInfoCollection.push_back(SfxResId(STR_PROPERTY_ATTRIBUTE_MAYBEDEFAULT)); bool bSet = false; - OUString aInfoString; + OUStringBuffer aInfoString; for (auto const& rString : aInfoCollection) { if (bSet) - aInfoString += ", "; + aInfoString.append(", "); else bSet = true; - aInfoString += rString; + aInfoString.append(rString); } auto* pObjectInspectorNode - = createNodeObjectForAny(aPropertyName, aCurrentAny, aInfoString); + = createNodeObjectForAny(aPropertyName, aCurrentAny, aInfoString.toString()); if (pObjectInspectorNode) lclAppendNodeToParent(pTree, pParent, pObjectInspectorNode); } diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index e43c6064744f..fa3f73cbc4b5 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -22,7 +22,7 @@ #include #include #include - +#include #include #include @@ -92,13 +92,13 @@ std::unique_ptr SfxCommonPrintOptionsTabPage::Create(weld::Container OUString SfxCommonPrintOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label4"_ustr, u"label6"_ustr, u"label2"_ustr, u"label3"_ustr, u"label1"_ustr, u"label5"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"converttogray"_ustr, u"reducebitmaptrans"_ustr, u"reducebitmap"_ustr, u"reducetrans"_ustr, @@ -107,7 +107,7 @@ OUString SfxCommonPrintOptionsTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"printer"_ustr, @@ -123,10 +123,10 @@ OUString SfxCommonPrintOptionsTabPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append( pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet* /*rSet*/ ) diff --git a/sfx2/source/sidebar/uiobject.cxx b/sfx2/source/sidebar/uiobject.cxx index ae3592fa4bce..d7a65c217f82 100644 --- a/sfx2/source/sidebar/uiobject.cxx +++ b/sfx2/source/sidebar/uiobject.cxx @@ -9,6 +9,7 @@ #include "uiobject.hxx" #include +#include namespace sfx2::sidebar { @@ -21,14 +22,14 @@ TabBarUIObject::TabBarUIObject(const VclPtr& xTabBar) StringMap TabBarUIObject::get_state() { StringMap aMap = WindowUIObject::get_state(); - OUString rsHighlightedTabsIds; + OUStringBuffer rsHighlightedTabsIds; for (auto const& item : mxTabBar->maItems) { if (item->mxButton->get_item_active(u"toggle"_ustr)) { if (!rsHighlightedTabsIds.isEmpty()) - rsHighlightedTabsIds += ","; - rsHighlightedTabsIds += item->msDeckId; + rsHighlightedTabsIds.append(","); + rsHighlightedTabsIds.append(item->msDeckId); } } aMap[u"HighlightedTabsIds"_ustr] = rsHighlightedTabsIds; diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 540badf3ed98..9a1dacbc5789 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -94,6 +94,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/stringconcatliterals \ compilerplugins/clang/test/stringconstant \ compilerplugins/clang/test/stringliteralvar \ + compilerplugins/clang/test/stringloop \ compilerplugins/clang/test/stringplusequal \ compilerplugins/clang/test/stringstatic \ compilerplugins/clang/test/stringview \ diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 1a8fbeca4bb4..a8882ab7fb41 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -222,13 +222,13 @@ SmPrintOptionsTabPage::~SmPrintOptionsTabPage() OUString SmPrintOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label4"_ustr, u"label5"_ustr, u"label1"_ustr, u"label6"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -237,7 +237,7 @@ OUString SmPrintOptionsTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"sizenormal"_ustr, u"sizescaled"_ustr, u"sizezoomed"_ustr }; @@ -245,10 +245,10 @@ OUString SmPrintOptionsTabPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 430e7b6e3306..7f88979446c7 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1885,14 +1886,14 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString ) else if (sStrArray[i][0] >= '0' && sStrArray[i][0] <= '9' && !bDenomin) // denominator was not yet found { - OUString sDiv; + OUStringBuffer sDiv; sal_uInt16 j = i; while(j < nStringsCnt && sStrArray[j][0] >= '0' && sStrArray[j][0] <= '9') { - sDiv += sStrArray[j++]; + sDiv.append(sStrArray[j++]); } assert(j > 0 && "if i is 0, first iteration through loop is guaranteed by surrounding if condition"); - if (std::u16string_view(OUString::number(sDiv.toInt32())) == sDiv) + if (std::u16string_view(OUString::number(o3tl::toInt32(sDiv))) == sDiv) { // Found a Divisor while (i < j) diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 31e6535c4163..a90085a22287 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -103,7 +103,7 @@ static std::vector< OUString > getInfoFromInd( std::u16string_view aInd ) } else { - OUString aNum; + OUStringBuffer aNum; for( int i = 1; i < 3; i++ ) { if( !pLine[i] @@ -115,10 +115,10 @@ static std::vector< OUString > getInfoFromInd( std::u16string_view aInd ) return aResult; } - aNum += OUStringChar( pLine[i] ); + aNum.append(OUStringChar( pLine[i] )); } - newItem.append( sal_Unicode( aNum.toUInt32( 16 ) ) ); + newItem.append( sal_Unicode( o3tl::toUInt32(aNum, 16) ) ); pLine += 3; } diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index e98c82331038..c166224bd6d6 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -945,7 +946,7 @@ bool EmbeddedObjectRef::IsChart() const // MT: Only used for getting accessible attributes, which are not localized OUString EmbeddedObjectRef::GetChartType() { - OUString Style; + OUStringBuffer Style; if ( mpImpl->mxObj.is() ) { if ( IsChart() ) @@ -968,20 +969,20 @@ OUString EmbeddedObjectRef::GetChartType() const uno::Sequence< uno::Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); int nDimesionCount = rCooSys->getDimension(); if( nDimesionCount == 3 ) - Style += "3D "; + Style.append("3D "); else - Style += "2D "; + Style.append("2D "); for( const auto& rChartType : aChartTypes ) { OUString strChartType = rChartType->getChartType(); if (strChartType == "com.sun.star.chart2.AreaChartType") { - Style += "Areas"; + Style.append("Areas"); bGetChartType = true; } else if (strChartType == "com.sun.star.chart2.BarChartType") { - Style += "Bars"; + Style.append("Bars"); bGetChartType = true; } else if (strChartType == "com.sun.star.chart2.ColumnChartType") @@ -993,47 +994,47 @@ OUString EmbeddedObjectRef::GetChartType() if( xProp->getPropertyValue( u"SwapXAndYAxis"_ustr ) >>= bCurrent ) { if (bCurrent) - Style += "Bars"; + Style.append("Bars"); else - Style += "Columns"; + Style.append("Columns"); bGetChartType = true; } } } else if (strChartType == "com.sun.star.chart2.LineChartType") { - Style += "Lines"; + Style.append("Lines"); bGetChartType = true; } else if (strChartType == "com.sun.star.chart2.ScatterChartType") { - Style += "XY Chart"; + Style.append("XY Chart"); bGetChartType = true; } else if (strChartType == "com.sun.star.chart2.PieChartType") { - Style += "Pies"; + Style.append("Pies"); bGetChartType = true; } else if (strChartType == "com.sun.star.chart2.NetChartType") { - Style += "Radar"; + Style.append("Radar"); bGetChartType = true; } else if (strChartType == "com.sun.star.chart2.CandleStickChartType") { - Style += "Candle Stick Chart"; + Style.append("Candle Stick Chart"); bGetChartType = true; } if (bGetChartType) - return Style; + return Style.toString(); } } } } } } - return Style; + return Style.toString(); } // #i104867# diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx index 3d3c07453824..6447c47ae608 100644 --- a/svx/source/dialog/optgrid.cxx +++ b/svx/source/dialog/optgrid.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -201,7 +202,7 @@ std::unique_ptr SvxGridTabPage::Create(weld::Container* pPage, weld: OUString SvxGridTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label2"_ustr, u"flddrawx"_ustr, u"flddrawy"_ustr, u"label6"_ustr, u"label7"_ustr, u"label3"_ustr, u"divisionx"_ustr, u"label4"_ustr, u"divisiony"_ustr, u"label5"_ustr, u"label8"_ustr, u"label9"_ustr }; @@ -209,7 +210,7 @@ OUString SvxGridTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -219,10 +220,10 @@ OUString SvxGridTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SvxGridTabPage::FillItemSet( SfxItemSet* rCoreSet ) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 5da43948e99f..4af1bb8dc7ee 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1109,7 +1109,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow); Point aLogicOffset = pWin->PixelToLogic(aOffsetPx); - OString sPolygonElem(" 0) - sPolygonElem += " "; - sPolygonElem += aPoint.toString(); + sPolygonElem.append(" "); + sPolygonElem.append(aPoint.toString()); } - sPolygonElem += R"elem(\" style=\"stroke: none; fill: rgb(114,159,207); fill-opacity: 0.8\"/>)elem"; + sPolygonElem.append(R"elem(\" style=\"stroke: none; fill: rgb(114,159,207); fill-opacity: 0.8\"/>)elem"); OString sSVGElem = R"elem( xNumRule( xFactory->createInstance(u"com.sun.star.text.NumberingRules"_ustr), uno::UNO_QUERY_THROW); - OUString listFormat; + OUStringBuffer listFormat; for (sal_Int32 i = 0; i < xNumRule->getCount(); ++i) { uno::Sequence format; @@ -1247,10 +1247,10 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) [](auto const& r) { return r.Name == "ParentNumbering"; })); const_cast(it->Value) <<= sal_Int16(i + 1); #endif - listFormat += "%" + OUString::number(i+1) + "%."; + listFormat.append("%" + OUString::number(i+1) + "%."); auto it(::std::find_if(format.begin(), format.end(), [](auto const& r) { return r.Name == "ListFormat"; })); - const_cast(it->Value) <<= listFormat; + const_cast(it->Value) <<= listFormat.toString(); } xNumRule->replaceByIndex(i, uno::Any(format)); } diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index fe7275e5be36..bbfbd3e1b505 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -885,7 +885,7 @@ DECLARE_ODFEXPORT_TEST(testTdf115815, "tdf115815.odt") uno::Reference xRunEnum = xRunEnumAccess->createEnumeration(); bool bAnnotationStart = false; bool bBeforeAnnotation = true; - OUString sTextBeforeAnnotation; + OUStringBuffer sTextBeforeAnnotation; while (xRunEnum->hasMoreElements()) { uno::Reference xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); @@ -904,13 +904,13 @@ DECLARE_ODFEXPORT_TEST(testTdf115815, "tdf115815.odt") else if (aType == "Text") { uno::Reference xRun(xPropertySet, uno::UNO_QUERY); - sTextBeforeAnnotation += xRun->getString(); + sTextBeforeAnnotation.append(xRun->getString()); } } } // This was "Lorem ipsum" (collapsed annotation range) - CPPUNIT_ASSERT_EQUAL(u"Lorem "_ustr, sTextBeforeAnnotation); + CPPUNIT_ASSERT_EQUAL(u"Lorem "_ustr, sTextBeforeAnnotation.toString()); } CPPUNIT_TEST_FIXTURE(Test, testFdo58949) diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 8bbe4d9588af..8b696d1385e7 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -407,7 +407,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf140982) uno::Reference xRunEnum = xRunEnumAccess->createEnumeration(); bool bAnnotationStart = false; bool bBeforeAnnotation = true; - OUString sTextBeforeAnnotation; + OUStringBuffer sTextBeforeAnnotation; while (xRunEnum->hasMoreElements()) { uno::Reference xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); @@ -426,13 +426,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf140982) else if (aType == "Text") { uno::Reference xRun(xPropertySet, uno::UNO_QUERY); - sTextBeforeAnnotation += xRun->getString(); + sTextBeforeAnnotation.append(xRun->getString()); } } } // This was "Lorem ipsum" (collapsed annotation range) - CPPUNIT_ASSERT_EQUAL(u"Lorem "_ustr, sTextBeforeAnnotation); + CPPUNIT_ASSERT_EQUAL(u"Lorem "_ustr, sTextBeforeAnnotation.toString()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf126206) diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 4d7bdfbe6872..0f033829d0a0 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -673,7 +674,7 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription( { // #i87532# - determine table cell in th row and // in first column of row header table and return its text content. - OUString sRowDesc; + OUStringBuffer sRowDesc; GetTableData().CheckRowAndCol(nRow, 0); @@ -693,12 +694,12 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription( uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY ); if ( xChildText.is() ) { - sRowDesc += xChildText->getText(); + sRowDesc.append(xChildText->getText()); } } } - return sRowDesc; + return sRowDesc.makeStringAndClear(); } OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription( @@ -706,7 +707,7 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription( { // #i87532# - determine table cell in first row and // in th column of column header table and return its text content. - OUString sColumnDesc; + OUStringBuffer sColumnDesc; GetTableData().CheckRowAndCol(0, nColumn); @@ -726,12 +727,12 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription( uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY ); if ( xChildText.is() ) { - sColumnDesc += xChildText->getText(); + sColumnDesc.append(xChildText->getText()); } } } - return sColumnDesc; + return sColumnDesc.makeStringAndClear(); } sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt( diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 61ae291a536a..fd5d0431ce2e 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1021,14 +1021,14 @@ OUString SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, OUString SwNumRule::MakeParagraphStyleListString() const { - OUString aParagraphStyleListString; + OUStringBuffer aParagraphStyleListString; for (const auto& rParagraphStyle : maParagraphStyleList) { if (!aParagraphStyleListString.isEmpty()) - aParagraphStyleListString += ", "; - aParagraphStyleListString += rParagraphStyle->GetName().toString(); + aParagraphStyleListString.append(", "); + aParagraphStyleListString.append(rParagraphStyle->GetName().toString()); } - return aParagraphStyleListString; + return aParagraphStyleListString.toString(); } /** Copy method of SwNumRule diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 5dd4938d98dd..4a60b93ccd08 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -982,7 +982,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS ); sal_Int32 *pSequenceMapping = aSequenceMapping.getArray(); - OUString aCellRanges; + OUStringBuffer aCellRanges; sal_Int16 nDtaSrcIsColumns = -1;// -1: don't know yet, 0: false, 1: true -2: neither sal_Int32 nLabelSeqLen = -1; // used to see if labels are always used or not and have // the expected size of 1 (i.e. if FirstCellAsLabel can @@ -1200,8 +1200,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume OUString aEndCell( sw_GetCellName( k + nColSubLen - 1, i + nRowSubLen - 1) ); aCurRange = aCellRangeBase + aStartCell + ":" + aEndCell; if (!aCellRanges.isEmpty()) - aCellRanges += ";"; - aCellRanges += aCurRange; + aCellRanges.append(";"); + aCellRanges.append(aCurRange); // clear already found sub-range from map for (sal_Int32 nRowIndex2 = 0; nRowIndex2 < nRowSubLen; ++nRowIndex2) @@ -1215,12 +1215,12 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume uno::Sequence< OUString > aSortedRanges; GetSubranges( aCellRanges, aSortedRanges, false /*sub ranges should already be normalized*/ ); SortSubranges( aSortedRanges, (nDtaSrcIsColumns == 1) ); - OUString aSortedCellRanges; + OUStringBuffer aSortedCellRanges; for (const OUString& rSortedRange : aSortedRanges) { if (!aSortedCellRanges.isEmpty()) - aSortedCellRanges += ";"; - aSortedCellRanges += rSortedRange; + aSortedCellRanges.append(";"); + aSortedCellRanges.append(rSortedRange); } // build value for 'SequenceMapping' @@ -1261,7 +1261,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume pResult[nProps ].Name = "FirstCellAsLabel"; pResult[nProps++].Value <<= bFirstCellIsLabel; pResult[nProps ].Name = "CellRangeRepresentation"; - pResult[nProps++].Value <<= aSortedCellRanges; + pResult[nProps++].Value <<= aSortedCellRanges.toString(); if (!aBrokenCellRangeForExport.isEmpty()) { pResult[nProps ].Name = "BrokenCellRangeForExport"; diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 054e9c913ec8..65b77180c959 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -918,11 +918,11 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, return rWrt; const OString tag = rWrt.GetNamespace() + TagNames[eTag]; - OString sOut = OString::Concat("<") + tag; + OStringBuffer sOut = OString::Concat("<") + tag; if( eType != TYPE_NONE ) { - sOut += OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_type "=\"") + - TypeNames[eType] + "\""; + sOut.append(OString::Concat(" " OOO_STRING_SVTOOLS_HTML_O_type "=\"") + + TypeNames[eType] + "\""); } aTmp = xPropSet->getPropertyValue(u"Name"_ustr); @@ -930,10 +930,10 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, { if( !s->isEmpty() ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), *s ); - sOut = "\""_ostr; + sOut = "\""; } } @@ -942,19 +942,19 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, { if( !*b ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_disabled; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_disabled); } } if( !sValue.isEmpty() || bEmptyValue ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_value "=\""); rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), sValue ); - sOut = "\""_ostr; + sOut = "\""; } - sOut += " " + sOptions; + sOut.append(" " + sOptions); if( TYPE_IMAGE == eType ) { @@ -963,11 +963,11 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, { if( !s->isEmpty() ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_src "=\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_src "=\""); rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String(rWrt.Strm(), rWrt.normalizeURL(*s, false)); - sOut = "\""_ostr; + sOut = "\""; } } @@ -975,14 +975,14 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, if( aPixelSz.Width() ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_width "=\"" + - OString::number(static_cast(aPixelSz.Width())) + "\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_width "=\"" + + OString::number(static_cast(aPixelSz.Width())) + "\""); } if( aPixelSz.Height() ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_height "=\"" + - OString::number(static_cast(aPixelSz.Height())) + "\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_height "=\"" + + OString::number(static_cast(aPixelSz.Height())) + "\""); } } @@ -995,8 +995,8 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, if( nTabIndex >= 32767 ) nTabIndex = 32767; - sOut += " " OOO_STRING_SVTOOLS_HTML_O_tabindex "=\"" + - OString::number(static_cast(nTabIndex)) + "\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_tabindex "=\"" + + OString::number(static_cast(nTabIndex)) + "\""); } } @@ -1181,15 +1181,15 @@ SwHTMLWriter& OutHTML_DrawFrameFormatAsControl( SwHTMLWriter& rWrt, sOut = "<" + rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_option; if( !sVal.isEmpty() || bEmptyVal ) { - sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\""; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_value "=\""); rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), sVal ); - sOut = "\""_ostr; + sOut = "\""; } if( bSelected ) - sOut += " " OOO_STRING_SVTOOLS_HTML_O_selected; + sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_selected); - sOut += ">"; + sOut.append(">"); rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), pStrings[i] ); diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 77e366aa2255..496f10e22eaf 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -146,14 +147,14 @@ std::unique_ptr SwMailConfigPage::Create(weld::Container* pPage, wel OUString SwMailConfigPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"displayname_label"_ustr, u"address_label"_ustr, u"replyto_label"_ustr, u"label2"_ustr, u"server_label"_ustr, u"port_label"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"replytocb"_ustr, u"secure"_ustr }; @@ -161,7 +162,7 @@ OUString SwMailConfigPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString buttons[] = { u"serverauthentication"_ustr, u"test"_ustr }; @@ -169,10 +170,10 @@ OUString SwMailConfigPage::GetAllStrings() for (const auto& btn : buttons) { if (const auto pString = m_xBuilder->weld_button(btn)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ ) diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 8ad861f5340f..7fa7623d139d 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -568,14 +568,14 @@ IMPL_LINK_NOARG(SwLoadOptPage, StandardizedPageCountCheckHdl, weld::Toggleable&, OUString SwLoadOptPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label2"_ustr, u"label1"_ustr, u"label3"_ustr, u"label5"_ustr, u"tablabel"_ustr, u"label4"_ustr, u"label7"_ustr, u"labelstandardpages"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -584,7 +584,7 @@ OUString SwLoadOptPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"always"_ustr, u"onrequest"_ustr, u"never"_ustr }; @@ -592,10 +592,10 @@ OUString SwLoadOptPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) @@ -1039,7 +1039,7 @@ std::unique_ptr SwCaptionOptPage::Create(weld::Container* pPage, wel OUString SwCaptionOptPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label13"_ustr, u"label2"_ustr, u"label7"_ustr, u"numberingft"_ustr, u"numseparatorft"_ustr, u"separatorft"_ustr, u"label18"_ustr, u"label11"_ustr, u"label4"_ustr, u"label6"_ustr, u"label10"_ustr, u"label3"_ustr }; @@ -1047,13 +1047,13 @@ OUString SwCaptionOptPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } if (const auto pString = m_xBuilder->weld_check_button(u"applyborder"_ustr)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwCaptionOptPage::FillItemSet( SfxItemSet* ) diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 8c919093c13d..a59064d67d93 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -360,7 +361,7 @@ void SwContentOptPage::Reset(const SfxItemSet* rSet) OUString SwContentOptPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"guideslabel"_ustr, u"displaylabel"_ustr, u"displayfl1"_ustr, u"changeslabel"_ustr, u"label3"_ustr, u"hruler"_ustr, u"settingslabel"_ustr, u"measureunitlabel"_ustr, u"outlinelabel"_ustr }; @@ -368,7 +369,7 @@ OUString SwContentOptPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"helplines"_ustr, @@ -390,10 +391,10 @@ OUString SwContentOptPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwContentOptPage::FillItemSet(SfxItemSet* rSet) @@ -600,13 +601,13 @@ std::unique_ptr SwAddPrinterTabPage::Create( weld::Container* pPage, OUString SwAddPrinterTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label2"_ustr, u"label10"_ustr, u"label1"_ustr, u"label5"_ustr, u"4"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -616,7 +617,7 @@ OUString SwAddPrinterTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"none"_ustr, u"only"_ustr, u"end"_ustr, u"endpage"_ustr, u"inmargins"_ustr }; @@ -624,10 +625,10 @@ OUString SwAddPrinterTabPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet ) @@ -934,19 +935,19 @@ static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType, OUString SwStdFontTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"font_label"_ustr, u"size_label"_ustr, u"default_label"_ustr, u"heading_label"_ustr, u"list_label"_ustr, u"caption_label"_ustr, u"index_label"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - sAllStrings += m_xStandardPB->get_label() + " "; + sAllStrings.append(m_xStandardPB->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwStdFontTabPage::FillItemSet( SfxItemSet* ) @@ -1439,7 +1440,7 @@ std::unique_ptr SwTableOptionsTabPage::Create( weld::Container* pPag OUString SwTableOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"label3"_ustr, u"label4"_ustr, u"label5"_ustr, u"label6"_ustr, u"label10"_ustr, u"label2"_ustr, u"label14"_ustr, u"label15"_ustr, u"label16"_ustr, u"label11"_ustr, u"label12"_ustr, u"label13"_ustr }; @@ -1447,7 +1448,7 @@ OUString SwTableOptionsTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] = { u"header"_ustr, u"repeatheader"_ustr, u"dontsplit"_ustr, u"border"_ustr, @@ -1456,7 +1457,7 @@ OUString SwTableOptionsTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"fix"_ustr, u"fixprop"_ustr, u"var"_ustr }; @@ -1464,10 +1465,10 @@ OUString SwTableOptionsTabPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -1817,14 +1818,14 @@ void SwShdwCursorOptionsTabPage::PageCreated( const SfxAllItemSet& aSet ) OUString SwShdwCursorOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"layoutopt"_ustr, u"displayfl"_ustr, u"cursoropt"_ustr, u"cursorlabel"_ustr, u"fillmode"_ustr, u"lbImage"_ustr, u"lbDefaultAnchor"_ustr, u"autocomplete"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString checkButton[] @@ -1835,10 +1836,10 @@ OUString SwShdwCursorOptionsTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwShdwCursorOptionsTabPage::FillItemSet( SfxItemSet* rSet ) @@ -2330,7 +2331,7 @@ std::unique_ptr SwRedlineOptionsTabPage::Create( weld::Container* pP OUString SwRedlineOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label2"_ustr, u"insert_label"_ustr, u"insertcolor_label"_ustr, u"label3"_ustr, u"deleted_label"_ustr, u"deletedcolor_label"_ustr, u"label4"_ustr, u"changed_label"_ustr, u"changedcolor_label"_ustr, @@ -2339,10 +2340,10 @@ OUString SwRedlineOptionsTabPage::GetAllStrings() for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2748,13 +2749,13 @@ std::unique_ptr SwCompareOptionsTabPage::Create( weld::Container* pP OUString SwCompareOptionsTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString labels[] = { u"label1"_ustr, u"setting"_ustr }; for (const auto& label : labels) { if (const auto pString = m_xBuilder->weld_label(label)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } OUString radioButton[] = { u"auto"_ustr, u"byword"_ustr, u"bycharacter"_ustr }; @@ -2762,10 +2763,10 @@ OUString SwCompareOptionsTabPage::GetAllStrings() for (const auto& radio : radioButton) { if (const auto pString = m_xBuilder->weld_radio_button(radio)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2889,7 +2890,7 @@ std::unique_ptr SwTestTabPage::Create( weld::Container* pPage, weld: OUString SwTestTabPage::GetAllStrings() { - OUString sAllStrings; + OUStringBuffer sAllStrings; OUString checkButton[] = { u"unused"_ustr, u"dynamic"_ustr, u"nocalm"_ustr, u"wysiwygdbg"_ustr, u"noidle"_ustr, u"noscreenadj"_ustr, u"winformat"_ustr, u"noscroll"_ustr, u"DrawingLayerNotLoading"_ustr, @@ -2898,13 +2899,13 @@ OUString SwTestTabPage::GetAllStrings() for (const auto& check : checkButton) { if (const auto pString = m_xBuilder->weld_check_button(check)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); } if (const auto pString = m_xBuilder->weld_label(u"label1"_ustr)) - sAllStrings += pString->get_label() + " "; + sAllStrings.append(pString->get_label() + " "); - return sAllStrings.replaceAll("_", ""); + return sAllStrings.toString().replaceAll("_", ""); } bool SwTestTabPage::FillItemSet( SfxItemSet* rCoreSet ) diff --git a/sw/source/uibase/uno/loktxdoc.cxx b/sw/source/uibase/uno/loktxdoc.cxx index 16da26b71946..54c5e3b6ebba 100644 --- a/sw/source/uibase/uno/loktxdoc.cxx +++ b/sw/source/uibase/uno/loktxdoc.cxx @@ -617,12 +617,12 @@ void GetDocStructureCharts(tools::JsonWriter& rJsonWriter, const SwDocShell* pDo uno::Reference xTitle = xTitled->getTitleObject(); if (xTitle.is()) { - OUString aTitle; + OUStringBuffer aTitle; const uno::Sequence> aFSSeq = xTitle->getText(); for (auto const& fs : aFSSeq) - aTitle += fs->getString(); - rJsonWriter.put("title", aTitle); + aTitle.append(fs->getString()); + rJsonWriter.put("title", aTitle.toString()); } } @@ -633,12 +633,12 @@ void GetDocStructureCharts(tools::JsonWriter& rJsonWriter, const SwDocShell* pDo uno::Reference xSubTitle = xSubTitled->getTitleObject(); if (xSubTitle.is()) { - OUString aSubTitle; + OUStringBuffer aSubTitle; const uno::Sequence> aFSSeq = xSubTitle->getText(); for (auto const& fs : aFSSeq) - aSubTitle += fs->getString(); - rJsonWriter.put("subtitle", aSubTitle); + aSubTitle.append(fs->getString()); + rJsonWriter.put("subtitle", aSubTitle.makeStringAndClear()); } } diff --git a/test/source/a11y/AccessibilityTools.cxx b/test/source/a11y/AccessibilityTools.cxx index 2003e6871d01..26fbe6ee3e6a 100644 --- a/test/source/a11y/AccessibilityTools.cxx +++ b/test/source/a11y/AccessibilityTools.cxx @@ -415,7 +415,7 @@ OUString AccessibilityTools::getRoleName(const sal_Int16 role) OUString AccessibilityTools::debugAccessibleStateSet(const sal_Int64 nCombinedState) { - OUString combinedName; + OUStringBuffer combinedName; for (int i = 0; i < 63; i++) { @@ -538,13 +538,13 @@ OUString AccessibilityTools::debugAccessibleStateSet(const sal_Int64 nCombinedSt break; } if (combinedName.getLength()) - combinedName += " | "; - combinedName += name; + combinedName.append(" | "); + combinedName.append(name); } if (combinedName.isEmpty()) return u"unknown"_ustr; - return combinedName; + return combinedName.makeStringAndClear(); } OUString AccessibilityTools::getEventIdName(const sal_Int16 event_id) diff --git a/tools/qa/cppunit/test_reversemap.cxx b/tools/qa/cppunit/test_reversemap.cxx index be70ade79585..bb0fee18ce61 100644 --- a/tools/qa/cppunit/test_reversemap.cxx +++ b/tools/qa/cppunit/test_reversemap.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,7 @@ namespace sal_Int32 nLength = aAllChars.size(); CPPUNIT_ASSERT_EQUAL(sOrigText.getLength(), nLength); - OUString sFinalText; + OUStringBuffer sFinalText; //Split up in chunks of the same encoding returned by //getBestMSEncodingByChar, convert to it, and back @@ -81,7 +82,7 @@ namespace if (eCurrEncoding != ePrevEncoding) { OString aChunk(pStr+nChunkStart, i-nChunkStart, ePrevEncoding); - sFinalText += OStringToOUString(aChunk, ePrevEncoding); + sFinalText.append(OStringToOUString(aChunk, ePrevEncoding)); nChunkStart = i; } ePrevEncoding = eCurrEncoding; @@ -89,11 +90,11 @@ namespace if (nChunkStart < 255) { OString aChunk(pStr+nChunkStart, 255-nChunkStart, ePrevEncoding); - sFinalText += OStringToOUString(aChunk, ePrevEncoding); + sFinalText.append(OStringToOUString(aChunk, ePrevEncoding)); } //Final text should be the same as original - CPPUNIT_ASSERT_EQUAL(sOrigText, sFinalText); + CPPUNIT_ASSERT_EQUAL(sOrigText, sFinalText.toString()); } void Test::test1252() diff --git a/vcl/backendtest/GraphicsRenderTests.cxx b/vcl/backendtest/GraphicsRenderTests.cxx index 2e367cdfcbc8..8f4f278e09ff 100644 --- a/vcl/backendtest/GraphicsRenderTests.cxx +++ b/vcl/backendtest/GraphicsRenderTests.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -2234,41 +2235,41 @@ void GraphicsRenderTests::run(bool storeResultBitmap) { aTests[tests.getStatus()].push_back(tests.getTestName()); } - OUString writeResult = getResultString() + "\n---Name of the tests that failed---\n"; + OUStringBuffer writeResult(getResultString() + "\n---Name of the tests that failed---\n"); if (static_cast(aTests[u"FAILED"_ustr].size()) > 0) { for (const class OUString& tests : aTests[u"FAILED"_ustr]) { - writeResult += tests + "\n"; + writeResult.append(tests + "\n"); } } else { - writeResult += "No test has been failed.\n"; + writeResult.append("No test has been failed.\n"); } - writeResult += "\n---Name of the tests that were Quirky---\n"; + writeResult.append("\n---Name of the tests that were Quirky---\n"); if (static_cast(aTests[u"QUIRKY"_ustr].size()) > 0) { for (const class OUString& tests : aTests[u"QUIRKY"_ustr]) { - writeResult += tests + "\n"; + writeResult.append(tests + "\n"); } } else { - writeResult += "No test was Quirky.\n"; + writeResult.append("No test was Quirky.\n"); } - writeResult += "\n---Name of the tests that were Skipped---\n"; + writeResult.append("\n---Name of the tests that were Skipped---\n"); if (static_cast(aTests[u"SKIPPED"_ustr].size()) > 0) { for (const class OUString& tests : aTests[u"SKIPPED"_ustr]) { - writeResult += tests + "\n"; + writeResult.append(tests + "\n"); } } else { - writeResult += "No test was Skipped."; + writeResult.append("No test was Skipped."); } logFile.WriteOString(OUStringToOString(writeResult, RTL_TEXTENCODING_UTF8)); } diff --git a/vcl/qa/cppunit/FontFeatureTest.cxx b/vcl/qa/cppunit/FontFeatureTest.cxx index f7a2321ab47c..8189b506f792 100644 --- a/vcl/qa/cppunit/FontFeatureTest.cxx +++ b/vcl/qa/cppunit/FontFeatureTest.cxx @@ -57,10 +57,10 @@ void FontFeatureTest::testGetFontFeaturesGraphite() std::vector rFontFeatures; CPPUNIT_ASSERT(aVDev->GetFontFeatures(rFontFeatures)); - OUString aFeaturesString; + OUStringBuffer aFeaturesString; for (vcl::font::Feature const& rFeature : rFontFeatures) { - aFeaturesString += vcl::font::featureCodeAsString(rFeature.m_nCode) + " "; + aFeaturesString.append(vcl::font::featureCodeAsString(rFeature.m_nCode) + " "); } CPPUNIT_ASSERT_EQUAL(size_t(53), rFontFeatures.size()); @@ -72,7 +72,7 @@ void FontFeatureTest::testGetFontFeaturesGraphite() "itlc para algn arti circ dash dbls foot " "frsp grkn hang lng minu nfsp name quot " "texm thou vari caps ligc "_ustr, - aFeaturesString); + aFeaturesString.toString()); // Check C2SC feature { @@ -141,16 +141,16 @@ void FontFeatureTest::testGetFontFeaturesOpenType() std::vector rFontFeatures; CPPUNIT_ASSERT(aVDev->GetFontFeatures(rFontFeatures)); - OUString aFeaturesString; + OUStringBuffer aFeaturesString; for (vcl::font::Feature const& rFeature : rFontFeatures) - aFeaturesString += vcl::font::featureCodeAsString(rFeature.m_nCode) + " "; + aFeaturesString.append(vcl::font::featureCodeAsString(rFeature.m_nCode) + " "); CPPUNIT_ASSERT_EQUAL(size_t(15), rFontFeatures.size()); CPPUNIT_ASSERT_EQUAL(u"dnom liga numr pnum ss01 ss02 " "ss03 ss04 ss05 ss06 ss07 ss08 kern kern " "ss05 "_ustr, - aFeaturesString); + aFeaturesString.toString()); // Check ss01 feature { @@ -190,15 +190,15 @@ void FontFeatureTest::testGetFontFeaturesOpenTypeEnum() std::vector rFontFeatures; CPPUNIT_ASSERT(aVDev->GetFontFeatures(rFontFeatures)); - OUString aFeaturesString; + OUStringBuffer aFeaturesString; for (vcl::font::Feature const& rFeature : rFontFeatures) - aFeaturesString += vcl::font::featureCodeAsString(rFeature.m_nCode) + " "; + aFeaturesString.append(vcl::font::featureCodeAsString(rFeature.m_nCode) + " "); CPPUNIT_ASSERT_EQUAL(size_t(10), rFontFeatures.size()); CPPUNIT_ASSERT_EQUAL(u"aalt case cv01 cv02 cv03 frac ordn sups " "zero kern "_ustr, - aFeaturesString); + aFeaturesString.toString()); // Check aalt feature { diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 54dd75b47dcd..7766c3aa3e76 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -3614,16 +3614,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115967) // Make sure the elements inside a formula in a RTL document are exported // LTR ( m=750abc ) and not RTL ( m=057cba ) int nPageObjectCount = pPdfPage->getObjectCount(); - OUString sText; + OUStringBuffer sText; for (int i = 0; i < nPageObjectCount; ++i) { std::unique_ptr pPageObject = pPdfPage->getObject(i); if (pPageObject->getType() != vcl::pdf::PDFPageObjectType::Text) continue; OUString sChar = pPageObject->getText(pTextPage); - sText += o3tl::trim(sChar); + sText.append(o3tl::trim(sChar)); } - CPPUNIT_ASSERT_EQUAL(u"m=750abc"_ustr, sText); + CPPUNIT_ASSERT_EQUAL(u"m=750abc"_ustr, sText.toString()); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf167659) diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index 58dfd4ebf279..b9c560f422b5 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -188,7 +188,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf159895) auto pStart = static_cast(aUncompressed.GetData()); const char* const pEnd = pStart + aUncompressed.GetSize(); - OString sText; + OStringBuffer sText; while (true) { auto const pLine = ::std::find(pStart, pEnd, '\n'); @@ -199,10 +199,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf159895) pStart = pLine + 1; if (!line.empty() && line[0] != '%') { - sText += line + "\n"_ostr; + sText.append(line + "\n"_ostr); } } - CPPUNIT_ASSERT_EQUAL("/Tx BMC\nEMC\n"_ostr, sText); + CPPUNIT_ASSERT_EQUAL("/Tx BMC\nEMC\n"_ostr, sText.toString()); } } } diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index 0f0fd04f5843..ff80f4a6dd22 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -14,6 +14,7 @@ #include #include +#include #if !HAVE_FEATURE_SKIA @@ -125,12 +126,12 @@ OUString readLog() { SvFileStream logFile(getCacheFolder() + "/skia.log", StreamMode::READ); - OUString sResult; + OUStringBuffer sResult; OStringBuffer sLine; while (logFile.ReadLine(sLine)) - sResult += OStringToOUString(sLine, RTL_TEXTENCODING_UTF8) + "\n"; + sResult.append(OStringToOUString(sLine, RTL_TEXTENCODING_UTF8) + "\n"); - return sResult; + return sResult.toString(); } uint32_t vendorId = 0; diff --git a/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx b/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx index f0c08a0f43f3..3c0a12cc6297 100644 --- a/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx +++ b/vcl/source/accessibility/AccessibleTextAttributeHelper.cxx @@ -29,6 +29,7 @@ #include #include #include +#include namespace { @@ -245,7 +246,7 @@ static OUString ConvertUnoToIAccessible2TextAttributes( const css::uno::Sequence& rUnoAttributes, IA2AttributeType eAttributeType) { - OUString aRet; + OUStringBuffer aRet; for (css::beans::PropertyValue const& prop : rUnoAttributes) { OUString sAttribute; @@ -291,7 +292,7 @@ static OUString ConvertUnoToIAccessible2TextAttributes( else if (prop.Name == "CharStrikeout") { const sal_Int16 nStrikeout = *o3tl::doAccess(prop.Value); - aRet += lcl_ConverCharStrikeout(nStrikeout); + aRet.append(lcl_ConverCharStrikeout(nStrikeout)); } else if (prop.Name == "CharUnderline") { @@ -304,11 +305,11 @@ static OUString ConvertUnoToIAccessible2TextAttributes( // leave 'sAttribute' and 'sName' empty, set all attributes here if (!sUnderlineStyle.isEmpty()) - aRet += u"text-underline-style:" + sUnderlineStyle + ";"; + aRet.append(u"text-underline-style:" + sUnderlineStyle + ";"); if (!sUnderlineType.isEmpty()) - aRet += u"text-underline-type:" + sUnderlineType + ";"; + aRet.append(u"text-underline-type:" + sUnderlineType + ";"); if (!sUnderlineWidth.isEmpty()) - aRet += u"text-underline-width:" + sUnderlineWidth + ";"; + aRet.append(u"text-underline-width:" + sUnderlineWidth + ";"); } else if (prop.Name == "CharWeight") { @@ -338,10 +339,10 @@ static OUString ConvertUnoToIAccessible2TextAttributes( } if (!sAttribute.isEmpty() && !sValue.isEmpty()) - aRet += sAttribute + ":" + sValue + ";"; + aRet.append(sAttribute + ":" + sValue + ";"); } - return aRet; + return aRet.toString(); } OUString AccessibleTextAttributeHelper::GetIAccessible2TextAttributes( diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index c3f4f123dbe5..e1b97c7ddaf2 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3003,13 +3003,13 @@ void RadioButton::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) Button::DumpAsPropertyTree(rJsonWriter); rJsonWriter.put("checked", IsChecked()); - OUString sGroupId; + OUStringBuffer sGroupId; std::vector> aGroup = GetRadioButtonGroup(); for(const auto& pButton : aGroup) - sGroupId += pButton->get_id(); + sGroupId.append(pButton->get_id()); if (!sGroupId.isEmpty()) - rJsonWriter.put("group", sGroupId); + rJsonWriter.put("group", sGroupId.toString()); if (!!maImage) { diff --git a/vcl/source/gdi/embeddedfontsmanager.cxx b/vcl/source/gdi/embeddedfontsmanager.cxx index 8de8cf79cb76..7e5aae1ec8c0 100644 --- a/vcl/source/gdi/embeddedfontsmanager.cxx +++ b/vcl/source/gdi/embeddedfontsmanager.cxx @@ -461,11 +461,11 @@ void EmbeddedFontsManager::activateFonts(std::vector filteredFamilies; // families can repeat, e.g. for bold/italic for (const auto& pair : temp) filteredFamilies.insert(pair.first); - OUString fontlist; + OUStringBuffer fontlist; for (const auto& family : filteredFamilies) - fontlist += "\n" + family; + fontlist.append("\n" + family); rtl::Reference pRequest(new comphelper::OInteractionRequest( - uno::Any(document::FontsDisallowEditingRequest({}, {}, fontlist)))); + uno::Any(document::FontsDisallowEditingRequest({}, {}, fontlist.toString())))); rtl::Reference pApprove(new comphelper::OInteractionApprove); pRequest->addContinuation(pApprove); pRequest->addContinuation(new comphelper::OInteractionDisapprove); diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index fae0bf2a86c4..d121e7b2f326 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -321,15 +322,14 @@ void CertificateChooser::ImplInitialize(bool mbSearch) seqLoadedCertsLabels.push_back(XsResId(STR_LOADED_CERTS_X509_NSS_NEWLINE) + nssPath); #endif // _WIN32 } - OUString loadedCertsLabel = XsResId(STR_LOADED_CERTS_BASE - ); + OUStringBuffer loadedCertsLabel(XsResId(STR_LOADED_CERTS_BASE)); for (size_t label_i=0; label_i 0) - loadedCertsLabel += ", "; - loadedCertsLabel += seqLoadedCertsLabels[label_i]; + loadedCertsLabel.append(", "); + loadedCertsLabel.append(seqLoadedCertsLabels[label_i]); } - m_xFTLoadedCerts->set_label(loadedCertsLabel); + m_xFTLoadedCerts->set_label(loadedCertsLabel.toString()); m_xFTLoadedCerts->set_visible(true); m_xCertLB->thaw();