diff options
author | Vinaya Mandke <vinaya.mandke@synerzip.com> | 2014-03-27 12:07:25 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-02 07:26:22 +0000 |
commit | 54d913aa74962781e31290d9bb7e2d95212d994c (patch) | |
tree | fae393e59a0eca0f041b49989a85b32e776b1e84 | |
parent | 8f7c677dbba29123c48778a1024a535f36bca183 (diff) |
fdo#76586 Table column separators from individual cell widths
In the test file Table Grid had only one value for entire table width
while there are two cells in a table row. So the table was not
imported with the correct Column Separators.
Added fix to calculate column seperators from cell widths if
unable to calculate from Table Grid, and all the cells have individual cell widths and
there are no after and before cells.
Change-Id: I466737437a18d3373e75fea5ad56c9e31eb149ec
Reviewed-on: https://gerrit.libreoffice.org/8767
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo76586.docx | bin | 0 -> 12277 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 10 |
3 files changed, 24 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo76586.docx b/sw/qa/extras/ooxmlexport/data/fdo76586.docx Binary files differnew file mode 100644 index 000000000000..28ae05ee7272 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo76586.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index de70fa3d9bed..fd080d0dd5bb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2983,6 +2983,22 @@ DECLARE_OOXMLEXPORT_TEST(testAuthorPropertySdt, "author-property.docx") // "xmlns:ns0='http://purl.org/dc/elements/1.1/' xmlns:ns1='http://schemas.openxmlformats.org/package/2006/metadata/core-properties'"); } +DECLARE_OOXMLEXPORT_TEST(testFDO76586, "fdo76586.docx") +{ + /* + * In the test file gridCol had only one value for entire table width + * while there are two cells in a table row. + * So the table was not imported with the correct cell widths + */ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + + if (!pXmlDoc) + return; + + // there is only one table in the test file + assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[1]", "w", "1601"); + assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[2]", "w", "7843"); +} #endif diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index e463ff13a2d6..fa840530a94d 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -710,13 +710,19 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } - else if (pCellWidths->size() > 0 && m_nLayoutType == NS_ooxml::LN_Value_wordprocessingml_ST_TblLayout_fixed) + else if ( pCellWidths->size() > 0 && + ( m_nLayoutType == NS_ooxml::LN_Value_wordprocessingml_ST_TblLayout_fixed + || pCellWidths->size() == ( m_nGridBefore + nGrids + m_nGridAfter ) ) + ) { // If we're here, then the number of cells does not equal to the amount // defined by the grid, even after taking care of // gridSpan/gridBefore/gridAfter. Handle this by ignoring the grid and // providing the separators based on the provided cell widths, as long - // as we have a fixed layout. + // as we have a fixed layout; + // On the other hand even if the layout is not fixed, but the cell widths + // provided equal the total number of cells, and there are no after/before cells + // then use the cell widths to calculate the column separators. uno::Sequence< text::TableColumnSeparator > aSeparators(pCellWidths->size() - 1); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nSum = 0; |