diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-13 17:58:24 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-14 22:40:34 +0200 |
commit | 552e68a15a41e01b2e9f5ef75b32f5acdf7b41ce (patch) | |
tree | 8286ceb63902fa119e27fe6f8ef38ee5a361f0d3 /starmath | |
parent | 809a4ef445ef0290a4d05babac2f585d1e6ed56f (diff) |
Avoid getTokenCount in SmViewShell::DrawText
Change-Id: I1a4ee666900c3c412777ea2e8c01a4f38dc58b3a
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/view.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 803c30a29cea..a84ea4fd1746 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1081,13 +1081,16 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const OUString& rText, sal_uInt16 MaxWidth) { - sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n'); + if (rText.isEmpty()) + return; + Point aPoint(rPosition); Size aSize; - 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); if (aSize.Width() > MaxWidth) @@ -1135,6 +1138,7 @@ void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const aPoint.Y() += aSize.Height(); } } + while ( nPos >= 0 ); } void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPrintUIOptions, Rectangle aOutRect, Point aZeroPoint ) |