summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdocumentimpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0de85f61bb45..378e9f57067c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -276,7 +276,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bNeedSect(true),
m_bWasInFrame(false),
m_bHadPicture(false),
- m_bHadSect(false)
+ m_bHadSect(false),
+ m_nCellxMax(0)
{
OSL_ASSERT(xInputStream.is());
m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True));
@@ -1619,7 +1620,11 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
if (bNeedPap)
runProps();
if (!m_pCurrentBuffer)
+ {
parBreak();
+ // Not in table? Reset max width.
+ m_nCellxMax = 0;
+ }
else if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
{
RTFValue::Pointer_t pValue;
@@ -1683,6 +1688,11 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
case RTF_ROW:
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)
+ dispatchValue(RTF_CELLX, m_nCellxMax);
+
if (m_aStates.top().nCells)
{
// Make a backup before we start popping elements
@@ -2945,6 +2955,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
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);
+ m_nCellxMax = std::max(m_nCellxMax, nParam);
}
break;
case RTF_TRRH: