oox/source/export/vmlexport.cxx | 2 +- sw/qa/extras/ooxmlexport/data/fdo79591.docx |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 15 +++++++++++++++ sw/source/filter/ww8/docxsdrexport.cxx | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-)
New commits: commit 7ea1bbe712cef48a97faffdf03b45f2812a93e62 Author: Dinesh Patil <dinesh.pa...@synerzip.com> Date: Thu Jun 12 11:34:32 2014 +0530 fdo#79591 Values for docPr name and shape ID attributes were set invalid Values set for docPr name and shape ID attributes in RT file were not valid as per UTF-8 encoding format and hence was showing RT document as corrupt with error message "invalid character". Calling add() function with current parameters is causing issue and setting invalid values so modified the second parameter which will set valid values to the specified parameters. Reviewed on: https://gerrit.libreoffice.org/9746 Change-Id: I3b48e53adbe5ed844235e596bb98eb396133845a diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 490bc7b..69242d6 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -821,7 +821,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect OUString idStr = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true); aStream.Seek(0); if (!IsWaterMarkShape(m_pSdrObject->GetName())) - m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8)); + m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8).getStr()); bAlreadyWritten[ESCHER_Prop_wzName] = true; } diff --git a/sw/qa/extras/ooxmlexport/data/fdo79591.docx b/sw/qa/extras/ooxmlexport/data/fdo79591.docx new file mode 100644 index 0000000..32a61de Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo79591.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 25a6cf7..20ee7c3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -1811,6 +1811,21 @@ DECLARE_OOXMLEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.doc CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString()); } +DECLARE_OOXMLEXPORT_TEST(testfdo79591, "fdo79591.docx") +{ + /* Values set for docPr name and shape ID attributes + * in RT file were not valid as per UTF-8 encoding format + * and hence was showing RT document as corrupt with error + * message "invalid character" + */ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr", "name", ""); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "ID", ""); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 42e9f9c..d3efe2a 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -724,7 +724,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrmFmt* sax_fastparser::FastAttributeList* pDocPrAttrList = pFS->createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr()); - pDocPrAttrList->add(XML_name, OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8)); + pDocPrAttrList->add(XML_name, OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8).getStr()); if (!pSdrObject->GetTitle().isEmpty()) pDocPrAttrList->add(XML_title, OUStringToOString(pSdrObject->GetTitle(), RTL_TEXTENCODING_UTF8)); if (!pSdrObject->GetDescription().isEmpty()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits