fdo#46808 Convert animations::ParallelTimeContainer to new style

Change-Id: Iac6337828c807a132e561b5e9017a708be2e9729
This commit is contained in:
Noel Grandin 2013-04-23 16:04:30 +02:00
parent 3086d847d9
commit 378c038918
10 changed files with 124 additions and 37 deletions

View File

@ -25,6 +25,7 @@
#include <com/sun/star/animations/XAnimateSet.hpp> #include <com/sun/star/animations/XAnimateSet.hpp>
#include <com/sun/star/animations/XAnimateMotion.hpp> #include <com/sun/star/animations/XAnimateMotion.hpp>
#include <com/sun/star/animations/XAnimateTransform.hpp> #include <com/sun/star/animations/XAnimateTransform.hpp>
#include <com/sun/star/animations/XParallelTimeContainer.hpp>
#include <com/sun/star/animations/XTransitionFilter.hpp> #include <com/sun/star/animations/XTransitionFilter.hpp>
#include <com/sun/star/animations/XTimeContainer.hpp> #include <com/sun/star/animations/XTimeContainer.hpp>
#include <com/sun/star/animations/XIterateContainer.hpp> #include <com/sun/star/animations/XIterateContainer.hpp>
@ -108,8 +109,8 @@ class AnimationNodeBase : public XAnimateMotion,
public XTransitionFilter, public XTransitionFilter,
public XAnimateSet, public XAnimateSet,
public XAnimateTransform, public XAnimateTransform,
public XParallelTimeContainer,
public XIterateContainer, public XIterateContainer,
public XEnumerationAccess,
public XServiceInfo, public XServiceInfo,
public XTypeProvider, public XTypeProvider,
public XAudio, public XAudio,
@ -547,9 +548,9 @@ Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeEx
aType, aType,
static_cast< XServiceInfo * >( this ), static_cast< XServiceInfo * >( this ),
static_cast< XTypeProvider * >( 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< 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< XInterface* >(static_cast< OWeakObject * >(this)),
static_cast< XWeak* >(static_cast< OWeakObject * >(this)), static_cast< XWeak* >(static_cast< OWeakObject * >(this)),
static_cast< XChangesNotifier* >( this ), static_cast< XChangesNotifier* >( this ),
@ -560,17 +561,24 @@ Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeEx
switch( mnNodeType ) switch( mnNodeType )
{ {
case AnimationNodeType::PAR: 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: case AnimationNodeType::SEQ:
aRet = ::cppu::queryInterface( aRet = ::cppu::queryInterface(
aType, aType,
static_cast< XTimeContainer * >( this ), static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ),
static_cast< XEnumerationAccess * >( this ), static_cast< XEnumerationAccess * >( this ),
static_cast< XElementAccess * >( this ) ); static_cast< XElementAccess * >( this ) );
break; break;
case AnimationNodeType::ITERATE: case AnimationNodeType::ITERATE:
aRet = ::cppu::queryInterface( aRet = ::cppu::queryInterface(
aType, aType,
static_cast< XTimeContainer * >( this ), static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ),
static_cast< XIterateContainer * >( this ), static_cast< XIterateContainer * >( this ),
static_cast< XEnumerationAccess * >( this ), static_cast< XEnumerationAccess * >( this ),
static_cast< XElementAccess * >( this ) ); static_cast< XElementAccess * >( this ) );

View File

@ -36,6 +36,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/accessibil
AccessBridge \ AccessBridge \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/animations,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/animations,\
ParallelTimeContainer \
SequenceTimeContainer \ SequenceTimeContainer \
TargetPropertiesCreator \ TargetPropertiesCreator \
)) ))
@ -1647,6 +1648,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/animations,\
XAudio \ XAudio \
XCommand \ XCommand \
XIterateContainer \ XIterateContainer \
XParallelTimeContainer \
XTargetPropertiesCreator \ XTargetPropertiesCreator \
XTimeContainer \ XTimeContainer \
XTransitionFilter \ XTransitionFilter \

View File

@ -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 <com/sun/star/animations/XParallelTimeContainer.idl>
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: */

View File

@ -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 <com/sun/star/animations/XTimeContainer.idl>
#include <com/sun/star/container/XEnumerationAccess.idl>
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: */

View File

@ -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_ure,sd_filters_test))
$(eval $(call gb_CppunitTest_use_components,sd_filters_test,\ $(eval $(call gb_CppunitTest_use_components,sd_filters_test,\
animations/source/animcore/animcore \
basic/util/sb \ basic/util/sb \
comphelper/util/comphelp \ comphelper/util/comphelp \
configmgr/source/configmgr \ configmgr/source/configmgr \

View File

@ -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_ure,sd_regression_test))
$(eval $(call gb_CppunitTest_use_components,sd_regression_test,\ $(eval $(call gb_CppunitTest_use_components,sd_regression_test,\
animations/source/animcore/animcore \
basic/util/sb \ basic/util/sb \
comphelper/util/comphelp \ comphelper/util/comphelp \
configmgr/source/configmgr \ configmgr/source/configmgr \

View File

@ -20,6 +20,7 @@
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/animations/AnimationFill.hpp> #include <com/sun/star/animations/AnimationFill.hpp>
#include <com/sun/star/animations/ParallelTimeContainer.hpp>
#include <com/sun/star/animations/SequenceTimeContainer.hpp> #include <com/sun/star/animations/SequenceTimeContainer.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/presentation/EffectNodeType.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp>
@ -1036,11 +1037,14 @@ void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType )
{ {
sal_Int16 nTargetSubItem = mnTargetSubItem; sal_Int16 nTargetSubItem = mnTargetSubItem;
Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() ); Reference< XTimeContainer > xNewContainer;
const char * pServiceName = if(nIterateType)
nIterateType ? "com.sun.star.animations.IterateContainer" : "com.sun.star.animations.ParallelTimeContainer"; {
Reference< XTimeContainer > xNewContainer( Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
xMsf->createInstance( OUString::createFromAscii(pServiceName) ), UNO_QUERY_THROW ); 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< XTimeContainer > xOldContainer( mxNode, UNO_QUERY_THROW );
Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY_THROW ); Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY_THROW );

View File

@ -17,9 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <com/sun/star/presentation/ParagraphTarget.hpp> #include <com/sun/star/animations/ParallelTimeContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/presentation/EffectNodeType.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp>
#include <com/sun/star/presentation/ParagraphTarget.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <editeng/outliner.hxx> #include <editeng/outliner.hxx>
@ -52,14 +53,11 @@ Reference< XAnimationNode > SdPage::getAnimationNode() throw (RuntimeException)
{ {
if( !mxAnimationNode.is() ) if( !mxAnimationNode.is() )
{ {
mxAnimationNode = Reference< XAnimationNode >::query(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.animations.ParallelTimeContainer")); mxAnimationNode.set( ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() ), UNO_QUERY_THROW );
if( mxAnimationNode.is() ) Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
{ aUserData[0].Name = "node-type";
Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT;
aUserData[0].Name = "node-type"; mxAnimationNode->setUserData( aUserData );
aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT;
mxAnimationNode->setUserData( aUserData );
}
} }
return mxAnimationNode; return mxAnimationNode;

View File

@ -20,6 +20,7 @@
#include <com/sun/star/presentation/EffectPresetClass.hpp> #include <com/sun/star/presentation/EffectPresetClass.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/animations/ParallelTimeContainer.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShape.hpp>
@ -2364,18 +2365,15 @@ void CustomAnimationPane::onPreview( bool bForcePreview )
void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimationNode ) void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimationNode )
{ {
Reference< XTimeContainer > xRoot(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.animations.ParallelTimeContainer"), UNO_QUERY); Reference< XParallelTimeContainer > xRoot = ParallelTimeContainer::create( ::comphelper::getProcessComponentContext() );
if( xRoot.is() ) Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
{ aUserData[0].Name = "node-type";
Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 ); aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT;
aUserData[0].Name = "node-type"; xRoot->setUserData( aUserData );
aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; xRoot->appendChild( xAnimationNode );
xRoot->setUserData( aUserData );
xRoot->appendChild( xAnimationNode );
Reference< XAnimationNode > xNode( xRoot, UNO_QUERY ); Reference< XAnimationNode > xNode( xRoot, UNO_QUERY );
SlideShow::StartPreview( mrBase, mxCurrentPage, xNode ); SlideShow::StartPreview( mrBase, mxCurrentPage, xNode );
}
} }

View File

@ -23,6 +23,7 @@
#include <com/sun/star/animations/AnimationFill.hpp> #include <com/sun/star/animations/AnimationFill.hpp>
#include <com/sun/star/animations/XAnimate.hpp> #include <com/sun/star/animations/XAnimate.hpp>
#include <com/sun/star/animations/AnimationRestart.hpp> #include <com/sun/star/animations/AnimationRestart.hpp>
#include <com/sun/star/animations/ParallelTimeContainer.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp>
@ -597,13 +598,8 @@ Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
else else
{ {
// no presets? give empty node! // no presets? give empty node!
Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); Reference< XParallelTimeContainer > xTimeContainer = ParallelTimeContainer::create( comphelper::getProcessComponentContext() );
Reference< XEnumerationAccess > aEmptyEnumAccess( xEnum = xTimeContainer->createEnumeration();
xServiceFactory->createInstance( "com.sun.star.animations.ParallelTimeContainer" ),
UNO_QUERY );
if( aEmptyEnumAccess.is() )
xEnum = aEmptyEnumAccess->createEnumeration();
} }
return xEnum; return xEnum;