From fdfd517a6f75e394ddcb1e195decbfed33ba56b9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Apr 2022 12:43:11 +0200 Subject: loplugin:stringviewparam whitelist some more functions for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basctl/source/basicide/moduldl2.cxx | 7 ++- basic/inc/sbxform.hxx | 2 +- basic/source/classes/sbunoobj.cxx | 4 +- basic/source/inc/sbunoobj.hxx | 7 ++- basic/source/sbx/sbxform.cxx | 21 ++++--- basic/source/sbx/sbxscan.cxx | 5 +- chart2/source/inc/ObjectIdentifier.hxx | 2 +- chart2/source/tools/ObjectIdentifier.cxx | 34 +++++----- comphelper/source/misc/storagehelper.cxx | 9 ++- compilerplugins/clang/stringviewparam.cxx | 3 +- configmgr/source/components.cxx | 5 +- configmgr/source/components.hxx | 2 +- .../source/drivers/mysqlc/mysqlc_general.cxx | 55 +++++++++------- .../source/drivers/mysqlc/mysqlc_general.hxx | 2 +- .../source/drivers/mysqlc/mysqlc_resultset.cxx | 8 +-- .../source/drivers/postgresql/pq_xcolumns.cxx | 4 +- cppu/source/uno/EnvStack.cxx | 13 ++-- cppu/source/uno/cascade_mapping.cxx | 13 ++-- cppuhelper/source/servicemanager.cxx | 5 +- cppuhelper/source/servicemanager.hxx | 2 +- cppuhelper/source/typemanager.cxx | 5 +- cppuhelper/source/typemanager.hxx | 2 +- cui/source/dialogs/cuifmsearch.cxx | 7 ++- cui/source/dialogs/multipat.cxx | 13 ++-- cui/source/inc/cuifmsearch.hxx | 2 +- cui/source/inc/multipat.hxx | 4 +- cui/source/inc/optpath.hxx | 2 +- cui/source/options/optaboutconfig.cxx | 5 +- cui/source/options/optaboutconfig.hxx | 2 +- cui/source/options/optpath.cxx | 10 +-- dbaccess/source/core/api/KeySet.cxx | 2 +- dbaccess/source/core/api/KeySet.hxx | 2 +- .../source/core/dataaccess/documentcontainer.cxx | 6 +- dbaccess/source/core/misc/dsntypes.cxx | 4 +- dbaccess/source/ui/app/AppDetailPageHelper.cxx | 13 ++-- dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 4 +- dbaccess/source/ui/dlg/TextConnectionHelper.hxx | 2 +- dbaccess/source/ui/inc/TableWindowListBox.hxx | 2 +- dbaccess/source/ui/inc/UITools.hxx | 2 +- dbaccess/source/ui/misc/UITools.cxx | 66 +++++++++---------- .../source/ui/querydesign/TableWindowListBox.cxx | 5 +- dbaccess/source/ui/tabledesign/TEditControl.cxx | 2 +- dbaccess/source/ui/tabledesign/TEditControl.hxx | 2 +- desktop/source/deployment/registry/dp_registry.cxx | 4 +- desktop/source/lib/init.cxx | 6 +- extensions/source/propctrlr/standardcontrol.cxx | 5 +- .../source/propctrlr/stringrepresentation.cxx | 11 ++-- filter/source/config/cache/filtercache.cxx | 5 +- filter/source/config/cache/filtercache.hxx | 2 +- filter/source/config/cache/querytokenizer.cxx | 11 ++-- filter/source/config/cache/querytokenizer.hxx | 2 +- filter/source/svg/svgfontexport.cxx | 5 +- filter/source/svg/svgfontexport.hxx | 2 +- forms/source/xforms/convert.cxx | 4 +- forms/source/xforms/submission/replace.cxx | 11 ++-- forms/source/xforms/submission/submission.hxx | 2 +- framework/inc/dispatch/closedispatcher.hxx | 4 +- framework/inc/services/layoutmanager.hxx | 2 +- framework/inc/uielement/menubarmerger.hxx | 6 +- framework/inc/uielement/statusbarmerger.hxx | 2 +- framework/inc/uielement/toolbarmerger.hxx | 4 +- framework/source/accelerators/keymapping.cxx | 7 ++- framework/source/accelerators/storageholder.cxx | 5 +- framework/source/dispatch/closedispatcher.cxx | 9 +-- .../dispatch/dispatchinformationprovider.cxx | 2 +- .../source/fwe/classes/sfxhelperfunctions.cxx | 4 +- framework/source/inc/accelerators/keymapping.hxx | 2 +- .../source/inc/accelerators/storageholder.hxx | 2 +- framework/source/layoutmanager/helpers.cxx | 27 ++++---- framework/source/layoutmanager/helpers.hxx | 6 +- framework/source/layoutmanager/layoutmanager.cxx | 25 ++++---- framework/source/services/pathsettings.cxx | 7 ++- framework/source/uielement/menubarmerger.cxx | 11 ++-- framework/source/uielement/statusbarmerger.cxx | 7 ++- framework/source/uielement/toolbarmerger.cxx | 7 ++- i18nlangtag/source/languagetag/languagetag.cxx | 5 +- include/comphelper/stl_types.hxx | 11 ++-- include/comphelper/storagehelper.hxx | 4 +- include/editeng/svxacorr.hxx | 5 +- include/framework/sfxhelperfunctions.hxx | 8 +-- include/jvmaccess/classpath.hxx | 2 +- include/oox/dump/dumperbase.hxx | 14 ++--- include/oox/helper/attributelist.hxx | 6 +- include/oox/ole/axcontrol.hxx | 2 +- include/oox/ole/olehelper.hxx | 2 +- include/oox/vml/vmlshapecontext.hxx | 2 +- include/sfx2/docfac.hxx | 2 +- include/sfx2/docfilt.hxx | 2 +- include/sfx2/dockwin.hxx | 4 +- include/sfx2/fcontnr.hxx | 2 +- include/svtools/ctrlbox.hxx | 2 +- include/svtools/ctrltool.hxx | 6 +- include/svx/fmsrcimp.hxx | 6 +- include/svx/fmview.hxx | 2 +- include/svx/ruler.hxx | 2 +- include/svx/svdoashp.hxx | 2 +- include/unotools/datetime.hxx | 2 +- include/unotools/localedatawrapper.hxx | 2 +- include/unotools/moduleoptions.hxx | 2 +- include/vcl/graphicfilter.hxx | 2 +- include/vcl/syswin.hxx | 2 +- include/vcl/toolkit/combobox.hxx | 2 +- include/vcl/toolkit/svtabbx.hxx | 2 +- include/vcl/window.hxx | 2 +- include/xmloff/xmlnumfe.hxx | 2 +- jvmaccess/source/classpath.cxx | 5 +- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 13 ++-- l10ntools/inc/lngmerge.hxx | 4 +- l10ntools/source/lngmerge.cxx | 10 +-- oox/inc/drawingml/chart/chartdrawingfragment.hxx | 2 +- oox/source/docprop/docprophandler.cxx | 4 +- oox/source/docprop/docprophandler.hxx | 2 +- .../drawingml/chart/chartdrawingfragment.cxx | 7 ++- oox/source/drawingml/customshapegeometry.cxx | 5 +- oox/source/dump/dumperbase.cxx | 58 +++++++++-------- oox/source/helper/attributelist.cxx | 12 ++-- oox/source/ole/axcontrol.cxx | 34 +++++----- oox/source/ole/olehelper.cxx | 2 +- oox/source/vml/vmlshapecontext.cxx | 6 +- opencl/source/openclconfig.cxx | 20 +++--- package/source/xstor/ohierarchyholder.cxx | 5 +- package/source/xstor/ohierarchyholder.hxx | 2 +- sc/inc/rangelst.hxx | 2 +- sc/source/core/tool/rangelst.cxx | 7 ++- sc/source/filter/excel/xecontent.cxx | 7 ++- sc/source/filter/excel/xistyle.cxx | 5 +- sc/source/filter/ftools/ftools.cxx | 9 +-- sc/source/filter/html/htmlimp.cxx | 7 ++- sc/source/filter/inc/drawingbase.hxx | 2 +- sc/source/filter/inc/formulabase.hxx | 2 +- sc/source/filter/inc/ftools.hxx | 4 +- sc/source/filter/inc/htmlimp.hxx | 2 +- sc/source/filter/inc/workbookhelper.hxx | 2 +- sc/source/filter/inc/xecontent.hxx | 2 +- sc/source/filter/oox/drawingbase.cxx | 10 +-- sc/source/filter/oox/formulabase.cxx | 7 ++- sc/source/filter/oox/workbookhelper.cxx | 5 +- sc/source/filter/xml/xmlsorti.cxx | 5 +- sc/source/filter/xml/xmlsorti.hxx | 2 +- sc/source/ui/dbgui/asciiopt.cxx | 24 +++---- sc/source/ui/dbgui/imoptdlg.cxx | 8 +-- sc/source/ui/dbgui/scuiasciiopt.cxx | 14 ++--- sc/source/ui/dbgui/validate.cxx | 7 ++- sc/source/ui/inc/anyrefdg.hxx | 6 +- sc/source/ui/inc/asciiopt.hxx | 2 +- sc/source/ui/inc/imoptdlg.hxx | 2 +- sc/source/ui/inc/linkarea.hxx | 2 +- sc/source/ui/inc/tabvwsh.hxx | 2 +- sc/source/ui/inc/viewdata.hxx | 2 +- sc/source/ui/miscdlgs/anyrefdg.cxx | 11 ++-- sc/source/ui/miscdlgs/linkarea.cxx | 7 ++- sc/source/ui/vba/vbarange.cxx | 2 +- sc/source/ui/vba/vbarange.hxx | 2 +- sc/source/ui/view/tabvwsh4.cxx | 2 +- sc/source/ui/view/viewdata.cxx | 18 +++--- sd/qa/unit/export-tests-ooxml2.cxx | 16 ++--- sd/qa/unit/tiledrendering/CallbackRecorder.hxx | 6 +- sd/qa/unit/tiledrendering/tiledrendering.cxx | 6 +- sd/source/ui/app/sdmod1.cxx | 2 +- sd/source/ui/dlg/tpoption.cxx | 13 ++-- sd/source/ui/inc/tpoption.hxx | 2 +- sd/source/ui/slideshow/slideshowimpl.cxx | 7 ++- sd/source/ui/slideshow/slideshowimpl.hxx | 2 +- sdext/source/minimizer/optimizerdialog.cxx | 4 +- sdext/source/minimizer/optimizerdialogcontrols.cxx | 4 +- sfx2/source/bastyp/fltfnc.cxx | 2 +- sfx2/source/dialog/dockwin.cxx | 9 +-- sfx2/source/dialog/filedlghelper.cxx | 4 +- sfx2/source/dialog/filedlgimpl.hxx | 2 +- sfx2/source/dialog/filtergrouping.cxx | 2 +- sfx2/source/dialog/filtergrouping.hxx | 2 +- sfx2/source/doc/DocumentMetadataAccess.cxx | 7 ++- sfx2/source/doc/docfac.cxx | 2 +- sfx2/source/doc/docfilt.cxx | 2 +- starmath/inc/view.hxx | 4 +- starmath/source/view.cxx | 13 ++-- svl/source/misc/msodocumentlockfile.cxx | 18 +++--- svtools/source/control/ctrlbox.cxx | 2 +- svtools/source/control/ctrltool.cxx | 17 ++--- svx/source/dialog/svxruler.cxx | 7 ++- svx/source/form/fmsrcimp.cxx | 9 +-- svx/source/form/fmview.cxx | 8 +-- .../svdraw/presetooxhandleadjustmentrelations.cxx | 12 ++-- svx/source/svdraw/svdoashp.cxx | 13 ++-- sw/inc/authfld.hxx | 4 +- sw/inc/shellio.hxx | 2 +- sw/inc/unochart.hxx | 2 +- sw/source/core/fields/authfld.cxx | 6 +- sw/source/core/inc/SwXMLBlockExport.hxx | 2 +- sw/source/core/inc/SwXMLTextBlocks.hxx | 4 +- sw/source/core/swg/SwXMLBlockExport.cxx | 6 +- sw/source/core/swg/SwXMLTextBlocks.cxx | 5 +- sw/source/core/swg/SwXMLTextBlocks1.cxx | 2 +- sw/source/core/unocore/unochart.cxx | 18 +++--- sw/source/core/unocore/unofield.cxx | 2 +- sw/source/filter/basflt/fltini.cxx | 28 ++++----- sw/source/filter/html/htmlctxt.cxx | 5 +- sw/source/filter/html/htmlgrin.cxx | 5 +- sw/source/filter/html/swhtml.hxx | 4 +- sw/source/filter/ww8/docxattributeoutput.cxx | 4 +- sw/source/filter/ww8/ww8par.hxx | 4 +- sw/source/ui/fldui/changedb.cxx | 11 ++-- sw/source/uibase/dbui/mailmergehelper.cxx | 5 +- sw/source/uibase/envelp/labelcfg.cxx | 9 +-- sw/source/uibase/inc/changedb.hxx | 2 +- sw/source/uibase/inc/glosdoc.hxx | 6 +- sw/source/uibase/inc/mailmergehelper.hxx | 2 +- sw/source/uibase/misc/glosdoc.cxx | 12 ++-- .../ucp/webdav-curl/UCBDeadPropertyValue.cxx | 21 ++++--- .../ucp/webdav-curl/UCBDeadPropertyValue.hxx | 2 +- unoidl/source/unoidl-read.cxx | 5 +- unotools/source/config/moduleoptions.cxx | 23 +++---- unotools/source/i18n/localedatawrapper.cxx | 5 +- unotools/source/misc/datetime.cxx | 17 ++--- vbahelper/source/vbahelper/vbacommandbarhelper.cxx | 9 +-- vbahelper/source/vbahelper/vbacommandbarhelper.hxx | 4 +- vcl/inc/IconThemeScanner.hxx | 4 +- vcl/inc/listbox.hxx | 2 +- vcl/inc/window.h | 2 +- vcl/qt5/QtTransferable.cxx | 12 ++-- vcl/source/app/IconThemeScanner.cxx | 7 ++- vcl/source/control/combobox.cxx | 2 +- vcl/source/control/imp_listbox.cxx | 5 +- vcl/source/filter/graphicfilter.cxx | 4 +- vcl/source/filter/webp/writer.cxx | 15 ++--- vcl/source/font/PhysicalFontFace.cxx | 5 +- vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 7 ++- vcl/source/gdi/WidgetDefinitionReader.cxx | 73 +++++++++++----------- vcl/source/treelist/svtabbx.cxx | 9 +-- vcl/source/window/syswin.cxx | 62 +++++++++--------- vcl/source/window/window2.cxx | 29 ++++----- vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 11 ++-- vcl/workben/svpclient.cxx | 13 ++-- writerfilter/source/dmapper/ConversionHelper.cxx | 10 +-- writerfilter/source/dmapper/ConversionHelper.hxx | 2 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 +-- writerfilter/source/rtftok/rtfsdrimport.cxx | 16 ++--- writerfilter/source/rtftok/rtfsdrimport.hxx | 6 +- xmlhelp/source/cxxhelp/provider/databases.hxx | 5 +- xmloff/source/draw/animationimport.cxx | 20 +++--- xmloff/source/draw/ximpcustomshape.cxx | 9 +-- xmloff/source/style/xmlnumfe.cxx | 11 ++-- xmlsecurity/inc/documentsignaturehelper.hxx | 2 +- .../source/helper/documentsignaturehelper.cxx | 7 ++- 244 files changed, 979 insertions(+), 879 deletions(-) diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 265a5d55b746..57241bce7dde 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include @@ -102,12 +103,12 @@ public: namespace { - int FindEntry(const weld::TreeView& rBox, const OUString& rName) + int FindEntry(const weld::TreeView& rBox, std::u16string_view rName) { int nCount = rBox.n_children(); for (int i = 0; i < nCount; ++i) { - if (rName.equalsIgnoreAsciiCase(rBox.get_text(i, 0))) + if (o3tl::equalsIgnoreAsciiCase(rName, rBox.get_text(i, 0))) return i; } return -1; @@ -1219,7 +1220,7 @@ void LibPage::SetCurLib() ImpInsertLibEntry(aLibName, nEntry++); } - int nEntry_ = FindEntry(*m_xLibBox, "Standard"); + int nEntry_ = FindEntry(*m_xLibBox, u"Standard"); if (nEntry_ == -1 && m_xLibBox->n_children()) nEntry_ = 0; m_xLibBox->set_cursor(nEntry_); diff --git a/basic/inc/sbxform.hxx b/basic/inc/sbxform.hxx index 8173c8ed87b7..8ae9cb2db3f4 100644 --- a/basic/inc/sbxform.hxx +++ b/basic/inc/sbxform.hxx @@ -95,7 +95,7 @@ class SbxBasicFormater { OUString BasicFormat( double dNumber, const OUString& sFormatStrg ); static OUString BasicFormatNull( const OUString& sFormatStrg ); - static bool isBasicFormat( const OUString& sFormatStrg ); + static bool isBasicFormat( std::u16string_view sFormatStrg ); private: static inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 999972c94744..3dc1b8f643a0 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -3271,14 +3271,14 @@ void VBAConstantHelper::init() } bool -VBAConstantHelper::isVBAConstantType( const OUString& rName ) +VBAConstantHelper::isVBAConstantType( std::u16string_view rName ) { init(); bool bConstant = false; for (auto const& elem : aConstCache) { - if( rName.equalsIgnoreAsciiCase(elem) ) + if( o3tl::equalsIgnoreAsciiCase(rName, elem) ) { bConstant = true; break; diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 1fc8ebe4e6c1..67be6f92ca5e 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -65,9 +66,9 @@ class SbUnoStructRefObject final : public SbxObject { struct caseLessComp { - bool operator() (const OUString& rProp, std::u16string_view rOtherProp ) const + bool operator() (std::u16string_view rProp, std::u16string_view rOtherProp ) const { - return rProp.compareToIgnoreAsciiCase( rOtherProp ) < 0; + return o3tl::compareToIgnoreAsciiCase( rProp, rOtherProp ) < 0; } }; typedef std::map< OUString, std::unique_ptr, caseLessComp > StructFieldInfo; @@ -372,7 +373,7 @@ private: public: static VBAConstantHelper& instance(); SbxVariable* getVBAConstant( const OUString& rName ); - bool isVBAConstantType( const OUString& rName ); + bool isVBAConstantType( std::u16string_view rName ); }; SbxVariable* getDefaultProp( SbxVariable* pRef ); diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx index 0123dd076d02..ef273c1f392b 100644 --- a/basic/source/sbx/sbxform.cxx +++ b/basic/source/sbx/sbxform.cxx @@ -24,6 +24,7 @@ #include #include +#include /* TODO: are there any Star-Basic characteristics unconsidered? @@ -957,41 +958,41 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormat return sReturnStrg; } -bool SbxBasicFormater::isBasicFormat( const OUString& sFormatStrg ) +bool SbxBasicFormater::isBasicFormat( std::u16string_view sFormatStrg ) { - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_GENERALNUMBER ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_CURRENCY ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_CURRENCY ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_FIXED ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_FIXED ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_STANDARD ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_STANDARD ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_PERCENT ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_PERCENT ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_SCIENTIFIC ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_SCIENTIFIC ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_YESNO ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_YESNO ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_TRUEFALSE ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_TRUEFALSE ) ) { return true; } - if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_ONOFF ) ) + if( o3tl::equalsIgnoreAsciiCase( sFormatStrg, BASICFORMAT_ONOFF ) ) { return true; } diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 9151c34defba..ae6d50b9cfdf 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -48,6 +48,7 @@ #include #include #include +#include void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep, sal_Unicode& rcDecimalSepAlt ) @@ -470,12 +471,12 @@ const VbaFormatInfo pFormatInfoTable[] = { VbaFormatType::Null, std::u16string_view(u""), NF_INDEX_TABLE_ENTRIES, nullptr } }; -const VbaFormatInfo* getFormatInfo( const OUString& rFmt ) +const VbaFormatInfo* getFormatInfo( std::u16string_view rFmt ) { const VbaFormatInfo* pInfo = pFormatInfoTable; while( pInfo->meType != VbaFormatType::Null ) { - if( rFmt.equalsIgnoreAsciiCase( pInfo->mpVbaFormat ) ) + if( o3tl::equalsIgnoreAsciiCase( rFmt, pInfo->mpVbaFormat ) ) break; ++pInfo; } diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx index 5be9d9cf3a97..834c7e814dd0 100644 --- a/chart2/source/inc/ObjectIdentifier.hxx +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -223,7 +223,7 @@ public: sal_Int32 nOffsetPercent , const css::awt::Point& rMinimumPosition , const css::awt::Point& rMaximumPosition ); - static bool parsePieSegmentDragParameterString( const OUString& rDragParameterString + static bool parsePieSegmentDragParameterString( std::u16string_view rDragParameterString , sal_Int32& rOffsetPercent , css::awt::Point& rMinimumPosition , css::awt::Point& rMaximumPosition ); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 43c26d2aaf55..9e08f108b12b 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -173,12 +173,12 @@ OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& return aRet.makeStringAndClear(); } -sal_Int32 lcl_StringToIndex( const OUString& rIndexString ) +sal_Int32 lcl_StringToIndex( std::u16string_view rIndexString ) { sal_Int32 nRet = -1; - if( !rIndexString.isEmpty() ) + if( !rIndexString.empty() ) { - nRet = rIndexString.toInt32(); + nRet = o3tl::toInt32(rIndexString); if( nRet < -1 ) nRet = -1; } @@ -195,8 +195,8 @@ void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, { OUString aAxisIndexString = lcl_getIndexStringAfterString( rString, ":Axis=" ); sal_Int32 nCharacterIndex=0; - rnDimensionIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) ); - rnAxisIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) ); + rnDimensionIndex = lcl_StringToIndex( o3tl::getToken(aAxisIndexString, 0, ',', nCharacterIndex ) ); + rnAxisIndex = lcl_StringToIndex( o3tl::getToken(aAxisIndexString, 0, ',', nCharacterIndex ) ); } void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, const OUString& rString ) @@ -599,35 +599,35 @@ OUString ObjectIdentifier::createPieSegmentDragParameterString( } bool ObjectIdentifier::parsePieSegmentDragParameterString( - const OUString& rDragParameterString + std::u16string_view rDragParameterString , sal_Int32& rOffsetPercent , awt::Point& rMinimumPosition , awt::Point& rMaximumPosition ) { sal_Int32 nCharacterIndex = 0; - OUString aValueString( rDragParameterString.getToken( 0, ',', nCharacterIndex ) ); - rOffsetPercent = aValueString.toInt32(); + std::u16string_view aValueString( o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ) ); + rOffsetPercent = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMinimumPosition.X = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMinimumPosition.X = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMinimumPosition.Y = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMinimumPosition.Y = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMaximumPosition.X = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMaximumPosition.X = o3tl::toInt32(aValueString); if( nCharacterIndex < 0 ) return false; - aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex ); - rMaximumPosition.Y = aValueString.toInt32(); + aValueString = o3tl::getToken(rDragParameterString, 0, ',', nCharacterIndex ); + rMaximumPosition.Y = o3tl::toInt32(aValueString); return nCharacterIndex >= 0; } @@ -1007,7 +1007,7 @@ OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const OUString& rParticleOrCID ) { const OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, "=" ); - return lcl_StringToIndex( aIndexString.getToken( 0, ',' ) ); + return lcl_StringToIndex( o3tl::getToken(aIndexString, 0, ',' ) ); } OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index b850d7d70197..b2a4512e4e79 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -607,11 +607,10 @@ void LifecycleProxy::commitStorages() }); } -static void splitPath( std::vector &rElems, - const OUString& rPath ) +static void splitPath( std::vector &rElems, std::u16string_view rPath ) { for (sal_Int32 i = 0; i >= 0;) - rElems.push_back( rPath.getToken( 0, '/', i ) ); + rElems.push_back( OUString(o3tl::getToken(rPath, 0, '/', i )) ); } static uno::Reference< embed::XStorage > LookupStorageAtPath( @@ -631,7 +630,7 @@ static uno::Reference< embed::XStorage > LookupStorageAtPath( uno::Reference< embed::XStorage > OStorageHelper::GetStorageAtPath( const uno::Reference< embed::XStorage > &xStorage, - const OUString& rPath, sal_uInt32 nOpenMode, + std::u16string_view rPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ) { std::vector aElems; @@ -641,7 +640,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageAtPath( uno::Reference< io::XStream > OStorageHelper::GetStreamAtPath( const uno::Reference< embed::XStorage > &xParentStorage, - const OUString& rPath, sal_uInt32 nOpenMode, + std::u16string_view rPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ) { std::vector aElems; diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx index e0ca76ead49a..10b7bd7e9c16 100644 --- a/compilerplugins/clang/stringviewparam.cxx +++ b/compilerplugins/clang/stringviewparam.cxx @@ -139,7 +139,8 @@ DeclRefExpr const* relevantCXXMemberCallExpr(CXXMemberCallExpr const* expr) auto const n = i->getName(); if (n == "endsWith" || n == "isEmpty" || n == "startsWith" || n == "subView" || n == "indexOf" || n == "lastIndexOf" || n == "compareTo" || n == "match" - || n == "trim") + || n == "trim" || n == "toInt32" || n == "toInt64" || n == "toDouble" + || n == "equalsIgnoreAsciiCase" || n == "compareToIgnoreAsciiCase" || n == "getToken") { good = true; } diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 3863103e2763..cf1375956571 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include "additions.hxx" #include "components.hxx" @@ -715,11 +716,11 @@ void Components::parseFiles( } void Components::parseFileList( - int layer, FileParser * parseFile, OUString const & urls, + int layer, FileParser * parseFile, std::u16string_view urls, bool recordAdditions) { for (sal_Int32 i = 0;;) { - OUString url(urls.getToken(0, ' ', i)); + OUString url(o3tl::getToken(urls, 0, ' ', i)); if (!url.isEmpty()) { Additions * adds = nullptr; if (recordAdditions) { diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index a44097810015..08f14a8b7bf9 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -122,7 +122,7 @@ private: OUString const & url, bool recursive); void parseFileList( - int layer, FileParser * parseFile, OUString const & urls, + int layer, FileParser * parseFile, std::u16string_view urls, bool recordAdditions); void parseXcdFiles(int layer, OUString const & url); diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx index 17b118c531a9..bc57770413f5 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx @@ -20,6 +20,7 @@ #include #include +#include #include @@ -192,50 +193,58 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept return css::sdbc::DataType::VARCHAR; } -sal_Int32 mysqlStrToOOOType(const OUString& sType) +sal_Int32 mysqlStrToOOOType(std::u16string_view sType) { // TODO other types. - if (sType.equalsIgnoreAsciiCase("tiny") || sType.equalsIgnoreAsciiCase("tinyint")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"tiny") + || o3tl::equalsIgnoreAsciiCase(sType, u"tinyint")) return css::sdbc::DataType::TINYINT; - if (sType.equalsIgnoreAsciiCase("smallint") || sType.equalsIgnoreAsciiCase("year")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"smallint") + || o3tl::equalsIgnoreAsciiCase(sType, u"year")) return css::sdbc::DataType::SMALLINT; - if (sType.equalsIgnoreAsciiCase("int") || sType.equalsIgnoreAsciiCase("mediumint")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"int") + || o3tl::equalsIgnoreAsciiCase(sType, u"mediumint")) return css::sdbc::DataType::INTEGER; - if (sType.equalsIgnoreAsciiCase("varchar") || sType.equalsIgnoreAsciiCase("set") - || sType.equalsIgnoreAsciiCase("enum")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"varchar") || o3tl::equalsIgnoreAsciiCase(sType, u"set") + || o3tl::equalsIgnoreAsciiCase(sType, u"enum")) return css::sdbc::DataType::VARCHAR; - if (sType.equalsIgnoreAsciiCase("bigint")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"bigint")) return css::sdbc::DataType::BIGINT; - if (sType.equalsIgnoreAsciiCase("blob") || sType.equalsIgnoreAsciiCase("longblob") - || sType.equalsIgnoreAsciiCase("tinyblob") || sType.equalsIgnoreAsciiCase("mediumblob")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"blob") + || o3tl::equalsIgnoreAsciiCase(sType, u"longblob") + || o3tl::equalsIgnoreAsciiCase(sType, u"tinyblob") + || o3tl::equalsIgnoreAsciiCase(sType, u"mediumblob")) return css::sdbc::DataType::BLOB; - if (sType.equalsIgnoreAsciiCase("varbinary")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"varbinary")) return css::sdbc::DataType::VARBINARY; - if (sType.equalsIgnoreAsciiCase("char")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"char")) return css::sdbc::DataType::CHAR; - if (sType.equalsIgnoreAsciiCase("tinytext")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"tinytext")) return css::sdbc::DataType::VARCHAR; - if (sType.equalsIgnoreAsciiCase("text")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"text")) return css::sdbc::DataType::LONGVARCHAR; - if (sType.equalsIgnoreAsciiCase("mediumtext") || sType.equalsIgnoreAsciiCase("longtext")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"mediumtext") + || o3tl::equalsIgnoreAsciiCase(sType, u"longtext")) return css::sdbc::DataType::CLOB; - if (sType.equalsIgnoreAsciiCase("binary")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"binary")) return css::sdbc::DataType::BINARY; - if (sType.equalsIgnoreAsciiCase("time")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"time")) return css::sdbc::DataType::TIME; - if (sType.equalsIgnoreAsciiCase("date")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"date")) return css::sdbc::DataType::DATE; - if (sType.equalsIgnoreAsciiCase("datetime") || sType.equalsIgnoreAsciiCase("timestamp")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"datetime") + || o3tl::equalsIgnoreAsciiCase(sType, u"timestamp")) return css::sdbc::DataType::TIMESTAMP; - if (sType.equalsIgnoreAsciiCase("decimal")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"decimal")) return css::sdbc::DataType::DECIMAL; - if (sType.equalsIgnoreAsciiCase("real") || sType.equalsIgnoreAsciiCase("float")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"real") || o3tl::equalsIgnoreAsciiCase(sType, u"float")) return css::sdbc::DataType::REAL; - if (sType.equalsIgnoreAsciiCase("double")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"double")) return css::sdbc::DataType::DOUBLE; - if (sType.equalsIgnoreAsciiCase("bit")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"bit")) return css::sdbc::DataType::BIT; - if (sType.equalsIgnoreAsciiCase("bool") || sType.equalsIgnoreAsciiCase("boolean")) + if (o3tl::equalsIgnoreAsciiCase(sType, u"bool") + || o3tl::equalsIgnoreAsciiCase(sType, u"boolean")) return css::sdbc::DataType::BOOLEAN; OSL_FAIL("Unknown type name from string, failing back to varchar."); return css::sdbc::DataType::VARCHAR; diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx index 2a78c7628879..16236e1530ed 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx @@ -108,7 +108,7 @@ sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept; OUString mysqlTypeToStr(unsigned mysql_type, unsigned mysql_flags); -sal_Int32 mysqlStrToOOOType(const OUString& sType); +sal_Int32 mysqlStrToOOOType(std::u16string_view sType); OUString convert(const ::std::string& _string, const rtl_TextEncoding encoding); } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx index 182e74b7fcb9..2feb2d2688d1 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx @@ -30,6 +30,7 @@ #include #include #include +#include using namespace rtl; @@ -51,14 +52,13 @@ namespace { // copied from string misc, it should be replaced when library is not an // extension anymore -std::vector lcl_split(const OString& rStr, char cSeparator) +std::vector lcl_split(std::string_view rStr, char cSeparator) { std::vector vec; sal_Int32 idx = 0; do { - OString kw = rStr.getToken(0, cSeparator, idx); - kw = kw.trim(); + OString kw(o3tl::trim(o3tl::getToken(rStr, 0, cSeparator, idx))); if (!kw.isEmpty()) { vec.push_back(kw); @@ -507,7 +507,7 @@ DateTime SAL_CALL OResultSet::getTimestamp(sal_Int32 column) // YY-MM-DD HH:MM:SS std::vector dateAndTime - = lcl_split(OString{ sVal.getStr(), getDataLength(column) }, ' '); + = lcl_split(std::string_view(sVal.getStr(), getDataLength(column)), ' '); auto dateParts = lcl_split(dateAndTime.at(0), '-'); auto timeParts = lcl_split(dateAndTime.at(1), ':'); diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx index 82d595628db3..95c4db003314 100644 --- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx @@ -75,9 +75,9 @@ using com::sun::star::sdbc::SQLException; namespace pq_sdbc_driver { -static Any isCurrency( const OUString & typeName ) +static Any isCurrency( std::u16string_view typeName ) { - return Any( typeName.equalsIgnoreAsciiCase("money") ); + return Any( o3tl::equalsIgnoreAsciiCase(typeName, u"money") ); } // static sal_Bool isAutoIncrement8( const OUString & typeName ) diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 2356948c51c5..880b922886d1 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -140,22 +141,22 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl } } -static OUString s_getPrefix(OUString const & str1, OUString const & str2) +static OUString s_getPrefix(OUString const & str1, std::u16string_view str2) { sal_Int32 nIndex1 = 0; sal_Int32 nIndex2 = 0; sal_Int32 sim = 0; - OUString token1; - OUString token2; + std::u16string_view token1; + std::u16string_view token2; do { - token1 = str1.getToken(0, ':', nIndex1); - token2 = str2.getToken(0, ':', nIndex2); + token1 = o3tl::getToken(str1, 0, ':', nIndex1); + token2 = o3tl::getToken(str2, 0, ':', nIndex2); if (token1 == token2) - sim += token1.getLength() + 1; + sim += token1.size() + 1; } while(nIndex1 == nIndex2 && nIndex1 >= 0 && token1 == token2); diff --git a/cppu/source/uno/cascade_mapping.cxx b/cppu/source/uno/cascade_mapping.cxx index e19173bcff4c..dbfbfc6c4dba 100644 --- a/cppu/source/uno/cascade_mapping.cxx +++ b/cppu/source/uno/cascade_mapping.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -155,22 +156,22 @@ extern "C" { static void s_MediatorMapping_free(uno_Mapping * pMapping) }} -static OUString getPrefix(OUString const & str1, OUString const & str2) +static OUString getPrefix(OUString const & str1, std::u16string_view str2) { sal_Int32 nIndex1 = 0; sal_Int32 nIndex2 = 0; sal_Int32 sim = 0; - OUString token1; - OUString token2; + std::u16string_view token1; + std::u16string_view token2; do { - token1 = str1.getToken(0, ':', nIndex1); - token2 = str2.getToken(0, ':', nIndex2); + token1 = o3tl::getToken(str1, 0, ':', nIndex1); + token2 = o3tl::getToken(str2, 0, ':', nIndex2); if (token1 == token2) - sim += token1.getLength() + 1; + sim += token1.size() + 1; } while(nIndex1 == nIndex2 && nIndex1 >= 0 && token1 == token2); diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 6e2f12813445..44044e28a54e 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include "loadsharedlibcomponentfactory.hxx" @@ -1322,9 +1323,9 @@ void cppuhelper::ServiceManager::removeEventListenerFromComponent( } } -void cppuhelper::ServiceManager::init(OUString const & rdbUris) { +void cppuhelper::ServiceManager::init(std::u16string_view rdbUris) { for (sal_Int32 i = 0; i != -1;) { - OUString uri(rdbUris.getToken(0, ' ', i)); + OUString uri(o3tl::getToken(rdbUris, 0, ' ', i)); if (uri.isEmpty()) { continue; } diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx index d086a8d65ead..537194151735 100644 --- a/cppuhelper/source/servicemanager.hxx +++ b/cppuhelper/source/servicemanager.hxx @@ -193,7 +193,7 @@ public: using ServiceManagerBase::acquire; using ServiceManagerBase::release; - void init(OUString const & rdbUris); + void init(std::u16string_view rdbUris); void setContext( css::uno::Reference< css::uno::XComponentContext > const & context) diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx index 30c1555de137..28ef85189f29 100644 --- a/cppuhelper/source/typemanager.cxx +++ b/cppuhelper/source/typemanager.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -2023,9 +2024,9 @@ cppuhelper::TypeManager::createTypeDescriptionEnumeration( depth == css::reflection::TypeDescriptionSearchDepth_INFINITE); } -void cppuhelper::TypeManager::init(OUString const & rdbUris) { +void cppuhelper::TypeManager::init(std::u16string_view rdbUris) { for (sal_Int32 i = 0; i != -1;) { - OUString uri(rdbUris.getToken(0, ' ', i)); + OUString uri(o3tl::getToken(rdbUris, 0, ' ', i)); if (uri.isEmpty()) { continue; } diff --git a/cppuhelper/source/typemanager.hxx b/cppuhelper/source/typemanager.hxx index dcd415b888b1..1ee264bf16ff 100644 --- a/cppuhelper/source/typemanager.hxx +++ b/cppuhelper/source/typemanager.hxx @@ -47,7 +47,7 @@ public: using TypeManager_Base::acquire; using TypeManager_Base::release; - void init(OUString const & rdbUris); + void init(std::u16string_view rdbUris); css::uno::Any find(OUString const & name); diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index 18f9cae66536..f1af2838c4b8 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -31,6 +31,7 @@ #include #include #include +#include using namespace css::uno; using namespace css::i18n; @@ -159,7 +160,7 @@ FmSearchDialog::~FmSearchDialog() m_pSearchEngine.reset(); } -void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText) +void FmSearchDialog::Init(std::u16string_view strVisibleFields, const OUString& sInitialText) { //the initialization of all the Controls m_prbSearchForText->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio)); @@ -203,11 +204,11 @@ void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sIni m_plbPosition->set_active(MATCHING_ANYWHERE); // the field listbox - if (!strVisibleFields.isEmpty()) + if (!strVisibleFields.empty()) { sal_Int32 nPos {0}; do { - m_plbField->append_text(strVisibleFields.getToken(0, ';', nPos)); + m_plbField->append_text(OUString(o3tl::getToken(strVisibleFields, 0, ';', nPos))); } while (nPos>=0); } diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 545fb594ef9b..085d21f995de 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -34,6 +34,7 @@ #include #include +#include using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ui::dialogs; @@ -262,16 +263,16 @@ OUString SvxPathSelectDialog::GetPath() const return sNewPath.makeStringAndClear(); } -void SvxMultiPathDialog::SetPath( const OUString& rPath ) +void SvxMultiPathDialog::SetPath( std::u16string_view rPath ) { - if ( !rPath.isEmpty() ) + if ( !rPath.empty() ) { const sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER; int nCount = 0; sal_Int32 nIndex = 0; do { - const OUString sPath = rPath.getToken( 0, cDelim, nIndex ); + const OUString sPath( o3tl::getToken(rPath, 0, cDelim, nIndex ) ); OUString sSystemPath; bool bIsSystemPath = osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None; @@ -292,14 +293,14 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath ) SelectHdl_Impl(*m_xRadioLB); } -void SvxPathSelectDialog::SetPath(const OUString& rPath) +void SvxPathSelectDialog::SetPath(std::u16string_view rPath) { - if ( !rPath.isEmpty() ) + if ( !rPath.empty() ) { sal_Int32 nIndex = 0; do { - const OUString sPath = rPath.getToken( 0, SVT_SEARCHPATH_DELIMITER, nIndex ); + const OUString sPath( o3tl::getToken(rPath, 0, SVT_SEARCHPATH_DELIMITER, nIndex ) ); OUString sSystemPath; bool bIsSystemPath = osl::FileBase::getSystemPathFromFileURL(sPath, sSystemPath) == osl::FileBase::E_None; diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx index 46284c6d8d4d..29484ef8f69c 100644 --- a/cui/source/inc/cuifmsearch.hxx +++ b/cui/source/inc/cuifmsearch.hxx @@ -133,7 +133,7 @@ public: inline void SetActiveField(const OUString& strField); private: - void Init(const OUString& strVisibleFields, const OUString& strInitialText); + void Init(std::u16string_view strVisibleFields, const OUString& strInitialText); // only to be used out of the constructors void OnFound(const css::uno::Any& aCursorPos, sal_Int16 nFieldPos); diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx index 0cedd954a1a6..258e446e80f8 100644 --- a/cui/source/inc/multipat.hxx +++ b/cui/source/inc/multipat.hxx @@ -40,7 +40,7 @@ public: virtual ~SvxMultiPathDialog() override; OUString GetPath() const; - void SetPath(const OUString& rPath); + void SetPath(std::u16string_view rPath); void SetTitle(const OUString& rTitle) { m_xDialog->set_title(rTitle); } }; @@ -59,7 +59,7 @@ public: SvxPathSelectDialog(weld::Window* pParent); OUString GetPath() const; - void SetPath( const OUString& rPath ); + void SetPath( std::u16string_view rPath ); void SetTitle(const OUString& rTitle) { m_xDialog->set_title(rTitle); } }; diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx index c3b9aafbbae5..acc7696527ed 100644 --- a/cui/source/inc/optpath.hxx +++ b/cui/source/inc/optpath.hxx @@ -56,7 +56,7 @@ private: void GetPathList( SvtPathOptions::Paths _nPathHandle, OUString& _rInternalPath, OUString& _rUserPath, OUString& _rWritablePath, bool& _rReadOnly ); void SetPathList( SvtPathOptions::Paths _nPathHandle, - const OUString& _rUserPath, const OUString& _rWritablePath ); + std::u16string_view _rUserPath, const OUString& _rWritablePath ); public: SvxPathTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ); diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 226839d20c98..6cd26a097a6c 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -531,14 +532,14 @@ void CuiAboutConfigTabPage::AddToModifiedVector( const std::shared_ptr< Prop_Imp //property is not modified before } -std::vector< OUString > CuiAboutConfigTabPage::commaStringToSequence( const OUString& rCommaSepString ) +std::vector< OUString > CuiAboutConfigTabPage::commaStringToSequence( std::u16string_view rCommaSepString ) { std::vector tempVector; sal_Int32 index = 0; do { - OUString word = rCommaSepString.getToken(0, u',', index); + OUString word( o3tl::getToken(rCommaSepString, 0, u',', index) ); word = word.trim(); if( !word.isEmpty()) tempVector.push_back(word); diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index 69a207da6712..64443bcff8cc 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -52,7 +52,7 @@ private: bool m_bSorted; void AddToModifiedVector( const std::shared_ptr< Prop_Impl >& rProp ); - static std::vector< OUString > commaStringToSequence( const OUString& rCommaSepString ); + static std::vector< OUString > commaStringToSequence( std::u16string_view rCommaSepString ); void InsertEntry(const prefBoxEntry& rEntry); DECL_LINK(StandardHdl_Impl, weld::Button&, void); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 1272a52f091d..4d9359534f06 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -136,16 +136,16 @@ static OUString getCfgName_Impl( SvtPathOptions::Paths _nHandle ) #define MULTIPATH_DELIMITER ';' -static OUString Convert_Impl( const OUString& rValue ) +static OUString Convert_Impl( std::u16string_view rValue ) { - if (rValue.isEmpty()) + if (rValue.empty()) return OUString(); sal_Int32 nPos = 0; OUStringBuffer aReturn; for (;;) { - OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos ); + OUString aValue( o3tl::getToken(rValue, 0, MULTIPATH_DELIMITER, nPos ) ); INetURLObject aObj( aValue ); if ( aObj.GetProtocol() == INetProtocol::File ) aReturn.append(aObj.PathToFileName()); @@ -659,7 +659,7 @@ void SvxPathTabPage::GetPathList( void SvxPathTabPage::SetPathList( - SvtPathOptions::Paths _nPathHandle, const OUString& _rUserPath, const OUString& _rWritablePath ) + SvtPathOptions::Paths _nPathHandle, std::u16string_view _rUserPath, const OUString& _rWritablePath ) { OUString sCfgName = getCfgName_Impl( _nPathHandle ); @@ -678,7 +678,7 @@ void SvxPathTabPage::SetPathList( OUString* pArray = aPathSeq.getArray(); sal_Int32 nPos = 0; for ( sal_Int32 i = 0; i < nCount; ++i ) - pArray[i] = _rUserPath.getToken( 0, MULTIPATH_DELIMITER, nPos ); + pArray[i] = o3tl::getToken(_rUserPath, 0, MULTIPATH_DELIMITER, nPos ); Any aValue( aPathSeq ); pImpl->m_xPathSettings->setPropertyValue( sCfgName + POSTFIX_USER, aValue); diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index ba712b574bc4..9cf07310502d 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1379,7 +1379,7 @@ namespace dbaccess void getColumnPositions(const Reference& _rxQueryColumns, const css::uno::Sequence< OUString >& _aColumnNames, - const OUString& _rsUpdateTableName, + std::u16string_view _rsUpdateTableName, SelectColumnsMetaData& o_rColumnNames, bool i_bAppendTableName) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index e5d3c61ea5ac..57889c7743b2 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -63,7 +63,7 @@ namespace dbaccess // the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME void getColumnPositions(const css::uno::Reference< css::container::XNameAccess >& _rxQueryColumns, const css::uno::Sequence< OUString >& _rColumnNames, - const OUString& _rsUpdateTableName, + std::u16string_view _rsUpdateTableName, SelectColumnsMetaData& o_rColumnNames /* out */, bool i_bAppendTableName = false); diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index ffbabde52f76..1a4eedac9532 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -493,10 +493,10 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com namespace { - bool lcl_queryContent(const OUString& _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName) + bool lcl_queryContent(std::u16string_view _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName) { sal_Int32 nIndex = 0; - OUString sName = _sName.getToken(0,'/',nIndex); + OUString sName( o3tl::getToken(_sName,0,'/',nIndex) ); bool bRet = _xNameContainer->hasByName(sName); if ( bRet ) { @@ -504,7 +504,7 @@ namespace _rRet = _xNameContainer->getByName(_sSimpleName); while ( nIndex != -1 && bRet ) { - sName = _sName.getToken(0,'/',nIndex); + sName = o3tl::getToken(_sName,0,'/',nIndex); _xNameContainer.set(_rRet,UNO_QUERY); bRet = _xNameContainer.is(); if ( bRet ) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index b05cd467da81..25513b36c952 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -36,12 +36,12 @@ namespace dbaccess namespace { - void lcl_extractHostAndPort(const OUString& _sUrl,OUString& _sHostname,sal_Int32& _nPortNumber) + void lcl_extractHostAndPort(std::u16string_view _sUrl, OUString& _sHostname, sal_Int32& _nPortNumber) { if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 ) { sal_Int32 nPos {0}; - _sHostname = _sUrl.getToken(0, ':', nPos); + _sHostname = o3tl::getToken(_sUrl, 0, ':', nPos); _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos)); } } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 4e9bb41cb63c..9533ec087c14 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include "AppView.hxx" #include #include @@ -79,11 +80,11 @@ namespace dbaui namespace { - bool lcl_findEntry_impl(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter) + bool lcl_findEntry_impl(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter) { bool bReturn = false; sal_Int32 nIndex = 0; - OUString sName( rName.getToken(0,'/',nIndex) ); + std::u16string_view sName( o3tl::getToken(rName,0,'/',nIndex) ); const weld::TreeView& rTreeView = rTree.GetWidget(); bool bEntry = true; @@ -93,7 +94,7 @@ namespace { if ( nIndex != -1 ) { - sName = rName.getToken(0,'/',nIndex); + sName = o3tl::getToken(rName,0,'/',nIndex); bEntry = rTreeView.iter_children(rIter); } else @@ -110,11 +111,11 @@ namespace return bReturn; } - bool lcl_findEntry(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter) + bool lcl_findEntry(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter) { sal_Int32 nIndex = 0; - OUString sErase = rName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part - return nIndex != -1 && lcl_findEntry_impl(rTree, rName.copy(sErase.getLength() + 1), rIter); + std::u16string_view sErase = o3tl::getToken(rName,0,'/',nIndex); // we don't want to have the "private:forms" part + return nIndex != -1 && lcl_findEntry_impl(rTree, rName.substr(sErase.size() + 1), rIter); } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 1dee8a1f57e2..caac1d968779 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -366,7 +366,7 @@ namespace dbaui return OUString(); } - void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, const OUString& rList, const OUString& rVal ) + void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal ) { if (rVal.getLength()==1) { @@ -376,7 +376,7 @@ namespace dbaui sal_Int32 nPrevIdx {nIdx}; if (static_cast(o3tl::toInt32(o3tl::getToken(rList, 1, '\t', nIdx))) == nVal) { - rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); + rBox.set_entry_text(OUString(o3tl::getToken(rList,0, '\t', nPrevIdx))); return; } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx index 5fface3d0512..6755a422378e 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx @@ -72,7 +72,7 @@ namespace dbaui DECL_LINK(OnEditModified, weld::Entry&, void); OUString GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList); - void SetSeparator(weld::ComboBox& rBox, const OUString& rList, const OUString& rVal); + void SetSeparator(weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal); void SetExtension(const OUString& _rVal); public: diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx index 0d3890cf26c7..cdad4947ca8d 100644 --- a/dbaccess/source/ui/inc/TableWindowListBox.hxx +++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx @@ -90,7 +90,7 @@ namespace dbaui virtual void Command(const CommandEvent& rEvt) override; OTableWindow* GetTabWin(){ return m_pTabWin; } - int GetEntryFromText( const OUString& rEntryText ); + int GetEntryFromText( std::u16string_view rEntryText ); }; class TableWindowListBoxHelper final : public DropTargetHelper diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 34249933f9b6..c622c73f65c5 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -115,7 +115,7 @@ namespace dbaui @param _rTypeInfoIters the vector filled with map iterators */ void fillTypeInfo( const css::uno::Reference< css::sdbc::XConnection>& _rxConnection, - const OUString& _rsTypeNames, + std::u16string_view _rsTypeNames, OTypeInfoMap& _rTypeInfoMap, std::vector& _rTypeInfoIters); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index fca7026cf9e2..e5f595d72446 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -395,7 +395,7 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, } void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, - const OUString& _rsTypeNames, + std::u16string_view _rsTypeNames, OTypeInfoMap& _rTypeInfoMap, std::vector& _rTypeInfoIters) { @@ -489,108 +489,108 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, if( pInfo->nNumPrecRadix <= 1) pInfo->nNumPrecRadix = 10; - OUString aName; + std::u16string_view aName; switch(pInfo->nType) { case DataType::CHAR: - aName = _rsTypeNames.getToken(TYPE_CHAR, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_CHAR, ';'); break; case DataType::VARCHAR: - aName = _rsTypeNames.getToken(TYPE_TEXT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TEXT, ';'); break; case DataType::DECIMAL: - aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DECIMAL, ';'); break; case DataType::NUMERIC: - aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_NUMERIC, ';'); break; case DataType::BIGINT: - aName = _rsTypeNames.getToken(TYPE_BIGINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BIGINT, ';'); break; case DataType::FLOAT: - aName = _rsTypeNames.getToken(TYPE_FLOAT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_FLOAT, ';'); break; case DataType::DOUBLE: - aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DOUBLE, ';'); break; case DataType::LONGVARCHAR: - aName = _rsTypeNames.getToken(TYPE_MEMO, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_MEMO, ';'); break; case DataType::LONGVARBINARY: - aName = _rsTypeNames.getToken(TYPE_IMAGE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_IMAGE, ';'); break; case DataType::DATE: - aName = _rsTypeNames.getToken(TYPE_DATE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DATE, ';'); break; case DataType::TIME: - aName = _rsTypeNames.getToken(TYPE_TIME, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TIME, ';'); break; case DataType::TIMESTAMP: - aName = _rsTypeNames.getToken(TYPE_DATETIME, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DATETIME, ';'); break; case DataType::BIT: if ( !pInfo->aCreateParams.isEmpty() ) { - aName = _rsTypeNames.getToken(TYPE_BIT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BIT, ';'); break; } [[fallthrough]]; case DataType::BOOLEAN: - aName = _rsTypeNames.getToken(TYPE_BOOL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BOOL, ';'); break; case DataType::TINYINT: - aName = _rsTypeNames.getToken(TYPE_TINYINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TINYINT, ';'); break; case DataType::SMALLINT: - aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_SMALLINT, ';'); break; case DataType::INTEGER: - aName = _rsTypeNames.getToken(TYPE_INTEGER, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_INTEGER, ';'); break; case DataType::REAL: - aName = _rsTypeNames.getToken(TYPE_REAL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_REAL, ';'); break; case DataType::BINARY: - aName = _rsTypeNames.getToken(TYPE_BINARY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BINARY, ';'); break; case DataType::VARBINARY: - aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_VARBINARY, ';'); break; case DataType::SQLNULL: - aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_SQLNULL, ';'); break; case DataType::OBJECT: - aName = _rsTypeNames.getToken(TYPE_OBJECT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_OBJECT, ';'); break; case DataType::DISTINCT: - aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DISTINCT, ';'); break; case DataType::STRUCT: - aName = _rsTypeNames.getToken(TYPE_STRUCT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_STRUCT, ';'); break; case DataType::ARRAY: - aName = _rsTypeNames.getToken(TYPE_ARRAY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_ARRAY, ';'); break; case DataType::BLOB: - aName = _rsTypeNames.getToken(TYPE_BLOB, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BLOB, ';'); break; case DataType::CLOB: - aName = _rsTypeNames.getToken(TYPE_CLOB, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_CLOB, ';'); break; case DataType::REF: - aName = _rsTypeNames.getToken(TYPE_REF, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_REF, ';'); break; case DataType::OTHER: - aName = _rsTypeNames.getToken(TYPE_OTHER, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_OTHER, ';'); break; } - if ( !aName.isEmpty() ) + if ( !aName.empty() ) { pInfo->aUIName = aName; pInfo->aUIName += " [ "; } pInfo->aUIName += pInfo->aTypeName; - if ( !aName.isEmpty() ) + if ( !aName.empty() ) pInfo->aUIName += " ]"; // Now that we have the type info, save it in the multimap _rTypeInfoMap.emplace(pInfo->nType,pInfo); diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index a1a8a17c4735..3066f8429f35 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -28,6 +28,7 @@ #include #include #include +#include using namespace dbaui; using namespace ::com::sun::star::sdbc; @@ -92,7 +93,7 @@ void OTableWindowListBox::dispose() InterimItemWindow::dispose(); } -int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText) +int OTableWindowListBox::GetEntryFromText(std::u16string_view rEntryText) { // iterate through the list OJoinDesignView* pView = m_pTabWin->getDesignView(); @@ -111,7 +112,7 @@ int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText) for (int nEntry = 0, nCount = m_xTreeView->n_children(); nEntry < nCount; ++nEntry) { if (bCase ? rEntryText == m_xTreeView->get_text(nEntry) - : rEntryText.equalsIgnoreAsciiCase(m_xTreeView->get_text(nEntry))) + : o3tl::equalsIgnoreAsciiCase(rEntryText, m_xTreeView->get_text(nEntry))) return nEntry; } } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 728b21cf55d6..119791a7c438 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -477,7 +477,7 @@ void OTableEditorCtrl::CursorMoved() OTableRowView::CursorMoved(); } -sal_Int32 OTableEditorCtrl::HasFieldName( const OUString& rFieldName ) +sal_Int32 OTableEditorCtrl::HasFieldName( std::u16string_view rFieldName ) { Reference xCon = GetView()->getController().getConnection(); diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx index 74e3594cf0b2..7b1d467815db 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.hxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx @@ -176,7 +176,7 @@ namespace dbaui DECL_LINK( InvalidateFieldType, void*, void ); void InitCellController(); - sal_Int32 HasFieldName( const OUString& rFieldName ); + sal_Int32 HasFieldName( std::u16string_view rFieldName ); OUString GenerateName( const OUString& rName ); bool SetDataPtr( sal_Int32 nRow ); diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 17b9b774a17d..9932dc6f6b64 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -72,8 +72,8 @@ class PackageRegistryImpl : private cppu::BaseMutex, public t_helper } }; struct ci_string_equals { - bool operator () ( OUString const & str1, std::u16string_view str2 ) const{ - return str1.equalsIgnoreAsciiCase( str2 ); + bool operator () ( std::u16string_view str1, std::u16string_view str2 ) const{ + return o3tl::equalsIgnoreAsciiCase( str1, str2 ); } }; typedef std::unordered_map< diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 017a5838c93b..33b763b3a1cb 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1181,19 +1181,19 @@ rtl::Reference forceSetClipboardForCurrentView(LibreOfficeKitDocum #endif -const vcl::Font* FindFont(const OUString& rFontName) +const vcl::Font* FindFont(std::u16string_view rFontName) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SvxFontListItem* pFonts = static_cast(pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST)); const FontList* pList = pFonts ? pFonts->GetFontList() : nullptr; - if (pList && !rFontName.isEmpty()) + if (pList && !rFontName.empty()) if (sal_Handle hMetric = pList->GetFirstFontMetric(rFontName)) return &FontList::GetFontMetric(hMetric); return nullptr; } -vcl::Font FindFont_FallbackToDefault(const OUString& rFontName) +vcl::Font FindFont_FallbackToDefault(std::u16string_view rFontName) { if (auto pFound = FindFont(rFontName)) return *pFound; diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 4aec523f9614..ba1b943f29a5 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -680,7 +681,7 @@ namespace pcr namespace { - StlSyntaxSequence< OUString > lcl_convertMultiLineToList( const OUString& _rCompsedTextWithLineBreaks ) + StlSyntaxSequence< OUString > lcl_convertMultiLineToList( std::u16string_view _rCompsedTextWithLineBreaks ) { sal_Int32 nLines = comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n'); StlSyntaxSequence< OUString > aStrings( nLines ); @@ -690,7 +691,7 @@ namespace pcr sal_Int32 nIdx {0}; do { - *stringItem = _rCompsedTextWithLineBreaks.getToken( 0, '\n', nIdx ); + *stringItem = o3tl::getToken(_rCompsedTextWithLineBreaks, 0, '\n', nIdx ); ++stringItem; } while (nIdx>0); diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 3c984eb0a867..e436b28e0b64 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include "modulepcr.hxx" #include @@ -304,9 +305,9 @@ namespace { return OUString::number( _rIntValue ); } - sal_Int32 operator()( const OUString& _rStringValue ) const + sal_Int32 operator()( std::u16string_view _rStringValue ) const { - return _rStringValue.toInt32(); + return o3tl::toInt32(_rStringValue); } }; @@ -336,16 +337,16 @@ namespace } template < class ElementType, class Transformer > - void splitComposedStringToSequence( const OUString& _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) + void splitComposedStringToSequence( std::u16string_view _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) { _out_SplitUp.realloc( 0 ); - if ( _rComposed.isEmpty() ) + if ( _rComposed.empty() ) return; sal_Int32 tokenPos = 0; do { _out_SplitUp.realloc( _out_SplitUp.getLength() + 1 ); - _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast(_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) )); + _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast(_rTransformer( OUString(o3tl::getToken(_rComposed, 0, '\n', tokenPos )) )); } while ( tokenPos != -1 ); } diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index eb602355ce20..7d64e645b668 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -51,6 +51,7 @@ #include #include +#include namespace filter::config{ @@ -2146,14 +2147,14 @@ CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::containe } -std::vector FilterCache::impl_tokenizeString(const OUString& sData , +std::vector FilterCache::impl_tokenizeString(std::u16string_view sData , sal_Unicode cSeparator) { std::vector lData ; sal_Int32 nToken = 0; do { - OUString sToken = sData.getToken(0, cSeparator, nToken); + OUString sToken( o3tl::getToken(sData, 0, cSeparator, nToken) ); lData.push_back(sToken); } while(nToken >= 0); diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index 42be4314cb38..526ce85d6126 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -891,7 +891,7 @@ class FilterCache : public cppu::BaseMutex /** TODO */ - static std::vector impl_tokenizeString(const OUString& sData , + static std::vector impl_tokenizeString(std::u16string_view sData , sal_Unicode cSeparator); diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx index 9b64f68fe6d8..f5b021f53b45 100644 --- a/filter/source/config/cache/querytokenizer.cxx +++ b/filter/source/config/cache/querytokenizer.cxx @@ -20,23 +20,24 @@ #include "querytokenizer.hxx" #include +#include namespace filter::config{ -QueryTokenizer::QueryTokenizer(const OUString& sQuery) +QueryTokenizer::QueryTokenizer(std::u16string_view sQuery) : m_bValid(true) { sal_Int32 token = 0; while(token != -1) { - OUString sToken = sQuery.getToken(0, ':', token); - if (!sToken.isEmpty()) + std::u16string_view sToken = o3tl::getToken(sQuery,0, ':', token); + if (!sToken.empty()) { sal_Int32 nIdx{ 0 }; - const OUString sKey{ sToken.getToken(0, '=', nIdx) }; - const OUString sVal{ sToken.getToken(0, ':', nIdx) }; + const OUString sKey{ o3tl::getToken(sToken, 0, '=', nIdx) }; + const OUString sVal{ o3tl::getToken(sToken, 0, ':', nIdx) }; if (sKey.isEmpty()) m_bValid = false; diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx index e0b8d5218130..0c7e79b3ddc7 100644 --- a/filter/source/config/cache/querytokenizer.hxx +++ b/filter/source/config/cache/querytokenizer.hxx @@ -73,7 +73,7 @@ class QueryTokenizer : public std::unordered_map< OUString, OUString > @param sQuery the query string. */ - explicit QueryTokenizer(const OUString& sQuery); + explicit QueryTokenizer(std::u16string_view sQuery); /** @short destruct an instance of this class. diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index b0cbed97e4e7..7e75d65e6bc2 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -307,9 +308,9 @@ void SVGFontExport::EmbedFonts() } -OUString SVGFontExport::GetMappedFontName( const OUString& rFontName ) const +OUString SVGFontExport::GetMappedFontName( std::u16string_view rFontName ) const { - OUString aRet( rFontName.getToken( 0, ';' ) ); + OUString aRet( o3tl::getToken(rFontName, 0, ';' ) ); if( mnCurFontId ) aRet += " embedded"; diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx index 6492ebd9c04c..259196f9e031 100644 --- a/filter/source/svg/svgfontexport.hxx +++ b/filter/source/svg/svgfontexport.hxx @@ -66,7 +66,7 @@ public: ~SVGFontExport(); void EmbedFonts(); - OUString GetMappedFontName( const OUString& rFontName ) const; + OUString GetMappedFontName( std::u16string_view rFontName ) const; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx index 773cbfd6f925..278d5b01f597 100644 --- a/forms/source/xforms/convert.cxx +++ b/forms/source/xforms/convert.cxx @@ -85,7 +85,7 @@ namespace } - css::util::Date lcl_toUNODate( const OUString& rString ) + css::util::Date lcl_toUNODate( std::u16string_view rString ) { css::util::Date aDate( 1, 1, 1900 ); @@ -217,7 +217,7 @@ namespace } else { - aDate = lcl_toUNODate( rString.copy( 0, nDateTimeSep ) ); + aDate = lcl_toUNODate( rString.subView( 0, nDateTimeSep ) ); aTime = lcl_toUNOTime( rString.subView( nDateTimeSep + 1 ) ); } css::util::DateTime aDateTime( diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index e0595736b712..77e628728534 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -43,15 +44,15 @@ using namespace com::sun::star::beans; using namespace com::sun::star::task; using namespace com::sun::star::xml::dom; -CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, const Reference& aDocument, const Reference& aFrame) +CSubmission::SubmissionResult CSubmission::replace(std::u16string_view aReplace, const Reference& aDocument, const Reference& aFrame) { if (!m_aResultStream.is()) return CSubmission::UNKNOWN_ERROR; try { Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - if (aReplace.equalsIgnoreAsciiCase("all") - || aReplace.equalsIgnoreAsciiCase("document")) { + if (o3tl::equalsIgnoreAsciiCase(aReplace, u"all") + || o3tl::equalsIgnoreAsciiCase(aReplace, u"document")) { Reference< XComponentLoader > xLoader; if (aFrame.is()) xLoader.set(aFrame, UNO_QUERY); @@ -73,7 +74,7 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con return CSubmission::SUCCESS; - } else if (aReplace.equalsIgnoreAsciiCase("instance")) { + } else if (o3tl::equalsIgnoreAsciiCase(aReplace, u"instance")) { if (aDocument.is()) { // parse the result stream into a new document Reference< XDocumentBuilder > xBuilder(DocumentBuilder::create(xContext)); @@ -94,7 +95,7 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con // nothing to replace return CSubmission::UNKNOWN_ERROR; } - } else if (aReplace.equalsIgnoreAsciiCase("none")) { + } else if (o3tl::equalsIgnoreAsciiCase(aReplace, u"none")) { // do nothing \o/ return CSubmission::SUCCESS; } diff --git a/forms/source/xforms/submission/submission.hxx b/forms/source/xforms/submission/submission.hxx index 655529063a7d..bb5a19ee362b 100644 --- a/forms/source/xforms/submission/submission.hxx +++ b/forms/source/xforms/submission/submission.hxx @@ -130,7 +130,7 @@ public: virtual SubmissionResult submit(const css::uno::Reference< css::task::XInteractionHandler >& ) = 0; - SubmissionResult replace(const OUString&, const css::uno::Reference< css::xml::dom::XDocument >&, const css::uno::Reference< css::frame::XFrame>&); + SubmissionResult replace(std::u16string_view, const css::uno::Reference< css::xml::dom::XDocument >&, const css::uno::Reference< css::frame::XFrame>&); }; diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx index 8ee08ed194f3..1ceb256498f9 100644 --- a/framework/inc/dispatch/closedispatcher.hxx +++ b/framework/inc/dispatch/closedispatcher.hxx @@ -117,7 +117,7 @@ class CloseDispatcher final : public ::cppu::WeakImplHelper< */ CloseDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget); + std::u16string_view sTarget); /** @short does nothing real. */ virtual ~CloseDispatcher() override; @@ -252,7 +252,7 @@ class CloseDispatcher final : public ::cppu::WeakImplHelper< */ static css::uno::Reference< css::frame::XFrame > static_impl_searchRightTargetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget); + std::u16string_view sTarget); }; // class CloseDispatcher diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 189be410bfc9..28f78d5bdc0f 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -175,7 +175,7 @@ namespace framework // query - css::uno::Reference< css::ui::XUIElement > implts_findElement( const OUString& aName ); + css::uno::Reference< css::ui::XUIElement > implts_findElement( std::u16string_view aName ); bool implts_readWindowStateData( const OUString& rName, UIElement& rElementData ); void implts_writeWindowStateData( const OUString& rName, const UIElement& rElementData ); diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx index 3e2d4addd408..16bb8ec67610 100644 --- a/framework/inc/uielement/menubarmerger.hxx +++ b/framework/inc/uielement/menubarmerger.hxx @@ -62,7 +62,7 @@ namespace MenuBarMerger bool IsCorrectContext( std::u16string_view aContext, std::u16string_view aModuleIdentifier ); - void RetrieveReferencePath( const OUString&, + void RetrieveReferencePath( std::u16string_view, std::vector< OUString >& aReferencePath ); ReferencePathInfo FindReferencePath( const std::vector< OUString >& aReferencePath, Menu* pMenu ); sal_uInt16 FindMenuItem( std::u16string_view rCmd, @@ -75,7 +75,7 @@ namespace MenuBarMerger sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const OUString& rModuleIdentifier, const AddonMenuContainer& rAddonMenuItems ); bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo, @@ -98,7 +98,7 @@ namespace MenuBarMerger const AddonMenuContainer& rAddonMenuItems ); bool RemoveMenuItems( Menu* pMenu, sal_uInt16 nPos, - const OUString& rMergeCommandParameter ); + std::u16string_view rMergeCommandParameter ); bool CreateSubMenu( Menu* pSubMenu, sal_uInt16& nItemId, const OUString& rModuleIdentifier, diff --git a/framework/inc/uielement/statusbarmerger.hxx b/framework/inc/uielement/statusbarmerger.hxx index 350bae4bf2f8..1eaec5a88f81 100644 --- a/framework/inc/uielement/statusbarmerger.hxx +++ b/framework/inc/uielement/statusbarmerger.hxx @@ -60,7 +60,7 @@ namespace StatusbarMerger sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonStatusbarItemContainer& rItems ); bool ProcessMergeFallback( StatusBar* pStatusbar, diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index 157e02170340..837507baa386 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -84,7 +84,7 @@ class ToolBarMerger CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonToolbarItemContainer& rItems ); static bool ProcessMergeFallback( ToolBox* pToolbar, @@ -112,7 +112,7 @@ class ToolBarMerger static void RemoveItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - const OUString& rMergeCommandParameter ); + std::u16string_view rMergeCommandParameter ); static rtl::Reference<::cppu::OWeakObject> CreateController( const css::uno::Reference< css::uno::XComponentContext > & rxContext, diff --git a/framework/source/accelerators/keymapping.cxx b/framework/source/accelerators/keymapping.cxx index 1a5648c8d43a..a0d33e7b4e23 100644 --- a/framework/source/accelerators/keymapping.cxx +++ b/framework/source/accelerators/keymapping.cxx @@ -21,6 +21,7 @@ #include #include +#include namespace framework { @@ -186,10 +187,10 @@ OUString KeyMapping::mapCodeToIdentifier(sal_uInt16 nCode) return OUString::number(nCode); } -bool KeyMapping::impl_st_interpretIdentifierAsPureKeyCode(const OUString& sIdentifier, +bool KeyMapping::impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier, sal_uInt16& rCode ) { - sal_Int32 nCode = sIdentifier.toInt32(); + sal_Int32 nCode = o3tl::toInt32(sIdentifier); if (nCode > 0) { rCode = static_cast(nCode); @@ -199,7 +200,7 @@ bool KeyMapping::impl_st_interpretIdentifierAsPureKeyCode(const OUString& sIdent // 0 is normally an error of the called method toInt32() ... // But we must be aware, that the identifier is "0"! rCode = 0; - return sIdentifier == "0"; + return sIdentifier == u"0"; } } // namespace framework diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx index e870ec0b71b8..c0a6106d7202 100644 --- a/framework/source/accelerators/storageholder.cxx +++ b/framework/source/accelerators/storageholder.cxx @@ -26,6 +26,7 @@ #include #include +#include #include @@ -427,13 +428,13 @@ OUString StorageHolder::impl_st_normPath(const OUString& sPath) return sNormedPath; } -std::vector StorageHolder::impl_st_parsePath(const OUString& sPath) +std::vector StorageHolder::impl_st_parsePath(std::u16string_view sPath) { std::vector lToken; sal_Int32 i = 0; while (true) { - OUString sToken = sPath.getToken(0, PATH_SEPARATOR_UNICODE, i); + OUString sToken( o3tl::getToken(sPath, 0, PATH_SEPARATOR_UNICODE, i) ); if (i < 0) break; lToken.push_back(sToken); diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 6b2a13cb4eb7..d36a14c6461a 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -40,6 +40,7 @@ #include #include #include +#include using namespace com::sun::star; @@ -56,7 +57,7 @@ const char URL_CLOSEFRAME[] = ".uno:CloseFrame"; CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget) + std::u16string_view sTarget) : m_xContext (rxContext ) , m_aAsyncCallback( new vcl::EventPoster(LINK(this, CloseDispatcher, impl_asyncCallback))) @@ -558,12 +559,12 @@ void CloseDispatcher::implts_notifyResultListener(const css::uno::Reference< css } css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRightTargetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame , - const OUString& sTarget) + std::u16string_view sTarget) { - if (sTarget.equalsIgnoreAsciiCase("_self")) + if (o3tl::equalsIgnoreAsciiCase(sTarget, u"_self")) return xFrame; - OSL_ENSURE(sTarget.isEmpty(), "CloseDispatch used for unexpected target. Magic things will happen now .-)"); + OSL_ENSURE(sTarget.empty(), "CloseDispatch used for unexpected target. Magic things will happen now .-)"); css::uno::Reference< css::frame::XFrame > xTarget = xFrame; while(true) diff --git a/framework/source/dispatch/dispatchinformationprovider.cxx b/framework/source/dispatch/dispatchinformationprovider.cxx index 0f4b488a19a9..8c9cd6d7c0d9 100644 --- a/framework/source/dispatch/dispatchinformationprovider.cxx +++ b/framework/source/dispatch/dispatchinformationprovider.cxx @@ -113,7 +113,7 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvide if (!xFrame.is()) return css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > >(); - rtl::Reference xCloser = new CloseDispatcher(m_xContext, xFrame, "_self"); // explicit "_self" ... not "" ... see implementation of close dispatcher itself! + rtl::Reference xCloser = new CloseDispatcher(m_xContext, xFrame, u"_self"); // explicit "_self" ... not "" ... see implementation of close dispatcher itself! css::uno::Reference< css::frame::XDispatchInformationProvider > xController (xFrame->getController() , css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher = css::frame::AppDispatchProvider::create(m_xContext); diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx index 06f48f1fe695..170f3e7156bb 100644 --- a/framework/source/fwe/classes/sfxhelperfunctions.cxx +++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx @@ -132,7 +132,7 @@ pfunc_createDockingWindow SetDockingWindowCreator( pfunc_createDockingWindow pNe return pOldFunc; } -void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL ) +void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rResourceURL ) { pfunc_createDockingWindow pFactory = nullptr; { @@ -153,7 +153,7 @@ pfunc_isDockingWindowVisible SetIsDockingWindowVisible( pfunc_isDockingWindowVis return pOldFunc; } -bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL ) +bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rResourceURL ) { pfunc_isDockingWindowVisible pCall = nullptr; { diff --git a/framework/source/inc/accelerators/keymapping.hxx b/framework/source/inc/accelerators/keymapping.hxx index 75715efc7e3a..88429a0122f1 100644 --- a/framework/source/inc/accelerators/keymapping.hxx +++ b/framework/source/inc/accelerators/keymapping.hxx @@ -117,7 +117,7 @@ class KeyMapping @return [boolean] sal_True if conversion was successful. */ - bool impl_st_interpretIdentifierAsPureKeyCode(const OUString& sIdentifier, + bool impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier, sal_uInt16& rCode ); }; diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx index d2e17ee1a550..355bedeaa662 100644 --- a/framework/source/inc/accelerators/storageholder.hxx +++ b/framework/source/inc/accelerators/storageholder.hxx @@ -174,7 +174,7 @@ class StorageHolder final /** @short TODO */ - static std::vector impl_st_parsePath(const OUString& sPath); + static std::vector impl_st_parsePath(std::u16string_view sPath); }; } // namespace framework diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index d3b58351d95c..7508d58cbd44 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include using namespace com::sun::star; @@ -185,26 +186,24 @@ WindowAlign ImplConvertAlignment( ui::DockingArea aAlignment ) return WindowAlign::Bottom; } -OUString getElementTypeFromResourceURL( const OUString& aResourceURL ) +std::u16string_view getElementTypeFromResourceURL( std::u16string_view aResourceURL ) { - OUString aUIResourceURL( UIRESOURCE_URL ); - if ( aResourceURL.startsWith( aUIResourceURL ) ) + if ( o3tl::starts_with(aResourceURL, UIRESOURCE_URL ) ) { - sal_Int32 nIndex{ aUIResourceURL.getLength() }; - return aResourceURL.getToken( 1, '/', nIndex ); + sal_Int32 nIndex{ UIRESOURCE_URL.getLength() }; + return o3tl::getToken(aResourceURL, 1, '/', nIndex ); } - return OUString(); + return std::u16string_view(); } -void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName ) +void parseResourceURL( std::u16string_view aResourceURL, OUString& aElementType, OUString& aElementName ) { - OUString aUIResourceURL( UIRESOURCE_URL ); - if ( aResourceURL.startsWith( aUIResourceURL ) ) + if ( o3tl::starts_with(aResourceURL, UIRESOURCE_URL) ) { - sal_Int32 nIndex{ aUIResourceURL.getLength() }; - aElementType = aResourceURL.getToken( 1, '/', nIndex ); - aElementName = aResourceURL.getToken( 0, '/', nIndex ); + sal_Int32 nIndex{ UIRESOURCE_URL.getLength() }; + aElementType = o3tl::getToken(aResourceURL, 1, '/', nIndex ); + aElementName = o3tl::getToken(aResourceURL, 0, '/', nIndex ); } } @@ -287,9 +286,9 @@ bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame ) return false; } -void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible ) +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName, bool bVisible ) { - sal_Int32 nID = rDockingWindowName.toInt32(); + sal_Int32 nID = o3tl::toInt32(rDockingWindowName); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY); diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index e3df8fa6f0e9..14f9642a39d6 100644 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -52,14 +52,14 @@ bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectang bool lcl_checkUIElement(const css::uno::Reference< css::ui::XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize, css::uno::Reference< css::awt::XWindow >& _xWindow); css::uno::Reference< css::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::awt::XWindowPeer >& rParent, const char* pService ); WindowAlign ImplConvertAlignment( css::ui::DockingArea aAlignment ); -OUString getElementTypeFromResourceURL( const OUString& aResourceURL ); -void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName ); +std::u16string_view getElementTypeFromResourceURL( std::u16string_view aResourceURL ); +void parseResourceURL( std::u16string_view aResourceURL, OUString& aElementType, OUString& aElementName ); ::tools::Rectangle putAWTToRectangle( const css::awt::Rectangle& rRect ); css::awt::Rectangle putRectangleValueToAWT( const ::tools::Rectangle& rRect ); css::uno::Reference< css::frame::XModel > impl_getModelFromFrame( const css::uno::Reference< css::frame::XFrame >& rFrame ); bool implts_isPreviewModel( const css::uno::Reference< css::frame::XModel >& xModel ); bool implts_isFrameOrWindowTop( const css::uno::Reference< css::frame::XFrame >& xFrame ); -void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible ); +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName, bool bVisible ); void impl_addWindowListeners( const css::uno::Reference< css::uno::XInterface >& xThis, const css::uno::Reference< css::ui::XUIElement >& xUIElement ); } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 0d1cc619da89..9397e7643a28 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -63,6 +63,7 @@ #include #include +#include #include @@ -482,7 +483,7 @@ void LayoutManager::implts_toggleFloatingUIElementsVisibility( bool bActive ) pToolbarManager->setFloatingToolbarsVisibility( bActive ); } -uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( const OUString& aName ) +uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( std::u16string_view aName ) { OUString aElementType; OUString aElementName; @@ -1880,7 +1881,7 @@ sal_Bool SAL_CALL LayoutManager::dockAllWindows( ::sal_Int16 /*nElementType*/ ) sal_Bool SAL_CALL LayoutManager::floatWindow( const OUString& aName ) { bool bResult( false ); - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -1899,7 +1900,7 @@ sal_Bool SAL_CALL LayoutManager::floatWindow( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::lockWindow( const OUString& aName ) { bool bResult( false ); - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -1918,7 +1919,7 @@ sal_Bool SAL_CALL LayoutManager::lockWindow( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::unlockWindow( const OUString& aName ) { bool bResult( false ); - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -1936,7 +1937,7 @@ sal_Bool SAL_CALL LayoutManager::unlockWindow( const OUString& aName ) void SAL_CALL LayoutManager::setElementSize( const OUString& aName, const awt::Size& aSize ) { - if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( !o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) return; SolarMutexClearableGuard aReadLock; @@ -1953,7 +1954,7 @@ void SAL_CALL LayoutManager::setElementSize( const OUString& aName, const awt::S void SAL_CALL LayoutManager::setElementPos( const OUString& aName, const awt::Point& aPos ) { - if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( !o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) return; SolarMutexClearableGuard aReadLock; @@ -1970,7 +1971,7 @@ void SAL_CALL LayoutManager::setElementPos( const OUString& aName, const awt::Po void SAL_CALL LayoutManager::setElementPosSize( const OUString& aName, const awt::Point& aPos, const awt::Size& aSize ) { - if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( !o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) return; SolarMutexClearableGuard aReadLock; @@ -2061,7 +2062,7 @@ sal_Bool SAL_CALL LayoutManager::isElementVisible( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::isElementFloating( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2076,7 +2077,7 @@ sal_Bool SAL_CALL LayoutManager::isElementFloating( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::isElementDocked( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2091,7 +2092,7 @@ sal_Bool SAL_CALL LayoutManager::isElementDocked( const OUString& aName ) sal_Bool SAL_CALL LayoutManager::isElementLocked( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2106,7 +2107,7 @@ sal_Bool SAL_CALL LayoutManager::isElementLocked( const OUString& aName ) awt::Size SAL_CALL LayoutManager::getElementSize( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); @@ -2121,7 +2122,7 @@ awt::Size SAL_CALL LayoutManager::getElementSize( const OUString& aName ) awt::Point SAL_CALL LayoutManager::getElementPos( const OUString& aName ) { - if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR )) + if ( o3tl::equalsIgnoreAsciiCase(getElementTypeFromResourceURL( aName ), UIRESOURCETYPE_TOOLBAR )) { SolarMutexClearableGuard aReadLock; ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get(); diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index fc74b81d55f1..bdffa86b1cea 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -50,6 +50,7 @@ #include #include #include +#include using namespace framework; @@ -369,7 +370,7 @@ private: /** converts our new string list schema to the old ";" separated schema ... */ OUString impl_convertPath2OldStyle(const PathSettings::PathInfo& rPath ) const; - std::vector impl_convertOldStyle2Path(const OUString& sOldStylePath) const; + std::vector impl_convertOldStyle2Path(std::u16string_view sOldStylePath) const; /** remove still known paths from the given lList argument. So real user defined paths can be extracted from the list of @@ -970,13 +971,13 @@ OUString PathSettings::impl_convertPath2OldStyle(const PathSettings::PathInfo& r return sPathVal.makeStringAndClear(); } -std::vector PathSettings::impl_convertOldStyle2Path(const OUString& sOldStylePath) const +std::vector PathSettings::impl_convertOldStyle2Path(std::u16string_view sOldStylePath) const { std::vector lList; sal_Int32 nToken = 0; do { - OUString sToken = sOldStylePath.getToken(0, ';', nToken); + OUString sToken( o3tl::getToken(sOldStylePath, 0, ';', nToken) ); if (!sToken.isEmpty()) lList.push_back(sToken); } diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx index 175cbe8bcde0..c5730d2ef3e9 100644 --- a/framework/source/uielement/menubarmerger.cxx +++ b/framework/source/uielement/menubarmerger.cxx @@ -20,6 +20,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -62,7 +63,7 @@ bool MenuBarMerger::IsCorrectContext( } void MenuBarMerger::RetrieveReferencePath( - const OUString& rReferencePathString, + std::u16string_view rReferencePathString, ::std::vector< OUString >& rReferencePath ) { const char aDelimiter = '\\'; @@ -71,7 +72,7 @@ void MenuBarMerger::RetrieveReferencePath( sal_Int32 nIndex( 0 ); do { - OUString aToken = rReferencePathString.getToken( 0, aDelimiter, nIndex ); + OUString aToken( o3tl::getToken(rReferencePathString, 0, aDelimiter, nIndex ) ); if ( !aToken.isEmpty() ) rReferencePath.push_back( aToken ); } @@ -256,9 +257,9 @@ bool MenuBarMerger::ReplaceMenuItem( bool MenuBarMerger::RemoveMenuItems( Menu* pMenu, sal_uInt16 nPos, - const OUString& rMergeCommandParameter ) + std::u16string_view rMergeCommandParameter ) { - const sal_uInt16 nParam( sal_uInt16( rMergeCommandParameter.toInt32() )); + const sal_uInt16 nParam( sal_uInt16( o3tl::toInt32(rMergeCommandParameter) )); sal_uInt16 nCount = std::max( nParam, sal_uInt16(1) ); sal_uInt16 i = 0; @@ -276,7 +277,7 @@ bool MenuBarMerger::ProcessMergeOperation( sal_uInt16 nPos, sal_uInt16& nItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const OUString& rModuleIdentifier, const AddonMenuContainer& rAddonMenuItems ) { diff --git a/framework/source/uielement/statusbarmerger.cxx b/framework/source/uielement/statusbarmerger.cxx index 38e266009aca..c8e6633be9f0 100644 --- a/framework/source/uielement/statusbarmerger.cxx +++ b/framework/source/uielement/statusbarmerger.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include +#include using com::sun::star::beans::PropertyValue; using com::sun::star::uno::Sequence; @@ -135,9 +136,9 @@ bool lcl_ReplaceItem( StatusBar* pStatusbar, bool lcl_RemoveItems( StatusBar* pStatusbar, sal_uInt16 nPos, - const OUString& rMergeCommandParameter ) + std::u16string_view rMergeCommandParameter ) { - sal_Int32 nCount = rMergeCommandParameter.toInt32(); + sal_Int32 nCount = o3tl::toInt32(rMergeCommandParameter); if ( nCount > 0 ) { for ( sal_Int32 i = 0; i < nCount; i++ ) @@ -190,7 +191,7 @@ bool StatusbarMerger::ProcessMergeOperation( sal_uInt16 nPos, sal_uInt16& rItemId, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonStatusbarItemContainer& rItems ) { if ( rMergeCommand == MERGECOMMAND_ADDAFTER ) diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index 9e434f672c2d..2657873c3b22 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -33,6 +33,7 @@ #include #include #include +#include namespace framework { @@ -307,7 +308,7 @@ bool ToolBarMerger::ProcessMergeOperation( CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, - const OUString& rMergeCommandParameter, + std::u16string_view rMergeCommandParameter, const AddonToolbarItemContainer& rItems ) { if ( rMergeCommand == MERGECOMMAND_ADDAFTER ) @@ -544,9 +545,9 @@ void ToolBarMerger::ReplaceItem( void ToolBarMerger::RemoveItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - const OUString& rMergeCommandParameter ) + std::u16string_view rMergeCommandParameter ) { - sal_Int32 nCount = rMergeCommandParameter.toInt32(); + sal_Int32 nCount = o3tl::toInt32(rMergeCommandParameter); if ( nCount > 0 ) { for ( sal_Int32 i = 0; i < nCount; i++ ) diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index f61ccc8ec235..7d881dd37de3 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -85,9 +86,9 @@ static const KnownTagSet & getKnowns() namespace { struct compareIgnoreAsciiCaseLess { - bool operator()( const OUString& r1, std::u16string_view r2 ) const + bool operator()( std::u16string_view r1, std::u16string_view r2 ) const { - return r1.compareToIgnoreAsciiCase( r2) < 0; + return o3tl::compareToIgnoreAsciiCase(r1, r2) < 0; } }; typedef ::std::map< OUString, LanguageTag::ImplPtr, compareIgnoreAsciiCaseLess > MapBcp47; diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx index 5693a83338f5..6b21dd77ddbb 100644 --- a/include/comphelper/stl_types.hxx +++ b/include/comphelper/stl_types.hxx @@ -27,6 +27,7 @@ #include #include +#include namespace com::sun::star::uno { template class Reference; } @@ -40,12 +41,12 @@ struct UStringMixLess bool m_bCaseSensitive; public: UStringMixLess(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){} - bool operator() (const OUString& x, std::u16string_view y) const + bool operator() (std::u16string_view x, std::u16string_view y) const { if (m_bCaseSensitive) - return x.compareTo(y) < 0; + return x < y; else - return x.compareToIgnoreAsciiCase(y) < 0; + return o3tl::compareToIgnoreAsciiCase(x, y) < 0; } bool isCaseSensitive() const {return m_bCaseSensitive;} @@ -57,9 +58,9 @@ class UStringMixEqual public: UStringMixEqual(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){} - bool operator() (const OUString& lhs, std::u16string_view rhs) const + bool operator() (std::u16string_view lhs, std::u16string_view rhs) const { - return m_bCaseSensitive ? lhs == rhs : lhs.equalsIgnoreAsciiCase( rhs ); + return m_bCaseSensitive ? lhs == rhs : o3tl::equalsIgnoreAsciiCase( lhs, rhs ); } bool isCaseSensitive() const {return m_bCaseSensitive;} }; diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx index 9cb09fc89597..10cbb1562d23 100644 --- a/include/comphelper/storagehelper.hxx +++ b/include/comphelper/storagehelper.hxx @@ -186,10 +186,10 @@ public: static css::uno::Reference< css::embed::XStorage > GetStorageAtPath( const css::uno::Reference< css::embed::XStorage > &xStorage, - const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ); + std::u16string_view aPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ); static css::uno::Reference< css::io::XStream > GetStreamAtPath( const css::uno::Reference< css::embed::XStorage > &xStorage, - const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ); + std::u16string_view aPath, sal_uInt32 nOpenMode, LifecycleProxy const &rNastiness ); static css::uno::Reference< css::io::XStream > GetStreamAtPackageURL( const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString& rURL, sal_uInt32 const nOpenMode, diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index 4197b456214c..0a4027256d2a 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -44,9 +45,9 @@ namespace tools { template class SvRef; } struct CompareSvStringsISortDtor { - bool operator()( OUString const& lhs, std::u16string_view rhs ) const + bool operator()( std::u16string_view lhs, std::u16string_view rhs ) const { - return lhs.compareToIgnoreAsciiCase( rhs ) < 0; + return o3tl::compareToIgnoreAsciiCase( lhs, rhs ) < 0; } }; diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx index 92fd502683ea..36de22f54e67 100644 --- a/include/framework/sfxhelperfunctions.hxx +++ b/include/framework/sfxhelperfunctions.hxx @@ -59,11 +59,11 @@ typedef void ( *pfunc_getRefreshToolbars)( typedef void ( *pfunc_createDockingWindow)( const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& rResourceURL ); + std::u16string_view rResourceURL ); typedef bool ( *pfunc_isDockingWindowVisible)( const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& rResourceURL ); + std::u16string_view rResourceURL ); namespace framework @@ -96,12 +96,12 @@ FWK_DLLPUBLIC void RefreshToolbars( FWK_DLLPUBLIC pfunc_createDockingWindow SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow ); FWK_DLLPUBLIC void CreateDockingWindow( const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& rResourceURL ); + std::u16string_view rResourceURL ); FWK_DLLPUBLIC pfunc_isDockingWindowVisible SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible ); FWK_DLLPUBLIC bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& rResourceURL ); + std::u16string_view rResourceURL ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/jvmaccess/classpath.hxx b/include/jvmaccess/classpath.hxx index 80da5cb3c36a..416b64a3335d 100644 --- a/include/jvmaccess/classpath.hxx +++ b/include/jvmaccess/classpath.hxx @@ -78,7 +78,7 @@ namespace ClassPath */ JVMACCESS_DLLPUBLIC jobjectArray translateToUrls(css::uno::Reference const& context, - JNIEnv* environment, OUString const& classPath); + JNIEnv* environment, std::u16string_view classPath); } } diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx index f32ca388d07b..9ce382ece7b9 100644 --- a/include/oox/dump/dumperbase.hxx +++ b/include/oox/dump/dumperbase.hxx @@ -320,26 +320,26 @@ public: static void appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx ); - static OUString getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP ); + static std::u16string_view getToken( std::u16string_view rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP ); /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */ static void enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' ); // string conversion ------------------------------------------------------ - static OUString trimSpaces( const OUString& rStr ); + static std::u16string_view trimSpaces( std::u16string_view rStr ); static OUString trimTrailingNul( const OUString& rStr ); static OString convertToUtf8( std::u16string_view rStr ); static DataType convertToDataType( std::u16string_view rStr ); static FormatType convertToFormatType( std::u16string_view rStr ); - static bool convertFromDec( sal_Int64& ornData, const OUString& rData ); - static bool convertFromHex( sal_Int64& ornData, const OUString& rData ); + static bool convertFromDec( sal_Int64& ornData, std::u16string_view rData ); + static bool convertFromHex( sal_Int64& ornData, std::u16string_view rData ); - static bool convertStringToInt( sal_Int64& ornData, const OUString& rData ); - static bool convertStringToDouble( double& orfData, const OUString& rData ); - static bool convertStringToBool( const OUString& rData ); + static bool convertStringToInt( sal_Int64& ornData, std::u16string_view rData ); + static bool convertStringToDouble( double& orfData, std::u16string_view rData ); + static bool convertStringToBool( std::u16string_view rData ); static OUStringPair convertStringToPair( const OUString& rString, sal_Unicode cSep = '=' ); diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index efb3de7779cf..511b00fce2a2 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -60,13 +60,13 @@ public: static OUString decodeXString( const OUString& rValue ); /** Returns the 32-bit signed integer value from the passed string (decimal). */ - static sal_Int32 decodeInteger( const OUString& rValue ); + static sal_Int32 decodeInteger( std::u16string_view rValue ); /** Returns the 32-bit unsigned integer value from the passed string (decimal). */ - static sal_uInt32 decodeUnsigned( const OUString& rValue ); + static sal_uInt32 decodeUnsigned( std::u16string_view rValue ); /** Returns the 64-bit signed integer value from the passed string (decimal). */ - static sal_Int64 decodeHyper( const OUString& rValue ); + static sal_Int64 decodeHyper( std::u16string_view rValue ); /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */ static sal_Int32 decodeIntegerHex( const OUString& rValue ); diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx index 216a10c6d1d2..f4fd7b6a7deb 100644 --- a/include/oox/ole/axcontrol.hxx +++ b/include/oox/ole/axcontrol.hxx @@ -909,7 +909,7 @@ public: /** Creates and returns the internal control model according to the passed MS class identifier. */ - ControlModelBase* createModelFromGuid( const OUString& rClassId ); + ControlModelBase* createModelFromGuid( std::u16string_view rClassId ); /** Returns true, if the internal control model exists. */ bool hasModel() const { return bool(mxModel); } diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx index d0b772506815..f15642760f3d 100644 --- a/include/oox/ole/olehelper.hxx +++ b/include/oox/ole/olehelper.hxx @@ -175,7 +175,7 @@ protected: bool importControlFromStream( ::oox::BinaryInputStream& rInStrm, css::uno::Reference< css::form::XFormComponent > & rxFormComp, - const OUString& rGuidString ); + std::u16string_view rGuidString ); bool importControlFromStream( ::oox::BinaryInputStream& rInStrm, css::uno::Reference< css::form::XFormComponent > & rxFormComp, const OUString& rGuidString, diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx index 5d7004ef59e0..ce838297cdf0 100644 --- a/include/oox/vml/vmlshapecontext.hxx +++ b/include/oox/vml/vmlshapecontext.hxx @@ -128,7 +128,7 @@ public: private: /** Processes the 'points' attribute. */ - void setPoints( const OUString& rPoints ); + void setPoints( std::u16string_view rPoints ); /** Processes the 'from' attribute. */ void setFrom( const OUString& rPoints ); /** Processes the 'to' attribute. */ diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx index f3ec43c109bb..884112530c90 100644 --- a/include/sfx2/docfac.hxx +++ b/include/sfx2/docfac.hxx @@ -63,7 +63,7 @@ public: // Filter std::shared_ptr GetTemplateFilter() const; - static OUString GetStandardTemplate( const OUString& rServiceName ); + static OUString GetStandardTemplate( std::u16string_view rServiceName ); static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName ); static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName ); diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index a3b350deebe5..fb5bb55051fd 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -107,7 +107,7 @@ public: const OUString& GetServiceName() const { return aServiceName; } const OUString& GetProviderName() const { return maProvider;} - static std::shared_ptr GetDefaultFilter( const OUString& rName ); + static std::shared_ptr GetDefaultFilter( std::u16string_view rName ); static std::shared_ptr GetFilterByName( const OUString& rName ); static std::shared_ptr GetDefaultFilterFromFactory( const OUString& rServiceName ); diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx index 21fe9d6e1e84..886f4ae11f86 100644 --- a/include/sfx2/dockwin.hxx +++ b/include/sfx2/dockwin.hxx @@ -34,8 +34,8 @@ namespace com::sun::star::frame { class XFrame; } class SfxDockingWindow_Impl; enum class SplitWindowItemFlags; -void SfxDockingWindowFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); -bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); +void SfxDockingWindowFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName ); +bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName ); class SFX2_DLLPUBLIC SfxDockingWindow : public ResizableDockingWindow { diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx index 68403c5755d8..026f0e1c1bf3 100644 --- a/include/sfx2/fcontnr.hxx +++ b/include/sfx2/fcontnr.hxx @@ -61,7 +61,7 @@ public: const css::uno::Reference< css::container::XNameAccess >& xTypeCFG, const css::uno::Reference< css::container::XNameAccess >& xFilterCFG, bool bUpdate ); - SAL_DLLPRIVATE static std::shared_ptr GetDefaultFilter_Impl( const OUString& ); + SAL_DLLPRIVATE static std::shared_ptr GetDefaultFilter_Impl( std::u16string_view ); }; class SfxFilterMatcher_Impl; diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index ca45b081cf5a..525c23583170 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -405,7 +405,7 @@ class SVT_DLLPUBLIC FontStyleBox public: FontStyleBox(std::unique_ptr p); - void Fill(const OUString& rName, const FontList* pList); + void Fill(std::u16string_view rName, const FontList* pList); void connect_changed(const Link& rLink) { m_xComboBox->connect_changed(rLink); } OUString get_active_text() const { return m_xComboBox->get_active_text(); } diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx index dc15f2637253..d70a49177f69 100644 --- a/include/svtools/ctrltool.hxx +++ b/include/svtools/ctrltool.hxx @@ -149,7 +149,7 @@ private: std::vector> m_Entries; SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( std::u16string_view rSearchName, sal_uInt32* pIndex ) const; - SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const; + SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( std::u16string_view rStr ) const; SVT_DLLPRIVATE void ImplInsertFonts(OutputDevice* pDev, bool bInsertData); public: @@ -174,13 +174,13 @@ public: FontWeight eWeight, FontItalic eItalic ) const; - bool IsAvailable( const OUString& rName ) const; + bool IsAvailable( std::u16string_view rName ) const; size_t GetFontNameCount() const { return m_Entries.size(); } const FontMetric& GetFontName(size_t nFont) const; - sal_Handle GetFirstFontMetric( const OUString& rName ) const; + sal_Handle GetFirstFontMetric( std::u16string_view rName ) const; static sal_Handle GetNextFontMetric( sal_Handle hFontMetric ); static const FontMetric& GetFontMetric( sal_Handle hFontMetric ); diff --git a/include/svx/fmsrcimp.hxx b/include/svx/fmsrcimp.hxx index b9ff77a1c813..fdcf12fa3195 100644 --- a/include/svx/fmsrcimp.hxx +++ b/include/svx/fmsrcimp.hxx @@ -273,7 +273,7 @@ public: FmSearchEngine( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const css::uno::Reference< css::sdbc::XResultSet >& xCursor, - const OUString& strVisibleFields, + std::u16string_view strVisibleFields, const InterfaceArray& arrFields); /** the link will be called on every record and after the completion of the search, the parameter is a pointer to @@ -306,11 +306,11 @@ public: /** only valid, if not an (asynchronous) search is running, the next search will then be executed on top of the new iterator with the new parameter */ - void SwitchToContext(const css::uno::Reference< css::sdbc::XResultSet >& xCursor, const OUString& strVisibleFields, const InterfaceArray& arrFields, + void SwitchToContext(const css::uno::Reference< css::sdbc::XResultSet >& xCursor, std::u16string_view strVisibleFields, const InterfaceArray& arrFields, sal_Int32 nFieldIndex); private: - void Init(const OUString& strVisibleFields); + void Init(std::u16string_view strVisibleFields); void SearchNextImpl(); // this Impl method is running in SearchThread diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx index 13c1ec711745..77928837d7d7 100644 --- a/include/svx/fmview.hxx +++ b/include/svx/fmview.hxx @@ -71,7 +71,7 @@ public: @deprecated This method is deprecated. Use the version with an ODataAccessDescriptor instead. */ - SdrObjectUniquePtr CreateFieldControl(const OUString& rFieldDesc) const; + SdrObjectUniquePtr CreateFieldControl(std::u16string_view rFieldDesc) const; /** create a control pair (label/bound control) for the database field description given. */ diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx index 010af4b17936..58b9e0a5c85b 100644 --- a/include/svx/ruler.hxx +++ b/include/svx/ruler.hxx @@ -218,7 +218,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener tools::Long GetLeftMin() const; tools::Long GetRightMax() const; - void TabMenuSelect(const OString& rIdent); + void TabMenuSelect(std::string_view rIdent); void MenuSelect(std::string_view ident); void PrepareProportional_Impl(RulerType); diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index 49bb9219f8a4..e161db2a71ac 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -243,7 +243,7 @@ public: virtual void AddToHdlList(SdrHdlList& rHdlList) const override; // #i33136# - static bool doConstructOrthogonal(const OUString& rName); + static bool doConstructOrthogonal(std::u16string_view rName); using SdrTextObj::NbcSetOutlinerParaObject; diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx index 961d34c0886c..afb06bc652a1 100644 --- a/include/unotools/datetime.hxx +++ b/include/unotools/datetime.hxx @@ -49,7 +49,7 @@ namespace utl UNOTOOLS_DLLPUBLIC OUString toISO8601(const css::util::DateTime& _rDateTime); UNOTOOLS_DLLPUBLIC bool ISO8601parseDateTime(const OUString &i_rIn, css::util::DateTime& o_rDateTime); - UNOTOOLS_DLLPUBLIC bool ISO8601parseDate(const OUString &i_rIn, css::util::Date& o_rDate); + UNOTOOLS_DLLPUBLIC bool ISO8601parseDate(std::u16string_view i_rIn, css::util::Date& o_rDate); UNOTOOLS_DLLPUBLIC bool ISO8601parseTime(std::u16string_view i_rIn, css::util::Time& o_Time); } // namespace utl diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index 8ca9167a0add..2b77e8d94d30 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -173,7 +173,7 @@ public: static const std::vector< LanguageType > & getInstalledLanguageTypes(); /// maps the LocaleData string to the International enum - MeasurementSystem mapMeasurementStringToEnum( const OUString& rMS ) const; + MeasurementSystem mapMeasurementStringToEnum( std::u16string_view rMS ) const; /// Convenience method to obtain the default calendar. const std::shared_ptr< css::i18n::Calendar2 >& getDefaultCalendar() const; diff --git a/include/unotools/moduleoptions.hxx b/include/unotools/moduleoptions.hxx index b5051fb1ecf7..8aa9860ceb1a 100644 --- a/include/unotools/moduleoptions.hxx +++ b/include/unotools/moduleoptions.hxx @@ -113,7 +113,7 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtModuleOptions final : public utl::de /** @short return the corresponding application ID for the given short name. */ - static EFactory ClassifyFactoryByShortName(const OUString& sName); + static EFactory ClassifyFactoryByShortName(std::u16string_view sName); /** @short return the corresponding application ID for the given properties. diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 2d2f071e7d71..e420d4dc61ce 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -367,7 +367,7 @@ public: static ErrCode readPDF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType); static ErrCode readTIFF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType); - static ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName); + static ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, std::u16string_view aFilterName); static ErrCode readBMP(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType); static ErrCode readTGA(SvStream & rStream, Graphic & rGraphic); static ErrCode readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType); diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index 71661908fd86..03d79f2e3497 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -176,7 +176,7 @@ public: void SetMaxOutputSizePixel( const Size& rSize ); const Size& GetMaxOutputSizePixel() const; - void SetWindowState(const OString& rStr); + void SetWindowState(std::string_view rStr); OString GetWindowState(WindowStateMask nMask = WindowStateMask::All) const; void SetMenuBar(MenuBar* pMenuBar); diff --git a/include/vcl/toolkit/combobox.hxx b/include/vcl/toolkit/combobox.hxx index 143c2989e42d..bdc415744662 100644 --- a/include/vcl/toolkit/combobox.hxx +++ b/include/vcl/toolkit/combobox.hxx @@ -127,7 +127,7 @@ public: Size CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const; void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const; - void SetMRUEntries( const OUString& rEntries ); + void SetMRUEntries( std::u16string_view rEntries ); OUString GetMRUEntries() const; void SetMaxMRUCount( sal_Int32 n ); sal_Int32 GetMaxMRUCount() const; diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index b4b8fd2715a5..5d54cb1a0078 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -46,7 +46,7 @@ private: OUString aCurEntry; protected: - static OUString GetToken( const OUString &sStr, sal_Int32 &nIndex ); + static std::u16string_view GetToken( std::u16string_view sStr, sal_Int32 &nIndex ); virtual void SetTabs() override; virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&) override; diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 4ce1cf44a388..5ad39489f2cb 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1397,7 +1397,7 @@ public: * * @return false if attribute is unknown */ - bool set_font_attribute(const OString &rKey, const OUString &rValue); + bool set_font_attribute(const OString &rKey, std::u16string_view rValue); /* * Adds this widget to the xGroup VclSizeGroup diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index 38216a073107..3d1f48ddf888 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -72,7 +72,7 @@ private: SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, bool bGrouping, const SvNumberformat& rFormat, sal_uInt16 nPart ); SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const OUString& rString, - const OUString& rExt ); + std::u16string_view rExt ); SAL_DLLPRIVATE void WriteBooleanElement_Impl(); SAL_DLLPRIVATE void WriteTextContentElement_Impl(); SAL_DLLPRIVATE void WriteDayElement_Impl( const OUString& rCalendar, bool bLong ); diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx index b4d0ef3d6bfa..95915196bad9 100644 --- a/jvmaccess/source/classpath.cxx +++ b/jvmaccess/source/classpath.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -41,7 +42,7 @@ namespace com::sun::star::uno { class XComponentContext; } jobjectArray jvmaccess::ClassPath::translateToUrls( css::uno::Reference< css::uno::XComponentContext > const & context, - JNIEnv * environment, OUString const & classPath) + JNIEnv * environment, std::u16string_view classPath) { assert(context.is()); assert(environment != nullptr); @@ -56,7 +57,7 @@ jobjectArray jvmaccess::ClassPath::translateToUrls( } ::std::vector< jobject > urls; for (::sal_Int32 i = 0; i != -1;) { - OUString url(classPath.getToken(0, ' ', i)); + OUString url(o3tl::getToken(classPath, 0, ' ', i)); if (!url.isEmpty()) { css::uno::Reference< css::uri::XVndSunStarExpandUrlReference > expUrl( diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 743db3a9ce13..f7d786007544 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -113,7 +114,7 @@ static bool getSDKInfoFromRegistry(std::vector & vecHome); static bool getJREInfoFromRegistry(std::vector& vecJavaHome); #endif -static bool decodeOutput(const OString& s, OUString* out); +static bool decodeOutput(std::string_view s, OUString* out); namespace @@ -482,22 +483,22 @@ bool getJavaProps(const OUString & exePath, readable strings. The strings are encoded as integer values separated by spaces. */ -bool decodeOutput(const OString& s, OUString* out) +bool decodeOutput(std::string_view s, OUString* out) { OSL_ASSERT(out != nullptr); OUStringBuffer buff(512); sal_Int32 nIndex = 0; do { - OString aToken = s.getToken( 0, ' ', nIndex ); - if (!aToken.isEmpty()) + std::string_view aToken = o3tl::getToken(s, 0, ' ', nIndex ); + if (!aToken.empty()) { - for (sal_Int32 i = 0; i < aToken.getLength(); ++i) + for (size_t i = 0; i < aToken.size(); ++i) { if (aToken[i] < '0' || aToken[i] > '9') return false; } - sal_Unicode value = static_cast(aToken.toInt32()); + sal_Unicode value = static_cast(o3tl::toInt32(aToken)); buff.append(value); } } while (nIndex >= 0); diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx index 3a6c2cc27be5..7b60e4ff231b 100644 --- a/l10ntools/inc/lngmerge.hxx +++ b/l10ntools/inc/lngmerge.hxx @@ -45,7 +45,7 @@ private: std::vector aLanguages; static bool isNextGroup(OString &sGroup_out, std::string_view sLine_in); - static void ReadLine(const OString &rLine_in, + static void ReadLine(std::string_view rLine_in, OStringHashMap &rText_inout); static void WritePO(PoOfstream &aPOStream, OStringHashMap &rText_inout, const OString &rActFileName, const OString &rID); @@ -55,7 +55,7 @@ public: void CreatePO( const OString &rPOFile ); void Merge(const OString &rPOFile, const OString &rDestinationFile, - const OString &rLanguage ); + std::string_view rLanguage ); }; #endif // INCLUDED_L10NTOOLS_INC_LNGMERGE_HXX diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 31bf50fc9126..33d928dbe539 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -134,14 +134,14 @@ bool LngParser::isNextGroup(OString &sGroup_out, std::string_view sLine_in) return lcl_isNextGroup(sGroup_out, o3tl::trim(sLine_in)); } -void LngParser::ReadLine(const OString &rLine_in, +void LngParser::ReadLine(std::string_view rLine_in, OStringHashMap &rText_inout) { - if (!rLine_in.match(" *") && !rLine_in.match("/*")) + if (!o3tl::starts_with(rLine_in, " *") && !o3tl::starts_with(rLine_in, "/*")) { OString sLang(o3tl::trim(o3tl::getToken(rLine_in, 0, '='))); if (!sLang.isEmpty()) { - OString sText(rLine_in.getToken(1, '"')); + OString sText(o3tl::getToken(rLine_in,1, '"')); rText_inout[sLang] = sText; } } @@ -150,13 +150,13 @@ void LngParser::ReadLine(const OString &rLine_in, void LngParser::Merge( const OString &rPOFile, const OString &rDestinationFile, - const OString &rLanguage ) + std::string_view rLanguage ) { std::ofstream aDestination( rDestinationFile.getStr(), std::ios_base::out | std::ios_base::trunc); MergeDataFile aMergeDataFile( rPOFile, sSource, false, true ); - if( rLanguage.equalsIgnoreAsciiCase("ALL") ) + if( o3tl::equalsIgnoreAsciiCase(rLanguage, "ALL") ) aLanguages = aMergeDataFile.GetLanguages(); size_t nPos = 0; diff --git a/oox/inc/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/drawingml/chart/chartdrawingfragment.hxx index 1613b5ee2d5b..af5b16145633 100644 --- a/oox/inc/drawingml/chart/chartdrawingfragment.hxx +++ b/oox/inc/drawingml/chart/chartdrawingfragment.hxx @@ -56,7 +56,7 @@ public: /** Imports the absolute anchor size from the cdr:ext element. */ void importExt( const AttributeList& rAttribs ); /** Sets the relative anchor position from the cdr:from or cdr:to element. */ - void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ); + void setPos( sal_Int32 nElement, sal_Int32 nParentContext, std::u16string_view rValue ); /** Calculates the resulting shape anchor in EMUs. */ EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const; diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index c346a63db1f6..c2609a8227d8 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -214,7 +214,7 @@ uno::Sequence< OUString > OOXMLDocPropHandler::GetKeywordsSet( std::u16string_vi return uno::Sequence< OUString >(); } -void OOXMLDocPropHandler::UpdateDocStatistic( const OUString& aChars ) +void OOXMLDocPropHandler::UpdateDocStatistic( std::u16string_view aChars ) { uno::Sequence< beans::NamedValue > aSet = m_xDocProp->getDocumentStatistics(); OUString aName; @@ -257,7 +257,7 @@ void OOXMLDocPropHandler::UpdateDocStatistic( const OUString& aChars ) if (nInd == aSet.getLength()) aSet.realloc( nInd + 1 ); - aSet.getArray()[nInd] = { aName, uno::Any(aChars.toInt32()) }; + aSet.getArray()[nInd] = { aName, uno::Any(o3tl::toInt32(aChars)) }; m_xDocProp->setDocumentStatistics( aSet ); } diff --git a/oox/source/docprop/docprophandler.hxx b/oox/source/docprop/docprophandler.hxx index c7e902634543..69e091850348 100644 --- a/oox/source/docprop/docprophandler.hxx +++ b/oox/source/docprop/docprophandler.hxx @@ -60,7 +60,7 @@ public: static css::util::DateTime GetDateTimeFromW3CDTF( const OUString& aChars ); static css::uno::Sequence< OUString > GetKeywordsSet( std::u16string_view aChars ); - void UpdateDocStatistic( const OUString& aChars ); + void UpdateDocStatistic( std::u16string_view aChars ); // com.sun.star.xml.sax.XFastDocumentHandler diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx b/oox/source/drawingml/chart/chartdrawingfragment.cxx index 9509ad4ea01e..b9977c933b6b 100644 --- a/oox/source/drawingml/chart/chartdrawingfragment.cxx +++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx @@ -31,6 +31,7 @@ #include #include #include +#include namespace oox::drawingml::chart { @@ -51,7 +52,7 @@ void ShapeAnchor::importExt( const AttributeList& rAttribs ) maSize.Height = rAttribs.getHyper( XML_cy, 0 ); } -void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) +void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, std::u16string_view rValue ) { AnchorPosModel* pAnchorPos = nullptr; switch( nParentContext ) @@ -68,8 +69,8 @@ void ShapeAnchor::setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OU } if( pAnchorPos ) switch( nElement ) { - case CDR_TOKEN( x ): pAnchorPos->mfX = rValue.toDouble(); break; - case CDR_TOKEN( y ): pAnchorPos->mfY = rValue.toDouble(); break; + case CDR_TOKEN( x ): pAnchorPos->mfX = o3tl::toDouble(rValue); break; + case CDR_TOKEN( y ): pAnchorPos->mfY = o3tl::toDouble(rValue); break; default: OSL_FAIL( "ShapeAnchor::setPos - unexpected element" ); } } diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index f54cd4a2ca68..2f508382cdc9 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -449,7 +450,7 @@ GeomGuideListContext::GeomGuideListContext( ContextHandler2Helper const & rParen { } -static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperties, const OUString& rSource ) +static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperties, std::u16string_view rSource ) { if ( !pCommandHashMap ) { @@ -463,7 +464,7 @@ static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperti sal_Int32 nIndex = 0; do { - OUString aToken( rSource.getToken( 0, ' ', nIndex ) ); + OUString aToken( o3tl::getToken(rSource, 0, ' ', nIndex ) ); if ( !aToken.isEmpty() ) aTokens.push_back( aToken ); } diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 2f7d7edc7815..092ab09ff319 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -526,9 +526,9 @@ void StringHelper::appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx ) rStr.append( '[' ).append( aToken.makeStringAndClear() ).append( ']' ); } -OUString StringHelper::getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep ) +std::u16string_view StringHelper::getToken( std::u16string_view rData, sal_Int32& rnPos, sal_Unicode cSep ) { - return trimSpaces( rData.getToken( 0, cSep, rnPos ) ); + return trimSpaces( o3tl::getToken(rData, 0, cSep, rnPos ) ); } void StringHelper::enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose ) @@ -599,15 +599,15 @@ OUString lclTrimQuotedStringList( const OUString& rStr ) } // namespace -OUString StringHelper::trimSpaces( const OUString& rStr ) +std::u16string_view StringHelper::trimSpaces( std::u16string_view rStr ) { - sal_Int32 nBeg = 0; - while( (nBeg < rStr.getLength()) && ((rStr[ nBeg ] == ' ') || (rStr[ nBeg ] == '\t')) ) + size_t nBeg = 0; + while( (nBeg < rStr.size()) && ((rStr[ nBeg ] == ' ') || (rStr[ nBeg ] == '\t')) ) ++nBeg; - sal_Int32 nEnd = rStr.getLength(); + size_t nEnd = rStr.size(); while( (nEnd > nBeg) && ((rStr[ nEnd - 1 ] == ' ') || (rStr[ nEnd - 1 ] == '\t')) ) --nEnd; - return rStr.copy( nBeg, nEnd - nBeg ); + return rStr.substr( nBeg, nEnd - nBeg ); } OUString StringHelper::trimTrailingNul( const OUString& rStr ) @@ -667,10 +667,10 @@ FormatType StringHelper::convertToFormatType( std::u16string_view rStr ) return eType; } -bool StringHelper::convertFromDec( sal_Int64& ornData, const OUString& rData ) +bool StringHelper::convertFromDec( sal_Int64& ornData, std::u16string_view rData ) { - sal_Int32 nPos = 0; - sal_Int32 nLen = rData.getLength(); + size_t nPos = 0; + size_t nLen = rData.size(); bool bNeg = false; if( (nLen > 0) && (rData[ 0 ] == '-') ) { @@ -690,10 +690,10 @@ bool StringHelper::convertFromDec( sal_Int64& ornData, const OUString& rData ) return true; } -bool StringHelper::convertFromHex( sal_Int64& ornData, const OUString& rData ) +bool StringHelper::convertFromHex( sal_Int64& ornData, std::u16string_view rData ) { ornData = 0; - for( sal_Int32 nPos = 0, nLen = rData.getLength(); nPos < nLen; ++nPos ) + for( size_t nPos = 0, nLen = rData.size(); nPos < nLen; ++nPos ) { sal_Unicode cChar = rData[ nPos ]; if( ('0' <= cChar) && (cChar <= '9') ) @@ -709,26 +709,32 @@ bool StringHelper::convertFromHex( sal_Int64& ornData, const OUString& rData ) return true; } -bool StringHelper::convertStringToInt( sal_Int64& ornData, const OUString& rData ) +bool StringHelper::convertStringToInt( sal_Int64& ornData, std::u16string_view rData ) { - if( (rData.getLength() > 2) && (rData[ 0 ] == '0') && ((rData[ 1 ] == 'X') || (rData[ 1 ] == 'x')) ) - return convertFromHex( ornData, rData.copy( 2 ) ); + if( (rData.size() > 2) && (rData[ 0 ] == '0') && ((rData[ 1 ] == 'X') || (rData[ 1 ] == 'x')) ) + return convertFromHex( ornData, rData.substr( 2 ) ); return convertFromDec( ornData, rData ); } -bool StringHelper::convertStringToDouble( double& orfData, const OUString& rData ) +bool StringHelper::convertStringToDouble( double& orfData, std::u16string_view rData ) { rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; sal_Int32 nSize = 0; - orfData = rtl::math::stringToDouble( rData, '.', '\0', &eStatus, &nSize ); - return (eStatus == rtl_math_ConversionStatus_Ok) && (nSize == rData.getLength()); + sal_Unicode const * pBegin = rData.data(); + sal_Unicode const * pEnd; + orfData = rtl_math_uStringToDouble(pBegin, + pBegin + rData.size(), + '.', '\0', + &eStatus, &pEnd); + nSize = static_cast(pEnd - pBegin); + return (eStatus == rtl_math_ConversionStatus_Ok) && (nSize == static_cast(rData.size())); } -bool StringHelper::convertStringToBool( const OUString& rData ) +bool StringHelper::convertStringToBool( std::u16string_view rData ) { - if ( rData == "true" ) + if ( rData == u"true" ) return true; - if ( rData == "false" ) + if ( rData == u"false" ) return false; sal_Int64 nData; return convertStringToInt( nData, rData ) && (nData != 0); @@ -746,8 +752,8 @@ OUStringPair StringHelper::convertStringToPair( const OUString& rString, sal_Uni } else { - aPair.first = StringHelper::trimSpaces( rString.copy( 0, nEqPos ) ); - aPair.second = StringHelper::trimSpaces( rString.copy( nEqPos + 1 ) ); + aPair.first = StringHelper::trimSpaces( rString.subView( 0, nEqPos ) ); + aPair.second = StringHelper::trimSpaces( rString.subView( nEqPos + 1 ) ); } } return aPair; @@ -761,9 +767,9 @@ void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUStr sal_Int32 nLen = aUnquotedData.getLength(); while( (0 <= nPos) && (nPos < nLen) ) { - OUString aToken = getToken( aUnquotedData, nPos, OOX_DUMP_LF ); - if( !bIgnoreEmpty || !aToken.isEmpty() ) - orVec.push_back( aToken ); + std::u16string_view aToken = getToken( aUnquotedData, nPos, OOX_DUMP_LF ); + if( !bIgnoreEmpty || !aToken.empty() ) + orVec.push_back( OUString(aToken) ); } } diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index a566069c3a2e..6afab21c33d8 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -105,19 +105,19 @@ OUString AttributeConversion::decodeXString( const OUString& rValue ) return aBuffer.makeStringAndClear(); } -sal_Int32 AttributeConversion::decodeInteger( const OUString& rValue ) +sal_Int32 AttributeConversion::decodeInteger( std::u16string_view rValue ) { - return rValue.toInt32(); + return o3tl::toInt32(rValue); } -sal_uInt32 AttributeConversion::decodeUnsigned( const OUString& rValue ) +sal_uInt32 AttributeConversion::decodeUnsigned( std::u16string_view rValue ) { - return getLimitedValue< sal_uInt32, sal_Int64 >( rValue.toInt64(), 0, SAL_MAX_UINT32 ); + return getLimitedValue< sal_uInt32, sal_Int64 >( o3tl::toInt64(rValue), 0, SAL_MAX_UINT32 ); } -sal_Int64 AttributeConversion::decodeHyper( const OUString& rValue ) +sal_Int64 AttributeConversion::decodeHyper( std::u16string_view rValue ) { - return rValue.toInt64(); + return o3tl::toInt64(rValue); } sal_Int32 AttributeConversion::decodeIntegerHex( const OUString& rValue ) diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index b8415111d38c..d2ec8b9b95ef 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -2659,23 +2659,23 @@ EmbeddedControl::EmbeddedControl( const OUString& rName ) : { } -ControlModelBase* EmbeddedControl::createModelFromGuid( const OUString& rClassId ) -{ - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_COMMANDBUTTON ) ) return &createModel< AxCommandButtonModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_LABEL ) ) return &createModel< AxLabelModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_IMAGE ) ) return &createModel< AxImageModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_TOGGLEBUTTON ) ) return &createModel< AxToggleButtonModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_CHECKBOX ) ) return &createModel< AxCheckBoxModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_OPTIONBUTTON ) ) return &createModel< AxOptionButtonModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_TEXTBOX ) ) return &createModel< AxTextBoxModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_LISTBOX ) ) return &createModel< AxListBoxModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_COMBOBOX ) ) return &createModel< AxComboBoxModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_SPINBUTTON ) ) return &createModel< AxSpinButtonModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >(); - if( rClassId.equalsIgnoreAsciiCase( AX_GUID_FRAME ) ) return &createModel< AxFrameModel >(); - if( rClassId.equalsIgnoreAsciiCase( COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 ); - if( rClassId.equalsIgnoreAsciiCase( HTML_GUID_SELECT ) ) return &createModel< HtmlSelectModel >(); - if( rClassId.equalsIgnoreAsciiCase( HTML_GUID_TEXTBOX ) ) return &createModel< HtmlTextBoxModel >(); +ControlModelBase* EmbeddedControl::createModelFromGuid( std::u16string_view rClassId ) +{ + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_COMMANDBUTTON ) ) return &createModel< AxCommandButtonModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_LABEL ) ) return &createModel< AxLabelModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_IMAGE ) ) return &createModel< AxImageModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_TOGGLEBUTTON ) ) return &createModel< AxToggleButtonModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_CHECKBOX ) ) return &createModel< AxCheckBoxModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_OPTIONBUTTON ) ) return &createModel< AxOptionButtonModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_TEXTBOX ) ) return &createModel< AxTextBoxModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_LISTBOX ) ) return &createModel< AxListBoxModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_COMBOBOX ) ) return &createModel< AxComboBoxModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_SPINBUTTON ) ) return &createModel< AxSpinButtonModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_FRAME ) ) return &createModel< AxFrameModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 ); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" HTML_GUID_SELECT ) ) return &createModel< HtmlSelectModel >(); + if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" HTML_GUID_TEXTBOX ) ) return &createModel< HtmlTextBoxModel >(); mxModel.reset(); return nullptr; diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index 0a50bc23327c..16b38919a213 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -421,7 +421,7 @@ MSConvertOCXControls::~MSConvertOCXControls() } bool -MSConvertOCXControls::importControlFromStream( ::oox::BinaryInputStream& rInStrm, Reference< XFormComponent >& rxFormComp, const OUString& rGuidString ) +MSConvertOCXControls::importControlFromStream( ::oox::BinaryInputStream& rInStrm, Reference< XFormComponent >& rxFormComp, std::u16string_view rGuidString ) { ::oox::ole::EmbeddedControl aControl( "Unknown" ); if( ::oox::ole::ControlModelBase* pModel = aControl.createModelFromGuid( rGuidString ) ) diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index a4d87bb0e9c9..9b489ce9b351 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -591,7 +591,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const Attri return ShapeTypeContext::onCreateContext( nElement, rAttribs ); } -void ShapeContext::setPoints(const OUString& rPoints) +void ShapeContext::setPoints(std::u16string_view rPoints) { mrShapeModel.maPoints.clear(); sal_Int32 nIndex = 0; @@ -599,10 +599,10 @@ void ShapeContext::setPoints(const OUString& rPoints) while (nIndex >= 0) { sal_Int32 nX = ConversionHelper::decodeMeasureToTwip( - mrShape.getDrawing().getFilter().getGraphicHelper(), rPoints.getToken(0, ',', nIndex), + mrShape.getDrawing().getFilter().getGraphicHelper(), OUString(o3tl::getToken(rPoints, 0, ',', nIndex)), 0, true, true); sal_Int32 nY = ConversionHelper::decodeMeasureToTwip( - mrShape.getDrawing().getFilter().getGraphicHelper(), rPoints.getToken(0, ',', nIndex), + mrShape.getDrawing().getFilter().getGraphicHelper(), OUString(o3tl::getToken(rPoints, 0, ',', nIndex)), 0, false, true); mrShapeModel.maPoints.emplace_back(nX, nY); } diff --git a/opencl/source/openclconfig.cxx b/opencl/source/openclconfig.cxx index 0c3597620d8e..a2b69c175cbf 100644 --- a/opencl/source/openclconfig.cxx +++ b/opencl/source/openclconfig.cxx @@ -69,27 +69,27 @@ css::uno::Sequence SetOfImplMatcherToStringSequence(const OpenCLConfig return result; } -OUString getToken(const OUString& string, sal_Int32& index) +OUString getToken(std::u16string_view string, sal_Int32& index) { - OUString token(string.getToken(0, '/', index)); + std::u16string_view token(o3tl::getToken(string, 0, '/', index)); OUStringBuffer result; sal_Int32 i(0); - sal_Int32 p; - while ((p = token.indexOf('%', i)) >= 0) + size_t p; + while ((p = token.find('%', i)) != std::u16string_view::npos) { - if (p > i) - result.append(token.subView(i, p - i)); - if (p < token.getLength() - 2) + if (static_cast(p) > i) + result.append(token.substr(i, p - i)); + if (p < token.size() - 2) { - result.append(sal_Unicode(o3tl::toInt32(token.subView(p+1, 2), 16))); + result.append(sal_Unicode(o3tl::toInt32(token.substr(p+1, 2), 16))); i = p + 3; } else { - i = token.getLength(); + i = token.size(); } } - result.append(token.subView(i)); + result.append(token.substr(i)); return result.makeStringAndClear(); } diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 55348f08547c..209136bcdf36 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include "ohierarchyholder.hxx" @@ -58,13 +59,13 @@ void OHierarchyHolder_Impl::RemoveStreamHierarchically( std::vector& a } // static -std::vector OHierarchyHolder_Impl::GetListPathFromString( const OUString& aPath ) +std::vector OHierarchyHolder_Impl::GetListPathFromString( std::u16string_view aPath ) { std::vector aResult; sal_Int32 nIndex = 0; do { - OUString aName = aPath.getToken( 0, '/', nIndex ); + OUString aName( o3tl::getToken(aPath, 0, '/', nIndex ) ); if ( aName.isEmpty() ) throw lang::IllegalArgumentException(); diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index e124d545d9a2..6f32b3f404f2 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -99,7 +99,7 @@ public: , m_xChild( new OHierarchyElement_Impl( css::uno::WeakReference< css::embed::XStorage >( xOwnStorage ) ) ) {} - static std::vector GetListPathFromString( const OUString& aPath ); + static std::vector GetListPathFromString( std::u16string_view aPath ); css::uno::Reference< css::embed::XExtendedStorageStream > GetStreamHierarchically( sal_Int32 nStorageMode, diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 46a4ad91c849..efbc697b4ca4 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -40,7 +40,7 @@ public: ScRangeList& operator=(const ScRangeList& rList); ScRangeList& operator=(ScRangeList&& rList) noexcept; - ScRefFlags Parse( const OUString&, const ScDocument&, + ScRefFlags Parse( std::u16string_view, const ScDocument&, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab = 0, sal_Unicode cDelimiter = 0 ); diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 4d6bf06f155d..fb880d308c89 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -88,11 +89,11 @@ ScRangeList::~ScRangeList() { } -ScRefFlags ScRangeList::Parse( const OUString& rStr, const ScDocument& rDoc, +ScRefFlags ScRangeList::Parse( std::u16string_view rStr, const ScDocument& rDoc, formula::FormulaGrammar::AddressConvention eConv, SCTAB nDefaultTab, sal_Unicode cDelimiter ) { - if ( !rStr.isEmpty() ) + if ( !rStr.empty() ) { if (!cDelimiter) cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep); @@ -104,7 +105,7 @@ ScRefFlags ScRangeList::Parse( const OUString& rStr, const ScDocument& rDoc, sal_Int32 nPos = 0; do { - const OUString aOne = rStr.getToken( 0, cDelimiter, nPos ); + const OUString aOne( o3tl::getToken(rStr, 0, cDelimiter, nPos ) ); aRange.aStart.SetTab( nTab ); // default tab if not specified ScRefFlags nRes = aRange.ParseAny( aOne, rDoc, eConv ); ScRefFlags nEndRangeBits = ScRefFlags::COL2_VALID | ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID; diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index cde4344b50e5..06439a8ab75d 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -55,6 +55,7 @@ #include #include #include +#include using namespace ::oox; @@ -2032,7 +2033,7 @@ void XclExpDval::WriteBody( XclExpStream& rStrm ) XclExpWebQuery::XclExpWebQuery( const OUString& rRangeName, const OUString& rUrl, - const OUString& rSource, + std::u16string_view rSource, sal_Int32 nRefrSecs ) : maDestRange( rRangeName ), maUrl( rUrl ), @@ -2044,12 +2045,12 @@ XclExpWebQuery::XclExpWebQuery( OUString aNewTables; OUString aAppendTable; bool bExitLoop = false; - if (!rSource.isEmpty()) + if (!rSource.empty()) { sal_Int32 nStringIx = 0; do { - OUString aToken( rSource.getToken( 0, ';', nStringIx ) ); + OUString aToken( o3tl::getToken(rSource, 0, ';', nStringIx ) ); mbEntireDoc = ScfTools::IsHTMLDocName( aToken ); bExitLoop = mbEntireDoc || ScfTools::IsHTMLTablesName( aToken ); if( !bExitLoop && ScfTools::GetHTMLNameFromName( aToken, aAppendTable ) ) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index c556b51ec602..dee145ae384f 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -77,6 +77,7 @@ #include #include #include +#include using ::std::vector; using namespace ::com::sun::star; @@ -1603,8 +1604,8 @@ namespace { /** Functor for case-insensitive string comparison, usable in maps etc. */ struct IgnoreCaseCompare { - bool operator()( const OUString& rName1, std::u16string_view rName2 ) const - { return rName1.compareToIgnoreAsciiCase( rName2 ) < 0; } + bool operator()( std::u16string_view rName1, std::u16string_view rName2 ) const + { return o3tl::compareToIgnoreAsciiCase( rName1, rName2 ) < 0; } }; } // namespace diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 9605dc7a46f7..5c219e3c3d3a 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -318,14 +319,14 @@ OUString ScfTools::GetNameFromHTMLName( std::u16string_view rTabName ) return GetHTMLNamePrefix() + rTabName; } -bool ScfTools::IsHTMLDocName( const OUString& rSource ) +bool ScfTools::IsHTMLDocName( std::u16string_view rSource ) { - return rSource.equalsIgnoreAsciiCase( GetHTMLDocName() ); + return o3tl::equalsIgnoreAsciiCase( rSource, GetHTMLDocName() ); } -bool ScfTools::IsHTMLTablesName( const OUString& rSource ) +bool ScfTools::IsHTMLTablesName( std::u16string_view rSource ) { - return rSource.equalsIgnoreAsciiCase( GetHTMLTablesName() ); + return o3tl::equalsIgnoreAsciiCase( rSource, GetHTMLTablesName() ); } bool ScfTools::GetHTMLNameFromName( const OUString& rSource, OUString& rName ) diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index cb88c0c658ca..12e98a9ef018 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -199,9 +200,9 @@ OUString ScFormatFilterPluginImpl::GetHTMLRangeNameList( ScDocument& rDoc, const return ScHTMLImport::GetHTMLRangeNameList( rDoc, rOrigName ); } -OUString ScHTMLImport::GetHTMLRangeNameList( const ScDocument& rDoc, const OUString& rOrigName ) +OUString ScHTMLImport::GetHTMLRangeNameList( const ScDocument& rDoc, std::u16string_view rOrigName ) { - if (rOrigName.isEmpty()) + if (rOrigName.empty()) return OUString(); OUString aNewName; @@ -210,7 +211,7 @@ OUString ScHTMLImport::GetHTMLRangeNameList( const ScDocument& rDoc, const OUStr sal_Int32 nStringIx = 0; do { - OUString aToken( rOrigName.getToken( 0, ';', nStringIx ) ); + OUString aToken( o3tl::getToken(rOrigName, 0, ';', nStringIx ) ); if( pRangeNames && ScfTools::IsHTMLTablesName( aToken ) ) { // build list with all HTML tables sal_uLong nIndex = 1; diff --git a/sc/source/filter/inc/drawingbase.hxx b/sc/source/filter/inc/drawingbase.hxx index 7ced93b73a99..576a3619db1e 100644 --- a/sc/source/filter/inc/drawingbase.hxx +++ b/sc/source/filter/inc/drawingbase.hxx @@ -88,7 +88,7 @@ public: /** Imports the shape client data from the xdr:clientData element. */ void importClientData( const AttributeList& rAttribs ); /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */ - void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ); + void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, std::u16string_view rValue ); /** Imports the client anchor settings from a VML element. */ void importVmlAnchor( std::u16string_view rAnchor ); diff --git a/sc/source/filter/inc/formulabase.hxx b/sc/source/filter/inc/formulabase.hxx index cb01e9a6fee0..aa0643f5a81d 100644 --- a/sc/source/filter/inc/formulabase.hxx +++ b/sc/source/filter/inc/formulabase.hxx @@ -553,7 +553,7 @@ public: /** Returns the library type associated with the passed URL of a function library (function add-in). */ - static FunctionLibraryType getFuncLibTypeFromLibraryName( const OUString& rLibraryName ); + static FunctionLibraryType getFuncLibTypeFromLibraryName( std::u16string_view rLibraryName ); protected: /** Returns the list of all function infos. */ diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index caeeef4598c6..1366a5197511 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -232,9 +232,9 @@ public: static OUString GetNameFromHTMLName( std::u16string_view rTabName ); /** Returns true, if rSource is the built-in range name for an HTML document. */ - static bool IsHTMLDocName( const OUString& rSource ); + static bool IsHTMLDocName( std::u16string_view rSource ); /** Returns true, if rSource is the built-in range name for all HTML tables. */ - static bool IsHTMLTablesName( const OUString& rSource ); + static bool IsHTMLTablesName( std::u16string_view rSource ); /** Converts a built-in range name to an HTML table name. @param rSource The string to be determined. @param rName The HTML table name. diff --git a/sc/source/filter/inc/htmlimp.hxx b/sc/source/filter/inc/htmlimp.hxx index 46dfcc1fc6cd..76acc44718b0 100644 --- a/sc/source/filter/inc/htmlimp.hxx +++ b/sc/source/filter/inc/htmlimp.hxx @@ -32,7 +32,7 @@ public: virtual void WriteToDocument( bool bSizeColsRows = false, double nOutputFactor = 1.0, SvNumberFormatter* pFormatter = nullptr, bool bConvertDate = true ) override; - static OUString GetHTMLRangeNameList( const ScDocument& rDoc, const OUString& rOrigName ); + static OUString GetHTMLRangeNameList( const ScDocument& rDoc, std::u16string_view rOrigName ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index d6d04007d39c..0234c50252ff 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -62,7 +62,7 @@ class ExcelFilter; /** Functor for case-insensitive string comparison, usable in maps etc. */ struct IgnoreCaseCompare { - bool operator()( const OUString& rName1, std::u16string_view rName2 ) const; + bool operator()( std::u16string_view rName1, std::u16string_view rName2 ) const; }; class AddressConverter; diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx index 578816c5203b..6eb4c77de494 100644 --- a/sc/source/filter/inc/xecontent.hxx +++ b/sc/source/filter/inc/xecontent.hxx @@ -391,7 +391,7 @@ public: explicit XclExpWebQuery( const OUString& rRangeName, const OUString& rUrl, - const OUString& rSource, + std::u16string_view rSource, sal_Int32 nRefrSecs ); virtual ~XclExpWebQuery() override; diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx index dbde579be303..0f1ee8690c35 100644 --- a/sc/source/filter/oox/drawingbase.cxx +++ b/sc/source/filter/oox/drawingbase.cxx @@ -123,7 +123,7 @@ void ShapeAnchor::importClientData( const AttributeList& rAttribs ) maClientData.mbPrintsWithSheet = rAttribs.getBool( XML_fPrintsWithSheet, true ); } -void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) +void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, std::u16string_view rValue ) { CellAnchorModel* pCellAnchor = nullptr; switch( nParentContext ) @@ -141,10 +141,10 @@ void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, cons } if( pCellAnchor ) switch( nElement ) { - case XDR_TOKEN( col ): pCellAnchor->mnCol = rValue.toInt32(); break; - case XDR_TOKEN( row ): pCellAnchor->mnRow = rValue.toInt32(); break; - case XDR_TOKEN( colOff ): pCellAnchor->mnColOffset = rValue.toInt64(); break; - case XDR_TOKEN( rowOff ): pCellAnchor->mnRowOffset = rValue.toInt64(); break; + case XDR_TOKEN( col ): pCellAnchor->mnCol = o3tl::toInt32(rValue); break; + case XDR_TOKEN( row ): pCellAnchor->mnRow = o3tl::toInt32(rValue); break; + case XDR_TOKEN( colOff ): pCellAnchor->mnColOffset = o3tl::toInt64(rValue); break; + case XDR_TOKEN( rowOff ): pCellAnchor->mnRowOffset = o3tl::toInt64(rValue); break; default: OSL_ENSURE( false, "ShapeAnchor::setCellPos - unexpected element" ); } } diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 2dcc513f21a9..f12f0f0402cd 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -44,6 +44,7 @@ #include #include #include +#include namespace { @@ -1098,11 +1099,11 @@ const FunctionInfo* FunctionProvider::getFuncInfoFromMacroName( const OUString& return mxFuncImpl->maMacroFuncs.get( rFuncName ).get(); } -FunctionLibraryType FunctionProvider::getFuncLibTypeFromLibraryName( const OUString& rLibraryName ) +FunctionLibraryType FunctionProvider::getFuncLibTypeFromLibraryName( std::u16string_view rLibraryName ) { // the EUROTOOL add-in containing the EUROCONVERT function - if( rLibraryName.equalsIgnoreAsciiCase("EUROTOOL.XLA") - || rLibraryName.equalsIgnoreAsciiCase("EUROTOOL.XLAM")) + if( o3tl::equalsIgnoreAsciiCase(rLibraryName, u"EUROTOOL.XLA") + || o3tl::equalsIgnoreAsciiCase(rLibraryName, u"EUROTOOL.XLAM")) return FUNCLIB_EUROTOOL; // default: unknown library diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 322986e9ba25..1f07567f1672 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -74,6 +74,7 @@ #include #include #include +#include #include #include @@ -93,10 +94,10 @@ using ::oox::core::FilterBase; using ::oox::core::FragmentHandler; using ::oox::core::XmlFilterBase; -bool IgnoreCaseCompare::operator()( const OUString& rName1, std::u16string_view rName2 ) const +bool IgnoreCaseCompare::operator()( std::u16string_view rName1, std::u16string_view rName2 ) const { // TODO: compare with collator - return rName1.compareToIgnoreAsciiCase(rName2 ) < 0; + return o3tl::compareToIgnoreAsciiCase(rName1, rName2 ) < 0; } class WorkbookGlobals diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx index 6fab95c1d383..31c7fbb5a4b3 100644 --- a/sc/source/filter/xml/xmlsorti.cxx +++ b/sc/source/filter/xml/xmlsorti.cxx @@ -26,6 +26,7 @@ #include #include +#include #include @@ -162,10 +163,10 @@ void SAL_CALL ScXMLSortContext::endFastElement( sal_Int32 /*nElement*/ ) pDatabaseRangeContext->SetSortSequence(aSortDescriptor); } -void ScXMLSortContext::AddSortField(const OUString& sFieldNumber, const OUString& sDataType, std::u16string_view sOrder) +void ScXMLSortContext::AddSortField(std::u16string_view sFieldNumber, const OUString& sDataType, std::u16string_view sOrder) { util::SortField aSortField; - aSortField.Field = sFieldNumber.toInt32(); + aSortField.Field = o3tl::toInt32(sFieldNumber); if (IsXMLToken(sOrder, XML_ASCENDING)) aSortField.SortAscending = true; else diff --git a/sc/source/filter/xml/xmlsorti.hxx b/sc/source/filter/xml/xmlsorti.hxx index 9087bb15d894..5b927f2d5b8c 100644 --- a/sc/source/filter/xml/xmlsorti.hxx +++ b/sc/source/filter/xml/xmlsorti.hxx @@ -56,7 +56,7 @@ public: virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; - void AddSortField(const OUString& sFieldNumber, const OUString& sDataType, std::u16string_view sOrder); + void AddSortField(std::u16string_view sFieldNumber, const OUString& sDataType, std::u16string_view sOrder); }; class ScXMLSortByContext : public ScXMLImportContext diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 4a2689242465..d1e3f3dda7f8 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -23,8 +23,8 @@ #include #include -const char pStrFix[] = "FIX"; -const char pStrMrg[] = "MRG"; +constexpr std::u16string_view pStrFix = u"FIX"; +constexpr std::u16string_view pStrMrg = u"MRG"; ScAsciiOptions::ScAsciiOptions() : bFixedLen ( false ), @@ -57,21 +57,21 @@ void ScAsciiOptions::SetColumnInfo( const ScCsvExpDataVec& rDataVec ) } } -static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeFieldSeps ) +static OUString lcl_decodeSepString( std::u16string_view rSepNums, bool & o_bMergeFieldSeps ) { - if ( rSepNums.isEmpty() ) + if ( rSepNums.empty() ) return OUString(); OUStringBuffer aFieldSeps; sal_Int32 nPos = 0; do { - const OUString aCode = rSepNums.getToken( 0, '/', nPos ); + const std::u16string_view aCode = o3tl::getToken(rSepNums, 0, '/', nPos ); if ( aCode == pStrMrg ) o_bMergeFieldSeps = true; else { - sal_Int32 nVal = aCode.toInt32(); + sal_Int32 nVal = o3tl::toInt32(aCode); if ( nVal ) aFieldSeps.append(sal_Unicode(nVal)); } @@ -84,16 +84,16 @@ static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeF // The options string must not contain semicolons (because of the pick list), // use comma as separator. -void ScAsciiOptions::ReadFromString( const OUString& rString ) +void ScAsciiOptions::ReadFromString( std::u16string_view rString ) { - sal_Int32 nPos = rString.isEmpty() ? -1 : 0; + sal_Int32 nPos = rString.empty() ? -1 : 0; // Token 0: Field separator. if ( nPos >= 0 ) { bFixedLen = bMergeFieldSeps = false; - const OUString aToken = rString.getToken(0, ',', nPos); + const std::u16string_view aToken = o3tl::getToken(rString, 0, ',', nPos); if ( aToken == pStrFix ) bFixedLen = true; aFieldSeps = lcl_decodeSepString( aToken, bMergeFieldSeps); @@ -109,7 +109,7 @@ void ScAsciiOptions::ReadFromString( const OUString& rString ) // Token 2: Text encoding. if ( nPos >= 0 ) { - eCharSet = ScGlobal::GetCharsetValue( rString.getToken(0, ',', nPos) ); + eCharSet = ScGlobal::GetCharsetValue( OUString(o3tl::getToken(rString, 0, ',', nPos)) ); } // Token 3: Number of start row. @@ -121,7 +121,7 @@ void ScAsciiOptions::ReadFromString( const OUString& rString ) // Token 4: Column info. if ( nPos >= 0 ) { - const OUString aToken = rString.getToken(0, ',', nPos); + const std::u16string_view aToken = o3tl::getToken(rString, 0, ',', nPos); const sal_Int32 nInfoCount = comphelper::string::getTokenCount(aToken, '/')/2; mvColStart.resize(nInfoCount); mvColFormat.resize(nInfoCount); @@ -181,7 +181,7 @@ void ScAsciiOptions::ReadFromString( const OUString& rString ) // Does not need to be evaluated here but may be present. if (nPos >= 0) { - rString.getToken(0, ',', nPos); + o3tl::getToken(rString, 0, ',', nPos); } // Token 12: evaluate formulas. diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx index 3fbbf8f8355c..b285c6ae968e 100644 --- a/sc/source/ui/dbgui/imoptdlg.cxx +++ b/sc/source/ui/dbgui/imoptdlg.cxx @@ -30,7 +30,7 @@ const char pStrFix[] = "FIX"; // The option string can no longer contain a semicolon (because of pick list), // therefore, starting with version 336 comma instead -ScImportOptions::ScImportOptions( const OUString& rStr ) +ScImportOptions::ScImportOptions( std::u16string_view rStr ) { // Use the same string format as ScAsciiOptions, // because the import options string is passed here when a CSV file is loaded and saved again. @@ -53,13 +53,13 @@ ScImportOptions::ScImportOptions( const OUString& rStr ) sal_Int32 nIdx{ 0 }; // first 3 tokens: common - OUString aToken( rStr.getToken( 0, ',', nIdx ) ); + OUString aToken( o3tl::getToken(rStr, 0, ',', nIdx ) ); if( aToken.equalsIgnoreAsciiCase( pStrFix ) ) bFixedWidth = true; else nFieldSepCode = ScAsciiOptions::GetWeightedFieldSep( aToken, true); nTextSepCode = static_cast(o3tl::toInt32(o3tl::getToken(rStr, 0, ',', nIdx))); - aStrFont = rStr.getToken(0, ',', nIdx); + aStrFont = o3tl::getToken(rStr, 0, ',', nIdx); eCharSet = ScGlobal::GetCharsetValue(aStrFont); if ( nTokenCount == 4 ) @@ -83,7 +83,7 @@ ScImportOptions::ScImportOptions( const OUString& rStr ) bRemoveSpace = o3tl::getToken(rStr, 0, ',', nIdx) == u"true"; if ( nTokenCount >= 12 ) { - const OUString aTok(rStr.getToken(0, ',', nIdx)); + const OUString aTok(o3tl::getToken(rStr,0, ',', nIdx)); if (aTok == "-1") nSheetToExport = -1; // all else if (aTok.isEmpty() || CharClass::isAsciiNumeric(aTok)) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index b3ddd1aba250..126689d7bce8 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -110,15 +110,15 @@ CSVImportOptionsIndex getSkipEmptyCellsIndex( ScImportAsciiCall eCall ) } } -static void lcl_FillCombo(weld::ComboBox& rCombo, const OUString& rList, sal_Unicode cSelect) +static void lcl_FillCombo(weld::ComboBox& rCombo, std::u16string_view rList, sal_Unicode cSelect) { OUString aStr; - if (!rList.isEmpty()) + if (!rList.empty()) { sal_Int32 nIdx {0}; do { - const OUString sEntry {rList.getToken(0, '\t', nIdx)}; + const OUString sEntry {o3tl::getToken(rList, 0, '\t', nIdx)}; rCombo.append_text(sEntry); if (nIdx>0 && static_cast(o3tl::toInt32(o3tl::getToken(rList, 0, '\t', nIdx))) == cSelect) aStr = sEntry; @@ -135,14 +135,14 @@ static void lcl_FillCombo(weld::ComboBox& rCombo, const OUString& rList, sal_Uni } } -static sal_Unicode lcl_CharFromCombo(const weld::ComboBox& rCombo, const OUString& rList) +static sal_Unicode lcl_CharFromCombo(const weld::ComboBox& rCombo, std::u16string_view rList) { sal_Unicode c = 0; OUString aStr = rCombo.get_active_text(); - if ( !aStr.isEmpty() && !rList.isEmpty() ) + if ( !aStr.isEmpty() && !rList.empty() ) { sal_Int32 nIdx {0}; - OUString sToken {rList.getToken(0, '\t', nIdx)}; + OUString sToken {o3tl::getToken(rList, 0, '\t', nIdx)}; while (nIdx>0) { if ( ScGlobal::GetTransliteration().isEqual( aStr, sToken ) ) @@ -151,7 +151,7 @@ static sal_Unicode lcl_CharFromCombo(const weld::ComboBox& rCombo, const OUStrin c = static_cast(o3tl::toInt32(o3tl::getToken(rList, 0, '\t', nTmpIdx))); } // Skip to next token at even position - sToken = rList.getToken(1, '\t', nIdx); + sToken = o3tl::getToken(rList, 1, '\t', nIdx); } if (!c) { diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 4840e3e2810e..d194fdc1070e 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -288,15 +289,15 @@ ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos ) @descr Keeps all empty strings. Example: abc\ndef\n\nghi -> "abc";"def";"";"ghi". @param rFmlaStr (out-param) The converted formula string. */ -void lclGetFormulaFromStringList( OUString& rFmlaStr, const OUString& rStringList, sal_Unicode cFmlaSep ) +void lclGetFormulaFromStringList( OUString& rFmlaStr, std::u16string_view rStringList, sal_Unicode cFmlaSep ) { rFmlaStr.clear(); - if (!rStringList.isEmpty()) + if (!rStringList.empty()) { sal_Int32 nIdx {0}; do { - OUString aToken {rStringList.getToken( 0, '\n', nIdx )}; + OUString aToken {o3tl::getToken(rStringList, 0, '\n', nIdx )}; ScGlobal::AddQuotes( aToken, '"' ); rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep); } diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 55f3a2b2929f..9109974a8295 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -53,9 +53,9 @@ public: ~ScFormulaReferenceHelper() COVERITY_NOEXCEPT_FALSE; void dispose(); - void ShowSimpleReference(const OUString& rStr); + void ShowSimpleReference(std::u16string_view rStr); void ShowFormulaReference(const OUString& rStr); - bool ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& rDoc ); + bool ParseWithNames( ScRangeList& rRanges, std::u16string_view rStr, const ScDocument& rDoc ); void Init(); void ShowReference(const OUString& rStr); @@ -99,7 +99,7 @@ protected: virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = nullptr ) override; virtual void RefInputDone( bool bForced = false ) override; - bool ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& pDoc ); + bool ParseWithNames( ScRangeList& rRanges, std::u16string_view rStr, const ScDocument& pDoc ); public: ScRefHandler(SfxDialogController &rController, SfxBindings* pB, bool bBindRef); diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx index 86e83ee89f78..c1b9c33d6ce3 100644 --- a/sc/source/ui/inc/asciiopt.hxx +++ b/sc/source/ui/inc/asciiopt.hxx @@ -50,7 +50,7 @@ public: static const sal_Unicode cDefaultTextSep = '"'; - void ReadFromString( const OUString& rString ); + void ReadFromString( std::u16string_view rString ); OUString WriteToString() const; rtl_TextEncoding GetCharSet() const { return eCharSet; } diff --git a/sc/source/ui/inc/imoptdlg.hxx b/sc/source/ui/inc/imoptdlg.hxx index fad5b4bf15f7..2ffe9f4df77a 100644 --- a/sc/source/ui/inc/imoptdlg.hxx +++ b/sc/source/ui/inc/imoptdlg.hxx @@ -26,7 +26,7 @@ class SC_DLLPUBLIC ScImportOptions { public: - ScImportOptions( const OUString& rStr ); + ScImportOptions( std::u16string_view rStr ); ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, rtl_TextEncoding nEnc ) : nFieldSepCode(nFieldSep), nTextSepCode(nTextSep), diff --git a/sc/source/ui/inc/linkarea.hxx b/sc/source/ui/inc/linkarea.hxx index 54829050f984..a209d3b8a39f 100644 --- a/sc/source/ui/inc/linkarea.hxx +++ b/sc/source/ui/inc/linkarea.hxx @@ -59,7 +59,7 @@ public: virtual ~ScLinkedAreaDlg() override; void InitFromOldLink( const OUString& rFile, const OUString& rFilter, - const OUString& rOptions, const OUString& rSource, + const OUString& rOptions, std::u16string_view rSource, sal_Int32 nRefreshDelaySeconds ); OUString GetURL() const; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 957dab0efcda..15fba84d2f25 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -170,7 +170,7 @@ private: SfxShell* GetMySubShell() const; - void DoReadUserData( const OUString& rData ); + void DoReadUserData( std::u16string_view rData ); void DoReadUserDataSequence( const css::uno::Sequence< css::beans::PropertyValue >& rSettings ); bool IsSignatureLineSelected(); bool IsSignatureLineSigned(); diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 9906071f28ac..76c65bf46a59 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -370,7 +370,7 @@ public: void UpdateInputHandler( bool bForce = false ); void WriteUserData(OUString& rData); - void ReadUserData(const OUString& rData); + void ReadUserData(std::u16string_view rData); void WriteExtOptions( ScExtDocOptions& rOpt ) const; void ReadExtOptions( const ScExtDocOptions& rOpt ); void WriteUserDataSequence(css::uno::Sequence & rSettings) const; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 20b2d7318df4..0ffad93cfe25 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -108,7 +109,7 @@ void ScFormulaReferenceHelper::enableInput( bool bEnable ) } } -void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr) +void ScFormulaReferenceHelper::ShowSimpleReference(std::u16string_view rStr) { if (!m_bEnableColorRef) return; @@ -137,11 +138,11 @@ void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr) } } -bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& rDoc ) +bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, std::u16string_view rStr, const ScDocument& rDoc ) { rRanges.RemoveAll(); - if (rStr.isEmpty()) + if (rStr.empty()) return true; ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0); @@ -151,7 +152,7 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUStr do { ScRange aRange; - OUString aRangeStr( rStr.getToken( 0, ';', nIdx ) ); + OUString aRangeStr( o3tl::getToken(rStr, 0, ';', nIdx ) ); ScRefFlags nFlags = aRange.ParseAny( aRangeStr, rDoc, aDetails ); if ( nFlags & ScRefFlags::VALID ) @@ -755,7 +756,7 @@ void ScRefHandler::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* m_aHelper.ToggleCollapsed( pEdit, pButton ); } -bool ScRefHandler::ParseWithNames( ScRangeList& rRanges, const OUString& rStr, const ScDocument& rDoc ) +bool ScRefHandler::ParseWithNames( ScRangeList& rRanges, std::u16string_view rStr, const ScDocument& rDoc ) { return m_aHelper.ParseWithNames( rRanges, rStr, rDoc ); } diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 0294752a5b1e..09cfe6c3c285 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -135,7 +136,7 @@ void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilt } void ScLinkedAreaDlg::InitFromOldLink( const OUString& rFile, const OUString& rFilter, - const OUString& rOptions, const OUString& rSource, + const OUString& rOptions, std::u16string_view rSource, sal_Int32 nRefreshDelaySeconds ) { LoadDocument( rFile, rFilter, rOptions ); @@ -149,12 +150,12 @@ void ScLinkedAreaDlg::InitFromOldLink( const OUString& rFile, const OUString& rF UpdateSourceRanges(); - if (!rSource.isEmpty()) + if (!rSource.empty()) { sal_Int32 nIdx {0}; do { - m_xLbRanges->select_text(rSource.getToken(0, ';', nIdx)); + m_xLbRanges->select_text(OUString(o3tl::getToken(rSource, 0, ';', nIdx))); } while (nIdx>0); } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 068178d9dd07..c424c687ecee 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1146,7 +1146,7 @@ public: } bool -ScVbaRange::getCellRangesForAddress( ScRefFlags& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter ) +ScVbaRange::getCellRangesForAddress( ScRefFlags& rResFlags, std::u16string_view sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter ) { if ( pDocSh ) diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx index 2e9b71746879..b32cc1ba3a5d 100644 --- a/sc/source/ui/vba/vbarange.hxx +++ b/sc/source/ui/vba/vbarange.hxx @@ -306,7 +306,7 @@ public: // * we shouldn't need hacks like this below /// @throws css::uno::RuntimeException static css::uno::Reference< ov::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ); - static bool getCellRangesForAddress(ScRefFlags &rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter ); + static bool getCellRangesForAddress(ScRefFlags &rResFlags, std::u16string_view sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter ); virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< ov::excel::XRange >& ChangingCell ) override; virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue) override; // XErrorQuery diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index e50484525fdb..1dab645a194e 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -533,7 +533,7 @@ void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::Proper // DoReadUserData is also called from ctor when switching from print preview -void ScTabViewShell::DoReadUserData( const OUString& rData ) +void ScTabViewShell::DoReadUserData( std::u16string_view rData ) { vcl::Window* pOldWin = GetActiveWin(); bool bFocus = pOldWin && pOldWin->HasFocus(); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 9b8e0a22d4bf..054305c5278f 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -3313,9 +3313,9 @@ void ScViewData::WriteUserData(OUString& rData) } } -void ScViewData::ReadUserData(const OUString& rData) +void ScViewData::ReadUserData(std::u16string_view rData) { - if (rData.isEmpty()) // empty string on "reload" + if (rData.empty()) // empty string on "reload" return; // then exit without assertion if ( comphelper::string::getTokenCount(rData, ';') <= 2 ) @@ -3329,24 +3329,24 @@ void ScViewData::ReadUserData(const OUString& rData) sal_Int32 nMainIdx {0}; sal_Int32 nIdx {0}; - OUString aZoomStr = rData.getToken(0, ';', nMainIdx); // Zoom/PageZoom/Mode + std::u16string_view aZoomStr = o3tl::getToken(rData, 0, ';', nMainIdx); // Zoom/PageZoom/Mode sal_Unicode cMode = o3tl::getToken(aZoomStr, 2, '/', nIdx)[0]; // 0 or "0"/"1" SetPagebreakMode( cMode == '1' ); // SetPagebreakMode must always be called due to CalcPPT / RecalcPixPos() // sheet may have become invalid (for instance last version): - SCTAB nNewTab = static_cast(rData.getToken(0, ';', nMainIdx).toUInt32()); + SCTAB nNewTab = static_cast(o3tl::toInt64(o3tl::getToken(rData, 0, ';', nMainIdx))); if (mrDoc.HasTable(nNewTab)) SetTabNo(nNewTab); // if available, get tab bar width: const sal_Int32 nMainIdxRef {nMainIdx}; - OUString aTabOpt = rData.getToken(0, ';', nMainIdx); + std::u16string_view aTabOpt = o3tl::getToken(rData, 0, ';', nMainIdx); - OUString aRest; - if (aTabOpt.startsWith(TAG_TABBARWIDTH, &aRest)) + std::u16string_view aRest; + if (o3tl::starts_with(aTabOpt, TAG_TABBARWIDTH, &aRest)) { - pView->SetTabBarWidth(aRest.toInt32()); + pView->SetTabBarWidth(o3tl::toInt32(aRest)); } else { @@ -3358,7 +3358,7 @@ void ScViewData::ReadUserData(const OUString& rData) SCTAB nPos = 0; while ( nMainIdx>0 ) { - aTabOpt = rData.getToken(0, ';', nMainIdx); + aTabOpt = o3tl::getToken(rData, 0, ';', nMainIdx); EnsureTabDataSize(nPos + 1); if (!maTabData[nPos]) maTabData[nPos].reset(new ScViewDataTable(&mrDoc)); diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 9cf7968fbbba..8ad1872d2c52 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -44,7 +44,7 @@ bool checkBeginWithNumber(const OUString& rStr) #define CPPUNIT_ASSERT_MOTIONPATH(expect, actual) \ assertMotionPath(expect, actual, CPPUNIT_SOURCELINE()) -static void assertMotionPath(const OUString &rStr1, const OUString &rStr2, const CppUnit::SourceLine &rSourceLine) +static void assertMotionPath(std::u16string_view rStr1, std::u16string_view rStr2, const CppUnit::SourceLine &rSourceLine) { sal_Int32 nIdx1 = 0; sal_Int32 nIdx2 = 0; @@ -55,8 +55,8 @@ static void assertMotionPath(const OUString &rStr1, const OUString &rStr2, const while(nIdx1 != -1 && nIdx2 != -1) { - OUString aToken1 = rStr1.getToken(0, ' ', nIdx1); - OUString aToken2 = rStr2.getToken(0, ' ', nIdx2); + OUString aToken1( o3tl::getToken(rStr1, 0, ' ', nIdx1) ); + OUString aToken2( o3tl::getToken(rStr2, 0, ' ', nIdx2) ); if (checkBeginWithNumber(aToken1) && checkBeginWithNumber(aToken2)) assertDoubleEquals(aToken1.toDouble(), aToken2.toDouble(), DBL_EPSILON, rSourceLine, sMessage.getStr()); @@ -1135,7 +1135,7 @@ void SdOOXMLExportTest2::testTdf111518() OUString sActual = getXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animMotion", "path"); - CPPUNIT_ASSERT_MOTIONPATH("M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E", sActual); + CPPUNIT_ASSERT_MOTIONPATH(u"M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E", sActual); } void SdOOXMLExportTest2::testTdf100387() @@ -1636,10 +1636,10 @@ void SdOOXMLExportTest2::testTdf118825() xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); - CPPUNIT_ASSERT_MOTIONPATH("M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 0.0704264795523803 -0.00370117418637049 0.0831071428571428 -0.00819047619047622 C 0.0953550597998766 -0.0125265741339082 0.107821870086751 -0.010397536991717 0.120321428571429 -0.0115555555555556 C 0.133179018681433 -0.0127467438724762 0.151318627483861 -0.0158700272533852 0.1585 0.00539682539682542 C 0.16478291361998 0.0240029898688431 0.15828642886492 0.0483806254341085 0.161392857142857 0.0698412698412698 C 0.165179286017685 0.0959996731216037 0.17453898927982 0.119735912694626 0.187142857142857 0.132634920634921 C 0.199788991845377 0.145577185161529 0.215607110490848 0.142889773028431 0.230107142857143 0.142857142857143 C 0.243821417584191 0.142826280916829 0.257716514999779 0.142685979556724 0.271142857142857 0.137777777777778 C 0.286895094567923 0.132019309914514 0.302318190711873 0.122962218306185 0.317928571428571 0.11568253968254 C 0.333496771884548 0.108422531222479 0.348787823719556 0.0990570571890929 0.363714285714286 0.0885079365079364 C 0.374930683062651 0.080580865157908 0.385357142857143 0.0693333333333332 0.396178571428571 0.0596825396825396 L 0.404785714285714 0.0410158730158729 L 0.401892857142857 0.0342222222222221 E", getXPath(pXmlDocContent, "(//p:animMotion)[1]", "path")); - CPPUNIT_ASSERT_MOTIONPATH("M 0.025 0.0571428571428571 L 0.0821428571428571 0.184126984126984 L -0.175 0.234920634920635 L -0.246428571428571 -0.0190476190476191 L -0.0821428571428573 -0.133333333333333 E", getXPath(pXmlDocContent, "(//p:animMotion)[2]", "path")); - CPPUNIT_ASSERT_MOTIONPATH("M -0.0107142857142857 0.00634920634920635 C -0.110714285714286 0.501587301587301 -0.153571428571429 -0.00634920634920635 -0.246428571428572 0.184126984126984 C -0.339285714285715 0.374603174603175 -0.296428571428572 0.514285714285714 -0.267857142857143 0.603174603174603 C -0.239285714285715 0.692063492063492 0.0607142857142858 0.590476190476191 0.0607142857142858 0.590476190476191 E", getXPath(pXmlDocContent, "(//p:animMotion)[3]", "path")); - CPPUNIT_ASSERT_MOTIONPATH("M 0.0535714285714286 -0.0444444444444444 L 0.132142857142857 -0.0444444444444444 L 0.132142857142857 -0.146031746031746 L 0.0964285714285715 -0.146031746031746 E", getXPath(pXmlDocContent, "(//p:animMotion)[4]", "path")); + CPPUNIT_ASSERT_MOTIONPATH(u"M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 0.0704264795523803 -0.00370117418637049 0.0831071428571428 -0.00819047619047622 C 0.0953550597998766 -0.0125265741339082 0.107821870086751 -0.010397536991717 0.120321428571429 -0.0115555555555556 C 0.133179018681433 -0.0127467438724762 0.151318627483861 -0.0158700272533852 0.1585 0.00539682539682542 C 0.16478291361998 0.0240029898688431 0.15828642886492 0.0483806254341085 0.161392857142857 0.0698412698412698 C 0.165179286017685 0.0959996731216037 0.17453898927982 0.119735912694626 0.187142857142857 0.132634920634921 C 0.199788991845377 0.145577185161529 0.215607110490848 0.142889773028431 0.230107142857143 0.142857142857143 C 0.243821417584191 0.142826280916829 0.257716514999779 0.142685979556724 0.271142857142857 0.137777777777778 C 0.286895094567923 0.132019309914514 0.302318190711873 0.122962218306185 0.317928571428571 0.11568253968254 C 0.333496771884548 0.108422531222479 0.348787823719556 0.0990570571890929 0.363714285714286 0.0885079365079364 C 0.374930683062651 0.080580865157908 0.385357142857143 0.0693333333333332 0.396178571428571 0.0596825396825396 L 0.404785714285714 0.0410158730158729 L 0.401892857142857 0.0342222222222221 E", getXPath(pXmlDocContent, "(//p:animMotion)[1]", "path")); + CPPUNIT_ASSERT_MOTIONPATH(u"M 0.025 0.0571428571428571 L 0.0821428571428571 0.184126984126984 L -0.175 0.234920634920635 L -0.246428571428571 -0.0190476190476191 L -0.0821428571428573 -0.133333333333333 E", getXPath(pXmlDocContent, "(//p:animMotion)[2]", "path")); + CPPUNIT_ASSERT_MOTIONPATH(u"M -0.0107142857142857 0.00634920634920635 C -0.110714285714286 0.501587301587301 -0.153571428571429 -0.00634920634920635 -0.246428571428572 0.184126984126984 C -0.339285714285715 0.374603174603175 -0.296428571428572 0.514285714285714 -0.267857142857143 0.603174603174603 C -0.239285714285715 0.692063492063492 0.0607142857142858 0.590476190476191 0.0607142857142858 0.590476190476191 E", getXPath(pXmlDocContent, "(//p:animMotion)[3]", "path")); + CPPUNIT_ASSERT_MOTIONPATH(u"M 0.0535714285714286 -0.0444444444444444 L 0.132142857142857 -0.0444444444444444 L 0.132142857142857 -0.146031746031746 L 0.0964285714285715 -0.146031746031746 E", getXPath(pXmlDocContent, "(//p:animMotion)[4]", "path")); xDocShRef->DoClose(); } diff --git a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx index 93b58cd04ead..ad64f5ab3924 100644 --- a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx +++ b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx @@ -17,20 +17,20 @@ #include #include #include +#include using namespace css; namespace { -std::vector lcl_convertSeparated(const OUString& rString, sal_Unicode nSeparator) +std::vector lcl_convertSeparated(std::u16string_view rString, sal_Unicode nSeparator) { std::vector aRet; sal_Int32 nIndex = 0; do { - OUString aToken = rString.getToken(0, nSeparator, nIndex); - aToken = aToken.trim(); + OUString aToken(o3tl::trim(o3tl::getToken(rString, 0, nSeparator, nIndex))); if (!aToken.isEmpty()) aRet.push_back(aToken); } while (nIndex >= 0); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 306cdbcf6b69..4207f6bbce7f 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -282,15 +283,14 @@ void SdTiledRenderingTest::callback(int nType, const char* pPayload, void* pData namespace { -std::vector lcl_convertSeparated(const OUString& rString, sal_Unicode nSeparator) +std::vector lcl_convertSeparated(std::u16string_view rString, sal_Unicode nSeparator) { std::vector aRet; sal_Int32 nIndex = 0; do { - OUString aToken = rString.getToken(0, nSeparator, nIndex); - aToken = aToken.trim(); + OUString aToken( o3tl::trim(o3tl::getToken(rString, 0, nSeparator, nIndex)) ); if (!aToken.isEmpty()) aRet.push_back(aToken); } diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 66a211bfe125..927b37ae830e 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -462,7 +462,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest const & rReq ) //we start without wizard //check whether we should load a template document - OUString aStandardTemplate( SfxObjectFactory::GetStandardTemplate( "com.sun.star.presentation.PresentationDocument" ) ); + OUString aStandardTemplate( SfxObjectFactory::GetStandardTemplate( u"com.sun.star.presentation.PresentationDocument" ) ); if( !aStandardTemplate.isEmpty() ) { diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index 28f7fff49bb8..a612163f9493 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -37,6 +37,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -524,32 +525,32 @@ OUString SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY ) return OUString::number(nX) + OUStringChar(TOKEN) + OUString::number(nY); } -bool SdTpOptionsMisc::SetScale( const OUString& aScale, sal_Int32& rX, sal_Int32& rY ) +bool SdTpOptionsMisc::SetScale( std::u16string_view aScale, sal_Int32& rX, sal_Int32& rY ) { - if (aScale.isEmpty()) + if (aScale.empty()) return false; sal_Int32 nIdx {0}; - OUString aTmp(aScale.getToken(0, TOKEN, nIdx)); + std::u16string_view aTmp(o3tl::getToken(aScale, 0, TOKEN, nIdx)); if (nIdx<0) return false; // we expect another token! if (!comphelper::string::isdigitAsciiString(aTmp)) return false; - rX = static_cast(aTmp.toInt32()); + rX = static_cast(o3tl::toInt32(aTmp)); if( rX == 0 ) return false; - aTmp = aScale.getToken(0, TOKEN, nIdx); + aTmp = o3tl::getToken(aScale, 0, TOKEN, nIdx); if (nIdx>=0) return false; // we require just 2 tokens! if (!comphelper::string::isdigitAsciiString(aTmp)) return false; - rY = static_cast(aTmp.toInt32()); + rY = static_cast(o3tl::toInt32(aTmp)); return rY != 0; } diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx index bc101dca3490..8657db27a243 100644 --- a/sd/source/ui/inc/tpoption.hxx +++ b/sd/source/ui/inc/tpoption.hxx @@ -106,7 +106,7 @@ private: std::unique_ptr m_xMtrFldInfo2; static OUString GetScale( sal_Int32 nX, sal_Int32 nY ); - static bool SetScale( const OUString& aScale, sal_Int32& rX, sal_Int32& rY ); + static bool SetScale( std::u16string_view aScale, sal_Int32& rX, sal_Int32& rY ); DECL_LINK( SelectMetricHdl_Impl, weld::ComboBox&, void ); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 51d3116bf70e..416f70ea6e46 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -2049,7 +2050,7 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void) resume(); } -void SlideshowImpl::ContextMenuSelectHdl(const OString& rMenuId) +void SlideshowImpl::ContextMenuSelectHdl(std::string_view rMenuId) { if (rMenuId == "prev") { @@ -2169,9 +2170,9 @@ void SlideshowImpl::ContextMenuSelectHdl(const OString& rMenuId) } endPresentation(); } - else if (!rMenuId.isEmpty()) + else if (!rMenuId.empty()) { - sal_Int32 nPageNumber = rMenuId.toInt32() - CM_SLIDES; + sal_Int32 nPageNumber = o3tl::toInt32(rMenuId) - CM_SLIDES; const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) { diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 33d74d60c7cc..eeec8a3fd7c5 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -242,7 +242,7 @@ private: DECL_LINK( updateHdl, Timer *, void ); DECL_LINK( ReadyForNextInputHdl, Timer *, void ); DECL_LINK( endPresentationHdl, void*, void ); - void ContextMenuSelectHdl(const OString& rIdent); + void ContextMenuSelectHdl(std::string_view rIdent); DECL_LINK( ContextMenuHdl, void*, void ); DECL_LINK( deactivateHdl, Timer *, void ); DECL_LINK( EventListenerHdl, VclSimpleEvent&, void ); diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index fbdd95c3c57d..3112c6f22959 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -707,11 +707,11 @@ void TextListenerFormattedField0Pg1::disposing( const css::lang::EventObject& /* namespace { -bool lcl_mapResolution(OUString& rResolution, const OUString& rImageResolution) +bool lcl_mapResolution(OUString& rResolution, std::u16string_view rImageResolution) { if (o3tl::getToken(rImageResolution, 1, ';')!=rResolution) return false; - rResolution = rImageResolution.getToken(0, ';'); + rResolution = o3tl::getToken(rImageResolution, 0, ';'); return true; } diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx b/sdext/source/minimizer/optimizerdialogcontrols.cxx index 92ecf16e09e1..4ab29d9694e6 100644 --- a/sdext/source/minimizer/optimizerdialogcontrols.cxx +++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx @@ -478,12 +478,12 @@ void OptimizerDialog::InitPage1() namespace { -bool lcl_getResolutionText(OUString& rResolutionText, const OUString& rImageResolution, sal_Int32 nTargetRes) +bool lcl_getResolutionText(OUString& rResolutionText, std::u16string_view rImageResolution, sal_Int32 nTargetRes) { sal_Int32 nIdx{ 0 }; if (o3tl::toInt32(o3tl::getToken(rImageResolution, 0, ';', nIdx))!=nTargetRes) return false; - rResolutionText = rImageResolution.getToken(0, ';', nIdx); + rResolutionText = o3tl::getToken(rImageResolution, 0, ';', nIdx); return true; } diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index fd2e7c2df31d..d554d8e9652d 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -137,7 +137,7 @@ OUString const & SfxFilterContainer::GetName() const return pImpl->aName; } -std::shared_ptr SfxFilterContainer::GetDefaultFilter_Impl( const OUString& rName ) +std::shared_ptr SfxFilterContainer::GetDefaultFilter_Impl( std::u16string_view rName ) { // Try to find out the type of factory. // Interpret given name as Service- and ShortName! diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index e19949b279f8..4329b2d908a4 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -320,10 +321,10 @@ static SfxWorkWindow* lcl_getWorkWindowFromXFrame( const uno::Reference< frame:: The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot range located in sfxsids.hrc (currently SID_DOCKWIN_START = 9800). */ -void SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, const OUString& rDockingWindowName ) +void SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, std::u16string_view rDockingWindowName ) { SolarMutexGuard aGuard; - sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32()); + sal_uInt16 nID = sal_uInt16(o3tl::toInt32(rDockingWindowName)); // Check the range of the provided ID otherwise nothing will happen if ( !lcl_checkDockingWindowID( nID )) @@ -345,11 +346,11 @@ void SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, con a special name. The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot range located in sfxsids.hrc (currently SID_DOCKWIN_START = 9800). */ -bool IsDockingWindowVisible( const uno::Reference< frame::XFrame >& rFrame, const OUString& rDockingWindowName ) +bool IsDockingWindowVisible( const uno::Reference< frame::XFrame >& rFrame, std::u16string_view rDockingWindowName ) { SolarMutexGuard aGuard; - sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32()); + sal_uInt16 nID = sal_uInt16(o3tl::toInt32(rDockingWindowName)); // Check the range of the provided ID otherwise nothing will happen if ( lcl_checkDockingWindowID( nID )) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 364943f832b3..6718ccd721d9 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2125,7 +2125,7 @@ void FileDialogHelper_Impl::saveConfig() } } -OUString FileDialogHelper_Impl::getInitPath(const OUString& _rFallback, +OUString FileDialogHelper_Impl::getInitPath(std::u16string_view _rFallback, const sal_Int32 _nFallbackToken) { OUString sPath; @@ -2152,7 +2152,7 @@ OUString FileDialogHelper_Impl::getInitPath(const OUString& _rFallback, } if ( sPath.isEmpty() ) - sPath = _rFallback.getToken( _nFallbackToken, ' ' ); + sPath = o3tl::getToken(_rFallback, _nFallbackToken, ' ' ); // check if the path points to a valid (accessible) directory bool bValid = false; diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 01411f23e9e4..e5910790cc01 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -205,7 +205,7 @@ namespace sfx2 OUString getFilterWithExtension( std::u16string_view rFilter ) const; void SetContext( FileDialogHelper::Context _eNewContext ); - OUString getInitPath( const OUString& _rFallback, const sal_Int32 _nFallbackToken ); + OUString getInitPath( std::u16string_view _rFallback, const sal_Int32 _nFallbackToken ); bool isAsyncFilePicker() const { return mbAsyncPicker; } bool isPasswordEnabled() const { return mbIsPwdEnabled; } diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 195fa09dd9bc..59388eece485 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -894,7 +894,7 @@ namespace sfx2 void appendFiltersForSave( TSortedFilterList& _rFilterMatcher, const Reference< XFilterManager >& _rxFilterManager, OUString& _rFirstNonEmpty, FileDialogHelper_Impl& _rFileDlgImpl, - const OUString& _rFactory ) + std::u16string_view _rFactory ) { DBG_ASSERT( _rxFilterManager.is(), "sfx2::appendFiltersForSave: invalid manager!" ); if ( !_rxFilterManager.is() ) diff --git a/sfx2/source/dialog/filtergrouping.hxx b/sfx2/source/dialog/filtergrouping.hxx index bba379f344c7..1d8a444738c1 100644 --- a/sfx2/source/dialog/filtergrouping.hxx +++ b/sfx2/source/dialog/filtergrouping.hxx @@ -54,7 +54,7 @@ namespace sfx2 const css::uno::Reference< css::ui::dialogs::XFilterManager >& _rFilterManager, OUString& /* [out] */ _rFirstNonEmpty, FileDialogHelper_Impl& _rFileDlgImpl, - const OUString& _rFactory + std::u16string_view _rFactory ); void appendExportFilters( diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 160dfce000f5..59c164501325 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -241,14 +242,14 @@ getURI(uno::Reference< uno::XComponentContext > const & i_xContext) /** would storing the file to a XStorage succeed? */ -static bool isFileNameValid(const OUString & i_rFileName) +static bool isFileNameValid(std::u16string_view i_rFileName) { - if (i_rFileName.isEmpty()) return false; + if (i_rFileName.empty()) return false; if (i_rFileName[0] == '/') return false; // no absolute paths! sal_Int32 idx(0); do { const OUString segment( - i_rFileName.getToken(0, u'/', idx) ); + o3tl::getToken(i_rFileName, 0, u'/', idx) ); if (segment.isEmpty() || // no empty segments segment == "." || // no . segments segment == ".." || // no .. segments diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index cc041670f997..481dd5a683e3 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -247,7 +247,7 @@ void SfxObjectFactory::SetStandardTemplate( const OUString& rServiceName, const } } -OUString SfxObjectFactory::GetStandardTemplate( const OUString& rServiceName ) +OUString SfxObjectFactory::GetStandardTemplate( std::u16string_view rServiceName ) { SvtModuleOptions::EFactory eFac = SvtModuleOptions::ClassifyFactoryByServiceName(rServiceName); if (eFac == SvtModuleOptions::EFactory::UNKNOWN_FACTORY) diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index 696792ff8ece..7a23a2842346 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -101,7 +101,7 @@ OUString SfxFilter::GetSuffixes() const return aRet; } -std::shared_ptr SfxFilter::GetDefaultFilter( const OUString& rName ) +std::shared_ptr SfxFilter::GetDefaultFilter( std::u16string_view rName ) { return SfxFilterContainer::GetDefaultFilter_Impl( rName ); } diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 8b49b117ef35..295b029457b7 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -258,14 +258,14 @@ class SmViewShell final : public SfxViewShell static Size GetTextLineSize(OutputDevice const & rDevice, const OUString& rLine); static Size GetTextSize(OutputDevice const & rDevice, - const OUString& rText, + std::u16string_view rText, tools::Long MaxWidth); static void DrawTextLine(OutputDevice& rDevice, const Point& rPosition, const OUString& rLine); static void DrawText(OutputDevice& rDevice, const Point& rPosition, - const OUString& rText, + std::u16string_view rText, sal_uInt16 MaxWidth); virtual SfxPrinter *GetPrinter(bool bCreate = false) override; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 4ab60033951e..cea8a3fd8abf 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include @@ -1145,17 +1146,17 @@ Size SmViewShell::GetTextLineSize(OutputDevice const & rDevice, const OUString& return aSize; } -Size SmViewShell::GetTextSize(OutputDevice const & rDevice, const OUString& rText, tools::Long MaxWidth) +Size SmViewShell::GetTextSize(OutputDevice const & rDevice, std::u16string_view rText, tools::Long MaxWidth) { Size aSize; Size aTextSize; - if (rText.isEmpty()) + if (rText.empty()) return aTextSize; sal_Int32 nPos = 0; do { - OUString aLine = rText.getToken(0, '\n', nPos); + OUString aLine( o3tl::getToken(rText, 0, '\n', nPos) ); aLine = aLine.replaceAll("\r", ""); aSize = GetTextLineSize(rDevice, aLine); @@ -1227,9 +1228,9 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co rDevice.DrawText(aPoint, rLine); } -void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const OUString& rText, sal_uInt16 MaxWidth) +void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, std::u16string_view rText, sal_uInt16 MaxWidth) { - if (rText.isEmpty()) + if (rText.empty()) return; Point aPoint(rPosition); @@ -1238,7 +1239,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const sal_Int32 nPos = 0; do { - OUString aLine = rText.getToken(0, '\n', nPos); + OUString aLine( o3tl::getToken(rText, 0, '\n', nPos) ); aLine = aLine.replaceAll("\r", ""); aSize = GetTextLineSize(rDevice, aLine); if (aSize.Width() > MaxWidth) diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx index c4709840102f..b240e9c9cbd9 100644 --- a/svl/source/misc/msodocumentlockfile.cxx +++ b/svl/source/misc/msodocumentlockfile.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -21,22 +22,23 @@ namespace svt { namespace { -bool isWordFormat(const OUString& sExt) +bool isWordFormat(std::u16string_view sExt) { - return sExt.equalsIgnoreAsciiCase("DOC") || sExt.equalsIgnoreAsciiCase("DOCX") - || sExt.equalsIgnoreAsciiCase("RTF") || sExt.equalsIgnoreAsciiCase("ODT"); + return o3tl::equalsIgnoreAsciiCase(sExt, u"DOC") || o3tl::equalsIgnoreAsciiCase(sExt, u"DOCX") + || o3tl::equalsIgnoreAsciiCase(sExt, u"RTF") + || o3tl::equalsIgnoreAsciiCase(sExt, u"ODT"); } -bool isExcelFormat(const OUString& sExt) +bool isExcelFormat(std::u16string_view sExt) { return //sExt.equalsIgnoreAsciiCase("XLS") || // MSO does not create lockfile for XLS - sExt.equalsIgnoreAsciiCase("XLSX") || sExt.equalsIgnoreAsciiCase("ODS"); + o3tl::equalsIgnoreAsciiCase(sExt, u"XLSX") || o3tl::equalsIgnoreAsciiCase(sExt, u"ODS"); } -bool isPowerPointFormat(const OUString& sExt) +bool isPowerPointFormat(std::u16string_view sExt) { - return sExt.equalsIgnoreAsciiCase("PPTX") || sExt.equalsIgnoreAsciiCase("PPT") - || sExt.equalsIgnoreAsciiCase("ODP"); + return o3tl::equalsIgnoreAsciiCase(sExt, u"PPTX") || o3tl::equalsIgnoreAsciiCase(sExt, u"PPT") + || o3tl::equalsIgnoreAsciiCase(sExt, u"ODP"); } // Need to generate different lock file name for MSO. diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 1b27be221943..d679b7c46160 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -842,7 +842,7 @@ FontStyleBox::FontStyleBox(std::unique_ptr p) m_xComboBox->set_entry_width_chars(std::ceil(nMaxLen / m_xComboBox->get_approximate_digit_width())); } -void FontStyleBox::Fill( const OUString& rName, const FontList* pList ) +void FontStyleBox::Fill( std::u16string_view rName, const FontList* pList ) { m_xComboBox->freeze(); OUString aOldText = m_xComboBox->get_active_text(); diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index d061c2773e3f..31c3c33b8004 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include // Standard fontsizes for scalable Fonts @@ -157,13 +158,13 @@ static OUString ImplMakeSearchString(const OUString& rStr) return rStr.toAsciiLowerCase(); } -static OUString ImplMakeSearchStringFromName(const OUString& rStr) +static OUString ImplMakeSearchStringFromName(std::u16string_view rStr) { // check for features before alternate font separator - if (sal_Int32 nColon = rStr.indexOf(':'); nColon != -1) - if (sal_Int32 nSemiColon = rStr.indexOf(';'); nSemiColon == -1 || nColon < nSemiColon) - return ImplMakeSearchString(rStr.getToken( 0, ':' )); - return ImplMakeSearchString(rStr.getToken( 0, ';' )); + if (size_t nColon = rStr.find(':'); nColon != std::u16string_view::npos) + if (size_t nSemiColon = rStr.find(';'); nSemiColon == std::u16string_view::npos || nColon < nSemiColon) + return ImplMakeSearchString(OUString(o3tl::getToken(rStr, 0, ':' ))); + return ImplMakeSearchString(OUString(o3tl::getToken(rStr, 0, ';' ))); } ImplFontListNameInfo* FontList::ImplFind(std::u16string_view rSearchName, sal_uInt32* pIndex) const @@ -235,7 +236,7 @@ ImplFontListNameInfo* FontList::ImplFind(std::u16string_view rSearchName, sal_uI return const_cast(pFoundData); } -ImplFontListNameInfo* FontList::ImplFindByName(const OUString& rStr) const +ImplFontListNameInfo* FontList::ImplFindByName(std::u16string_view rStr) const { OUString aSearchName = ImplMakeSearchStringFromName(rStr); return ImplFind( aSearchName, nullptr ); @@ -709,7 +710,7 @@ FontMetric FontList::Get(const OUString& rName, return aInfo; } -bool FontList::IsAvailable(const OUString& rName) const +bool FontList::IsAvailable(std::u16string_view rName) const { return (ImplFindByName( rName ) != nullptr); } @@ -721,7 +722,7 @@ const FontMetric& FontList::GetFontName(size_t const nFont) const return *(m_Entries[nFont]->mpFirst); } -sal_Handle FontList::GetFirstFontMetric(const OUString& rName) const +sal_Handle FontList::GetFirstFontMetric(std::u16string_view rName) const { ImplFontListNameInfo* pData = ImplFindByName( rName ); if ( !pData ) diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index ca680dd09bb9..98c9211efb01 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include "rlrcitem.hxx" #include @@ -3270,11 +3271,11 @@ void SvxRuler::MenuSelect(std::string_view ident) SetUnit(vcl::EnglishStringToMetric(ident)); } -void SvxRuler::TabMenuSelect(const OString& rIdent) +void SvxRuler::TabMenuSelect(std::string_view rIdent) { - if (rIdent.isEmpty()) + if (rIdent.empty()) return; - sal_Int32 nId = rIdent.toInt32(); + sal_Int32 nId = o3tl::toInt32(rIdent); /* Handler of the tab menu for setting the type */ if (mxTabStopItem && mxTabStopItem->Count() > mxRulerImpl->nIdx) { diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index ed6899c6fa9c..6ebd99c9355b 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -537,7 +538,7 @@ FmSearchEngine::SearchResult FmSearchEngine::SearchRegularApprox(const OUString& FmSearchEngine::FmSearchEngine(const Reference< XComponentContext >& _rxContext, - const Reference< XResultSet > & xCursor, const OUString& sVisibleFields, + const Reference< XResultSet > & xCursor, std::u16string_view sVisibleFields, const InterfaceArray& arrFields) :m_xSearchCursor(xCursor) ,m_aCharacterClassficator( _rxContext, SvtSysLocale().GetLanguageTag() ) @@ -629,7 +630,7 @@ void FmSearchEngine::fillControlTexts(const InterfaceArray& arrFields) } -void FmSearchEngine::Init(const OUString& sVisibleFields) +void FmSearchEngine::Init(std::u16string_view sVisibleFields) { // analyze the fields // additionally, create the mapping: because the list of used columns can be shorter than the list @@ -680,7 +681,7 @@ void FmSearchEngine::Init(const OUString& sVisibleFields) sal_Int32 nIndex = 0; do { - sCurrentField = sVisibleFields.getToken(0, ';' , nIndex); + sCurrentField = o3tl::getToken(sVisibleFields, 0, ';' , nIndex); // search in the field collection sal_Int32 nFoundIndex = -1; @@ -926,7 +927,7 @@ void FmSearchEngine::CancelSearch() } -void FmSearchEngine::SwitchToContext(const Reference< css::sdbc::XResultSet > & xCursor, const OUString& sVisibleFields, const InterfaceArray& arrFields, +void FmSearchEngine::SwitchToContext(const Reference< css::sdbc::XResultSet > & xCursor, std::u16string_view sVisibleFields, const InterfaceArray& arrFields, sal_Int32 nFieldIndex) { DBG_ASSERT(!m_bSearchingCurrently, "FmSearchEngine::SwitchToContext : please do not call while I'm searching !"); diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 0463f2e6044b..141bdc097c3b 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -383,13 +383,13 @@ SdrObjectUniquePtr FmFormView::CreateXFormsControl( const OXFormsDescriptor &_rD } -SdrObjectUniquePtr FmFormView::CreateFieldControl(const OUString& rFieldDesc) const +SdrObjectUniquePtr FmFormView::CreateFieldControl(std::u16string_view rFieldDesc) const { sal_Int32 nIdx{ 0 }; - OUString sDataSource = rFieldDesc.getToken(0, u'\x000B', nIdx); - OUString sObjectName = rFieldDesc.getToken(0, u'\x000B', nIdx); + OUString sDataSource( o3tl::getToken(rFieldDesc, 0, u'\x000B', nIdx)); + OUString sObjectName( o3tl::getToken(rFieldDesc, 0, u'\x000B', nIdx)); sal_uInt16 nObjectType = static_cast(o3tl::toInt32(o3tl::getToken(rFieldDesc, 0, u'\x000B', nIdx))); - OUString sFieldName = rFieldDesc.getToken(0, u'\x000B', nIdx); + OUString sFieldName( o3tl::getToken(rFieldDesc, 0, u'\x000B', nIdx)); if (sFieldName.isEmpty() || sObjectName.isEmpty() || sDataSource.isEmpty()) return nullptr; diff --git a/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx b/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx index 927db678da6c..5e31fd3e6341 100644 --- a/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx +++ b/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx @@ -287,16 +287,16 @@ const HandleAdjRel aHandleAdjRelArray[] { "wedgeRoundRectCallout_0", "RefX|adj1|RefY|adj2" } }; } -static sal_Int32 lcl_getAdjIndexFromToken(const sal_Int32 nTokenPos, const OUString& rMapValue) +static sal_Int32 lcl_getAdjIndexFromToken(const sal_Int32 nTokenPos, std::u16string_view rMapValue) { - OUString sAdjRef = rMapValue.getToken(nTokenPos, '|'); - OUString sNumber; // number part from "adj1", "adj2" etc. - if (sAdjRef.startsWith("adj", &sNumber)) + std::u16string_view sAdjRef = o3tl::getToken(rMapValue, nTokenPos, '|'); + std::u16string_view sNumber; // number part from "adj1", "adj2" etc. + if (o3tl::starts_with(sAdjRef, u"adj", &sNumber)) { - if (sNumber.isEmpty() || sNumber == "1") + if (sNumber.empty() || sNumber == u"1") return 0; else - return sNumber.toInt32() - 1; + return o3tl::toInt32(sNumber) - 1; } else return -1; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index a75ce4760d43..edb1dff58010 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -84,6 +84,7 @@ #include #include #include +#include #include "presetooxhandleadjustmentrelations.hxx" using namespace ::com::sun::star; @@ -3176,27 +3177,27 @@ std::unique_ptr SdrObjCustomShape::CreateObjectSpecif } // #i33136# -bool SdrObjCustomShape::doConstructOrthogonal(const OUString& rName) +bool SdrObjCustomShape::doConstructOrthogonal(std::u16string_view rName) { bool bRetval(false); - if(rName.equalsIgnoreAsciiCase("quadrat")) + if(o3tl::equalsIgnoreAsciiCase(rName, u"quadrat")) { bRetval = true; } - else if(rName.equalsIgnoreAsciiCase("round-quadrat")) + else if(o3tl::equalsIgnoreAsciiCase(rName, u"round-quadrat")) { bRetval = true; } - else if(rName.equalsIgnoreAsciiCase("circle")) + else if(o3tl::equalsIgnoreAsciiCase(rName, u"circle")) { bRetval = true; } - else if(rName.equalsIgnoreAsciiCase("circle-pie")) + else if(o3tl::equalsIgnoreAsciiCase(rName, u"circle-pie")) { bRetval = true; } - else if(rName.equalsIgnoreAsciiCase("ring")) + else if(o3tl::equalsIgnoreAsciiCase(rName, u"ring")) { bRetval = true; } diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index fcf4f128361d..07144b3e43e2 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -87,7 +87,7 @@ public: void SetDoc(SwDoc* pNewDoc) { m_pDoc = pNewDoc; } SwDoc* GetDoc(){ return m_pDoc; } void RemoveField(const SwAuthEntry* nHandle); - SwAuthEntry* AddField(const OUString& rFieldContents); + SwAuthEntry* AddField(std::u16string_view rFieldContents); void DelSequenceArray() { m_SequArr.clear(); @@ -167,7 +167,7 @@ public: //To handle Citation OUString ExpandCitation(ToxAuthorityField eField, SwRootFrame const* pLayout) const; - SwAuthorityField(SwAuthorityFieldType* pType, const OUString& rFieldContents); + SwAuthorityField(SwAuthorityFieldType* pType, std::u16string_view rFieldContents); SwAuthorityField(SwAuthorityFieldType* pType, SwAuthEntry* pAuthEntry); virtual ~SwAuthorityField() override; diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index 388dffb7ac90..437487720073 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -94,7 +94,7 @@ public: m_bIncludeHidden = true; } // for the automatic conversion (mail/news/...) - void ReadUserData( const OUString& ); + void ReadUserData( std::u16string_view ); void WriteUserData( OUString& ) const; SwAsciiOptions() { Reset(); } diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx index ff4e24e764d6..a639127d97fb 100644 --- a/sw/inc/unochart.hxx +++ b/sw/inc/unochart.hxx @@ -59,7 +59,7 @@ struct SwRangeDescriptor; class SwSelBoxes; namespace com::sun::star::table { class XCell; } -bool FillRangeDescriptor( SwRangeDescriptor &rDesc, const OUString &rCellRangeName ); +bool FillRangeDescriptor( SwRangeDescriptor &rDesc, std::u16string_view rCellRangeName ); class SwChartHelper { diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 4906dc28cdca..5d4b72ba551b 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -105,13 +105,13 @@ void SwAuthorityFieldType::RemoveField(const SwAuthEntry* pEntry) assert(false && "SwAuthorityFieldType::RemoveField: pEntry was not added previously"); } -SwAuthEntry* SwAuthorityFieldType::AddField(const OUString& rFieldContents) +SwAuthEntry* SwAuthorityFieldType::AddField(std::u16string_view rFieldContents) { rtl::Reference pEntry(new SwAuthEntry); sal_Int32 nIdx{ 0 }; for( sal_Int32 i = 0; i < AUTH_FIELD_END; ++i ) pEntry->SetAuthorField( static_cast(i), - rFieldContents.getToken( 0, TOX_STYLE_DELIMITER, nIdx )); + OUString(o3tl::getToken(rFieldContents, 0, TOX_STYLE_DELIMITER, nIdx ))); for (const auto &rpTemp : m_DataArr) { @@ -450,7 +450,7 @@ void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const } SwAuthorityField::SwAuthorityField( SwAuthorityFieldType* pInitType, - const OUString& rFieldContents ) + std::u16string_view rFieldContents ) : SwField(pInitType) , m_nTempSequencePos( -1 ) , m_nTempSequencePosRLHidden( -1 ) diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx index 0468cab1912e..90f8c59595d9 100644 --- a/sw/source/core/inc/SwXMLBlockExport.hxx +++ b/sw/source/core/inc/SwXMLBlockExport.hxx @@ -54,7 +54,7 @@ public: css::uno::Reference< css::xml::sax::XDocumentHandler> const &rHandler); ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum /*eClass*/) override { return ERRCODE_NONE; } - void exportDoc(const OUString & rText); + void exportDoc(std::u16string_view rText); void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} void ExportContent_() override {} diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index 456a4454941d..bd6458e717d0 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -90,8 +90,8 @@ public: ErrCode StartPutBlock( const OUString& rShort, const OUString& rPackageName ); ErrCode PutBlock(); ErrCode GetBlockText( std::u16string_view rShort, OUString& rText ); - ErrCode PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ); - void MakeBlockText( const OUString& rText ); + ErrCode PutBlockText( const OUString& rShort, std::u16string_view rText, const OUString& rPackageName ); + void MakeBlockText( std::u16string_view rText ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/swg/SwXMLBlockExport.cxx b/sw/source/core/swg/SwXMLBlockExport.cxx index c195c255476a..fe085a4a5183 100644 --- a/sw/source/core/swg/SwXMLBlockExport.cxx +++ b/sw/source/core/swg/SwXMLBlockExport.cxx @@ -23,6 +23,8 @@ #include #include #include +#include + using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -96,7 +98,7 @@ SwXMLTextBlockExport::SwXMLTextBlockExport( XML_NAMESPACE_TEXT ); } -void SwXMLTextBlockExport::exportDoc(const OUString &rText) +void SwXMLTextBlockExport::exportDoc(std::u16string_view rText) { GetDocHandler()->startDocument(); @@ -122,7 +124,7 @@ void SwXMLTextBlockExport::exportDoc(const OUString &rText) sal_Int32 nPos = 0; do { - OUString sTemp ( rText.getToken( 0, '\015', nPos ) ); + OUString sTemp ( o3tl::getToken(rText, 0, '\015', nPos ) ); SvXMLElementExport aPara (*this, XML_NAMESPACE_TEXT, XML_P, true, false); GetDocHandler()->characters(sTemp); } while (-1 != nPos ); diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index b6f4467981c7..9aa41c332814 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -496,7 +497,7 @@ ErrCode SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName, return nRes; } -void SwXMLTextBlocks::MakeBlockText( const OUString& rText ) +void SwXMLTextBlocks::MakeBlockText( std::u16string_view rText ) { SwTextNode* pTextNode = m_xDoc->GetNodes()[ m_xDoc->GetNodes().GetEndOfContent(). GetIndex() - 1 ]->GetTextNode(); @@ -511,7 +512,7 @@ void SwXMLTextBlocks::MakeBlockText( const OUString& rText ) pTextNode = static_cast(pTextNode->AppendNode( SwPosition( *pTextNode ) )); } SwIndex aIdx( pTextNode ); - pTextNode->InsertText( rText.getToken( 0, '\015', nPos ), aIdx ); + pTextNode->InsertText( OUString(o3tl::getToken(rText, 0, '\015', nPos )), aIdx ); } while ( -1 != nPos ); } diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 36ff82236c9e..ba610776e6c1 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -320,7 +320,7 @@ ErrCode SwXMLTextBlocks::GetBlockText( std::u16string_view rShort, OUString& rTe } ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, - const OUString& rText, const OUString& rPackageName ) + std::u16string_view rText, const OUString& rPackageName ) { GetIndex ( rShort ); /* diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 6fe9ab1e27b8..192ad33ed801 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -172,12 +173,12 @@ static void LaunchModifiedEvent( */ bool FillRangeDescriptor( SwRangeDescriptor &rDesc, - const OUString &rCellRangeName ) + std::u16string_view rCellRangeName ) { - sal_Int32 nToken = -1 == rCellRangeName.indexOf('.') ? 0 : 1; - OUString aCellRangeNoTableName( rCellRangeName.getToken( nToken, '.' ) ); - OUString aTLName( aCellRangeNoTableName.getToken(0, ':') ); // name of top left cell - OUString aBRName( aCellRangeNoTableName.getToken(1, ':') ); // name of bottom right cell + sal_Int32 nToken = std::u16string_view::npos == rCellRangeName.find('.') ? 0 : 1; + std::u16string_view aCellRangeNoTableName( o3tl::getToken(rCellRangeName, nToken, '.' ) ); + OUString aTLName( o3tl::getToken(aCellRangeNoTableName, 0, ':') ); // name of top left cell + OUString aBRName( o3tl::getToken(aCellRangeNoTableName, 1, ':') ); // name of bottom right cell if(aTLName.isEmpty() || aBRName.isEmpty()) return false; @@ -405,7 +406,7 @@ static void GetFormatAndCreateCursorFromRangeRep( } } -static bool GetSubranges( const OUString &rRangeRepresentation, +static bool GetSubranges( std::u16string_view rRangeRepresentation, uno::Sequence< OUString > &rSubRanges, bool bNormalize ) { bool bRes = true; @@ -420,7 +421,7 @@ static bool GetSubranges( const OUString &rRangeRepresentation, sal_Int32 nPos = 0; for( sal_Int32 i = 0; i < nLen && bRes; ++i ) { - const OUString aRange( rRangeRepresentation.getToken( 0, ';', nPos ) ); + const OUString aRange( o3tl::getToken(rRangeRepresentation, 0, ';', nPos ) ); if (!aRange.isEmpty()) { pRanges[nCnt] = aRange; @@ -2452,7 +2453,8 @@ void SwChartDataSequence::ExtendTo( bool bExtendCol, SwRangeDescriptor aDesc; // note that cell range here takes the newly added rows/cols already into account - FillRangeDescriptor( aDesc, aStartBox + ":" + aEndBox ); + OUString sDescrip = aStartBox + ":" + aEndBox; + FillRangeDescriptor( aDesc, sDescrip ); bool bChanged = false; OUString aNewStartCell; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 703eb3e1f2a5..486552c774f6 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1878,7 +1878,7 @@ void SAL_CALL SwXTextField::attach( SwAuthorityFieldType const type(pDoc); xField.reset(new SwAuthorityField(static_cast( pDoc->getIDocumentFieldsAccess().InsertFieldType(type)), - OUString())); + u"")); if (m_pImpl->m_pProps->aPropSeq.hasElements()) { uno::Any aVal; diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index f42ee3d5761f..acf72c41cda2 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -544,30 +544,30 @@ OUString NameFromCharSet(rtl_TextEncoding nChrSet) // 6. Whether to include hidden paragraphs and text - as true/false // the delimiter character is "," -void SwAsciiOptions::ReadUserData( const OUString& rStr ) +void SwAsciiOptions::ReadUserData( std::u16string_view rStr ) { sal_Int32 nToken = 0; - OUString sToken = rStr.getToken(0, ',', nToken); // 1. Charset name - if (!sToken.isEmpty()) - m_eCharSet = CharSetFromName(sToken); - if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 2. Line ending type + std::u16string_view sToken = o3tl::getToken(rStr, 0, ',', nToken); // 1. Charset name + if (!sToken.empty()) + m_eCharSet = CharSetFromName(OUString(sToken)); + if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 2. Line ending type { - if (sToken.equalsIgnoreAsciiCase("CRLF")) + if (o3tl::equalsIgnoreAsciiCase(sToken, u"CRLF")) m_eCRLF_Flag = LINEEND_CRLF; - else if (sToken.equalsIgnoreAsciiCase("LF")) + else if (o3tl::equalsIgnoreAsciiCase(sToken, u"LF")) m_eCRLF_Flag = LINEEND_LF; else m_eCRLF_Flag = LINEEND_CR; } - if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 3. Font name + if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 3. Font name m_sFont = sToken; - if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 4. Language tag - m_nLanguage = LanguageTag::convertToLanguageTypeWithFallback(sToken); - if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 5. Include BOM? - m_bIncludeBOM = !(sToken.equalsIgnoreAsciiCase("FALSE")); + if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 4. Language tag + m_nLanguage = LanguageTag::convertToLanguageTypeWithFallback(OUString(sToken)); + if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 5. Include BOM? + m_bIncludeBOM = !(o3tl::equalsIgnoreAsciiCase(sToken, u"FALSE")); // 6. Include hidden text - if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) - m_bIncludeHidden = !(sToken.equalsIgnoreAsciiCase("FALSE")); + if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) + m_bIncludeHidden = !(o3tl::equalsIgnoreAsciiCase(sToken, u"FALSE")); } void SwAsciiOptions::WriteUserData(OUString& rStr) const diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index 218cb300722a..ff1fbff03c93 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -500,13 +501,13 @@ bool SwHTMLParser::DoPositioning( SfxItemSet &rItemSet, return bRet; } -bool SwHTMLParser::CreateContainer( const OUString& rClass, +bool SwHTMLParser::CreateContainer( std::u16string_view rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext ) { bool bRet = false; - if( rClass.equalsIgnoreAsciiCase( "sd-abs-pos" ) && + if( o3tl::equalsIgnoreAsciiCase( rClass, u"sd-abs-pos" ) && SwCSS1Parser::MayBePositioned( rPropInfo ) ) { // Container class diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 68998cee3efe..1e8c9948b395 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -92,7 +93,7 @@ HTMLOptionEnum const aHTMLImgVAlignTable[] = { nullptr, 0 } }; -ImageMap *SwHTMLParser::FindImageMap( const OUString& rName ) const +ImageMap *SwHTMLParser::FindImageMap( std::u16string_view rName ) const { OSL_ENSURE( rName[0] != '#', "FindImageMap: name begins with '#'!" ); @@ -100,7 +101,7 @@ ImageMap *SwHTMLParser::FindImageMap( const OUString& rName ) const { for (const auto &rpIMap : *m_pImageMaps) { - if (rName.equalsIgnoreAsciiCase(rpIMap->GetName())) + if (o3tl::equalsIgnoreAsciiCase(rName, rpIMap->GetName())) { return rpIMap.get(); } diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 346e612eb19c..e89cfb616712 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -536,7 +536,7 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener bool DoPositioning( SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext ); - bool CreateContainer( const OUString& rClass, SfxItemSet &rItemSet, + bool CreateContainer( std::u16string_view rClass, SfxItemSet &rItemSet, SvxCSS1PropertyInfo &rPropInfo, HTMLAttrContext *pContext ); bool EndSection( bool bLFStripped=false ); @@ -673,7 +673,7 @@ private: // Inserting graphics, plug-ins and applets // search image maps and link with graphic nodes - ImageMap *FindImageMap( const OUString& rURL ) const; + ImageMap *FindImageMap( std::u16string_view rURL ) const; void ConnectImageMaps(); // find anchor of Fly-Frames and set corresponding attributes diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 47d4117ae052..847888dfba75 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6857,9 +6857,9 @@ namespace { /// Functor to do case-insensitive ordering of OUString instances. struct OUStringIgnoreCase { - bool operator() (const OUString& lhs, std::u16string_view rhs) const + bool operator() (std::u16string_view lhs, std::u16string_view rhs) const { - return lhs.compareToIgnoreAsciiCase(rhs) < 0; + return o3tl::compareToIgnoreAsciiCase(lhs, rhs) < 0; } }; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 46198b105021..4e448abb440e 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -439,9 +439,9 @@ namespace SwWW8 { struct ltstr { - bool operator()(const OUString &r1, std::u16string_view r2) const + bool operator()(std::u16string_view r1, std::u16string_view r2) const { - return r1.compareToIgnoreAsciiCase(r2)<0; + return o3tl::compareToIgnoreAsciiCase(r1, r2)<0; } }; }; diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index 90595da0450c..1fa9e140f712 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,7 @@ void SwChangeDBDlg::FillDBPopup() for(size_t k = 0; k < nCount; k++) { - std::unique_ptr xLast = Insert(aDBNameList[k].getToken(0, ';')); + std::unique_ptr xLast = Insert(o3tl::getToken(aDBNameList[k], 0, ';')); if (!xFirst) xFirst = std::move(xLast); } @@ -106,12 +107,12 @@ void SwChangeDBDlg::FillDBPopup() } } -std::unique_ptr SwChangeDBDlg::Insert(const OUString& rDBName) +std::unique_ptr SwChangeDBDlg::Insert(std::u16string_view rDBName) { sal_Int32 nIdx{ 0 }; - const OUString sDBName(rDBName.getToken(0, DB_DELIM, nIdx)); - const OUString sTableName(rDBName.getToken(0, DB_DELIM, nIdx)); - OUString sUserData = rDBName.getToken(0, DB_DELIM, nIdx); + const OUString sDBName(o3tl::getToken(rDBName, 0, DB_DELIM, nIdx)); + const OUString sTableName(o3tl::getToken(rDBName, 0, DB_DELIM, nIdx)); + OUString sUserData( o3tl::getToken(rDBName, 0, DB_DELIM, nIdx) ); sal_Int32 nCommandType = sUserData.toInt32(); const OUString & rToInsert ( nCommandType ? RID_BMP_DBQUERY : RID_BMP_DBTABLE ); diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index edd125cb04a3..5eadf3dc9276 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -490,7 +491,7 @@ bool SwAddressPreview::KeyInput( const KeyEvent& rKEvt ) return bHandled; } -void SwAddressPreview::DrawText_Impl(vcl::RenderContext& rRenderContext, const OUString& rAddress, +void SwAddressPreview::DrawText_Impl(vcl::RenderContext& rRenderContext, std::u16string_view rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected) { rRenderContext.SetClipRegion(vcl::Region(tools::Rectangle(rTopLeft, rSize))); @@ -507,7 +508,7 @@ void SwAddressPreview::DrawText_Impl(vcl::RenderContext& rRenderContext, const O sal_Int32 nPos = 0; do { - rRenderContext.DrawText(aStart, rAddress.getToken(0, '\n', nPos)); + rRenderContext.DrawText(aStart, OUString(o3tl::getToken(rAddress, 0, '\n', nPos))); aStart.AdjustY(nHeight ); } while (nPos >= 0); diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index ec943c2ff27c..8d98c7a9f1eb 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -163,7 +164,7 @@ void SwLabelConfig::ImplCommit() {} void SwLabelConfig::Notify( const css::uno::Sequence< OUString >& ) {} -static std::unique_ptr lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeasure, const OUString& rManufacturer) +static std::unique_ptr lcl_CreateSwLabRec(const OUString& rType, std::u16string_view rMeasure, const OUString& rManufacturer) { std::unique_ptr pNewRec(new SwLabRec); pNewRec->m_aMake = rManufacturer; @@ -173,11 +174,11 @@ static std::unique_ptr lcl_CreateSwLabRec(const OUString& rType, const //all values are contained as colon-separated 1/100 mm values //except for the continuous flag ('C'/'S') and nCols, nRows (sal_Int32) sal_Int32 nTok{0}; - sal_Int32 nIdx{rMeasure.isEmpty() ? -1 : 0}; + sal_Int32 nIdx{rMeasure.empty() ? -1 : 0}; while (nIdx>=0) { - const OUString sToken(rMeasure.getToken(0, ';', nIdx)); - int nVal = sToken.toInt32(); + const std::u16string_view sToken(o3tl::getToken(rMeasure, 0, ';', nIdx)); + int nVal = o3tl::toInt32(sToken); switch(nTok++) { case 0 : pNewRec->m_bCont = sToken[0] == 'C'; break; diff --git a/sw/source/uibase/inc/changedb.hxx b/sw/source/uibase/inc/changedb.hxx index a928a5d3074f..0e2ffbdb5baa 100644 --- a/sw/source/uibase/inc/changedb.hxx +++ b/sw/source/uibase/inc/changedb.hxx @@ -46,7 +46,7 @@ class SwChangeDBDlg final : public SfxDialogController void UpdateFields(); void FillDBPopup(); - std::unique_ptr Insert(const OUString& rDBName); + std::unique_ptr Insert(std::u16string_view rDBName); void ShowDBName(const SwDBData& rDBData); public: diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx index 14b4be59eef6..e6d01aa4481c 100644 --- a/sw/source/uibase/inc/glosdoc.hxx +++ b/sw/source/uibase/inc/glosdoc.hxx @@ -73,7 +73,7 @@ public: */ css::uno::Reference< css::text::XAutoTextGroup > GetAutoTextGroup( - const OUString& _rGroupName + std::u16string_view _rGroupName ); /** returns the cached AutoTextEntry (if any) for the given group/with the given name @@ -108,11 +108,11 @@ public: static OUString GetDefName(); static OUString GetExtension(); - OUString GetCompleteGroupName( const OUString& GroupName ); + OUString GetCompleteGroupName( std::u16string_view GroupName ); bool NewGroupDoc(OUString &rGroupName, const OUString& rTitle); bool RenameGroupDoc(const OUString& sOldGroup, OUString& sNewGroup, const OUString& rNewTitle); - bool DelGroupDoc(const OUString &); + bool DelGroupDoc(std::u16string_view); SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString& rShortName, bool bShow = true ); void UpdateGlosPath(bool bFull); void ShowError(); diff --git a/sw/source/uibase/inc/mailmergehelper.hxx b/sw/source/uibase/inc/mailmergehelper.hxx index 3813991969cf..8d7d33de96af 100644 --- a/sw/source/uibase/inc/mailmergehelper.hxx +++ b/sw/source/uibase/inc/mailmergehelper.hxx @@ -63,7 +63,7 @@ class SW_DLLPUBLIC SwAddressPreview final : public weld::CustomWidgetController std::unique_ptr m_xVScrollBar; Link m_aSelectHdl; - void DrawText_Impl(vcl::RenderContext& rRenderContext, const OUString& rAddress, + void DrawText_Impl(vcl::RenderContext& rRenderContext, std::u16string_view rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected); virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 291ef3cf4050..53c4d2df5338 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -245,12 +245,12 @@ bool SwGlossaries::RenameGroupDoc( } // Deletes a text block group -bool SwGlossaries::DelGroupDoc(const OUString &rName) +bool SwGlossaries::DelGroupDoc(std::u16string_view rName) { sal_uInt16 nPath = o3tl::narrowing(o3tl::toInt32(o3tl::getToken(rName, 1, GLOS_DELIM))); if (static_cast(nPath) >= m_PathArr.size()) return false; - const OUString sBaseName(rName.getToken(0, GLOS_DELIM)); + const std::u16string_view sBaseName(o3tl::getToken(rName, 0, GLOS_DELIM)); const OUString sFileURL = lcl_FullPathName(m_PathArr[nPath], sBaseName); const OUString aName = sBaseName + OUStringChar(GLOS_DELIM) + OUString::number(nPath); // Even if the file doesn't exist it has to be deleted from @@ -474,13 +474,13 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) m_GlosArr.erase(it); } -OUString SwGlossaries::GetCompleteGroupName( const OUString& rGroupName ) +OUString SwGlossaries::GetCompleteGroupName( std::u16string_view rGroupName ) { const size_t nCount = GetGroupCnt(); // when the group name was created internally the path is here as well sal_Int32 nIndex = 0; - const OUString sGroupName(rGroupName.getToken(0, GLOS_DELIM, nIndex)); - const bool bPathLen = !rGroupName.getToken(0, GLOS_DELIM, nIndex).isEmpty(); + const std::u16string_view sGroupName(o3tl::getToken(rGroupName, 0, GLOS_DELIM, nIndex)); + const bool bPathLen = !o3tl::getToken(rGroupName, 0, GLOS_DELIM, nIndex).empty(); for ( size_t i = 0; i < nCount; i++ ) { const OUString sGrpName = GetGroupName(i); @@ -519,7 +519,7 @@ void SwGlossaries::InvalidateUNOOjects() UnoAutoTextEntries().swap(m_aGlossaryEntries); } -Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const OUString& _rGroupName ) +Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( std::u16string_view _rGroupName ) { bool _bCreate = true; // first, find the name with path-extension diff --git a/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx index 03b4f0008ce9..1bcf87eacf3d 100644 --- a/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.cxx @@ -18,6 +18,7 @@ */ #include +#include #include "UCBDeadPropertyValue.hxx" using namespace http_dav_ucp; @@ -64,25 +65,25 @@ bool UCBDeadPropertyValue::supportsType( const uno::Type & rType ) // static -bool UCBDeadPropertyValue::createFromXML(OUString const& rType, +bool UCBDeadPropertyValue::createFromXML(std::u16string_view rType, OUString const& rValue, uno::Any & rOutData) { bool success = true; - if (rType.equalsIgnoreAsciiCase(aTypeString)) + if (o3tl::equalsIgnoreAsciiCase(rType, aTypeString)) { rOutData <<= rValue; } - else if (rType.equalsIgnoreAsciiCase(aTypeLong)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeLong)) { rOutData <<= rValue.toInt32(); } - else if (rType.equalsIgnoreAsciiCase(aTypeShort)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeShort)) { rOutData <<= sal_Int16( rValue.toInt32() ); } - else if (rType.equalsIgnoreAsciiCase(aTypeBoolean)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeBoolean)) { if (rValue.equalsIgnoreAsciiCase(u"true")) { @@ -93,23 +94,23 @@ bool UCBDeadPropertyValue::createFromXML(OUString const& rType, rOutData <<= false; } } - else if (rType.equalsIgnoreAsciiCase(aTypeChar)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeChar)) { rOutData <<= rValue.toChar(); } - else if (rType.equalsIgnoreAsciiCase(aTypeByte)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeByte)) { rOutData <<= sal_Int8( rValue.toChar() ); } - else if (rType.equalsIgnoreAsciiCase(aTypeHyper)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeHyper)) { rOutData <<= rValue.toInt64(); } - else if (rType.equalsIgnoreAsciiCase(aTypeFloat)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeFloat)) { rOutData <<= rValue.toFloat(); } - else if (rType.equalsIgnoreAsciiCase(aTypeDouble)) + else if (o3tl::equalsIgnoreAsciiCase(rType, aTypeDouble)) { rOutData <<= rValue.toDouble(); } diff --git a/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx b/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx index 03240d010df1..12574e0a950b 100644 --- a/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx +++ b/ucb/source/ucp/webdav-curl/UCBDeadPropertyValue.hxx @@ -33,7 +33,7 @@ class UCBDeadPropertyValue public: static bool supportsType( const css::uno::Type & rType ); - static bool createFromXML(OUString const& rType, + static bool createFromXML(std::u16string_view rType, OUString const& rValue, css::uno::Any & rOutData); static ::std::optional<::std::pair> diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx index fec721a34491..fcf541612ec5 100644 --- a/unoidl/source/unoidl-read.cxx +++ b/unoidl/source/unoidl-read.cxx @@ -26,6 +26,7 @@ #include #include #include +#include namespace { @@ -458,11 +459,11 @@ void closeModules( } } -OUString openModulesFor(std::vector & modules, OUString const & name) +OUString openModulesFor(std::vector & modules, std::u16string_view name) { std::vector::iterator i(modules.begin()); for (sal_Int32 j = 0;;) { - OUString id(name.getToken(0, '.', j)); + OUString id(o3tl::getToken(name, 0, '.', j)); if (j == -1) { closeModules( modules, diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 967191c06e1f..858d2d09e72e 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -938,27 +939,27 @@ OUString SvtModuleOptions::GetModuleName( EModule eModule ) const return OUString(); } -SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const OUString& sName) +SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(std::u16string_view sName) { - if ( sName == "swriter" ) + if ( sName == u"swriter" ) return EFactory::WRITER; - if (sName.equalsIgnoreAsciiCase("swriter/Web")) // sometimes they are registered for swriter/web :-( + if (o3tl::equalsIgnoreAsciiCase(sName, u"swriter/Web")) // sometimes they are registered for swriter/web :-( return EFactory::WRITERWEB; - if (sName.equalsIgnoreAsciiCase("swriter/GlobalDocument")) // sometimes they are registered for swriter/globaldocument :-( + if (o3tl::equalsIgnoreAsciiCase(sName, u"swriter/GlobalDocument")) // sometimes they are registered for swriter/globaldocument :-( return EFactory::WRITERGLOBAL; - if ( sName == "scalc" ) + if ( sName == u"scalc" ) return EFactory::CALC; - if ( sName == "sdraw" ) + if ( sName == u"sdraw" ) return EFactory::DRAW; - if ( sName == "simpress" ) + if ( sName == u"simpress" ) return EFactory::IMPRESS; - if ( sName == "schart" ) + if ( sName == u"schart" ) return EFactory::CHART; - if ( sName == "smath" ) + if ( sName == u"smath" ) return EFactory::MATH; - if ( sName == "sbasic" ) + if ( sName == u"sbasic" ) return EFactory::BASIC; - if ( sName == "sdatabase" ) + if ( sName == u"sdatabase" ) return EFactory::DATABASE; return EFactory::UNKNOWN_FACTORY; diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 170e826e7eed..fa30ceb9b5a1 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -40,6 +40,7 @@ #include #include #include +#include const sal_uInt16 nCurrFormatDefault = 0; @@ -384,10 +385,10 @@ const OUString& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const return aReservedWords[nWord]; } -MeasurementSystem LocaleDataWrapper::mapMeasurementStringToEnum( const OUString& rMS ) const +MeasurementSystem LocaleDataWrapper::mapMeasurementStringToEnum( std::u16string_view rMS ) const { //! TODO: could be cached too - if ( rMS.equalsIgnoreAsciiCase( "metric" ) ) + if ( o3tl::equalsIgnoreAsciiCase( rMS, u"metric" ) ) return MeasurementSystem::Metric; //! TODO: other measurement systems? => extend enum MeasurementSystem return MeasurementSystem::US; diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx index 5bb7280bdf50..f1b1d6a8a33e 100644 --- a/unotools/source/misc/datetime.cxx +++ b/unotools/source/misc/datetime.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include namespace @@ -56,7 +57,7 @@ namespace /** convert string to number with optional min and max values */ bool convertNumber32(sal_Int32& rValue, - const OUString& rString, + std::u16string_view rString, sal_Int32 /*nMin*/ = -1, sal_Int32 /*nMax*/ = -1) { if (!checkAllNumber(rString)) @@ -65,12 +66,12 @@ namespace return false; } - rValue = rString.toInt32(); + rValue = o3tl::toInt32(rString); return true; } bool convertNumber64(sal_Int64& rValue, - const OUString& rString, + std::u16string_view rString, sal_Int64 /*nMin*/ = -1, sal_Int64 /*nMax*/ = -1) { if (!checkAllNumber(rString)) @@ -79,7 +80,7 @@ namespace return false; } - rValue = rString.toInt64(); + rValue = o3tl::toInt64(rString); return true; } @@ -338,7 +339,7 @@ bool ISO8601parseDateTime(const OUString &rString, css::util::DateTime& rDateTim // TODO: supports only calendar dates YYYY-MM-DD // MISSING: calendar dates YYYYMMDD YYYY-MM // year, week date, ordinal date -bool ISO8601parseDate(const OUString &aDateStr, css::util::Date& rDate) +bool ISO8601parseDate(std::u16string_view aDateStr, css::util::Date& rDate) { const sal_Int32 nDateTokens {comphelper::string::getTokenCount(aDateStr, '-')}; @@ -350,13 +351,13 @@ bool ISO8601parseDate(const OUString &aDateStr, css::util::Date& rDate) sal_Int32 nDay = 30; sal_Int32 nIdx {0}; - if ( !convertNumber32( nYear, aDateStr.getToken( 0, '-', nIdx ), 0, 9999 ) ) + if ( !convertNumber32( nYear, o3tl::getToken(aDateStr, 0, '-', nIdx ), 0, 9999 ) ) return false; if ( nDateTokens >= 2 ) - if ( !convertNumber32( nMonth, aDateStr.getToken( 0, '-', nIdx ), 0, 12 ) ) + if ( !convertNumber32( nMonth, o3tl::getToken(aDateStr, 0, '-', nIdx ), 0, 12 ) ) return false; if ( nDateTokens >= 3 ) - if ( !convertNumber32( nDay, aDateStr.getToken( 0, '-', nIdx ), 0, 31 ) ) + if ( !convertNumber32( nDay, o3tl::getToken(aDateStr, 0, '-', nIdx ), 0, 31 ) ) return false; rDate.Year = static_cast(nYear); diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx index 562205451839..fdc2fee94b29 100644 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -161,14 +162,14 @@ uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager() return xLayoutManager; } -bool VbaCommandBarHelper::hasToolbar( const OUString& sResourceUrl, const OUString& sName ) +bool VbaCommandBarHelper::hasToolbar( const OUString& sResourceUrl, std::u16string_view sName ) { if( m_xDocCfgMgr->hasSettings( sResourceUrl ) ) { OUString sUIName; uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, false ), uno::UNO_QUERY_THROW ); xPropertySet->getPropertyValue( ITEM_DESCRIPTOR_UINAME ) >>= sUIName; - if( sName.equalsIgnoreAsciiCase( sUIName ) ) + if( o3tl::equalsIgnoreAsciiCase( sName, sUIName ) ) return true; } return false; @@ -200,7 +201,7 @@ OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference< css: } // if found, return the position of the control. if not found, return -1 -sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const OUString& sName, bool bMenu ) +sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, std::u16string_view sName, bool bMenu ) { sal_Int32 nCount = xIndexAccess->getCount(); css::uno::Sequence< css::beans::PropertyValue > aProps; @@ -225,7 +226,7 @@ sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css } OUString sNewLabel = aBuffer.makeStringAndClear(); SAL_INFO("vbahelper", "VbaCommandBarHelper::findControlByName, control name: " << sNewLabel); - if( sName.equalsIgnoreAsciiCase( sNewLabel ) ) + if( o3tl::equalsIgnoreAsciiCase( sName, sNewLabel ) ) return i; } diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx index c177385cc285..774ec4839f7b 100644 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.hxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.hxx @@ -59,7 +59,7 @@ private: /// @throws css::uno::RuntimeException void Init(); /// @throws css::uno::RuntimeException - bool hasToolbar( const OUString& sResourceUrl, const OUString& sName ); + bool hasToolbar( const OUString& sResourceUrl, std::u16string_view sName ); public: /// @throws css::uno::RuntimeException VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ); @@ -85,7 +85,7 @@ public: /// @throws css::uno::RuntimeException OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const OUString& sName ); /// @throws css::uno::RuntimeException - static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const OUString& sName, bool bMenu ); + static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, std::u16string_view sName, bool bMenu ); static OUString generateCustomURL(); }; diff --git a/vcl/inc/IconThemeScanner.hxx b/vcl/inc/IconThemeScanner.hxx index d997443a63aa..80f24054799f 100644 --- a/vcl/inc/IconThemeScanner.hxx +++ b/vcl/inc/IconThemeScanner.hxx @@ -31,7 +31,7 @@ public: /** Factory method to create the object. * Provide a path to search for IconThemes. */ - static std::shared_ptr Create(const OUString& path); + static std::shared_ptr Create(std::u16string_view path); /** This method will return the standard path where icon themes are located. */ @@ -60,7 +60,7 @@ private: * - The directory does not exist * - There are no files which match the pattern images_xxx.zip */ - void ScanDirectoryForIconThemes(const OUString& path); + void ScanDirectoryForIconThemes(std::u16string_view path); /** Adds the provided icon theme by path. */ diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx index 561cbcfac636..6846a4272976 100644 --- a/vcl/inc/listbox.hxx +++ b/vcl/inc/listbox.hxx @@ -484,7 +484,7 @@ public: bool IsSelectionChanged() const { return maLBWindow->IsSelectionChanged(); } sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); } - void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ); + void SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep ); OUString GetMRUEntries( sal_Unicode cSep ) const; void SetMaxMRUCount( sal_Int32 n ) { maLBWindow->GetEntryList().SetMaxMRUCount( n ); } sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList().GetMaxMRUCount(); } diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 903e857037aa..b0395330e19e 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -433,7 +433,7 @@ bool ImplLOKHandleMouseEvent( const VclPtr& xWindow, MouseNotifyEve void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight ); -VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, const OString& rStr); +VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, std::string_view rStr); VCL_DLLPUBLIC css::uno::Reference FindFocusedEditableText(css::uno::Reference const&); diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 51178038dad2..806f57426255 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -21,18 +21,18 @@ #include -static bool lcl_textMimeInfo(const OUString& rMimeString, bool& bHaveNoCharset, bool& bHaveUTF16, - bool& bHaveUTF8) +static bool lcl_textMimeInfo(std::u16string_view rMimeString, bool& bHaveNoCharset, + bool& bHaveUTF16, bool& bHaveUTF8) { sal_Int32 nIndex = 0; if (o3tl::getToken(rMimeString, 0, ';', nIndex) == u"text/plain") { - OUString aToken(rMimeString.getToken(0, ';', nIndex)); - if (aToken == "charset=utf-16") + std::u16string_view aToken(o3tl::getToken(rMimeString, 0, ';', nIndex)); + if (aToken == u"charset=utf-16") bHaveUTF16 = true; - else if (aToken == "charset=utf-8") + else if (aToken == u"charset=utf-8") bHaveUTF8 = true; - else if (aToken.isEmpty()) + else if (aToken.empty()) bHaveNoCharset = true; else // we just handle UTF-16 and UTF-8, everything else is "bytes" return false; diff --git a/vcl/source/app/IconThemeScanner.cxx b/vcl/source/app/IconThemeScanner.cxx index a9163af3c690..c8f6a1ac7e8d 100644 --- a/vcl/source/app/IconThemeScanner.cxx +++ b/vcl/source/app/IconThemeScanner.cxx @@ -18,6 +18,7 @@ #include #include #include +#include namespace vcl { @@ -59,7 +60,7 @@ OUString convert_to_absolute_path(const OUString& path) IconThemeScanner::IconThemeScanner() {} -void IconThemeScanner::ScanDirectoryForIconThemes(const OUString& paths) +void IconThemeScanner::ScanDirectoryForIconThemes(std::u16string_view paths) { mFoundIconThemes.clear(); @@ -68,7 +69,7 @@ void IconThemeScanner::ScanDirectoryForIconThemes(const OUString& paths) sal_Int32 nIndex = 0; do { - aPaths.push_front(paths.getToken(0, ';', nIndex)); + aPaths.push_front(OUString(o3tl::getToken(paths, 0, ';', nIndex))); } while (nIndex >= 0); @@ -168,7 +169,7 @@ IconThemeScanner::IconThemeIsInstalled(const OUString& themeId) const } /*static*/ std::shared_ptr -IconThemeScanner::Create(const OUString &path) +IconThemeScanner::Create(std::u16string_view path) { std::shared_ptr retval(new IconThemeScanner); retval->ScanDirectoryForIconThemes(path); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 44d7fc5f5b8a..50882532edc9 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1286,7 +1286,7 @@ void ComboBox::AddSeparator( sal_Int32 n ) m_pImpl->m_pImplLB->AddSeparator( n ); } -void ComboBox::SetMRUEntries( const OUString& rEntries ) +void ComboBox::SetMRUEntries( std::u16string_view rEntries ) { m_pImpl->m_pImplLB->SetMRUEntries( rEntries, ';' ); } diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 2d405e542775..13910084db77 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -2419,7 +2420,7 @@ bool ImplListBox::HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& return bDone; } -void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ) +void ImplListBox::SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep ) { bool bChanges = GetEntryList().GetMRUCount() != 0; @@ -2431,7 +2432,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep ) sal_Int32 nIndex = 0; do { - OUString aEntry = rEntries.getToken( 0, cSep, nIndex ); + OUString aEntry( o3tl::getToken(rEntries, 0, cSep, nIndex ) ); // Accept only existing entries if ( GetEntryList().FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND ) { diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 6e486035b777..758052856f9b 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1208,7 +1208,7 @@ ErrCode GraphicFilter::readTIFF(SvStream & rStream, Graphic & rGraphic, GfxLinkT return ERRCODE_GRFILTER_FILTERERROR; } -ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName) +ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, std::u16string_view aFilterName) { ErrCode aReturnCode = ERRCODE_GRFILTER_FILTERERROR; @@ -1218,7 +1218,7 @@ ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGra if (!rStream.GetError()) { - if (aFilterName.equalsIgnoreAsciiCase(IMP_MOV)) + if (o3tl::equalsIgnoreAsciiCase(aFilterName, u"" IMP_MOV)) { rGraphic.SetDefaultType(); rStream.Seek(STREAM_SEEK_TO_END); diff --git a/vcl/source/filter/webp/writer.cxx b/vcl/source/filter/webp/writer.cxx index b1ac654d858a..f29dad007ed6 100644 --- a/vcl/source/filter/webp/writer.cxx +++ b/vcl/source/filter/webp/writer.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -32,23 +33,23 @@ static int writerFunction(const uint8_t* data, size_t size, const WebPPicture* p return stream->WriteBytes(data, size) == size ? 1 : 0; } -static WebPPreset presetToValue(const OUString& preset) +static WebPPreset presetToValue(std::u16string_view preset) { - if (preset.equalsIgnoreAsciiCase("picture")) + if (o3tl::equalsIgnoreAsciiCase(preset, u"picture")) return WEBP_PRESET_PICTURE; - if (preset.equalsIgnoreAsciiCase("photo")) + if (o3tl::equalsIgnoreAsciiCase(preset, u"photo")) return WEBP_PRESET_PHOTO; - if (preset.equalsIgnoreAsciiCase("drawing")) + if (o3tl::equalsIgnoreAsciiCase(preset, u"drawing")) return WEBP_PRESET_DRAWING; - if (preset.equalsIgnoreAsciiCase("icon")) + if (o3tl::equalsIgnoreAsciiCase(preset, u"icon")) return WEBP_PRESET_ICON; - if (preset.equalsIgnoreAsciiCase("text")) + if (o3tl::equalsIgnoreAsciiCase(preset, u"text")) return WEBP_PRESET_TEXT; return WEBP_PRESET_DEFAULT; } static bool writeWebp(SvStream& rStream, const BitmapEx& bitmapEx, bool lossless, - const OUString& preset, int quality) + std::u16string_view preset, int quality) { WebPConfig config; if (!WebPConfigInit(&config)) diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx index b7c1ad7d0816..aef9054fdcc1 100644 --- a/vcl/source/font/PhysicalFontFace.cxx +++ b/vcl/source/font/PhysicalFontFace.cxx @@ -27,6 +27,7 @@ #include #include +#include #include @@ -80,9 +81,9 @@ static int FamilyNameMatchValue(FontSelectPattern const& rFSP, std::u16string_vi return 0; } -static int StyleNameMatchValue(FontMatchStatus const& rStatus, OUString const& rStyle) +static int StyleNameMatchValue(FontMatchStatus const& rStatus, std::u16string_view rStyle) { - if (rStatus.mpTargetStyleName && rStyle.equalsIgnoreAsciiCase(*rStatus.mpTargetStyleName)) + if (rStatus.mpTargetStyleName && o3tl::equalsIgnoreAsciiCase(rStyle, *rStatus.mpTargetStyleName)) return 120000; return 0; diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index ec840c984d80..88f4d6189a57 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -37,6 +37,7 @@ #include #include +#include using namespace css; @@ -90,13 +91,13 @@ getWidgetDefinitionForTheme(std::u16string_view rThemenName) return spDefinition; } -int getSettingValueInteger(OString const& rValue, int nDefault) +int getSettingValueInteger(std::string_view rValue, int nDefault) { - if (rValue.isEmpty()) + if (rValue.empty()) return nDefault; if (!comphelper::string::isdigitAsciiString(rValue)) return nDefault; - return rValue.toInt32(); + return o3tl::toInt32(rValue); } bool getSettingValueBool(std::string_view rValue, bool bDefault) diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index 7d3fb7c4c8f3..4f68c35e4de5 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace vcl @@ -69,77 +70,77 @@ OString getValueOrAny(OString const& rInputString) return rInputString; } -ControlPart xmlStringToControlPart(OString const& sPart) +ControlPart xmlStringToControlPart(std::string_view sPart) { - if (sPart.equalsIgnoreAsciiCase("NONE")) + if (o3tl::equalsIgnoreAsciiCase(sPart, "NONE")) return ControlPart::NONE; - else if (sPart.equalsIgnoreAsciiCase("Entire")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "Entire")) return ControlPart::Entire; - else if (sPart.equalsIgnoreAsciiCase("ListboxWindow")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ListboxWindow")) return ControlPart::ListboxWindow; - else if (sPart.equalsIgnoreAsciiCase("Button")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "Button")) return ControlPart::Button; - else if (sPart.equalsIgnoreAsciiCase("ButtonUp")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonUp")) return ControlPart::ButtonUp; - else if (sPart.equalsIgnoreAsciiCase("ButtonDown")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonDown")) return ControlPart::ButtonDown; - else if (sPart.equalsIgnoreAsciiCase("ButtonLeft")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonLeft")) return ControlPart::ButtonLeft; - else if (sPart.equalsIgnoreAsciiCase("ButtonRight")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ButtonRight")) return ControlPart::ButtonRight; - else if (sPart.equalsIgnoreAsciiCase("AllButtons")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "AllButtons")) return ControlPart::AllButtons; - else if (sPart.equalsIgnoreAsciiCase("SeparatorHorz")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "SeparatorHorz")) return ControlPart::SeparatorHorz; - else if (sPart.equalsIgnoreAsciiCase("SeparatorVert")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "SeparatorVert")) return ControlPart::SeparatorVert; - else if (sPart.equalsIgnoreAsciiCase("TrackHorzLeft")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackHorzLeft")) return ControlPart::TrackHorzLeft; - else if (sPart.equalsIgnoreAsciiCase("TrackVertUpper")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackVertUpper")) return ControlPart::TrackVertUpper; - else if (sPart.equalsIgnoreAsciiCase("TrackHorzRight")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackHorzRight")) return ControlPart::TrackHorzRight; - else if (sPart.equalsIgnoreAsciiCase("TrackVertLower")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackVertLower")) return ControlPart::TrackVertLower; - else if (sPart.equalsIgnoreAsciiCase("TrackHorzArea")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackHorzArea")) return ControlPart::TrackHorzArea; - else if (sPart.equalsIgnoreAsciiCase("TrackVertArea")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TrackVertArea")) return ControlPart::TrackVertArea; - else if (sPart.equalsIgnoreAsciiCase("Arrow")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "Arrow")) return ControlPart::Arrow; - else if (sPart.equalsIgnoreAsciiCase("ThumbHorz")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ThumbHorz")) return ControlPart::ThumbHorz; - else if (sPart.equalsIgnoreAsciiCase("ThumbVert")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "ThumbVert")) return ControlPart::ThumbVert; - else if (sPart.equalsIgnoreAsciiCase("MenuItem")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "MenuItem")) return ControlPart::MenuItem; - else if (sPart.equalsIgnoreAsciiCase("MenuItemCheckMark")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "MenuItemCheckMark")) return ControlPart::MenuItemCheckMark; - else if (sPart.equalsIgnoreAsciiCase("MenuItemRadioMark")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "MenuItemRadioMark")) return ControlPart::MenuItemRadioMark; - else if (sPart.equalsIgnoreAsciiCase("Separator")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "Separator")) return ControlPart::Separator; - else if (sPart.equalsIgnoreAsciiCase("SubmenuArrow")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "SubmenuArrow")) return ControlPart::SubmenuArrow; - else if (sPart.equalsIgnoreAsciiCase("SubEdit")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "SubEdit")) return ControlPart::SubEdit; - else if (sPart.equalsIgnoreAsciiCase("DrawBackgroundHorz")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "DrawBackgroundHorz")) return ControlPart::DrawBackgroundHorz; - else if (sPart.equalsIgnoreAsciiCase("DrawBackgroundVert")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "DrawBackgroundVert")) return ControlPart::DrawBackgroundVert; - else if (sPart.equalsIgnoreAsciiCase("TabsDrawRtl")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "TabsDrawRtl")) return ControlPart::TabsDrawRtl; - else if (sPart.equalsIgnoreAsciiCase("HasBackgroundTexture")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "HasBackgroundTexture")) return ControlPart::HasBackgroundTexture; - else if (sPart.equalsIgnoreAsciiCase("HasThreeButtons")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "HasThreeButtons")) return ControlPart::HasThreeButtons; - else if (sPart.equalsIgnoreAsciiCase("BackgroundWindow")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "BackgroundWindow")) return ControlPart::BackgroundWindow; - else if (sPart.equalsIgnoreAsciiCase("BackgroundDialog")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "BackgroundDialog")) return ControlPart::BackgroundDialog; - else if (sPart.equalsIgnoreAsciiCase("Border")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "Border")) return ControlPart::Border; - else if (sPart.equalsIgnoreAsciiCase("Focus")) + else if (o3tl::equalsIgnoreAsciiCase(sPart, "Focus")) return ControlPart::Focus; return ControlPart::NONE; } diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index b116c95d2e37..ec403682a35d 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -171,8 +172,8 @@ void SvTabListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const sal_uInt16 nCount = mvTabList.size() - 1; for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ ) { - const OUString aToken = GetToken(aCurEntry, nIndex); - pEntry->AddItem(std::make_unique(aToken)); + const std::u16string_view aToken = GetToken(aCurEntry, nIndex); + pEntry->AddItem(std::make_unique(OUString(aToken))); } } @@ -317,9 +318,9 @@ sal_uInt32 SvTabListBox::GetEntryPos( const SvTreeListEntry* pEntry ) const } // static -OUString SvTabListBox::GetToken( const OUString &sStr, sal_Int32& nIndex ) +std::u16string_view SvTabListBox::GetToken( std::u16string_view sStr, sal_Int32& nIndex ) { - return sStr.getToken(0, '\t', nIndex); + return o3tl::getToken(sStr, 0, '\t', nIndex); } OUString SvTabListBox::GetTabEntryText( sal_uInt32 nPos, sal_uInt16 nCol ) const diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f691f62dfda3..bf6be3b0ab10 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -398,16 +399,15 @@ const Size& SystemWindow::GetMaxOutputSizePixel() const return mpImplData->maMaxOutSize; } -void ImplWindowStateFromStr(WindowStateData& rData, - const OString& rStr) +void ImplWindowStateFromStr(WindowStateData& rData, std::string_view rStr) { WindowStateMask nValidMask = WindowStateMask::NONE; sal_Int32 nIndex = 0; - OString aTokenStr = rStr.getToken(0, ',', nIndex); - if (!aTokenStr.isEmpty()) + std::string_view aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); + if (!aTokenStr.empty()) { - rData.SetX(aTokenStr.toInt32()); + rData.SetX(o3tl::toInt32(aTokenStr)); if( rData.GetX() > -16384 && rData.GetX() < 16384 ) nValidMask |= WindowStateMask::X; else @@ -415,10 +415,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetX( 0 ); - aTokenStr = rStr.getToken(0, ',', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); + if (!aTokenStr.empty()) { - rData.SetY(aTokenStr.toInt32()); + rData.SetY(o3tl::toInt32(aTokenStr)); if( rData.GetY() > -16384 && rData.GetY() < 16384 ) nValidMask |= WindowStateMask::Y; else @@ -426,10 +426,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetY( 0 ); - aTokenStr = rStr.getToken(0, ',', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); + if (!aTokenStr.empty()) { - rData.SetWidth(aTokenStr.toInt32()); + rData.SetWidth(o3tl::toInt32(aTokenStr)); if( rData.GetWidth() > 0 && rData.GetWidth() < 16384 ) nValidMask |= WindowStateMask::Width; else @@ -437,10 +437,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetWidth( 0 ); - aTokenStr = rStr.getToken(0, ';', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); + if (!aTokenStr.empty()) { - rData.SetHeight(aTokenStr.toInt32()); + rData.SetHeight(o3tl::toInt32(aTokenStr)); if( rData.GetHeight() > 0 && rData.GetHeight() < 16384 ) nValidMask |= WindowStateMask::Height; else @@ -448,12 +448,12 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetHeight( 0 ); - aTokenStr = rStr.getToken(0, ';', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); + if (!aTokenStr.empty()) { // #94144# allow Minimize again, should be masked out when read from configuration // 91625 - ignore Minimize - WindowStateState nState = static_cast(aTokenStr.toInt32()); + WindowStateState nState = static_cast(o3tl::toInt32(aTokenStr)); //nState &= ~(WindowStateState::Minimized); rData.SetState( nState ); nValidMask |= WindowStateMask::State; @@ -462,10 +462,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, rData.SetState( WindowStateState::NONE ); // read maximized pos/size - aTokenStr = rStr.getToken(0, ',', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); + if (!aTokenStr.empty()) { - rData.SetMaximizedX(aTokenStr.toInt32()); + rData.SetMaximizedX(o3tl::toInt32(aTokenStr)); if( rData.GetMaximizedX() > -16384 && rData.GetMaximizedX() < 16384 ) nValidMask |= WindowStateMask::MaximizedX; else @@ -473,10 +473,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetMaximizedX( 0 ); - aTokenStr = rStr.getToken(0, ',', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); + if (!aTokenStr.empty()) { - rData.SetMaximizedY(aTokenStr.toInt32()); + rData.SetMaximizedY(o3tl::toInt32(aTokenStr)); if( rData.GetMaximizedY() > -16384 && rData.GetMaximizedY() < 16384 ) nValidMask |= WindowStateMask::MaximizedY; else @@ -484,10 +484,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetMaximizedY( 0 ); - aTokenStr = rStr.getToken(0, ',', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); + if (!aTokenStr.empty()) { - rData.SetMaximizedWidth(aTokenStr.toInt32()); + rData.SetMaximizedWidth(o3tl::toInt32(aTokenStr)); if( rData.GetMaximizedWidth() > 0 && rData.GetMaximizedWidth() < 16384 ) nValidMask |= WindowStateMask::MaximizedWidth; else @@ -495,10 +495,10 @@ void ImplWindowStateFromStr(WindowStateData& rData, } else rData.SetMaximizedWidth( 0 ); - aTokenStr = rStr.getToken(0, ';', nIndex); - if (!aTokenStr.isEmpty()) + aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); + if (!aTokenStr.empty()) { - rData.SetMaximizedHeight(aTokenStr.toInt32()); + rData.SetMaximizedHeight(o3tl::toInt32(aTokenStr)); if( rData.GetMaximizedHeight() > 0 && rData.GetMaximizedHeight() < 16384 ) nValidMask |= WindowStateMask::MaximizedHeight; else @@ -833,9 +833,9 @@ void SystemWindow::GetWindowStateData( WindowStateData& rData ) const } } -void SystemWindow::SetWindowState(const OString& rStr) +void SystemWindow::SetWindowState(std::string_view rStr) { - if (rStr.isEmpty()) + if (rStr.empty()) return; WindowStateData aData; diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index bf8973114185..eaa3c4fa7d25 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -1405,28 +1406,28 @@ namespace } } -bool Window::set_font_attribute(const OString &rKey, const OUString &rValue) +bool Window::set_font_attribute(const OString &rKey, std::u16string_view rValue) { if (rKey == "weight") { vcl::Font aFont(GetControlFont()); - if (rValue == "thin") + if (rValue == u"thin") aFont.SetWeight(WEIGHT_THIN); - else if (rValue == "ultralight") + else if (rValue == u"ultralight") aFont.SetWeight(WEIGHT_ULTRALIGHT); - else if (rValue == "light") + else if (rValue == u"light") aFont.SetWeight(WEIGHT_LIGHT); - else if (rValue == "book") + else if (rValue == u"book") aFont.SetWeight(WEIGHT_SEMILIGHT); - else if (rValue == "normal") + else if (rValue == u"normal") aFont.SetWeight(WEIGHT_NORMAL); - else if (rValue == "medium") + else if (rValue == u"medium") aFont.SetWeight(WEIGHT_MEDIUM); - else if (rValue == "semibold") + else if (rValue == u"semibold") aFont.SetWeight(WEIGHT_SEMIBOLD); - else if (rValue == "bold") + else if (rValue == u"bold") aFont.SetWeight(WEIGHT_BOLD); - else if (rValue == "ultrabold") + else if (rValue == u"ultrabold") aFont.SetWeight(WEIGHT_ULTRABOLD); else aFont.SetWeight(WEIGHT_BLACK); @@ -1435,11 +1436,11 @@ bool Window::set_font_attribute(const OString &rKey, const OUString &rValue) else if (rKey == "style") { vcl::Font aFont(GetControlFont()); - if (rValue == "normal") + if (rValue == u"normal") aFont.SetItalic(ITALIC_NONE); - else if (rValue == "oblique") + else if (rValue == u"oblique") aFont.SetItalic(ITALIC_OBLIQUE); - else if (rValue == "italic") + else if (rValue == u"italic") aFont.SetItalic(ITALIC_NORMAL); SetControlFont(aFont); } @@ -1452,7 +1453,7 @@ bool Window::set_font_attribute(const OString &rKey, const OUString &rValue) else if (rKey == "size") { vcl::Font aFont(GetControlFont()); - sal_Int32 nHeight = rValue.toInt32() / 1000; + sal_Int32 nHeight = o3tl::toInt32(rValue) / 1000; aFont.SetFontHeight(nHeight); SetControlFont(aFont); } diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index f83e861e9706..183f429e909c 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -399,18 +399,17 @@ void FilterEntry::getSubFilters( css::uno::Sequence< css::beans::StringPair >& _ } static bool -isFilterString( const OUString &rFilterString, const char *pMatch ) +isFilterString( std::u16string_view rFilterString, const char *pMatch ) { sal_Int32 nIndex = 0; - OUString aToken; bool bIsFilter = true; OUString aMatch(OUString::createFromAscii(pMatch)); do { - aToken = rFilterString.getToken( 0, ';', nIndex ); - if( !aToken.match( aMatch ) ) + std::u16string_view aToken = o3tl::getToken(rFilterString, 0, ';', nIndex ); + if( !o3tl::starts_with(aToken, aMatch) ) { bIsFilter = false; break; @@ -439,11 +438,11 @@ shrinkFilterName( const OUString &rFilterName, bool bAllowNoStar = false ) nBracketLen = nBracketEnd - i; if( nBracketEnd <= 0 ) continue; - if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), "*." ) ) + if( isFilterString( rFilterName.subView( i + 1, nBracketLen - 1 ), "*." ) ) aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" ); else if (bAllowNoStar) { - if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), ".") ) + if( isFilterString( rFilterName.subView( i + 1, nBracketLen - 1 ), ".") ) aRealName = aRealName.replaceAt( i, nBracketLen + 1, u"" ); } } diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 07153f100016..584ad041d62a 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -41,6 +41,7 @@ #include #include +#include #include @@ -106,7 +107,7 @@ public: virtual ~MyWin() override { disposeOnce(); } virtual void dispose() override; - void parseList( const OString& rList ); + void parseList( std::string_view rList ); static OString processCommand( const OString& rCommand ); DECL_LINK( ListHdl, Button*, void ); @@ -167,19 +168,19 @@ void MyWin::dispose() WorkWindow::dispose(); } -void MyWin::parseList( const OString& rList ) +void MyWin::parseList( std::string_view rList ) { sal_Int32 nTokenPos = 0; OUString aElementType; m_aSvpBitmaps->Clear(); while( nTokenPos >= 0 ) { - OString aLine = rList.getToken( 0, '\n', nTokenPos ); - if( ! aLine.getLength() || *aLine.getStr() == '#' ) + std::string_view aLine = o3tl::getToken(rList, 0, '\n', nTokenPos ); + if( aLine.empty() || aLine[0] == '#' ) continue; - if( aLine.startsWith( "ElementType: " ) ) - aElementType = OStringToOUString( aLine.subView( 13 ), RTL_TEXTENCODING_ASCII_US ); + if( o3tl::starts_with(aLine, "ElementType: " ) ) + aElementType = OStringToOUString( aLine.substr( 13 ), RTL_TEXTENCODING_ASCII_US ); else { OUString aNewElement = diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index afc8acf72d00..357f4878c5b9 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -660,27 +660,27 @@ sal_Int16 ConvertCustomNumberFormat(std::u16string_view rFormat) return nRet; } -util::DateTime ConvertDateStringToDateTime( const OUString& rDateTime ) +util::DateTime ConvertDateStringToDateTime( std::u16string_view rDateTime ) { util::DateTime aDateTime; //xsd::DateTime in the format [-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm] example: 2008-01-21T10:42:00Z //OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const sal_Int32 nIndex = 0; - OUString sDate = rDateTime.getToken( 0, 'T', nIndex ); + std::u16string_view sDate = o3tl::getToken(rDateTime, 0, 'T', nIndex ); // HACK: this is broken according to the spec, but MSOffice always treats the time as local, // and writes it as Z (=UTC+0) - OUString sTime = rDateTime.getToken( 0, 'Z', nIndex ); + std::u16string_view sTime = o3tl::getToken(rDateTime, 0, 'Z', nIndex ); nIndex = 0; aDateTime.Year = sal_uInt16( o3tl::toInt32(o3tl::getToken(sDate, 0, '-', nIndex )) ); aDateTime.Month = sal_uInt16( o3tl::toInt32(o3tl::getToken(sDate, 0, '-', nIndex )) ); if (nIndex != -1) - aDateTime.Day = sal_uInt16( o3tl::toInt32(sDate.subView( nIndex )) ); + aDateTime.Day = sal_uInt16( o3tl::toInt32(sDate.substr( nIndex )) ); nIndex = 0; aDateTime.Hours = sal_uInt16( o3tl::toInt32(o3tl::getToken(sTime, 0, ':', nIndex )) ); aDateTime.Minutes = sal_uInt16( o3tl::toInt32(o3tl::getToken(sTime, 0, ':', nIndex )) ); if (nIndex != -1) - aDateTime.Seconds = sal_uInt16( o3tl::toInt32(sTime.subView( nIndex )) ); + aDateTime.Seconds = sal_uInt16( o3tl::toInt32(sTime.substr( nIndex )) ); return aDateTime; } diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx b/writerfilter/source/dmapper/ConversionHelper.hxx index 4ca441d169fa..c14c8033ea58 100644 --- a/writerfilter/source/dmapper/ConversionHelper.hxx +++ b/writerfilter/source/dmapper/ConversionHelper.hxx @@ -54,7 +54,7 @@ namespace writerfilter::dmapper::ConversionHelper{ sal_Int16 ConvertNumberingType(const sal_Int32 nFmt, const sal_Int16 nDefault = css::style::NumberingType::ARABIC); sal_Int16 ConvertCustomNumberFormat(std::u16string_view rFormat); - css::util::DateTime ConvertDateStringToDateTime(const OUString& rDateTime); + css::util::DateTime ConvertDateStringToDateTime(std::u16string_view rDateTime); } // namespace writerfilter::dmapper::ConversionHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index fbd75c2ef34d..d7d9be2bc10c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4052,7 +4052,7 @@ void DomainMapper_Impl::HandleLineBreak(const PropertyMapPtr& pPropertyMap) m_oLineBreakClear.reset(); } -static sal_Int16 lcl_ParseNumberingType( const OUString& rCommand ) +static sal_Int16 lcl_ParseNumberingType( std::u16string_view rCommand ) { sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR; @@ -4060,10 +4060,10 @@ static sal_Int16 lcl_ParseNumberingType( const OUString& rCommand ) // tdf#132185: but may as well be "PAGE \* Arabic" OUString sNumber; constexpr OUStringLiteral rSeparator(u"\\* "); - if (sal_Int32 nStartIndex = rCommand.indexOf(rSeparator); nStartIndex >= 0) + if (size_t nStartIndex = rCommand.find(rSeparator); nStartIndex != std::u16string_view::npos) { - nStartIndex += rSeparator.getLength(); - sNumber = rCommand.getToken(0, ' ', nStartIndex); + sal_Int32 nStartIndex2 = nStartIndex + rSeparator.getLength(); + sNumber = o3tl::getToken(rCommand, 0, ' ', nStartIndex2); } if( !sNumber.isEmpty() ) diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 6d03ac396664..aa35c03351db 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -190,7 +190,7 @@ void RTFSdrImport::resolveFLine(uno::Reference const& xProp } void RTFSdrImport::applyProperty(uno::Reference const& xShape, - std::u16string_view aKey, const OUString& aValue) const + std::u16string_view aKey, std::u16string_view aValue) const { uno::Reference xPropertySet(xShape, uno::UNO_QUERY); sal_Int16 nHoriOrient = 0; @@ -200,7 +200,7 @@ void RTFSdrImport::applyProperty(uno::Reference const& xShape, if (aKey == u"posh") { - switch (aValue.toInt32()) + switch (o3tl::toInt32(aValue)) { case 1: nHoriOrient = text::HoriOrientation::LEFT; @@ -223,7 +223,7 @@ void RTFSdrImport::applyProperty(uno::Reference const& xShape, } else if (aKey == u"posv") { - switch (aValue.toInt32()) + switch (o3tl::toInt32(aValue)) { case 1: nVertOrient = text::VertOrientation::TOP; @@ -239,14 +239,14 @@ void RTFSdrImport::applyProperty(uno::Reference const& xShape, } } else if (aKey == u"fFitShapeToText") - obFitShapeToText = aValue.toInt32() == 1; + obFitShapeToText = o3tl::toInt32(aValue) == 1; else if (aKey == u"fFilled") - bFilled = aValue.toInt32() == 1; + bFilled = o3tl::toInt32(aValue) == 1; else if (aKey == u"rotation") { // See DffPropertyReader::Fix16ToAngle(): in RTF, positive rotation angles are clockwise, we have them as counter-clockwise. // Additionally, RTF type is 0..360*2^16, our is 0..360*100. - sal_Int32 nRotation = aValue.toInt32() * 100 / RTF_MULTIPLIER; + sal_Int32 nRotation = o3tl::toInt32(aValue) * 100 / RTF_MULTIPLIER; uno::Reference xServiceInfo(xShape, uno::UNO_QUERY); if (!xServiceInfo->supportsService("com.sun.star.text.TextFrame")) xPropertySet->setPropertyValue( @@ -1166,12 +1166,12 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap void RTFSdrImport::close() { m_rImport.Mapper().endShape(); } -void RTFSdrImport::append(std::u16string_view aKey, const OUString& aValue) +void RTFSdrImport::append(std::u16string_view aKey, std::u16string_view aValue) { applyProperty(m_xShape, aKey, aValue); } -void RTFSdrImport::appendGroupProperty(std::u16string_view aKey, const OUString& aValue) +void RTFSdrImport::appendGroupProperty(std::u16string_view aKey, std::u16string_view aValue) { if (m_aParents.empty()) return; diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index c9bfd6ffa216..16f7f9c319ac 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -53,9 +53,9 @@ public: }; void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict); void close(); - void append(std::u16string_view aKey, const OUString& aValue); + void append(std::u16string_view aKey, std::u16string_view aValue); /// Append property on the current parent. - void appendGroupProperty(std::u16string_view aKey, const OUString& aValue); + void appendGroupProperty(std::u16string_view aKey, std::u16string_view aValue); void resolveDhgt(css::uno::Reference const& xPropertySet, sal_Int32 nZOrder, bool bOldStyle); /// Set line color and line width on the shape, using the relevant API depending on if the shape is a text frame or not. @@ -82,7 +82,7 @@ private: void createShape(const OUString& rService, css::uno::Reference& xShape, css::uno::Reference& xPropertySet); void applyProperty(css::uno::Reference const& xShape, - std::u16string_view aKey, const OUString& aValue) const; + std::u16string_view aKey, std::u16string_view aValue) const; int initShape(css::uno::Reference& o_xShape, css::uno::Reference& o_xPropSet, bool& o_rIsCustomShape, RTFShape const& rShape, bool bClose, ShapeOrPict shapeOrPict); diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx index e5cdf10fde52..66c351088e46 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.hxx +++ b/xmlhelp/source/cxxhelp/provider/databases.hxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -64,11 +65,11 @@ namespace chelp { StaticModuleInformation( const OUString& aTitle, const OUString& aStartId, const OUString& aProgramSwitch, - const OUString& aOrder ) + std::u16string_view aOrder ) : m_aStartId( aStartId ), m_aProgramSwitch( aProgramSwitch ), m_aTitle( aTitle ), - m_nOrder( aOrder.toInt32() ) + m_nOrder( o3tl::toInt32(aOrder) ) { } diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 236131ac8bb9..094dc94f52c5 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -110,13 +110,13 @@ public: explicit AnimationsImportHelperImpl( SvXMLImport& rImport ); Any convertValue( XMLTokenEnum eAttributeName, const OUString& rValue ); - Sequence< Any > convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue ); + Sequence< Any > convertValueSequence( XMLTokenEnum eAttributeName, std::u16string_view rValue ); Any convertTarget( const OUString& rValue ); static Any convertPath( const OUString& rValue ); Any convertTiming( const OUString& rValue ); static Sequence< double > convertKeyTimes( std::u16string_view rValue ); - static Sequence< TimeFilterPair > convertTimeFilter( const OUString& rValue ); + static Sequence< TimeFilterPair > convertTimeFilter( std::u16string_view rValue ); }; AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport& rImport ) @@ -283,7 +283,7 @@ Any AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName, const } } -Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName, const OUString& rValue ) +Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName, std::u16string_view rValue ) { Sequence< Any > aValues; @@ -296,7 +296,7 @@ Sequence< Any > AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum e // fill the sequence Any* pValues = aValues.getArray(); for (sal_Int32 nIndex = 0; nIndex >= 0; ) - *pValues++ = convertValue( eAttributeName, rValue.getToken( 0, ';', nIndex ) ); + *pValues++ = convertValue( eAttributeName, OUString(o3tl::getToken(rValue, 0, ';', nIndex )) ); } return aValues; @@ -394,7 +394,7 @@ Sequence< double > AnimationsImportHelperImpl::convertKeyTimes( std::u16string_v return aKeyTimes; } -Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const OUString& rValue ) +Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( std::u16string_view rValue ) { const sal_Int32 nElements { comphelper::string::getTokenCount(rValue, ';') }; @@ -405,15 +405,15 @@ Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const TimeFilterPair* pValues = aTimeFilter.getArray(); for (sal_Int32 nIndex = 0; nIndex >= 0; ) { - const OUString aToken( rValue.getToken( 0, ';', nIndex ) ); + const std::u16string_view aToken( o3tl::getToken(rValue, 0, ';', nIndex ) ); - sal_Int32 nPos = aToken.indexOf( ',' ); - if( nPos >= 0 ) + size_t nPos = aToken.find( ',' ); + if( nPos != std::u16string_view::npos ) { pValues->Time = rtl_math_uStringToDouble( - aToken.getStr(), aToken.getStr() + nPos, '.', 0, nullptr, nullptr); + aToken.data(), aToken.data() + nPos, '.', 0, nullptr, nullptr); pValues->Progress = rtl_math_uStringToDouble( - aToken.getStr() + nPos + 1, aToken.getStr() + aToken.getLength(), '.', 0, + aToken.data() + nPos + 1, aToken.data() + aToken.size(), '.', 0, nullptr, nullptr); } pValues++; diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index ab567b6bd178..5e32cdba6763 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -440,14 +441,14 @@ static void GetPosition3D( std::vector< css::beans::PropertyValue >& rDest, } static void GetDoubleSequence( std::vector< css::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions - const OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) + std::u16string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { std::vector< double > vDirection; sal_Int32 nIndex = 0; do { double fAttrDouble; - OUString aToken( rValue.getToken( 0, ',', nIndex ) ); + std::u16string_view aToken( o3tl::getToken(rValue, 0, ',', nIndex ) ); if (!::sax::Converter::convertDouble( fAttrDouble, aToken )) break; else @@ -465,14 +466,14 @@ static void GetDoubleSequence( std::vector< css::beans::PropertyValue >& rDest, } static void GetSizeSequence( std::vector< css::beans::PropertyValue >& rDest, - const OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) + std::u16string_view rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { std::vector< sal_Int32 > vNum; sal_Int32 nIndex = 0; do { sal_Int32 n; - OUString aToken( rValue.getToken( 0, ' ', nIndex ) ); + std::u16string_view aToken( o3tl::getToken(rValue, 0, ' ', nIndex ) ); if (!::sax::Converter::convertNumber( n, aToken )) break; else diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 4c313538b0df..52b286dd50a9 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -348,16 +349,16 @@ void SvXMLNumFmtExport::WriteColorElement_Impl( const Color& rColor ) } void SvXMLNumFmtExport::WriteCurrencyElement_Impl( const OUString& rString, - const OUString& rExt ) + std::u16string_view rExt ) { FinishTextElement_Impl(); - if ( !rExt.isEmpty() ) + if ( !rExt.empty() ) { // rExt should be a 16-bit hex value max FFFF which may contain a // leading "-" separator (that is not a minus sign, but toInt32 can be // used to parse it, with post-processing as necessary): - sal_Int32 nLang = rExt.toInt32(16); + sal_Int32 nLang = o3tl::toInt32(rExt, 16); if ( nLang < 0 ) nLang = -nLang; AddLanguageAttr_Impl( LanguageType(nLang) ); // adds to pAttrList @@ -903,7 +904,7 @@ bool SvXMLNumFmtExport::WriteTextWithCurrency_Impl( const OUString& rString, AddToTextElement_Impl( rString.subView( 0, nPos ) ); } // currency symbol (empty string -> default) - WriteCurrencyElement_Impl( "", "" ); + WriteCurrencyElement_Impl( "", u"" ); bRet = true; // text after currency symbol @@ -1478,7 +1479,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt //! but should still be empty (meaning automatic) // pElemStr is "CCC" - WriteCurrencyElement_Impl( *pElemStr, OUString() ); + WriteCurrencyElement_Impl( *pElemStr, u"" ); bAnyContent = true; bCurrencyWritten = true; } diff --git a/xmlsecurity/inc/documentsignaturehelper.hxx b/xmlsecurity/inc/documentsignaturehelper.hxx index d517787af0cf..b18ccf103e20 100644 --- a/xmlsecurity/inc/documentsignaturehelper.hxx +++ b/xmlsecurity/inc/documentsignaturehelper.hxx @@ -83,7 +83,7 @@ namespace DocumentSignatureHelper const SignatureInformation & sigInfo, const DocumentSignatureAlgorithm alg); bool equalsReferenceUriManifestPath( - const OUString & rUri, const OUString & rPath); + std::u16string_view rUri, std::u16string_view rPath); OUString GetDocumentContentSignatureDefaultStreamName(); OUString GetScriptingContentSignatureDefaultStreamName(); diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index 5c264f7885e6..af3d51154b54 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -478,16 +479,16 @@ bool DocumentSignatureHelper::checkIfAllFilesAreSigned( Returns true if both strings are equal. */ bool DocumentSignatureHelper::equalsReferenceUriManifestPath( - const OUString & rUri, const OUString & rPath) + std::u16string_view rUri, std::u16string_view rPath) { //split up the uri and path into segments. Both are separated by '/' std::vector vUriSegments; for (sal_Int32 nIndex = 0; nIndex >= 0; ) - vUriSegments.push_back(rUri.getToken( 0, '/', nIndex )); + vUriSegments.push_back(OUString(o3tl::getToken(rUri, 0, '/', nIndex ))); std::vector vPathSegments; for (sal_Int32 nIndex = 0; nIndex >= 0; ) - vPathSegments.push_back(rPath.getToken( 0, '/', nIndex )); + vPathSegments.push_back(OUString(o3tl::getToken(rPath, 0, '/', nIndex ))); if (vUriSegments.size() != vPathSegments.size()) return false; -- cgit