diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-04-25 11:21:06 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-04-25 11:59:00 +0200 |
commit | bec0bab00eeed78ccdb7065554dcf9e898f499fa (patch) | |
tree | f3d30b2f71d1ecf7ad39ca675a3c9f93d6a910aa /writerfilter | |
parent | d09182127bd215236c71796f349e2226cb712700 (diff) |
fdo#48193 fix RTF import of fields without a result
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 26 | ||||
-rw-r--r-- | 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 6bcfdc7998b5..ed89aa2983e1 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1043,7 +1043,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: { @@ -3458,6 +3458,30 @@ int RTFDocumentImpl::popState() } else if (aState.nDestinationState == DESTINATION_LEVELNUMBERS) m_aStates.top().aTableSprms = aState.aTableSprms; + 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 3a1bad4fa625..c905909334a1 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, @@ -161,6 +162,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; @@ -244,6 +252,7 @@ namespace writerfilter { RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; RTFDesitnationState nDestinationState; + RTFFieldStatus nFieldStatus; RTFBorderState nBorderState; // font table, stylesheet table RTFSprms aTableSprms; |