diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-27 15:15:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-28 08:42:01 +0200 |
commit | ceaff89c973953e283aa881292206c593e5f9c7c (patch) | |
tree | 35394077d755495ad8dc4a08ce5649ae77bc99bb /oox | |
parent | 3c3f41dc11957c1ee8e8e06fbf197cae28d7671b (diff) |
use more string_view in oox
Change-Id: Ib0d7015a898073d51ac2638d62a19eadcba37685
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/presetgeometrynames.hxx | 4 | ||||
-rw-r--r-- | oox/source/core/filterbase.cxx | 4 | ||||
-rw-r--r-- | oox/source/crypto/Standard2007Engine.cxx | 6 | ||||
-rw-r--r-- | oox/source/docprop/docprophandler.cxx | 24 | ||||
-rw-r--r-- | oox/source/docprop/docprophandler.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/presetgeometrynames.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/theme.cxx | 14 | ||||
-rw-r--r-- | oox/source/dump/dumperbase.cxx | 66 | ||||
-rw-r--r-- | oox/source/dump/oledumper.cxx | 6 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 4 | ||||
-rw-r--r-- | oox/source/ole/vbacontrol.cxx | 12 | ||||
-rw-r--r-- | oox/source/ole/vbaexport.cxx | 20 | ||||
-rw-r--r-- | oox/source/vml/vmldrawing.cxx | 6 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 8 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 6 |
15 files changed, 95 insertions, 95 deletions
diff --git a/oox/inc/drawingml/presetgeometrynames.hxx b/oox/inc/drawingml/presetgeometrynames.hxx index 1dc46b86f61b..8499bb634ca9 100644 --- a/oox/inc/drawingml/presetgeometrynames.hxx +++ b/oox/inc/drawingml/presetgeometrynames.hxx @@ -14,8 +14,8 @@ namespace PresetGeometryTypeNames { -OUString GetFontworkType(const OUString& rMsoType); -OUString GetMsoName(const OUString& rFontworkType); +OUString GetFontworkType(std::u16string_view rMsoType); +OUString GetMsoName(std::u16string_view rFontworkType); } #endif diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 6ae55238c3eb..5357dae3f86b 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -254,10 +254,10 @@ const OUString& FilterBase::getFileUrl() const namespace { -bool lclIsDosDrive( const OUString& rUrl, sal_Int32 nPos = 0 ) +bool lclIsDosDrive( std::u16string_view rUrl, size_t nPos = 0 ) { return - (rUrl.getLength() >= nPos + 3) && + (rUrl.size() >= nPos + 3) && ((('A' <= rUrl[ nPos ]) && (rUrl[ nPos ] <= 'Z')) || (('a' <= rUrl[ nPos ]) && (rUrl[ nPos ] <= 'z'))) && (rUrl[ nPos + 1 ] == ':') && (rUrl[ nPos + 2 ] == '/'); diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index c3b0efad962e..a045046c3bc4 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -67,10 +67,10 @@ bool Standard2007Engine::generateVerifier() return true; } -bool Standard2007Engine::calculateEncryptionKey(const OUString& rPassword) +bool Standard2007Engine::calculateEncryptionKey(std::u16string_view rPassword) { sal_uInt32 saltSize = mInfo.verifier.saltSize; - sal_uInt32 passwordByteLength = rPassword.getLength() * 2; + size_t passwordByteLength = rPassword.size() * 2; const sal_uInt8* saltArray = mInfo.verifier.salt; // Prepare initial data -> salt + password (in 16-bit chars) @@ -78,7 +78,7 @@ bool Standard2007Engine::calculateEncryptionKey(const OUString& rPassword) std::copy(saltArray, saltArray + saltSize, initialData.begin()); auto p = initialData.begin() + saltSize; - for (sal_Int32 i = 0; i != rPassword.getLength(); ++i) { + for (size_t i = 0; i != rPassword.size(); ++i) { auto c = rPassword[i]; *p++ = c & 0xFF; *p++ = c >> 8; diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index 9a23991a47c9..b65ea16999c7 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -93,36 +93,36 @@ void OOXMLDocPropHandler::AddCustomProperty( const uno::Any& aAny ) } } -util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChars ) +util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( std::u16string_view aChars ) { oslDateTime aOslDTime = { 0, 0, 0, 0, 0, 0, 0, 0 }; - const sal_Int32 nLen = aChars.getLength(); + const size_t nLen = aChars.size(); if ( nLen >= 4 ) { - aOslDTime.Year = static_cast<sal_Int16>(o3tl::toInt32(aChars.subView( 0, 4 ))); + aOslDTime.Year = static_cast<sal_Int16>(o3tl::toInt32(aChars.substr( 0, 4 ))); if ( nLen >= 7 && aChars[4] == '-' ) { - aOslDTime.Month = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 5, 2 ))); + aOslDTime.Month = static_cast<sal_uInt16>(o3tl::toInt32(aChars.substr( 5, 2 ))); if ( nLen >= 10 && aChars[7] == '-' ) { - aOslDTime.Day = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 8, 2 ))); + aOslDTime.Day = static_cast<sal_uInt16>(o3tl::toInt32(aChars.substr( 8, 2 ))); if ( nLen >= 16 && aChars[10] == 'T' && aChars[13] == ':' ) { - aOslDTime.Hours = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 11, 2 ))); - aOslDTime.Minutes = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 14, 2 ))); + aOslDTime.Hours = static_cast<sal_uInt16>(o3tl::toInt32(aChars.substr( 11, 2 ))); + aOslDTime.Minutes = static_cast<sal_uInt16>(o3tl::toInt32(aChars.substr( 14, 2 ))); - sal_Int32 nOptTime = 0; + size_t nOptTime = 0; if ( nLen >= 19 && aChars[16] == ':' ) { - aOslDTime.Seconds = static_cast<sal_uInt16>(o3tl::toInt32(aChars.subView( 17, 2 ))); + aOslDTime.Seconds = static_cast<sal_uInt16>(o3tl::toInt32(aChars.substr( 17, 2 ))); nOptTime += 3; if ( nLen >= 20 && aChars[19] == '.' ) { nOptTime += 1; - sal_Int32 digitPos = 20; + size_t digitPos = 20; while (nLen > digitPos && digitPos < 29) { sal_Unicode c = aChars[digitPos]; @@ -163,8 +163,8 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar if ( ( aChars[16 + nOptTime] == '+' || aChars[16 + nOptTime] == '-' ) && aChars[16 + nOptTime + 3] == ':' ) { - nModif = o3tl::toInt32(aChars.subView( 16 + nOptTime + 1, 2 )) * 3600; - nModif += o3tl::toInt32(aChars.subView( 16 + nOptTime + 4, 2 )) * 60; + nModif = o3tl::toInt32(aChars.substr( 16 + nOptTime + 1, 2 )) * 3600; + nModif += o3tl::toInt32(aChars.substr( 16 + nOptTime + 4, 2 )) * 60; if ( aChars[16 + nOptTime] == '-' ) nModif *= -1; } diff --git a/oox/source/docprop/docprophandler.hxx b/oox/source/docprop/docprophandler.hxx index 69e091850348..cdefa8c9a03c 100644 --- a/oox/source/docprop/docprophandler.hxx +++ b/oox/source/docprop/docprophandler.hxx @@ -58,7 +58,7 @@ public: void InitNew(); void AddCustomProperty( const css::uno::Any& aAny ); - static css::util::DateTime GetDateTimeFromW3CDTF( const OUString& aChars ); + static css::util::DateTime GetDateTimeFromW3CDTF( std::u16string_view aChars ); static css::uno::Sequence< OUString > GetKeywordsSet( std::u16string_view aChars ); void UpdateDocStatistic( std::u16string_view aChars ); diff --git a/oox/source/drawingml/presetgeometrynames.cxx b/oox/source/drawingml/presetgeometrynames.cxx index 04dff605c629..fd2807f9d1a0 100644 --- a/oox/source/drawingml/presetgeometrynames.cxx +++ b/oox/source/drawingml/presetgeometrynames.cxx @@ -69,7 +69,7 @@ const PresetGeometryName pPresetGeometryNameArray[] { "textCascadeDown", "fontwork-fade-up-and-left" } }; } -OUString PresetGeometryTypeNames::GetFontworkType(const OUString& rMsoType) +OUString PresetGeometryTypeNames::GetFontworkType(std::u16string_view rMsoType) { static const PresetGeometryHashMap s_HashMap = []() { PresetGeometryHashMap aH; @@ -78,7 +78,7 @@ OUString PresetGeometryTypeNames::GetFontworkType(const OUString& rMsoType) return aH; }(); const char* pRetValue = ""; - int i, nLen = rMsoType.getLength(); + size_t i, nLen = rMsoType.size(); std::unique_ptr<char[]> pBuf(new char[nLen + 1]); for (i = 0; i < nLen; i++) pBuf[i] = static_cast<char>(rMsoType[i]); @@ -90,7 +90,7 @@ OUString PresetGeometryTypeNames::GetFontworkType(const OUString& rMsoType) return OUString(pRetValue, strlen(pRetValue), RTL_TEXTENCODING_ASCII_US); } -OUString PresetGeometryTypeNames::GetMsoName(const OUString& rFontworkType) +OUString PresetGeometryTypeNames::GetMsoName(std::u16string_view rFontworkType) { static const PresetGeometryHashMap s_HashMapInv = []() { PresetGeometryHashMap aHInv; @@ -99,7 +99,7 @@ OUString PresetGeometryTypeNames::GetMsoName(const OUString& rFontworkType) return aHInv; }(); const char* pRetValue = ""; - int i, nLen = rFontworkType.getLength(); + size_t i, nLen = rFontworkType.size(); std::unique_ptr<char[]> pBuf(new char[nLen + 1]); for (i = 0; i < nLen; i++) pBuf[i] = static_cast<char>(rFontworkType[i]); diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index 87bee889538a..f406f829ea91 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -62,14 +62,14 @@ const TextCharacterProperties* Theme::getFontStyle( sal_Int32 nSchemeType ) cons return maFontScheme.get( nSchemeType ).get(); } -const TextFont* Theme::resolveFont( const OUString& rName ) const +const TextFont* Theme::resolveFont( std::u16string_view rName ) const { const TextCharacterProperties* pCharProps = nullptr; /* Resolves the following names: +mj-lt, +mj-ea, +mj-cs -- major Latin, Asian, Complex font +mn-lt, +mn-ea, +mn-cs -- minor Latin, Asian, Complex font */ - if( (rName.getLength() == 6) && (rName[ 0 ] == '+') && (rName[ 3 ] == '-') ) + if( (rName.size() == 6) && (rName[ 0 ] == '+') && (rName[ 3 ] == '-') ) { if( (rName[ 1 ] == 'm') && (rName[ 2 ] == 'j') ) pCharProps = maFontScheme.get( XML_major ).get(); @@ -87,17 +87,17 @@ const TextFont* Theme::resolveFont( const OUString& rName ) const } // See writerfilter::dmapper::ThemeTable::getFontNameForTheme(). - if (rName == "majorHAnsi" || rName == "majorAscii" || rName == "majorBidi" || rName == "majorEastAsia") + if (rName == u"majorHAnsi" || rName == u"majorAscii" || rName == u"majorBidi" || rName == u"majorEastAsia") pCharProps = maFontScheme.get(XML_major).get(); - else if (rName == "minorHAnsi" || rName == "minorAscii" || rName == "minorBidi" || rName == "minorEastAsia") + else if (rName == u"minorHAnsi" || rName == u"minorAscii" || rName == u"minorBidi" || rName == u"minorEastAsia") pCharProps = maFontScheme.get(XML_minor).get(); if (pCharProps) { - if (rName == "majorAscii" || rName == "majorHAnsi" || rName == "minorAscii" || rName == "minorHAnsi") + if (rName == u"majorAscii" || rName == u"majorHAnsi" || rName == u"minorAscii" || rName == u"minorHAnsi") return &pCharProps->maLatinFont; - else if (rName == "minorBidi" || rName == "majorBidi") + else if (rName == u"minorBidi" || rName == u"majorBidi") return &pCharProps->maComplexFont; - else if (rName == "minorEastAsia" || rName == "majorEastAsia") + else if (rName == u"minorEastAsia" || rName == u"majorEastAsia") return &pCharProps->maAsianFont; } return nullptr; diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index e3f0001a3fe3..497795050f38 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -184,7 +184,7 @@ OUStringVector::const_iterator ItemFormat::parse( const OUStringVector& rFormatV return aIt; } -OUStringVector ItemFormat::parse( const OUString& rFormatStr ) +OUStringVector ItemFormat::parse( std::u16string_view rFormatStr ) { OUStringVector aFormatVec; StringHelper::convertStringToStringList( aFormatVec, rFormatStr, false ); @@ -200,9 +200,9 @@ void StringHelper::appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int3 rStr.append( cChar ); } -void StringHelper::appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth, sal_Unicode cFill ) +void StringHelper::appendString( OUStringBuffer& rStr, std::u16string_view rData, sal_Int32 nWidth, sal_Unicode cFill ) { - appendChar( rStr, cFill, nWidth - rData.getLength() ); + appendChar( rStr, cFill, nWidth - rData.size() ); rStr.append( rData ); } @@ -483,11 +483,11 @@ void StringHelper::appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_I } } -void StringHelper::appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix ) +void StringHelper::appendEncString( OUStringBuffer& rStr, std::u16string_view rData, bool bPrefix ) { - sal_Int32 nBeg = 0; - sal_Int32 nIdx = 0; - sal_Int32 nEnd = rData.getLength(); + size_t nBeg = 0; + size_t nIdx = 0; + size_t nEnd = rData.size(); while( nIdx < nEnd ) { // find next character that needs encoding @@ -498,7 +498,7 @@ void StringHelper::appendEncString( OUStringBuffer& rStr, const OUString& rData, if( (nBeg == 0) && (nIdx == nEnd) ) rStr.append( rData ); else - rStr.append( rData.subView(nBeg, nIdx - nBeg) ); + rStr.append( rData.substr(nBeg, nIdx - nBeg) ); } // append characters to be encoded while( (nIdx < nEnd) && (rData[ nIdx ] < 0x20) ) @@ -541,17 +541,17 @@ void StringHelper::enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode namespace { -sal_Int32 lclIndexOf( const OUString& rStr, sal_Unicode cChar, sal_Int32 nStartPos ) +sal_Int32 lclIndexOf( std::u16string_view rStr, sal_Unicode cChar, sal_Int32 nStartPos ) { - sal_Int32 nIndex = rStr.indexOf( cChar, nStartPos ); - return (nIndex < 0) ? rStr.getLength() : nIndex; + size_t nIndex = rStr.find( cChar, nStartPos ); + return (nIndex == std::u16string_view::npos) ? rStr.size() : nIndex; } -OUString lclTrimQuotedStringList( const OUString& rStr ) +OUString lclTrimQuotedStringList( std::u16string_view rStr ) { OUStringBuffer aBuffer; - sal_Int32 nPos = 0; - sal_Int32 nLen = rStr.getLength(); + size_t nPos = 0; + size_t nLen = rStr.size(); while( nPos < nLen ) { if( rStr[ nPos ] == OOX_DUMP_CFG_QUOTE ) @@ -563,8 +563,8 @@ OUString lclTrimQuotedStringList( const OUString& rStr ) do { // seek to next quote character and add text portion to token buffer - sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_QUOTE, nPos ); - aToken.append( rStr.subView(nPos, nEnd - nPos) ); + size_t nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_QUOTE, nPos ); + aToken.append( rStr.substr(nPos, nEnd - nPos) ); // process literal quotes while( (nEnd + 1 < nLen) && (rStr[ nEnd ] == OOX_DUMP_CFG_QUOTE) && (rStr[ nEnd + 1 ] == OOX_DUMP_CFG_QUOTE) ) { @@ -586,8 +586,8 @@ OUString lclTrimQuotedStringList( const OUString& rStr ) else { // find list separator, add token text to buffer - sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos ); - aBuffer.append( rStr.subView(nPos, nEnd - nPos) ); + size_t nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos ); + aBuffer.append( rStr.substr(nPos, nEnd - nPos) ); if( nEnd < nLen ) aBuffer.append( OOX_DUMP_LF ); // set current position behind list separator @@ -760,7 +760,7 @@ OUStringPair StringHelper::convertStringToPair( const OUString& rString, sal_Uni return aPair; } -void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty ) +void StringHelper::convertStringToStringList( OUStringVector& orVec, std::u16string_view rData, bool bIgnoreEmpty ) { orVec.clear(); OUString aUnquotedData = lclTrimQuotedStringList( rData ); @@ -774,7 +774,7 @@ void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUStr } } -void StringHelper::convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty ) +void StringHelper::convertStringToIntList( Int64Vector& orVec, std::u16string_view rData, bool bIgnoreEmpty ) { orVec.clear(); OUString aUnquotedData = lclTrimQuotedStringList( rData ); @@ -918,7 +918,7 @@ const OUString* NameListBase::findRawName( sal_Int64 nKey ) const return (aIt == end()) ? nullptr : &aIt->second; } -void NameListBase::include( const OUString& rListKeys ) +void NameListBase::include( std::u16string_view rListKeys ) { OUStringVector aVec; StringHelper::convertStringToStringList( aVec, rListKeys, true ); @@ -926,7 +926,7 @@ void NameListBase::include( const OUString& rListKeys ) includeList( mrCfgData.getNameList(elem) ); } -void NameListBase::exclude( const OUString& rKeys ) +void NameListBase::exclude( std::u16string_view rKeys ) { Int64Vector aVec; StringHelper::convertStringToIntList( aVec, rKeys, true ); @@ -1352,7 +1352,7 @@ bool SharedConfigData::readConfigFile( const OUString& rFileUrl ) return bLoaded; } -void SharedConfigData::createShortList( const OUString& rData ) +void SharedConfigData::createShortList( std::u16string_view rData ) { OUStringVector aDataVec; StringHelper::convertStringToStringList( aDataVec, rData, false ); @@ -1371,7 +1371,7 @@ void SharedConfigData::createShortList( const OUString& rData ) } } -void SharedConfigData::createUnitConverter( const OUString& rData ) +void SharedConfigData::createUnitConverter( std::u16string_view rData ) { OUStringVector aDataVec; StringHelper::convertStringToStringList( aDataVec, rData, false ); @@ -1641,7 +1641,7 @@ void Output::writeAscii( const char* pcStr ) maLine.appendAscii( pcStr ); } -void Output::writeString( const OUString& rStr ) +void Output::writeString( std::u16string_view rStr ) { StringHelper::appendEncString( maLine, rStr ); } @@ -1686,7 +1686,7 @@ void Output::writeItemName( const String& rItemName ) { if( rItemName.has() && (rItemName[ 0 ] == '#') ) { - writeString( rItemName.copy( 1 ) ); + writeString( rItemName.subView( 1 ) ); StringHelper::appendIndex( maLine, mnItemIdx++ ); } else @@ -1846,7 +1846,7 @@ void StorageObjectBase::addPreferredStorage( const String& rStrgPath ) } OUString StorageObjectBase::getSysFileName( - const OUString& rStrmName, std::u16string_view rSysOutPath ) + std::u16string_view rStrmName, std::u16string_view rSysOutPath ) { // encode all characters < 0x20 OUStringBuffer aBuffer; @@ -1968,16 +1968,16 @@ void OutputObjectBase::writeCharItem( const String& rName, sal_Unicode cData ) mxOut->writeChar( OOX_DUMP_STRQUOTE ); } -void OutputObjectBase::writeStringItem( const String& rName, const OUString& rData ) +void OutputObjectBase::writeStringItem( const String& rName, std::u16string_view rData ) { ItemGuard aItem( mxOut, rName ); mxOut->writeAscii( "(len=" ); - mxOut->writeDec( rData.getLength() ); + mxOut->writeDec( sal_Int32(rData.size()) ); mxOut->writeAscii( ")," ); - OUStringBuffer aValue( rData.subView( 0, ::std::min( rData.getLength(), OOX_DUMP_MAXSTRLEN ) ) ); + OUStringBuffer aValue( rData.substr( 0, ::std::min( sal_Int32(rData.size()), OOX_DUMP_MAXSTRLEN ) ) ); StringHelper::enclose( aValue, OOX_DUMP_STRQUOTE ); mxOut->writeString( aValue.makeStringAndClear() ); - if( rData.getLength() > OOX_DUMP_MAXSTRLEN ) + if( rData.size() > OOX_DUMP_MAXSTRLEN ) mxOut->writeAscii( ",cut" ); } @@ -2354,7 +2354,7 @@ void TextLineStreamObject::implDumpText( TextInputStream& rTextStrm ) } } -void TextLineStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine ) +void TextLineStreamObject::implDumpLine( std::u16string_view rLine, sal_uInt32 nLine ) { TableGuard aTabGuard( mxOut, 8 ); mxOut->writeDec( nLine, 6 ); @@ -2408,7 +2408,7 @@ void XmlStreamObject::implDumpText( TextInputStream& rTextStrm ) the text of the old start element. */ if( (bSimpleElem || bStartElem) && (aOldStartElem.getLength() > 0) ) { - mxOut->writeString( aOldStartElem.makeStringAndClear().trim() ); + mxOut->writeString( o3tl::trim(aOldStartElem.makeStringAndClear()) ); mxOut->newLine(); mxOut->incIndent(); } diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx index 92e67c04590f..931b89f6d685 100644 --- a/oox/source/dump/oledumper.cxx +++ b/oox/source/dump/oledumper.cxx @@ -1827,11 +1827,11 @@ void VbaContainerStorageObject::implDumpStorage( const StorageRef& rxStrg, const OleStorageObject( *this, rxStrg, rSysPath ).dump(); } -bool VbaContainerStorageObject::isFormStorage( const OUString& rStrgPath ) const +bool VbaContainerStorageObject::isFormStorage( std::u16string_view rStrgPath ) const { - if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') ) + if( (rStrgPath.size() >= 3) && (rStrgPath[ 0 ] == 'i') ) { - std::u16string_view aId = rStrgPath.subView( 1 ); + std::u16string_view aId = rStrgPath.substr( 1 ); if( (aId.size() == 2) && (aId[ 0 ] == '0') ) aId = aId.substr( 1 ); sal_Int32 nId = o3tl::toInt32(aId); diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index c1f57996088f..1c45988b2bfe 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -501,14 +501,14 @@ void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamData } void ControlConverter::convertAxState( PropertyMap& rPropMap, - const OUString& rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode, bool bAwtModel ) + std::u16string_view rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode, bool bAwtModel ) { bool bBooleanState = eDefStateMode == API_DEFAULTSTATE_BOOLEAN; bool bSupportsTriState = eDefStateMode == API_DEFAULTSTATE_TRISTATE; // state sal_Int16 nState = bSupportsTriState ? API_STATE_DONTKNOW : API_STATE_UNCHECKED; - if( rValue.getLength() == 1 ) switch( rValue[ 0 ] ) + if( rValue.size() == 1 ) switch( rValue[ 0 ] ) { case '0': nState = API_STATE_UNCHECKED; break; case '1': nState = API_STATE_CHECKED; break; diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 9c2a301635d9..bdfe6b363556 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -729,14 +729,14 @@ bool VbaFormControl::compareByTabIndex( const VbaFormControlRef& rxLeft, const V namespace { -OUString lclGetQuotedString( const OUString& rCodeLine ) +OUString lclGetQuotedString( std::u16string_view rCodeLine ) { OUStringBuffer aBuffer; - sal_Int32 nLen = rCodeLine.getLength(); + size_t nLen = rCodeLine.size(); if( (nLen > 0) && (rCodeLine[ 0 ] == '"') ) { bool bExitLoop = false; - for( sal_Int32 nIndex = 1; !bExitLoop && (nIndex < nLen); ++nIndex ) + for( size_t nIndex = 1; !bExitLoop && (nIndex < nLen); ++nIndex ) { sal_Unicode cChar = rCodeLine[ nIndex ]; // exit on closing quote char (but check on double quote chars) @@ -766,11 +766,11 @@ bool lclEatWhitespace( OUString& rCodeLine ) return false; } -bool lclEatKeyword( OUString& rCodeLine, const OUString& rKeyword ) +bool lclEatKeyword( OUString& rCodeLine, std::u16string_view rKeyword ) { if( rCodeLine.matchIgnoreAsciiCase( rKeyword ) ) { - rCodeLine = rCodeLine.copy( rKeyword.getLength() ); + rCodeLine = rCodeLine.copy( rKeyword.size() ); // success, if code line ends after keyword, or if whitespace follows return rCodeLine.isEmpty() || lclEatWhitespace( rCodeLine ); } @@ -813,7 +813,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, bBeginFound = lclEatKeyword( aLine, aBegin ); } // check for the specific GUID that represents VBA forms - if( !bBeginFound || !lclEatKeyword( aLine, "{C62A69F0-16DC-11CE-9E98-00AA00574A4F}" ) ) + if( !bBeginFound || !lclEatKeyword( aLine, u"{C62A69F0-16DC-11CE-9E98-00AA00574A4F}" ) ) return; // remaining line is the form name diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 97d2a6d0adf5..6d8f47e88c52 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -514,10 +514,10 @@ void writePROJECTCODEPAGE(SvStream& rStrm, const rtl_TextEncoding eTextEncoding) } //section 2.3.4.2.1.5 -void writePROJECTNAME(SvStream& rStrm, const OUString& name, const rtl_TextEncoding eTextEncoding) +void writePROJECTNAME(SvStream& rStrm, std::u16string_view name, const rtl_TextEncoding eTextEncoding) { rStrm.WriteUInt16(0x0004); // id - sal_uInt32 sizeOfProjectName = name.getLength(); + size_t sizeOfProjectName = name.size(); rStrm.WriteUInt32(sizeOfProjectName); // sizeOfProjectName exportString(rStrm, name, eTextEncoding); // ProjectName } @@ -575,7 +575,7 @@ void writePROJECTCONSTANTS(SvStream& rStrm) } // section 2.3.4.2.1 -void writePROJECTINFORMATION(SvStream& rStrm, const OUString& projectName, +void writePROJECTINFORMATION(SvStream& rStrm, std::u16string_view projectName, const rtl_TextEncoding eTextEncoding) { writePROJECTSYSKIND(rStrm); @@ -605,11 +605,11 @@ void writeREFERENCENAME(SvStream& rStrm, const OUString& name, const rtl_TextEnc } // section 2.3.4.2.2.5 -void writeREFERENCEREGISTERED(SvStream& rStrm, const OUString& libid, +void writeREFERENCEREGISTERED(SvStream& rStrm, std::u16string_view libid, const rtl_TextEncoding eTextEncoding) { rStrm.WriteUInt16(0x000D); // id - sal_Int32 sizeOfLibid = libid.getLength(); + size_t sizeOfLibid = libid.size(); sal_Int32 size = sizeOfLibid + 10; // size of Libid, sizeOfLibid(4 bytes), reserved 1(4 bytes) and reserved 2(2 bytes) rStrm.WriteUInt32(size); // size rStrm.WriteUInt32(sizeOfLibid); // sizeOfLibid @@ -619,7 +619,7 @@ void writeREFERENCEREGISTERED(SvStream& rStrm, const OUString& libid, } // section 2.3.4.2.2.1 -void writeREFERENCE(SvStream& rStrm, const OUString& name, const OUString& libid, +void writeREFERENCE(SvStream& rStrm, const OUString& name, std::u16string_view libid, const rtl_TextEncoding eTextEncoding) { writeREFERENCENAME(rStrm, name, eTextEncoding); @@ -630,8 +630,8 @@ void writeREFERENCE(SvStream& rStrm, const OUString& name, const OUString& libid void writePROJECTREFERENCES(SvStream& rStrm, const rtl_TextEncoding eTextEncoding) { // TODO: find out where these references are coming from - writeREFERENCE(rStrm, "stdole", "*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\SysWOW64\\stdole2.tlb#OLE Automation", eTextEncoding); - writeREFERENCE(rStrm, "Office", "*\\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\OFFICE14\\MSO.DLL#Microsoft Office 14.0 Object Library", eTextEncoding); + writeREFERENCE(rStrm, "stdole", u"*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\SysWOW64\\stdole2.tlb#OLE Automation", eTextEncoding); + writeREFERENCE(rStrm, "Office", u"*\\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\OFFICE14\\MSO.DLL#Microsoft Office 14.0 Object Library", eTextEncoding); } // section 2.3.4.2.3.1 @@ -643,10 +643,10 @@ void writePROJECTCOOKIE(SvStream& rStrm) } // section 2.3.4.2.3.2.1 -void writeMODULENAME(SvStream& rStrm, const OUString& name, const rtl_TextEncoding eTextEncoding) +void writeMODULENAME(SvStream& rStrm, std::u16string_view name, const rtl_TextEncoding eTextEncoding) { rStrm.WriteUInt16(0x0019); // id - sal_Int32 n = name.getLength(); // sizeOfModuleName + sal_Int32 n = name.size(); // sizeOfModuleName rStrm.WriteUInt32(n); exportString(rStrm, name, eTextEncoding); // ModuleName } diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx index c38bf96ad7f2..eaa0ecf1c110 100644 --- a/oox/source/vml/vmldrawing.cxx +++ b/oox/source/vml/vmldrawing.cxx @@ -63,10 +63,10 @@ OUString lclGetShapeId( sal_Int32 nShapeId ) } /** Returns the numeric VML shape identifier from its textual representation. */ -sal_Int32 lclGetShapeId( const OUString& rShapeId ) +sal_Int32 lclGetShapeId( std::u16string_view rShapeId ) { // identifier consists of a literal NUL character, a lowercase 's', and the id - return ((rShapeId.getLength() >= 3) && (rShapeId[ 0 ] == '\0') && (rShapeId[ 1 ] == 's')) ? o3tl::toInt32(rShapeId.subView( 2 )) : -1; + return ((rShapeId.size() >= 3) && (rShapeId[ 0 ] == '\0') && (rShapeId[ 1 ] == 's')) ? o3tl::toInt32(rShapeId.substr( 2 )) : -1; } } // namespace @@ -206,7 +206,7 @@ void Drawing::convertAndInsert() const } -sal_Int32 Drawing::getLocalShapeIndex( const OUString& rShapeId ) const +sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view rShapeId ) const { sal_Int32 nShapeId = lclGetShapeId( rShapeId ); if( nShapeId <= 0 ) return -1; diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index c15a1fa3a658..2e96c61bb366 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -315,7 +315,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, return aDmlColor; } -void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& rPointLists, ::std::vector< ::std::vector< PolygonFlags > >& rFlagLists, const OUString& rPath ) +void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& rPointLists, ::std::vector< ::std::vector< PolygonFlags > >& rFlagLists, std::u16string_view rPath ) { ::std::vector< sal_Int32 > aCoordList; Point aCurrentPoint; @@ -330,7 +330,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r rPointLists.emplace_back( ); rFlagLists.emplace_back( ); - for ( sal_Int32 i = 0; i < rPath.getLength(); i++ ) + for ( size_t i = 0; i < rPath.size(); i++ ) { // Keep track of current integer token if ( ( rPath[ i ] >= '0' && rPath[ i ] <= '9' ) || rPath[ i ] == '-' ) @@ -341,7 +341,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r if ( state != START && state != UNSUPPORTED ) { if ( nTokenLen > 0 ) - aCoordList.push_back( o3tl::toInt32(rPath.subView( nTokenStart, nTokenLen )) ); + aCoordList.push_back( o3tl::toInt32(rPath.substr( nTokenStart, nTokenLen )) ); else aCoordList.push_back( 0 ); nTokenLen = 0; @@ -453,7 +453,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r // Allow two-char commands to peek ahead to the next character sal_Unicode nextChar = '\0'; - if (i+1 < rPath.getLength()) + if (i+1 < rPath.size()) nextChar = rPath[i+1]; // Move to relevant state upon finding a command diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 8942d13de842..abbf4fd7f9d6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -115,12 +115,12 @@ awt::Rectangle lclGetAbsRect( const awt::Rectangle& rRelRect, const awt::Rectang } /// Count the crop value based on a crop fraction and a reference size. -sal_Int32 lclConvertCrop(const OUString& rCrop, sal_uInt32 nSize) +sal_Int32 lclConvertCrop(std::u16string_view rCrop, sal_uInt32 nSize) { - if (rCrop.endsWith("f")) + if (o3tl::ends_with(rCrop, u"f")) { // Numeric value is specified in 1/65536-ths. - sal_uInt32 nCrop = o3tl::toUInt32(rCrop.subView(0, rCrop.getLength() - 1)); + sal_uInt32 nCrop = o3tl::toUInt32(rCrop.substr(0, rCrop.size() - 1)); return (nCrop * nSize) / 65536; } |