summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2018-08-12 23:29:55 +0800
committerMark Hung <marklh9@gmail.com>2018-08-16 18:17:16 +0200
commit6e03d7ee5734c94d245aea5900c0924fbef2a246 (patch)
tree2e1df4c15ba03111a69f6ff9a6b3f1c0436a65cc /sd
parent4f2b25c406b3e63b5d15bf90ad29abb3eb9041a1 (diff)
tdf#99213 handle iterate container.
Export iterate container as p:par with iterate element, which has 'type' attribute and p:tmAbs element. Note that child animation node would not have target so it has to use the target of the iterate container. Testcase of testTdf113822 is used, PowerPointExport:: WriteAnimationAttributeName is tuned to prevent data loss there. Deciding an Any is a RGB color by converting to sal_Int32 doesn't work and has been done AnimationExporter::convertAnimateValue, so we can remove them securely and make the roundtrip test case work. Change-Id: I04a66f004df291c04c1f6e4a8fb7da34b924d922 Reviewed-on: https://gerrit.libreoffice.org/58998 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/export-tests.cxx3
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx43
2 files changed, 37 insertions, 9 deletions
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 0e5b8f563df9..b17fb213c5b1 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1105,6 +1105,9 @@ void SdExportTest::testTdf113822()
utl::TempFile tempFile;
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf113822underline.pptx"), PPTX);
+ // Was unable to export iterate container (tdf#99213).
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ // Was unable to import iterate container (tdf#113822).
xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile);
xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml");
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 7b64a3f271a5..69624d1c0752 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -60,6 +60,7 @@
#include <com/sun/star/animations/XAnimateColor.hpp>
#include <com/sun/star/animations/XCommand.hpp>
#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -76,6 +77,7 @@
#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/presentation/TextAnimationType.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -1027,14 +1029,7 @@ void PowerPointExport::WriteAnimateTo(const FSHelperPtr& pFS, const Any& rValue,
SAL_INFO("sd.eppt", "to attribute name: " << USS(rAttributeName));
- sal_uInt32 nColor;
- if (rValue >>= nColor)
- {
- // RGB color
- WriteAnimationProperty(pFS, rValue, XML_to);
- }
- else
- WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName), XML_to);
+ WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName), XML_to);
}
void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const OUString& rAttributeName)
@@ -1351,7 +1346,10 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, c
XML_additive, pAdditive,
FSEND);
WriteAnimationNodeCommonPropsStart(pFS, rXNode, true, bMainSeqChild);
- WriteAnimationTarget(pFS, rXAnimate->getTarget());
+
+ Reference<XIterateContainer> xIterate(rXNode->getParent(), UNO_QUERY);
+ WriteAnimationTarget(pFS, xIterate.is() ?
+ xIterate->getTarget() : rXAnimate->getTarget());
Reference<XAnimateTransform> xTransform(rXNode, UNO_QUERY);
@@ -1687,6 +1685,32 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS
WriteAnimationCondition(pFS, aAny, false, bMainSeqChild, XML_endCondLst);
}
+ if (rXNode->getType() == AnimationNodeType::ITERATE)
+ {
+ Reference<XIterateContainer> xIterate(rXNode, UNO_QUERY);
+ if (xIterate.is())
+ {
+ const char *sType = nullptr;
+ switch(xIterate->getIterateType())
+ {
+ case TextAnimationType::BY_PARAGRAPH:
+ sType = "el";
+ break;
+ case TextAnimationType::BY_LETTER:
+ sType = "lt";
+ break;
+ case TextAnimationType::BY_WORD:
+ default:
+ sType = "wd";
+ break;
+
+ }
+ pFS->startElementNS(XML_p, XML_iterate, XML_type, sType, FSEND);
+ pFS->singleElementNS(XML_p, XML_tmAbs, XML_val, I32S(xIterate->getIterateInterval() * 1000), FSEND);
+ pFS->endElementNS(XML_p, XML_iterate);
+ }
+ }
+
Reference< XEnumerationAccess > xEnumerationAccess(rXNode, UNO_QUERY);
if (xEnumerationAccess.is())
{
@@ -1794,6 +1818,7 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Referenc
switch (rXNode->getType())
{
+ case AnimationNodeType::ITERATE:
case AnimationNodeType::PAR:
xmlNodeType = XML_par;
break;