Hi, See http://cgit.freedesktop.org/libreoffice/core/commit/?id=bec0bab
This never really worked ("foo<page number>bar" was imported as "foo<pagenumber>"), but without this commit in 3.5 it got even worse, as "foo-". Backported patch attached. Thanks, Miklos
>From 338cf7de8e2bc63cab38898dcb1875b977fed3ea Mon Sep 17 00:00:00 2001 From: Miklos Vajna <vmik...@suse.cz> Date: Wed, 25 Apr 2012 11:21:06 +0200 Subject: [PATCH] fdo#48193 fix RTF import of fields without a result --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 26 +++++++++++++++++++++++- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 9 ++++++++ 2 files changed, 34 insertions(+), 1 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index b74b26e..23df13f 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1097,7 +1097,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().nDestinationState = DESTINATION_STYLESHEET; break; case RTF_FIELD: - // A field consists of an fldinst and an fldrslt group. + m_aStates.top().nDestinationState = DESTINATION_FIELD; break; case RTF_FLDINST: { @@ -3526,6 +3526,30 @@ int RTFDocumentImpl::popState() } else if (bLevelNumbersEnd) m_aStates.top().aTableSprms = aSprms; + else if (aState.nDestinationState == DESTINATION_FIELDINSTRUCTION) + m_aStates.top().nFieldStatus = FIELD_INSTRUCTION; + else if (aState.nDestinationState == DESTINATION_FIELDRESULT) + m_aStates.top().nFieldStatus = FIELD_RESULT; + else if (aState.nDestinationState == DESTINATION_FIELD) + { + if (aState.nFieldStatus == FIELD_INSTRUCTION) + { + sal_uInt8 sFieldEnd[] = { 0x15 }; + if (!m_pCurrentBuffer) + { + Mapper().startCharacterGroup(); + Mapper().text(sFieldEnd, 1); + Mapper().endCharacterGroup(); + } + else + { + m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); + RTFValue::Pointer_t pValue(new RTFValue(*sFieldEnd)); + m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); + m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); + } + } + } else if (bPopShapeProperties) { m_aStates.top().aShape = aShape; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 1d0a37d..885f75a 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -65,6 +65,7 @@ namespace writerfilter { DESTINATION_STYLESHEET, DESTINATION_STYLEENTRY, DESTINATION_EQINSTRUCTION, + DESTINATION_FIELD, DESTINATION_FIELDINSTRUCTION, DESTINATION_FIELDRESULT, DESTINATION_LISTTABLE, @@ -162,6 +163,13 @@ namespace writerfilter { BMPSTYLE_PNG }; + enum RTFFieldStatus + { + FIELD_NONE, + FIELD_INSTRUCTION, + FIELD_RESULT + }; + /// A buffer storing dmapper calls. typedef std::deque< std::pair<RTFBufferTypes, RTFValue::Pointer_t> > RTFBuffer_t; @@ -245,6 +253,7 @@ namespace writerfilter { RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; RTFDesitnationState nDestinationState; + RTFFieldStatus nFieldStatus; RTFBorderState nBorderState; // font table, stylesheet table RTFSprms aTableSprms; -- 1.7.7
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice