summaryrefslogtreecommitdiff
path: root/sw
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 /sw
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 'sw')
-rw-r--r--sw/source/core/doc/doclay.cxx4
-rw-r--r--sw/source/core/doc/docnum.cxx3
-rw-r--r--sw/source/core/doc/doctxm.cxx4
-rw-r--r--sw/source/core/docnode/ndsect.cxx4
-rw-r--r--sw/source/core/fields/cellfml.cxx3
-rw-r--r--sw/source/core/unocore/XMLRangeHelper.cxx4
-rw-r--r--sw/source/core/unocore/unotbl.cxx3
-rw-r--r--sw/source/filter/ascii/wrtasc.cxx4
-rw-r--r--sw/source/filter/html/htmlatr.cxx4
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx4
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.cxx4
-rw-r--r--sw/source/uibase/app/docsh2.cxx2
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx5
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx4
-rw-r--r--sw/source/uibase/uiview/view2.cxx5
-rw-r--r--sw/source/uibase/utlui/unotools.cxx2
16 files changed, 32 insertions, 27 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 992f163084c3..7859d73fb844 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1279,7 +1279,7 @@ static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32
if (o3tl::starts_with(rName, rCmpName))
{
// Only get and set the Flag
- const sal_Int32 nNum = comphelper::string::toInt32(rName.substr(nNmLen)) - 1;
+ const sal_Int32 nNum = o3tl::toInt32(rName.substr(nNmLen)) - 1;
if (nNum >= 0)
rSetFlags.push_back(nNum);
}
@@ -1485,7 +1485,7 @@ void SwDoc::SetAllUniqueFlyNames()
if ( pNum )
{
- const sal_Int32 nNewLen = comphelper::string::toInt32(aNm.subView( nLen ));
+ const sal_Int32 nNewLen = o3tl::toInt32(aNm.subView( nLen ));
if (*pNum < nNewLen)
*pNum = nNewLen;
}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 4c6c1da80880..a7d3af37439d 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -49,6 +49,7 @@
#include <comphelper/string.hxx>
#include <comphelper/random.hxx>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <tools/datetimeutils.hxx>
@@ -2610,7 +2611,7 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c
if( sNm.startsWith( aName ) )
{
// Determine Number and set the Flag
- nNum = o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(sNm.subView( nNmLen )));
+ nNum = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(sNm.subView( nNmLen )));
if( nNum-- && nNum < mpNumRuleTable->size() )
pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 1905578b0646..83310172e852 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -21,7 +21,7 @@
#include <hintids.hxx>
#include <editeng/formatbreakitem.hxx>
#include <comphelper/classids.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <docsh.hxx>
#include <ndole.hxx>
#include <txttxmrk.hxx>
@@ -668,7 +668,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
if ( rNm.startsWith(aName) )
{
// Calculate number and set the Flag
- nNum = comphelper::string::toInt32(rNm.subView( nNmLen ));
+ nNum = o3tl::toInt32(rNm.subView( nNmLen ));
if( nNum-- && nNum < mpSectionFormatTable->size() )
pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
}
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index da9c6d96a68c..3c6b26b39366 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -60,7 +60,7 @@
#include <memory>
#include "ndsect.hxx"
#include <tools/datetimeutils.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
// #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>.
// Method now determines the previous/next on its own. Thus, it can be controlled,
@@ -1435,7 +1435,7 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
if (rNm.startsWith( aName ))
{
// Calculate the Number and reset the Flag
- nNum = comphelper::string::toInt32(rNm.subView( aName.getLength() ));
+ nNum = o3tl::toInt32(rNm.subView( aName.getLength() ));
if( nNum-- && nNum < mpSectionFormatTable->size() )
pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
}
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 34aefecff0b3..eb8eff09c06d 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -44,6 +44,7 @@
#include <ndindex.hxx>
#include <frameformats.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <svl/numformat.hxx>
@@ -789,7 +790,7 @@ static sal_Int32 lcl_GetLongBoxNum( OUString& rStr )
}
else
{
- nRet = comphelper::string::toInt32(rStr.subView( 0, nPos ));
+ nRet = o3tl::toInt32(rStr.subView( 0, nPos ));
rStr = rStr.copy( nPos+1 );
}
return nRet;
diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx b/sw/source/core/unocore/XMLRangeHelper.cxx
index 3ce673e24042..0a565b2cf293 100644
--- a/sw/source/core/unocore/XMLRangeHelper.cxx
+++ b/sw/source/core/unocore/XMLRangeHelper.cxx
@@ -20,7 +20,7 @@
#include "XMLRangeHelper.hxx"
#include <rtl/character.hxx>
#include <rtl/ustrbuf.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <algorithm>
namespace
@@ -118,7 +118,7 @@ void lcl_getSingleCellAddressFromXMLString(
// parse number for row
while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 )
i--;
- rOutCell.nRow = (comphelper::string::toInt32(aCellStr.subView( i + 1 ))) - 1;
+ rOutCell.nRow = (o3tl::toInt32(aCellStr.subView( i + 1 ))) - 1;
// a dollar in XML means absolute (whereas in UI it means relative)
if( pStrArray[ i ] == aDollar )
{
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 4bb64a369220..836866bef198 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -106,6 +106,7 @@
#include <fesh.hxx>
#include <itabenum.hxx>
#include <frameformats.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star;
using ::editeng::SvxBorderLine;
@@ -387,7 +388,7 @@ void SwXTextTable::GetCellPosition(const OUString& rCellName, sal_Int32& o_rColu
}
o_rColumn = nColIdx;
- o_rRow = comphelper::string::toInt32(rCellName.subView(nRowPos)) - 1; // - 1 because indices ought to be 0 based
+ o_rRow = o3tl::toInt32(rCellName.subView(nRowPos)) - 1; // - 1 because indices ought to be 0 based
}
/** compare position of two cells (check rows first)
diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx
index c37efe6ee713..17e53f30802c 100644
--- a/sw/source/filter/ascii/wrtasc.cxx
+++ b/sw/source/filter/ascii/wrtasc.cxx
@@ -29,7 +29,7 @@
#include <frameformats.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/sfxsids.hrc>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <strings.hrc>
@@ -45,7 +45,7 @@ SwASCWriter::SwASCWriter( std::u16string_view rFltNm )
if( 5 < rFltNm.size() )
{
std::u16string_view aFilterNum = rFltNm.substr( 5 );
- switch( comphelper::string::toInt32(aFilterNum) )
+ switch( o3tl::toInt32(aFilterNum) )
{
case 437: aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_437 ); break;
case 850: aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_850 ); break;
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index cefef48647dc..b9b8f32aadd3 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -107,12 +107,12 @@ sal_uInt16 SwHTMLWriter::GetDefListLvl( std::u16string_view rNm, sal_uInt16 nPoo
OUString sDTDD = OOO_STRING_SVTOOLS_HTML_dt " ";
if( o3tl::starts_with(rNm, sDTDD) )
// DefinitionList - term
- return o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DT;
+ return o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DT;
sDTDD = OOO_STRING_SVTOOLS_HTML_dd " ";
if( o3tl::starts_with(rNm, sDTDD) )
// DefinitionList - definition
- return o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DD;
+ return o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DD;
return 0;
}
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index cf0c6fd4c7a5..7c8de88defdd 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -60,7 +60,7 @@
#include <IDocumentDrawModelAccess.hxx>
#include <drawdoc.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star;
@@ -340,7 +340,7 @@ void WW8Export::OutputLinkedOLE( const OUString& rOleId )
// Output the cPicLocation attribute
std::unique_ptr<ww::bytes> pBuf( new ww::bytes );
SwWW8Writer::InsUInt16( *pBuf, NS_sprm::CPicLocation::val );
- SwWW8Writer::InsUInt32( *pBuf, comphelper::string::toInt32(rOleId.subView( 1 )) );
+ SwWW8Writer::InsUInt32( *pBuf, o3tl::toInt32(rOleId.subView( 1 )) );
SwWW8Writer::InsUInt16( *pBuf, NS_sprm::CFOle2::val );
pBuf->push_back( 1 );
diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx
index 68f3a16219c3..3286e331e49f 100644
--- a/sw/source/ui/vba/vbaparagraphformat.cxx
+++ b/sw/source/ui/vba/vbaparagraphformat.cxx
@@ -27,7 +27,7 @@
#include <com/sun/star/style/BreakType.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include "vbatabstops.hxx"
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -188,7 +188,7 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel()
if( aHeading.startsWith( HEADING ) )
{
// get the sub string after "Heading"
- nLevel = comphelper::string::toInt32(aHeading.subView( HEADING.getLength() ));
+ nLevel = o3tl::toInt32(aHeading.subView( HEADING.getLength() ));
}
return nLevel;
}
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 23c4f1c1464e..2b0b280d14ce 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1081,7 +1081,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
else if ( sTmpl.startsWith(aOutline) )
{
- nTemplateOutlineLevel = comphelper::string::toInt32(sTmpl.subView(aOutline.getLength())); //get string behind "Outline: Level ";
+ nTemplateOutlineLevel = o3tl::toInt32(sTmpl.subView(aOutline.getLength())); //get string behind "Outline: Level ";
bCreateByOutlineLevel = true;
}
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index e4b1597bc9f2..4bf95499394b 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <tools/resary.hxx>
#include <osl/diagnose.h>
#include <sfx2/dispatch.hxx>
@@ -1233,7 +1234,7 @@ bool SwFieldMgr::InsertField(
nExpPos = rData.m_sPar1.indexOf(DB_DELIM, nCmdTypePos);
if (nExpPos>=0)
{
- aDBData.nCommandType = comphelper::string::toInt32(rData.m_sPar1.subView(nCmdTypePos, nExpPos++ - nCmdTypePos));
+ aDBData.nCommandType = o3tl::toInt32(rData.m_sPar1.subView(nCmdTypePos, nExpPos++ - nCmdTypePos));
}
}
}
@@ -1631,7 +1632,7 @@ void SwFieldMgr::UpdateCurField(sal_uInt32 nFormat,
static_cast<SwGetRefField*>(pTmpField.get())->SetSubType( o3tl::narrowing<sal_uInt16>(rPar2.toInt32()) );
const sal_Int32 nPos = rPar2.indexOf( '|' );
if( nPos>=0 )
- static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rPar2.subView( nPos + 1 ))));
+ static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rPar2.subView( nPos + 1 ))));
}
break;
case SwFieldTypesEnum::Dropdown:
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index dea682f77d11..a5f5a5fb209f 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -33,7 +33,7 @@
#include <redlndlg.hxx>
#include <swwait.hxx>
#include <uitool.hxx>
-#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <cmdid.h>
#include <strings.hrc>
@@ -1288,7 +1288,7 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
}
else if (!sCommand.isEmpty())
{
- int nSortMode = comphelper::string::toInt32(sCommand.subView(10));
+ int nSortMode = o3tl::toInt32(sCommand.subView(10));
if (nSortMode == 4 && nColumn == 4)
return true; // we already have it
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 8484919c5a58..5e7fba530d49 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -152,6 +152,7 @@
#include <ndtxt.hxx>
#include <svx/srchdlg.hxx>
+#include <o3tl/string_view.hxx>
const char sStatusDelim[] = " : ";
@@ -2160,7 +2161,7 @@ auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& rName)
SAL_WARN("sw.ui", "JumpToTOXMark: missing separator");
return std::optional<std::pair<SwTOXMark, sal_Int32>>();
}
- sal_Int32 const counter(comphelper::string::toInt32(rName.subView(0, first)));
+ sal_Int32 const counter(o3tl::toInt32(rName.subView(0, first)));
if (counter <= 0)
{
SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter");
@@ -2307,7 +2308,7 @@ bool SwView::JumpToSwMark( std::u16string_view rMark )
sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator );
if ( nNoPos != -1 )
{
- sal_uInt16 nSeqNo = comphelper::string::toInt32(sName.subView( nNoPos + 1 ));
+ sal_uInt16 nSeqNo = o3tl::toInt32(sName.subView( nNoPos + 1 ));
sName = sName.copy( 0, nNoPos );
bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, nSeqNo);
}
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 62c3397bf11c..31ec42ff75ea 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -500,7 +500,7 @@ void SwOneExampleFrame::PopupHdl(std::string_view rId)
std::string_view sZoomValue;
if (o3tl::starts_with(rId, "zoom", &sZoomValue))
{
- sal_Int16 nZoom = comphelper::string::toInt32(sZoomValue);
+ sal_Int16 nZoom = o3tl::toInt32(sZoomValue);
uno::Reference< view::XViewSettingsSupplier > xSettings(m_xController, uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings();