diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-11 22:24:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-12 12:42:15 +0200 |
commit | cbaf1fbaa6e707d939f815eda360fad68a492aca (patch) | |
tree | 20b3dfeac257130afb01572b2c117b7840d07007 /sw | |
parent | f751417b77e6573a0c639778e76ec943449f4573 (diff) |
loplugin:stringview more o3tl conversion
look for call sequences that can use string_view and the new o3tl
functions in o3tl/string_view.hxx
Also add a few more wrappers to said #include file
Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
34 files changed, 62 insertions, 36 deletions
diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx b/sw/qa/extras/fodfexport/fodfexport.cxx index 9fd8e3c82afc..53297da28c53 100644 --- a/sw/qa/extras/fodfexport/fodfexport.cxx +++ b/sw/qa/extras/fodfexport/fodfexport.cxx @@ -8,6 +8,7 @@ */ #include <swmodeltestbase.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -23,7 +24,7 @@ public: bool mustTestImportOf(const char* filename) const override { // Only test import of .fodt document - return OString(filename).endsWith(".odt") || OString(filename).endsWith(".fodt"); + return o3tl::ends_with(filename, ".odt") || o3tl::ends_with(filename, ".fodt"); } }; diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 5ba0fa510589..b5b4c8e012a3 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -42,6 +42,7 @@ #include <comphelper/processfactory.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/dibtools.hxx> +#include <o3tl/string_view.hxx> #include <swmodule.hxx> #include <swdll.hxx> @@ -237,7 +238,7 @@ private: setFilterOptions("XHTML"); else if (getTestName().indexOf("ReqIf") != -1) { - if (OString(filename).endsWith(".xhtml")) + if (o3tl::ends_with(filename, ".xhtml")) { setImportFilterOptions("xhtmlns=reqif-xhtml"); // Bypass filter detect. diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 9b3159fd347a..8db40efda7bf 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -62,6 +62,7 @@ #include <docsh.hxx> #include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -73,7 +74,7 @@ public: */ bool mustTestImportOf(const char* filename) const override { // Only test import of .odt document - return OString(filename).endsWith(".odt"); + return o3tl::ends_with(filename, ".odt"); } bool mustValidate(const char* /*filename*/) const override diff --git a/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx b/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx index 24a1b2ded86c..2472a7bd3969 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlencryption.cxx @@ -8,6 +8,7 @@ */ #include <swmodeltestbase.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -20,7 +21,7 @@ public: protected: bool mustTestImportOf(const char* filename) const override { - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index b35377cdfc31..844eb014de18 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -39,6 +39,7 @@ #include <comphelper/propertysequence.hxx> #include <svx/svdpage.hxx> #include <unotools/ucbstreamhelper.hxx> +#include <o3tl/string_view.hxx> #include <drawdoc.hxx> #include <IDocumentDrawModelAccess.hxx> @@ -71,7 +72,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } protected: diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 8af29d6d7683..7bb652701d7a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -26,6 +26,7 @@ #include <unotxdoc.hxx> #include <docsh.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -38,7 +39,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 16ac47ce8a9a..fcdede363837 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -34,7 +35,7 @@ protected: bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 2bfe6c68a0f7..9f02523807c0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -27,6 +27,7 @@ #include <frameformats.hxx> #include <unotxdoc.hxx> #include <docsh.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -39,7 +40,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx") + return o3tl::ends_with(filename, ".docx") || filename == std::string_view("ooo39250-1-min.rtf"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index ebc1cbfd02ab..e808abfc3f97 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -31,6 +31,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <oox/drawingml/drawingmltypes.hxx> #include <unotools/fltrcfg.hxx> +#include <o3tl/string_view.hxx> using namespace com::sun::star; @@ -47,7 +48,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 6f23998495ab..1a9bddbfbd67 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> #include <com/sun/star/text/XTextField.hpp> +#include <o3tl/string_view.hxx> constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/"; @@ -32,7 +33,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 53db9cfccf3b..43acadba38f1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -29,6 +29,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <unotools/fltrcfg.hxx> #include <unoprnms.hxx> +#include <o3tl/string_view.hxx> constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/"; @@ -61,7 +62,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 3df56e2489ce..75b483e7d239 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -18,6 +18,7 @@ #include <comphelper/scopeguard.hxx> #include <officecfg/Office/Common.hxx> +#include <o3tl/string_view.hxx> #include <queue> #include <swmodeltestbase.hxx> @@ -35,7 +36,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 33c347661233..c949f59b34ca 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -35,6 +35,7 @@ #include <oox/drawingml/drawingmltypes.hxx> #include <xmloff/odffields.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <o3tl/string_view.hxx> #include <IDocumentMarkAccess.hxx> #include <bordertest.hxx> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index e9b2c0a1ef39..3681b9d55834 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -35,6 +35,7 @@ #include <sfx2/docfilt.hxx> #include <comphelper/processfactory.hxx> #include <tools/UnitConversion.hxx> +#include <o3tl/string_view.hxx> #include <docsh.hxx> #include <ftninfo.hxx> @@ -51,7 +52,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx index 7d09765db1b9..42b5e165bb54 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx @@ -8,6 +8,7 @@ */ #include <swmodeltestbase.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -20,7 +21,7 @@ public: protected: bool mustTestImportOf(const char* filename) const override { - return OString(filename).endsWith(".dotx"); + return o3tl::ends_with(filename, ".dotx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 42b743aabccc..e3628f721ccd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/text/XTextField.hpp> #include <xmloff/odffields.hxx> +#include <o3tl/string_view.hxx> #include <IDocumentMarkAccess.hxx> #include <IMark.hxx> @@ -32,7 +33,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 0446427e0b03..03e53c0e5c81 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -11,6 +11,7 @@ #include <unotools/tempfile.hxx> #include <tools/urlobj.hxx> #include <officecfg/Office/Common.hxx> +#include <o3tl/string_view.hxx> // This file contains tests to check relative/absolute hyperlinks handling @@ -107,7 +108,7 @@ protected: bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx index 602ef048f5ca..bc896ae5f638 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx @@ -8,6 +8,7 @@ */ #include <swmodeltestbase.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -20,7 +21,7 @@ protected: */ bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".docx"); + return o3tl::ends_with(filename, ".docx"); } }; diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 298bdbaa8e02..8351541224bc 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -58,6 +58,7 @@ #include <IDocumentSettingAccess.hxx> #include <docsh.hxx> #include <unotxdoc.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -67,7 +68,7 @@ public: bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".doc"); + return o3tl::ends_with(filename, ".doc"); } /** @@ -100,7 +101,7 @@ public: }; // Don't bother with non-.doc files; weed out denylisted .doc files - return (OString(filename).endsWith(".doc") && std::find(aDenylist.begin(), aDenylist.end(), filename) == aDenylist.end()); + return (o3tl::ends_with(filename, ".doc") && std::find(aDenylist.begin(), aDenylist.end(), filename) == aDenylist.end()); } protected: diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index f46743d8b1e5..d6523f172f57 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -32,6 +32,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <unotxdoc.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -41,7 +42,7 @@ public: bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".doc"); + return o3tl::ends_with(filename, ".doc"); } }; diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index ccd850864b87..de913f30c451 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -35,6 +35,7 @@ #include <docsh.hxx> #include <unotxdoc.hxx> #include <formatlinebreak.hxx> +#include <o3tl/string_view.hxx> class Test : public SwModelTestBase { @@ -47,7 +48,7 @@ public: bool mustTestImportOf(const char* filename) const override { // If the testcase is stored in some other format, it's pointless to test. - return OString(filename).endsWith(".doc"); + return o3tl::ends_with(filename, ".doc"); } }; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index d72289bdbb36..90f20d09207e 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -57,6 +57,7 @@ #include <SwGrammarMarkUp.hxx> #include <docsh.hxx> #include <svtools/optionsdrawinglayer.hxx> +#include <o3tl/string_view.hxx> #include <cellfrm.hxx> #include <wrtsh.hxx> #include <textcontentcontrol.hxx> @@ -123,7 +124,7 @@ OString buildHyperlinkJSON(const OUString& sText, const OUString& sLink) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree, false); - return OString(aStream.str().c_str()).trim(); + return OString(o3tl::trim(aStream.str())); } } diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 0232dbe01e75..4906dc28cdca 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -24,6 +24,7 @@ #include <comphelper/string.hxx> #include <i18nlangtag/languagetag.hxx> #include <o3tl/any.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <tools/urlobj.hxx> #include <swtypes.hxx> @@ -500,7 +501,7 @@ OUString SwAuthorityField::ConditionalExpandAuthIdentifier( { OUString sIdentifier(m_xAuthEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER)); // tdf#107784 Use title if it's a ooxml citation - if (sIdentifier.trim().startsWith("CITATION")) + if (o3tl::starts_with(o3tl::trim(sIdentifier), u"CITATION")) return m_xAuthEntry->GetAuthorField(AUTH_FIELD_TITLE); else sRet += sIdentifier; diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 91fa6120eae2..222ac3e96589 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -22,6 +22,7 @@ #include <svtools/htmlkywd.hxx> #include <svtools/htmlout.hxx> #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> #include <fmtfld.hxx> #include <doc.hxx> #include <breakit.hxx> @@ -466,7 +467,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) bool bWritten = false; if( (rComment.getLength() >= 6 && rComment.startsWith("<") && rComment.endsWith(">") && - rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) || + o3tl::equalsIgnoreAsciiCase(rComment.subView( 1, 4 ), u"" OOO_STRING_SVTOOLS_HTML_meta) ) || (rComment.getLength() >= 7 && rComment.startsWith( "<!--" ) && rComment.endsWith( "-->" )) ) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 44063c816d9e..032c302460c6 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1816,7 +1816,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType, break; case ww::eCITATION: eFieldType = ww::eQUOTE; - assert(rFieldCmd.trim().startsWith("CITATION")); + assert(o3tl::starts_with(o3tl::trim(rFieldCmd), u"CITATION")); sFieldCmd = rFieldCmd.replaceFirst(FieldString(ww::eCITATION), FieldString(ww::eQUOTE)); break; @@ -3060,7 +3060,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) // FIXME: DomainMapper_Impl::CloseFieldCommand() stuffs fully formed // field instructions in here, but if the field doesn't originate // from those filters it won't have that - if (!sRet.trim().startsWith("CITATION")) + if (!o3tl::starts_with(o3tl::trim(sRet), u"CITATION")) { sRet = FieldString(ww::eCITATION) + " \"" + sRet + "\""; } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index cecad8f6d370..fd19f6c11630 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -631,7 +631,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() } default: OUString aCode = m_aFieldStack.back().GetBookmarkCode(); - if (!aCode.isEmpty() && !aCode.trim().startsWith("SHAPE")) + if (!aCode.isEmpty() && !o3tl::starts_with(o3tl::trim(aCode), u"SHAPE")) { // Unhandled field with stored code SwPosition aEndPos = *m_pPaM->GetPoint(); diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 73a63255cc62..3293a6bc670d 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -153,7 +153,7 @@ void SwFieldDBPage::Reset(const SfxItemSet*) { const OUString sUserData = GetUserData(); sal_Int32 nIdx{ 0 }; - if (sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1)) + if (o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1)) { const sal_uInt16 nVal = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(sUserData, 0, ';', nIdx))); if (nVal != USHRT_MAX) diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index c3247352fe8a..50ce0548fd54 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -124,7 +124,7 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* ) sal_Int32 nSelEntryData = -1; const OUString sUserData = GetUserData(); sal_Int32 nIdx{ 0 }; - if (sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1)) + if (o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1)) { nSelEntryData = o3tl::toInt32(o3tl::getToken(sUserData, 0, ';', nIdx)); } diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index 25e77775a2ba..2e7c1c67dbc2 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -154,7 +154,7 @@ void SwFieldDokPage::Reset(const SfxItemSet* ) { const OUString sUserData = GetUserData(); sal_Int32 nIdx{ 0 }; - if (sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1)) + if (o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1)) { const sal_uInt16 nVal = static_cast< sal_uInt16 >(o3tl::toInt32(o3tl::getToken(sUserData, 0, ';', nIdx))); if(nVal != USHRT_MAX) diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index 874b8fe5e90f..017a4d19c6aa 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -144,7 +144,7 @@ void SwFieldFuncPage::Reset(const SfxItemSet* ) { const OUString sUserData = GetUserData(); sal_Int32 nIdx{ 0 }; - if(sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1)) + if(o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1)) { const sal_uInt16 nVal = static_cast< sal_uInt16 >(o3tl::toInt32(o3tl::getToken(sUserData, 0, ';', nIdx))); if(nVal != USHRT_MAX) diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 0c6c4ace6e11..5392df80463e 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -239,8 +239,8 @@ void SwFieldRefPage::Reset(const SfxItemSet* ) { sal_Int32 nIdx{ 0 }; const OUString sUserData = GetUserData(); - if(!IsRefresh() && sUserData.getToken(0, ';', nIdx). - equalsIgnoreAsciiCase(USER_DATA_VERSION_1)) + if(!IsRefresh() && o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), + u"" USER_DATA_VERSION_1)) { const sal_uInt16 nVal = static_cast< sal_uInt16 >(o3tl::toInt32(o3tl::getToken(sUserData, 0, ';', nIdx))); if(nVal != USHRT_MAX) diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index e07117a3c737..af34366b2d36 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -33,6 +33,7 @@ #include <calc.hxx> #include <svl/numformat.hxx> #include <svl/zformat.hxx> +#include <o3tl/string_view.hxx> #include <strings.hrc> #define USER_DATA_VERSION_1 "1" @@ -157,7 +158,7 @@ void SwFieldVarPage::Reset(const SfxItemSet* ) { OUString sUserData = GetUserData(); sal_Int32 nIdx{ 0 }; - if(!IsRefresh() && sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1)) + if(!IsRefresh() && o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1)) { OUString sVal = sUserData.getToken(0, ';', nIdx); sal_uInt16 nVal = o3tl::narrowing<sal_uInt16>(sVal.toInt32()); diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index c886c603953d..48260cd48f0b 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -442,7 +442,8 @@ void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark) } bool bExceedsLength = nBookmarkTextLen > nMaxTextLen; nBookmarkTextLen = std::min<sal_Int32>(nMaxTextLen, nBookmarkTextLen); - sBookmarkNodeText = sBookmarkNodeText.copy(nBookmarkNodeTextPos, nBookmarkTextLen).trim(); + sBookmarkNodeText + = o3tl::trim(sBookmarkNodeText.subView(nBookmarkNodeTextPos, nBookmarkTextLen)); if (bExceedsLength) sBookmarkNodeText += "..."; else if (bPulling && !bPulledAll) diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 58121c6734e7..4e657a260d02 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -250,7 +250,7 @@ OUString getCurrentGlossary() const OUString sTemp{ ::GetCurrGlosGroup() }; // the zeroth path is not being recorded! - if (sTemp.getToken(1, GLOS_DELIM).startsWith("0")) + if (o3tl::starts_with(o3tl::getToken(sTemp, 1, GLOS_DELIM), u"0")) return sTemp.getToken(0, GLOS_DELIM); return sTemp; |