summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-08 12:34:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-02-11 11:37:14 +0000
commit7d4e28739681ca947112332016f9e904d4e587c9 (patch)
tree19f3ec28c033d8a2ce4fbac48767f8c6fb162b52 /writerfilter/source
parent0977ba31ee91f2ccaef87883407a3d3700e7551a (diff)
fdo#59953 RTF import: fix unreadable graphic and nested cell contents
There were two issues here: 1) c3b0f13546b30e5db3aecd311c7178e4e0933208 added a mechanism to work around broken documents, but that didn't deal with nested tables. Additionally, the check compared the max row width with the width of the last cell, not the last row. 2) d276d3f3ae112a11c8cb5768650d147cbb94275e cleaned up implicit horizontal merge detection, but didn't deal with valid documents, where each row definition is available twice. (cherry picked from commit e15f9ceafdf6e8b21cd315936ab44edfa91dd8b2) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx Change-Id: I1a32ec2fcb0d1a8fca7a7bd26501d3daf17880c9 Reviewed-on: https://gerrit.libreoffice.org/2044 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx5
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx4
2 files changed, 6 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 448d6e18fb4d..52fbd0ccb749 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -222,7 +222,10 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
break;
case NS_ooxml::LN_CT_TblGridBase_gridCol:
{
- getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
+ if (nIntValue == -1)
+ getCurrentGrid()->clear();
+ else
+ getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
}
break;
case NS_ooxml::LN_CT_TcPrBase_vMerge : //vertical merge
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a58e139a5c12..366959e04a59 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1718,8 +1718,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
case RTF_NESTROW:
{
// If the right edge of the last cell (row width) is smaller than the width of some other row, mimic the WW8 import: add a fake cell.
- RTFValue::Pointer_t pLastCellx = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblGridBase_gridCol, false);
- if (pLastCellx.get() && pLastCellx->getInt() < m_nCellxMax)
+ if (nKeyword == RTF_ROW && m_aStates.top().nCellX < m_nCellxMax)
dispatchValue(RTF_CELLX, m_nCellxMax);
if (m_aStates.top().nCells)
@@ -2139,6 +2138,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break;
case RTF_TROWD:
m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms;
+ m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, RTFValue::Pointer_t(new RTFValue(-1)), false);
m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes;
m_aStates.top().nCellX = 0;
// In case the table definition is in the middle of the row