diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-08 14:05:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-08 20:44:43 +0200 |
commit | 3e7679738413054c7e6ce973380eac501bf41cf2 (patch) | |
tree | ad80f5bd2f11020fa864488792b6cc0e98a00207 /oox | |
parent | 3bfac2a7fad9737f31443292699bd6fee6ac3a6f (diff) |
move comphelper::string::toInt32 to o3tl
so we can use it in places where we cannot include comphelper
Change-Id: Iba0ba3e4c0dcf0f9d1f09092a77c3b2010ec4f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132732
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/docprop/docprophandler.cxx | 18 | ||||
-rw-r--r-- | oox/source/drawingml/customshapepresetdata.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/customshapeproperties.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/hyperlinkcontext.cxx | 4 | ||||
-rw-r--r-- | oox/source/helper/attributelist.cxx | 14 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 6 | ||||
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 6 | ||||
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 8 | ||||
-rw-r--r-- | oox/source/vml/vmldrawing.cxx | 4 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 8 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 8 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 4 |
12 files changed, 45 insertions, 45 deletions
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)) { |