summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-09-13 17:14:23 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-09-14 22:40:33 +0200
commit90059da96a91dd2271aeba4101cee8ce827e3c4e (patch)
tree328935f2cba9785c51223b2d0a0fb0d1530b5360 /starmath
parent13ea7ab912093d2c890e4533f54c21eca5f4f585 (diff)
Avoid getTokenCount in SmViewShell::SetZoomFactor
Change-Id: Idb874a60868595ccc648da86c8bd32c28b92547b
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/view.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 1df935c22d7b..b10981b73870 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -976,23 +976,21 @@ void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY )
Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const OUString& rLine)
{
Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight());
- sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
- long nTabPos = 0;
- if (nTabs > 0)
- nTabPos = rDevice.approximate_char_width() * 8;
+ const long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_char_width() * 8;
if (nTabPos)
{
aSize.Width() = 0;
-
- for (sal_uInt16 i = 0; i < nTabs; i++)
+ sal_Int32 nPos = 0;
+ do
{
- if (i > 0)
+ if (nPos > 0)
aSize.Width() = ((aSize.Width() / nTabPos) + 1) * nTabPos;
- OUString aText = rLine.getToken(i, '\t');
+ const OUString aText = rLine.getToken(0, '\t', nPos);
aSize.Width() += rDevice.GetTextWidth(aText);
}
+ while (nPos >= 0);
}
return aSize;