include/xmloff/prstylei.hxx                       |    2 
 include/xmloff/txtimp.hxx                         |    2 
 include/xmloff/xmlimp.hxx                         |    4 -
 include/xmloff/xmlmetai.hxx                       |    2 
 xmloff/inc/EnhancedCustomShapeToken.hxx           |    2 
 xmloff/source/chart/SchXMLChartContext.cxx        |   28 +++++------
 xmloff/source/chart/SchXMLTools.cxx               |   14 ++---
 xmloff/source/chart/SchXMLTools.hxx               |    2 
 xmloff/source/core/xmlimp.cxx                     |   10 ++--
 xmloff/source/draw/EnhancedCustomShapeToken.cxx   |    4 -
 xmloff/source/draw/ximpcustomshape.cxx            |   54 +++++++++++-----------
 xmloff/source/draw/ximpstyl.cxx                   |    8 +--
 xmloff/source/draw/ximpstyl.hxx                   |    2 
 xmloff/source/meta/xmlmetai.cxx                   |   43 ++++++++---------
 xmloff/source/style/prstylei.cxx                  |    4 -
 xmloff/source/style/xmlnumfi.cxx                  |    4 -
 xmloff/source/text/txtimp.cxx                     |    4 -
 xmloff/source/transform/FormPropOASISTContext.cxx |    4 -
 xmloff/source/transform/FormPropOASISTContext.hxx |    2 
 19 files changed, 98 insertions(+), 97 deletions(-)

New commits:
commit 776ea34deefe7bdce2fb8a06e5c55ef27ec87ea7
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Sep 21 11:09:46 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Sep 21 15:46:10 2022 +0200

    use more string_view in xmloff
    
    Change-Id: Ieef49d049760e557d341f1991f28333b09220c1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140336
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx
index 98df0c4ead52..eac79e0ea877 100644
--- a/include/xmloff/prstylei.hxx
+++ b/include/xmloff/prstylei.hxx
@@ -52,7 +52,7 @@ public:
     // Helper to check if the local maProperties contains the given
     // FillStyle tag and if the FillStyle there is different from 
FillStyle_NONE
     bool doNewDrawingLayerFillStyleDefinitionsExist(
-        const OUString& rFillStyleTag) const;
+        std::u16string_view rFillStyleTag) const;
 
 protected:
 
diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 0124bc8eb2c2..cc617393e1b4 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -159,7 +159,7 @@ public:
     // insert a string without special whitespace processing enabled
     void InsertString( const OUString& rChars );
     // insert a string with special whitespace processing enabled
-    void InsertString( const OUString& rChars,
+    void InsertString( std::u16string_view rChars,
                        bool& rIgnoreLeadingSpace );
     // Delete current paragraph
     void DeleteParagraph();
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 8e8856a6895d..14c7b92556b1 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -394,7 +394,7 @@ public:
     static OUString getNamespacePrefixFromToken(sal_Int32 nToken, const 
SvXMLNamespaceMap* pMap);
     static OUString getNamespaceURIFromToken( sal_Int32 nToken );
     static OUString getNamespacePrefixFromURI( const OUString& rURI );
-    static sal_Int32 getTokenFromName(const OUString& sName);
+    static sal_Int32 getTokenFromName(std::u16string_view sName);
 
     SvXMLNamespaceMap& GetNamespaceMap() { return *mxNamespaceMap; }
     const SvXMLNamespaceMap& GetNamespaceMap() const { return *mxNamespaceMap; 
}
@@ -421,7 +421,7 @@ public:
 
     css::uno::Reference< css::io::XOutputStream > 
GetStreamForGraphicObjectURLFromBase64() const;
 
-    bool IsPackageURL( const OUString& rURL ) const;
+    bool IsPackageURL( std::u16string_view rURL ) const;
     OUString ResolveEmbeddedObjectURL( const OUString& rURL,
                                        std::u16string_view rClassId );
     css::uno::Reference< css::io::XOutputStream >
diff --git a/include/xmloff/xmlmetai.hxx b/include/xmloff/xmlmetai.hxx
index 786ca63a017f..640ea4ad9060 100644
--- a/include/xmloff/xmlmetai.hxx
+++ b/include/xmloff/xmlmetai.hxx
@@ -54,7 +54,7 @@ public:
 public:
     void FinishMetaElement();
 
-    static void setBuildId(const OUString & rGenerator,
+    static void setBuildId(std::u16string_view rGenerator,
         const css::uno::Reference< css::beans::XPropertySet>& xImportInfo );
 };
 
diff --git a/xmloff/inc/EnhancedCustomShapeToken.hxx 
b/xmloff/inc/EnhancedCustomShapeToken.hxx
index 4438ba1260e5..dc0206fcb0c7 100644
--- a/xmloff/inc/EnhancedCustomShapeToken.hxx
+++ b/xmloff/inc/EnhancedCustomShapeToken.hxx
@@ -155,7 +155,7 @@ namespace xmloff::EnhancedCustomShapeToken {
         EAS_NotFound
     };
 
-    EnhancedCustomShapeTokenEnum EASGet( const OUString& );
+    EnhancedCustomShapeTokenEnum EASGet( std::u16string_view );
     EnhancedCustomShapeTokenEnum EASGet( sal_Int32 nToken );
     OUString EASGet( const EnhancedCustomShapeTokenEnum );
 }
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx 
b/xmloff/source/chart/SchXMLChartContext.cxx
index 5400a0030db4..2fe91b2026a1 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -171,32 +171,32 @@ void lcl_removeEmptyChartTypeGroups( const 
uno::Reference< chart2::XChartDocumen
     }
 }
 
-uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& 
rStr, bool bAddOneToEachOldIndex )
+uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( 
std::u16string_view rStr, bool bAddOneToEachOldIndex )
 {
     const sal_Unicode aSpace( ' ' );
 
     // count number of entries
     ::std::vector< sal_Int32 > aVec;
-    sal_Int32 nLastPos = 0;
-    sal_Int32 nPos = 0;
-    while( nPos != -1 )
+    size_t nLastPos = 0;
+    size_t nPos = 0;
+    while( nPos != std::u16string_view::npos )
     {
-        nPos = rStr.indexOf( aSpace, nLastPos );
+        nPos = rStr.find( aSpace, nLastPos );
         if( nPos > nLastPos )
         {
-            aVec.push_back( o3tl::toInt32(rStr.subView( nLastPos, (nPos - 
nLastPos) )) );
+            aVec.push_back( o3tl::toInt32(rStr.substr( nLastPos, (nPos - 
nLastPos) )) );
         }
-        if( nPos != -1 )
+        if( nPos != std::u16string_view::npos )
             nLastPos = nPos + 1;
     }
     // last entry
     if( nLastPos != 0 &&
-        rStr.getLength() > nLastPos )
+        rStr.size() > nLastPos )
     {
-        aVec.push_back( o3tl::toInt32(rStr.subView( nLastPos )) );
+        aVec.push_back( o3tl::toInt32(rStr.substr( nLastPos )) );
     }
 
-    const sal_Int32 nVecSize = aVec.size();
+    const size_t nVecSize = aVec.size();
     uno::Sequence< sal_Int32 > aSeq( nVecSize );
 
     if(!bAddOneToEachOldIndex)
@@ -623,8 +623,8 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram(
         , css::chart::ChartDataRowSource eDataRowSource
         , bool bRowHasLabels, bool bColHasLabels
         , bool bSwitchOnLabelsAndCategoriesForOwnData
-        , const OUString& sColTrans
-        , const OUString& sRowTrans )
+        , std::u16string_view sColTrans
+        , std::u16string_view sRowTrans )
 {
     if( !xNewDoc.is() )
         return;
@@ -660,12 +660,12 @@ static void lcl_ApplyDataFromRectangularRangeToDiagram(
            beans::PropertyState_DIRECT_VALUE )
     };
 
