4954e95fab
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
195 lines
7.1 KiB
C++
195 lines
7.1 KiB
C++
/*************************************************************************
|
|
*
|
|
* $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
|
|
|