[Libreoffice-commits] .: writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Tue Dec 20 03:36:25 PST 2011
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 53 ++++++++++++++++++++-----
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1
2 files changed, 45 insertions(+), 9 deletions(-)
New commits:
commit 133f4d750a46dc67797d2f23f25a1bb39620d59f
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Tue Dec 20 12:37:21 2011 +0100
fdo#42109 fix RTF import of fields inside tables
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3f1deb6..4c9f8a3 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 4370d9a..8013677 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
More information about the Libreoffice-commits
mailing list