Kaydet (Commit) 6a92b406 authored tarafından Brennan Vincent's avatar Brennan Vincent Kaydeden (comit) Fridrich Štrba

Fix writerperfect ignoring newlines.

Change-Id: Ib737a7d0ba833bcdc1e284890c62c9cf187d6b61
üst c3aa1cef
...@@ -74,12 +74,35 @@ void DocumentHandler::endElement(const char *psName) ...@@ -74,12 +74,35 @@ void DocumentHandler::endElement(const char *psName)
void DocumentHandler::characters(const WPXString &sCharacters) void DocumentHandler::characters(const WPXString &sCharacters)
{ {
OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8); int lastNewline = -1;
int length = sCharacters.len();
for (int curr = 0; curr < length; ++curr)
{
if (sCharacters.cstr()[curr] == '\n')
{
if (curr > lastNewline + 1)
{
OUString sCharU16(sCharacters.cstr() + lastNewline + 1, curr - lastNewline - 1, RTL_TEXTENCODING_UTF8);
#ifdef DEBUG_XML
WPXString sEscapedCharacters(sCharacters, true);
printf("%s", sEscapedCharacters.cstr());
#endif
mxHandler->characters(sCharU16);
}
startElement("text:line-break", WPXPropertyList());
endElement("text:line-break");
lastNewline = curr;
}
}
if (lastNewline + 1 < length)
{
OUString sCharU16(sCharacters.cstr() + lastNewline + 1, length - lastNewline - 1, RTL_TEXTENCODING_UTF8);
#ifdef DEBUG_XML #ifdef DEBUG_XML
WPXString sEscapedCharacters(sCharacters, true); WPXString sEscapedCharacters(sCharacters, true);
printf("%s", sEscapedCharacters.cstr()); printf("%s", sEscapedCharacters.cstr());
#endif #endif
mxHandler->characters(sCharU16); mxHandler->characters(sCharU16);
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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