From 8a6c210f4b3ebec87575911a58facbe0f87e2c5d Mon Sep 17 00:00:00 2001 From: Tushar Bende Date: Mon, 9 Dec 2013 19:13:36 +0530 Subject: fdo#68211 fdo#72786 Fix for "General input/output error" while opening file Description: Docx containing floating table with formula was giving "General input/output error" while opening in LibreOffice. Reason being within xLoader->filter() it was calling EmbeddedObjectContainer::RemoveEmbeddedObject() with bClose value as sal_True(default value in function declaration) and hence it was removing embedded object from container and also it was closing it.Fix includes passing this bClose value as sal_false (which means remove object from container but don't close it.) verified code changes for various floating table docx and normal docx containing tables and formulas. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7009 (cherry picked from commit bee397a1e35fbc2717c56a8bd4a631ccfc185b6b) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: I9c2d3f8c4099f9f753b2a1b027f9072cd4effeb5 --- .../ooxmlexport/data/floatingtbl_with_formula.docx | Bin 0 -> 17046 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++++++ sw/source/core/ole/ndole.cxx | 5 +++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/floatingtbl_with_formula.docx diff --git a/sw/qa/extras/ooxmlexport/data/floatingtbl_with_formula.docx b/sw/qa/extras/ooxmlexport/data/floatingtbl_with_formula.docx new file mode 100644 index 000000000000..ecabbd6b2a9f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/floatingtbl_with_formula.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 06bedcc53690..88e681105db8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2021,6 +2021,15 @@ DECLARE_OOXMLEXPORT_TEST(testTableLineSpacing, "table_atleast.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:spacing", "line", "320"); } +DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx") +{ + // Docx containing Floating table with formula was giving "General input/output error" while opening in LibreOffice + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal"); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 7d876058d231..9ec8330faf49 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -715,10 +715,11 @@ SwOLEObj::~SwOLEObj() // successful closing of the object will automatically clear the reference then xOLERef.Lock(sal_False); - // Always remove object from conteiner it is connected to + // Always remove object from container it is connected to try { - pCnt->RemoveEmbeddedObject( aName ); + // remove object from container but don't close it + pCnt->RemoveEmbeddedObject( aName, sal_False); } catch ( uno::Exception& ) { -- cgit v1.2.3