diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-13 17:54:17 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-14 22:40:34 +0200 |
commit | 809a4ef445ef0290a4d05babac2f585d1e6ed56f (patch) | |
tree | 3f7c51534f1c84085b65ed5af495ef6ee0c3ca4d /starmath/source/view.cxx | |
parent | fa29fab1be6a1e93ea25cf87aefec3da04dff357 (diff) |
Avoid getTokenCount in SmViewShell::DrawTextLine
Change-Id: If2c059b1284257c73e64f30ffe845ee4d1ccc84d
Diffstat (limited to 'starmath/source/view.cxx')
-rw-r--r-- | starmath/source/view.cxx | 14 |
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); |