summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-04-25 11:21:06 +0200
committerCaolán McNamara <caolanm@redhat.com>2012-05-08 10:23:51 +0100
commit9b03e5c64482a4725459daa5ccc16fa686a3bffb (patch)
tree6b467389eb3d4bebbff862c860e79b2d65fce8cf
parent62d1f855ce3b630f109efb8437237602590715fe (diff)
fdo#48193 fix RTF import of fields without a result
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx26
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx9
2 files changed, 34 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b74b26ef03f9..23df13f582b4 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 1d0a37d827ea..885f75a769f4 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;