diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-07 20:54:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-08 13:18:41 +0200 |
commit | 36e0e88b28e818faf25b8e32cc8c4dc444b8a0be (patch) | |
tree | b7b5c8e13b6e05f871b01a3d0bf68c1d1329ef12 /sw | |
parent | cf5bbe3fce4a250ab25998053965bdc604c6114e (diff) |
use more subView when converting to Int32
Change-Id: I54e3ddf79ba793fd4328bf8bda7f949b65349651
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132693
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/fields/cellfml.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/XMLRangeHelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlatr.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8gr.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/vba/vbaparagraphformat.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 5 |
15 files changed, 35 insertions, 25 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 6fd9c72928c9..992f163084c3 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -83,6 +83,8 @@ #include <strings.hrc> #include <frameformats.hxx> #include <tools/datetimeutils.hxx> +#include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include <sortedobjs.hxx> @@ -1272,12 +1274,12 @@ SwFlyFrameFormat* SwDoc::InsertDrawLabel( return pNewFormat; } -static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32 nNmLen, const OUString& rName, std::u16string_view rCmpName) +static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32 nNmLen, std::u16string_view rName, std::u16string_view rCmpName) { - if (rName.startsWith(rCmpName)) + if (o3tl::starts_with(rName, rCmpName)) { // Only get and set the Flag - const sal_Int32 nNum = rName.copy(nNmLen).toInt32() - 1; + const sal_Int32 nNum = comphelper::string::toInt32(rName.substr(nNmLen)) - 1; if (nNum >= 0) rSetFlags.push_back(nNum); } @@ -1483,7 +1485,7 @@ void SwDoc::SetAllUniqueFlyNames() if ( pNum ) { - const sal_Int32 nNewLen = aNm.copy( nLen ).toInt32(); + const sal_Int32 nNewLen = comphelper::string::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 2cbfb7a6a4df..4c6c1da80880 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2610,7 +2610,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>(sNm.copy( nNmLen ).toInt32()); + nNum = o3tl::narrowing<sal_uInt16>(comphelper::string::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 9e6990247484..1905578b0646 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -21,6 +21,7 @@ #include <hintids.hxx> #include <editeng/formatbreakitem.hxx> #include <comphelper/classids.hxx> +#include <comphelper/string.hxx> #include <docsh.hxx> #include <ndole.hxx> #include <txttxmrk.hxx> @@ -667,7 +668,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, if ( rNm.startsWith(aName) ) { // Calculate number and set the Flag - nNum = rNm.copy( nNmLen ).toInt32(); + nNum = comphelper::string::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 84f281b9fe91..da9c6d96a68c 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -60,6 +60,7 @@ #include <memory> #include "ndsect.hxx" #include <tools/datetimeutils.hxx> +#include <comphelper/string.hxx> // #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>. // Method now determines the previous/next on its own. Thus, it can be controlled, @@ -1434,7 +1435,7 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const if (rNm.startsWith( aName )) { // Calculate the Number and reset the Flag - nNum = rNm.copy( aName.getLength() ).toInt32(); + nNum = comphelper::string::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 5c9632a7fb96..34aefecff0b3 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -789,7 +789,7 @@ static sal_Int32 lcl_GetLongBoxNum( OUString& rStr ) } else { - nRet = rStr.copy( 0, nPos ).toInt32(); + nRet = comphelper::string::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 4542469f5f94..3ce673e24042 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 <algorithm> namespace @@ -118,7 +118,7 @@ void lcl_getSingleCellAddressFromXMLString( // parse number for row while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 ) i--; - rOutCell.nRow = (aCellStr.copy( i + 1 )).toInt32() - 1; + rOutCell.nRow = (comphelper::string::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 39ebb99e2355..4bb64a369220 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -387,7 +387,7 @@ void SwXTextTable::GetCellPosition(const OUString& rCellName, sal_Int32& o_rColu } o_rColumn = nColIdx; - o_rRow = rCellName.copy(nRowPos).toInt32() - 1; // - 1 because indices ought to be 0 based + o_rRow = comphelper::string::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/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index db17987ff468..cefef48647dc 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -76,6 +76,7 @@ #include <deque> #include <svtools/HtmlWriter.hxx> +#include <o3tl/string_view.hxx> #include <memory> #include <algorithm> @@ -92,7 +93,7 @@ HTMLOutEvent const aAnchorEventTable[] = static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt ); -sal_uInt16 SwHTMLWriter::GetDefListLvl( const OUString& rNm, sal_uInt16 nPoolId ) +sal_uInt16 SwHTMLWriter::GetDefListLvl( std::u16string_view rNm, sal_uInt16 nPoolId ) { if( nPoolId == RES_POOLCOLL_HTML_DD ) { @@ -104,14 +105,14 @@ sal_uInt16 SwHTMLWriter::GetDefListLvl( const OUString& rNm, sal_uInt16 nPoolId } OUString sDTDD = OOO_STRING_SVTOOLS_HTML_dt " "; - if( rNm.startsWith(sDTDD) ) + if( o3tl::starts_with(rNm, sDTDD) ) // DefinitionList - term - return o3tl::narrowing<sal_uInt16>(rNm.copy( sDTDD.getLength() ).toInt32()) | HTML_DLCOLL_DT; + return o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DT; sDTDD = OOO_STRING_SVTOOLS_HTML_dd " "; - if( rNm.startsWith(sDTDD) ) + if( o3tl::starts_with(rNm, sDTDD) ) // DefinitionList - definition - return o3tl::narrowing<sal_uInt16>(rNm.copy( sDTDD.getLength() ).toInt32()) | HTML_DLCOLL_DD; + return o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( sDTDD.getLength() ))) | HTML_DLCOLL_DD; return 0; } diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 0ad4728dc143..fc3d01eecd2b 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -571,7 +571,7 @@ public: static void GetEEAttrsFromDrwObj( SfxItemSet& rItemSet, const SdrObject *pObj ); - static sal_uInt16 GetDefListLvl( const OUString& rNm, sal_uInt16 nPoolId ); + static sal_uInt16 GetDefListLvl( std::u16string_view rNm, sal_uInt16 nPoolId ); sal_uInt32 GetHTMLMode() const { diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 78cecb7224a4..cf0c6fd4c7a5 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -60,6 +60,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <drawdoc.hxx> +#include <comphelper/string.hxx> using namespace ::com::sun::star; @@ -339,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, rOleId.copy( 1 ).toInt32() ); + SwWW8Writer::InsUInt32( *pBuf, comphelper::string::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 683a3a5befcc..68f3a16219c3 100644 --- a/sw/source/ui/vba/vbaparagraphformat.cxx +++ b/sw/source/ui/vba/vbaparagraphformat.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include "vbatabstops.hxx" +#include <comphelper/string.hxx> using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -187,7 +188,7 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() if( aHeading.startsWith( HEADING ) ) { // get the sub string after "Heading" - nLevel = aHeading.copy( HEADING.getLength() ).toInt32(); + nLevel = comphelper::string::toInt32(aHeading.subView( HEADING.getLength() )); } return nLevel; } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 92514a5e1486..23c4f1c1464e 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -26,6 +26,7 @@ #include <comphelper/fileformat.h> #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> +#include <comphelper/string.hxx> #include <sal/log.hxx> #include <edtwin.hxx> @@ -1080,7 +1081,7 @@ void SwDocShell::Execute(SfxRequest& rReq) } else if ( sTmpl.startsWith(aOutline) ) { - nTemplateOutlineLevel = sTmpl.copy(aOutline.getLength()).toInt32(); //get string behind "Outline: Level "; + nTemplateOutlineLevel = comphelper::string::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 90fdaad22a1d..e4b1597bc9f2 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1233,7 +1233,7 @@ bool SwFieldMgr::InsertField( nExpPos = rData.m_sPar1.indexOf(DB_DELIM, nCmdTypePos); if (nExpPos>=0) { - aDBData.nCommandType = rData.m_sPar1.copy(nCmdTypePos, nExpPos++ - nCmdTypePos).toInt32(); + aDBData.nCommandType = comphelper::string::toInt32(rData.m_sPar1.subView(nCmdTypePos, nExpPos++ - nCmdTypePos)); } } } @@ -1631,7 +1631,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>(rPar2.copy( nPos + 1 ).toInt32())); + static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(comphelper::string::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 dd5feeacc747..dea682f77d11 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -33,6 +33,7 @@ #include <redlndlg.hxx> #include <swwait.hxx> #include <uitool.hxx> +#include <comphelper/string.hxx> #include <cmdid.h> #include <strings.hrc> @@ -1287,7 +1288,7 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool) } else if (!sCommand.isEmpty()) { - int nSortMode = sCommand.copy(10).toInt32(); + int nSortMode = comphelper::string::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 2b976f28b46f..8484919c5a58 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -116,6 +116,7 @@ #include <dbmgr.hxx> #include <reffld.hxx> #include <comphelper/lok.hxx> +#include <comphelper/string.hxx> #include <PostItMgr.hxx> @@ -2159,7 +2160,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(rName.copy(0, first).toInt32()); + sal_Int32 const counter(comphelper::string::toInt32(rName.subView(0, first))); if (counter <= 0) { SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter"); @@ -2306,7 +2307,7 @@ bool SwView::JumpToSwMark( std::u16string_view rMark ) sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator ); if ( nNoPos != -1 ) { - sal_uInt16 nSeqNo = sName.copy( nNoPos + 1 ).toInt32(); + sal_uInt16 nSeqNo = comphelper::string::toInt32(sName.subView( nNoPos + 1 )); sName = sName.copy( 0, nNoPos ); bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, nSeqNo); } |