summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-09-13 17:48:47 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-09-14 22:40:34 +0200
commitfa29fab1be6a1e93ea25cf87aefec3da04dff357 (patch)
tree0ea0bffdcc76f0f0cde523d002ffb38776874b8a /starmath
parent584d55178d2e390e60355b18bbac4be16fe750dd (diff)
Avoid getTokenCount in SmViewShell::GetTextSize
Change-Id: Ic81b961ae2360ea3fe40c9e536a6f10a5788fe1a
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/view.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 8627f3767bbe..7bfe1df578a9 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1000,11 +1000,13 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const OUString& rText, long
{
Size aSize;
Size aTextSize;
- sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
+ if (rText.isEmpty())
+ return aTextSize;
- for (sal_uInt16 i = 0; i < nLines; i++)
+ sal_Int32 nPos = 0;
+ do
{
- OUString aLine = rText.getToken(i, '\n');
+ OUString aLine = rText.getToken(0, '\n', nPos);
aLine = comphelper::string::remove(aLine, '\r');
aSize = GetTextLineSize(rDevice, aLine);
@@ -1048,6 +1050,7 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const OUString& rText, long
aTextSize.Width() = std::max(aTextSize.Width(), aSize.Width());
}
}
+ while (nPos >= 0);
return aTextSize;
}