1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CustomAnimationPreset.hxx,v $
10 * $Revision: 1.6.72.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_CUSTOMANIMATIONPRESET_HXX
32 #define _SD_CUSTOMANIMATIONPRESET_HXX
34 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
35 #include <boost/shared_ptr.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <com/sun/star/animations/AnimationNodeType.hpp>
40 #ifndef _UTL_STLTYPES_HXX_
41 #include <comphelper/stl_types.hxx>
43 #include <CustomAnimationEffect.hxx>
49 typedef std::hash_map
< rtl::OUString
, CustomAnimationEffectPtr
, comphelper::UStringHash
, comphelper::UStringEqual
> EffectsSubTypeMap
;
50 typedef std::hash_map
< rtl::OUString
, rtl::OUString
, comphelper::UStringHash
, comphelper::UStringEqual
> UStringMap
;
51 typedef std::vector
< rtl::OUString
> UStringList
;
53 class CustomAnimationPreset
55 friend class CustomAnimationPresets
;
58 CustomAnimationPreset( CustomAnimationEffectPtr pEffect
);
60 void add( CustomAnimationEffectPtr pEffect
);
62 SD_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> create( const rtl::OUString
& rstrSubType
);
64 const rtl::OUString
& getPresetId() const { return maPresetId
; }
65 const rtl::OUString
& getProperty() const { return maProperty
; }
66 const rtl::OUString
& getLabel() const { return maLabel
; }
67 sal_Int16
getPresetClass() const { return mnPresetClass
; }
68 double getDuration() const { return mfDuration
; }
70 UStringList
getSubTypes();
71 UStringList
getProperties() const;
73 bool hasProperty( const rtl::OUString
& rProperty
) const;
74 bool isTextOnly() const { return mbIsTextOnly
; }
77 rtl::OUString maPresetId
;
78 rtl::OUString maProperty
;
79 sal_Int16 mnPresetClass
;
80 rtl::OUString maLabel
;
81 rtl::OUString maDefaultSubTyp
;
85 EffectsSubTypeMap maSubTypes
;
88 typedef boost::shared_ptr
< CustomAnimationPreset
> CustomAnimationPresetPtr
;
89 typedef std::hash_map
<rtl::OUString
, CustomAnimationPresetPtr
, comphelper::UStringHash
, comphelper::UStringEqual
> EffectDescriptorMap
;
90 typedef std::vector
< CustomAnimationPresetPtr
> EffectDescriptorList
;
94 rtl::OUString maLabel
;
95 EffectDescriptorList maEffects
;
97 PresetCategory( const rtl::OUString
& rLabel
, const EffectDescriptorList
& rEffects
)
98 : maLabel( rLabel
), maEffects( rEffects
) {}
100 typedef boost::shared_ptr
< PresetCategory
> PresetCategoryPtr
;
101 typedef std::vector
< PresetCategoryPtr
> PresetCategoryList
;
103 class CustomAnimationPresets
106 CustomAnimationPresets();
107 virtual ~CustomAnimationPresets();
111 SD_DLLPUBLIC
static const CustomAnimationPresets
& getCustomAnimationPresets();
113 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> getRandomPreset( sal_Int16 nPresetClass
) const;
115 SD_DLLPUBLIC CustomAnimationPresetPtr
getEffectDescriptor( const rtl::OUString
& rPresetId
) const;
116 // const AnimationEffect* getEffect( const rtl::OUString& rPresetId ) const;
117 // const AnimationEffect* getEffect( const rtl::OUString& rPresetId, const rtl::OUString& rPresetSubType ) const;
119 const rtl::OUString
& getUINameForPresetId( const rtl::OUString
& rPresetId
) const;
120 const rtl::OUString
& getUINameForProperty( const rtl::OUString
& rProperty
) const;
122 const PresetCategoryList
& getEntrancePresets() const { return maEntrancePresets
; }
123 const PresetCategoryList
& getEmphasisPresets() const { return maEmphasisPresets
; }
124 const PresetCategoryList
& getExitPresets() const { return maExitPresets
; }
125 const PresetCategoryList
& getMotionPathsPresets() const { return maMotionPathsPresets
; }
126 const PresetCategoryList
& getMiscPresets() const { return maMiscPresets
; }
128 void changePresetSubType( CustomAnimationEffectPtr pEffect
, const rtl::OUString
& rPresetSubType
) const;
131 void importEffects();
132 void importResources();
134 void importPresets( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xConfigProvider
, const rtl::OUString
& rNodePath
, PresetCategoryList
& rPresetMap
);
136 const rtl::OUString
& translateName( const rtl::OUString
& rId
, const UStringMap
& rNameMap
) const;
139 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> mxRootNode
;
140 EffectDescriptorMap maEffectDiscriptorMap
;
141 UStringMap maEffectNameMap
;
142 UStringMap maPropertyNameMap
;
144 PresetCategoryList maEntrancePresets
;
145 PresetCategoryList maEmphasisPresets
;
146 PresetCategoryList maExitPresets
;
147 PresetCategoryList maMotionPathsPresets
;
148 PresetCategoryList maMiscPresets
;
150 static CustomAnimationPresets
* mpCustomAnimationPresets
;
153 typedef boost::shared_ptr
< CustomAnimationPresets
> CustomAnimationPresetsPtr
;
157 #endif // _SD_CUSTOMANIMATIONEFFECTS_HXX