summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-12-20 12:37:21 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2011-12-20 12:37:44 +0100
commit133f4d750a46dc67797d2f23f25a1bb39620d59f (patch)
tree5012a1d15bd8f9c03edcf6d3b259bc083c185a1a /writerfilter/source/rtftok
parent577bb0dc298cc376d94ecdd35672081628bb8a93 (diff)
fdo#42109 fix RTF import of fields inside tables
Diffstat (limited to 'writerfilter/source/rtftok')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx53
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx1
2 files changed, 45 insertions, 9 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3f1deb698dcb..4c9f8a3b5efe 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -933,6 +933,11 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer)
}
else if (aPair.first == BUFFER_STARTRUN)
Mapper().startCharacterGroup();
+ else if (aPair.first == BUFFER_TEXT)
+ {
+ sal_uInt8 nValue = aPair.second->getInt();
+ Mapper().text(&nValue, 1);
+ }
else if (aPair.first == BUFFER_UTEXT)
{
OUString aString(aPair.second->getString());
@@ -1000,9 +1005,19 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
else
{
sal_uInt8 sFieldStart[] = { 0x13 };
- Mapper().startCharacterGroup();
- Mapper().text(sFieldStart, 1);
- Mapper().endCharacterGroup();
+ if (!m_pCurrentBuffer)
+ {
+ Mapper().startCharacterGroup();
+ Mapper().text(sFieldStart, 1);
+ Mapper().endCharacterGroup();
+ }
+ else
+ {
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t()));
+ RTFValue::Pointer_t pValue(new RTFValue(*sFieldStart));
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue));
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t()));
+ }
}
m_aStates.top().nDestinationState = DESTINATION_FIELDINSTRUCTION;
}
@@ -2782,9 +2797,19 @@ int RTFDocumentImpl::popState()
if (!m_bEq)
{
sal_uInt8 sFieldSep[] = { 0x14 };
- Mapper().startCharacterGroup();
- Mapper().text(sFieldSep, 1);
- Mapper().endCharacterGroup();
+ if (!m_pCurrentBuffer)
+ {
+ Mapper().startCharacterGroup();
+ Mapper().text(sFieldSep, 1);
+ Mapper().endCharacterGroup();
+ }
+ else
+ {
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t()));
+ RTFValue::Pointer_t pValue(new RTFValue(*sFieldSep));
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue));
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t()));
+ }
}
}
else if (m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT)
@@ -2792,9 +2817,19 @@ int RTFDocumentImpl::popState()
if (!m_bEq)
{
sal_uInt8 sFieldEnd[] = { 0x15 };
- Mapper().startCharacterGroup();
- Mapper().text(sFieldEnd, 1);
- Mapper().endCharacterGroup();
+ 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
m_bEq = false;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 4370d9a8c832..80136771dd86 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -135,6 +135,7 @@ namespace writerfilter {
BUFFER_PROPS,
BUFFER_CELLEND,
BUFFER_STARTRUN,
+ BUFFER_TEXT,
BUFFER_UTEXT,
BUFFER_ENDRUN,
BUFFER_PAR