From 10e733908038407791f9c14af2a86417cc4a653c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 23 Feb 2017 15:33:55 +0100 Subject: 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 --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'writerfilter') diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index a42b52833ab0..ef5e0868d1ef 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1120,7 +1120,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; } -- cgit