diff options
author | Paul Trojahn <paul.trojahn@gmail.com> | 2017-08-07 10:18:36 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-19 05:08:52 +0200 |
commit | 81d40428bbcfe332b78e154b4cd3fd7feff5ff73 (patch) | |
tree | 5b65cfd58c6bf302296b51d69493eec5fc1c8c97 /sd | |
parent | ce2e7a4e7a143937393f89c91e17b52b8dba1a74 (diff) |
tdf#100387 Fix OOXML export of animated lists
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 <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/tdf100387.odp | bin | 0 -> 10810 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 27 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 29 |
3 files changed, 51 insertions, 5 deletions
diff --git a/sd/qa/unit/data/odp/tdf100387.odp b/sd/qa/unit/data/odp/tdf100387.odp Binary files differnew file mode 100644 index 000000000000..72c7ba38528c --- /dev/null +++ b/sd/qa/unit/data/odp/tdf100387.odp 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 <com/sun/star/presentation/AnimationSpeed.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp> #include <com/sun/star/presentation/EffectPresetClass.hpp> +#include <com/sun/star/presentation/ParagraphTarget.hpp> #include <com/sun/star/util/DateTime.hpp> #include <oox/export/utils.hxx> @@ -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); } |