diff options
author | Brennan Vincent <brennanv@email.arizona.edu> | 2012-08-17 18:06:09 -0700 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-08-21 12:24:28 +0200 |
commit | 6a92b406b03e8bbce27fe314b6229644b9fc8b0e (patch) | |
tree | 21f587d0c674a6ebe587a1d469b3b888099a00da /writerperfect | |
parent | c3aa1cefdc6521d34a2a32c20bae1593e1edb5ba (diff) |
Fix writerperfect ignoring newlines.
Change-Id: Ib737a7d0ba833bcdc1e284890c62c9cf187d6b61
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/source/filter/DocumentHandler.cxx | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/writerperfect/source/filter/DocumentHandler.cxx b/writerperfect/source/filter/DocumentHandler.cxx index 8336c077caf7..e1f58b2dc45b 100644 --- a/writerperfect/source/filter/DocumentHandler.cxx +++ b/writerperfect/source/filter/DocumentHandler.cxx @@ -74,12 +74,35 @@ void DocumentHandler::endElement(const char *psName) 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 - WPXString sEscapedCharacters(sCharacters, true); - printf("%s", sEscapedCharacters.cstr()); + WPXString sEscapedCharacters(sCharacters, true); + printf("%s", sEscapedCharacters.cstr()); #endif - mxHandler->characters(sCharU16); + mxHandler->characters(sCharU16); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |