summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorumeshkadam <umesh.kadam@synerzip.com>2014-01-10 16:46:58 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-10 15:52:14 +0100
commit89a3acbdb590c3552a3184137ba0aad7f97f1549 (patch)
treed2025208b95a8bfd1a145287467a29c9648dc09a
parent3a6fdd146a37a1dbdec56b6a1d4eff3a8a28a3f8 (diff)
fdo#71834: Fix for floating table
Issue : - When we have overlapping tables the first table gets exported as a table and the second table gets exported as a DML/VML shape. - While exporting, the system starts with the table row & the cell, within which it starts exporting the overlapped table, while doing so the previous table attributes were being referred since the variable was shared. Implementation: - Save and reset the table related attributes before calling the WriteDMLTextFrame & writeVMLTextFrame functions. - Restore the table attributes for further processing after having written the shape. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7364 Change-Id: I0052a08c74ffbbebd3eb91a7075a43a4c225b670
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo71834.docxbin0 -> 1494310 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx8
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx34
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx7
4 files changed, 45 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo71834.docx b/sw/qa/extras/ooxmlexport/data/fdo71834.docx
new file mode 100644
index 000000000000..62262d902618
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo71834.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ecad7b0d4388..26dc77a7b902 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2296,6 +2296,14 @@ DECLARE_OOXMLEXPORT_TEST(testSmartArtAnchoredInline, "fdo73227.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","name","Picture");
}
+DECLARE_OOXMLEXPORT_TEST(testFDO71834, "fdo71834.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[4]/w:tr[2]/w:tc[1]/w:tcPr[1]/w:tcW[1]","type", "dxa");
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1606038bad80..26a7507aa3b2 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -368,6 +368,23 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
m_pSerializer->startElementNS(XML_mc, XML_Choice,
XML_Requires, "wps",
FSEND);
+ /** FDO#71834 :
+ We should probably be renaming the function
+ switchHeaderFooter to something like SaveRetrieveTableReference.
+ Save the table reference attributes before calling WriteDMLTextFrame,
+ otherwise the StartParagraph function will use the previous existing
+ table reference attributes since the variable is being shared.
+ */
+ switchHeaderFooter(true,1);
+ /** Save the table info's before writing the shape
+ as there might be a new table that might get
+ spawned from within the VML & DML block and alter
+ the contents.
+ */
+ ww8::WW8TableInfo::Pointer_t pOldTableInfo = m_rExport.mpTableInfo;
+ //Reset the table infos after saving.
+ m_rExport.mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
+
WriteDMLTextFrame(pParentFrame);
m_pSerializer->endElementNS(XML_mc, XML_Choice);
@@ -375,9 +392,17 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
// in case the text frame had table(s) and we try to export the
// same table second time.
m_rExport.mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
+ //reset the tableReference.
+ switchHeaderFooter(false,0);
m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND);
m_rExport.SdrExporter().writeVMLTextFrame(pParentFrame);
+ /* FDO#71834 :Restore the data here after having written the Shape
+ for further processing.
+ */
+ switchHeaderFooter(false,-1);
+ m_rExport.mpTableInfo = pOldTableInfo;
+
m_pSerializer->endElementNS(XML_mc, XML_Fallback);
m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
@@ -563,6 +588,9 @@ void DocxAttributeOutput::EndParagraphProperties( const boost::shared_ptr<SfxIte
WriteCollectedParagraphProperties();
+ // Merge the marks for the ordered elements
+ m_pSerializer->mergeTopMarks( );
+
// Write 'Paragraph Mark' properties
if ( pRedlineParagraphMarkerDeleted || pRedlineParagraphMarkerInserted || pParagraphMarkerProperties)
{
@@ -617,9 +645,6 @@ void DocxAttributeOutput::EndParagraphProperties( const boost::shared_ptr<SfxIte
m_pSerializer->endElementNS( XML_w, XML_rPr );
}
- // Merge the marks for the ordered elements
- m_pSerializer->mergeTopMarks( );
-
m_pSerializer->endElementNS( XML_w, XML_pPr );
if ( m_nColBreakStatus == COLBRK_WRITE )
@@ -2146,7 +2171,7 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
}
else if( index == -1)
{
- m_tableReference = m_oldTableReference;
+ *m_tableReference = *m_oldTableReference;
}
else
{
@@ -2154,6 +2179,7 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
m_tableReference->m_nTableDepth = 0;
}
}
+
void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
m_pSerializer->startElementNS( XML_w, XML_tbl, FSEND );
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 53c0ce0bfddc..3375895d249f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -116,6 +116,13 @@ struct TableReference
m_nTableDepth(0)
{
}
+
+ TableReference operator= (const TableReference& rhs)
+ {
+ m_bTableCellOpen = rhs.m_bTableCellOpen ;
+ m_nTableDepth = rhs.m_nTableDepth ;
+ return *this ;
+ }
};
/// The class that has handlers for various resource types when exporting as DOCX.