[Libreoffice-commits] .: 2 commits - writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Sat Nov 12 19:13:18 PST 2011
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 ++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 +++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 3f170f223296e2d0d336ff69088e5ba57b3a37c9
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Sun Nov 13 02:17:33 2011 +0100
Related: i#110745 fix crash on invalid RTF tables
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2f3eed6..61add03 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -348,6 +348,8 @@ void DomainMapper_Impl::PushListProperties(PropertyMapPtr pListProperties)
void DomainMapper_Impl::PopProperties(ContextType eId)
{
OSL_ENSURE(!m_aPropertyStacks[eId].empty(), "section stack already empty");
+ if ( m_aPropertyStacks[eId].empty() )
+ return;
if ( eId == CONTEXT_SECTION )
{
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 650f480..d88c199 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1668,6 +1668,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms;
m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes;
m_aStates.top().nCellX = 0;
+ // In case the table definition is in the middle of the row
+ // (invalid), make sure table definition is emitted.
+ m_bNeedPap = true;
break;
case RTF_WIDCTLPAR:
case RTF_NOWIDCTLPAR:
@@ -1954,6 +1957,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
if (nSprm > 0)
{
m_aStates.top().aParagraphSprms->push_back(make_pair(nSprm, pIntValue));
+ if (nKeyword == RTF_ITAP && nParam > 0)
+ // Invalid tables may omit INTBL after ITAP
+ dispatchFlag(RTF_INTBL);
return 0;
}
@@ -2286,6 +2292,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().aTableCellsAttributes.push_back(m_aStates.top().aTableCellAttributes);
m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes;
+ // We assume text after a row definition always belongs to the table, to handle text before the real INTBL token
+ dispatchFlag(RTF_INTBL);
}
break;
case RTF_TRRH:
commit 3510a6f63913544e8a686fcf152b31b4841d94fc
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Sun Nov 13 02:50:27 2011 +0100
RTFDocumentImpl: cleanup
checkFirstRun() should not do what checkNeedPap() already does
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 7ba5249..650f480 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -272,7 +272,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_aColorTable(),
m_bFirstRun(true),
m_bFirstRow(true),
- m_bNeedPap(false),
+ m_bNeedPap(true),
m_bNeedCr(false),
m_bNeedPar(true),
m_aListTableSprms(),
@@ -392,9 +392,6 @@ void RTFDocumentImpl::checkFirstRun()
{
if (m_bFirstRun)
{
- writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
- new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
- );
// output settings table
RTFSprms aAttributes;
writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aAttributes, m_aSettingsTableSprms));
@@ -406,7 +403,6 @@ void RTFDocumentImpl::checkFirstRun()
if (!m_bIsSubstream)
Mapper().startSectionGroup();
Mapper().startParagraphGroup();
- Mapper().props(pParagraphProperties);
m_bFirstRun = false;
}
}
More information about the Libreoffice-commits
mailing list