summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyankaGaikwad <priyanka.gaikwad@synerzip.com>2014-02-27 17:42:52 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-05 10:53:01 +0100
commit0415e2696156b25226f21085a0716187f83c2f4b (patch)
treef94307891d9282bb567d689155bd34033be516b7
parentd2c08569373551144b141bbdeea76894cf7fc82b (diff)
fdo#73219 File corruption: Table in header
Description: File corrupt due to the end tag </w:tc> </w:tr> </w:tbl> are missing after roundtrip in header4.xml Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8378 Change-Id: Ib05a50b3b3beca6c744b93360f9341ddcaa1a22a
-rw-r--r--sw/qa/extras/ooxmlexport/data/tableCurrupt.docxbin0 -> 28750 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
4 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tableCurrupt.docx b/sw/qa/extras/ooxmlexport/data/tableCurrupt.docx
new file mode 100644
index 000000000000..1deda7ddcbc2
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tableCurrupt.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 094519cf6c12..4c1ba4ff24fe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2962,6 +2962,15 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx")
CPPUNIT_ASSERT( xInputStream.is() );
}
+DECLARE_OOXMLEXPORT_TEST(testTableCurruption, "tableCurrupt.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/header4.xml");
+ if (!pXmlDoc)
+ return;
+ CPPUNIT_ASSERT(pXmlDoc) ;
+ assertXPath(pXmlDoc, "/w:hdr/w:tbl[1]/w:tr[1]/w:tc[1]",1);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d7d9deafb749..2fe102c81bfd 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -251,9 +251,18 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
{
ww8::WW8TableNodeInfoInner::Pointer_t pInner( pTextNodeInfo->getInnerForDepth( nDepth ) );
+ if (m_tableReference->m_pOldTablepInner && m_tableReference->m_pOldTablepInner->getTable() == pInner->getTable() && nCurrentDepth > 1 && nDepth != 1)
+ {
+ m_tableReference->m_pOldTablepInner = pInner;
+ break;
+ }
+ else
+ {
StartTable( pInner );
StartTableRow( pInner );
StartTableCell( pInner );
+ m_tableReference->m_pOldTablepInner = pInner;
+ }
}
m_tableReference->m_nTableDepth = nCurrentDepth;
@@ -2366,8 +2375,10 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
{
m_oldTableReference->m_bTableCellOpen = m_tableReference->m_bTableCellOpen;
m_oldTableReference->m_nTableDepth = m_tableReference->m_nTableDepth;
+ m_oldTableReference->m_pOldTablepInner = m_tableReference->m_pOldTablepInner;
m_tableReference->m_bTableCellOpen = false;
m_tableReference->m_nTableDepth = 0;
+ m_pSectionInfo.reset();
}
else if( index == -1)
{
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index b7653159d7aa..6012f43e994f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -113,6 +113,8 @@ struct TableReference
/// Remember the current table depth.
sal_uInt32 m_nTableDepth;
+ ww8::WW8TableNodeInfoInner::Pointer_t m_pOldTablepInner;
+
TableReference()
: m_bTableCellOpen(false),
m_nTableDepth(0)