summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2021-01-16 23:48:56 +0800
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-21 15:30:11 +0100
commitd56e4aea5fd5d777204f9f4e4b14cf0047348beb (patch)
treee3a8d04ef19dfbdfaeb4980011fb5047e17bc869 /oox
parent6d49ac8214b7d084d07469a6ce2414788f8ef9e0 (diff)
tdf#128550 set sub item on the ancestor node.
The target of a animation node may resolved to a subitem. However it only has effect on a iterate container or animate node, not on any other containers. Subitem setting like background and paragraph got ignored, so everything were shown together. The patch find the ancestor node that is iterate container or animate, and set the subitem on it. Change-Id: Iaaa52aed3a34eb2d70b3b318b8336246e17e1e98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109444 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com> (cherry picked from commit 9b19bf0283b569a5c134de6b5cce1d72d8f37879) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109679 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109754
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/timenode.cxx57
1 files changed, 49 insertions, 8 deletions
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index 41fb39fba150..4071f8b6a8b8 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -51,8 +51,37 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::animations;
using namespace ::com::sun::star::presentation;
-namespace oox::ppt {
+namespace {
+
+void lcl_setAncestorSubItem( const Reference<XAnimationNode>& xParent, sal_Int16 nSubItem )
+{
+
+ Reference<XAnimationNode> xNode = xParent;
+
+ while ( xNode.is() )
+ {
+ if ( xNode->getType() == AnimationNodeType::ANIMATE )
+ {
+ Reference<XAnimate> xAnimate( xNode, UNO_QUERY );
+ if ( xAnimate.is() )
+ xAnimate->setSubItem( nSubItem );
+ break;
+ }
+ else if ( xNode->getType() == AnimationNodeType::ITERATE )
+ {
+ Reference<XIterateContainer> xIterateContainer( xNode, UNO_QUERY );
+ if ( xIterateContainer.is() )
+ xIterateContainer->setSubItem( nSubItem );
+ break;
+ }
+
+ xNode.set( xNode->getParent(), UNO_QUERY );
+ }
+}
+
+}
+namespace oox::ppt {
OUString TimeNode::getServiceName( sal_Int16 nNodeType )
{
OUString sServiceName;
@@ -225,11 +254,17 @@ namespace oox::ppt {
if( mpTarget )
{
- sal_Int16 nSubType(0);
- maNodeProperties[ NP_TARGET ] = mpTarget->convert( pSlide, nSubType );
+ sal_Int16 nSubItem(0);
+ maNodeProperties[ NP_TARGET ] = mpTarget->convert( pSlide, nSubItem );
if( mpTarget->mnType == XML_spTgt )
{
- maNodeProperties[ NP_SUBITEM ] <<= nSubType;
+ if ( xNode->getType() == AnimationNodeType::ANIMATE ||
+ xNode->getType() == AnimationNodeType::ITERATE )
+ {
+ maNodeProperties[ NP_SUBITEM ] <<= nSubItem;
+ }
+ else
+ lcl_setAncestorSubItem( xParent, nSubItem );
}
}
@@ -338,15 +373,21 @@ namespace oox::ppt {
}
break;
case NP_SUBITEM:
- if( xAnimate.is() )
+ if( aValue >>= nInt16 )
{
- if( aValue >>= nInt16 )
+ if( xAnimate.is() )
+ {
xAnimate->setSubItem( nInt16 );
- else
+ }
+ else if ( xIterateContainer.is() )
{
- SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
+ xIterateContainer->setSubItem( nInt16 );
}
}
+ else
+ {
+ SAL_INFO("oox.ppt","any >>= failed " << __LINE__ );
+ }
break;
case NP_ATTRIBUTENAME:
if( xAnimate.is() )