From 378c038918ca6c7adecf73f49e627c75ebd0e43a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 23 Apr 2013 16:04:30 +0200 Subject: fdo#46808 Convert animations::ParallelTimeContainer to new style Change-Id: Iac6337828c807a132e561b5e9017a708be2e9729 --- animations/source/animcore/animcore.cxx | 18 +++++++--- offapi/UnoApi_offapi.mk | 2 ++ .../sun/star/animations/ParallelTimeContainer.idl | 37 +++++++++++++++++++ .../sun/star/animations/XParallelTimeContainer.idl | 42 ++++++++++++++++++++++ sd/CppunitTest_sd_filters_test.mk | 1 + sd/CppunitTest_sd_regression_test.mk | 1 + sd/source/core/CustomAnimationEffect.cxx | 14 +++++--- sd/source/core/sdpage_animations.cxx | 16 ++++----- sd/source/ui/animations/CustomAnimationPane.cxx | 22 ++++++------ sd/source/ui/unoidl/randomnode.cxx | 10 ++---- 10 files changed, 125 insertions(+), 38 deletions(-) create mode 100644 offapi/com/sun/star/animations/ParallelTimeContainer.idl create mode 100644 offapi/com/sun/star/animations/XParallelTimeContainer.idl diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index a503097f07d5..5b83bc0f43a9 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -108,8 +109,8 @@ class AnimationNodeBase : public XAnimateMotion, public XTransitionFilter, public XAnimateSet, public XAnimateTransform, + public XParallelTimeContainer, public XIterateContainer, - public XEnumerationAccess, public XServiceInfo, public XTypeProvider, public XAudio, @@ -547,9 +548,9 @@ Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeEx aType, static_cast< XServiceInfo * >( this ), static_cast< XTypeProvider * >( this ), - static_cast< XChild * >( static_cast< XTimeContainer * >(this) ), + static_cast< XChild * >( static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ) ), static_cast< XCloneable* >( this ), - static_cast< XAnimationNode* >( static_cast< XTimeContainer * >(this) ), + static_cast< XAnimationNode* >( static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ) ), static_cast< XInterface* >(static_cast< OWeakObject * >(this)), static_cast< XWeak* >(static_cast< OWeakObject * >(this)), static_cast< XChangesNotifier* >( this ), @@ -560,17 +561,24 @@ Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeEx switch( mnNodeType ) { case AnimationNodeType::PAR: + aRet = ::cppu::queryInterface( + aType, + static_cast< XParallelTimeContainer * >( this ), + static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ), + static_cast< XEnumerationAccess * >( this ), + static_cast< XElementAccess * >( this ) ); + break; case AnimationNodeType::SEQ: aRet = ::cppu::queryInterface( aType, - static_cast< XTimeContainer * >( this ), + static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ), static_cast< XEnumerationAccess * >( this ), static_cast< XElementAccess * >( this ) ); break; case AnimationNodeType::ITERATE: aRet = ::cppu::queryInterface( aType, - static_cast< XTimeContainer * >( this ), + static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ), static_cast< XIterateContainer * >( this ), static_cast< XEnumerationAccess * >( this ), static_cast< XElementAccess * >( this ) ); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 2099eba7776b..ed72206f6da9 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -36,6 +36,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/accessibil AccessBridge \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/animations,\ + ParallelTimeContainer \ SequenceTimeContainer \ TargetPropertiesCreator \ )) @@ -1647,6 +1648,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/animations,\ XAudio \ XCommand \ XIterateContainer \ + XParallelTimeContainer \ XTargetPropertiesCreator \ XTimeContainer \ XTransitionFilter \ diff --git a/offapi/com/sun/star/animations/ParallelTimeContainer.idl b/offapi/com/sun/star/animations/ParallelTimeContainer.idl new file mode 100644 index 000000000000..a74b77cd9466 --- /dev/null +++ b/offapi/com/sun/star/animations/ParallelTimeContainer.idl @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_animations_ParallelTimeContainer_idl__ +#define __com_sun_star_animations_ParallelTimeContainer_idl__ + +#include + +module com { module sun { module star { module animations { + + +/** + @since LibreOffice 4.1 +*/ +service ParallelTimeContainer : com::sun::star::animations::XParallelTimeContainer; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/animations/XParallelTimeContainer.idl b/offapi/com/sun/star/animations/XParallelTimeContainer.idl new file mode 100644 index 000000000000..42c38645ecc3 --- /dev/null +++ b/offapi/com/sun/star/animations/XParallelTimeContainer.idl @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_animations_XParallelTimeContainer_idl__ +#define __com_sun_star_animations_XParallelTimeContainer_idl__ + +#include +#include + +module com { module sun { module star { module animations { + + +/** + @since LibreOffice 4.1 +*/ +interface XParallelTimeContainer +{ + interface com::sun::star::animations::XTimeContainer; + interface com::sun::star::container::XEnumerationAccess; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/CppunitTest_sd_filters_test.mk b/sd/CppunitTest_sd_filters_test.mk index 5ec613409b0f..23c9709a3c1b 100644 --- a/sd/CppunitTest_sd_filters_test.mk +++ b/sd/CppunitTest_sd_filters_test.mk @@ -71,6 +71,7 @@ $(eval $(call gb_CppunitTest_use_api,sd_filters_test,\ $(eval $(call gb_CppunitTest_use_ure,sd_filters_test)) $(eval $(call gb_CppunitTest_use_components,sd_filters_test,\ + animations/source/animcore/animcore \ basic/util/sb \ comphelper/util/comphelp \ configmgr/source/configmgr \ diff --git a/sd/CppunitTest_sd_regression_test.mk b/sd/CppunitTest_sd_regression_test.mk index 4c616efae9a6..9121af4ace13 100644 --- a/sd/CppunitTest_sd_regression_test.mk +++ b/sd/CppunitTest_sd_regression_test.mk @@ -66,6 +66,7 @@ $(eval $(call gb_CppunitTest_use_api,sd_regression_test,\ $(eval $(call gb_CppunitTest_use_ure,sd_regression_test)) $(eval $(call gb_CppunitTest_use_components,sd_regression_test,\ + animations/source/animcore/animcore \ basic/util/sb \ comphelper/util/comphelp \ configmgr/source/configmgr \ diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index c24b3c9dbf90..9b397bea4708 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1036,11 +1037,14 @@ void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType ) { sal_Int16 nTargetSubItem = mnTargetSubItem; - Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() ); - const char * pServiceName = - nIterateType ? "com.sun.star.animations.IterateContainer" : "com.sun.star.animations.ParallelTimeContainer"; - Reference< XTimeContainer > xNewContainer( - xMsf->createInstance( OUString::createFromAscii(pServiceName) ), UNO_QUERY_THROW ); + Reference< XTimeContainer > xNewContainer; + if(nIterateType) + { + Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() ); + xNewContainer.set( xMsf->createInstance( OUString::createFromAscii("com.sun.star.animations.IterateContainer") ), UNO_QUERY_THROW ); + } + else + xNewContainer.set( ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() ), UNO_QUERY_THROW ); Reference< XTimeContainer > xOldContainer( mxNode, UNO_QUERY_THROW ); Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY_THROW ); diff --git a/sd/source/core/sdpage_animations.cxx b/sd/source/core/sdpage_animations.cxx index e14bba4eafab..0c322d1d9f01 100644 --- a/sd/source/core/sdpage_animations.cxx +++ b/sd/source/core/sdpage_animations.cxx @@ -17,9 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include +#include #include #include #include @@ -52,14 +53,11 @@ Reference< XAnimationNode > SdPage::getAnimationNode() throw (RuntimeException) { if( !mxAnimationNode.is() ) { - mxAnimationNode = Reference< XAnimationNode >::query(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.animations.ParallelTimeContainer")); - if( mxAnimationNode.is() ) - { - Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); - aUserData[0].Name = "node-type"; - aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; - mxAnimationNode->setUserData( aUserData ); - } + mxAnimationNode.set( ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() ), UNO_QUERY_THROW ); + Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); + aUserData[0].Name = "node-type"; + aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; + mxAnimationNode->setUserData( aUserData ); } return mxAnimationNode; diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 4dc8ef9b2fcf..e686b3e20e01 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -2364,18 +2365,15 @@ void CustomAnimationPane::onPreview( bool bForcePreview ) void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimationNode ) { - Reference< XTimeContainer > xRoot(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.animations.ParallelTimeContainer"), UNO_QUERY); - if( xRoot.is() ) - { - Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); - aUserData[0].Name = "node-type"; - aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; - xRoot->setUserData( aUserData ); - xRoot->appendChild( xAnimationNode ); - - Reference< XAnimationNode > xNode( xRoot, UNO_QUERY ); - SlideShow::StartPreview( mrBase, mxCurrentPage, xNode ); - } + Reference< XParallelTimeContainer > xRoot = ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() ); + Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); + aUserData[0].Name = "node-type"; + aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; + xRoot->setUserData( aUserData ); + xRoot->appendChild( xAnimationNode ); + + Reference< XAnimationNode > xNode( xRoot, UNO_QUERY ); + SlideShow::StartPreview( mrBase, mxCurrentPage, xNode ); } diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx index ee3c74b15e4d..a18fd1c22619 100644 --- a/sd/source/ui/unoidl/randomnode.cxx +++ b/sd/source/ui/unoidl/randomnode.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -597,13 +598,8 @@ Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration() else { // no presets? give empty node! - Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); - Reference< XEnumerationAccess > aEmptyEnumAccess( - xServiceFactory->createInstance( "com.sun.star.animations.ParallelTimeContainer" ), - UNO_QUERY ); - - if( aEmptyEnumAccess.is() ) - xEnum = aEmptyEnumAccess->createEnumeration(); + Reference< XParallelTimeContainer > xTimeContainer = ParallelTimeContainer::create( comphelper::getProcessComponentContext() ); + xEnum = xTimeContainer->createEnumeration(); } return xEnum; -- cgit v1.2.3