Kaydet (Commit) a1b9f7e8 authored tarafından Mark Hung's avatar Mark Hung

tdf#120573 export media type for .wav properly.

Only video files were handled before. .wav files had
wrong mime type in [Content Types].xml, used videoFile
tag in slide1.xml, and incorrect type in rel file.

Change-Id: I92bded52eb9f366103a10334c6a92fda9648076e
Reviewed-on: https://gerrit.libreoffice.org/61885
Tested-by: Jenkins
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst c2545303
......@@ -58,6 +58,7 @@ enum class Relationship
THEME,
VBAPROJECT,
VIDEO,
AUDIO,
VMLDRAWING,
WORDVBADATA,
WORKSHEET
......
......@@ -1072,6 +1072,7 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra
aExtension = rURL.copy(nLastDot);
bool bEmbed = rURL.startsWith("vnd.sun.star.Package:");
Relationship eMediaType = Relationship::VIDEO;
// mime type
#if HAVE_FEATURE_AVMEDIA
......@@ -1095,6 +1096,11 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra
aMimeType = "video/ogg";
else if (aExtension.equalsIgnoreAsciiCase(".wmv"))
aMimeType = "video/x-ms-wmv";
else if (aExtension.equalsIgnoreAsciiCase(".wav"))
{
aMimeType = "audio/x-wav";
eMediaType = Relationship::AUDIO;
}
}
OUString aVideoFileRelId;
......@@ -1122,18 +1128,18 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra
.append(static_cast<sal_Int32>(mnImageCounter++))
.append(aExtension)
.makeStringAndClear();
aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::VIDEO), aPath);
aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), aPath);
aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), aPath);
}
else
{
aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::VIDEO), rURL);
aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), rURL);
aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), rURL);
}
GetFS()->startElementNS(XML_p, XML_nvPr, FSEND);
GetFS()->singleElementNS(XML_a, XML_videoFile,
GetFS()->singleElementNS(XML_a, eMediaType == Relationship::VIDEO ? XML_videoFile : XML_audioFile,
FSNS(XML_r, XML_link), USS(aVideoFileRelId),
FSEND);
......
......@@ -38,6 +38,7 @@
{Relationship::THEME, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"},
{Relationship::VBAPROJECT, "http://schemas.microsoft.com/office/2006/relationships/vbaProject"},
{Relationship::VIDEO, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"},
{Relationship::AUDIO, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"},
{Relationship::VMLDRAWING, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"},
{Relationship::WORDVBADATA, "http://schemas.microsoft.com/office/2006/relationships/wordVbaData"},
{Relationship::WORKSHEET, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"}
......@@ -192,6 +192,7 @@ public:
void testTdf118768();
void testTdf118836();
void testTdf116350TextEffects();
void testTdf120573();
void testTdf118825();
void testTdf119118();
void testTdf99213();
......@@ -270,6 +271,7 @@ public:
CPPUNIT_TEST(testTdf118768);
CPPUNIT_TEST(testTdf118836);
CPPUNIT_TEST(testTdf116350TextEffects);
CPPUNIT_TEST(testTdf120573);
CPPUNIT_TEST(testTdf118825);
CPPUNIT_TEST(testTdf119118);
CPPUNIT_TEST(testTdf99213);
......@@ -1971,6 +1973,29 @@ void SdOOXMLExportTest2::testTdf116350TextEffects()
xDocShRef->DoClose();
}
void SdOOXMLExportTest2::testTdf120573()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf120573.pptx" ), PPTX );
utl::TempFile tempFile;
xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile );
xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:audioFile", 1);
assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile", 0);
xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels");
assertXPath(pXmlDocRels,
"(/rels:Relationships/rels:Relationship[@Target='../media/media1.wav'])[1]",
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml");
assertXPath(pXmlContentType,
"/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.wav']",
"ContentType",
"audio/x-wav");
}
void SdOOXMLExportTest2::testTdf118825()
{
const OUString sPath1 = "M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 0.0704264795523803 -0.00370117418637049 0.0831071428571428 -0.00819047619047622 C 0.0953550597998766 -0.0125265741339082 0.107821870086751 -0.010397536991717 0.120321428571429 -0.0115555555555556 C 0.133179018681433 -0.0127467438724762 0.151318627483861 -0.0158700272533852 0.1585 0.00539682539682542 C 0.16478291361998 0.0240029898688431 0.15828642886492 0.0483806254341085 0.161392857142857 0.0698412698412698 C 0.165179286017685 0.0959996731216037 0.17453898927982 0.119735912694626 0.187142857142857 0.132634920634921 C 0.199788991845377 0.145577185161529 0.215607110490848 0.142889773028431 0.230107142857143 0.142857142857143 C 0.243821417584191 0.142826280916829 0.257716514999779 0.142685979556724 0.271142857142857 0.137777777777778 C 0.286895094567923 0.132019309914514 0.302318190711873 0.122962218306185 0.317928571428571 0.11568253968254 C 0.333496771884547 0.108422531222479 0.348787823719556 0.0990570571890929 0.363714285714286 0.0885079365079364 C 0.374930683062651 0.080580865157908 0.385357142857143 0.0693333333333332 0.396178571428571 0.0596825396825396 L 0.404785714285714 0.0410158730158729 L 0.401892857142857 0.0342222222222221 E";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment