Kaydet (Commit) 809a4ef4 authored tarafından Matteo Casalin's avatar Matteo Casalin

Avoid getTokenCount in SmViewShell::DrawTextLine

Change-Id: If2c059b1284257c73e64f30ffe845ee4d1ccc84d
üst fa29fab1
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment