summaryrefslogtreecommitdiff
path: root/vcl
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 /vcl
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 'vcl')
-rw-r--r--vcl/source/control/field2.cxx9
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx14
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx12
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx7
4 files changed, 22 insertions, 20 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 95dff5f634e2..7fe9e482936b 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -25,6 +25,7 @@
#include <tools/diagnose_ex.h>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
@@ -1195,7 +1196,7 @@ static sal_uInt16 ImplCutNumberFromString( OUString& rStr )
while (i2 != rStr.getLength() && rStr[i2] >= '0' && rStr[i2] <= '9') {
++i2;
}
- sal_Int32 nValue = comphelper::string::toInt32(rStr.subView(i1, i2-i1));
+ sal_Int32 nValue = o3tl::toInt32(rStr.subView(i1, i2-i1));
rStr = rStr.copy(std::min(i2+1, rStr.getLength()));
return nValue;
}
@@ -2410,7 +2411,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, tools::Time& rTime,
}
else
{
- nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos )));
+ nSecond = static_cast<short>(o3tl::toInt32(aStr.subView( 0, nSepPos )));
aStr.remove( 0, nSepPos+1 );
nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
@@ -2419,7 +2420,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, tools::Time& rTime,
if ( nSepPos >= 0 )
{
nMinute = nSecond;
- nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos )));
+ nSecond = static_cast<short>(o3tl::toInt32(aStr.subView( 0, nSepPos )));
aStr.remove( 0, nSepPos+1 );
nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
@@ -2429,7 +2430,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, tools::Time& rTime,
{
nHour = nMinute;
nMinute = nSecond;
- nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos )));
+ nSecond = static_cast<short>(o3tl::toInt32(aStr.subView( 0, nSepPos )));
aStr.remove( 0, nSepPos+1 );
}
else
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index e3f9baa98897..d02e2a0bab49 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -24,7 +24,7 @@
#include <vcl/bitmap.hxx>
#include <tools/stream.hxx>
#include <tools/UnitConversion.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
@@ -582,12 +582,12 @@ util::DateTime PDFiumSignatureImpl::getTime()
OString aM(aTimeBuf.data(), aTimeBuf.size() - 1);
if (aM.startsWith("D:") && aM.getLength() >= 16)
{
- aRet.Year = comphelper::string::toInt32(aM.subView(2, 4));
- aRet.Month = comphelper::string::toInt32(aM.subView(6, 2));
- aRet.Day = comphelper::string::toInt32(aM.subView(8, 2));
- aRet.Hours = comphelper::string::toInt32(aM.subView(10, 2));
- aRet.Minutes = comphelper::string::toInt32(aM.subView(12, 2));
- aRet.Seconds = comphelper::string::toInt32(aM.subView(14, 2));
+ aRet.Year = o3tl::toInt32(aM.subView(2, 4));
+ aRet.Month = o3tl::toInt32(aM.subView(6, 2));
+ aRet.Day = o3tl::toInt32(aM.subView(8, 2));
+ aRet.Hours = o3tl::toInt32(aM.subView(10, 2));
+ aRet.Minutes = o3tl::toInt32(aM.subView(12, 2));
+ aRet.Seconds = o3tl::toInt32(aM.subView(14, 2));
}
return aRet;
}
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 5d7d432bb114..a1f17f46eec5 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -21,7 +21,7 @@
#include <jobdata.hxx>
#include <printerinfomanager.hxx>
#include <tools/stream.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/strbuf.hxx>
#include <memory>
@@ -232,7 +232,7 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
else if (aLine.startsWith(copiesEquals))
{
bCopies = true;
- rJobData.m_nCopies = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(copiesEquals)));
+ rJobData.m_nCopies = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(copiesEquals)));
}
else if (aLine.startsWith(collateEquals))
{
@@ -250,22 +250,22 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
else if (aLine.startsWith(colordepthEquals))
{
bColorDepth = true;
- rJobData.m_nColorDepth = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordepthEquals)));
+ rJobData.m_nColorDepth = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordepthEquals)));
}
else if (aLine.startsWith(colordeviceEquals))
{
bColorDevice = true;
- rJobData.m_nColorDevice = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordeviceEquals)));
+ rJobData.m_nColorDevice = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordeviceEquals)));
}
else if (aLine.startsWith(pslevelEquals))
{
bPSLevel = true;
- rJobData.m_nPSLevel = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals)));
+ rJobData.m_nPSLevel = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals)));
}
else if (aLine.startsWith(pdfdeviceEquals))
{
bPDFDevice = true;
- rJobData.m_nPDFDevice = comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)));
+ rJobData.m_nPDFDevice = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)));
}
else if (aLine == "PPDContextData" && bPrinter)
{
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index ba68e1ef011e..8191c98364e1 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <ppdparser.hxx>
#include <strhelper.hxx>
@@ -1526,11 +1527,11 @@ void PPDParser::getResolutionFromString(std::u16string_view rString,
const size_t nPos {rString.find( 'x' )};
if( nPos != std::u16string_view::npos )
{
- rXRes = comphelper::string::toInt32(rString.substr( 0, nPos ));
- rYRes = comphelper::string::toInt32(rString.substr(nPos+1, nDPIPos - nPos - 1));
+ rXRes = o3tl::toInt32(rString.substr( 0, nPos ));
+ rYRes = o3tl::toInt32(rString.substr(nPos+1, nDPIPos - nPos - 1));
}
else
- rXRes = rYRes = comphelper::string::toInt32(rString.substr( 0, nDPIPos ));
+ rXRes = rYRes = o3tl::toInt32(rString.substr( 0, nDPIPos ));
}
}