-    if( !sColTrans.isEmpty() || !sRowTrans.isEmpty() )
+    if( !sColTrans.empty() || !sRowTrans.empty() )
     {
         aArgs.realloc( aArgs.getLength() + 1 );
         aArgs.getArray()[ sal::static_int_cast<sal_uInt32>(aArgs.getLength()) 
- 1 ] = beans::PropertyValue(
             "SequenceMapping",
-            -1, uno::Any( !sColTrans.isEmpty()
+            -1, uno::Any( !sColTrans.empty()
                 ? lcl_getNumberSequenceFromString( sColTrans, bHasCateories && 
!xNewDoc->hasInternalDataProvider() )
                 : lcl_getNumberSequenceFromString( sRowTrans, bHasCateories && 
!xNewDoc->hasInternalDataProvider() ) ),
         beans::PropertyState_DIRECT_VALUE );
diff --git a/xmloff/source/chart/SchXMLTools.cxx 
b/xmloff/source/chart/SchXMLTools.cxx
index 99dc811c4dc2..b6299a4b0ed7 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -271,7 +271,7 @@ OUString GetChartTypeByClassName(
 }
 
 XMLTokenEnum getTokenByChartType(
-    const OUString & rChartTypeService, bool bUseOldNames )
+    std::u16string_view rChartTypeService, bool bUseOldNames )
 {
     XMLTokenEnum eResult = XML_TOKEN_INVALID;
     OUString aPrefix, aPostfix;
@@ -287,15 +287,15 @@ XMLTokenEnum getTokenByChartType(
         aPostfix = "ChartType";
     }
 
-    if( rChartTypeService.match( aPrefix ))
+    if( o3tl::starts_with(rChartTypeService, aPrefix))
     {
         sal_Int32 nSkip = aPrefix.getLength();
-        SAL_WARN_IF( rChartTypeService.getLength() < nSkip, "xmloff.chart", 
"ChartTypeService.getLength() < nSkip" );
-        sal_Int32 nTypeLength = rChartTypeService.getLength() - nSkip - 
aPostfix.getLength();
+        SAL_WARN_IF( static_cast<sal_Int32>(rChartTypeService.size()) < nSkip, 
"xmloff.chart", "ChartTypeService.getLength() < nSkip" );
+        sal_Int32 nTypeLength = rChartTypeService.size() - nSkip - 
aPostfix.getLength();
         // if postfix matches and leaves a non-empty type
-        if( nTypeLength > 0 && rChartTypeService.match( aPostfix, nSkip + 
nTypeLength ))
+        if( nTypeLength > 0 && 
o3tl::starts_with(rChartTypeService.substr(nSkip + nTypeLength), aPostfix) )
         {
-            std::u16string_view aServiceName( rChartTypeService.subView( 
nSkip, nTypeLength ));
+            std::u16string_view aServiceName( rChartTypeService.substr( nSkip, 
nTypeLength ));
 
             if ( aServiceName == u"Line" )
                 eResult = XML_LINE;
@@ -323,7 +323,7 @@ XMLTokenEnum getTokenByChartType(
         }
     }
 
-    if( eResult == XML_TOKEN_INVALID && !rChartTypeService.isEmpty() )
+    if( eResult == XML_TOKEN_INVALID && !rChartTypeService.empty() )
         eResult = XML_ADD_IN;
 
     return eResult;
diff --git a/xmloff/source/chart/SchXMLTools.hxx 
b/xmloff/source/chart/SchXMLTools.hxx
index 885e57aef7bf..994308a19bc3 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -72,7 +72,7 @@ namespace SchXMLTools
         std::u16string_view rClassName, bool bUseOldNames );
 
     ::xmloff::token::XMLTokenEnum getTokenByChartType(
-        const OUString & rChartTypeService, bool bUseOldNames );
+        std::u16string_view rChartTypeService, bool bUseOldNames );
 
     OUString GetNewChartTypeName( const OUString & rOldChartTypeName );
 
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 885b1c4819b7..e8b4ae2e0f97 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1236,7 +1236,7 @@ const Reference< container::XNameContainer > & 
SvXMLImport::GetDashHelper()
     return mxDashHelper;
 }
 
-bool SvXMLImport::IsPackageURL( const OUString& rURL ) const
+bool SvXMLImport::IsPackageURL( std::u16string_view rURL ) const
 {
 
     // if, and only if, only parts are imported, then we're in a package
@@ -1247,7 +1247,7 @@ bool SvXMLImport::IsPackageURL( const OUString& rURL ) 
const
     // TODO: from this point extract to own static function
 
     // Some quick tests: Some may rely on the package structure!
-    sal_Int32 nLen = rURL.getLength();
+    size_t nLen = rURL.size();
     if( nLen > 0 && '/' == rURL[0] )
         // RFC2396 net_path or abs_path
         return false;
@@ -1263,7 +1263,7 @@ bool SvXMLImport::IsPackageURL( const OUString& rURL ) 
const
     }
 
     // Now check for a RFC2396 schema
