Kaydet (Commit) 18cd4b27 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

pptx: "fall" transition, which needed p15 namespace

Added p15 namespace which is present in MSO 2013+ documents. It
adds a "prstTrans" element with a string "prst" attribute which
is a name of the transition to be performed.

This was added to support "fall" transition which translates to
"fallOver" preset transition.

Change-Id: I429bb106a12c1b99cce756502508e917720daef3
üst 9d3cb711
......@@ -53,6 +53,9 @@ namespace oox { namespace ppt {
void setOoxTransitionType( ::sal_Int32 OoxType,
::sal_Int32 param1, ::sal_Int32 param2 );
void setPresetTransition(OUString sPresetTransition);
private:
::sal_Int16 mnTransitionType;
::sal_Int16 mnTransitionSubType;
......
......@@ -72,6 +72,7 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis
static std::vector<OUString> aSupportedNS =
{
"p14",
"p15",
};
if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end())
......
......@@ -121,6 +121,7 @@ struct NamespaceIds: public rtl::StaticWithInit<
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main",
"http://schemas.libreoffice.org/",
"http://schemas.microsoft.com/office/powerpoint/2010/main"
"http://schemas.microsoft.com/office/powerpoint/2012/main"
};
static const sal_Int32 namespaceIds[] = {
......@@ -150,6 +151,7 @@ struct NamespaceIds: public rtl::StaticWithInit<
NMSP_xls14Lst,
NMSP_loext,
NMSP_p14,
NMSP_p15,
};
Sequence< beans::Pair< OUString, sal_Int32 > > aRet(SAL_N_ELEMENTS(namespaceIds));
......
......@@ -419,6 +419,19 @@ namespace oox { namespace ppt {
}
}
void SlideTransition::setPresetTransition(OUString sPresetTransition)
{
if (sPresetTransition == "fallOver")
{
mnTransitionType = TransitionType::MISCSHAPEWIPE;
mnTransitionSubType = TransitionSubType::LEFTTORIGHT;
}
else
{
mnTransitionType = 0;
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -152,6 +152,14 @@ SlideTransitionContext::~SlideTransitionContext() throw()
maTransition.setOoxTransitionType(aElementToken, sal_Int32(rAttribs.getBool(XML_isInverted, false)), 0);
}
return this;
case P15_TOKEN(prstTrans):
if (!mbHasTransition)
{
mbHasTransition = true;
maTransition.setPresetTransition(rAttribs.getString(XML_prst, ""));
}
return this;
default:
break;
......
......@@ -80,6 +80,10 @@ w14 http://schemas.microsoft.com/office/word/2010/wordml
a14 http://schemas.microsoft.com/office/drawingml/2010/main
p14 http://schemas.microsoft.com/office/powerpoint/2010/main
# MSO 2012/2013 extensions ---------------------------------------------------------
p15 http://schemas.microsoft.com/office/powerpoint/2012/main
# extlst namespaces
# xls14Lst for features introduced by excel 2010
......
......@@ -41,6 +41,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
#define PC_TOKEN( token ) OOX_TOKEN( packageContentTypes, token )
#define PPT_TOKEN( token ) OOX_TOKEN( ppt, token )
#define P14_TOKEN( token ) OOX_TOKEN( p14, token )
#define P15_TOKEN( token ) OOX_TOKEN( p15, token )
#define PR_TOKEN( token ) OOX_TOKEN( packageRel, token )
#define R_TOKEN( token ) OOX_TOKEN( officeRel, token )
#define VML_TOKEN( token ) OOX_TOKEN( vml, token )
......
......@@ -80,6 +80,10 @@ w14 http://schemas.microsoft.com/office/word/2010/wordml
a14 http://schemas.microsoft.com/office/drawing/2010/main
p14 http://schemas.microsoft.com/office/powerpoint/2010/main
# MSO 2012/2013 extensions ---------------------------------------------------------
p15 http://schemas.microsoft.com/office/powerpoint/2012/main
# extlst namespaces
# xls14Lst for features introduced by excel 2010
......
......@@ -3798,6 +3798,7 @@ overwriteClear
owners
p
p14
p15
pBdr
pLen
pPos
......
......@@ -1415,6 +1415,9 @@ void SdExportTest::testExportTransitionsPPTX()
// INSIDE TURNING CUBE
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 60, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSIN));
// FALL
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 61, TransitionType::MISCSHAPEWIPE, TransitionSubType::LEFTTORIGHT));
// VORTEX
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 70, TransitionType::MISCSHAPEWIPE, TransitionSubType::VERTICAL));
......
......@@ -70,6 +70,7 @@
FSNS(XML_xmlns, XML_p), "http://schemas.openxmlformats.org/presentationml/2006/main", \
FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", \
FSNS(XML_xmlns, XML_p14), "http://schemas.microsoft.com/office/powerpoint/2010/main", \
FSNS(XML_xmlns, XML_p15), "http://schemas.microsoft.com/office/powerpoint/2012/main", \
FSNS(XML_xmlns, XML_mc), "http://schemas.openxmlformats.org/markup-compatibility/2006"
......@@ -521,16 +522,20 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
bool bOOXmlSpecificTransition = false;
sal_Int32 nTransition = 0;
sal_Int32 nTransition14 = 0;
const char* pDirection = NULL;
const char* pDirection14 = NULL;
const char* pOrientation = NULL;
const char* pThruBlk = NULL;
const char* pSpokes = NULL;
char pSpokesTmp[2] = "0";
// p14
sal_Int32 nTransition14 = 0;
const char* pInverted = nullptr;
//p15
const char* pPresetTransition = nullptr;
if (!nPPTTransitionType)
{
switch(nTransitionType)
......@@ -570,6 +575,11 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
nTransition14 = XML_ripple;
bOOXmlSpecificTransition = true;
break;
case animations::TransitionSubType::LEFTTORIGHT: // Fall
nTransition = XML_fade;
pPresetTransition = "fallOver";
bOOXmlSpecificTransition = true;
break;
case animations::TransitionSubType::CORNERSIN:
pInverted = "true";
case animations::TransitionSubType::CORNERSOUT:
......@@ -615,20 +625,32 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
if( changeType == 1 && GETA( Duration ) )
mAny >>= advanceTiming;
if (nTransition14)
if (nTransition14 || pPresetTransition)
{
const char* pRequiresNS = nTransition14 ? "p14" : "p15";
pFS->startElement(FSNS(XML_mc, XML_AlternateContent), FSEND);
pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "p14", FSEND);
pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, pRequiresNS, FSEND);
pFS->startElementNS(XML_p, XML_transition,
XML_spd, speed,
XML_advTm, advanceTiming != -1 ? I32S( advanceTiming*1000 ) : NULL,
FSEND );
pFS->singleElementNS(XML_p14, nTransition14,
XML_isInverted, pInverted,
XML_dir, pDirection14,
FSEND );
if (nTransition14)
{
pFS->singleElementNS(XML_p14, nTransition14,
XML_isInverted, pInverted,
XML_dir, pDirection14,
FSEND );
}
else if (pPresetTransition)
{
pFS->singleElementNS(XML_p15, XML_prstTrans,
XML_prst, pPresetTransition,
FSEND );
}
pFS->endElement(FSNS(XML_p, XML_transition));
......@@ -745,7 +767,7 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
pFS->endElementNS(XML_p, XML_transition);
if (nTransition14)
if (nTransition14 || pPresetTransition)
{
pFS->endElement(FSNS(XML_mc, XML_Fallback));
pFS->endElement(FSNS(XML_mc, XML_AlternateContent));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment