summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2018-08-12 22:10:25 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2018-09-09 21:07:50 +0200
commitc8796e9f1fe5a77953dd5089581b2e8569533de9 (patch)
treef4c2b55fced457021f8fc9bdce0a891498735667
parent0a2be735c37dd7d5c7ecf2aeb8f8fa2b689dba45 (diff)
Avoid getTokenCount and use indexed getToken
Change-Id: I1cea711e1e22edfab8f90c30554135727b97a276
-rw-r--r--sc/source/ui/docshell/arealink.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index c23c9308429a..d0797a453873 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <comphelper/string.hxx>
#include <sfx2/app.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/fcontnr.hxx>
@@ -286,20 +285,22 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
}
}
- sal_Int32 nTokenCnt = comphelper::string::getTokenCount(aTempArea, ';');
- sal_Int32 nStringIx = 0;
- for (sal_Int32 nToken = 0; nToken < nTokenCnt; ++nToken)
+ if (!aTempArea.isEmpty())
{
- OUString aToken( aTempArea.getToken( 0, ';', nStringIx ) );
- ScRange aTokenRange;
- if( FindExtRange( aTokenRange, &rSrcDoc, aToken ) )
+ sal_Int32 nIdx {0};
+ do
{
- aSourceRanges.push_back( aTokenRange);
- // columns: find maximum
- nWidth = std::max( nWidth, static_cast<SCCOL>(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) );
- // rows: add row range + 1 empty row
- nHeight += aTokenRange.aEnd.Row() - aTokenRange.aStart.Row() + 2;
+ ScRange aTokenRange;
+ if( FindExtRange( aTokenRange, &rSrcDoc, aTempArea.getToken( 0, ';', nIdx ) ) )
+ {
+ aSourceRanges.push_back( aTokenRange);
+ // columns: find maximum
+ nWidth = std::max( nWidth, static_cast<SCCOL>(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) );
+ // rows: add row range + 1 empty row
+ nHeight += aTokenRange.aEnd.Row() - aTokenRange.aStart.Row() + 2;
+ }
}
+ while (nIdx>0);
}
// remove the last empty row
if( nHeight > 0 )