summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-02-23 15:33:55 +0100
committerAndras Timar <andras.timar@collabora.com>2017-02-24 12:24:47 +0100
commit8d283f4a171862a65062140abeb81cb017f9207a (patch)
treee6e23f16c838d1906717f3275431150eae94ef81 /writerfilter
parent8ccb70131e67d9badcef25044fec4026120f9590 (diff)
writerfilter: RTF import: hex-escaped \r and \n create paragraph break
... in Word 2010, while the spec doesn't say what they do. So just handle \'0d and \'0a like \par. This fixes an assert failure on importing lp556169-2.rtf, where insertTextPortion was called with a string containing "\r", which split the paragraph and that messed up the SwPaM. Change-Id: Iee8b5b47e15d18232de841adfbc9c6498727c384 (cherry picked from commit 10e733908038407791f9c14af2a86417cc4a653c) Reviewed-on: https://gerrit.libreoffice.org/34584 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 7a26194b05029f68e58ff71285c7be1c5b4c2c42)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2264493649e8..19bc1599e668 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1114,7 +1114,19 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
if (m_aStates.top().nInternalState == RTFInternalState::HEX && m_aStates.top().eDestination != Destination::LEVELNUMBERS)
{
if (!bSkipped)
- m_aHexBuffer.append(ch);
+ {
+ // note: apparently \'0d\'0a is interpreted as 2 breaks, not 1
+ if (m_aStates.top().eDestination != Destination::DOCCOMM
+ && (ch == '\r' || ch == '\n'))
+ {
+ checkUnicode(/*bUnicode =*/ false, /*bHex =*/ true);
+ dispatchSymbol(RTF_PAR);
+ }
+ else
+ {
+ m_aHexBuffer.append(ch);
+ }
+ }
return RTFError::OK;
}