summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-09-13 17:54:17 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-09-14 22:40:34 +0200
commit809a4ef445ef0290a4d05babac2f585d1e6ed56f (patch)
tree3f7c51534f1c84085b65ed5af495ef6ee0c3ca4d /starmath
parentfa29fab1be6a1e93ea25cf87aefec3da04dff357 (diff)
Avoid getTokenCount in SmViewShell::DrawTextLine
Change-Id: If2c059b1284257c73e64f30ffe845ee4d1ccc84d
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 7bfe1df578a9..803c30a29cea 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1058,23 +1058,21 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const OUString& rText, long
void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, const OUString& rLine)
{
Point aPoint(rPosition);
-
- 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)
{
- for (sal_uInt16 i = 0; i < nTabs; ++i)
+ sal_Int32 nPos = 0;
+ do
{
- if (i > 0)
+ if (nPos > 0)
aPoint.X() = ((aPoint.X() / nTabPos) + 1) * nTabPos;
- OUString aText = rLine.getToken(i, '\t');
+ OUString aText = rLine.getToken(0, '\t', nPos);
rDevice.DrawText(aPoint, aText);
aPoint.X() += rDevice.GetTextWidth(aText);
}
+ while ( nPos >= 0 );
}
else
rDevice.DrawText(aPoint, rLine);