1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _SD_CUSTOMANIMATIONPRESET_HXX 25*b1cdbd2cSJim Jagielski #define _SD_CUSTOMANIMATIONPRESET_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #ifndef BOOST_SHARED_PTR_HPP_INCLUDED 28*b1cdbd2cSJim Jagielski #include <boost/shared_ptr.hpp> 29*b1cdbd2cSJim Jagielski #endif 30*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XMultiServiceFactory.hpp> 31*b1cdbd2cSJim Jagielski #include <com/sun/star/animations/AnimationNodeType.hpp> 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski #ifndef _UTL_STLTYPES_HXX_ 34*b1cdbd2cSJim Jagielski #include <comphelper/stl_types.hxx> 35*b1cdbd2cSJim Jagielski #endif 36*b1cdbd2cSJim Jagielski #include <CustomAnimationEffect.hxx> 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski #include <hash_map> 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski namespace sd { 41*b1cdbd2cSJim Jagielski 42*b1cdbd2cSJim Jagielski typedef std::hash_map< rtl::OUString, CustomAnimationEffectPtr, comphelper::UStringHash, comphelper::UStringEqual > EffectsSubTypeMap; 43*b1cdbd2cSJim Jagielski typedef std::hash_map< rtl::OUString, rtl::OUString, comphelper::UStringHash, comphelper::UStringEqual > UStringMap; 44*b1cdbd2cSJim Jagielski typedef std::vector< rtl::OUString > UStringList; 45*b1cdbd2cSJim Jagielski 46*b1cdbd2cSJim Jagielski class CustomAnimationPreset 47*b1cdbd2cSJim Jagielski { 48*b1cdbd2cSJim Jagielski friend class CustomAnimationPresets; 49*b1cdbd2cSJim Jagielski 50*b1cdbd2cSJim Jagielski public: 51*b1cdbd2cSJim Jagielski CustomAnimationPreset( CustomAnimationEffectPtr pEffect ); 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski void add( CustomAnimationEffectPtr pEffect ); 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim Jagielski SD_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > create( const rtl::OUString& rstrSubType ); 56*b1cdbd2cSJim Jagielski getPresetId() const57*b1cdbd2cSJim Jagielski const rtl::OUString& getPresetId() const { return maPresetId; } getProperty() const58*b1cdbd2cSJim Jagielski const rtl::OUString& getProperty() const { return maProperty; } getLabel() const59*b1cdbd2cSJim Jagielski const rtl::OUString& getLabel() const { return maLabel; } getPresetClass() const60*b1cdbd2cSJim Jagielski sal_Int16 getPresetClass() const { return mnPresetClass; } getDuration() const61*b1cdbd2cSJim Jagielski double getDuration() const { return mfDuration; } 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski UStringList getSubTypes(); 64*b1cdbd2cSJim Jagielski UStringList getProperties() const; 65*b1cdbd2cSJim Jagielski 66*b1cdbd2cSJim Jagielski bool hasProperty( const rtl::OUString& rProperty ) const; isTextOnly() const67*b1cdbd2cSJim Jagielski bool isTextOnly() const { return mbIsTextOnly; } 68*b1cdbd2cSJim Jagielski 69*b1cdbd2cSJim Jagielski private: 70*b1cdbd2cSJim Jagielski rtl::OUString maPresetId; 71*b1cdbd2cSJim Jagielski rtl::OUString maProperty; 72*b1cdbd2cSJim Jagielski sal_Int16 mnPresetClass; 73*b1cdbd2cSJim Jagielski rtl::OUString maLabel; 74*b1cdbd2cSJim Jagielski rtl::OUString maDefaultSubTyp; 75*b1cdbd2cSJim Jagielski double mfDuration; 76*b1cdbd2cSJim Jagielski bool mbIsTextOnly; 77*b1cdbd2cSJim Jagielski 78*b1cdbd2cSJim Jagielski EffectsSubTypeMap maSubTypes; 79*b1cdbd2cSJim Jagielski }; 80*b1cdbd2cSJim Jagielski 81*b1cdbd2cSJim Jagielski typedef boost::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr; 82*b1cdbd2cSJim Jagielski typedef std::hash_map<rtl::OUString, CustomAnimationPresetPtr, comphelper::UStringHash, comphelper::UStringEqual> EffectDescriptorMap; 83*b1cdbd2cSJim Jagielski typedef std::vector< CustomAnimationPresetPtr > EffectDescriptorList; 84*b1cdbd2cSJim Jagielski 85*b1cdbd2cSJim Jagielski struct PresetCategory 86*b1cdbd2cSJim Jagielski { 87*b1cdbd2cSJim Jagielski rtl::OUString maLabel; 88*b1cdbd2cSJim Jagielski EffectDescriptorList maEffects; 89*b1cdbd2cSJim Jagielski PresetCategorysd::PresetCategory90*b1cdbd2cSJim Jagielski PresetCategory( const rtl::OUString& rLabel, const EffectDescriptorList& rEffects ) 91*b1cdbd2cSJim Jagielski : maLabel( rLabel ), maEffects( rEffects ) {} 92*b1cdbd2cSJim Jagielski }; 93*b1cdbd2cSJim Jagielski typedef boost::shared_ptr< PresetCategory > PresetCategoryPtr; 94*b1cdbd2cSJim Jagielski typedef std::vector< PresetCategoryPtr > PresetCategoryList; 95*b1cdbd2cSJim Jagielski 96*b1cdbd2cSJim Jagielski class CustomAnimationPresets 97*b1cdbd2cSJim Jagielski { 98*b1cdbd2cSJim Jagielski public: 99*b1cdbd2cSJim Jagielski CustomAnimationPresets(); 100*b1cdbd2cSJim Jagielski virtual ~CustomAnimationPresets(); 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski void init(); 103*b1cdbd2cSJim Jagielski 104*b1cdbd2cSJim Jagielski SD_DLLPUBLIC static const CustomAnimationPresets& getCustomAnimationPresets(); 105*b1cdbd2cSJim Jagielski 106*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRandomPreset( sal_Int16 nPresetClass ) const; 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski SD_DLLPUBLIC CustomAnimationPresetPtr getEffectDescriptor( const rtl::OUString& rPresetId ) const; 109*b1cdbd2cSJim Jagielski // const AnimationEffect* getEffect( const rtl::OUString& rPresetId ) const; 110*b1cdbd2cSJim Jagielski // const AnimationEffect* getEffect( const rtl::OUString& rPresetId, const rtl::OUString& rPresetSubType ) const; 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski const rtl::OUString& getUINameForPresetId( const rtl::OUString& rPresetId ) const; 113*b1cdbd2cSJim Jagielski const rtl::OUString& getUINameForProperty( const rtl::OUString& rProperty ) const; 114*b1cdbd2cSJim Jagielski getEntrancePresets() const115*b1cdbd2cSJim Jagielski const PresetCategoryList& getEntrancePresets() const { return maEntrancePresets; } getEmphasisPresets() const116*b1cdbd2cSJim Jagielski const PresetCategoryList& getEmphasisPresets() const { return maEmphasisPresets; } getExitPresets() const117*b1cdbd2cSJim Jagielski const PresetCategoryList& getExitPresets() const { return maExitPresets; } getMotionPathsPresets() const118*b1cdbd2cSJim Jagielski const PresetCategoryList& getMotionPathsPresets() const { return maMotionPathsPresets; } getMiscPresets() const119*b1cdbd2cSJim Jagielski const PresetCategoryList& getMiscPresets() const { return maMiscPresets; } 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski void changePresetSubType( CustomAnimationEffectPtr pEffect, const rtl::OUString& rPresetSubType ) const; 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski private: 124*b1cdbd2cSJim Jagielski void importEffects(); 125*b1cdbd2cSJim Jagielski void importResources(); 126*b1cdbd2cSJim Jagielski 127*b1cdbd2cSJim Jagielski void importPresets( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xConfigProvider, const rtl::OUString& rNodePath, PresetCategoryList& rPresetMap ); 128*b1cdbd2cSJim Jagielski 129*b1cdbd2cSJim Jagielski const rtl::OUString& translateName( const rtl::OUString& rId, const UStringMap& rNameMap ) const; 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim Jagielski private: 132*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxRootNode; 133*b1cdbd2cSJim Jagielski EffectDescriptorMap maEffectDiscriptorMap; 134*b1cdbd2cSJim Jagielski UStringMap maEffectNameMap; 135*b1cdbd2cSJim Jagielski UStringMap maPropertyNameMap; 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski PresetCategoryList maEntrancePresets; 138*b1cdbd2cSJim Jagielski PresetCategoryList maEmphasisPresets; 139*b1cdbd2cSJim Jagielski PresetCategoryList maExitPresets; 140*b1cdbd2cSJim Jagielski PresetCategoryList maMotionPathsPresets; 141*b1cdbd2cSJim Jagielski PresetCategoryList maMiscPresets; 142*b1cdbd2cSJim Jagielski 143*b1cdbd2cSJim Jagielski static CustomAnimationPresets* mpCustomAnimationPresets; 144*b1cdbd2cSJim Jagielski }; 145*b1cdbd2cSJim Jagielski 146*b1cdbd2cSJim Jagielski typedef boost::shared_ptr< CustomAnimationPresets > CustomAnimationPresetsPtr; 147*b1cdbd2cSJim Jagielski 148*b1cdbd2cSJim Jagielski } 149*b1cdbd2cSJim Jagielski 150*b1cdbd2cSJim Jagielski #endif // _SD_CUSTOMANIMATIONEFFECTS_HXX 151*b1cdbd2cSJim Jagielski 152