[Libreoffice-commits] core.git: sw/qa sw/source
Caolán McNamara
caolanm at redhat.com
Fri Apr 17 12:53:17 PDT 2015
sw/qa/extras/ooxmlexport/data/tdf90681.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 9 +++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 15 ++++++++++++++-
sw/source/filter/ww8/docxattributeoutput.hxx | 2 ++
4 files changed, 25 insertions(+), 1 deletion(-)
New commits:
commit 9657455d985ecce30c4e9d3d799212e7cc8aa57a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 17 15:31:19 2015 +0100
Resolves: tdf#90681 table model can have truly empty cells
old school complex tables can create a table model
where a cell exists in the table but there are no
paragraphs in it.
--------
| A | C |
----
| B |*D*|
--------
i.e. normally for the above there are 4 nodes which
get exported, even though C and D are merged. But it
can be the case that there are only three nodes, and
*D* is missing
be conservative for now and only do this for the
obviously broken no cell start but cell end case
and incrementally build up the test-cases
Change-Id: I5703595f61688a66b7fac7f3905ace0c207c9875
diff --git a/sw/qa/extras/ooxmlexport/data/tdf90681.odt b/sw/qa/extras/ooxmlexport/data/tdf90681.odt
new file mode 100644
index 0000000..009e006
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf90681.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index f04e8b9..bece25f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -228,6 +228,15 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTable, "fdo77887.docx")
}
+DECLARE_OOXMLEXPORT_TEST(testOldComplexMerge, "tdf90681.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+ if (!pXmlDoc)
+ return;
+
+ assertXPath(pXmlDoc, "//w:vMerge[4]", "val", "continue");
+}
DECLARE_OOXMLEXPORT_TEST(testTablePreferredWidth, "tablePreferredWidth.docx")
{
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c5404f4..e29339c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -705,11 +705,21 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe
// and merge the contents of the remaining ones into it (since we don't close the cell
// here, following ones will not be opened)
bool limitWorkaround = ( pInner->getCell() >= 62 && !pInner->isEndOfLine());
+ const bool bEndCell = pInner->isEndOfCell() && !limitWorkaround;
+ const bool bStartCell = bEndCell && !m_nCellsOpen;
- if ( pInner->isEndOfCell() && !limitWorkaround )
+ if ( bEndCell )
{
if ( bForceEmptyParagraph )
+ {
+ if (bStartCell)
+ {
+ const sal_uInt32 nCol = pInner->getCell();
+ StartTableCell(pInner, nCol+1, nRow);
+ }
+
m_pSerializer->singleElementNS( XML_w, XML_p, FSEND );
+ }
EndTableCell();
}
@@ -2986,6 +2996,7 @@ void DocxAttributeOutput::StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t
{
InitTableHelper( pTableTextNodeInfoInner );
+ ++m_nCellsOpen;
m_pSerializer->startElementNS( XML_w, XML_tc, FSEND );
// Write the cell properties here
@@ -3007,6 +3018,7 @@ void DocxAttributeOutput::EndTableCell( )
EndParaSdtBlock();
m_pSerializer->endElementNS( XML_w, XML_tc );
+ --m_nCellsOpen;
m_bBtLr = false;
m_tableReference->m_bTableCellOpen = false;
@@ -8302,6 +8314,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
, m_nRunSdtPrToken(0)
, m_nStateOfFlyFrame( FLY_NOT_PROCESSED )
, m_bParagraphSdtHasId(false)
+ , m_nCellsOpen(0)
{
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 2b253d2..ff49541 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -945,6 +945,8 @@ private:
OUString m_aRunSdtPrAlias;
/// Currently paragraph SDT has a <w:id> child element.
bool m_bParagraphSdtHasId;
+ /// Checking for balanced table cells start/ends
+ sal_Int32 m_nCellsOpen;
std::map<SvxBoxItemLine, css::table::BorderLine2> m_aTableStyleConf;
More information about the Libreoffice-commits
mailing list