Iterate the utf8 correctly + handle tabs too
Change-Id: Ie6a4750ebd04e3b1ed8ad0985e141b6ff2e65e98
This commit is contained in:
@@ -1750,12 +1750,11 @@ void OdgGenerator::endTextSpan()
|
|||||||
|
|
||||||
void OdgGenerator::insertText(const WPXString &text)
|
void OdgGenerator::insertText(const WPXString &text)
|
||||||
{
|
{
|
||||||
int length = text.len();
|
|
||||||
WPXString out;
|
WPXString out;
|
||||||
for (int curr = 0; curr < length; ++curr)
|
WPXString::Iter i(text);
|
||||||
|
for (i.rewind(); i.next();)
|
||||||
{
|
{
|
||||||
char ch = text.cstr()[curr];
|
if ((*i()) == '\n' || (*i()) == '\t')
|
||||||
if (ch == '\n')
|
|
||||||
{
|
{
|
||||||
if (out.len() != 0)
|
if (out.len() != 0)
|
||||||
{
|
{
|
||||||
@@ -1763,12 +1762,20 @@ void OdgGenerator::insertText(const WPXString &text)
|
|||||||
mpImpl->mBodyElements.push_back(pText);
|
mpImpl->mBodyElements.push_back(pText);
|
||||||
out.clear();
|
out.clear();
|
||||||
}
|
}
|
||||||
|
if ((*i()) == '\n')
|
||||||
|
{
|
||||||
mpImpl->mBodyElements.push_back(new TagOpenElement("text:line-break"));
|
mpImpl->mBodyElements.push_back(new TagOpenElement("text:line-break"));
|
||||||
mpImpl->mBodyElements.push_back(new TagCloseElement("text:line-break"));
|
mpImpl->mBodyElements.push_back(new TagCloseElement("text:line-break"));
|
||||||
}
|
}
|
||||||
|
else if ((*i()) == '\t')
|
||||||
|
{
|
||||||
|
mpImpl->mBodyElements.push_back(new TagOpenElement("text:tab"));
|
||||||
|
mpImpl->mBodyElements.push_back(new TagCloseElement("text:tab"));
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out.append(ch);
|
out.append(i());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out.len() != 0)
|
if (out.len() != 0)
|
||||||
|
Reference in New Issue
Block a user