diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2017-09-18 15:30:59 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-09-26 12:08:52 +0200 |
commit | ed8d2a45cb9745b8de1f287a2a6ce95e3ab6b07f (patch) | |
tree | b7c5e8004f26990c17e51685ec89dc3cbf5728ad | |
parent | tdf#112088 gradient stop map -> multimap (diff) | |
download | core-ed8d2a45cb9745b8de1f287a2a6ce95e3ab6b07f.tar.gz core-ed8d2a45cb9745b8de1f287a2a6ce95e3ab6b07f.zip |
tdf#112333 PPTX export fill.type & fill.on
Change-Id: I2407d0227e10204354ee69fd9a2af9ca93077221
Reviewed-on: https://gerrit.libreoffice.org/42432
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/42526
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | oox/source/ppt/animvariantcontext.cxx | 32 | ||||
-rw-r--r-- | oox/source/ppt/pptfilterhelpers.cxx | 1 | ||||
-rw-r--r-- | oox/source/ppt/timenodelistcontext.cxx | 14 | ||||
-rwxr-xr-x | sd/qa/unit/data/pptx/tdf112333.pptx | bin | 0 -> 30459 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 24 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptexanimations.cxx | 11 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 12 |
7 files changed, 89 insertions, 5 deletions
diff --git a/oox/source/ppt/animvariantcontext.cxx b/oox/source/ppt/animvariantcontext.cxx index 1c879a6582ec..9cbfab2e0bb4 100644 --- a/oox/source/ppt/animvariantcontext.cxx +++ b/oox/source/ppt/animvariantcontext.cxx @@ -24,6 +24,7 @@ #include <osl/diagnose.h> #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/drawing/FillStyle.hpp> #include <rtl/ustring.hxx> #include "oox/helper/attributelist.hxx" @@ -140,6 +141,22 @@ namespace oox { namespace ppt { return bRet; } + bool convertFillStyle( const OUString& rString, css::drawing::FillStyle& rValue ) + { + if( rString == "solid" ) + { + rValue = css::drawing::FillStyle::FillStyle_SOLID; + return true; + } + else if( rString == "none" ) + { + rValue = css::drawing::FillStyle::FillStyle_NONE; + return true; + } + else + return false; + } + AnimVariantContext::AnimVariantContext( FragmentHandler2& rParent, sal_Int32 aElement, Any & aValue ) : FragmentHandler2( rParent ) , mnElement( aElement ) @@ -187,8 +204,19 @@ namespace oox { namespace ppt { case PPT_TOKEN( strVal ): { OUString val = rAttribs.getString( XML_val, OUString() ); - convertMeasure( val ); // ignore success or failure if it fails, use as is - maValue = makeAny( val ); + + if( convertMeasure( val ) ) + { + maValue <<= val; + } + else + { + css::drawing::FillStyle eFillStyle; + if( convertFillStyle( val, eFillStyle ) ) + maValue <<= eFillStyle; + else + maValue <<= val; + } return this; } default: diff --git a/oox/source/ppt/pptfilterhelpers.cxx b/oox/source/ppt/pptfilterhelpers.cxx index 6496e9153e60..f117e2a1210d 100644 --- a/oox/source/ppt/pptfilterhelpers.cxx +++ b/oox/source/ppt/pptfilterhelpers.cxx @@ -38,6 +38,7 @@ namespace oox { namespace ppt { { MS_FILLCOLOR, "fillColor", "FillColor" }, { MS_FILLCOLOR, "fillcolor", "FillColor" }, { MS_FILLTYPE, "fill.type", "FillStyle" }, + { MS_FILLTYPE, "fill.on", "FillOn" }, { MS_STROKECOLOR, "stroke.color", "LineColor" }, { MS_STROKEON, "stroke.on", "LineStyle" }, { MS_STYLECOLOR, "style.color", "CharColor" }, diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index 287e67ebf066..fc890c8b97c2 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -189,9 +189,17 @@ namespace oox { namespace ppt { if( maTo >>= aString ) { OSL_TRACE( "Magic conversion %s", OUSTRING_TO_CSTR( aString ) ); - maTo = makeAny( aString == "visible" ); - if( !maTo.has<sal_Bool>() ) - OSL_TRACE( "conversion failed" ); + + if( aString == "visible" || aString == "true" ) + maTo <<= true; + else if( aString == "false" ) + maTo <<= false; + + if (!maTo.has<sal_Bool>()) + { + SAL_WARN("oox.ppt", "conversion failed"); + maTo <<= false; + } } mpNode->setTo( maTo ); } diff --git a/sd/qa/unit/data/pptx/tdf112333.pptx b/sd/qa/unit/data/pptx/tdf112333.pptx Binary files differnew file mode 100755 index 000000000000..c381ed8b353e --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf112333.pptx diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index eee4dadbbeb5..9fda601f4bbf 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -110,6 +110,7 @@ public: void testTdf112552(); void testTdf112557(); void testTdf112088(); + void testTdf112333(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -143,6 +144,7 @@ public: CPPUNIT_TEST(testTdf112552); CPPUNIT_TEST(testTdf112557); CPPUNIT_TEST(testTdf112088); + CPPUNIT_TEST(testTdf112333); CPPUNIT_TEST_SUITE_END(); @@ -900,6 +902,28 @@ void SdOOXMLExportTest2::testTdf112088() assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst", 2); } +void SdOOXMLExportTest2::testTdf112333() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112333.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + + OUString sTo = getXPath(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[1]/p:to/p:strVal", "val"); + CPPUNIT_ASSERT_EQUAL(OUString("solid"), sTo); + + 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[1]/p:cBhvr/p:attrNameLst/p:attrName"); + CPPUNIT_ASSERT_EQUAL(OUString("fill.type"), sAttributeName); + + sTo = getXPath(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[2]/p:to/p:strVal", "val"); + CPPUNIT_ASSERT_EQUAL(OUString("true"), sTo); + + 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[2]/p:cBhvr/p:attrNameLst/p:attrName"); + CPPUNIT_ASSERT_EQUAL(OUString("fill.on"), sAttributeName); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index 30bb1a7276c4..7a15904c7c94 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -1459,6 +1459,17 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "solid"; } } + else if (rAttributeName == "FillOn") + { + bool bFillOn; + if ( rSourceValue >>= bFillOn ) + { + if ( bFillOn ) + aDest += "true"; + else + aDest += "false"; + } + } else if ( rAttributeName == "LineStyle" ) { css::drawing::LineStyle eLineStyle; diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 5d59edfebda0..d76b524119c9 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -923,6 +923,18 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons pFS->writeEscaped("r"); pFS->endElementNS(XML_p, XML_attrName); } + else if (rAttributeName == "FillStyle") + { + pFS->startElementNS(XML_p, XML_attrName, FSEND); + pFS->writeEscaped("fill.type"); + pFS->endElementNS(XML_p, XML_attrName); + } + else if (rAttributeName == "FillOn") + { + pFS->startElementNS(XML_p, XML_attrName, FSEND); + pFS->writeEscaped("fill.on"); + pFS->endElementNS(XML_p, XML_attrName); + } else { SAL_INFO("sd.eppt", "unhandled animation attribute name: " << rAttributeName); |