diff options
73 files changed, 238 insertions, 252 deletions
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index 2372ecd7144d..82d909398a77 100644 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -41,6 +41,7 @@ #include <sal/log.hxx> #include <salhelper/simplereferenceobject.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/string_view.hxx> #undef max @@ -609,7 +610,7 @@ ErrCode getProcData(HMODULE handle, OUString const & name, ProcData * proc) { assert(proc != nullptr); if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"??? - sal_Int32 n = comphelper::string::toInt32(name.subView(1)); //TODO: handle bad input + sal_Int32 n = o3tl::toInt32(name.subView(1)); //TODO: handle bad input if (n <= 0 || n > 0xFFFF) { return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode? } diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx index 32ddf68b6818..7ab84d7f8b56 100644 --- a/basic/source/runtime/dllmgr-x86.cxx +++ b/basic/source/runtime/dllmgr-x86.cxx @@ -40,6 +40,7 @@ #include <sal/log.hxx> #include <salhelper/simplereferenceobject.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <o3tl/string_view.hxx> #undef max @@ -585,7 +586,7 @@ ErrCode getProcData(HMODULE handle, OUString const & name, ProcData * proc) { assert(proc != 0); if ( !name.isEmpty() && name[0] == '@' ) { //TODO: "@" vs. "#"??? - sal_Int32 n = comphelper::string::toInt32(name.subView(1)); //TODO: handle bad input + sal_Int32 n = o3tl::toInt32(name.subView(1)); //TODO: handle bad input if (n <= 0 || n > 0xFFFF) { return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode? } diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index ecee58fdbb88..f1e00b786dd1 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -40,7 +40,7 @@ #include <cppuhelper/supportsservice.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/property.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <tools/diagnose_ex.h> #include <limits> @@ -826,7 +826,7 @@ Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDa else if( aRangeRepresentation.match( lcl_aLabelRangePrefix )) { // label - sal_Int32 nIndex = comphelper::string::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix))); + sal_Int32 nIndex = o3tl::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix))); return createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::number( nIndex )); } else if ( aRangeRepresentation == "last" ) @@ -870,7 +870,7 @@ sal_Bool SAL_CALL InternalDataProvider::hasDataByRangeRepresentation( const OUSt } else if( aRange.match( lcl_aLabelRangePrefix )) { - sal_Int32 nIndex = comphelper::string::toInt32(aRange.subView( strlen(lcl_aLabelRangePrefix))); + sal_Int32 nIndex = o3tl::toInt32(aRange.subView( strlen(lcl_aLabelRangePrefix))); bResult = (nIndex < (m_bDataInColumns ? m_aInternalData.getColumnCount(): m_aInternalData.getRowCount())); } else @@ -906,7 +906,7 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation } else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) ) { - sal_Int32 nLevel = comphelper::string::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix) )); + sal_Int32 nLevel = o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix) )); vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels()); if( nLevel < lcl_getInnerLevelCount( aCategories ) ) { @@ -958,7 +958,7 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation( auto aNewVector( comphelper::sequenceToContainer<vector< uno::Any >>(aNewData) ); if( aRange.match( lcl_aLabelRangePrefix ) ) { - sal_uInt32 nIndex = comphelper::string::toInt32(aRange.subView( strlen(lcl_aLabelRangePrefix))); + sal_uInt32 nIndex = o3tl::toInt32(aRange.subView( strlen(lcl_aLabelRangePrefix))); if( m_bDataInColumns ) m_aInternalData.setComplexColumnLabel( nIndex, std::move(aNewVector) ); else @@ -966,7 +966,7 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation( } else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) ) { - sal_Int32 nPointIndex = comphelper::string::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix))); + sal_Int32 nPointIndex = o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix))); if( m_bDataInColumns ) m_aInternalData.setComplexRowLabel( nPointIndex, std::move(aNewVector) ); else @@ -974,7 +974,7 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation( } else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) ) { - sal_Int32 nLevel = comphelper::string::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix))); + sal_Int32 nLevel = o3tl::toInt32(aRange.subView( strlen(lcl_aCategoriesLevelRangeNamePrefix))); vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels(); //ensure equal length @@ -1191,7 +1191,7 @@ OUString SAL_CALL InternalDataProvider::convertRangeToXML( const OUString& aRang } else if( aRangeRepresentation.match( lcl_aLabelRangePrefix )) { - sal_Int32 nIndex = comphelper::string::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix))); + sal_Int32 nIndex = o3tl::toInt32(aRangeRepresentation.subView( strlen(lcl_aLabelRangePrefix))); aRange.aUpperLeft.bIsEmpty = false; aRange.aLowerRight.bIsEmpty = true; if( m_bDataInColumns ) diff --git a/chart2/source/tools/PropertyHelper.cxx b/chart2/source/tools/PropertyHelper.cxx index b50d3b58d3d2..ae52b5b33127 100644 --- a/chart2/source/tools/PropertyHelper.cxx +++ b/chart2/source/tools/PropertyHelper.cxx @@ -87,7 +87,7 @@ struct lcl_OUStringRestToInt32 { if( m_nPrefixLength > rStr.getLength() ) return 0; - return comphelper::string::toInt32(rStr.subView( m_nPrefixLength )); + return o3tl::toInt32(rStr.subView( m_nPrefixLength )); } private: sal_Int32 m_nPrefixLength; diff --git a/chart2/source/tools/XMLRangeHelper.cxx b/chart2/source/tools/XMLRangeHelper.cxx index c052e42ea3d6..d77c3b591900 100644 --- a/chart2/source/tools/XMLRangeHelper.cxx +++ b/chart2/source/tools/XMLRangeHelper.cxx @@ -21,7 +21,7 @@ #include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <algorithm> @@ -120,7 +120,7 @@ void lcl_getSingleCellAddressFromXMLString( // parse number for row while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 ) i--; - rOutCell.nRow = (comphelper::string::toInt32(aCellStr.subView( i + 1 ))) - 1; + rOutCell.nRow = (o3tl::toInt32(aCellStr.subView( i + 1 ))) - 1; // a dollar in XML means absolute (whereas in UI it means relative) if( pStrArray[ i ] == aDollar ) { diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index aacad7e6e08f..8c8461fd485d 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <comphelper/property.hxx> #include <comphelper/servicehelper.hxx> +#include <o3tl/string_view.hxx> #include <comphelper/string.hxx> #include <unotools/configmgr.hxx> #include <unotools/tempfile.hxx> @@ -952,9 +953,9 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool (*_rRow)[i]->setNull(); break; } - const sal_uInt16 nYear = static_cast<sal_uInt16>(comphelper::string::toInt32(aStr.subView( 0, 4 ))); - const sal_uInt16 nMonth = static_cast<sal_uInt16>(comphelper::string::toInt32(aStr.subView( 4, 2 ))); - const sal_uInt16 nDay = static_cast<sal_uInt16>(comphelper::string::toInt32(aStr.subView( 6, 2 ))); + const sal_uInt16 nYear = static_cast<sal_uInt16>(o3tl::toInt32(aStr.subView( 0, 4 ))); + const sal_uInt16 nMonth = static_cast<sal_uInt16>(o3tl::toInt32(aStr.subView( 4, 2 ))); + const sal_uInt16 nDay = static_cast<sal_uInt16>(o3tl::toInt32(aStr.subView( 6, 2 ))); const css::util::Date aDate(nDay,nMonth,nYear); *(*_rRow)[i] = aDate; diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx index 43348041b039..40d144730f6b 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/sdbc/Deferrability.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/sequence.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <rtl/ustrbuf.hxx> @@ -751,8 +751,7 @@ Reference<XResultSet> SAL_CALL ODatabaseMetaData::getColumns(const Any& /*catalo sal_Int32 nCharMaxLen = xRow->getShort(6); bool bIsCharMax = !xRow->wasNull(); if (sDataType.equalsIgnoreAsciiCase("year")) - nColumnSize - = comphelper::string::toInt32(sColumnType.subView(6, 1)); // 'year(' length is 5 + nColumnSize = o3tl::toInt32(sColumnType.subView(6, 1)); // 'year(' length is 5 else if (sDataType.equalsIgnoreAsciiCase("date")) nColumnSize = 10; else if (sDataType.equalsIgnoreAsciiCase("time")) diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx index 7959081df70c..ce3f107e2864 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx @@ -28,7 +28,7 @@ #include <TPrivilegesResultSet.hxx> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace connectivity::odbc; using namespace com::sun::star::uno; @@ -1242,7 +1242,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) try { OUString aValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding()); - return comphelper::string::toInt32(aValue.subView(0,aValue.indexOf('.'))); + return o3tl::toInt32(aValue.subView(0,aValue.indexOf('.'))); } catch (const SQLException &) { @@ -1278,7 +1278,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) try { OUString aValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding()); - return comphelper::string::toInt32(aValue.subView(0,aValue.lastIndexOf('.'))); + return o3tl::toInt32(aValue.subView(0,aValue.lastIndexOf('.'))); } catch (const SQLException &) { diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 452e7ed2bd78..f77cf8821a4a 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -43,7 +43,7 @@ #include <unotools/transliterationwrapper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <editeng/editids.hrc> #include <sot/storage.hxx> #include <editeng/udlnitem.hxx> @@ -510,7 +510,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( } if (bFoundEnd && isValidNumber) { - sal_Int32 nNum = comphelper::string::toInt32(rTxt.subView(nSttPos, nNumEnd - nSttPos + 1)); + sal_Int32 nNum = o3tl::toInt32(rTxt.subView(nSttPos, nNumEnd - nSttPos + 1)); // Check if the characters after that number correspond to the ordinal suffix uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index c85d1f58e540..a1d3929a218c 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -15,7 +15,7 @@ #include <vcl/BitmapPalette.hxx> #include <filter/msfilter/escherex.hxx> #include <filter/msfilter/util.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <memory> #include <unordered_map> @@ -489,7 +489,7 @@ bool WW8ReadFieldParams::GetTokenSttFromTo(sal_Int32* pFrom, sal_Int32* pTo, sal if (nIndex>=0) { nStart = sStart.toInt32(); - nEnd = comphelper::string::toInt32(sParams.subView(nIndex)); + nEnd = o3tl::toInt32(sParams.subView(nIndex)); } } if( pFrom ) *pFrom = nStart; diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index dac4259f4bed..a112544c83c6 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -26,7 +26,7 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <comphelper/propertyvalue.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <unotools/pathoptions.hxx> @@ -369,7 +369,7 @@ OUString XMLFilterSettingsDialog::createUniqueInterfaceName( const OUString& rIn { // if yes, make sure we generate a unique name with a higher number // this is dump but fast - sal_Int32 nNumber = comphelper::string::toInt32(aInterfaceName.subView( rInterfaceName.getLength() )); + sal_Int32 nNumber = o3tl::toInt32(aInterfaceName.subView( rInterfaceName.getLength() )); if( nNumber >= nDefaultNumber ) nDefaultNumber = nNumber + 1; } diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index 5f0e1c388cea..88edd70beb79 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -31,7 +31,7 @@ #include <vcl/dibtools.hxx> #include <vcl/graph.hxx> #include <vcl/svapp.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> const sal_uInt16 START_ITEMID = 1000; @@ -140,7 +140,7 @@ static void InsertSubMenuItems(const Reference<XPopupMenu>& rSubMenu, sal_uInt16 // command url but uses the item id as a unique identifier. These entries // got a special url during conversion from menu=>actiontriggercontainer. // Now we have to extract this special url and set the correct item id!!! - nNewItemId = static_cast<sal_uInt16>(comphelper::string::toInt32(aCommandURL.subView( nIndex+aSlotURL.getLength() ))); + nNewItemId = static_cast<sal_uInt16>(o3tl::toInt32(aCommandURL.subView( nIndex+aSlotURL.getLength() ))); rSubMenu->insertItem(nNewItemId, aLabel, 0, i); } else diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 8bf0456e0e33..82815c0e5bc6 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -359,64 +359,6 @@ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::string_view rString); */ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(std::u16string_view rString); -/** Interpret a string as a long integer. - - This function cannot be used for language-specific conversion. - - @param str - a string. - - @param radix - the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX - (36), inclusive. - - @param nStrLength - number of chars to process - - @return - the long integer value represented by the string, or 0 if the string does - not represent a long integer. -*/ -inline sal_Int64 toInt64(std::u16string_view str, sal_Int16 radix = 10 ) -{ - return rtl_ustr_toInt64_WithLength(str.data(), radix, str.size()); -} -inline sal_Int64 toInt64(std::string_view str, sal_Int16 radix = 10 ) -{ - return rtl_str_toInt64_WithLength(str.data(), radix, str.size()); -} - -/** Interpret a string as an integer. - - This function cannot be used for language-specific conversion. - - @param radix - the radix. Must be between RTL_USTR_MIN_RADIX (2) and RTL_USTR_MAX_RADIX - (36), inclusive. - - @param nStrLength - number of chars to process - - @return - the integer value represented by the string, or 0 if the string does not - represent an integer. - */ -inline sal_Int32 toInt32( std::u16string_view str, sal_Int16 radix = 10 ) -{ - sal_Int64 n = rtl_ustr_toInt64_WithLength(str.data(), radix, str.size()); - if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32) - n = 0; - return n; -} -inline sal_Int32 toInt32( std::string_view str, sal_Int16 radix = 10 ) -{ - sal_Int64 n = rtl_str_toInt64_WithLength(str.data(), radix, str.size()); - if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32) - n = 0; - return n; -} - - } // namespace comphelper::string /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx index c62fa5f23283..b14258c14d39 100644 --- a/include/o3tl/string_view.hxx +++ b/include/o3tl/string_view.hxx @@ -304,6 +304,32 @@ inline std::string_view trim(std::string_view str) return std::string_view{ str.data() + nPreSpaces, static_cast<size_t>(nLen - nPostSpaces - nPreSpaces) }; } + +// Like OString::toInt32, but for std::string_view: +inline sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix = 10) +{ + sal_Int64 n = rtl_ustr_toInt64_WithLength(str.data(), radix, str.size()); + if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32) + n = 0; + return n; +} +inline sal_Int32 toInt32(std::string_view str, sal_Int16 radix = 10) +{ + sal_Int64 n = rtl_str_toInt64_WithLength(str.data(), radix, str.size()); + if (n < SAL_MIN_INT32 || n > SAL_MAX_INT32) + n = 0; + return n; +} + +// Like OString::toInt64, but for std::string_view: +inline sal_Int64 toInt64(std::u16string_view str, sal_Int16 radix = 10) +{ + return rtl_ustr_toInt64_WithLength(str.data(), radix, str.size()); +} +inline sal_Int64 toInt64(std::string_view str, sal_Int16 radix = 10) +{ + return rtl_str_toInt64_WithLength(str.data(), radix, str.size()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index 587740f24a93..c346a63db1f6 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -24,7 +24,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/xml/sax/SAXException.hpp> #include <cppuhelper/exc_hlp.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <o3tl/safeint.hxx> #include <osl/time.h> @@ -99,25 +99,25 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar const sal_Int32 nLen = aChars.getLength(); if ( nLen >= 4 ) { - aOslDTime.Year = static_cast<sal_Int16>(comphelper::string::toInt32(aChars.subView( 0, 4 ))); + aOslDTime.Year = static_cast<sal_Int16>(o3tl::toInt32(aChars.subView( 0, 4 ))); if ( nLen >= 7 && aChars[4] == '-' ) { - aOslDTime.Month = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 5, 2 ))); + aOslDTime.Month = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 5, 2 ))); if ( nLen >= 10 && aChars[7] == '-' ) { - aOslDTime.Day = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 8, 2 ))); + aOslDTime.Day = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 8, 2 ))); if ( nLen >= 16 && aChars[10] == 'T' && aChars[13] == ':' ) { - aOslDTime.Hours = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 11, 2 ))); - aOslDTime.Minutes = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 14, 2 ))); + aOslDTime.Hours = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 11, 2 ))); + aOslDTime.Minutes = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 14, 2 ))); sal_Int32 nOptTime = 0; if ( nLen >= 19 && aChars[16] == ':' ) { - aOslDTime.Seconds = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 17, 2 ))); + aOslDTime.Seconds = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 17, 2 ))); nOptTime += 3; if ( nLen >= 20 && aChars[19] == '.' ) { @@ -163,8 +163,8 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar if ( ( aChars[16 + nOptTime] == '+' || aChars[16 + nOptTime] == '-' ) && aChars[16 + nOptTime + 3] == ':' ) { - nModif = comphelper::string::toInt32(aChars.subView( 16 + nOptTime + 1, 2 )) * 3600; - nModif += comphelper::string::toInt32(aChars.subView( 16 + nOptTime + 4, 2 )) * 60; + nModif = o3tl::toInt32(aChars.subView( 16 + nOptTime + 1, 2 )) * 3600; + nModif += o3tl::toInt32(aChars.subView( 16 + nOptTime + 4, 2 )) * 60; if ( aChars[16 + nOptTime] == '-' ) nModif *= -1; } diff --git a/oox/source/drawingml/customshapepresetdata.cxx b/oox/source/drawingml/customshapepresetdata.cxx index 75f43c94e80a..45f6b21a903d 100644 --- a/oox/source/drawingml/customshapepresetdata.cxx +++ b/oox/source/drawingml/customshapepresetdata.cxx @@ -20,7 +20,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; @@ -152,7 +152,7 @@ awt::Rectangle lcl_parseRectangle(const OString& rValue) static const char aExpectedHeightPrefix[] = " Height = (long) "; assert(nIndex >= 0 && rValue.match(aExpectedHeightPrefix, nIndex)); nIndex += strlen(aExpectedHeightPrefix); - aRectangle.Height = comphelper::string::toInt32(rValue.subView(nIndex)); + aRectangle.Height = o3tl::toInt32(rValue.subView(nIndex)); return aRectangle; } @@ -169,7 +169,7 @@ awt::Size lcl_parseSize(const OString& rValue) static const char aExpectedHeightPrefix[] = " Height = (long) "; assert(nIndex >= 0 && rValue.match(aExpectedHeightPrefix, nIndex)); nIndex += strlen(aExpectedHeightPrefix); - aSize.Height = comphelper::string::toInt32(rValue.subView(nIndex)); + aSize.Height = o3tl::toInt32(rValue.subView(nIndex)); return aSize; } diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 3e81b84a133f..59d8a8775fb6 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <comphelper/sequence.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <algorithm> @@ -151,7 +151,7 @@ void CustomShapeProperties::pushToPropSet( { if ( adjustmentGuide.maName.getLength() > 3 ) { - sal_Int32 nAdjustmentIndex = comphelper::string::toInt32(adjustmentGuide.maName.subView( 3 )) - 1; + sal_Int32 nAdjustmentIndex = o3tl::toInt32(adjustmentGuide.maName.subView( 3 )) - 1; if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) ) { EnhancedCustomShapeAdjustmentValue aAdjustmentVal; diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 844cb7a4fb2c..7bb6930eca13 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -28,7 +28,7 @@ #include <oox/token/namespaces.hxx> #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace ::oox::core; using namespace ::com::sun::star::uno; @@ -117,7 +117,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, break; nLength++; } - sal_Int32 nPageNumber = comphelper::string::toInt32(sHref.subView( nIndex2, nLength )); + sal_Int32 nPageNumber = o3tl::toInt32(sHref.subView( nIndex2, nLength )); if ( nPageNumber ) { const OUString aSlideType( sHref.copy( 0, nIndex2 ) ); diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index a8f19a335cbc..47bfb27fc1da 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -23,7 +23,7 @@ #include <rtl/ustrbuf.hxx> #include <sax/fastattribs.hxx> #include <oox/token/tokenmap.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox { @@ -254,12 +254,12 @@ OptValue< util::DateTime > AttributeList::getDateTime( sal_Int32 nAttrToken ) co (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':'); if( bValid ) { - aDateTime.Year = static_cast< sal_uInt16 >( comphelper::string::toInt32(aValue.subView( 0, 4 )) ); - aDateTime.Month = static_cast< sal_uInt16 >( comphelper::string::toInt32(aValue.subView( 5, 2 )) ); - aDateTime.Day = static_cast< sal_uInt16 >( comphelper::string::toInt32(aValue.subView( 8, 2 )) ); - aDateTime.Hours = static_cast< sal_uInt16 >( comphelper::string::toInt32(aValue.subView( 11, 2 )) ); - aDateTime.Minutes = static_cast< sal_uInt16 >( comphelper::string::toInt32(aValue.subView( 14, 2 )) ); - aDateTime.Seconds = static_cast< sal_uInt16 >( comphelper::string::toInt32(aValue.subView( 17, 2 )) ); + aDateTime.Year = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 0, 4 )) ); + aDateTime.Month = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 5, 2 )) ); + aDateTime.Day = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 8, 2 )) ); + aDateTime.Hours = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 11, 2 )) ); + aDateTime.Minutes = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 14, 2 )) ); + aDateTime.Seconds = static_cast< sal_uInt16 >( o3tl::toInt32(aValue.subView( 17, 2 )) ); } return OptValue< util::DateTime >( bValid, aDateTime ); } diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index f960e819417f..9b3a1491a435 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -63,7 +63,7 @@ #include <oox/token/properties.hxx> #include <oox/token/tokens.hxx> #include <tools/diagnose_ex.h> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox::ole { @@ -838,8 +838,8 @@ void AxControlModelBase::importProperty( sal_Int32 nPropId, const OUString& rVal OSL_ENSURE( nSepPos >= 0, "AxControlModelBase::importProperty - missing separator in 'Size' property" ); if( nSepPos >= 0 ) { - maSize.first = comphelper::string::toInt32(rValue.subView( 0, nSepPos )); - maSize.second = comphelper::string::toInt32(rValue.subView( nSepPos + 1 )); + maSize.first = o3tl::toInt32(rValue.subView( 0, nSepPos )); + maSize.second = o3tl::toInt32(rValue.subView( nSepPos + 1 )); } } break; diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index f334d100a05d..d83737250550 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -42,7 +42,7 @@ #include <oox/ppt/slidepersist.hxx> #include <oox/token/tokens.hxx> #include <oox/token/properties.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace ::oox::core; using namespace ::oox::drawingml; @@ -474,7 +474,7 @@ void PPTShape::addShape( if (xNamed->getName().startsWith(aTitleText, &sRest) && (sRest.isEmpty() || (sRest.startsWith(" (") && sRest.endsWith(")") - && comphelper::string::toInt32(sRest.subView(2, sRest.getLength() - 3)) > 0))) + && o3tl::toInt32(sRest.subView(2, sRest.getLength() - 3)) > 0))) nCount++; } Reference<container::XNamed> xName(rSlidePersist.getPage(), UNO_QUERY_THROW); @@ -621,7 +621,7 @@ void PPTShape::addShape( sal_Int32 nPageNumber = 0; static const OUStringLiteral sSlide = u"Slide "; if (sURL.match(sSlide)) - nPageNumber = comphelper::string::toInt32(sURL.subView(sSlide.getLength())); + nPageNumber = o3tl::toInt32(sURL.subView(sSlide.getLength())); Reference<drawing::XDrawPagesSupplier> xDPS(rFilterBase.getModel(), uno::UNO_QUERY_THROW); Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 2d5f18af81d5..66176d0a485a 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -20,7 +20,7 @@ #include <comphelper/anytostring.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <tools/multisel.hxx> #include <tools/diagnose_ex.h> @@ -132,10 +132,10 @@ static void ResolveTextFields( XmlFilterBase const & rFilter ) bool bNotes = false; sal_Int32 nPageNumber = 0; if ( aURL.match( sSlide ) ) - nPageNumber = comphelper::string::toInt32(aURL.subView( sSlide.getLength() )); + nPageNumber = o3tl::toInt32(aURL.subView( sSlide.getLength() )); else if ( aURL.match( sNotes ) ) { - nPageNumber = comphelper::string::toInt32(aURL.subView( sNotes.getLength() )); + nPageNumber = o3tl::toInt32(aURL.subView( sNotes.getLength() )); bNotes = true; } if ( nPageNumber ) @@ -193,7 +193,7 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector<CustomShow>& OUString sCustomSlide = rCustomShowList[i].maSldLst[j]; sal_Int32 nPageNumber = 0; if (sCustomSlide.match(sSlide)) - nPageNumber = comphelper::string::toInt32(sCustomSlide.subView(sSlide.getLength())); + nPageNumber = o3tl::toInt32(sCustomSlide.subView(sSlide.getLength())); Reference<XDrawPage> xPage; xDrawPages->getByIndex(nPageNumber - 1) >>= xPage; diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx index aa64ce397caa..ea587298baa1 100644 --- a/oox/source/vml/vmldrawing.cxx +++ b/oox/source/vml/vmldrawing.cxx @@ -38,7 +38,7 @@ #include <oox/vml/vmlshapecontainer.hxx> #include <tools/diagnose_ex.h> #include <tools/gen.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox::vml { @@ -66,7 +66,7 @@ OUString lclGetShapeId( sal_Int32 nShapeId ) sal_Int32 lclGetShapeId( const OUString& rShapeId ) { // identifier consists of a literal NUL character, a lowercase 's', and the id - return ((rShapeId.getLength() >= 3) && (rShapeId[ 0 ] == '\0') && (rShapeId[ 1 ] == 's')) ? comphelper::string::toInt32(rShapeId.subView( 2 )) : -1; + return ((rShapeId.getLength() >= 3) && (rShapeId[ 0 ] == '\0') && (rShapeId[ 1 ] == 's')) ? o3tl::toInt32(rShapeId.subView( 2 )) : -1; } } // namespace diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index a93996d94289..5967e7be0f34 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -45,7 +45,7 @@ #include <oox/token/tokens.hxx> #include <svx/svdtrans.hxx> #include <comphelper/propertysequence.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <vcl/virdev.hxx> namespace oox::vml { @@ -275,7 +275,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, // try palette colors enclosed in brackets if( (aColorIndex.getLength() >= 3) && (aColorIndex[ 0 ] == '[') && (aColorIndex[ aColorIndex.getLength() - 1 ] == ']') ) { - aDmlColor.setPaletteClr( comphelper::string::toInt32(aColorIndex.subView( 1, aColorIndex.getLength() - 2 )) ); + aDmlColor.setPaletteClr( o3tl::toInt32(aColorIndex.subView( 1, aColorIndex.getLength() - 2 )) ); return aDmlColor; } @@ -292,7 +292,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, case XML_darken: nModToken = XML_shade;break; case XML_lighten: nModToken = XML_tint; } - sal_Int32 nValue = comphelper::string::toInt32(aColorIndex.subView( nOpenParen + 1, nCloseParen - nOpenParen - 1 )); + sal_Int32 nValue = o3tl::toInt32(aColorIndex.subView( nOpenParen + 1, nCloseParen - nOpenParen - 1 )); if( (nModToken != XML_TOKEN_INVALID) && (0 <= nValue) && (nValue < 255) ) { /* Simulate this modifier color by a color with related transformation. @@ -337,7 +337,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r if ( state != START && state != UNSUPPORTED ) { if ( nTokenLen > 0 ) - aCoordList.push_back( comphelper::string::toInt32(rPath.subView( nTokenStart, nTokenLen )) ); + aCoordList.push_back( o3tl::toInt32(rPath.subView( nTokenStart, nTokenLen )) ); else aCoordList.push_back( 0 ); nTokenLen = 0; diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index a0768503560b..c5ccb9346289 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -69,7 +69,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/storagehelper.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::uno::Any; @@ -314,7 +314,7 @@ void ShapeBase::finalizeFragmentImport() static const OUStringLiteral sShapeTypePrefix = u"shapetype_"; OUString tmp; if (aType.startsWith(sShapeTypePrefix)) { - maTypeModel.moShapeType = comphelper::string::toInt32(aType.subView(sShapeTypePrefix.getLength())); + maTypeModel.moShapeType = o3tl::toInt32(aType.subView(sShapeTypePrefix.getLength())); } else if (aType.startsWith("_x0000_t", &tmp)) { maTypeModel.moShapeType = tmp.toInt32(); @@ -378,8 +378,8 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS if (idPos < seqPos) { auto idPosEnd = idPos+2; - id = comphelper::string::toInt32(sLinkChainName.subView(idPosEnd, seqPos - idPosEnd)); - seq = comphelper::string::toInt32(sLinkChainName.subView(seqPos+2)); + id = o3tl::toInt32(sLinkChainName.subView(idPosEnd, seqPos - idPosEnd)); + seq = o3tl::toInt32(sLinkChainName.subView(seqPos+2)); } } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index d41539083917..d5e7996cbada 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -35,7 +35,7 @@ #include <osl/diagnose.h> #include <filter/msfilter/escherex.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox::vml { @@ -300,7 +300,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent, if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) ) { mrTypeModel.maShapeId = mrTypeModel.maShapeName; - mrTypeModel.moShapeType = comphelper::string::toInt32(mrTypeModel.maShapeName.subView(sShapeTypePrefix.getLength())); + mrTypeModel.moShapeType = o3tl::toInt32(mrTypeModel.maShapeName.subView(sShapeTypePrefix.getLength())); } else if (mrTypeModel.maShapeName.startsWith("_x0000_t", &tmp)) { diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index 6d67c59a863a..d10d87c39a49 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -28,7 +28,7 @@ #include <sal/log.hxx> #include <rtl/character.hxx> #include <rtl/math.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <global.hxx> #include <rangeutl.hxx> @@ -449,7 +449,7 @@ Label_fallback_to_unambiguous: const sal_Int32 nLimit[done] = {0,12,31,0,59,59,0}; State eState = (bDate ? month : minute); rCurFmtType = (bDate ? SvNumFormatType::DATE : SvNumFormatType::TIME); - nUnit[eState-1] = comphelper::string::toInt32(rStr.subView( 0, nParseEnd)); + nUnit[eState-1] = o3tl::toInt32(rStr.subView( 0, nParseEnd)); const sal_Unicode* pLastStart = p; // Ensure there's no preceding sign. Negative dates // currently aren't handled correctly. Also discard @@ -475,7 +475,7 @@ Label_fallback_to_unambiguous: // We had at least one digit. if (eState < done) { - nUnit[eState] = comphelper::string::toInt32(rStr.subView( pLastStart - pStart, p - pLastStart)); + nUnit[eState] = o3tl::toInt32(rStr.subView( pLastStart - pStart, p - pLastStart)); if (nLimit[eState] && nLimit[eState] < nUnit[eState]) rError = nStringNoValueError; } @@ -546,7 +546,7 @@ Label_fallback_to_unambiguous: // Catch the very last unit at end of string. if (p > pLastStart && eState < done) { - nUnit[eState] = comphelper::string::toInt32(rStr.subView( pLastStart - pStart, p - pLastStart)); + nUnit[eState] = o3tl::toInt32(rStr.subView( pLastStart - pStart, p - pLastStart)); if (nLimit[eState] && nLimit[eState] < nUnit[eState]) rError = nStringNoValueError; } diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index c0443dcf155a..5105d9c36654 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -47,6 +47,7 @@ #include <editutil.hxx> #include <listenercontext.hxx> #include <scopetools.hxx> +#include <o3tl/string_view.hxx> #include <math.h> #include <memory> @@ -80,7 +81,7 @@ short lcl_DecompValueString( OUString& rValue, sal_Int32& nVal, sal_uInt16* pMin // Otherwise, use the number at the end, to enable things like IP addresses. if ( nNum > nSign && ( cNext == 0 || cNext == ' ' || !CharClass::isAsciiNumeric(OUString(cLast)) ) ) { // number at the beginning - nVal = comphelper::string::toInt32(rValue.subView( 0, nNum )); + nVal = o3tl::toInt32(rValue.subView( 0, nNum )); // any number with a leading zero sets the minimum number of digits if ( p[nSign] == '0' && pMinDigits && ( nNum - nSign > *pMinDigits ) ) *pMinDigits = nNum - nSign; @@ -100,7 +101,7 @@ short lcl_DecompValueString( OUString& rValue, sal_Int32& nVal, sal_uInt16* pMin } if ( nNum < nEnd - nSign ) { // number at the end - nVal = comphelper::string::toInt32(rValue.subView( nNum + 1 )); + nVal = o3tl::toInt32(rValue.subView( nNum + 1 )); // any number with a leading zero sets the minimum number of digits if ( p[nNum+1+nSign] == '0' && pMinDigits && ( nEnd - nNum - nSign > *pMinDigits ) ) *pMinDigits = nEnd - nNum - nSign; diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index 8ac06679ccfc..c4582cef0884 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -34,7 +34,7 @@ #include <defnamesbuffer.hxx> #include <externallinkbuffer.hxx> #include <tablebuffer.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox::xls { @@ -1146,7 +1146,7 @@ const FunctionInfo* FormulaParserImpl::resolveBadFuncName( const OUString& rToke sal_Int32 nExclamation = rTokenData.indexOf( '!' ); if( (0 == nBracketOpen) && (nBracketOpen + 1 < nBracketClose) && (nBracketClose + 1 == nExclamation) && (nExclamation + 1 < rTokenData.getLength()) ) { - sal_Int32 nRefId = comphelper::string::toInt32(rTokenData.subView( nBracketOpen + 1, nBracketClose - nBracketOpen - 1 )); + sal_Int32 nRefId = o3tl::toInt32(rTokenData.subView( nBracketOpen + 1, nBracketClose - nBracketOpen - 1 )); const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get(); if( pExtLink && (pExtLink->getLinkType() == ExternalLinkType::Library) ) { @@ -1740,7 +1740,7 @@ bool lclExtractRefId( sal_Int32& rnRefId, OUString& rRemainder, const OUString& sal_Int32 nBracketClose = rFormulaString.indexOf( ']', 1 ); if( nBracketClose >= 2 ) { - rnRefId = comphelper::string::toInt32(rFormulaString.subView( 1, nBracketClose - 1 )); + rnRefId = o3tl::toInt32(rFormulaString.subView( 1, nBracketClose - 1 )); rRemainder = rFormulaString.copy( nBracketClose + 1 ); return !rRemainder.isEmpty(); } diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index e2a8aaa59a49..a757d8d23d43 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -49,7 +49,7 @@ #include <document.hxx> #include <biffhelper.hxx> #include <filter/msfilter/util.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox::xls { @@ -851,8 +851,8 @@ void HeaderFooterParser::convertFontColor( const OUString& rColor ) if( (rColor[ 2 ] == '+') || (rColor[ 2 ] == '-') ) // theme color: TTSNNN (TT = decimal theme index, S = +/-, NNN = decimal tint/shade in percent) maFontModel.maColor.setTheme( - comphelper::string::toInt32(rColor.subView( 0, 2 )), - static_cast< double >( comphelper::string::toInt32(rColor.subView( 2 )) ) / 100.0 ); + o3tl::toInt32(rColor.subView( 0, 2 )), + static_cast< double >( o3tl::toInt32(rColor.subView( 2 )) ) / 100.0 ); else // RGB color: RRGGBB maFontModel.maColor.setRgb( ::Color(ColorTransparency, rColor.toUInt32( 16 )) ); diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 9b651c384c2f..5d3d4501ca73 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -29,7 +29,7 @@ #include <formulaparser.hxx> #include <richstringcontext.hxx> #include <sal/log.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> namespace oox::xls { @@ -296,11 +296,11 @@ void SheetDataContext::importRow( const AttributeList& rAttribs ) if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) ) { // OOXML uses 1-based integer column indexes, row model expects 0-based colspans - const sal_Int32 nCol1 = comphelper::string::toInt32(aColSpanToken.subView( 0, nSepPos )) - 1; + const sal_Int32 nCol1 = o3tl::toInt32(aColSpanToken.subView( 0, nSepPos )) - 1; const bool bValid1 = mrAddressConv.checkCol( nCol1, true); if (bValid1) { - const sal_Int32 nCol2 = comphelper::string::toInt32(aColSpanToken.subView( nSepPos + 1 )) - 1; + const sal_Int32 nCol2 = o3tl::toInt32(aColSpanToken.subView( nSepPos + 1 )) - 1; mrAddressConv.checkCol( nCol2, true); aModel.insertColSpan( ValueRange( nCol1, ::std::min( nCol2, nMaxCol ))); } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 519e612c01bc..bbc4f014eb18 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -26,7 +26,7 @@ #include <sal/log.hxx> #include <unotools/charclass.hxx> #include <osl/module.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <global.hxx> #include <docsh.hxx> @@ -1258,8 +1258,8 @@ static bool lcl_PutString( { using namespace ::com::sun::star; bool bSecondCal = false; - sal_uInt16 nDay = static_cast<sal_uInt16>(comphelper::string::toInt32(rStr.subView( nStart[nDP], nEnd[nDP]+1-nStart[nDP] ))); - sal_uInt16 nYear = static_cast<sal_uInt16>(comphelper::string::toInt32(rStr.subView( nStart[nYP], nEnd[nYP]+1-nStart[nYP] ))); + sal_uInt16 nDay = static_cast<sal_uInt16>(o3tl::toInt32(rStr.subView( nStart[nDP], nEnd[nDP]+1-nStart[nDP] ))); + sal_uInt16 nYear = static_cast<sal_uInt16>(o3tl::toInt32(rStr.subView( nStart[nYP], nEnd[nYP]+1-nStart[nYP] ))); OUString aMStr = rStr.copy( nStart[nMP], nEnd[nMP]+1-nStart[nMP] ); sal_Int16 nMonth = static_cast<sal_Int16>(aMStr.toInt32()); if (!nMonth) @@ -1324,11 +1324,11 @@ static bool lcl_PutString( // time fields to zero (ICU calendar instance defaults to current date/time) nHour = nMinute = nSecond = 0; if (nFound > 3) - nHour = static_cast<sal_Int16>(comphelper::string::toInt32(rStr.subView( nStart[3], nEnd[3]+1-nStart[3]))); + nHour = static_cast<sal_Int16>(o3tl::toInt32(rStr.subView( nStart[3], nEnd[3]+1-nStart[3]))); if (nFound > 4) - nMinute = static_cast<sal_Int16>(comphelper::string::toInt32(rStr.subView( nStart[4], nEnd[4]+1-nStart[4]))); + nMinute = static_cast<sal_Int16>(o3tl::toInt32(rStr.subView( nStart[4], nEnd[4]+1-nStart[4]))); if (nFound > 5) - nSecond = static_cast<sal_Int16>(comphelper::string::toInt32(rStr.subView( nStart[5], nEnd[5]+1-nStart[5]))); + nSecond = static_cast<sal_Int16>(o3tl::toInt32(rStr.subView( nStart[5], nEnd[5]+1-nStart[5]))); // do not use calendar's milliseconds, to avoid fractional part truncation double fFrac = 0.0; if (nFound > 6) diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index b714f4d5e697..d1427a8a3c28 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -24,7 +24,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/basedlgs.hxx> #include <vcl/commandevent.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <acredlin.hxx> #include <global.hxx> @@ -1651,7 +1651,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool) } else { - int nDialogCol = comphelper::string::toInt32(sCommand.subView(8)); + int nDialogCol = o3tl::toInt32(sCommand.subView(8)); pTheView->HeaderBarClick(nDialogCol); } } diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 03a0a0d18b9b..fff458c854e6 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -26,7 +26,7 @@ #include <com/sun/star/xml/sax/SAXParseException.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <editeng/outlobj.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> @@ -696,11 +696,11 @@ bool SdXMLFilter::Import( ErrCode& nError ) sal_Int32 nIndex = sBuildId.indexOf('$'); if( nIndex != -1 ) { - sal_Int32 nUPD = comphelper::string::toInt32(sBuildId.subView( 0, nIndex )); + sal_Int32 nUPD = o3tl::toInt32(sBuildId.subView( 0, nIndex )); if( nUPD == 300 ) { - sal_Int32 nBuildId = comphelper::string::toInt32(sBuildId.subView( nIndex+1 )); + sal_Int32 nBuildId = o3tl::toInt32(sBuildId.subView( nIndex+1 )); if( (nBuildId > 0) && (nBuildId < 9316) ) bTransform = true; // treat OOo 3.0 beta1 as OOo 2.x } diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx index 53e9373a37d5..affa21b03978 100644 --- a/sd/source/ui/presenter/PresenterTextView.cxx +++ b/sd/source/ui/presenter/PresenterTextView.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/i18n/ScriptType.hpp> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -370,11 +370,11 @@ sal_Int32 PresenterTextView::Implementation::ParseDistance (const OUString& rsDi sal_Int32 nDistance (0); if (rsDistance.endsWith("px")) { - nDistance = comphelper::string::toInt32(rsDistance.subView(0,rsDistance.getLength()-2)); + nDistance = o3tl::toInt32(rsDistance.subView(0,rsDistance.getLength()-2)); } else if (rsDistance.endsWith("l")) { - const sal_Int32 nLines (comphelper::string::toInt32(rsDistance.subView(0,rsDistance.getLength()-1))); + const sal_Int32 nLines (o3tl::toInt32(rsDistance.subView(0,rsDistance.getLength()-1))); // Take the height of the first line as the height of every line. const sal_uInt32 nFirstLineHeight (mpEditEngine->GetLineHeight(0)); nDistance = nFirstLineHeight * nLines; diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 9f9e9a3c3c87..891839f6b977 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -255,19 +255,19 @@ std::string_view LineParser::readNextToken() void LineParser::readInt32( sal_Int32& o_Value ) { std::string_view tok = readNextToken(); - o_Value = comphelper::string::toInt32(tok); + o_Value = o3tl::toInt32(tok); } sal_Int32 LineParser::readInt32() { std::string_view tok = readNextToken(); - return comphelper::string::toInt32(tok); + return o3tl::toInt32(tok); } void LineParser::readInt64( sal_Int64& o_Value ) { std::string_view tok = readNextToken(); - o_Value = comphelper::string::toInt64(tok); + o_Value = o3tl::toInt64(tok); } void LineParser::readDouble( double& o_Value ) diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 1b47ce57c3ba..caf18f5157ad 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -84,6 +84,7 @@ #include <sfx2/filedlghelper.hxx> #include <sfx2/templatedlg.hxx> #include <sfx2/sfxsids.hrc> +#include <o3tl/string_view.hxx> #include <openuriexternally.hxx> #include <officecfg/Office/ProtocolHandler.hxx> @@ -596,7 +597,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { if ( aCommand.startsWith("slot:") ) { - sal_uInt16 nSlotId = static_cast<sal_uInt16>(comphelper::string::toInt32(aCommand.subView(5))); + sal_uInt16 nSlotId = static_cast<sal_uInt16>(o3tl::toInt32(aCommand.subView(5))); if ( nSlotId == SID_OPENDOC ) pFileNameItem = nullptr; } diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 268e4dcf70fd..097ab1a5aee7 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -38,6 +38,7 @@ #include <workwin.hxx> #include <sfx2/sfxsids.hrc> +#include <o3tl/string_view.hxx> const sal_uInt16 nVersion = 2; @@ -389,7 +390,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI // Read version char cToken = ','; sal_Int32 nPos = aWinData.indexOf( cToken ); - sal_uInt16 nActVersion = static_cast<sal_uInt16>(comphelper::string::toInt32(aWinData.subView( 0, nPos + 1 ))); + sal_uInt16 nActVersion = static_cast<sal_uInt16>(o3tl::toInt32(aWinData.subView( 0, nPos + 1 ))); if ( nActVersion != nVersion ) return; @@ -406,12 +407,12 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI if ( nNextPos != -1 ) { // there is extra information - rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(comphelper::string::toInt32(aWinData.subView( nPos+1, nNextPos - nPos - 1 )))); + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(o3tl::toInt32(aWinData.subView( nPos+1, nNextPos - nPos - 1 )))); aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, u"" ); rInfo.aExtraString = aWinData; } else - rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(comphelper::string::toInt32(aWinData.subView( nPos+1 )))); + rInfo.nFlags = static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(o3tl::toInt32(aWinData.subView( nPos+1 )))); } bool ParentIsFloatingWindow(const vcl::Window *pParent) diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 7301949775ab..4d6d74e1fca0 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <tools/stream.hxx> #include <comphelper/string.hxx> @@ -49,13 +50,13 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) nIndex = 0; OString sTmp(sLine.getToken(0, ':', nIndex)); if (sTmp == "StartHTML") - nStt = comphelper::string::toInt32(sLine.subView(nIndex)); + nStt = o3tl::toInt32(sLine.subView(nIndex)); else if (sTmp == "EndHTML") - nEnd = comphelper::string::toInt32(sLine.subView(nIndex)); + nEnd = o3tl::toInt32(sLine.subView(nIndex)); else if (sTmp == "StartFragment") - nFragStart = comphelper::string::toInt32(sLine.subView(nIndex)); + nFragStart = o3tl::toInt32(sLine.subView(nIndex)); else if (sTmp == "EndFragment") - nFragEnd = comphelper::string::toInt32(sLine.subView(nIndex)); + nFragEnd = o3tl::toInt32(sLine.subView(nIndex)); else if (sTmp == "SourceURL") sBaseURL = OStringToOUString( sLine.subView(nIndex), RTL_TEXTENCODING_UTF8 ); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 382aa47ed591..3c652adb89c7 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -127,6 +127,7 @@ #include <sfx2/digitalsignatures.hxx> #include <sfx2/viewfrm.hxx> #include <comphelper/threadpool.hxx> +#include <o3tl/string_view.hxx> #include <condition_variable> #include <com/sun/star/io/WrongFormatException.hpp> @@ -3661,7 +3662,7 @@ void SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision ) sal_Int32 nLength = pImpl->aVersions.getLength(); for ( const auto& rVersion : std::as_const(pImpl->aVersions) ) { - sal_uInt32 nVer = static_cast<sal_uInt32>( comphelper::string::toInt32(rVersion.Identifier.subView(7))); + sal_uInt32 nVer = static_cast<sal_uInt32>( o3tl::toInt32(rVersion.Identifier.subView(7))); size_t n; for ( n=0; n<aLongs.size(); ++n ) if ( nVer<aLongs[n] ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index b30690b57245..0e7d373c43b9 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -70,6 +70,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/namedvaluecollection.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <svl/itemset.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> @@ -3559,7 +3560,7 @@ static void ConvertSlotsToCommands( SfxObjectShell const * pDoc, Reference< cont GetCommandFromSequence( aCommand, nIndex, aSeqPropValue ); if ( nIndex >= 0 && aCommand.startsWith( "slot:" ) ) { - const sal_uInt16 nSlot = comphelper::string::toInt32(aCommand.subView( 5 )); + const sal_uInt16 nSlot = o3tl::toInt32(aCommand.subView( 5 )); // We have to replace the old "slot-Command" with our new ".uno:-Command" const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( nSlot ); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b5503ae55d46..eb0020669cd6 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -20,7 +20,9 @@ #include <stdio.h> #include <string_view> +#include <o3tl/string_view.hxx> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> #include <tools/long.hxx> @@ -1614,7 +1616,7 @@ static bool lcl_matchKeywordAndGetNumber( const OUString & rString, const sal_In { if (0 <= nPos && nPos + rKeyword.getLength() < rString.getLength() && rString.matchIgnoreAsciiCase( rKeyword, nPos)) { - nNumber = comphelper::string::toInt32(rString.subView( nPos + rKeyword.getLength())); + nNumber = o3tl::toInt32(rString.subView( nPos + rKeyword.getLength())); return true; } else diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index f5a0d4161efb..49248a03cf57 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <comphelper/propertyvalue.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <o3tl/any.hxx> #include <svl/itempool.hxx> #include <editeng/memberids.h> @@ -213,7 +213,7 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u const OUString& aEntryName = pEntry->GetName(); if(aEntryName.getLength() >= aUser.getLength()) { - sal_Int32 nThisIndex = comphelper::string::toInt32(aEntryName.subView( aUser.getLength() )); + sal_Int32 nThisIndex = o3tl::toInt32(aEntryName.subView( aUser.getLength() )); if( nThisIndex >= nUserIndex ) nUserIndex = nThisIndex + 1; } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 992f163084c3..7859d73fb844 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1279,7 +1279,7 @@ static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32 if (o3tl::starts_with(rName, rCmpName)) { // Only get and set the Flag - const sal_Int32 nNum = comphelper::string::toInt32(rName.substr(nNmLen)) - 1; + const sal_Int32 nNum = o3tl::toInt32(rName.substr(nNmLen)) - 1; if (nNum >= 0) rSetFlags.push_back(nNum); } @@ -1485,7 +1485,7 @@ void SwDoc::SetAllUniqueFlyNames() if ( pNum ) { - const sal_Int32 nNewLen = comphelper::string::toInt32(aNm.subView( nLen )); + const sal_Int32 nNewLen = o3tl::toInt32(aNm.subView( nLen )); if (*pNum < nNewLen) *pNum = nNewLen; } diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 4c6c1da80880..a7d3af37439d 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -49,6 +49,7 @@ #include <comphelper/string.hxx> #include <comphelper/random.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <tools/datetimeutils.hxx> @@ -2610,7 +2611,7 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c if( sNm.startsWith( aName ) ) { // Determine Number and set the Flag - nNum = o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(sNm.subView( nNmLen ))); + nNum = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sNm.subView( nNmLen ))); if( nNum-- && nNum < mpNumRuleTable->size() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 1905578b0646..83310172e852 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -21,7 +21,7 @@ #include <hintids.hxx> #include <editeng/formatbreakitem.hxx> #include <comphelper/classids.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <docsh.hxx> #include <ndole.hxx> #include <txttxmrk.hxx> @@ -668,7 +668,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, if ( rNm.startsWith(aName) ) { // Calculate number and set the Flag - nNum = comphelper::string::toInt32(rNm.subView( nNmLen )); + nNum = o3tl::toInt32(rNm.subView( nNmLen )); if( nNum-- && nNum < mpSectionFormatTable->size() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index da9c6d96a68c..3c6b26b39366 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -60,7 +60,7 @@ #include <memory> #include "ndsect.hxx" #include <tools/datetimeutils.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> // #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>. // Method now determines the previous/next on its own. Thus, it can be controlled, @@ -1435,7 +1435,7 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const if (rNm.startsWith( aName )) { // Calculate the Number and reset the Flag - nNum = comphelper::string::toInt32(rNm.subView( aName.getLength() )); + nNum = o3tl::toInt32(rNm.subView( aName.getLength() )); if( nNum-- && nNum < mpSectionFormatTable->size() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 34aefecff0b3..eb8eff09c06d 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -44,6 +44,7 @@ #include <ndindex.hxx> #include <frameformats.hxx> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <svl/numformat.hxx> @@ -789,7 +790,7 @@ static sal_Int32 lcl_GetLongBoxNum( OUString& rStr ) } else { - nRet = comphelper::string::toInt32(rStr.subView( 0, nPos )); + nRet = o3tl::toInt32(rStr.subView( 0, nPos )); rStr = rStr.copy( nPos+1 ); } return nRet; diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx b/sw/source/core/unocore/XMLRangeHelper.cxx index 3ce673e24042..0a565b2cf293 100644 --- a/sw/source/core/unocore/XMLRangeHelper.cxx +++ b/sw/source/core/unocore/XMLRangeHelper.cxx @@ -20,7 +20,7 @@ #include "XMLRangeHelper.hxx" #include <rtl/character.hxx> #include <rtl/ustrbuf.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <algorithm> namespace @@ -118,7 +118,7 @@ void lcl_getSingleCellAddressFromXMLString( // parse number for row while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 ) i--; - rOutCell.nRow = (comphelper::string::toInt32(aCellStr.subView( i + 1 ))) - 1; + rOutCell.nRow = (o3tl::toInt32(aCellStr.subView( i + 1 ))) - 1; // a dollar in XML means absolute (whereas in UI it means relative) if( pStrArray[ i ] == aDollar ) { diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 4bb64a369220..836866bef198 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -106,6 +106,7 @@ #include <fesh.hxx> #include <itabenum.hxx> #include <frameformats.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; using ::editeng::SvxBorderLine; @@ -387,7 +388,7 @@ void SwXTextTable::GetCellPosition(const OUString& rCellName, sal_Int32& o_rColu } o_rColumn = nColIdx; - o_rRow = comphelper::string::toInt32(rCellName.subView(nRowPos)) - 1; // - 1 because indices ought to be 0 based + o_rRow = o3tl::toInt32(rCellName.subView(nRowPos)) - 1; // - 1 because indices ought to be 0 based } /** compare position of two cells (check rows first) diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index c37efe6ee713..17e53f30802c 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -29,7 +29,7 @@ #include <frameformats.hxx> #include <sfx2/docfile.hxx> #include <sfx2/sfxsids.hrc> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <strings.hrc> @@ -45,7 +45,7 @@ SwASCWriter::SwASCWriter( std::u16string_view rFltNm ) if( 5 < rFltNm.size() ) { std::u16string_view aFilterNum = rFltNm.substr( 5 ); - switch( comphelper::string::toInt32(aFilterNum) ) + switch( o3tl::toInt32(aFilterNum) ) { case 437: aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_437 ); break; case 850: aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_850 ); break; diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index cefef48647dc..b9b8f32aadd3 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -107,12 +107,12 @@ sal_uInt16 SwHTMLWriter::GetDefListLvl( std::u16string_view rNm, sal_uInt16 nPoo OUString sDTDD = OOO_STRING_SVTOOLS_HTML_dt " "; if( o3tl::starts_with(rNm, sDTDD) ) // DefinitionList - term - return o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DT; + return o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DT; sDTDD = OOO_STRING_SVTOOLS_HTML_dd " "; if( o3tl::starts_with(rNm, sDTDD) ) // DefinitionList - definition - return o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DD; + return o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DD; return 0; } diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index cf0c6fd4c7a5..7c8de88defdd 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -60,7 +60,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <drawdoc.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; @@ -340,7 +340,7 @@ void WW8Export::OutputLinkedOLE( const OUString& rOleId ) // Output the cPicLocation attribute std::unique_ptr<ww::bytes> pBuf( new ww::bytes ); SwWW8Writer::InsUInt16( *pBuf, NS_sprm::CPicLocation::val ); - SwWW8Writer::InsUInt32( *pBuf, comphelper::string::toInt32(rOleId.subView( 1 )) ); + SwWW8Writer::InsUInt32( *pBuf, o3tl::toInt32(rOleId.subView( 1 )) ); SwWW8Writer::InsUInt16( *pBuf, NS_sprm::CFOle2::val ); pBuf->push_back( 1 ); diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx index 68f3a16219c3..3286e331e49f 100644 --- a/sw/source/ui/vba/vbaparagraphformat.cxx +++ b/sw/source/ui/vba/vbaparagraphformat.cxx @@ -27,7 +27,7 @@ #include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include "vbatabstops.hxx" -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -188,7 +188,7 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() if( aHeading.startsWith( HEADING ) ) { // get the sub string after "Heading" - nLevel = comphelper::string::toInt32(aHeading.subView( HEADING.getLength() )); + nLevel = o3tl::toInt32(aHeading.subView( HEADING.getLength() )); } return nLevel; } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 23c4f1c1464e..2b0b280d14ce 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1081,7 +1081,7 @@ void SwDocShell::Execute(SfxRequest& rReq) } else if ( sTmpl.startsWith(aOutline) ) { - nTemplateOutlineLevel = comphelper::string::toInt32(sTmpl.subView(aOutline.getLength())); //get string behind "Outline: Level "; + nTemplateOutlineLevel = o3tl::toInt32(sTmpl.subView(aOutline.getLength())); //get string behind "Outline: Level "; bCreateByOutlineLevel = true; } diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index e4b1597bc9f2..4bf95499394b 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <tools/resary.hxx> #include <osl/diagnose.h> #include <sfx2/dispatch.hxx> @@ -1233,7 +1234,7 @@ bool SwFieldMgr::InsertField( nExpPos = rData.m_sPar1.indexOf(DB_DELIM, nCmdTypePos); if (nExpPos>=0) { - aDBData.nCommandType = comphelper::string::toInt32(rData.m_sPar1.subView(nCmdTypePos, nExpPos++ - nCmdTypePos)); + aDBData.nCommandType = o3tl::toInt32(rData.m_sPar1.subView(nCmdTypePos, nExpPos++ - nCmdTypePos)); } } } @@ -1631,7 +1632,7 @@ void SwFieldMgr::UpdateCurField(sal_uInt32 nFormat, static_cast<SwGetRefField*>(pTmpField.get())->SetSubType( o3tl::narrowing<sal_uInt16>(rPar2.toInt32()) ); const sal_Int32 nPos = rPar2.indexOf( '|' ); if( nPos>=0 ) - static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rPar2.subView( nPos + 1 )))); + static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rPar2.subView( nPos + 1 )))); } break; case SwFieldTypesEnum::Dropdown: diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index dea682f77d11..a5f5a5fb209f 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -33,7 +33,7 @@ #include <redlndlg.hxx> #include <swwait.hxx> #include <uitool.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <cmdid.h> #include <strings.hrc> @@ -1288,7 +1288,7 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool) } else if (!sCommand.isEmpty()) { - int nSortMode = comphelper::string::toInt32(sCommand.subView(10)); + int nSortMode = o3tl::toInt32(sCommand.subView(10)); if (nSortMode == 4 && nColumn == 4) return true; // we already have it diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 8484919c5a58..5e7fba530d49 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -152,6 +152,7 @@ #include <ndtxt.hxx> #include <svx/srchdlg.hxx> +#include <o3tl/string_view.hxx> const char sStatusDelim[] = " : "; @@ -2160,7 +2161,7 @@ auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& rName) SAL_WARN("sw.ui", "JumpToTOXMark: missing separator"); return std::optional<std::pair<SwTOXMark, sal_Int32>>(); } - sal_Int32 const counter(comphelper::string::toInt32(rName.subView(0, first))); + sal_Int32 const counter(o3tl::toInt32(rName.subView(0, first))); if (counter <= 0) { SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter"); @@ -2307,7 +2308,7 @@ bool SwView::JumpToSwMark( std::u16string_view rMark ) sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator ); if ( nNoPos != -1 ) { - sal_uInt16 nSeqNo = comphelper::string::toInt32(sName.subView( nNoPos + 1 )); + sal_uInt16 nSeqNo = o3tl::toInt32(sName.subView( nNoPos + 1 )); sName = sName.copy( 0, nNoPos ); bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, nSeqNo); } diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 62c3397bf11c..31ec42ff75ea 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -500,7 +500,7 @@ void SwOneExampleFrame::PopupHdl(std::string_view rId) std::string_view sZoomValue; if (o3tl::starts_with(rId, "zoom", &sZoomValue)) { - sal_Int16 nZoom = comphelper::string::toInt32(sZoomValue); + sal_Int16 nZoom = o3tl::toInt32(sZoomValue); uno::Reference< view::XViewSettingsSupplier > xSettings(m_xController, uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings(); diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx index 1d46d8ca9a29..10228b72aedc 100644 --- a/ucbhelper/source/client/proxydecider.cxx +++ b/ucbhelper/source/client/proxydecider.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/util/XChangesNotifier.hpp> #include <cppuhelper/implbase.hxx> #include <ucbhelper/proxydecider.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #ifdef _WIN32 #include <o3tl/char16_t2wchar_t.hxx> @@ -519,7 +519,7 @@ DWORD WINAPI GetPACProxyThread(_In_ LPVOID lpParameter) sal_Int32 nPortSepPos = sProxyResult.indexOf(':'); if (nPortSepPos != -1) { - pData->m_ProxyServer.nPort = comphelper::string::toInt32(sProxyResult.subView(nPortSepPos + 1)); + pData->m_ProxyServer.nPort = o3tl::toInt32(sProxyResult.subView(nPortSepPos + 1)); sProxyResult = sProxyResult.copy(0, nPortSepPos); } else @@ -591,7 +591,7 @@ InternetProxyServer GetUnixSystemProxy(const OUString & rProtocol) sal_Int32 x = tmp.indexOf(':'); if (x == -1) return aProxy; - int nPort = comphelper::string::toInt32(tmp.subView(x + 1)); + int nPort = o3tl::toInt32(tmp.subView(x + 1)); if (nPort == 0) return aProxy; aProxy.aName = tmp.copy(0, x); diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 98c8aac403de..3872d5a92120 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -293,8 +293,8 @@ static void lcl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource // Get order numbers from entry name without prefix. // e.g. "m10" => 10 // "m5" => 5 - sal_Int32 n1 = comphelper::string::toInt32(s1.substr( 1 )); - sal_Int32 n2 = comphelper::string::toInt32(s2.substr( 1 )); + sal_Int32 n1 = o3tl::toInt32(s1.substr( 1 )); + sal_Int32 n2 = o3tl::toInt32(s2.substr( 1 )); // MUST be in [0,1] ... because it's a difference between // insert-positions of given entries in sorted list! return( n1<n2 ); diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx index 1adaf286e817..d7b2ad8bf16c 100644 --- a/vbahelper/source/vbahelper/vbalineformat.cxx +++ b/vbahelper/source/vbahelper/vbalineformat.cxx @@ -104,7 +104,7 @@ ScVbaLineFormat::getBeginArrowheadStyle() { sal_Int32 nIndex = sLineName.indexOf( ' ' ); OUString sName = sLineName.copy( 0, nIndex ); - //sal_Int32 nSize = comphelper::string::toInt32(sLineName.subView( nIndex + 1 )); + //sal_Int32 nSize = o3tl::toInt32(sLineName.subView( nIndex + 1 )); nLineType = convertLineStartEndNameToArrowheadStyle( sName ); } else diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 95dff5f634e2..7fe9e482936b 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -25,6 +25,7 @@ #include <tools/diagnose_ex.h> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <officecfg/Office/Common.hxx> #include <vcl/svapp.hxx> #include <vcl/event.hxx> @@ -1195,7 +1196,7 @@ static sal_uInt16 ImplCutNumberFromString( OUString& rStr ) while (i2 != rStr.getLength() && rStr[i2] >= '0' && rStr[i2] <= '9') { ++i2; } - sal_Int32 nValue = comphelper::string::toInt32(rStr.subView(i1, i2-i1)); + sal_Int32 nValue = o3tl::toInt32(rStr.subView(i1, i2-i1)); rStr = rStr.copy(std::min(i2+1, rStr.getLength())); return nValue; } @@ -2410,7 +2411,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, tools::Time& rTime, } else { - nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos ))); + nSecond = static_cast<short>(o3tl::toInt32(aStr.subView( 0, nSepPos ))); aStr.remove( 0, nSepPos+1 ); nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() ); @@ -2419,7 +2420,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, tools::Time& rTime, if ( nSepPos >= 0 ) { nMinute = nSecond; - nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos ))); + nSecond = static_cast<short>(o3tl::toInt32(aStr.subView( 0, nSepPos ))); aStr.remove( 0, nSepPos+1 ); nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() ); @@ -2429,7 +2430,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, tools::Time& rTime, { nHour = nMinute; nMinute = nSecond; - nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos ))); + nSecond = static_cast<short>(o3tl::toInt32(aStr.subView( 0, nSepPos ))); aStr.remove( 0, nSepPos+1 ); } else diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index e3f9baa98897..d02e2a0bab49 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -24,7 +24,7 @@ #include <vcl/bitmap.hxx> #include <tools/stream.hxx> #include <tools/UnitConversion.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <bitmap/BitmapWriteAccess.hxx> @@ -582,12 +582,12 @@ util::DateTime PDFiumSignatureImpl::getTime() OString aM(aTimeBuf.data(), aTimeBuf.size() - 1); if (aM.startsWith("D:") && aM.getLength() >= 16) { - aRet.Year = comphelper::string::toInt32(aM.subView(2, 4)); - aRet.Month = comphelper::string::toInt32(aM.subView(6, 2)); - aRet.Day = comphelper::string::toInt32(aM.subView(8, 2)); - aRet.Hours = comphelper::string::toInt32(aM.subView(10, 2)); - aRet.Minutes = comphelper::string::toInt32(aM.subView(12, 2)); - aRet.Seconds = comphelper::string::toInt32(aM.subView(14, 2)); + aRet.Year = o3tl::toInt32(aM.subView(2, 4)); + aRet.Month = o3tl::toInt32(aM.subView(6, 2)); + aRet.Day = o3tl::toInt32(aM.subView(8, 2)); + aRet.Hours = o3tl::toInt32(aM.subView(10, 2)); + aRet.Minutes = o3tl::toInt32(aM.subView(12, 2)); + aRet.Seconds = o3tl::toInt32(aM.subView(14, 2)); } return aRet; } diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 5d7d432bb114..a1f17f46eec5 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -21,7 +21,7 @@ #include <jobdata.hxx> #include <printerinfomanager.hxx> #include <tools/stream.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <rtl/strbuf.hxx> #include <memory> @@ -232,7 +232,7 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo else if (aLine.startsWith(copiesEquals)) { bCopies = true; - rJobData.m_nCopies = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(copiesEquals))); + rJobData.m_nCopies = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(copiesEquals))); } else if (aLine.startsWith(collateEquals)) { @@ -250,22 +250,22 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo else if (aLine.startsWith(colordepthEquals)) { bColorDepth = true; - rJobData.m_nColorDepth = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordepthEquals))); + rJobData.m_nColorDepth = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordepthEquals))); } else if (aLine.startsWith(colordeviceEquals)) { bColorDevice = true; - rJobData.m_nColorDevice = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordeviceEquals))); + rJobData.m_nColorDevice = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordeviceEquals))); } else if (aLine.startsWith(pslevelEquals)) { bPSLevel = true; - rJobData.m_nPSLevel = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals))); + rJobData.m_nPSLevel = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals))); } else if (aLine.startsWith(pdfdeviceEquals)) { bPDFDevice = true; - rJobData.m_nPDFDevice = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals))); + rJobData.m_nPDFDevice = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals))); } else if (aLine == "PPDContextData" && bPrinter) { diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index ba68e1ef011e..8191c98364e1 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -22,6 +22,7 @@ #include <stdlib.h> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <i18nlangtag/languagetag.hxx> #include <ppdparser.hxx> #include <strhelper.hxx> @@ -1526,11 +1527,11 @@ void PPDParser::getResolutionFromString(std::u16string_view rString, const size_t nPos {rString.find( 'x' )}; if( nPos != std::u16string_view::npos ) { - rXRes = comphelper::string::toInt32(rString.substr( 0, nPos )); - rYRes = comphelper::string::toInt32(rString.substr(nPos+1, nDPIPos - nPos - 1)); + rXRes = o3tl::toInt32(rString.substr( 0, nPos )); + rYRes = o3tl::toInt32(rString.substr(nPos+1, nDPIPos - nPos - 1)); } else - rXRes = rYRes = comphelper::string::toInt32(rString.substr( 0, nDPIPos )); + rXRes = rYRes = o3tl::toInt32(rString.substr( 0, nDPIPos )); } } diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index ec74bad06625..98657263a4bc 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -27,7 +27,7 @@ #include <tools/color.hxx> #include <tools/mapunit.hxx> #include <tools/UnitConversion.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace com::sun::star; @@ -674,13 +674,13 @@ util::DateTime ConvertDateStringToDateTime( const OUString& rDateTime ) aDateTime.Year = sal_uInt16( sDate.getToken( 0, '-', nIndex ).toInt32() ); aDateTime.Month = sal_uInt16( sDate.getToken( 0, '-', nIndex ).toInt32() ); if (nIndex != -1) - aDateTime.Day = sal_uInt16( comphelper::string::toInt32(sDate.subView( nIndex )) ); + aDateTime.Day = sal_uInt16( o3tl::toInt32(sDate.subView( nIndex )) ); nIndex = 0; aDateTime.Hours = sal_uInt16( sTime.getToken( 0, ':', nIndex ).toInt32() ); aDateTime.Minutes = sal_uInt16( sTime.getToken( 0, ':', nIndex ).toInt32() ); if (nIndex != -1) - aDateTime.Seconds = sal_uInt16( comphelper::string::toInt32(sTime.subView( nIndex )) ); + aDateTime.Seconds = sal_uInt16( o3tl::toInt32(sTime.subView( nIndex )) ); return aDateTime; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b032726fed1d..597549475936 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -476,7 +476,7 @@ OUString DomainMapper_Impl::GetUnusedPageStyleName() { if ( rStyleName.startsWith( DEFAULT_STYLE ) ) { - sal_Int32 nIndex = comphelper::string::toInt32(rStyleName.subView( strlen( DEFAULT_STYLE ) )); + sal_Int32 nIndex = o3tl::toInt32(rStyleName.subView( strlen( DEFAULT_STYLE ) )); if ( nIndex > nMaxIndex ) nMaxIndex = nIndex; } @@ -5760,7 +5760,7 @@ void DomainMapper_Impl::handleToc { sal_Int32 nIndex = 0; sValue.getToken( 0, '-', nIndex ); - nMaxLevel = static_cast<sal_Int16>(nIndex != -1 ? comphelper::string::toInt32(sValue.subView(nIndex)) : 0); + nMaxLevel = static_cast<sal_Int16>(nIndex != -1 ? o3tl::toInt32(sValue.subView(nIndex)) : 0); } } // \p Defines the separator between the table entry and its page number @@ -6370,7 +6370,7 @@ void DomainMapper_Impl::CloseFieldCommand() if (nStartIndex > 0 && nEndIndex > 0) { // nDown is the requested "lower by" value in points. - sal_Int32 nDown = comphelper::string::toInt32(aCommand.subView(0, nStartIndex)); + sal_Int32 nDown = o3tl::toInt32(aCommand.subView(0, nStartIndex)); OUString aContent = aCommand.copy(nStartIndex + 1, nEndIndex - nStartIndex - 1); PropertyMapPtr pCharContext = GetTopContext(); // dHeight is the font size of the current style. diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2df00afc239a..04ca8cf35b9b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -63,14 +63,14 @@ util::DateTime getDateTimeFromUserProp(const OUString& rString) sal_Int32 nLen = rString.getLength(); if (nLen >= 4) { - aRet.Year = comphelper::string::toInt32(rString.subView(0, 4)); + aRet.Year = o3tl::toInt32(rString.subView(0, 4)); if (nLen >= 8 && rString.match(". ", 4)) { - aRet.Month = comphelper::string::toInt32(rString.subView(6, 2)); + aRet.Month = o3tl::toInt32(rString.subView(6, 2)); if (nLen >= 12 && rString.match(". ", 8)) - aRet.Day = comphelper::string::toInt32(rString.subView(10, 2)); + aRet.Day = o3tl::toInt32(rString.subView(10, 2)); } } return aRet; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index b5aaf117cf45..31c48ba6ff9d 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -57,7 +57,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> using namespace com::sun::star; using namespace ::xmloff::token; @@ -181,7 +181,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr nPos = rStr.indexOf( aSpace, nLastPos ); if( nPos > nLastPos ) { - aVec.push_back( comphelper::string::toInt32(rStr.subView( nLastPos, (nPos - nLastPos) )) ); + aVec.push_back( o3tl::toInt32(rStr.subView( nLastPos, (nPos - nLastPos) )) ); } if( nPos != -1 ) nLastPos = nPos + 1; @@ -190,7 +190,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr if( nLastPos != 0 && rStr.getLength() > nLastPos ) { - aVec.push_back( comphelper::string::toInt32(rStr.subView( nLastPos )) ); + aVec.push_back( o3tl::toInt32(rStr.subView( nLastPos )) ); } const sal_Int32 nVecSize = aVec.size(); diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx index 1e61b1f52a58..e7e765132113 100644 --- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx +++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx @@ -21,7 +21,7 @@ #include <o3tl/safeint.hxx> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <algorithm> using namespace ::com::sun::star; @@ -95,7 +95,7 @@ bool UnoInterfaceToUniqueIdentifierMapper::registerReference( const OUString& rI // the identifier is a pure integer value // so we make sure we will never generate // an integer value like this one - sal_Int32 nId = comphelper::string::toInt32(rIdentifier.subView(2)); + sal_Int32 nId = o3tl::toInt32(rIdentifier.subView(2)); if (nId > 0 && mnNextId <= o3tl::make_unsigned(nId)) mnNextId = nId + 1; diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index e18769e9f6a4..38a6be15e6cb 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -73,6 +73,7 @@ #include <unotools/fontcvt.hxx> #include <fasttokenhandler.hxx> #include <vcl/GraphicExternalLink.hxx> +#include <o3tl/string_view.hxx> #include <com/sun/star/rdf/XMetadatable.hpp> #include <com/sun/star/rdf/XRepositorySupplier.hpp> @@ -1830,11 +1831,11 @@ bool SvXMLImport::getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const sal_Int32 nIndex = aBuildId.indexOf('$'); if (nIndex != -1) { - rUPD = comphelper::string::toInt32(aBuildId.subView( 0, nIndex )); + rUPD = o3tl::toInt32(aBuildId.subView( 0, nIndex )); sal_Int32 nIndexEnd = aBuildId.indexOf(';', nIndex); rBuild = (nIndexEnd == -1) - ? comphelper::string::toInt32(aBuildId.subView(nIndex + 1)) - : comphelper::string::toInt32(aBuildId.subView(nIndex + 1, nIndexEnd - nIndex - 1)); + ? o3tl::toInt32(aBuildId.subView(nIndex + 1)) + : o3tl::toInt32(aBuildId.subView(nIndex + 1, nIndexEnd - nIndex - 1)); bRet = true; } } diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx b/xmloff/source/xforms/SchemaRestrictionContext.cxx index 68da0bdd95c9..2f44f1cd1f6e 100644 --- a/xmloff/source/xforms/SchemaRestrictionContext.cxx +++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/xsd/DataTypeClass.hpp> #include <com/sun/star/xsd/WhiteSpaceTreatment.hpp> -#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <tools/diagnose_ex.h> @@ -151,11 +151,11 @@ static Any xforms_date( const OUString& rValue ) { util::Date aDate; aDate.Year = static_cast<sal_uInt16>( - comphelper::string::toInt32(rValue.subView( 0, nPos1 )) ); + o3tl::toInt32(rValue.subView( 0, nPos1 )) ); aDate.Month = static_cast<sal_uInt16>( - comphelper::string::toInt32(rValue.subView( nPos1 + 1, nPos2 - nPos1 - 1 )) ); + o3tl::toInt32(rValue.subView( nPos1 + 1, nPos2 - nPos1 - 1 )) ); aDate.Day = static_cast<sal_uInt16>( - comphelper::string::toInt32(rValue.subView( nPos2 + 1 )) ); + o3tl::toInt32(rValue.subView( nPos2 + 1 )) ); aAny <<= aDate; } return aAny; |