[Libreoffice-commits] core.git: Branch 'distro/collabora/cd-5.3-3.1' - 5 commits - oox/source sd/qa sd/source
Szymon Kłos
szymon.klos at collabora.com
Tue Mar 27 13:09:46 UTC 2018
oox/source/ppt/animationspersist.cxx | 10 -
sd/qa/unit/data/odp/tdf90627.odp |binary
sd/qa/unit/data/pptx/tdf104786.pptx |binary
sd/qa/unit/data/pptx/tdf104789.pptx |binary
sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx |binary
sd/qa/unit/data/pptx/tdf84205.pptx |binary
sd/qa/unit/export-tests-ooxml2.cxx | 75 +++++++
sd/source/filter/eppt/epptooxml.hxx | 6
sd/source/filter/eppt/pptx-epptooxml.cxx | 157 ++++++++--------
9 files changed, 165 insertions(+), 83 deletions(-)
New commits:
commit cbc7ee4a2d22022f74f463176379929a395a4608
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Fri Mar 16 21:35:01 2018 +0100
tdf#84205 If theme not found, use first
Not a complete fix, workaround.
Change-Id: If4d765eaeae3419f4f1deb4e1cfbe0113a71da94
Reviewed-on: https://gerrit.libreoffice.org/51440
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51458
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 586d56208861135e6548a4d73961e64cd3df5d68)
diff --git a/sd/qa/unit/data/pptx/tdf84205.pptx b/sd/qa/unit/data/pptx/tdf84205.pptx
new file mode 100644
index 000000000000..211cea6d0251
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf84205.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 288b0fe192bd..5315f3558001 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -124,6 +124,7 @@ public:
void testGroupsPosition();
void testGroupsRotatedPosition();
void testAccentColor();
+ void testThemeColors();
void testTdf114848();
void testFontScale();
void testTdf115394();
@@ -178,6 +179,7 @@ public:
CPPUNIT_TEST(testGroupsPosition);
CPPUNIT_TEST(testGroupsRotatedPosition);
CPPUNIT_TEST(testAccentColor);
+ CPPUNIT_TEST(testThemeColors);
CPPUNIT_TEST(testTdf114848);
CPPUNIT_TEST(testFontScale);
CPPUNIT_TEST(testTdf115394);
@@ -1119,6 +1121,18 @@ void SdOOXMLExportTest2::testAccentColor()
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "deb340");
}
+void SdOOXMLExportTest2::testThemeColors()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf84205.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml");
+ assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "44546a");
+ assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val", "a5a5a5");
+}
+
void SdOOXMLExportTest2::testTdf114848()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114848.pptx"), PPTX);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9a8c67e65c22..bc6d9623f945 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2652,8 +2652,12 @@ void PowerPointExport::WriteTheme( sal_Int32 nThemeNum )
if (!WriteColorSchemes(pFS, sThemePath))
{
- // color schemes are required - use default values
- WriteDefaultColorSchemes(pFS);
+ // if style is not defined, try to use first one
+ if (!WriteColorSchemes(pFS, "ppt/theme/theme1.xml"))
+ {
+ // color schemes are required - use default values
+ WriteDefaultColorSchemes(pFS);
+ }
}
pFS->endElementNS(XML_a, XML_clrScheme);
commit 5c0ad243ab5275df8e68cfdc3ab72e1c18ab9ffb
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Thu Mar 15 19:23:20 2018 +0100
tdf#104789 Export opacity attribute name
Change-Id: Id47ab6b3cb20fbcebb2d7fa589f3b0d7552e2cce
Reviewed-on: https://gerrit.libreoffice.org/51369
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51457
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 63f6174b67a7e731389d477e0856b64478e6511d)
diff --git a/sd/qa/unit/data/pptx/tdf104789.pptx b/sd/qa/unit/data/pptx/tdf104789.pptx
new file mode 100644
index 000000000000..d5ead6a931a7
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104789.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 16c0e55c43be..288b0fe192bd 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -132,6 +132,7 @@ public:
void testTdf104792();
void testTdf90627();
void testTdf104786();
+ void testTdf104789();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -184,6 +185,7 @@ public:
CPPUNIT_TEST(testTdf104792);
CPPUNIT_TEST(testTdf90627);
CPPUNIT_TEST(testTdf104786);
+ CPPUNIT_TEST(testTdf104789);
CPPUNIT_TEST_SUITE_END();
@@ -1245,6 +1247,19 @@ void SdOOXMLExportTest2::testTdf104786()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testTdf104789()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104789.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName");
+ CPPUNIT_ASSERT_EQUAL(OUString("style.opacity"), sAttributeName);
+
+ xDocShRef->DoClose();
+}
+
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 f44121b1c967..9a8c67e65c22 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -991,23 +991,19 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons
SAL_INFO("sd.eppt", "write attribute name: " << USS(rAttributeName));
+ const char* pAttribute = nullptr;
+
if (rAttributeName == "Visibility")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("style.visibility");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "style.visibility";
}
else if (rAttributeName == "X")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("ppt_x");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "ppt_x";
}
else if (rAttributeName == "Y")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("ppt_y");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "ppt_y";
}
else if (rAttributeName == "X;Y")
{
@@ -1021,58 +1017,53 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons
}
else if (rAttributeName == "Width")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("ppt_w");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "ppt_w";
}
else if (rAttributeName == "Height")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("ppt_h");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "ppt_h";
}
else if (rAttributeName == "Rotate")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("r");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "r";
}
else if (rAttributeName == "FillStyle")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("fill.type");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "fill.type";
}
else if (rAttributeName == "FillOn")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("fill.on");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "fill.on";
}
else if (rAttributeName == "FillColor")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("fillcolor");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "fillcolor";
}
else if (rAttributeName == "CharColor")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("style.color");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "style.color";
}
- if (rAttributeName == "SkewX")
+ else if (rAttributeName == "Opacity")
{
- pFS->startElementNS(XML_p, XML_attrName, FSEND);
- pFS->writeEscaped("xshear");
- pFS->endElementNS(XML_p, XML_attrName);
+ pAttribute = "style.opacity";
+ }
+ else if (rAttributeName == "SkewX")
+ {
+ pAttribute = "xshear";
}
else
{
SAL_INFO("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
}
- pFS->endElementNS( XML_p, XML_attrNameLst );
+ if (pAttribute)
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped(pAttribute);
+ pFS->endElementNS(XML_p, XML_attrName);
+ }
+
+ pFS->endElementNS(XML_p, XML_attrNameLst);
}
void PowerPointExport::WriteAnimationTarget( const FSHelperPtr& pFS, const Any& rTarget )
commit f27c853357cf693cd90c0539abfdc7a1895d4992
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Thu Mar 15 17:17:21 2018 +0100
tdf#104786 Don't export empty 'to'
Change-Id: I16b573fd6455813c6be5c2f5a0f0a820360a239f
Reviewed-on: https://gerrit.libreoffice.org/51359
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51456
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 16d316c912ef0ebbab30c66f2df898a407ca5c86)
diff --git a/sd/qa/unit/data/pptx/tdf104786.pptx b/sd/qa/unit/data/pptx/tdf104786.pptx
new file mode 100644
index 000000000000..165b5676e400
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104786.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index ed1076fe1f0e..16c0e55c43be 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -131,6 +131,7 @@ public:
/// SmartArt animated elements
void testTdf104792();
void testTdf90627();
+ void testTdf104786();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -182,6 +183,7 @@ public:
CPPUNIT_TEST(testTdf115394Zero);
CPPUNIT_TEST(testTdf104792);
CPPUNIT_TEST(testTdf90627);
+ CPPUNIT_TEST(testTdf104786);
CPPUNIT_TEST_SUITE_END();
@@ -1230,6 +1232,19 @@ void SdOOXMLExportTest2::testTdf90627()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testTdf104786()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104786.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide2.xml");
+ // Don't export empty 'to'
+ assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst/p:set[2]/p:to", 0);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index fb8617491936..8987fddbdb8f 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -114,7 +114,7 @@ protected:
void WriteAnimationNodeEffect( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
void WriteAnimationNodeCommand(const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
void WriteAnimationNodeCommonPropsStart( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bSingle, bool bMainSeqChild );
- static void WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny );
+ static void WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rAny, sal_Int32 nToken = 0 );
void WriteAnimationTarget( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rTarget );
bool WriteComments( sal_uInt32 nPageNum );
void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::beans::XPropertySet >& aXBackgroundPropSet );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index ca50427f4bab..f44121b1c967 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -885,7 +885,7 @@ void PowerPointExport::WriteTransition( const FSHelperPtr& pFS )
}
}
-void PowerPointExport::WriteAnimationProperty( const FSHelperPtr& pFS, const Any& rAny )
+void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const Any& rAny, sal_Int32 nToken)
{
if( !rAny.hasValue() )
return;
@@ -893,7 +893,17 @@ void PowerPointExport::WriteAnimationProperty( const FSHelperPtr& pFS, const Any
sal_uInt32 nRgb;
double fDouble;
- switch( rAny.getValueType().getTypeClass() ) {
+ uno::TypeClass aClass = rAny.getValueType().getTypeClass();
+ bool bWriteToken = nToken &&
+ ( aClass == TypeClass_LONG
+ || aClass == TypeClass_DOUBLE
+ || aClass == TypeClass_STRING );
+
+ if (bWriteToken)
+ pFS->startElementNS(XML_p, XML_to, FSEND);
+
+ switch (rAny.getValueType().getTypeClass())
+ {
case TypeClass_LONG:
rAny >>= nRgb;
pFS->singleElementNS(XML_a, XML_srgbClr,
@@ -914,6 +924,9 @@ void PowerPointExport::WriteAnimationProperty( const FSHelperPtr& pFS, const Any
default:
break;
}
+
+ if (bWriteToken)
+ pFS->endElementNS(XML_p, nToken);
}
void PowerPointExport::WriteAnimateValues( const FSHelperPtr& pFS, const Reference< XAnimate >& rXAnimate )
@@ -959,18 +972,14 @@ void PowerPointExport::WriteAnimateTo( const FSHelperPtr& pFS, const Any& rValue
SAL_INFO("sd.eppt", "to attribute name: " << USS(rAttributeName));
- pFS->startElementNS( XML_p, XML_to, FSEND );
-
sal_uInt32 nColor;
if (rValue >>= nColor)
{
// RGB color
- WriteAnimationProperty(pFS, rValue);
+ WriteAnimationProperty(pFS, rValue, XML_to);
}
else
- WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName));
-
- pFS->endElementNS( XML_p, XML_to );
+ WriteAnimationProperty(pFS, AnimationExporter::convertAnimateValue(rValue, rAttributeName), XML_to);
}
void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, const OUString& rAttributeName )
commit 79d646a222c81b1622d45b69a99a460f0b259924
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Wed Mar 14 18:59:49 2018 +0100
tdf#90627 Don't save empty conditions
Change-Id: I5a953c1b0fff7bf41a59360a8f52596264ddf266
Reviewed-on: https://gerrit.libreoffice.org/51293
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51455
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit a21204ec1cf0b5f311f581ecce437785005d0456)
diff --git a/sd/qa/unit/data/odp/tdf90627.odp b/sd/qa/unit/data/odp/tdf90627.odp
new file mode 100644
index 000000000000..dfa28c9b09a3
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf90627.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 9818801662aa..ed1076fe1f0e 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -130,6 +130,7 @@ public:
void testTdf115394Zero();
/// SmartArt animated elements
void testTdf104792();
+ void testTdf90627();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -180,6 +181,7 @@ public:
CPPUNIT_TEST(testTdf115394);
CPPUNIT_TEST(testTdf115394Zero);
CPPUNIT_TEST(testTdf104792);
+ CPPUNIT_TEST(testTdf90627);
CPPUNIT_TEST_SUITE_END();
@@ -1215,6 +1217,19 @@ void SdOOXMLExportTest2::testTdf104792()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testTdf90627()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf90627.odp"), ODP);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ // Don't export empty conditions
+ assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:endCondLst", 0);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index 7c4ab7a9580a..fb8617491936 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -103,8 +103,8 @@ protected:
static void WriteAnimateTo( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rValue, const OUString& rAttributeName );
static void WriteAnimateValues( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimate >& rXAnimate );
- static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, css::uno::Any& rAny, bool bWriteEvent, bool bMainSeqChild );
- static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay );
+ static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, css::uno::Any const & rAny, bool bWriteEvent, bool bMainSeqChild, sal_Int32 nToken );
+ static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay, sal_Int32 nToken );
void WriteAnimations( const ::sax_fastparser::FSHelperPtr& pFS );
static void WriteAnimationAttributeName( const ::sax_fastparser::FSHelperPtr& pFS, const OUString& rAttributeName );
void WriteAnimationNode( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c977471aaaa8..ca50427f4bab 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1250,29 +1250,35 @@ void PowerPointExport::WriteAnimationNodeAnimateInside( const FSHelperPtr& pFS,
WriteAnimateTo( pFS, rXAnimate->getTo(), rXAnimate->getAttributeName() );
}
-void PowerPointExport::WriteAnimationCondition( const FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay )
+void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay, sal_Int32 nToken)
{
- if( bHasFDelay || pDelay || pEvent ) {
- if( !pEvent )
- pFS->singleElementNS( XML_p, XML_cond,
- XML_delay, bHasFDelay ? I64S( (sal_uInt32) (fDelay*1000.0) ) : pDelay,
- FSEND );
- else {
- pFS->startElementNS( XML_p, XML_cond,
- XML_delay, bHasFDelay ? I64S( (sal_uInt32) (fDelay*1000.0) ) : pDelay,
- XML_evt, pEvent,
- FSEND );
+ if (bHasFDelay || pDelay || pEvent)
+ {
+ pFS->startElementNS(XML_p, nToken, FSEND);
+
+ if (!pEvent)
+ pFS->singleElementNS(XML_p, XML_cond,
+ XML_delay, bHasFDelay ? I64S(static_cast<sal_uInt32>(fDelay*1000.0)) : pDelay,
+ FSEND);
+ else
+ {
+ pFS->startElementNS(XML_p, XML_cond,
+ XML_delay, bHasFDelay ? I64S(static_cast<sal_uInt32>(fDelay*1000.0)) : pDelay,
+ XML_evt, pEvent,
+ FSEND);
- pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
- pFS->singleElementNS( XML_p, XML_sldTgt, FSEND );
- pFS->endElementNS( XML_p, XML_tgtEl );
+ pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
+ pFS->singleElementNS( XML_p, XML_sldTgt, FSEND );
+ pFS->endElementNS( XML_p, XML_tgtEl );
- pFS->endElementNS( XML_p, XML_cond );
- }
+ pFS->endElementNS(XML_p, XML_cond);
+ }
+
+ pFS->endElementNS(XML_p, nToken);
}
}
-void PowerPointExport::WriteAnimationCondition( const FSHelperPtr& pFS, Any& rAny, bool bWriteEvent, bool bMainSeqChild )
+void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const& rAny, bool bWriteEvent, bool bMainSeqChild, sal_Int32 nToken)
{
bool bHasFDelay = false;
double fDelay = 0;
@@ -1355,7 +1361,7 @@ void PowerPointExport::WriteAnimationCondition( const FSHelperPtr& pFS, Any& rAn
}
}
- WriteAnimationCondition( pFS, pDelay, pEvent, fDelay, bHasFDelay );
+ WriteAnimationCondition(pFS, pDelay, pEvent, fDelay, bHasFDelay, nToken);
}
void PowerPointExport::WriteAnimationNodeCommonPropsStart( const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bSingle, bool bMainSeqChild )
@@ -1501,26 +1507,22 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart( const FSHelperPtr& pF
if( aAny.hasValue() ) {
Sequence< Any > aCondSeq;
- pFS->startElementNS( XML_p, XML_stCondLst, FSEND );
if( aAny >>= aCondSeq ) {
for( int i = 0; i < aCondSeq.getLength(); i ++ )
- WriteAnimationCondition( pFS, aCondSeq[ i ], false, bMainSeqChild );
+ WriteAnimationCondition( pFS, aCondSeq[ i ], false, bMainSeqChild, XML_stCondLst );
} else
- WriteAnimationCondition( pFS, aAny, false, bMainSeqChild );
- pFS->endElementNS( XML_p, XML_stCondLst );
+ WriteAnimationCondition( pFS, aAny, false, bMainSeqChild, XML_stCondLst );
}
aAny = rXNode->getEnd();
if( aAny.hasValue() ) {
Sequence< Any > aCondSeq;
- pFS->startElementNS( XML_p, XML_endCondLst, FSEND );
if( aAny >>= aCondSeq ) {
for( int i = 0; i < aCondSeq.getLength(); i ++ )
- WriteAnimationCondition( pFS, aCondSeq[ i ], false, bMainSeqChild );
+ WriteAnimationCondition( pFS, aCondSeq[ i ], false, bMainSeqChild, XML_endCondLst );
} else
- WriteAnimationCondition( pFS, aAny, false, bMainSeqChild );
- pFS->endElementNS( XML_p, XML_endCondLst );
+ WriteAnimationCondition( pFS, aAny, false, bMainSeqChild, XML_endCondLst );
}
Reference< XEnumerationAccess > xEnumerationAccess( rXNode, UNO_QUERY );
@@ -1556,13 +1558,8 @@ void PowerPointExport::WriteAnimationNodeSeq( const FSHelperPtr& pFS, const Refe
WriteAnimationNodeCommonPropsStart( pFS, rXNode, true, bMainSeqChild );
- pFS->startElementNS( XML_p, XML_prevCondLst, FSEND );
- WriteAnimationCondition( pFS, nullptr, "onPrev", 0, true );
- pFS->endElementNS( XML_p, XML_prevCondLst );
-
- pFS->startElementNS( XML_p, XML_nextCondLst, FSEND );
- WriteAnimationCondition( pFS, nullptr, "onNext", 0, true );
- pFS->endElementNS( XML_p, XML_nextCondLst );
+ WriteAnimationCondition(pFS, nullptr, "onPrev", 0, true, XML_prevCondLst);
+ WriteAnimationCondition(pFS, nullptr, "onNext", 0, true, XML_nextCondLst);
pFS->endElementNS( XML_p, XML_seq );
}
commit fdf2bcaba4ffc240bc26337dbfb697b56d9b9109
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Tue Mar 13 20:57:52 2018 +0100
tdf#104792 Double check for target shape
Change-Id: Ibe23377c7752d9ce97c7b100af4b2759b3ce946f
Reviewed-on: https://gerrit.libreoffice.org/51241
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51454
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 03a5a78a78808e1ec0c1cd4ee41c05cfa49143bd)
diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx
index 0173d3794105..8a2a2bff6521 100644
--- a/oox/source/ppt/animationspersist.cxx
+++ b/oox/source/ppt/animationspersist.cxx
@@ -141,8 +141,14 @@ namespace oox { namespace ppt {
sShapeName = maShapeTarget.msSubShapeId;
Any rTarget;
- ::oox::drawingml::ShapePtr pShape = pSlide->getShape(sShapeName);
- SAL_WARN_IF( !pShape, "oox.ppt", "failed to locate Shape");
+ ::oox::drawingml::ShapePtr pShape = pSlide->getShape( sShapeName );
+ SAL_WARN_IF( !pShape, "oox.ppt", "failed to locate Shape" );
+
+ if( !pShape && maShapeTarget.mnType == XML_dgm )
+ {
+ pShape = pSlide->getShape( msValue );
+ }
+
if( pShape )
{
Reference< XShape > xShape( pShape->getXShape() );
diff --git a/sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx b/sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx
new file mode 100644
index 000000000000..ac72639efd77
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 7cfb05b3228a..9818801662aa 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -128,6 +128,8 @@ public:
void testFontScale();
void testTdf115394();
void testTdf115394Zero();
+ /// SmartArt animated elements
+ void testTdf104792();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -177,6 +179,7 @@ public:
CPPUNIT_TEST(testFontScale);
CPPUNIT_TEST(testTdf115394);
CPPUNIT_TEST(testTdf115394Zero);
+ CPPUNIT_TEST(testTdf104792);
CPPUNIT_TEST_SUITE_END();
@@ -1199,6 +1202,19 @@ void SdOOXMLExportTest2::testTdf115394Zero()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testTdf104792()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[1]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:set/p:cBhvr/p:tgtEl/p:spTgt", 1);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list