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 sfx2/source/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 svl/source/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 vcl/source/accessibility/AccessibleTextAttributeHelper.cxx | 15 vcl/source/control/button.cxx | 6 vcl/source/gdi/embeddedfontsmanager.cxx | 6 xmlsecurity/source/dialogs/certificatechooser.cxx | 10 79 files changed, 820 insertions(+), 442 deletions(-)
New commits: commit 4e2b089020d6af65080ba54b5aa64c2595f1b341 Author: Noel Grandin <[email protected]> AuthorDate: Mon Dec 1 12:02:39 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Dec 1 14:25:01 2025 +0100 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 <[email protected]> Tested-by: Jenkins 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<chart2::XTitled>& xTitled ) uno::Reference<chart2::XTitle> xTitle = xTitled->getTitleObject(); CPPUNIT_ASSERT(xTitle.is()); const uno::Sequence<uno::Reference<chart2::XFormattedString> > 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<chart2::XAxis>& 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 <vector> + +/** Look for OUString/OString being appended to inside a loop, where OUStringBuffer/OStringBuffer would be a better idea + */ +namespace +{ +class StringLoop : public clang::RecursiveASTVisitor<StringLoop>, 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<VarDecl const*>; + std::vector<VarDeclList> 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<CXXOperatorCallExpr>(callExpr); + if (!operatorCallExpr) + return true; + if (operatorCallExpr->getOperator() != OO_PlusEqual) + return true; + + if (auto memberExpr = dyn_cast<MemberExpr>(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<FieldDecl>(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<DeclRefExpr>(callExpr->getArg(0))) + { + if (auto varDecl = dyn_cast<VarDecl>(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<StringLoop> 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 <dialmgr.hxx> #include <editeng/editids.hrc> #include <officecfg/Office/Common.hxx> +#include <rtl/ustrbuf.hxx> #include <strings.hrc> #include <sfx2/AdditionsDialogHelper.hxx> #include <svtools/colorcfg.hxx> @@ -177,17 +178,17 @@ std::unique_ptr<SfxTabPage> 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 <osl/diagnose.h> #include "connpooloptions.hxx" #include "connpoolsettings.hxx" +#include <rtl/ustrbuf.hxx> #include <svl/eitem.hxx> #include <svx/databaseregistrationui.hxx> #include <strings.hrc> @@ -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 <svtools/fontsubstconfig.hxx> #include "fontsubs.hxx" #include <helpids.h> +#include <rtl/ustrbuf.hxx> /*********************************************************************/ /* */ @@ -148,13 +149,13 @@ std::unique_ptr<SfxTabPage> 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 <officecfg/Office/Common.hxx> #include <unotools/resmgr.hxx> #include <dialmgr.hxx> +#include <rtl/ustrbuf.hxx> namespace { @@ -113,7 +114,7 @@ std::unique_ptr<SfxTabPage> 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 <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/XForbiddenCharacters.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <rtl/ustrbuf.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/objsh.hxx> #include <vcl/svapp.hxx> @@ -143,14 +144,14 @@ std::unique_ptr<SfxTabPage> 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 <basic/codecompletecache.hxx> #include <officecfg/Office/BasicIDE.hxx> +#include <rtl/ustrbuf.hxx> 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 <svx/SvxColorValueSet.hxx> +#include <rtl/ustrbuf.hxx> #include <vcl/virdev.hxx> #include <vcl/weld.hxx> #include <vcl/settings.hxx> @@ -189,13 +190,13 @@ std::unique_ptr<SfxTabPage> 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 <rtl/ustrbuf.hxx> #include <svl/ctloptions.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> @@ -60,13 +61,13 @@ std::unique_ptr<SfxTabPage> 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 <officecfg/Office/Linguistic.hxx> +#include <rtl/ustrbuf.hxx> 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 <officecfg/Office/Calc.hxx> #include <officecfg/Office/Writer.hxx> #include <officecfg/Office/Impress.hxx> +#include <rtl/ustrbuf.hxx> #include "optfltr.hxx" #include <strings.hrc> #include <dialmgr.hxx> @@ -85,13 +86,13 @@ std::unique_ptr<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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 <comphelper/configuration.hxx> #include <officecfg/Office/Common.hxx> #include "opthtml.hxx" +#include <rtl/ustrbuf.hxx> OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) @@ -83,14 +84,14 @@ std::unique_ptr<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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 <tools/debug.hxx> #include <unotools/searchopt.hxx> #include <i18nutil/transliteration.hxx> +#include <rtl/ustrbuf.hxx> #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 <officecfg/Office/Linguistic.hxx> +#include <rtl/ustrbuf.hxx> #include <dialmgr.hxx> #include <strings.hrc> @@ -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<SfxTabPage> 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 <sfx2/docfilt.hxx> #include <tools/debug.hxx> #include <osl/diagnose.h> +#include <rtl/ustrbuf.hxx> #include <comphelper/diagnose_ex.hxx> #include <officecfg/Office/Recovery.hxx> #include <unotools/confignode.hxx> @@ -223,14 +224,14 @@ std::unique_ptr<SfxTabPage> 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 += " "; + sResult.append(" "); nPos = 0; } nPos++; } - return sResult; + return sResult.toString(); } void SvxOnlineUpdateTabPage::UpdateUserAgent() @@ -249,14 +248,14 @@ std::unique_ptr<SfxTabPage> 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 <svx/xbtmpit.hxx> #include <svx/xgrscit.hxx> #include <cuitabarea.hxx> +#include <rtl/ustrbuf.hxx> #include <sfx2/tabdlg.hxx> #include <unotools/pathoptions.hxx> @@ -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 <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> #include <emfreader.hxx> +#include <rtl/ustrbuf.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> #include <vcl/dibtools.hxx> @@ -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<sal_Unicode>(cChar); - aDesc += OUStringChar(cUniChar); + aDesc.append(OUStringChar(cUniChar)); } - SAL_INFO("emfio", " Description: " << aDesc); + SAL_INFO("emfio", " Description: " << 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<sal_Unicode>(cChar)); + aDesc.append(OUStringChar(static_cast<sal_Unicode>(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 <rtl/bootstrap.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> #include <osl/file.hxx> #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 <rtl/strbuf.hxx> #include <osl/diagnose.h> #include <oox/helper/textinputstream.hxx> +#include <o3tl/string_view.hxx> 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 '<![CDATA[' - if( aElement.match( gaOpeningCData ) ) + if( o3tl::starts_with(aElement, gaOpeningCData) ) { // search the end tag ']]>' - 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; i<len; i++) @@ -156,7 +156,7 @@ void SAL_CALL TestDocumentHandler::startElement( const OUString& aName, const Re OUString sAttrValue = xAttribs->getValueByIndex(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<size_t>(!!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<std::string>(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<SfxTabPage> 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 <rtl/ustrbuf.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <officecfg/Office/Calc.hxx> @@ -37,18 +38,18 @@ std::unique_ptr<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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<SfxTabPage> 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 <optsitem.hxx> #include <prntopts.hxx> #include <app.hrc> +#include <rtl/ustrbuf.hxx> #include <svl/intitem.hxx> #include <officecfg/Office/Impress.hxx> #include <officecfg/Office/Draw.hxx> @@ -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<weld::TreeView>& 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 <officecfg/Office/Common.hxx> #include <svtools/printoptions.hxx> #include <svtools/restartdialog.hxx> - +#include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/printopt.hxx> @@ -92,13 +92,13 @@ std::unique_ptr<SfxTabPage> 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 <sfx2/sidebar/SidebarController.hxx> +#include <rtl/ustrbuf.hxx> namespace sfx2::sidebar { @@ -21,14 +22,14 @@ TabBarUIObject::TabBarUIObject(const VclPtr<TabBar>& 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 <stdlib.h> #include <comphelper/string.hxx> #include <o3tl/untaint.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> #include <i18nlangtag/mslangid.hxx> -e ... etc. - the rest is truncated
