From bafc6196c5364c2692e9a4f538a580e3dedec073 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Tue, 7 Apr 2015 23:05:25 +0200 Subject: Use size() on array filled by SwEditShell::GetINetAttrs to get number of items Change-Id: I10d05c6b635c220f2ec833e4207afbd46651aec8 --- sw/inc/editsh.hxx | 2 +- sw/source/core/edit/editsh.cxx | 3 +-- sw/source/core/text/EnhancedPDFExportHelper.cxx | 6 +++--- sw/source/uibase/utlui/content.cxx | 5 +++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 58f04bad217c..b2e8ee2841a8 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -788,7 +788,7 @@ public: bool InsertURL( const SwFmtINetFmt& rFmt, const OUString& rStr, bool bKeepSelection = false ); - sal_uInt16 GetINetAttrs( SwGetINetAttrs& rArr ); + void GetINetAttrs( SwGetINetAttrs& rArr ); OUString GetDropTxt( const sal_uInt16 nChars ) const; void ReplaceDropTxt( const OUString &rStr, SwPaM* pPaM = NULL ); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 1f328893608f..65c480a0c6ba 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -660,7 +660,7 @@ bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const OUString& rStr, boo return true; } -sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) +void SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) { rArr.clear(); @@ -689,7 +689,6 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr ) } } } - return rArr.size(); } /// If the cursor is in a INetAttribute then it will be deleted completely (incl. hint text, the diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 7a08004e1095..e63aa81da0ff 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1623,10 +1623,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // HYPERLINKS SwGetINetAttrs aArr; - const sal_uInt16 nHyperLinkCount = mrSh.GetINetAttrs( aArr ); - for( sal_uInt16 n = 0; n < nHyperLinkCount; ++n ) + mrSh.GetINetAttrs( aArr ); + for( auto &rAttr : aArr ) { - SwGetINetAttr* p = &aArr[ n ]; + SwGetINetAttr* p = &rAttr; OSL_ENSURE( 0 != p, "Enhanced pdf export - SwGetINetAttr is missing" ); const SwTxtNode* pTNd = p->rINetAttr.GetpTxtNode(); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 555406271fa6..bec9651f0370 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -153,8 +153,9 @@ namespace const SwContentType *pCntType) { SwGetINetAttrs aArr; - const sal_uInt16 nCount = pWrtShell->GetINetAttrs( aArr ); - for( sal_uInt16 n = 0; n < nCount; ++n ) + pWrtShell->GetINetAttrs( aArr ); + const SwGetINetAttrs::size_type nCount {aArr.size()}; + for( SwGetINetAttrs::size_type n = 0; n < nCount; ++n ) { SwGetINetAttr* p = &aArr[ n ]; SwURLFieldContent* pCnt = new SwURLFieldContent( -- cgit v1.2.3