fdo#78284 Content-type of ".png" images in Smart Art

Content-type for 'png' images was not getting added in
[Content_Types].xml. This was as  only 'jpeg' and 'wmf'
extensions were handled. Modified DocxSdrExport::writeDiagramRels
to handle all types of extensions.
Added UT for the same.

Reviewed on:
	https://gerrit.libreoffice.org/9252

Change-Id: I5e068d4db14f3a43be08a4b7c9bf265f388bf356
This commit is contained in:
Vinaya Mandke 2014-05-05 14:13:31 +05:30 committed by Miklos Vajna
parent 9beda5ab8f
commit d8b5bd541b
3 changed files with 14 additions and 3 deletions

Binary file not shown.

View File

@ -3260,6 +3260,17 @@ DECLARE_OOXMLEXPORT_TEST(testPageBreakInFirstPara,"fdo77727.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br","type","page"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br","type","page");
} }
DECLARE_OOXMLEXPORT_TEST(testFDO78284, "fdo78284.docx")
{
xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc,"/ContentType:Types/ContentType:Override[@PartName='/word/media/OOXDiagramDataRels1_0.png']",
"ContentType",
"image/png");
}
#endif #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();

View File

@ -828,10 +828,10 @@ void DocxSdrExport::writeDiagramRels(uno::Reference<xml::dom::XDocument> xDom,
diagramDataRelTuple[0] >>= sRelId; diagramDataRelTuple[0] >>= sRelId;
diagramDataRelTuple[2] >>= sExtension; diagramDataRelTuple[2] >>= sExtension;
OUString sContentType; OUString sContentType;
if (sExtension == ".jpeg") if (sExtension.equalsIgnoreAsciiCase(".WMF"))
sContentType = "image/jpeg";
else if (sExtension == ".WMF")
sContentType = "image/x-wmf"; sContentType = "image/x-wmf";
else
sContentType = OUString("image/") + sExtension.copy(1);
sRelId = sRelId.copy(3); sRelId = sRelId.copy(3);
StreamDataSequence dataSeq; StreamDataSequence dataSeq;