diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-11-26 18:37:20 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-11-26 18:37:20 +0000 |
commit | 4954e95fab988a69a9b5dcf1345a322741d9cb8d (patch) | |
tree | 40f27c954e7d54131a1164e57c62199b3e10b95b /sd | |
parent | 6cf9653c9ced31d14850a3f02a0146cc5203b0aa (diff) |
INTEGRATION: CWS presentationengine01 (1.1.2); FILE ADDED
2004/09/12 22:52:32 cl 1.1.2.6: added text only effects ui support
2004/09/09 14:22:30 cl 1.1.2.5: added random nodes support
2004/09/07 21:51:43 cl 1.1.2.4: added random animation node
2004/09/02 09:10:22 cl 1.1.2.3: moved effect and transition presets access to a singleton
2004/08/19 09:51:13 cl 1.1.2.2: new helper for transition presets
2004/07/28 11:10:34 cl 1.1.2.1: #i31376# added strings for translation
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/CustomAnimationPreset.hxx | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/sd/inc/CustomAnimationPreset.hxx b/sd/inc/CustomAnimationPreset.hxx new file mode 100644 index 000000000000..baeb8d27a89e --- /dev/null +++ b/sd/inc/CustomAnimationPreset.hxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * $RCSfile: CustomAnimationPreset.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2004-11-26 19:37:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SD_CUSTOMANIMATIONPRESET_HXX +#define _SD_CUSTOMANIMATIONPRESET_HXX + +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#include <boost/shared_ptr.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONNODETYPE_HPP_ +#include <com/sun/star/animations/AnimationNodeType.hpp> +#endif + +#ifndef _UTL_STLTYPES_HXX_ +#include <comphelper/stl_types.hxx> +#endif + +#ifndef _SD_CUSTOMANIMATIONEFFECT_HXX +#include <CustomAnimationEffect.hxx> +#endif + + +namespace sd { + +typedef std::hash_map<rtl::OUString, CustomAnimationEffectPtr, comphelper::UStringHash, comphelper::UStringEqual> EffectsSubTypeMap; +typedef std::hash_map<rtl::OUString, rtl::OUString, comphelper::UStringHash, comphelper::UStringEqual> UStringMap; +typedef std::vector< rtl::OUString > UStringList; + +class CustomAnimationPreset +{ + friend class CustomAnimationPresets; + +public: + CustomAnimationPreset( CustomAnimationEffectPtr pEffect ); + + void add( CustomAnimationEffectPtr pEffect ); + + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > create( const rtl::OUString& rstrSubType ); + + const rtl::OUString& getPresetId() const { return maPresetId; } + const rtl::OUString& getProperty() const { return maProperty; } + const rtl::OUString& getLabel() const { return maLabel; } + sal_Int16 getPresetClass() const { return mnPresetClass; } + double getDuration() const { return mfDuration; } + + UStringList getSubTypes(); + UStringList getProperties() const; + + bool hasProperty( const rtl::OUString& rProperty ) const; + bool isTextOnly() const { return mbIsTextOnly; } + +private: + rtl::OUString maPresetId; + rtl::OUString maProperty; + sal_Int16 mnPresetClass; + rtl::OUString maLabel; + rtl::OUString maDefaultSubTyp; + double mfDuration; + bool mbIsTextOnly; + + EffectsSubTypeMap maSubTypes; +}; + +typedef boost::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr; +typedef std::hash_map<rtl::OUString, CustomAnimationPresetPtr, comphelper::UStringHash, comphelper::UStringEqual> EffectDescriptorMap; +typedef std::vector< CustomAnimationPresetPtr > EffectDescriptorList; + +struct PresetCategory +{ + rtl::OUString maLabel; + EffectDescriptorList maEffects; + + PresetCategory( const rtl::OUString& rLabel, const EffectDescriptorList& rEffects ) + : maLabel( rLabel ), maEffects( rEffects ) {} +}; +typedef boost::shared_ptr< PresetCategory > PresetCategoryPtr; +typedef std::vector< PresetCategoryPtr > PresetCategoryList; + +class CustomAnimationPresets +{ +public: + CustomAnimationPresets(); + virtual ~CustomAnimationPresets(); + + void init(); + + static const CustomAnimationPresets& getCustomAnimationPresets(); + + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRandomPreset( sal_Int16 nPresetClass ) const; + + CustomAnimationPresetPtr getEffectDescriptor( const rtl::OUString& rPresetId ) const; +// const AnimationEffect* getEffect( const rtl::OUString& rPresetId ) const; +// const AnimationEffect* getEffect( const rtl::OUString& rPresetId, const rtl::OUString& rPresetSubType ) const; + + const rtl::OUString& getUINameForPresetId( const rtl::OUString& rPresetId ) const; + const rtl::OUString& getUINameForProperty( const rtl::OUString& rProperty ) const; + + const PresetCategoryList& getEntrancePresets() const { return maEntrancePresets; } + const PresetCategoryList& getEmphasisPresets() const { return maEmphasisPresets; } + const PresetCategoryList& getExitPresets() const { return maExitPresets; } + const PresetCategoryList& getMotionPathsPresets() const { return maMotionPathsPresets; } + + void changePresetSubType( CustomAnimationEffectPtr pEffect, const rtl::OUString& rPresetSubType ) const; + +private: + void importEffects(); + void importResources(); + + void importPresets( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xConfigProvider, const rtl::OUString& rNodePath, PresetCategoryList& rPresetMap ); + + const rtl::OUString& translateName( const rtl::OUString& rId, const UStringMap& rNameMap ) const; + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxRootNode; + EffectDescriptorMap maEffectDiscriptorMap; + UStringMap maEffectNameMap; + UStringMap maPropertyNameMap; + + PresetCategoryList maEntrancePresets; + PresetCategoryList maEmphasisPresets; + PresetCategoryList maExitPresets; + PresetCategoryList maMotionPathsPresets; + + static CustomAnimationPresets* mpCustomAnimationPresets; +}; + +typedef boost::shared_ptr< CustomAnimationPresets > CustomAnimationPresetsPtr; + +} + +#endif // _SD_CUSTOMANIMATIONEFFECTS_HXX + |