writerfilter/source/rtftok/rtfdocumentimpl.cxx | 25 ++++++++++++++++++++----- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 + 2 files changed, 21 insertions(+), 5 deletions(-)
New commits: commit 0805b222f87bf99ec0c53ca678d1c670eb5293a2 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Feb 26 15:36:09 2013 +0100 fdo#61507 import RTF_UPR and RTF_UD It turns out Word wraps document title with these destinations if they contain something that isn't possible to describe using legacy charsets. Change-Id: Ic9417d0f23d44149acb3ae3dc9d4c281058a1b36 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 14c7486..9266505 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1517,7 +1517,11 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE; break; case RTF_TITLE: - m_aStates.top().nDestinationState = DESTINATION_TITLE; + // \title inside \upr but outside \ud should be ignored. + if (m_aStates.top().nDestinationState != DESTINATION_UPR) + m_aStates.top().nDestinationState = DESTINATION_TITLE; + else + m_aStates.top().nDestinationState = DESTINATION_SKIP; break; case RTF_SUBJECT: m_aStates.top().nDestinationState = DESTINATION_SUBJECT; @@ -1615,6 +1619,13 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) OPEN_M_TOKEN(SPREPR, sPrePr); OPEN_M_TOKEN(BOX, box); OPEN_M_TOKEN(EQARR, eqArr); + case RTF_UPR: + m_aStates.top().nDestinationState = DESTINATION_UPR; + break; + case RTF_UD: + // Anything inside \ud is just normal Unicode content. + m_aStates.top().nDestinationState = DESTINATION_NORMAL; + break; default: SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle destination '" << lcl_RtfToString(nKeyword) << "'"); // Make sure we skip destinations (even without \*) till we don't handle them @@ -3808,10 +3819,6 @@ int RTFDocumentImpl::popState() if (m_xDocumentProperties.is()) m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear()); break; - case DESTINATION_TITLE: - if (m_xDocumentProperties.is()) - m_xDocumentProperties->setTitle(m_aStates.top().aDestinationText.makeStringAndClear()); - break; case DESTINATION_SUBJECT: if (m_xDocumentProperties.is()) m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear()); @@ -4234,6 +4241,14 @@ int RTFDocumentImpl::popState() aState.nDestinationState == DESTINATION_SHPPICT || aState.nDestinationState == DESTINATION_SHAPE) m_aStates.top().aFrame = aState.aFrame; + else if (aState.nDestinationState == DESTINATION_TITLE) + { + if (m_aStates.top().nDestinationState == DESTINATION_TITLE) + // The parent is a title as well, just append what we have so far. + m_aStates.top().aDestinationText.append(aState.aDestinationText.makeStringAndClear()); + else if (m_xDocumentProperties.is()) + m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear()); + } if (m_pCurrentBuffer == &m_aSuperBuffer) { if (!m_bHasFootnote) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 82490eb..a26d3ff 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -178,6 +178,7 @@ namespace writerfilter { DESTINATION_MGROW, DESTINATION_MBOX, DESTINATION_MEQARR, + DESTINATION_UPR, }; enum RTFBorderState _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits