summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-08 14:05:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-08 20:44:43 +0200
commit3e7679738413054c7e6ce973380eac501bf41cf2 (patch)
treead80f5bd2f11020fa864488792b6cc0e98a00207 /sc
parent3bfac2a7fad9737f31443292699bd6fee6ac3a6f (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 'sc')
-rw-r--r--sc/source/core/data/global2.cxx8
-rw-r--r--sc/source/core/data/table4.cxx5
-rw-r--r--sc/source/filter/oox/formulaparser.cxx6
-rw-r--r--sc/source/filter/oox/pagesettings.cxx6
-rw-r--r--sc/source/filter/oox/sheetdatacontext.cxx6
-rw-r--r--sc/source/ui/docshell/impex.cxx12
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx4
7 files changed, 24 insertions, 23 deletions
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);
}
}