From 81d40428bbcfe332b78e154b4cd3fd7feff5ff73 Mon Sep 17 00:00:00 2001 From: Paul Trojahn Date: Mon, 7 Aug 2017 10:18:36 +0200 Subject: tdf#100387 Fix OOXML export of animated lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pRg is a paragraph range, not a character range. AnimationExporter::getTargetElementShape is still used by the ppt export filter, so I just moved the relevant parts over to PowerPointExport::WriteAnimationTarget. Change-Id: If477013d62483d57fe142c9da3ab0c75872733af Reviewed-on: https://gerrit.libreoffice.org/40979 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai --- sd/qa/unit/data/odp/tdf100387.odp | Bin 0 -> 10810 bytes sd/qa/unit/export-tests-ooxml2.cxx | 27 +++++++++++++++++++++++++++ sd/source/filter/eppt/pptx-epptooxml.cxx | 29 ++++++++++++++++++++++++----- 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 sd/qa/unit/data/odp/tdf100387.odp (limited to 'sd') diff --git a/sd/qa/unit/data/odp/tdf100387.odp b/sd/qa/unit/data/odp/tdf100387.odp new file mode 100644 index 000000000000..72c7ba38528c Binary files /dev/null and b/sd/qa/unit/data/odp/tdf100387.odp differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 3d89edec6120..8f41bc928427 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -101,6 +101,7 @@ public: void testPptmContentType(); void testPptmVBAStream(); void testTdf111518(); + void testTdf100387(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -129,6 +130,7 @@ public: CPPUNIT_TEST(testPptmContentType); CPPUNIT_TEST(testPptmVBAStream); CPPUNIT_TEST(testTdf111518); + CPPUNIT_TEST(testTdf100387); CPPUNIT_TEST_SUITE_END(); @@ -854,6 +856,31 @@ void SdOOXMLExportTest2::testTdf111518() "M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069"); } +void SdOOXMLExportTest2::testTdf100387() +{ + + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf100387.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml"); + + assertXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]" + "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "st", "0"); + assertXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]" + "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "0"); + + assertXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]" + "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "st", "1"); + assertXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]" + "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "1"); + + assertXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]" + "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "st", "2"); + assertXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]" + "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "2"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index c8d3532617b7..2f02dc49d697 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -936,9 +937,27 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const void PowerPointExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& rTarget) { - sal_Int32 nBegin = -1, nEnd = -1; - bool bParagraphTarget; - Reference< XShape > rXShape = AnimationExporter::getTargetElementShape(rTarget, nBegin, nEnd, bParagraphTarget); + sal_Int32 nParagraph = -1; + bool bParagraphTarget = false; + + Reference< XShape > rXShape; + rTarget >>= rXShape; + + if (!rXShape.is()) + { + ParagraphTarget aParagraphTarget; + if (rTarget >>= aParagraphTarget) + rXShape = aParagraphTarget.Shape; + if (rXShape.is()) + { + nParagraph = static_cast< sal_Int32 >(aParagraphTarget.Paragraph); + Reference< XSimpleText > xText(rXShape, UNO_QUERY); + if (xText.is()) + { + bParagraphTarget = true; + } + } + } if (rXShape.is()) { @@ -950,8 +969,8 @@ void PowerPointExport::WriteAnimationTarget(const FSHelperPtr& pFS, const Any& r { pFS->startElementNS(XML_p, XML_txEl, FSEND); pFS->singleElementNS(XML_p, XML_pRg, - XML_st, I32S(nBegin), - XML_end, I32S(nEnd), + XML_st, I32S(nParagraph), + XML_end, I32S(nParagraph), FSEND); pFS->endElementNS(XML_p, XML_txEl); } -- cgit