summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-04-02 11:40:11 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-04-02 12:02:24 +0200
commitc433a482cf249485e7fa3e71362b107f0eafa705 (patch)
tree5c9aad9f4bdd1461bec73610b070b167dfc81648 /writerfilter
parentf0d001a378c64ea457e722266e60c96522c72e9b (diff)
fdo#59273 DOCX import: fix table width when w:tblW is missing
Regression from 6718482c072defe5d885030826fef5ef833732e9, put back the table width counting in DomainMapperTableManager::endOfRowAction(), in case the document has no explicit w:tblW token. Change-Id: I8bd983045e1950451c9afb4f15f1deb87312524e
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.hxx7
2 files changed, 17 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index af64ffe6eee7..cb96046c0ef4 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -53,6 +53,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
m_bOOXML( bOOXML ),
m_bPushCurrentWidth(false),
m_bRowSizeTypeInserted(false),
+ m_bTableSizeTypeInserted(false),
m_nLayoutType(0),
m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) )
{
@@ -132,6 +133,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 100 );
}
+ m_bTableSizeTypeInserted = true;
}
#ifdef DEBUG_DOMAINMAPPER
pPropMap->dumpXml( dmapper_logger );
@@ -493,6 +495,13 @@ void DomainMapperTableManager::endOfRowAction()
m_nTableWidth += *aCellIter++;
}
+ if (m_nTableWidth > 0 && !m_bTableSizeTypeInserted)
+ {
+ TablePropertyMapPtr pPropMap( new TablePropertyMap );
+ pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
+ insertTableProps(pPropMap);
+ }
+
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement();
#endif
@@ -610,6 +619,7 @@ void DomainMapperTableManager::endOfRowAction()
m_nGridBefore = m_nGridAfter = 0;
m_bRowSizeTypeInserted = false;
+ m_bTableSizeTypeInserted = false;
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index e2fb5f66ac32..d529d5531404 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -56,6 +56,8 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
::std::vector< IntVectorPtr > m_aCellWidths;
/// Remember if a cell already set this, then it should not be set at a row level.
bool m_bRowSizeTypeInserted;
+ /// Remember if table width was already set, when we lack a w:tblW, it should be set manually at the end.
+ bool m_bTableSizeTypeInserted;
/// Table layout algorithm, IOW if we should consider fixed column width or not.
sal_uInt32 m_nLayoutType;
@@ -128,6 +130,11 @@ public:
return m_bRowSizeTypeInserted;
}
+ bool IsTableSizeTypeInserted() const
+ {
+ return m_bTableSizeTypeInserted;
+ }
+
void SetLayoutType(sal_uInt32 nLayoutType)
{
m_nLayoutType = nLayoutType;