-    sal_Int32 nPos = 1;
+    size_t nPos = 1;
     while( nPos < nLen )
     {
         switch( rURL[nPos] )
@@ -2001,10 +2001,10 @@ OUString SvXMLImport::getNamespacePrefixFromURI( const 
OUString& rURI )
         return OUString();
 }
 
-sal_Int32 SvXMLImport::getTokenFromName( const OUString& rName )
+sal_Int32 SvXMLImport::getTokenFromName( std::u16string_view rName )
 {
     Sequence< sal_Int8 > aLocalNameSeq( reinterpret_cast<sal_Int8 const *>(
-        OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr()), 
rName.getLength() );
+        OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr()), 
rName.size() );
     return xTokenHandler->getTokenFromUTF8( aLocalNameSeq );
 }
 
diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx 
b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
index bd0613e9e4b4..d8c54a37044d 100644
--- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -181,10 +181,10 @@ static const TypeNameHashMap& GetNameHashMap()
     return aHashMap;
 }
 
-EnhancedCustomShapeTokenEnum EASGet( const OUString& rShapeType )
+EnhancedCustomShapeTokenEnum EASGet( std::u16string_view rShapeType )
 {
     EnhancedCustomShapeTokenEnum eRetValue = EAS_NotFound;
-    int i, nLen = rShapeType.getLength();
+    size_t i, nLen = rShapeType.size();
     std::unique_ptr<char[]> pBuf(new char[ nLen + 1 ]);
     for ( i = 0; i < nLen; i++ )
         pBuf[ i ] = static_cast<char>(rShapeType[ i ]);
diff --git a/xmloff/source/draw/ximpcustomshape.cxx 
b/xmloff/source/draw/ximpcustomshape.cxx
index fbc32e53eceb..56b9fd4cc47e 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -171,10 +171,10 @@ static void GetB3DVector( std::vector< 
css::beans::PropertyValue >& rDest,
     }
 }
 
-static bool GetEquationName( const OUString& rEquation, const sal_Int32 
nStart, OUString& rEquationName )
+static bool GetEquationName( std::u16string_view rEquation, const sal_Int32 
nStart, OUString& rEquationName )
 {
     sal_Int32 nIndex = nStart;
-    while( nIndex < rEquation.getLength() )
+    while( nIndex < static_cast<sal_Int32>(rEquation.size()) )
     {
         sal_Unicode nChar = rEquation[ nIndex ];
         if (
@@ -190,13 +190,13 @@ static bool GetEquationName( const OUString& rEquation, 
const sal_Int32 nStart,
     }
     bool bValid = ( nIndex - nStart ) != 0;
     if ( bValid )
-        rEquationName = rEquation.copy( nStart, nIndex - nStart );
+        rEquationName = rEquation.substr( nStart, nIndex - nStart );
     return bValid;
 }
 
-static bool GetNextParameter( css::drawing::EnhancedCustomShapeParameter& 
rParameter, sal_Int32& nIndex, const OUString& rParaString )
+static bool GetNextParameter( css::drawing::EnhancedCustomShapeParameter& 
rParameter, sal_Int32& nIndex, std::u16string_view rParaString )
 {
-    if ( nIndex >= rParaString.getLength() )
+    if ( nIndex >= static_cast<sal_Int32>(rParaString.size()) )
         return false;
 
     bool bValid = true;
@@ -226,62 +226,62 @@ static bool GetNextParameter( 
css::drawing::EnhancedCustomShapeParameter& rParam
     else if ( rParaString[ nIndex ] > '9' )
     {
         bNumberRequired = false;
-        if ( rParaString.matchIgnoreAsciiCase( "left", nIndex ) )
+        if ( o3tl::matchIgnoreAsciiCase( rParaString, u"left", nIndex ) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::LEFT;
             nIndex += 4;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "top", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"top", nIndex ) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::TOP;
             nIndex += 3;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "right", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"right", nIndex ) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::RIGHT;
             nIndex += 5;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "bottom", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"bottom", nIndex ) 
)
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::BOTTOM;
             nIndex += 6;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "xstretch", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"xstretch", nIndex 
) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::XSTRETCH;
             nIndex += 8;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "ystretch", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"ystretch", nIndex 
) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::YSTRETCH;
             nIndex += 8;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "hasstroke", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"hasstroke", 
nIndex ) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::HASSTROKE;
             nIndex += 9;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "hasfill", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"hasfill", nIndex 
) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::HASFILL;
             nIndex += 7;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "width", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"width", nIndex ) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::WIDTH;
             nIndex += 5;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "height", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"height", nIndex ) 
)
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::HEIGHT;
             nIndex += 6;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "logwidth", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"logwidth", nIndex 
) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::LOGWIDTH;
             nIndex += 8;
         }
-        else if ( rParaString.matchIgnoreAsciiCase( "logheight", nIndex ) )
+        else if ( o3tl::matchIgnoreAsciiCase( rParaString, u"logheight", 
nIndex ) )
         {
             rParameter.Type = 
css::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT;
             nIndex += 9;
@@ -301,7 +301,7 @@ static bool GetNextParameter( 
css::drawing::EnhancedCustomShapeParameter& rParam
             bool bDot = false;  // set if there is a dot included
             bool bEnd = false;  // set for each value that can not be part of 
a double/integer
 
-            while( ( nIndex < rParaString.getLength() ) && bValid )
+            while( ( nIndex < static_cast<sal_Int32>(rParaString.size()) ) && 
bValid )
             {
                 switch( rParaString[ nIndex ] )
                 {
@@ -383,7 +383,7 @@ static bool GetNextParameter( 
css::drawing::EnhancedCustomShapeParameter& rParam
                 bValid = false;
             if ( bValid )
             {
-                std::u16string_view aNumber( rParaString.subView( nStartIndex, 
nIndex - nStartIndex ) );
+                std::u16string_view aNumber( rParaString.substr( nStartIndex, 
nIndex - nStartIndex ) );
                 if ( bE || bDot )
                 {
                     double fAttrDouble;
@@ -409,7 +409,7 @@ static bool GetNextParameter( 
css::drawing::EnhancedCustomShapeParameter& rParam
         const sal_Unicode aSpace(' ');
         const sal_Unicode aCommata(',');
 
-        while(nIndex < rParaString.getLength())
+        while(nIndex < static_cast<sal_Int32>(rParaString.size()))
         {
             const sal_Unicode aCandidate(rParaString[nIndex]);
 
@@ -503,7 +503,7 @@ static void GetSizeSequence( std::vector< 
css::beans::PropertyValue >& rDest,
 }
 
 static void GetEnhancedParameter( std::vector< css::beans::PropertyValue >& 
rDest,              // e.g. draw:handle-position
-                        const OUString& rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
+                        std::u16string_view rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
 {
     sal_Int32 nIndex = 0;
     css::drawing::EnhancedCustomShapeParameter aParameter;
@@ -517,7 +517,7 @@ static void GetEnhancedParameter( std::vector< 
css::beans::PropertyValue >& rDes
 }
 
 static void GetEnhancedParameterPair( std::vector< css::beans::PropertyValue 
>& rDest,          // e.g. draw:handle-position
-                        const OUString& rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
+                        std::u16string_view rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
 {
     sal_Int32 nIndex = 0;
     css::drawing::EnhancedCustomShapeParameterPair aParameterPair;
@@ -532,7 +532,7 @@ static void GetEnhancedParameterPair( std::vector< 
css::beans::PropertyValue >&
 }
 
 static sal_Int32 GetEnhancedParameterPairSequence( std::vector< 
css::beans::PropertyValue >& rDest,     // e.g. draw:glue-points
-                        const OUString& rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
+                        std::u16string_view rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
 {
     std::vector< css::drawing::EnhancedCustomShapeParameterPair > vParameter;
     css::drawing::EnhancedCustomShapeParameterPair aParameter;
@@ -554,7 +554,7 @@ static sal_Int32 GetEnhancedParameterPairSequence( 
std::vector< css::beans::Prop
 }
 
 static void GetEnhancedRectangleSequence( std::vector< 
css::beans::PropertyValue >& rDest,      // e.g. draw:text-areas
-                        const OUString& rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
+                        std::u16string_view rValue, const 
EnhancedCustomShapeTokenEnum eDestProp )
 {
     std::vector< css::drawing::EnhancedCustomShapeTextFrame > vTextFrame;
     css::drawing::EnhancedCustomShapeTextFrame aParameter;
@@ -579,7 +579,7 @@ static void GetEnhancedRectangleSequence( std::vector< 
css::beans::PropertyValue
 
 static void
 GetEnhancedPath(std::vector<css::beans::PropertyValue>& rDest, // e.g. 
draw:enhanced-path
-                const OUString& rValue, std::u16string_view rType)
+                std::u16string_view rValue, std::u16string_view rType)
 {
     std::vector< css::drawing::EnhancedCustomShapeParameterPair >    
vCoordinates;
     std::vector< css::drawing::EnhancedCustomShapeSegment >      vSegments;
@@ -592,7 +592,7 @@ GetEnhancedPath(std::vector<css::beans::PropertyValue>& 
rDest, // e.g. draw:enha
 
     bool bValid = true;
 
-    while( bValid && ( nIndex < rValue.getLength() ) )
+    while( bValid && ( nIndex < static_cast<sal_Int32>(rValue.size()) ) )
     {
         switch( rValue[ nIndex ] )
         {
@@ -850,7 +850,7 @@ GetEnhancedPath(std::vector<css::beans::PropertyValue>& 
rDest, // e.g. draw:enha
 }
 
 static void GetAdjustmentValues( std::vector< css::beans::PropertyValue >& 
rDest,               // draw:adjustments
-                        const OUString& rValue )
+                        std::u16string_view rValue )
 {
     std::vector< css::drawing::EnhancedCustomShapeAdjustmentValue > 
vAdjustmentValue;
     css::drawing::EnhancedCustomShapeParameter aParameter;
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 5a99bf01a4d6..cc23cee1a885 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -1126,7 +1126,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles() const
     {
         uno::Reference< container::XNameAccess > xGraphicPageStyles( 
GetSdImport().GetLocalDocStyleFamilies()->getByName("graphics"), 
uno::UNO_QUERY_THROW );
 
-        ImpSetGraphicStyles(xGraphicPageStyles, 
XmlStyleFamily::SD_GRAPHICS_ID, OUString());
+        ImpSetGraphicStyles(xGraphicPageStyles, 
XmlStyleFamily::SD_GRAPHICS_ID, u"");
     }
     catch( uno::Exception& )
     {
@@ -1140,7 +1140,7 @@ void SdXMLStylesContext::ImpSetCellStyles() const
     {
         uno::Reference< container::XNameAccess > xGraphicPageStyles( 
GetSdImport().GetLocalDocStyleFamilies()->getByName("cell"), 
uno::UNO_QUERY_THROW );
 
-        ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::TABLE_CELL, 
OUString());
+        ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::TABLE_CELL, 
u"");
     }
     catch( uno::Exception& )
     {
@@ -1182,9 +1182,9 @@ static bool canSkipReset(std::u16string_view rName, const 
XMLPropStyleContext* p
 
 // help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
 
-void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< 
container::XNameAccess > const & xPageStyles,  XmlStyleFamily nFamily,  const 
OUString& rPrefix) const
+void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< 
container::XNameAccess > const & xPageStyles,  XmlStyleFamily nFamily, 
std::u16string_view rPrefix) const
 {
-    sal_Int32 nPrefLen(rPrefix.getLength());
+    sal_Int32 nPrefLen(rPrefix.size());
 
     sal_uInt32 a;
 
diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx
index 00f032e4cb44..b26e46eacd7c 100644
--- a/xmloff/source/draw/ximpstyl.hxx
+++ b/xmloff/source/draw/ximpstyl.hxx
@@ -175,7 +175,7 @@ class SdXMLStylesContext : public SvXMLStylesContext
     void ImpSetGraphicStyles() const;
     void ImpSetCellStyles() const;
     void ImpSetGraphicStyles( css::uno::Reference< css::container::XNameAccess 
> const & xPageStyles,
-        XmlStyleFamily nFamily, const OUString& rPrefix) const;
+        XmlStyleFamily nFamily, std::u16string_view rPrefix) const;
 
 protected:
     using SvXMLStylesContext::CreateStyleChildContext;
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index decbf65c5783..6f75963056b2 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/exc_hlp.hxx>
+#include <o3tl/string_view.hxx>
 #include <rtl/character.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <utility>
@@ -228,29 +229,29 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
SvXMLMetaDocumentContex
     return nullptr;
 }
 
-void SvXMLMetaDocumentContext::setBuildId(OUString const& i_rBuildId, const 
uno::Reference<beans::XPropertySet>& xImportInfo )
+void SvXMLMetaDocumentContext::setBuildId(std::u16string_view i_rBuildId, 
const uno::Reference<beans::XPropertySet>& xImportInfo )
 {
     OUString sBuildId;
     // skip to second product
-    sal_Int32 nBegin = i_rBuildId.indexOf( ' ' );
-    if ( nBegin != -1 )
+    size_t nBegin = i_rBuildId.find( ' ' );
+    if ( nBegin != std::u16string_view::npos )
     {
         // skip to build information
-        nBegin = i_rBuildId.indexOf( '/', nBegin );
-        if ( nBegin != -1 )
+        nBegin = i_rBuildId.find( '/', nBegin );
+        if ( nBegin != std::u16string_view::npos )
         {
-            sal_Int32 nEnd = i_rBuildId.indexOf( 'm', nBegin );
-            if ( nEnd != -1 )
+            size_t nEnd = i_rBuildId.find( 'm', nBegin );
+            if ( nEnd != std::u16string_view::npos )
             {
                 OUStringBuffer sBuffer(
-                    i_rBuildId.subView( nBegin+1, nEnd-nBegin-1 ) );
+                    i_rBuildId.substr( nBegin+1, nEnd-nBegin-1 ) );
                 static const OUStringLiteral sBuildCompare(
                      u"$Build-"  );
-                nBegin = i_rBuildId.indexOf( sBuildCompare, nEnd );
-                if ( nBegin != -1 )
+                nBegin = i_rBuildId.find( sBuildCompare, nEnd );
+                if ( nBegin != std::u16string_view::npos )
                 {
                     sBuffer.append( '$' );
-                    sBuffer.append( i_rBuildId.subView(nBegin + 
sBuildCompare.getLength()) );
+                    sBuffer.append( i_rBuildId.substr(nBegin + 
sBuildCompare.getLength()) );
                     sBuildId = sBuffer.makeStringAndClear();
                 }
             }
@@ -259,15 +260,15 @@ void SvXMLMetaDocumentContext::setBuildId(OUString const& 
i_rBuildId, const uno:
 
     if ( sBuildId.isEmpty() )
     {
-        if (    i_rBuildId.startsWith("StarOffice 7")
-            ||  i_rBuildId.startsWith("StarSuite 7")
-            ||  i_rBuildId.startsWith("StarOffice 6")
-            ||  i_rBuildId.startsWith("StarSuite 6")
-            ||  i_rBuildId.startsWith("OpenOffice.org 1"))
+        if (    o3tl::starts_with(i_rBuildId, u"StarOffice 7")
+            ||  o3tl::starts_with(i_rBuildId, u"StarSuite 7")
+            ||  o3tl::starts_with(i_rBuildId, u"StarOffice 6")
+            ||  o3tl::starts_with(i_rBuildId, u"StarSuite 6")
+            ||  o3tl::starts_with(i_rBuildId, u"OpenOffice.org 1"))
         {
             sBuildId = "645$8687";
         }
-        else if (i_rBuildId.startsWith("NeoOffice/2"))
+        else if (o3tl::starts_with(i_rBuildId, u"NeoOffice/2"))
         {
             sBuildId = "680$9134"; // fake NeoOffice as OpenOffice.org 2.2 
release
         }
@@ -275,12 +276,12 @@ void SvXMLMetaDocumentContext::setBuildId(OUString const& 
i_rBuildId, const uno:
 
     // "LibreOffice_project" was hard-coded since LO 3.3.0
     // see utl::DocInfoHelper::GetGeneratorString()
-    if (i_rBuildId.indexOf("LibreOffice_project/") != -1)
+    if (i_rBuildId.find(u"LibreOffice_project/") != std::u16string_view::npos)
     {
         OUStringBuffer sNumber;
-        auto const firstSlash = i_rBuildId.indexOf("/");
-        assert(firstSlash != -1);
-        for (sal_Int32 i = firstSlash + 1; i < i_rBuildId.getLength(); ++i)
+        size_t const firstSlash = i_rBuildId.find('/');
+        assert(firstSlash != std::u16string_view::npos);
+        for (size_t i = firstSlash + 1; i < i_rBuildId.size(); ++i)
         {
             if (rtl::isAsciiDigit(i_rBuildId[i]))
             {
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index aae787d491c6..a0277bf8a752 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -543,9 +543,9 @@ void XMLPropStyleContext::Finish( bool bOverwrite )
 }
 
 bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
-    const OUString& rFillStyleTag) const
+    std::u16string_view rFillStyleTag) const
 {
-    if(!maProperties.empty() && rFillStyleTag.getLength())
+    if(!maProperties.empty() && !rFillStyleTag.empty())
     {
         // no & to avoid non-obvious UAF due to the 2nd temp Reference
         const rtl::Reference<XMLPropertySetMapper> rMapper = 
GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index bedd13bebcf6..370af2bde369 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1947,10 +1947,10 @@ void SvXMLNumFormatContext::AddNfKeyword( sal_uInt16 
nIndex )
     }
 }
 
-static bool lcl_IsAtEnd( OUStringBuffer& rBuffer, const OUString& rToken )
+static bool lcl_IsAtEnd( OUStringBuffer& rBuffer, std::u16string_view rToken )
 {
     sal_Int32 nBufLen = rBuffer.getLength();
-    sal_Int32 nTokLen = rToken.getLength();
+    sal_Int32 nTokLen = rToken.size();
 
     if ( nTokLen > nBufLen )
         return false;
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index f26ce21e66ab..288ccf45dc9b 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -710,7 +710,7 @@ void XMLTextImportHelper::InsertString( const OUString& 
rChars )
     }
 }
 
-void XMLTextImportHelper::InsertString( const OUString& rChars,
+void XMLTextImportHelper::InsertString( std::u16string_view rChars,
                                         bool& rIgnoreLeadingSpace )
 {
     assert(m_xImpl->m_xText.is());
@@ -718,7 +718,7 @@ void XMLTextImportHelper::InsertString( const OUString& 
rChars,
     if (!m_xImpl->m_xText.is())
         return;
 
-    sal_Int32 nLen = rChars.getLength();
+    sal_Int32 nLen = rChars.size();
     OUStringBuffer sChars( nLen );
 
     for( sal_Int32 i=0; i < nLen; i++ )
diff --git a/xmloff/source/transform/FormPropOASISTContext.cxx 
b/xmloff/source/transform/FormPropOASISTContext.cxx
index 6b29f0da9816..228d960cccca 100644
--- a/xmloff/source/transform/FormPropOASISTContext.cxx
+++ b/xmloff/source/transform/FormPropOASISTContext.cxx
@@ -32,14 +32,14 @@ using namespace ::com::sun::star::xml::sax;
 using namespace ::xmloff::token;
 
 XMLTokenEnum XMLFormPropOASISTransformerContext::GetValueType(
-                const OUString& rValue )
+                std::u16string_view rValue )
 {
     XMLTokenEnum eRet = XML_DOUBLE;
     bool bNeg = false;
     sal_uInt32 nVal = 0;
 
     sal_Int32 nPos = 0;
-    sal_Int32 nLen = rValue.getLength();
+    sal_Int32 nLen = rValue.size();
 
     // skip white space
     while( nPos < nLen && ' ' == rValue[nPos] )
diff --git a/xmloff/source/transform/FormPropOASISTContext.hxx 
b/xmloff/source/transform/FormPropOASISTContext.hxx
index 5a656a629750..4f35d84d1540 100644
--- a/xmloff/source/transform/FormPropOASISTContext.hxx
+++ b/xmloff/source/transform/FormPropOASISTContext.hxx
@@ -27,7 +27,7 @@ class XMLFormPropOASISTransformerContext :
     bool const m_bIsList;
     bool const m_bIsListValue;
 
-    static ::xmloff::token::XMLTokenEnum GetValueType( const OUString& rValue 
);
+    static ::xmloff::token::XMLTokenEnum GetValueType( std::u16string_view 
rValue );
 
 public:
     XMLFormPropOASISTransformerContext( XMLTransformerBase& rTransformer,

Reply via email to