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>
This commit is contained in:
parent
c72a1a74b5
commit
f44aa84331
@ -23,6 +23,7 @@
|
||||
#include "cppuhelper/exc_hlp.hxx"
|
||||
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#include <com/sun/star/drawing/FillStyle.hpp>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
#include "oox/helper/attributelist.hxx"
|
||||
@ -139,6 +140,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 const & rParent, sal_Int32 aElement, Any & aValue )
|
||||
: FragmentHandler2( rParent )
|
||||
, mnElement( aElement )
|
||||
@ -186,8 +203,18 @@ 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 <<= val;
|
||||
if( convertMeasure( val ) )
|
||||
{
|
||||
maValue <<= val;
|
||||
}
|
||||
else
|
||||
{
|
||||
css::drawing::FillStyle eFillStyle;
|
||||
if( convertFillStyle( val, eFillStyle ) )
|
||||
maValue <<= eFillStyle;
|
||||
else
|
||||
maValue <<= val;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
default:
|
||||
|
@ -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" },
|
||||
|
@ -180,9 +180,16 @@ namespace oox { namespace ppt {
|
||||
OUString aString;
|
||||
if( maTo >>= aString )
|
||||
{
|
||||
maTo <<= aString == "visible";
|
||||
if( !maTo.has<sal_Bool>() )
|
||||
SAL_WARN("oox.ppt", "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 );
|
||||
}
|
||||
|
BIN
sd/qa/unit/data/pptx/tdf112333.pptx
Executable file
BIN
sd/qa/unit/data/pptx/tdf112333.pptx
Executable file
Binary file not shown.
@ -108,6 +108,7 @@ public:
|
||||
void testTdf106867();
|
||||
void testTdf112280();
|
||||
void testTdf112088();
|
||||
void testTdf112333();
|
||||
|
||||
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
|
||||
|
||||
@ -143,6 +144,7 @@ public:
|
||||
CPPUNIT_TEST(testTdf106867);
|
||||
CPPUNIT_TEST(testTdf112280);
|
||||
CPPUNIT_TEST(testTdf112088);
|
||||
CPPUNIT_TEST(testTdf112333);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@ -1068,6 +1070,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();
|
||||
|
@ -1451,6 +1451,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;
|
||||
|
@ -936,6 +936,18 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
|
||||
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_WARN("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user