From 063fea93d6919cf701ca1efa4f9cd5f73a0851d7 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Wed, 25 Feb 2015 12:08:39 +1100 Subject: animations: convert animcore.component to constructor usage Change-Id: Ia623a19457000fe717e29d6b0e73f53b978f7de8 Signed-off-by: Stephan Bergmann --- animations/Library_animcore.mk | 1 - animations/source/animcore/animcore.component | 33 ++-- animations/source/animcore/animcore.cxx | 232 +++++++++++++++++++++++--- animations/source/animcore/factreg.cxx | 69 -------- animations/source/animcore/factreg.hxx | 48 ++++-- 5 files changed, 259 insertions(+), 124 deletions(-) delete mode 100644 animations/source/animcore/factreg.cxx (limited to 'animations') diff --git a/animations/Library_animcore.mk b/animations/Library_animcore.mk index 2f08ae32c036..f0fca838f298 100644 --- a/animations/Library_animcore.mk +++ b/animations/Library_animcore.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Library_use_libraries,animcore,\ $(eval $(call gb_Library_add_exception_objects,animcore,\ animations/source/animcore/animcore \ - animations/source/animcore/factreg \ )) # vim: set noet sw=4 ts=4: diff --git a/animations/source/animcore/animcore.component b/animations/source/animcore/animcore.component index ceb6288daf2f..4ec3d12a04bc 100644 --- a/animations/source/animcore/animcore.component +++ b/animations/source/animcore/animcore.component @@ -19,37 +19,48 @@ - + > - + - + - + - + - + - + - + - + - + - + diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 1c9596dbea8f..1f6d43d2817a 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -510,37 +510,137 @@ AnimationNode::~AnimationNode() { } +Sequence getSupportedServiceNames_PAR() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.ParallelTimeContainer"; + return aRet; +} + +OUString getImplementationName_PAR() +{ + return OUString( "animcore::ParallelTimeContainer" ); +} + +Sequence getSupportedServiceNames_SEQ() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.SequenceTimContainer"; + return aRet; +} + +OUString getImplementationName_SEQ() +{ + return OUString( "animcore::SequenceTimeContainer" ); +} + +Sequence getSupportedServiceNames_ITERATE() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.IterateContainer"; + return aRet; +} + +OUString getImplementationName_ITERATE() +{ + return OUString( "animcore::IterateContainer" ); +} + +Sequence getSupportedServiceNames_ANIMATE() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.Animate"; + return aRet; +} + +OUString getImplementationName_ANIMATE() +{ + return OUString( "animcore::Animate" ); +} + +Sequence getSupportedServiceNames_SET() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.AnimateSet"; + return aRet; +} + +OUString getImplementationName_SET() +{ + return OUString( "animcore::AnimateSet" ); +} + +Sequence getSupportedServiceNames_ANIMATECOLOR(void) +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.AnimateColor"; + return aRet; +} + +OUString getImplementationName_ANIMATECOLOR() +{ + return OUString( "animcore::AnimateColor" ); +} + +Sequence getSupportedServiceNames_ANIMATEMOTION(void) +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.AnimateMotion"; + return aRet; +} +OUString getImplementationName_ANIMATEMOTION() +{ + return OUString( "animcore::AnimateMotion" ); +} -#define IMPL_NODE_FACTORY(N,IN,SN)\ -Reference< XInterface > SAL_CALL createInstance_##N( const Reference< XComponentContext > & ) throw (Exception)\ -{\ - return static_cast< ::cppu::OWeakObject * >(new AnimationNode( N ));\ -}\ -OUString getImplementationName_##N()\ -{\ - return OUString( IN );\ -}\ -Sequence getSupportedServiceNames_##N(void)\ -{\ - Sequence aRet(1);\ - aRet.getArray()[0] = SN;\ - return aRet;\ -} - -IMPL_NODE_FACTORY( PAR, "animcore::ParallelTimeContainer", "com.sun.star.animations.ParallelTimeContainer" ) -IMPL_NODE_FACTORY( SEQ, "animcore::SequenceTimeContainer", "com.sun.star.animations.SequenceTimeContainer" ) -IMPL_NODE_FACTORY( ITERATE, "animcore::IterateContainer", "com.sun.star.animations.IterateContainer" ) -IMPL_NODE_FACTORY( ANIMATE, "animcore::Animate", "com.sun.star.animations.Animate" ) -IMPL_NODE_FACTORY( SET, "animcore::AnimateSet", "com.sun.star.animations.AnimateSet" ) -IMPL_NODE_FACTORY( ANIMATECOLOR, "animcore::AnimateColor", "com.sun.star.animations.AnimateColor" ) -IMPL_NODE_FACTORY( ANIMATEMOTION, "animcore::AnimateMotion", "com.sun.star.animations.AnimateMotion" ) -IMPL_NODE_FACTORY( ANIMATETRANSFORM, "animcore::AnimateTransform", "com.sun.star.animations.AnimateTransform" ) -IMPL_NODE_FACTORY( TRANSITIONFILTER, "animcore::TransitionFilter", "com.sun.star.animations.TransitionFilter" ) -IMPL_NODE_FACTORY( AUDIO, "animcore::Audio", "com.sun.star.animations.Audio" ); -IMPL_NODE_FACTORY( COMMAND, "animcore::Command", "com.sun.star.animations.Command" ); +Sequence getSupportedServiceNames_ANIMATETRANSFORM() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.AnimateTransform"; + return aRet; +} +OUString getImplementationName_ANIMATETRANSFORM() +{ + return OUString( "animcore::AnimateTransform" ); +} +Sequence getSupportedServiceNames_TRANSITIONFILTER() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.TransitionFilter"; + return aRet; +} + +OUString getImplementationName_TRANSITIONFILTER() +{ + return OUString( "animcore::TransitionFilter" ); +} + +Sequence getSupportedServiceNames_AUDIO() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.Audio"; + return aRet; +} + +OUString getImplementationName_AUDIO() +{ + return OUString( "animcore::Audio" ); +} + +Sequence getSupportedServiceNames_COMMAND() +{ + Sequence aRet(1); + aRet.getArray()[0] = "com.sun.star.animations.Command"; + return aRet; +} + +OUString getImplementationName_COMMAND() +{ + return OUString( "animcore::Command" ); +} // XInterface Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeException, std::exception) @@ -2067,4 +2167,82 @@ void AnimationNode::fireChangeListener() } // namespace animcore + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_ParallelTimeContainer_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(PAR)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_SequenceTimeContainer_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(SEQ)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_IterateContainer_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(ITERATE)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_Animate_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(ANIMATE)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_AnimateSet_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(SET)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_AnimateColor_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(ANIMATECOLOR)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_AnimateMotion_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(ANIMATEMOTION)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_AnimateTransform_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(ANIMATETRANSFORM)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_TransitionFilter_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(TRANSITIONFILTER)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_Audio_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(AUDIO)); +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_animations_Command_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence const &) +{ + return cppu::acquire(new animcore::AnimationNode(COMMAND)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/animations/source/animcore/factreg.cxx b/animations/source/animcore/factreg.cxx deleted file mode 100644 index 1b78976f3eba..000000000000 --- a/animations/source/animcore/factreg.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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 . - */ - -#include -#include -#include - -#include - -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -#include "factreg.hxx" - -using namespace animcore; - -#define IMPLEMENTATION_ENTRY(N)\ -{\ - createInstance_##N, getImplementationName_##N ,\ - getSupportedServiceNames_##N, createSingleComponentFactory ,\ - 0, 0\ -}\ - -static const struct ImplementationEntry g_entries[] = -{ - IMPLEMENTATION_ENTRY( PAR ), - IMPLEMENTATION_ENTRY( SEQ ), - IMPLEMENTATION_ENTRY( ITERATE ), - IMPLEMENTATION_ENTRY( ANIMATE ), - IMPLEMENTATION_ENTRY( SET ), - IMPLEMENTATION_ENTRY( ANIMATECOLOR ), - IMPLEMENTATION_ENTRY( ANIMATEMOTION ), - IMPLEMENTATION_ENTRY( ANIMATETRANSFORM ), - IMPLEMENTATION_ENTRY( TRANSITIONFILTER ), - IMPLEMENTATION_ENTRY( AUDIO ), - IMPLEMENTATION_ENTRY( COMMAND ), - { 0, 0, 0, 0, 0, 0 } -}; - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL animcore_component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/animations/source/animcore/factreg.hxx b/animations/source/animcore/factreg.hxx index 24e9c98fdc4d..152976c632b5 100644 --- a/animations/source/animcore/factreg.hxx +++ b/animations/source/animcore/factreg.hxx @@ -22,22 +22,38 @@ namespace animcore { -#define DECL_NODE_FACTORY(N)\ -extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance_##N( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rSMgr ) throw (::com::sun::star::uno::Exception);\ -extern OUString getImplementationName_##N();\ -extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_##N(void) - -DECL_NODE_FACTORY( PAR ); -DECL_NODE_FACTORY( SEQ ); -DECL_NODE_FACTORY( ITERATE ); -DECL_NODE_FACTORY( ANIMATE ); -DECL_NODE_FACTORY( SET ); -DECL_NODE_FACTORY( ANIMATECOLOR ); -DECL_NODE_FACTORY( ANIMATEMOTION ); -DECL_NODE_FACTORY( ANIMATETRANSFORM ); -DECL_NODE_FACTORY( TRANSITIONFILTER ); -DECL_NODE_FACTORY( AUDIO ); -DECL_NODE_FACTORY( COMMAND ); +extern OUString getImplementationName_PAR(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_PAR(); + +extern OUString getImplementationName_SEQ(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_SEQ(); + +extern OUString getImplementationName_ITERATE(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_ITERATE(); + +extern OUString getImplementationName_ANIMATE(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_ANIMATE(); + +extern OUString getImplementationName_SET(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_SET(); + +extern OUString getImplementationName_ANIMATECOLOR(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_ANIMATECOLOR(); + +extern OUString getImplementationName_ANIMATEMOTION(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_ANIMATEMOTION(); + +extern OUString getImplementationName_ANIMATETRANSFORM(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_ANIMATETRANSFORM(); + +extern OUString getImplementationName_TRANSITIONFILTER(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_TRANSITIONFILTER(); + +extern OUString getImplementationName_AUDIO(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_AUDIO(); + +extern OUString getImplementationName_COMMAND(); +extern ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_COMMAND(); } -- cgit