summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarisa Raicevic <lara.raicevic@gmail.com>2010-09-22 21:38:28 +0200
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-09-22 21:41:33 +0200
commita0866751f996613466f7e10619c3c3f2ff54c38d (patch)
treecc4037a928f211a6153096068c680a6f92241090
parentf3a517b005a31607b373393600ac41237a55b1f4 (diff)
Pushed Larisa's patch AS IS
-rw-r--r--patches/dev300/sd_effects_styles.diff3821
1 files changed, 3821 insertions, 0 deletions
diff --git a/patches/dev300/sd_effects_styles.diff b/patches/dev300/sd_effects_styles.diff
new file mode 100644
index 000000000..231c468db
--- /dev/null
+++ b/patches/dev300/sd_effects_styles.diff
@@ -0,0 +1,3821 @@
+diff --git sd/inc/STLPropertySet.hxx sd/inc/STLPropertySet.hxx
+new file mode 100644
+index 0000000..30efa7c
+--- /dev/null
++++ sd/inc/STLPropertySet.hxx
+@@ -0,0 +1,170 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: STLPropertySet.hxx,v $
++ * $Revision: 1.5 $
++ *
++ * This file is part of OpenOffice.org.
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef _SD_STLPROPERTYSET_HXX
++#define _SD_STLPROPERTYSET_HXX
++
++#include <com/sun/star/beans/PropertyValue.hpp>
++
++#ifndef _UTL_STLTYPES_HXX_
++#include <comphelper/stl_types.hxx>
++#endif
++
++#include <list>
++#include <map>
++#include <iostream>
++
++#include "CustomAnimationEffect.hxx"
++#include <CustomAnimationPreset.hxx>
++
++#include <svtools/itemset.hxx> //SfxItemSet
++
++using ::com::sun::star::uno::Any;
++
++namespace sd
++{
++
++// property handles
++const sal_Int32 nHandleSound = 0;
++const sal_Int32 nHandleHasAfterEffect = 1;
++const sal_Int32 nHandleIterateType = 2;
++const sal_Int32 nHandleIterateInterval = 3;
++const sal_Int32 nHandleStart = 4;
++const sal_Int32 nHandleBegin = 5;
++const sal_Int32 nHandleDuration = 6;
++const sal_Int32 nHandleRepeat = 7;
++const sal_Int32 nHandleRewind = 8;
++const sal_Int32 nHandleEnd = 9;
++const sal_Int32 nHandleAfterEffectOnNextEffect = 10;
++const sal_Int32 nHandleDimColor = 11;
++const sal_Int32 nHandleMaxParaDepth = 12;
++const sal_Int32 nHandlePresetId = 13;
++const sal_Int32 nHandleProperty1Type = 14;
++const sal_Int32 nHandleProperty1Value = 15;
++const sal_Int32 nHandleProperty2Type = 16;
++const sal_Int32 nHandleProperty2Value = 17;
++
++const sal_Int32 nHandleAccelerate = 18;
++const sal_Int32 nHandleDecelerate = 19;
++const sal_Int32 nHandleAutoReverse = 20;
++const sal_Int32 nHandleTrigger = 21;
++
++const sal_Int32 nHandleHasText = 22;
++const sal_Int32 nHandleTextGrouping = 23;
++const sal_Int32 nHandleAnimateForm = 24;
++const sal_Int32 nHandleTextGroupingAuto = 25;
++const sal_Int32 nHandleTextReverse = 26;
++
++const sal_Int32 nHandleCurrentPage = 27;
++const sal_Int32 nHandleSoundURL = 28;
++const sal_Int32 nHandleSoundVolumne = 29;
++const sal_Int32 nHandleSoundEndAfterSlide = 30;
++
++const sal_Int32 nHandleCommand = 31;
++
++const sal_Int32 nHandleHasVisibleShape = 32;
++
++const sal_Int32 nPropertyTypeNone = 0;
++const sal_Int32 nPropertyTypeDirection = 1;
++const sal_Int32 nPropertyTypeSpokes = 2;
++const sal_Int32 nPropertyTypeFirstColor = 3;
++const sal_Int32 nPropertyTypeSecondColor = 4;
++const sal_Int32 nPropertyTypeZoom = 5;
++const sal_Int32 nPropertyTypeFillColor = 6;
++const sal_Int32 nPropertyTypeColorStyle = 7;
++const sal_Int32 nPropertyTypeFont = 8;
++const sal_Int32 nPropertyTypeCharHeight = 9;
++const sal_Int32 nPropertyTypeCharColor = 10;
++const sal_Int32 nPropertyTypeCharHeightStyle = 11;
++const sal_Int32 nPropertyTypeCharDecoration = 12;
++const sal_Int32 nPropertyTypeLineColor = 13;
++const sal_Int32 nPropertyTypeRotate = 14;
++const sal_Int32 nPropertyTypeColor = 15;
++const sal_Int32 nPropertyTypeAccelerate = 16;
++const sal_Int32 nPropertyTypeDecelerate = 17;
++const sal_Int32 nPropertyTypeAutoReverse = 18;
++const sal_Int32 nPropertyTypeTransparency = 19;
++const sal_Int32 nPropertyTypeFontStyle = 20;
++const sal_Int32 nPropertyTypeScale = 21;
++
++// --------------------------------------------------------------------
++
++const sal_Int32 STLPropertyState_DEFAULT = 0;
++const sal_Int32 STLPropertyState_DIRECT = 1;
++const sal_Int32 STLPropertyState_AMBIGUOUS = 3;
++
++class STLPropertyMapEntry
++{
++public:
++ ::com::sun::star::uno::Any maValue;
++ sal_Int32 mnState;
++
++ STLPropertyMapEntry()
++ : mnState( STLPropertyState_AMBIGUOUS ) {}
++ STLPropertyMapEntry( ::com::sun::star::uno::Any aValue, sal_Int32 nState = STLPropertyState_DEFAULT )
++ : maValue( aValue ), mnState( nState ) {}
++ bool operator==(const STLPropertyMapEntry& rMapEntry) const
++ {
++ return mnState == rMapEntry.mnState;
++ }
++};
++
++typedef std::map<sal_Int32, STLPropertyMapEntry > PropertyMap;
++typedef PropertyMap::iterator PropertyMapIter;
++typedef PropertyMap::const_iterator PropertyMapConstIter;
++
++class STLPropertySet
++{
++public:
++ STLPropertySet();
++ ~STLPropertySet();
++
++ void setPropertyDefaultValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue );
++ void setPropertyValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue, sal_Int32 nState = STLPropertyState_DIRECT );
++
++ ::com::sun::star::uno::Any getPropertyValue( sal_Int32 nHandle ) const;
++
++ sal_Int32 getPropertyState( sal_Int32 nHandle ) const;
++ void setPropertyState( sal_Int32 nHandle, sal_Int32 nState );
++
++ static STLPropertySet* createDefaultSet();
++ bool operator==(const STLPropertySet& rSet) const;
++private:
++ bool findProperty( sal_Int32 nHandle, PropertyMapIter& rIter );
++ bool findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const;
++
++private:
++ PropertyMap maPropertyMap;
++};
++
++}
++
++#endif // _SD_STLPROPERTYSET_HXX
+diff --git sd/inc/animationitem.hxx sd/inc/animationitem.hxx
+new file mode 100644
+index 0000000..079ff25
+--- /dev/null
++++ sd/inc/animationitem.hxx
+@@ -0,0 +1,84 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: animationitem.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef _SFXANIMATIONITEM_HXX
++#define _SFXANIMATIONITEM_HXX
++
++#include "svtools/svtdllapi.h"
++#include <tools/solar.h>
++#include <tools/rtti.hxx>
++#include <svtools/poolitem.hxx>
++#include "app.hrc"
++
++namespace sd { class STLPropertySet;
++
++class SvStream;
++
++// -----------------------------------------------------------------------
++
++class SfxAnimationItem: public SfxPoolItem
++{
++ STLPropertySet* maValue;
++ // @@@ TODO @@@
++ // add a string containing the prevous PresetId,
++ // so we could support removing of a previous effect
++public:
++ static size_t count;
++ TYPEINFO();
++
++ SfxAnimationItem();
++ SfxAnimationItem( USHORT nWhich, STLPropertySet* aValue);
++ SfxAnimationItem( USHORT nWhich, SvStream & );
++ SfxAnimationItem( const SfxAnimationItem& );
++
++ ~SfxAnimationItem();
++
++
++ virtual int operator==( const SfxPoolItem& ) const;
++
++ virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const;
++
++ virtual SvStream& Store(SvStream &, USHORT nItemVersion) const;
++
++ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
++ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
++ SfxMapUnit eCoreMetric,
++ SfxMapUnit ePresMetric,
++ XubString &rText,
++ const IntlWrapper * = 0 ) const;
++
++ STLPropertySet* GetValue() const { return maValue; }
++ void SetValue( STLPropertySet* aNewVal ) {
++ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
++ maValue = aNewVal;
++ }
++};
++
++}
++#endif
+diff --git sd/inc/app.hrc sd/inc/app.hrc
+index dcdfd43..0965197 100644
+--- sd/inc/app.hrc
++++ sd/inc/app.hrc
+@@ -466,4 +466,5 @@
+ #define SID_ADD_MOTION_PATH (SID_SD_START+444)
+ #define SID_TABLE_TOOLBOX (SID_SD_START+445)
+
++#define SID_ANIMATION_ITEM (SID_SD_START+446)
+ #endif
+diff --git sd/inc/sdtools.hxx sd/inc/sdtools.hxx
+new file mode 100644
+index 0000000..990d650
+--- /dev/null
++++ sd/inc/sdtools.hxx
+@@ -0,0 +1,107 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef __SD_TOOLS__
++#define __SD_TOOLS__
++
++#include <CustomAnimationEffect.hxx>
++#include <animationitem.hxx>
++#include <STLPropertySet.hxx>
++#include <stlpool.hxx>
++#include <stlsheet.hxx>
++#include <sdpage.hxx>
++#include <com/sun/star/uno/Any.hxx>
++using ::com::sun::star::uno::Any;
++
++namespace sd {
++class View;
++namespace tools {
++
++// -----------------------------------------------------------------------------
++// adds a value to the STLPropertySet
++// -----------------------------------------------------------------------------
++void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue );
++
++// -----------------------------------------------------------------------------
++// Takes all objects in a view,
++// and assigns an animation from the stylesheet to them
++// -----------------------------------------------------------------------------
++void assignAnimationToObjects(sd::View* mpView, SfxStyleSheet* pStyleSheet);
++
++// -----------------------------------------------------------------------------
++// Populates the STLPropertySet with the information from the Effect
++// -----------------------------------------------------------------------------
++void fillSTLPropertySetWithEffect(STLPropertySet* pSet,
++ CustomAnimationEffectPtr pEffect);
++// -----------------------------------------------------------------------------
++// Used for testing purposes:
++// Creates a random effect and puts it into an SfxItemSet]
++// -----------------------------------------------------------------------------
++void addRandomAnimationToItemSet(SfxItemSet& styleSheet);
++
++// -----------------------------------------------------------------------------
++// Gets information from a STLPropertySet
++// and populates an effect from that information
++// -----------------------------------------------------------------------------
++BOOL getEffectFromSTLPropertySet(STLPropertySet* pResultSet,
++ CustomAnimationEffectPtr pEffect,
++ MainSequencePtr mpMainSequence);
++// -----------------------------------------------------------------------------
++// Applies the animation from a stylesheet to a SdrObject
++// -----------------------------------------------------------------------------
++void applyAnimationFromStyleSheet(SdrObject* pSdrObj,
++ SfxStyleSheet* pSheetForPresObj);
++
++// -----------------------------------------------------------------------------
++// Checks if a stylesheet contains animation
++// -----------------------------------------------------------------------------
++bool styleSheetContainsAnimation(SfxStyleSheet* pStyleSheet);
++
++// -----------------------------------------------------------------------------
++// Gets a STLPropertySet from a Stylesheet
++// -----------------------------------------------------------------------------
++STLPropertySet* getSTLPropertySet(SfxStyleSheet* pStyleSheet);
++
++
++// -----------------------------------------------------------------------------
++// Gets a STLPropertySet from a Stylesheet
++// -----------------------------------------------------------------------------
++BOOL getPresetData(const SfxItemSet& rSet,
++ rtl::OUString& aPresetId,
++ float& fDuration);
++
++// -----------------------------------------------------------------------------
++// Gets the PresetId and the Duration from a STLPropertySet
++// -----------------------------------------------------------------------------
++BOOL getPresetData(const STLPropertySet* pSet,
++ rtl::OUString& aPresetId,
++ float& fDuration);
++
++} // namespace tools
++} // namespace sd
++
++#endif
+diff --git sd/inc/stlpool.hxx sd/inc/stlpool.hxx
+index 07552df..3c4b98c 100644
+--- sd/inc/stlpool.hxx
++++ sd/inc/stlpool.hxx
+@@ -49,7 +49,8 @@
+ class SdStyleSheet;
+ class SdDrawDocument;
+ class SdPage;
+-
++class Font;
++class List;
+ typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
+
+ typedef ::cppu::ImplInheritanceHelper4< SfxStyleSheetPool,
+diff --git sd/source/core/STLPropertySet.cxx sd/source/core/STLPropertySet.cxx
+new file mode 100644
+index 0000000..d11c7ef
+--- /dev/null
++++ sd/source/core/STLPropertySet.cxx
+@@ -0,0 +1,183 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sd.hxx"
++#include <tools/debug.hxx>
++#include "STLPropertySet.hxx"
++#include <com/sun/star/presentation/EffectNodeType.hpp>
++#include <com/sun/star/animations/AnimationFill.hpp>
++#include <sdtools.hxx>
++#include <iostream>
++
++using namespace com::sun::star::beans;
++using namespace ::com::sun::star::presentation;
++using namespace ::com::sun::star::animations;
++
++using rtl::OUString;
++using com::sun::star::uno::Any;
++using ::com::sun::star::uno::makeAny;
++
++namespace sd
++{
++
++STLPropertySet::STLPropertySet()
++{
++}
++
++STLPropertySet::~STLPropertySet()
++{
++}
++
++void STLPropertySet::setPropertyDefaultValue( sal_Int32 nHandle, const Any& rValue )
++{
++ STLPropertyMapEntry aEntry( rValue, STLPropertyState_DEFAULT );
++ maPropertyMap[ nHandle ] = aEntry;
++}
++
++void STLPropertySet::setPropertyValue( sal_Int32 nHandle, const Any& rValue, sal_Int32 /* nState = STLPropertyState_DIRECT */ )
++{
++ PropertyMapIter aIter;
++ if( findProperty( nHandle, aIter ) )
++ {
++ (*aIter).second.mnState = STLPropertyState_DIRECT;
++ (*aIter).second.maValue = rValue;
++ }
++ else
++ {
++ DBG_ERROR( "sd::STLPropertySet::setPropertyValue(), unknown property!" );
++ }
++}
++
++Any STLPropertySet::getPropertyValue( sal_Int32 nHandle ) const
++{
++ PropertyMapConstIter aIter;
++ if( findProperty( nHandle, aIter ) )
++ {
++ return (*aIter).second.maValue;
++ }
++ else
++ {
++ DBG_ERROR( "sd::STLPropertySet::setPropertyValue(), unknown property!" );
++
++ Any aAny;
++ return aAny;
++ }
++}
++
++sal_Int32 STLPropertySet::getPropertyState( sal_Int32 nHandle ) const
++{
++ PropertyMapConstIter aIter;
++ if( findProperty( nHandle, aIter ) )
++ {
++ return (*aIter).second.mnState;
++ }
++ else
++ {
++ DBG_ERROR( "sd::STLPropertySet::setPropertyState(), unknown property!" );
++ return STLPropertyState_AMBIGUOUS;
++ }
++}
++
++void STLPropertySet::setPropertyState( sal_Int32 nHandle, sal_Int32 nState )
++{
++ PropertyMapIter aIter;
++ if( findProperty( nHandle, aIter ) )
++ {
++ (*aIter).second.mnState = nState;
++ }
++ else
++ {
++ DBG_ERROR( "sd::STLPropertySet::setPropertyState(), unknown property!" );
++ }
++}
++
++bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapIter& rIter )
++{
++ rIter = maPropertyMap.find(nHandle);
++ return( rIter != maPropertyMap.end() );
++}
++
++bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const
++{
++ rIter = maPropertyMap.find(nHandle);
++ return( rIter != maPropertyMap.end() );
++}
++
++STLPropertySet* STLPropertySet::createDefaultSet()
++{
++ Any aEmpty;
++
++ STLPropertySet* pSet = new STLPropertySet();
++ pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( (sal_Int32)-1 ) );
++
++ pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( (sal_Bool)sal_False ) );
++ pSet->setPropertyDefaultValue( nHandleAfterEffectOnNextEffect, makeAny( (sal_Bool)sal_False ) );
++ pSet->setPropertyDefaultValue( nHandleDimColor, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleIterateType, makeAny( (sal_Int16)0 ) );
++ pSet->setPropertyDefaultValue( nHandleIterateInterval, makeAny( (double)0.0 ) );
++
++ pSet->setPropertyDefaultValue( nHandleStart, makeAny( (sal_Int16)EffectNodeType::ON_CLICK ) );
++ pSet->setPropertyDefaultValue( nHandleBegin, makeAny( (double)0.0 ) );
++ pSet->setPropertyDefaultValue( nHandleDuration, makeAny( (double)2.0 ) );
++ pSet->setPropertyDefaultValue( nHandleRepeat, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleRewind, makeAny( AnimationFill::HOLD ) );
++
++ pSet->setPropertyDefaultValue( nHandleEnd, aEmpty );
++
++ pSet->setPropertyDefaultValue( nHandlePresetId, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleProperty1Type, makeAny( nPropertyTypeNone ) );
++ pSet->setPropertyDefaultValue( nHandleProperty1Value, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleProperty2Type, makeAny( nPropertyTypeNone ) );
++ pSet->setPropertyDefaultValue( nHandleProperty2Value, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleAccelerate, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleDecelerate, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleAutoReverse, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleTrigger, aEmpty );
++
++ pSet->setPropertyDefaultValue( nHandleHasText, makeAny( sal_False ) );
++ pSet->setPropertyDefaultValue( nHandleHasVisibleShape, makeAny( sal_False ) );
++ pSet->setPropertyDefaultValue( nHandleTextGrouping, makeAny( (sal_Int32)-1 ) );
++ pSet->setPropertyDefaultValue( nHandleAnimateForm, makeAny( sal_True ) );
++ pSet->setPropertyDefaultValue( nHandleTextGroupingAuto, makeAny( (double)-1.0 ) );
++ pSet->setPropertyDefaultValue( nHandleTextReverse, makeAny( sal_False ) );
++
++ pSet->setPropertyDefaultValue( nHandleCurrentPage, aEmpty );
++
++ pSet->setPropertyDefaultValue( nHandleSoundURL, aEmpty );
++ pSet->setPropertyDefaultValue( nHandleSoundVolumne, makeAny( (double)1.0) );
++ pSet->setPropertyDefaultValue( nHandleSoundEndAfterSlide, makeAny( (sal_Int32)0 ) );
++
++ pSet->setPropertyDefaultValue( nHandleCommand, makeAny( (sal_Int16)0 ) );
++ return pSet;
++}
++
++ bool STLPropertySet::operator==(const STLPropertySet& rSet) const {
++ return maPropertyMap == rSet.maPropertyMap;
++ }
++
++}
+diff --git sd/source/core/animationitem.cxx sd/source/core/animationitem.cxx
+new file mode 100644
+index 0000000..49f49a6
+--- /dev/null
++++ sd/source/core/animationitem.cxx
+@@ -0,0 +1,143 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: animationitem.hxx,v $
++ * $Revision: 1.3 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include <animationitem.hxx>
++#include <svtools/poolitem.hxx>
++#include <tools/stream.hxx>
++#include <STLPropertySet.hxx>
++#if DEBUG
++#include <iostream>
++#endif
++namespace sd {
++
++class SvStream;
++
++// -----------------------------------------------------------------------
++
++TYPEINIT1_AUTOFACTORY(SfxAnimationItem, SfxPoolItem)
++SfxAnimationItem::SfxAnimationItem( USHORT nWhichValue, STLPropertySet* pSet)
++: SfxPoolItem(nWhichValue)
++
++{
++ DBG_CTOR(SfxAnimationItem, 0);
++ if (pSet == NULL || nWhichValue == 0)
++ {
++#if DEBUG
++ std::cerr << "STLPropertySet is NULL" << std::endl;
++#endif
++ maValue = NULL;
++ SfxAnimationItem::count++;
++ return;
++ }
++ maValue = new STLPropertySet(*pSet);
++ SfxAnimationItem::count++;
++}
++
++SfxAnimationItem::SfxAnimationItem()
++ :SfxPoolItem(0)
++{
++ DBG_CTOR(SfxAnimationItem, 0);
++ //this is not a proper initialization, so fill in stuff with blank
++ maValue = NULL;
++ SfxAnimationItem::count++;
++}
++
++SfxAnimationItem::SfxAnimationItem( USHORT nWhichValue, SvStream& /* rStream */ ) :
++ SfxPoolItem(nWhichValue)
++{
++ DBG_CTOR(SfxAnimationItem, 0);
++ SfxAnimationItem::count++;
++}
++
++SfxAnimationItem::SfxAnimationItem( const SfxAnimationItem& rItem) :
++ SfxPoolItem( rItem )
++
++{
++ DBG_CTOR(SfxAnimationItem, 0);
++ if (rItem.maValue == NULL)
++ maValue = NULL;
++ else
++ maValue = new STLPropertySet(*rItem.maValue);
++ SfxAnimationItem::count++;
++}
++
++SfxAnimationItem::~SfxAnimationItem()
++{
++ delete maValue;
++ maValue = NULL;
++ SfxAnimationItem::count--;
++}
++
++
++int SfxAnimationItem::operator==( const SfxPoolItem& rItem) const
++{
++ const SfxAnimationItem* aAnimationItem;
++ if ( (aAnimationItem = dynamic_cast<const SfxAnimationItem*>(&rItem)) == NULL)
++ return 1; //not equal
++
++ if (maValue == NULL && aAnimationItem->maValue == NULL)
++ return true;
++ if (maValue == NULL || aAnimationItem->maValue == NULL)
++ return false;
++
++ return *maValue == *(aAnimationItem->maValue);
++}
++
++SfxPoolItem* SfxAnimationItem::Create(SvStream &, USHORT /* nVersion */) const
++{
++ SfxAnimationItem* result = new SfxAnimationItem(SID_ANIMATION_ITEM, STLPropertySet::createDefaultSet());
++ return result;
++}
++
++SvStream& SfxAnimationItem::Store(SvStream &aStream, USHORT /* nItemVersion */ ) const
++{
++ return aStream;
++}
++
++SfxPoolItem* SfxAnimationItem::Clone( SfxItemPool* /* pPool */) const
++{
++ return new SfxAnimationItem(*this);
++}
++
++SfxItemPresentation SfxAnimationItem::GetPresentation( SfxItemPresentation /* ePres */,
++ SfxMapUnit /* eCoreMetric */,
++ SfxMapUnit /* ePresMetric */,
++ XubString& rText,
++ const IntlWrapper* ) const
++{
++
++ DBG_CHKTHIS(SfxAnimationItem, 0);
++ rText.Erase();
++ rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Animation"));
++ return SFX_ITEM_PRESENTATION_NAMELESS;
++}
++
++size_t SfxAnimationItem::count = 0;
++} //namespace sd
+diff --git sd/source/core/makefile.mk sd/source/core/makefile.mk
+index 962aa1f..c936f97 100644
+--- sd/source/core/makefile.mk
++++ sd/source/core/makefile.mk
+@@ -70,7 +70,10 @@ SLOFILES = $(SLO)$/stlsheet.obj \
+ $(SLO)$/undoanim.obj\
+ $(SLO)$/EffectMigration.obj\
+ $(SLO)$/CustomAnimationCloner.obj\
+- $(SLO)$/shapelist.obj
++ $(SLO)$/shapelist.obj\
++ $(SLO)$/STLPropertySet.obj \
++ $(SLO)$/animationitem.obj \
++ $(SLO)$/sdtools.obj
+
+ # --- Tagets -------------------------------------------------------
+
+diff --git sd/source/core/sdpage.cxx sd/source/core/sdpage.cxx
+index fdc7699..4bc18c7 100644
+--- sd/source/core/sdpage.cxx
++++ sd/source/core/sdpage.cxx
+@@ -85,6 +85,7 @@
+ #include <svx/sdr/contact/objectcontact.hxx>
+ #include <svx/unoapi.hxx>
+
++#include <sdtools.hxx>
+ #include <set>
+
+ using namespace ::sd;
+@@ -465,10 +466,13 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, BOOL bVertical, const Rec
+ if( mePageKind != PK_HANDOUT )
+ {
+ SfxStyleSheet* pSheetForPresObj = GetStyleSheetForPresObj(eObjKind);
+- if(pSheetForPresObj)
++ if(pSheetForPresObj) {
+ pSdrObj->SetStyleSheet(pSheetForPresObj, FALSE);
++ // apply StyleSheet animation to the object
++ sd::tools::applyAnimationFromStyleSheet(pSdrObj, pSheetForPresObj);
++ }
+ }
+-
++
+ if (eObjKind == PRESOBJ_OUTLINE)
+ {
+ for (USHORT nLevel = 1; nLevel < 10; nLevel++)
+diff --git sd/source/core/sdtools.cxx sd/source/core/sdtools.cxx
+new file mode 100644
+index 0000000..5e4f998
+--- /dev/null
++++ sd/source/core/sdtools.cxx
+@@ -0,0 +1,510 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include <sdtools.hxx>
++/*************************************************************************/
++// A set of functions used for various operations on effects & stylesheets
++/*************************************************************************/
++#include <CustomAnimationPreset.hxx>
++#include <CustomAnimationEffect.hxx>
++#include <com/sun/star/animations/XAnimationNode.hpp>
++#include <com/sun/star/presentation/EffectNodeType.hpp>
++#include <com/sun/star/animations/AnimationFill.hpp>
++#include <com/sun/star/presentation/EffectPresetClass.hpp>
++#include <com/sun/star/uno/Reference.hxx>
++#include "com/sun/star/drawing/XShape.hpp"
++#include <svx/unoapi.hxx>
++
++#include <animationitem.hxx>
++#include <STLPropertySet.hxx>
++#include <../ui/inc/View.hxx>
++#include <iostream>
++
++using namespace sd;
++using namespace ::com::sun::star::presentation;
++using namespace ::com::sun::star::animations;
++using com::sun::star::drawing::XShape;
++using com::sun::star::uno::Any;
++using ::com::sun::star::uno::makeAny;
++
++using com::sun::star::uno::Reference;
++using com::sun::star::animations::XAnimationNode;
++using rtl::OUString;
++
++namespace sd {
++namespace tools {
++
++// -----------------------------------------------------------------------------
++// Takes all objects in a view, and assigns an animation from the stylesheet to them
++// -----------------------------------------------------------------------------
++
++void assignAnimationToObjects(sd::View* pView, SfxStyleSheet* pStyleSheet)
++{
++ if (pView->AreObjectsMarked()) {
++ ULONG nMarkCount = pView->GetMarkedObjectCount();
++ {
++ if (sd::tools::styleSheetContainsAnimation(pStyleSheet)) {
++ for (ULONG nm = 0; nm < nMarkCount; nm++)
++ {
++ SdrMark* pM = pView->GetSdrMarkByIndex(nm);
++ SdrObject* pObj = pM->GetMarkedSdrObj();
++ sd::tools::applyAnimationFromStyleSheet(pObj, pStyleSheet);
++ }
++ }
++ }
++ }
++}
++
++// -----------------------------------------------------------------------------
++// Populates the STLPropertySet with the information from the Effect
++// -----------------------------------------------------------------------------
++
++void fillSTLPropertySetWithEffect(STLPropertySet* pSet, CustomAnimationEffectPtr pEffect)
++{
++ addValue( pSet, nHandleHasAfterEffect, makeAny( pEffect->hasAfterEffect() ) );
++ addValue( pSet, nHandleAfterEffectOnNextEffect, makeAny( pEffect->IsAfterEffectOnNext() ? sal_True : sal_False ) );
++ addValue( pSet, nHandleDimColor, pEffect->getDimColor() );
++ addValue( pSet, nHandleIterateType, makeAny( pEffect->getIterateType() ) );
++
++ // convert absolute time to percentage value
++ // This calculation is done in float to avoid some rounding artifacts.
++ float fIterateInterval = (float)pEffect->getIterateInterval();
++ if( pEffect->getDuration() )
++ fIterateInterval = (float)(fIterateInterval / pEffect->getDuration() );
++ fIterateInterval *= 100.0;
++ addValue( pSet, nHandleIterateInterval, makeAny( (double)fIterateInterval ) );
++
++ addValue( pSet, nHandleBegin, makeAny( pEffect->getBegin() ) );
++ addValue( pSet, nHandleDuration, makeAny( pEffect->getDuration() ) );
++ addValue( pSet, nHandleStart, makeAny( pEffect->getNodeType() ) );
++ addValue( pSet, nHandleRepeat, makeAny( pEffect->getRepeatCount() ) );
++ addValue( pSet, nHandleEnd, pEffect->getEnd() );
++ addValue( pSet, nHandleRewind, makeAny( pEffect->getFill() ) );
++
++ addValue( pSet, nHandlePresetId, makeAny( pEffect->getPresetId() ) );
++
++ addValue( pSet, nHandleHasText, makeAny( (sal_Bool)pEffect->hasText() ) );
++
++ //addValue( pSet, nHandleHasVisibleShape, Any( hasVisibleShape( pEffect->getTargetShape() ) ) );
++}
++
++// -----------------------------------------------------------------------------
++// adds a value to the STLPropertySet
++// -----------------------------------------------------------------------------
++
++void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
++{
++ switch( pSet->getPropertyState( nHandle ) )
++ {
++ case STLPropertyState_AMBIGUOUS:
++ // value is already ambiguous, do nothing
++ break;
++ case STLPropertyState_DIRECT:
++ // set to ambiguous if existing value is different
++ if( rValue != pSet->getPropertyValue( nHandle ) )
++ pSet->setPropertyState( nHandle, STLPropertyState_AMBIGUOUS );
++ break;
++ case STLPropertyState_DEFAULT:
++ // just set new value
++ pSet->setPropertyValue( nHandle, rValue );
++ break;
++ }
++}
++// -----------------------------------------------------------------------------
++// Used for testing purposes:
++// Creates a random effect and puts it into an SfxItemSet]
++// -----------------------------------------------------------------------------
++
++void addRandomAnimationToItemSet(SfxItemSet& itemSet) {
++ CustomAnimationPresets presets = CustomAnimationPresets::getCustomAnimationPresets();
++ Reference<XAnimationNode> onePresetAnimationNode =
++ presets.getRandomPreset( ::com::sun::star::presentation::EffectPresetClass::ENTRANCE);
++
++ CustomAnimationEffectPtr pEffect(new CustomAnimationEffect(onePresetAnimationNode));
++ STLPropertySet* pSet = STLPropertySet::createDefaultSet();
++ fillSTLPropertySetWithEffect(pSet, pEffect);
++
++ SfxAnimationItem aAnimationItem(SID_ANIMATION_ITEM, pSet);
++ itemSet.Put(aAnimationItem);
++}
++
++// -----------------------------------------------------------------------------
++// Gets information from a STLPropertySet
++// and populates an effect from that information
++// -----------------------------------------------------------------------------
++
++BOOL getEffectFromSTLPropertySet(STLPropertySet* pResultSet,
++ CustomAnimationEffectPtr pEffect,
++ MainSequencePtr mpMainSequence)
++{
++ double fDuration = 0.0; // we might need this for iterate-interval
++ BOOL bChanged = FALSE;
++ if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
++ {
++ pResultSet->getPropertyValue( nHandleDuration ) >>= fDuration;
++ }
++ else
++ {
++ fDuration = pEffect->getDuration();
++ }
++
++ if( pResultSet->getPropertyState( nHandleIterateType ) == STLPropertyState_DIRECT )
++ {
++ sal_Int16 nIterateType = 0;
++ pResultSet->getPropertyValue( nHandleIterateType ) >>= nIterateType;
++ if( pEffect->getIterateType() != nIterateType )
++ {
++ pEffect->setIterateType( nIterateType );
++ bChanged = true;
++ }
++ }
++
++ if( pEffect->getIterateType() )
++ {
++ if( pResultSet->getPropertyState( nHandleIterateInterval ) == STLPropertyState_DIRECT )
++ {
++ double fIterateInterval = 0.0;
++ pResultSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval;
++ if( pEffect->getIterateInterval() != fIterateInterval )
++ {
++ const double f = fIterateInterval * pEffect->getDuration() / 100;
++ pEffect->setIterateInterval( f );
++ bChanged = true;
++ }
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState_DIRECT )
++ {
++ double fBegin = 0.0;
++ pResultSet->getPropertyValue( nHandleBegin ) >>= fBegin;
++ if( pEffect->getBegin() != fBegin )
++ {
++ pEffect->setBegin( fBegin );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
++ {
++ if( pEffect->getDuration() != fDuration )
++ {
++ pEffect->setDuration( fDuration );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleStart ) == STLPropertyState_DIRECT )
++ {
++ sal_Int16 nNodeType = 0;
++ pResultSet->getPropertyValue( nHandleStart ) >>= nNodeType;
++ if( pEffect->getNodeType() != nNodeType )
++ {
++ pEffect->setNodeType( nNodeType );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleRepeat ) == STLPropertyState_DIRECT )
++ {
++ Any aRepeatCount( pResultSet->getPropertyValue( nHandleRepeat ) );
++ if( aRepeatCount != pEffect->getRepeatCount() )
++ {
++ pEffect->setRepeatCount( aRepeatCount );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleEnd ) == STLPropertyState_DIRECT )
++ {
++ Any aEndValue( pResultSet->getPropertyValue( nHandleEnd ) );
++ if( pEffect->getEnd() != aEndValue )
++ {
++ pEffect->setEnd( aEndValue );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleRewind ) == STLPropertyState_DIRECT )
++ {
++ sal_Int16 nFill = 0;
++ pResultSet->getPropertyValue( nHandleRewind ) >>= nFill;
++ if( pEffect->getFill() != nFill )
++ {
++ pEffect->setFill( nFill );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleHasAfterEffect ) == STLPropertyState_DIRECT )
++ {
++ sal_Bool bHasAfterEffect = sal_False;
++ if( pResultSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect )
++ {
++ if( pEffect->hasAfterEffect() != bHasAfterEffect )
++ {
++ pEffect->setHasAfterEffect( bHasAfterEffect );
++ bChanged = true;
++ }
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleAfterEffectOnNextEffect ) == STLPropertyState_DIRECT )
++ {
++ sal_Bool bAfterEffectOnNextEffect = sal_False;
++ if( (pResultSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextEffect)
++ && ((pEffect->IsAfterEffectOnNext() ? sal_True : sal_False) != bAfterEffectOnNextEffect) )
++ {
++ pEffect->setAfterEffectOnNext( bAfterEffectOnNextEffect );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleDimColor ) == STLPropertyState_DIRECT )
++ {
++ Any aDimColor( pResultSet->getPropertyValue( nHandleDimColor ) );
++ if( pEffect->getDimColor() != aDimColor )
++ {
++ pEffect->setDimColor( aDimColor );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT )
++ {
++ double fAccelerate = 0.0;
++ pResultSet->getPropertyValue( nHandleAccelerate ) >>= fAccelerate;
++ if( pEffect->getAcceleration() != fAccelerate )
++ {
++ pEffect->setAcceleration( fAccelerate );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleDecelerate ) == STLPropertyState_DIRECT )
++ {
++ double fDecelerate = 0.0;
++ pResultSet->getPropertyValue( nHandleDecelerate ) >>= fDecelerate;
++ if( pEffect->getDecelerate() != fDecelerate )
++ {
++ pEffect->setDecelerate( fDecelerate );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleAutoReverse ) == STLPropertyState_DIRECT )
++ {
++ sal_Bool bAutoReverse = sal_False;
++ pResultSet->getPropertyValue( nHandleAutoReverse ) >>= bAutoReverse;
++ if( pEffect->getAutoReverse() != bAutoReverse )
++ {
++ pEffect->setAutoReverse( bAutoReverse );
++ bChanged = true;
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleSoundURL ) == STLPropertyState_DIRECT )
++ {
++ const Any aSoundSource( pResultSet->getPropertyValue( nHandleSoundURL ) );
++
++ if( aSoundSource.getValueType() == ::getCppuType((const sal_Bool*)0) )
++ {
++ pEffect->setStopAudio();
++ bChanged = true;
++ }
++ else
++ {
++ OUString aSoundURL;
++ aSoundSource >>= aSoundURL;
++
++ if( aSoundURL.getLength() )
++ {
++ if( !pEffect->getAudio().is() )
++ {
++ pEffect->createAudio( aSoundSource );
++ bChanged = true;
++ }
++ else
++ {
++ if( pEffect->getAudio()->getSource() != aSoundSource )
++ {
++ pEffect->getAudio()->setSource( aSoundSource );
++ bChanged = true;
++ }
++ }
++ }
++ else
++ {
++ if( pEffect->getAudio().is() || pEffect->getStopAudio() )
++ {
++ pEffect->removeAudio();
++ bChanged = true;
++ }
++ }
++ }
++ }
++
++ if( pResultSet->getPropertyState( nHandleTrigger ) == STLPropertyState_DIRECT )
++ {
++ Reference< XShape > xTriggerShape;
++ pResultSet->getPropertyValue( nHandleTrigger ) >>= xTriggerShape;
++ bChanged |= mpMainSequence->setTrigger( pEffect, xTriggerShape );
++ }
++ return bChanged;
++}
++
++// -----------------------------------------------------------------------------
++// Checks if a stylesheet contains animation
++// -----------------------------------------------------------------------------
++
++bool styleSheetContainsAnimation(SfxStyleSheet* pStyleSheet) {
++ SfxItemState eState = pStyleSheet->GetItemSet().GetItemState( SID_ANIMATION_ITEM );
++ if (eState < SFX_ITEM_DEFAULT)
++ return false;
++
++ SfxAnimationItem* pAnimationItem = (SfxAnimationItem*)(pStyleSheet->GetItemSet().GetItem(SID_ANIMATION_ITEM));
++ if (pAnimationItem == NULL || pAnimationItem->Which() == 0)
++ return false;
++
++ STLPropertySet* pSet = pAnimationItem->GetValue();
++ if (pSet == NULL)
++ {
++ /*
++ @@ TODO
++ For animation removal - this has to be changed to return true,
++ so we would be able to detect when an animation is removed from the itemset
++ */
++ return false;
++ }
++ if (pSet->getPropertyState( nHandlePresetId ) == STLPropertyState_AMBIGUOUS )
++ // Unhealthy presetId
++ return false;
++
++ return true;
++}
++
++// -----------------------------------------------------------------------------
++// Gets a STLPropertySet from a Stylesheet
++// -----------------------------------------------------------------------------
++
++STLPropertySet* getSTLPropertySet(SfxStyleSheet* pStyleSheet) {
++ if (!styleSheetContainsAnimation(pStyleSheet))
++ return NULL;
++ SfxAnimationItem* pAnimationItem = (SfxAnimationItem*)(pStyleSheet->GetItemSet().GetItem(SID_ANIMATION_ITEM));
++ return pAnimationItem->GetValue();
++
++}
++
++// -----------------------------------------------------------------------------
++// Applies the animation from a stylesheet to a SdrObject
++// @@@ TODO @@@
++// Change this to support removing of the effects
++// -----------------------------------------------------------------------------
++
++void applyAnimationFromStyleSheet(SdrObject* pSdrObj, SfxStyleSheet* pStyleSheet) {
++
++ if (!sd::tools::styleSheetContainsAnimation(pStyleSheet))
++ // No animation for this stylesheet
++ return;
++
++ OUString strEmpty;
++ OUString aPresetId;
++
++ sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pSdrObj->GetPage())->getMainSequence();
++ STLPropertySet* pSet = getSTLPropertySet(pStyleSheet);
++ if (pSet == NULL) {
++ // @@ TODO
++ // check for a previous effect, and remove it from the main sequence
++ return;
++
++ }
++
++ if (pSet->getPropertyState( nHandlePresetId ) == STLPropertyState_DIRECT )
++ {
++ pSet->getPropertyValue(nHandlePresetId) >>= aPresetId;
++ }
++
++ CustomAnimationPresets presets = CustomAnimationPresets::getCustomAnimationPresets();
++ CustomAnimationPresetPtr pPreset = presets.getEffectDescriptor( aPresetId );
++ Reference< XAnimationNode > xNode( pPreset->create( strEmpty ) );
++ CustomAnimationEffectPtr pEffect(new CustomAnimationEffect(xNode));
++
++ sd::tools::getEffectFromSTLPropertySet(pSet, pEffect, pMainSequence);
++
++ Any target = makeAny(GetXShapeForSdrObject(pSdrObj));
++ float fDuration = 2.0f;
++ if( pSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
++ {
++ pSet->getPropertyValue( nHandleDuration ) >>= fDuration;
++ }
++
++ CustomAnimationEffectPtr pCreated = pMainSequence->append( pPreset, target, fDuration );
++ pCreated->setTarget(target);
++
++ MainSequenceRebuildGuard aGuard( pMainSequence );
++ pMainSequence->rebuild();
++}
++
++// -----------------------------------------------------------------------------
++// Gets the PresetId and the Duration from a Stylesheet's SfxItemSet
++// -----------------------------------------------------------------------------
++
++BOOL getPresetData(const SfxItemSet& rSet, rtl::OUString& aPresetId, float& fDuration)
++{
++ SfxAnimationItem* pAnimationItem = (SfxAnimationItem*)rSet.GetItem(SID_ANIMATION_ITEM);
++ if (pAnimationItem && pAnimationItem->GetValue())
++ {
++ STLPropertySet* pSet = new STLPropertySet(*pAnimationItem->GetValue());
++ return getPresetData(pSet, aPresetId, fDuration);
++ }
++ return FALSE;
++}
++
++// -----------------------------------------------------------------------------
++// Gets the PresetId and the Duration from a STLPropertySet
++// -----------------------------------------------------------------------------
++
++BOOL getPresetData(const STLPropertySet* pSet, rtl::OUString& aPresetId, float& fDuration)
++{
++ if (pSet)
++ {
++ if( pSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
++ {
++ pSet->getPropertyValue( nHandleDuration ) >>= fDuration;
++ }
++
++ if (pSet->getPropertyState( nHandlePresetId ) == STLPropertyState_DIRECT )
++ {
++ pSet->getPropertyValue(nHandlePresetId) >>= aPresetId;
++ }
++ return TRUE;
++ }
++ return FALSE;
++}
++
++} // namespace tools
++} // namespace sd
+diff --git sd/source/core/stlsheet.cxx sd/source/core/stlsheet.cxx
+index 5317143..ad0492c 100644
+--- sd/source/core/stlsheet.cxx
++++ sd/source/core/stlsheet.cxx
+@@ -263,7 +263,8 @@ SfxItemSet& SdStyleSheet::GetItemSet()
+
+ SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
+
+- SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
++ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
++ SID_ANIMATION_ITEM, SID_ANIMATION_ITEM,
+ 0, 0 };
+
+ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
+diff --git sd/source/ui/animations/CustomAnimation.hrc sd/source/ui/animations/CustomAnimation.hrc
+index 1914b47..b145828 100644
+--- sd/source/ui/animations/CustomAnimation.hrc
++++ sd/source/ui/animations/CustomAnimation.hrc
+@@ -40,6 +40,7 @@
+ #define DLG_SLIDE_TRANSITION_PANE RID_CUSTOMANIMATION_START+3
+ #define DLG_CUSTOMANIMATION_SCHEMES_PANE RID_CUSTOMANIMATION_START+4
+ #define DLG_ANIMATION_SCHEMES_PANE RID_CUSTOMANIMATION_START+5
++#define DLG_STYLESHEETEFFECT_CREATE RID_CUSTOMANIMATION_START+6
+
+ #define RID_EFFECT_CONTEXTMENU RID_CUSTOMANIMATION_START+0
+ #define RID_TP_CUSTOMANIMATION_EFFECT RID_CUSTOMANIMATION_START+1
+diff --git sd/source/ui/animations/CustomAnimationCreateDialog.cxx sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+index e9c48b9..5db4041 100644
+--- sd/source/ui/animations/CustomAnimationCreateDialog.cxx
++++ sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+@@ -28,9 +28,6 @@
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_sd.hxx"
+
+-#ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
+-#include <com/sun/star/i18n/XCollator.hpp>
+-#endif
+
+ #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+ #include <comphelper/processfactory.hxx>
+@@ -43,7 +40,7 @@
+ #include <vcl/button.hxx>
+ #endif
+ #include <vcl/fixed.hxx>
+-#include <vcl/lstbox.hxx>
++
+ #include <vcl/combobox.hxx>
+ #include <svtools/valueset.hxx>
+
+@@ -89,27 +86,6 @@ extern void fillDurationComboBox( ComboBox* pBox );
+
+ // --------------------------------------------------------------------
+
+-class CategoryListBox : public ListBox
+-{
+-public:
+- CategoryListBox( Window* pParent, WinBits nStyle = WB_BORDER );
+- CategoryListBox( Window* pParent, const ResId& rResId );
+- ~CategoryListBox();
+-
+- virtual void MouseButtonUp( const MouseEvent& rMEvt );
+-
+- USHORT InsertCategory( const XubString& rStr, USHORT nPos = LISTBOX_APPEND );
+-
+- void SetDoubleClickLink( const Link& rDoubleClickHdl ) { maDoubleClickHdl = rDoubleClickHdl; }
+-
+- DECL_LINK( implDoubleClickHdl, Control* );
+-
+-private:
+- virtual void UserDraw( const UserDrawEvent& rUDEvt );
+-
+- Link maDoubleClickHdl;
+-};
+-
+ CategoryListBox::CategoryListBox( Window* pParent, WinBits nStyle /* = WB_BORDER */ )
+ : ListBox( pParent, nStyle )
+ {
+@@ -232,15 +208,6 @@ private:
+
+ };
+
+-struct ImplStlEffectCategorySortHelper
+-{
+- ImplStlEffectCategorySortHelper();
+- bool operator()( const CustomAnimationPresetPtr& p1, const CustomAnimationPresetPtr& p2 );
+-
+-private:
+- uno::Reference< i18n::XCollator > mxCollator;
+-};
+-
+ ImplStlEffectCategorySortHelper::ImplStlEffectCategorySortHelper()
+ {
+ uno::Reference<lang::XMultiServiceFactory> xFac( ::comphelper::getProcessServiceFactory() );
+diff --git sd/source/ui/animations/CustomAnimationCreateDialog.hxx sd/source/ui/animations/CustomAnimationCreateDialog.hxx
+index 48b8704..4cf2f66 100644
+--- sd/source/ui/animations/CustomAnimationCreateDialog.hxx
++++ sd/source/ui/animations/CustomAnimationCreateDialog.hxx
+@@ -29,7 +29,15 @@
+ #define _SD_CUSTOMANIMATIONCREATEDIALOG_HXX
+
+ #include "CustomAnimationPreset.hxx"
++
+ #include <vcl/tabdlg.hxx>
++#include <vcl/lstbox.hxx>
++#ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
++#include <com/sun/star/i18n/XCollator.hpp>
++#endif
++
++
++using namespace ::com::sun::star;
+
+ enum PathKind { NONE, CURVE, POLYGON, FREEFORM };
+
+@@ -45,6 +53,38 @@ namespace sd {
+ class CustomAnimationCreateTabPage;
+ class CustomAnimationPane;
+
++class CategoryListBox : public ListBox
++{
++public:
++ CategoryListBox( Window* pParent, WinBits nStyle = WB_BORDER );
++ CategoryListBox( Window* pParent, const ResId& rResId );
++ ~CategoryListBox();
++
++ virtual void MouseButtonUp( const MouseEvent& rMEvt );
++
++ USHORT InsertCategory( const XubString& rStr, USHORT nPos = LISTBOX_APPEND );
++
++ void SetDoubleClickLink( const Link& rDoubleClickHdl ) { maDoubleClickHdl = rDoubleClickHdl; }
++
++ DECL_LINK( implDoubleClickHdl, Control* );
++
++private:
++ virtual void UserDraw( const UserDrawEvent& rUDEvt );
++
++ Link maDoubleClickHdl;
++};
++
++// --------------------------------------------------------------------
++
++struct ImplStlEffectCategorySortHelper
++{
++ ImplStlEffectCategorySortHelper();
++ bool operator()( const CustomAnimationPresetPtr& p1, const CustomAnimationPresetPtr& p2 );
++
++private:
++ uno::Reference< i18n::XCollator > mxCollator;
++};
++
+ class CustomAnimationCreateDialog : public TabDialog
+ {
+ friend class CustomAnimationCreateTabPage;
+diff --git sd/source/ui/animations/CustomAnimationDialog.cxx sd/source/ui/animations/CustomAnimationDialog.cxx
+index bf37d9a..88d9761 100644
+--- sd/source/ui/animations/CustomAnimationDialog.cxx
++++ sd/source/ui/animations/CustomAnimationDialog.cxx
+@@ -2483,7 +2483,7 @@ STLPropertySet* CustomAnimationDialog::getResultSet()
+ if( mpResultSet )
+ delete mpResultSet;
+
+- mpResultSet = createDefaultSet();
++ mpResultSet = STLPropertySet::createDefaultSet();
+
+ mpEffectTabPage->update( mpResultSet );
+ mpDurationTabPage->update( mpResultSet );
+@@ -2493,54 +2493,6 @@ STLPropertySet* CustomAnimationDialog::getResultSet()
+ return mpResultSet;
+ }
+
+-STLPropertySet* CustomAnimationDialog::createDefaultSet()
+-{
+- Any aEmpty;
+-
+- STLPropertySet* pSet = new STLPropertySet();
+- pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( (sal_Int32)-1 ) );
+-
+- pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( (sal_Bool)sal_False ) );
+- pSet->setPropertyDefaultValue( nHandleAfterEffectOnNextEffect, makeAny( (sal_Bool)sal_False ) );
+- pSet->setPropertyDefaultValue( nHandleDimColor, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleIterateType, makeAny( (sal_Int16)0 ) );
+- pSet->setPropertyDefaultValue( nHandleIterateInterval, makeAny( (double)0.0 ) );
+-
+- pSet->setPropertyDefaultValue( nHandleStart, makeAny( (sal_Int16)EffectNodeType::ON_CLICK ) );
+- pSet->setPropertyDefaultValue( nHandleBegin, makeAny( (double)0.0 ) );
+- pSet->setPropertyDefaultValue( nHandleDuration, makeAny( (double)2.0 ) );
+- pSet->setPropertyDefaultValue( nHandleRepeat, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleRewind, makeAny( AnimationFill::HOLD ) );
+-
+- pSet->setPropertyDefaultValue( nHandleEnd, aEmpty );
+-
+- pSet->setPropertyDefaultValue( nHandlePresetId, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleProperty1Type, makeAny( nPropertyTypeNone ) );
+- pSet->setPropertyDefaultValue( nHandleProperty1Value, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleProperty2Type, makeAny( nPropertyTypeNone ) );
+- pSet->setPropertyDefaultValue( nHandleProperty2Value, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleAccelerate, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleDecelerate, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleAutoReverse, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleTrigger, aEmpty );
+-
+- pSet->setPropertyDefaultValue( nHandleHasText, makeAny( sal_False ) );
+- pSet->setPropertyDefaultValue( nHandleHasVisibleShape, makeAny( sal_False ) );
+- pSet->setPropertyDefaultValue( nHandleTextGrouping, makeAny( (sal_Int32)-1 ) );
+- pSet->setPropertyDefaultValue( nHandleAnimateForm, makeAny( sal_True ) );
+- pSet->setPropertyDefaultValue( nHandleTextGroupingAuto, makeAny( (double)-1.0 ) );
+- pSet->setPropertyDefaultValue( nHandleTextReverse, makeAny( sal_False ) );
+-
+- pSet->setPropertyDefaultValue( nHandleCurrentPage, aEmpty );
+-
+- pSet->setPropertyDefaultValue( nHandleSoundURL, aEmpty );
+- pSet->setPropertyDefaultValue( nHandleSoundVolumne, makeAny( (double)1.0) );
+- pSet->setPropertyDefaultValue( nHandleSoundEndAfterSlide, makeAny( (sal_Int32)0 ) );
+-
+- pSet->setPropertyDefaultValue( nHandleCommand, makeAny( (sal_Int16)0 ) );
+- return pSet;
+-}
+-
+ PropertyControl::PropertyControl( Window* pParent, const ResId& rResId )
+ : ListBox( pParent, rResId ), mpSubControl(0)
+ {
+diff --git sd/source/ui/animations/CustomAnimationDialog.hxx sd/source/ui/animations/CustomAnimationDialog.hxx
+index c96c06d..6f8c7a0 100644
+--- sd/source/ui/animations/CustomAnimationDialog.hxx
++++ sd/source/ui/animations/CustomAnimationDialog.hxx
+@@ -39,74 +39,6 @@ class CancelButton;
+ class HelpButton;
+ namespace sd {
+
+-
+-// --------------------------------------------------------------------
+-
+-// property handles
+-const sal_Int32 nHandleSound = 0;
+-const sal_Int32 nHandleHasAfterEffect = 1;
+-const sal_Int32 nHandleIterateType = 2;
+-const sal_Int32 nHandleIterateInterval = 3;
+-const sal_Int32 nHandleStart = 4;
+-const sal_Int32 nHandleBegin = 5;
+-const sal_Int32 nHandleDuration = 6;
+-const sal_Int32 nHandleRepeat = 7;
+-const sal_Int32 nHandleRewind = 8;
+-const sal_Int32 nHandleEnd = 9;
+-const sal_Int32 nHandleAfterEffectOnNextEffect = 10;
+-const sal_Int32 nHandleDimColor = 11;
+-const sal_Int32 nHandleMaxParaDepth = 12;
+-const sal_Int32 nHandlePresetId = 13;
+-const sal_Int32 nHandleProperty1Type = 14;
+-const sal_Int32 nHandleProperty1Value = 15;
+-const sal_Int32 nHandleProperty2Type = 16;
+-const sal_Int32 nHandleProperty2Value = 17;
+-
+-const sal_Int32 nHandleAccelerate = 18;
+-const sal_Int32 nHandleDecelerate = 19;
+-const sal_Int32 nHandleAutoReverse = 20;
+-const sal_Int32 nHandleTrigger = 21;
+-
+-const sal_Int32 nHandleHasText = 22;
+-const sal_Int32 nHandleTextGrouping = 23;
+-const sal_Int32 nHandleAnimateForm = 24;
+-const sal_Int32 nHandleTextGroupingAuto = 25;
+-const sal_Int32 nHandleTextReverse = 26;
+-
+-const sal_Int32 nHandleCurrentPage = 27;
+-const sal_Int32 nHandleSoundURL = 28;
+-const sal_Int32 nHandleSoundVolumne = 29;
+-const sal_Int32 nHandleSoundEndAfterSlide = 30;
+-
+-const sal_Int32 nHandleCommand = 31;
+-
+-const sal_Int32 nHandleHasVisibleShape = 32;
+-
+-const sal_Int32 nPropertyTypeNone = 0;
+-const sal_Int32 nPropertyTypeDirection = 1;
+-const sal_Int32 nPropertyTypeSpokes = 2;
+-const sal_Int32 nPropertyTypeFirstColor = 3;
+-const sal_Int32 nPropertyTypeSecondColor = 4;
+-const sal_Int32 nPropertyTypeZoom = 5;
+-const sal_Int32 nPropertyTypeFillColor = 6;
+-const sal_Int32 nPropertyTypeColorStyle = 7;
+-const sal_Int32 nPropertyTypeFont = 8;
+-const sal_Int32 nPropertyTypeCharHeight = 9;
+-const sal_Int32 nPropertyTypeCharColor = 10;
+-const sal_Int32 nPropertyTypeCharHeightStyle = 11;
+-const sal_Int32 nPropertyTypeCharDecoration = 12;
+-const sal_Int32 nPropertyTypeLineColor = 13;
+-const sal_Int32 nPropertyTypeRotate = 14;
+-const sal_Int32 nPropertyTypeColor = 15;
+-const sal_Int32 nPropertyTypeAccelerate = 16;
+-const sal_Int32 nPropertyTypeDecelerate = 17;
+-const sal_Int32 nPropertyTypeAutoReverse = 18;
+-const sal_Int32 nPropertyTypeTransparency = 19;
+-const sal_Int32 nPropertyTypeFontStyle = 20;
+-const sal_Int32 nPropertyTypeScale = 21;
+-
+-// --------------------------------------------------------------------
+-
+ class PropertySubControl
+ {
+ public:
+@@ -164,7 +96,6 @@ public:
+ STLPropertySet* getDefaultSet() { return mpSet; }
+ STLPropertySet* getResultSet();
+
+- static STLPropertySet* createDefaultSet();
+
+ private:
+ STLPropertySet* mpSet;
+diff --git sd/source/ui/animations/CustomAnimationPane.cxx sd/source/ui/animations/CustomAnimationPane.cxx
+index d835e0e..c60e57c 100644
+--- sd/source/ui/animations/CustomAnimationPane.cxx
++++ sd/source/ui/animations/CustomAnimationPane.cxx
+@@ -93,11 +93,16 @@
+ #include <basegfx/matrix/b2dhommatrix.hxx>
+ #include <basegfx/range/b2drange.hxx>
+
++// for handling Animations within stylesheets
++#include <sdtools.hxx>
++#include <STLPropertySet.hxx>
++
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::animations;
+ using namespace ::com::sun::star::presentation;
+ using namespace ::com::sun::star::text;
+
++using sd::tools::addValue;
+ using ::rtl::OUString;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::drawing;
+@@ -383,7 +388,6 @@ IMPL_LINK(CustomAnimationPane,EventMultiplexerListener,
+ return 0;
+ }
+
+-
+ void CustomAnimationPane::updateLayout()
+ {
+ Size aPaneSize( GetSizePixel() );
+@@ -1077,25 +1081,6 @@ void CustomAnimationPane::onContextMenu( USHORT nSelectedPopupEntry )
+ updateControls();
+ }
+
+-void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
+-{
+- switch( pSet->getPropertyState( nHandle ) )
+- {
+- case STLPropertyState_AMBIGUOUS:
+- // value is already ambiguous, do nothing
+- break;
+- case STLPropertyState_DIRECT:
+- // set to ambiguous if existing value is different
+- if( rValue != pSet->getPropertyValue( nHandle ) )
+- pSet->setPropertyState( nHandle, STLPropertyState_AMBIGUOUS );
+- break;
+- case STLPropertyState_DEFAULT:
+- // just set new value
+- pSet->setPropertyValue( nHandle, rValue );
+- break;
+- }
+-}
+-
+ static sal_Int32 calcMaxParaDepth( Reference< XShape > xTargetShape )
+ {
+ sal_Int32 nMaxParaDepth = -1;
+@@ -1290,7 +1275,7 @@ static sal_Bool hasVisibleShape( const Reference< XShape >& xShape )
+
+ STLPropertySet* CustomAnimationPane::createSelectionSet()
+ {
+- STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet();
++ STLPropertySet* pSet = STLPropertySet::createDefaultSet();
+
+ pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) );
+
+@@ -1426,228 +1411,18 @@ void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLProper
+ DBG_ASSERT( pEffect->getEffectSequence(), "sd::CustomAnimationPane::changeSelection(), dead effect in selection!" );
+ if( !pEffect->getEffectSequence() )
+ continue;
+-
+- double fDuration = 0.0; // we might need this for iterate-interval
+- if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
+- {
+- pResultSet->getPropertyValue( nHandleDuration ) >>= fDuration;
+- }
+- else
+- {
+- fDuration = pEffect->getDuration();
+- }
+-
+- if( pResultSet->getPropertyState( nHandleIterateType ) == STLPropertyState_DIRECT )
+- {
+- sal_Int16 nIterateType = 0;
+- pResultSet->getPropertyValue( nHandleIterateType ) >>= nIterateType;
+- if( pEffect->getIterateType() != nIterateType )
+- {
+- pEffect->setIterateType( nIterateType );
+- bChanged = true;
+- }
+- }
+-
+- if( pEffect->getIterateType() )
+- {
+- if( pResultSet->getPropertyState( nHandleIterateInterval ) == STLPropertyState_DIRECT )
+- {
+- double fIterateInterval = 0.0;
+- pResultSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval;
+- if( pEffect->getIterateInterval() != fIterateInterval )
+- {
+- const double f = fIterateInterval * pEffect->getDuration() / 100;
+- pEffect->setIterateInterval( f );
+- bChanged = true;
+- }
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState_DIRECT )
+- {
+- double fBegin = 0.0;
+- pResultSet->getPropertyValue( nHandleBegin ) >>= fBegin;
+- if( pEffect->getBegin() != fBegin )
+- {
+- pEffect->setBegin( fBegin );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
+- {
+- if( pEffect->getDuration() != fDuration )
+- {
+- pEffect->setDuration( fDuration );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleStart ) == STLPropertyState_DIRECT )
+- {
+- sal_Int16 nNodeType = 0;
+- pResultSet->getPropertyValue( nHandleStart ) >>= nNodeType;
+- if( pEffect->getNodeType() != nNodeType )
+- {
+- pEffect->setNodeType( nNodeType );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleRepeat ) == STLPropertyState_DIRECT )
+- {
+- Any aRepeatCount( pResultSet->getPropertyValue( nHandleRepeat ) );
+- if( aRepeatCount != pEffect->getRepeatCount() )
+- {
+- pEffect->setRepeatCount( aRepeatCount );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleEnd ) == STLPropertyState_DIRECT )
+- {
+- Any aEndValue( pResultSet->getPropertyValue( nHandleEnd ) );
+- if( pEffect->getEnd() != aEndValue )
+- {
+- pEffect->setEnd( aEndValue );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleRewind ) == STLPropertyState_DIRECT )
+- {
+- sal_Int16 nFill = 0;
+- pResultSet->getPropertyValue( nHandleRewind ) >>= nFill;
+- if( pEffect->getFill() != nFill )
+- {
+- pEffect->setFill( nFill );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleHasAfterEffect ) == STLPropertyState_DIRECT )
+- {
+- sal_Bool bHasAfterEffect = sal_False;
+- if( pResultSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect )
+- {
+- if( pEffect->hasAfterEffect() != bHasAfterEffect )
+- {
+- pEffect->setHasAfterEffect( bHasAfterEffect );
+- bChanged = true;
+- }
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleAfterEffectOnNextEffect ) == STLPropertyState_DIRECT )
+- {
+- sal_Bool bAfterEffectOnNextEffect = sal_False;
+- if( (pResultSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextEffect) && ((pEffect->IsAfterEffectOnNext() ? sal_True : sal_False) != bAfterEffectOnNextEffect) )
+- {
+- pEffect->setAfterEffectOnNext( bAfterEffectOnNextEffect );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleDimColor ) == STLPropertyState_DIRECT )
+- {
+- Any aDimColor( pResultSet->getPropertyValue( nHandleDimColor ) );
+- if( pEffect->getDimColor() != aDimColor )
+- {
+- pEffect->setDimColor( aDimColor );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT )
+- {
+- double fAccelerate = 0.0;
+- pResultSet->getPropertyValue( nHandleAccelerate ) >>= fAccelerate;
+- if( pEffect->getAcceleration() != fAccelerate )
+- {
+- pEffect->setAcceleration( fAccelerate );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleDecelerate ) == STLPropertyState_DIRECT )
+- {
+- double fDecelerate = 0.0;
+- pResultSet->getPropertyValue( nHandleDecelerate ) >>= fDecelerate;
+- if( pEffect->getDecelerate() != fDecelerate )
+- {
+- pEffect->setDecelerate( fDecelerate );
+- bChanged = true;
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleAutoReverse ) == STLPropertyState_DIRECT )
+- {
+- sal_Bool bAutoReverse = sal_False;
+- pResultSet->getPropertyValue( nHandleAutoReverse ) >>= bAutoReverse;
+- if( pEffect->getAutoReverse() != bAutoReverse )
+- {
+- pEffect->setAutoReverse( bAutoReverse );
+- bChanged = true;
+- }
+- }
+-
++ // Initialize effect
++ bChanged = sd::tools::getEffectFromSTLPropertySet(pResultSet, pEffect, mpMainSequence);
+ if( pResultSet->getPropertyState( nHandleProperty1Value ) == STLPropertyState_DIRECT )
+ {
+ sal_Int32 nType = 0;
+ pOldSet->getPropertyValue( nHandleProperty1Type ) >>= nType;
+
+ bChanged |= setProperty1Value( nType, pEffect, pResultSet->getPropertyValue( nHandleProperty1Value ) );
+- }
+-
+- if( pResultSet->getPropertyState( nHandleSoundURL ) == STLPropertyState_DIRECT )
+- {
+- const Any aSoundSource( pResultSet->getPropertyValue( nHandleSoundURL ) );
+-
+- if( aSoundSource.getValueType() == ::getCppuType((const sal_Bool*)0) )
+- {
+- pEffect->setStopAudio();
+- bChanged = true;
+- }
+- else
+- {
+- OUString aSoundURL;
+- aSoundSource >>= aSoundURL;
+-
+- if( aSoundURL.getLength() )
+- {
+- if( !pEffect->getAudio().is() )
+- {
+- pEffect->createAudio( aSoundSource );
+- bChanged = true;
+- }
+- else
+- {
+- if( pEffect->getAudio()->getSource() != aSoundSource )
+- {
+- pEffect->getAudio()->setSource( aSoundSource );
+- bChanged = true;
+- }
+- }
+- }
+- else
+- {
+- if( pEffect->getAudio().is() || pEffect->getStopAudio() )
+- {
+- pEffect->removeAudio();
+- bChanged = true;
+- }
+- }
+- }
+- }
+-
+- if( pResultSet->getPropertyState( nHandleTrigger ) == STLPropertyState_DIRECT )
+- {
+- Reference< XShape > xTriggerShape;
+- pResultSet->getPropertyValue( nHandleTrigger ) >>= xTriggerShape;
+- bChanged |= mpMainSequence->setTrigger( pEffect, xTriggerShape );
+- }
++ }
+ }
+
++ // Initialize the other parts of the effect
+ const bool bHasTextGrouping = pResultSet->getPropertyState( nHandleTextGrouping ) == STLPropertyState_DIRECT;
+ const bool bHasAnimateForm = pResultSet->getPropertyState( nHandleAnimateForm ) == STLPropertyState_DIRECT;
+ const bool bHasTextGroupingAuto = pResultSet->getPropertyState( nHandleTextGroupingAuto ) == STLPropertyState_DIRECT;
+diff --git sd/source/ui/animations/STLPropertySet.cxx sd/source/ui/animations/STLPropertySet.cxx
+deleted file mode 100644
+index 3f72f58..0000000
+--- sd/source/ui/animations/STLPropertySet.cxx
++++ /dev/null
+@@ -1,124 +0,0 @@
+-/*************************************************************************
+- *
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * Copyright 2000, 2010 Oracle and/or its affiliates.
+- *
+- * OpenOffice.org - a multi-platform office productivity suite
+- *
+- * This file is part of OpenOffice.org.
+- *
+- * OpenOffice.org is free software: you can redistribute it and/or modify
+- * it under the terms of the GNU Lesser General Public License version 3
+- * only, as published by the Free Software Foundation.
+- *
+- * OpenOffice.org 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 version 3 for more details
+- * (a copy is included in the LICENSE file that accompanied this code).
+- *
+- * You should have received a copy of the GNU Lesser General Public License
+- * version 3 along with OpenOffice.org. If not, see
+- * <http://www.openoffice.org/license.html>
+- * for a copy of the LGPLv3 License.
+- *
+- ************************************************************************/
+-
+-// MARKER(update_precomp.py): autogen include statement, do not remove
+-#include "precompiled_sd.hxx"
+-#include <tools/debug.hxx>
+-#include "STLPropertySet.hxx"
+-
+-using namespace com::sun::star::beans;
+-
+-using rtl::OUString;
+-using com::sun::star::uno::Any;
+-
+-namespace sd
+-{
+-
+-STLPropertySet::STLPropertySet()
+-{
+-}
+-
+-STLPropertySet::~STLPropertySet()
+-{
+-}
+-
+-void STLPropertySet::setPropertyDefaultValue( sal_Int32 nHandle, const Any& rValue )
+-{
+- STLPropertyMapEntry aEntry( rValue, STLPropertyState_DEFAULT );
+- maPropertyMap[ nHandle ] = aEntry;
+-}
+-
+-void STLPropertySet::setPropertyValue( sal_Int32 nHandle, const Any& rValue, sal_Int32 /* nState = STLPropertyState_DIRECT */ )
+-{
+- PropertyMapIter aIter;
+- if( findProperty( nHandle, aIter ) )
+- {
+- (*aIter).second.mnState = STLPropertyState_DIRECT;
+- (*aIter).second.maValue = rValue;
+- }
+- else
+- {
+- DBG_ERROR( "sd::STLPropertySet::setPropertyValue(), unknown property!" );
+- }
+-}
+-
+-Any STLPropertySet::getPropertyValue( sal_Int32 nHandle ) const
+-{
+- PropertyMapConstIter aIter;
+- if( findProperty( nHandle, aIter ) )
+- {
+- return (*aIter).second.maValue;
+- }
+- else
+- {
+- DBG_ERROR( "sd::STLPropertySet::setPropertyValue(), unknown property!" );
+-
+- Any aAny;
+- return aAny;
+- }
+-}
+-
+-sal_Int32 STLPropertySet::getPropertyState( sal_Int32 nHandle ) const
+-{
+- PropertyMapConstIter aIter;
+- if( findProperty( nHandle, aIter ) )
+- {
+- return (*aIter).second.mnState;
+- }
+- else
+- {
+- DBG_ERROR( "sd::STLPropertySet::setPropertyState(), unknown property!" );
+- return STLPropertyState_AMBIGUOUS;
+- }
+-}
+-
+-void STLPropertySet::setPropertyState( sal_Int32 nHandle, sal_Int32 nState )
+-{
+- PropertyMapIter aIter;
+- if( findProperty( nHandle, aIter ) )
+- {
+- (*aIter).second.mnState = nState;
+- }
+- else
+- {
+- DBG_ERROR( "sd::STLPropertySet::setPropertyState(), unknown property!" );
+- }
+-}
+-
+-bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapIter& rIter )
+-{
+- rIter = maPropertyMap.find(nHandle);
+- return( rIter != maPropertyMap.end() );
+-}
+-
+-bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const
+-{
+- rIter = maPropertyMap.find(nHandle);
+- return( rIter != maPropertyMap.end() );
+-}
+-
+-}
+diff --git sd/source/ui/animations/STLPropertySet.hxx sd/source/ui/animations/STLPropertySet.hxx
+deleted file mode 100644
+index 2d5d95b..0000000
+--- sd/source/ui/animations/STLPropertySet.hxx
++++ /dev/null
+@@ -1,86 +0,0 @@
+-/*************************************************************************
+- *
+- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+- *
+- * Copyright 2000, 2010 Oracle and/or its affiliates.
+- *
+- * OpenOffice.org - a multi-platform office productivity suite
+- *
+- * This file is part of OpenOffice.org.
+- *
+- * OpenOffice.org is free software: you can redistribute it and/or modify
+- * it under the terms of the GNU Lesser General Public License version 3
+- * only, as published by the Free Software Foundation.
+- *
+- * OpenOffice.org 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 version 3 for more details
+- * (a copy is included in the LICENSE file that accompanied this code).
+- *
+- * You should have received a copy of the GNU Lesser General Public License
+- * version 3 along with OpenOffice.org. If not, see
+- * <http://www.openoffice.org/license.html>
+- * for a copy of the LGPLv3 License.
+- *
+- ************************************************************************/
+-
+-#ifndef _SD_STLPROPERTYSET_HXX
+-#define _SD_STLPROPERTYSET_HXX
+-
+-#include <com/sun/star/beans/PropertyValue.hpp>
+-
+-#ifndef _UTL_STLTYPES_HXX_
+-#include <comphelper/stl_types.hxx>
+-#endif
+-
+-#include <list>
+-#include <map>
+-
+-namespace sd
+-{
+-
+-const sal_Int32 STLPropertyState_DEFAULT = 0;
+-const sal_Int32 STLPropertyState_DIRECT = 1;
+-const sal_Int32 STLPropertyState_AMBIGUOUS = 3;
+-
+-struct STLPropertyMapEntry
+-{
+- ::com::sun::star::uno::Any maValue;
+- sal_Int32 mnState;
+-
+- STLPropertyMapEntry()
+- : mnState( STLPropertyState_AMBIGUOUS ) {}
+- STLPropertyMapEntry( ::com::sun::star::uno::Any aValue, sal_Int32 nState = STLPropertyState_DEFAULT )
+- : maValue( aValue ), mnState( nState ) {}
+-
+-};
+-
+-typedef std::map<sal_Int32, STLPropertyMapEntry > PropertyMap;
+-typedef PropertyMap::iterator PropertyMapIter;
+-typedef PropertyMap::const_iterator PropertyMapConstIter;
+-
+-class STLPropertySet
+-{
+-public:
+- STLPropertySet();
+- ~STLPropertySet();
+-
+- void setPropertyDefaultValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue );
+- void setPropertyValue( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue, sal_Int32 nState = STLPropertyState_DIRECT );
+- ::com::sun::star::uno::Any getPropertyValue( sal_Int32 nHandle ) const;
+-
+- sal_Int32 getPropertyState( sal_Int32 nHandle ) const;
+- void setPropertyState( sal_Int32 nHandle, sal_Int32 nState );
+-
+-private:
+- bool findProperty( sal_Int32 nHandle, PropertyMapIter& rIter );
+- bool findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const;
+-
+-private:
+- PropertyMap maPropertyMap;
+-};
+-
+-}
+-
+-#endif // _SD_STLPROPERTYSET_HXX
+diff --git sd/source/ui/animations/StyleSheetEffectCreateDialog.cxx sd/source/ui/animations/StyleSheetEffectCreateDialog.cxx
+new file mode 100644
+index 0000000..ffc5562
+--- /dev/null
++++ sd/source/ui/animations/StyleSheetEffectCreateDialog.cxx
+@@ -0,0 +1,512 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sd.hxx"
++
++#ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
++#include <com/sun/star/i18n/XCollator.hpp>
++#endif
++
++#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
++#include <comphelper/processfactory.hxx>
++#endif
++#include <vcl/svapp.hxx>
++#include <vcl/tabctrl.hxx>
++#include <vcl/tabpage.hxx>
++
++#ifndef _SV_BUTTON_HXX
++#include <vcl/button.hxx>
++#endif
++#include <vcl/fixed.hxx>
++#include <vcl/lstbox.hxx>
++#include <vcl/combobox.hxx>
++#include <svtools/valueset.hxx>
++
++#include <svx/svdetc.hxx>
++#include <svx/svdstr.hrc>
++#include "sdresid.hxx"
++#include <svtools/viewoptions.hxx>
++#include <com/sun/star/presentation/EffectNodeType.hpp>
++#include "StyleSheetEffectCreateDialog.hxx"
++
++#include "StyleSheetEffectCreateDialog.hrc"
++#include <CustomAnimationCreateDialog.hxx>
++#include <STLPropertySet.hxx>
++#include <com/sun/star/uno/Any.hxx>
++#include "optsitem.hxx"
++#include "sddll.hxx"
++
++#include "helpids.h"
++
++using namespace ::com::sun::star;
++
++using ::rtl::OUString;
++using ::com::sun::star::uno::UNO_QUERY;
++using ::com::sun::star::uno::UNO_QUERY_THROW;
++using ::com::sun::star::uno::Any;
++using ::com::sun::star::uno::makeAny;
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::uno::Exception;
++using namespace ::com::sun::star::presentation;
++
++
++namespace sd {
++
++const int ENTRANCE = 0;
++const int EMPHASIS = 1;
++const int EXIT = 2;
++const int MISCEFFECTS = 3;
++
++extern void fillDurationComboBox( ComboBox* pBox );
++
++//-------------------------------------------------------------------------------
++
++class StyleSheetEffectTabPage : public TabPage
++{
++public:
++ StyleSheetEffectTabPage( Window* pParent,
++ StyleSheetEffectCreateDialog* pDialogParent,
++ int nTabId,
++ const PresetCategoryList& rCategoryList,
++ bool bHasText);
++
++ ~StyleSheetEffectTabPage();
++
++ CustomAnimationPresetPtr getSelectedPreset() const;
++ double getDuration() const;
++
++ void setDuration( double fDuration );
++ bool select( const OUString& rsPresetId );
++
++private:
++ DECL_LINK( implSelectHdl, Control* );
++ DECL_LINK( implDoubleClickHdl, Control* );
++ void clearEffects();
++ void onSelectEffect();
++
++private:
++ CategoryListBox* mpLBEffects;
++ FixedText* mpFTSpeed;
++ ComboBox* mpCBSpeed;
++
++ StyleSheetEffectCreateDialog* mpParent;
++};
++
++//-------------------------------------------------------------------------------
++
++StyleSheetEffectTabPage::StyleSheetEffectTabPage( Window* pParent,
++ StyleSheetEffectCreateDialog* pDialogParent,
++ int /* nTabId */,
++ const PresetCategoryList& rCategoryList,
++ bool bHasText ) :
++ TabPage( pParent, SdResId( RID_TP_CUSTOMANIMATION_ENTRANCE_SS ) ) ,
++ mpParent( pDialogParent )
++
++{
++ mpLBEffects = new CategoryListBox( this, SdResId( LB_EFFECTS_SS ) );
++ mpFTSpeed = new FixedText( this, SdResId( FT_SPEED_SS ) );
++ mpCBSpeed = new ComboBox( this, SdResId( CB_SPEED_SS ) );
++
++ FreeResource();
++
++ USHORT nFirstEffect = LISTBOX_ENTRY_NOTFOUND;
++
++ // Populate with Presets
++ PresetCategoryList::const_iterator aCategoryIter( rCategoryList.begin() );
++ const PresetCategoryList::const_iterator aCategoryEnd( rCategoryList.end() );
++ while( aCategoryIter != aCategoryEnd )
++ {
++ PresetCategoryPtr pCategory( *aCategoryIter++ );
++ if( pCategory.get() )
++ {
++ mpLBEffects->InsertCategory( pCategory->maLabel );
++
++ std::vector< CustomAnimationPresetPtr > aSortedVector(pCategory->maEffects.size());
++ std::copy( pCategory->maEffects.begin(), pCategory->maEffects.end(), aSortedVector.begin() );
++ ImplStlEffectCategorySortHelper aSortHelper;
++ std::sort( aSortedVector.begin(), aSortedVector.end(), aSortHelper );
++
++ std::vector< CustomAnimationPresetPtr >::const_iterator aIter( aSortedVector.begin() );
++ const std::vector< CustomAnimationPresetPtr >::const_iterator aEnd( aSortedVector.end() );
++ while( aIter != aEnd )
++ {
++ CustomAnimationPresetPtr pDescriptor = (*aIter++);
++ if( pDescriptor.get() && (bHasText || !pDescriptor->isTextOnly() ) )
++ {
++ USHORT nPos = mpLBEffects->InsertEntry( pDescriptor->getLabel() );
++ mpLBEffects->SetEntryData( nPos, static_cast<void*>( new CustomAnimationPresetPtr( pDescriptor ) ) );
++
++ if( nFirstEffect == LISTBOX_ENTRY_NOTFOUND )
++ nFirstEffect = nPos;
++ }
++ }
++ }
++ }
++
++ mpLBEffects->SelectEntryPos( nFirstEffect );
++
++ fillDurationComboBox( mpCBSpeed );
++
++ if( nFirstEffect != LISTBOX_ENTRY_NOTFOUND )
++ onSelectEffect();
++
++ mpLBEffects->SetSelectHdl( LINK( this, StyleSheetEffectTabPage, implSelectHdl ) );
++ mpLBEffects->SetDoubleClickLink( LINK( this, StyleSheetEffectTabPage, implDoubleClickHdl ) );
++}
++
++//-------------------------------------------------------------------------------
++
++StyleSheetEffectTabPage::~StyleSheetEffectTabPage()
++{
++ clearEffects();
++
++ delete mpLBEffects;
++ delete mpFTSpeed;
++ delete mpCBSpeed;
++}
++
++//-------------------------------------------------------------------------------
++
++IMPL_LINK( StyleSheetEffectTabPage, implSelectHdl, Control*, pControl )
++{
++ if( pControl == mpLBEffects )
++ onSelectEffect();
++ return 0;
++}
++
++//-------------------------------------------------------------------------------
++
++IMPL_LINK( StyleSheetEffectTabPage, implDoubleClickHdl, Control*, pControl )
++{
++ if( pControl == mpLBEffects )
++ {
++ if( mpLBEffects->GetSelectEntryCount() )
++ mpParent->EndDialog( TRUE );
++ }
++
++ // do nothing
++ return 0;
++}
++
++//-------------------------------------------------------------------------------
++
++void StyleSheetEffectTabPage::onSelectEffect()
++{
++ CustomAnimationPresetPtr*p = static_cast< CustomAnimationPresetPtr* >( mpLBEffects->GetEntryData( mpLBEffects->GetSelectEntryPos() ) );
++
++ if( !p )
++ return;
++
++ CustomAnimationPresetPtr pPreset( *p );
++
++ const double fDuration = pPreset->getDuration();
++ USHORT nPos = 0xffff;
++
++ if( fDuration == 5.0 )
++ nPos = 0;
++ else if( fDuration == 3.0 )
++ nPos = 1;
++ else if( fDuration == 2.0 )
++ nPos = 2;
++ else if( fDuration == 1.0 )
++ nPos = 3;
++ else if( fDuration == 0.5 )
++ nPos = 4;
++
++ mpCBSpeed->SelectEntryPos( nPos );
++
++ bool bHasSpeed = pPreset->getDuration() > 0.001;
++ mpCBSpeed->Enable( bHasSpeed );
++ mpFTSpeed->Enable( bHasSpeed );
++}
++
++//-------------------------------------------------------------------------------
++
++void StyleSheetEffectTabPage::clearEffects()
++{
++ USHORT nPos = mpLBEffects->GetEntryCount();
++ while( nPos-- )
++ delete static_cast< CustomAnimationPresetPtr* >( mpLBEffects->GetEntryData( nPos ) );
++
++ mpLBEffects->Clear();
++}
++
++//-------------------------------------------------------------------------------
++
++CustomAnimationPresetPtr StyleSheetEffectTabPage::getSelectedPreset() const
++{
++ CustomAnimationPresetPtr pPreset;
++
++ if( mpLBEffects->GetSelectEntryCount() == 1 )
++ {
++ void* pEntryData = mpLBEffects->GetEntryData( mpLBEffects->GetSelectEntryPos() );
++ if( pEntryData )
++ pPreset = *static_cast< CustomAnimationPresetPtr* >( pEntryData );
++ }
++
++ return pPreset;
++}
++
++//-------------------------------------------------------------------------------
++
++double StyleSheetEffectTabPage::getDuration() const
++{
++ USHORT nPos = mpCBSpeed->GetSelectEntryPos();
++ if( (nPos == 0xffff) || !mpCBSpeed->IsEnabled() )
++ {
++ CustomAnimationPresetPtr pPreset = getSelectedPreset();
++ if( pPreset.get() )
++ return pPreset->getDuration();
++ }
++
++ switch( nPos )
++ {
++ case 0: return 5.0f;
++ case 1: return 3.0f;
++ case 2: return 2.0f;
++ case 3: return 1.0f;
++ case 4: return 0.5f;
++ }
++
++ return 0.0f;
++}
++
++//-------------------------------------------------------------------------------
++
++STLPropertySet* StyleSheetEffectCreateDialog::getResultSet() const
++{
++ STLPropertySet* pNewSet = STLPropertySet::createDefaultSet();
++
++ StyleSheetEffectTabPage* pEffectTabPage = getCurrentPage();
++ float fDuration = pEffectTabPage->getDuration();
++ CustomAnimationPresetPtr pPreset = pEffectTabPage->getSelectedPreset();
++ if (pPreset == CustomAnimationPresetPtr())
++ // nothing has been chosen!
++ return NULL;
++ pNewSet->setPropertyValue( nHandleDuration, makeAny( fDuration) );
++ pNewSet->setPropertyValue( nHandlePresetId, makeAny( pPreset->getPresetId() ));
++ return pNewSet;
++
++}
++
++//-------------------------------------------------------------------------------
++
++void StyleSheetEffectTabPage::setDuration( double fDuration )
++{
++ USHORT nPos = 0;
++ if( fDuration < 2.0f )
++ {
++ if( fDuration < 1.0f )
++ {
++ nPos = 4;
++ }
++ else
++ {
++ nPos = 3;
++ }
++ }
++ else if( fDuration < 5.0f )
++ {
++ if( fDuration < 3.0f )
++ {
++ nPos = 2;
++ }
++ else
++ {
++ nPos = 1;
++ }
++ }
++
++ mpCBSpeed->SelectEntryPos( nPos );
++}
++
++//-------------------------------------------------------------------------------
++
++bool StyleSheetEffectTabPage::select( const OUString& rsPresetId )
++{
++ USHORT nPos = mpLBEffects->GetEntryCount();
++ while( nPos-- )
++ {
++ void* pEntryData = mpLBEffects->GetEntryData( nPos );
++ if( pEntryData )
++ {
++ CustomAnimationPresetPtr& pPtr = *static_cast< CustomAnimationPresetPtr* >(pEntryData);
++ if( pPtr.get() && pPtr->getPresetId() == rsPresetId )
++ {
++ mpLBEffects->SelectEntryPos( nPos );
++ return true;
++ }
++ }
++ }
++
++ return false;
++}
++
++//-------------------------------------------------------------------------------
++// ---------------------StyleSheetEffectCreateDialog-----------------------------
++//-------------------------------------------------------------------------------
++
++StyleSheetEffectCreateDialog::StyleSheetEffectCreateDialog( Window* pParent,
++ bool bHasText,
++ const ::rtl::OUString& rsPresetId,
++ double fDuration ) :
++ TabDialog( pParent, SdResId( DLG_STYLESHEETEFFECT_CREATE ) ),
++ mfDuration( fDuration )
++{
++ mpTabControl = new TabControl( this, SdResId( 1 ) );
++
++ const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
++
++ // ----- Create tabs with effects ------
++ mpTabPages[ENTRANCE] = new StyleSheetEffectTabPage( mpTabControl, this, ENTRANCE, rPresets.getEntrancePresets(), bHasText );
++ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_ENTRANCE_SS, mpTabPages[ENTRANCE] );
++
++ mpTabPages[EMPHASIS] = new StyleSheetEffectTabPage( mpTabControl, this, EMPHASIS, rPresets.getEmphasisPresets(), bHasText );
++ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EMPHASIS_SS, mpTabPages[EMPHASIS] );
++
++ mpTabPages[EXIT] = new StyleSheetEffectTabPage( mpTabControl, this, EXIT, rPresets.getExitPresets(), bHasText );
++ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EXIT_SS, mpTabPages[EXIT] );
++
++ mpTabPages[MISCEFFECTS] = new StyleSheetEffectTabPage( mpTabControl, this, MISCEFFECTS, rPresets.getMiscPresets(), bHasText );
++ mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_MISCEFFECTS_SS, mpTabPages[MISCEFFECTS] );
++
++ getCurrentPage()->setDuration( mfDuration );
++
++ mpTabControl->SetActivatePageHdl( LINK( this, StyleSheetEffectCreateDialog, implActivatePagekHdl ) );
++ mpTabControl->SetDeactivatePageHdl( LINK( this, StyleSheetEffectCreateDialog, implDeactivatePagekHdl ) );
++
++ // ----- Create buttons -----
++ mpOKButton = new OKButton(this, SdResId( 1 ) ) ;
++ mpOKButton->SetStyle(WB_DEFBUTTON);
++ mpCancelButton = new CancelButton(this, SdResId( 1 ) );
++ mpCancelButton->SetStyle(WB_DEFBUTTON);
++
++ FreeResource();
++
++ // ----- Select current preset if available -----
++ if( rsPresetId.getLength() != 0 )
++ {
++ for( sal_uInt16 i = ENTRANCE; i <= MISCEFFECTS; i++ )
++ {
++ if( mpTabPages[i]->select( rsPresetId ) )
++ {
++ mpTabControl->SetCurPageId( RID_TP_CUSTOMANIMATION_ENTRANCE_SS + i );
++ break;
++ }
++ }
++ }
++}
++
++//-------------------------------------------------------------------------------
++
++StyleSheetEffectCreateDialog::~StyleSheetEffectCreateDialog()
++{
++ delete mpTabPages[ENTRANCE];
++ delete mpTabPages[EMPHASIS];
++ delete mpTabPages[EXIT];
++ delete mpTabPages[MISCEFFECTS];
++
++ delete mpOKButton;
++ delete mpCancelButton;
++ delete mpTabControl;
++}
++
++//-------------------------------------------------------------------------------
++
++void StyleSheetEffectCreateDialog::setPreset(const rtl::OUString& rsPresetId)
++{
++ // select current preset if available
++ if( rsPresetId.getLength() != 0 )
++ {
++ for( sal_uInt16 i = ENTRANCE; i <= MISCEFFECTS; i++ )
++ {
++ if( mpTabPages[i]->select( rsPresetId ) )
++ {
++ mpTabControl->SetCurPageId( RID_TP_CUSTOMANIMATION_ENTRANCE + i );
++ break;
++ }
++ }
++ }
++}
++
++//-------------------------------------------------------------------------------
++
++void StyleSheetEffectCreateDialog::setDuration(float fDuration)
++{
++ getCurrentPage()->setDuration(fDuration);
++}
++
++//-------------------------------------------------------------------------------
++
++StyleSheetEffectTabPage* StyleSheetEffectCreateDialog::getCurrentPage() const
++{
++ switch( mpTabControl->GetCurPageId() )
++ {
++ case RID_TP_CUSTOMANIMATION_ENTRANCE_SS:
++ return mpTabPages[ENTRANCE];
++ case RID_TP_CUSTOMANIMATION_EMPHASIS_SS:
++ return mpTabPages[EMPHASIS];
++ case RID_TP_CUSTOMANIMATION_EXIT_SS:
++ return mpTabPages[EXIT];
++ // case RID_TP_CUSTOMANIMATION_MISCEFFECTS_SS:
++ default:
++ return mpTabPages[MISCEFFECTS];
++ }
++}
++
++//-------------------------------------------------------------------------------
++
++CustomAnimationPresetPtr StyleSheetEffectCreateDialog::getSelectedPreset() const
++{
++ return getCurrentPage()->getSelectedPreset();
++}
++
++//-------------------------------------------------------------------------------
++
++double StyleSheetEffectCreateDialog::getSelectedDuration() const
++{
++ return getCurrentPage()->getDuration();
++}
++
++//-------------------------------------------------------------------------------
++
++IMPL_LINK( StyleSheetEffectCreateDialog, implActivatePagekHdl, Control*, EMPTYARG )
++{
++ getCurrentPage()->setDuration( mfDuration );
++ return 1;
++}
++
++//-------------------------------------------------------------------------------
++
++IMPL_LINK( StyleSheetEffectCreateDialog, implDeactivatePagekHdl, Control*, EMPTYARG )
++{
++ mfDuration = getCurrentPage()->getDuration();
++ return 1;
++}
++
++} // namespace sd
+diff --git sd/source/ui/animations/StyleSheetEffectCreateDialog.hrc sd/source/ui/animations/StyleSheetEffectCreateDialog.hrc
+new file mode 100644
+index 0000000..b90823a
+--- /dev/null
++++ sd/source/ui/animations/StyleSheetEffectCreateDialog.hrc
+@@ -0,0 +1,42 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef _SD_STYLESHEET_EFFECT_CREATE_DIALOG_HRC
++#define _SD_STYLESHEET_EFFECT_CREATE_DIALOG_HRC
++
++#include "CustomAnimation.hrc"
++#define RID_TP_CUSTOMANIMATION_ENTRANCE_SS RID_CUSTOMANIMATION_START+21
++#define RID_TP_CUSTOMANIMATION_EMPHASIS_SS RID_CUSTOMANIMATION_START+22
++#define RID_TP_CUSTOMANIMATION_EXIT_SS RID_CUSTOMANIMATION_START+23
++#define RID_TP_CUSTOMANIMATION_MISCEFFECTS_SS RID_CUSTOMANIMATION_START+24
++
++#define LB_EFFECTS_SS 1
++#define FT_SPEED_SS 2
++#define CB_SPEED_SS 3
++
++
++#endif // _SD_STYLESHEET_EFFECT_CREATE_DIALOG_HRC
+diff --git sd/source/ui/animations/StyleSheetEffectCreateDialog.hxx sd/source/ui/animations/StyleSheetEffectCreateDialog.hxx
+new file mode 100644
+index 0000000..ba11a5f
+--- /dev/null
++++ sd/source/ui/animations/StyleSheetEffectCreateDialog.hxx
+@@ -0,0 +1,74 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef _SD_STYLESHEETEFFECTPANE_HXX
++#define _SD_STYLESHEETEFFECTPANE_HXX
++
++#include "CustomAnimationPreset.hxx"
++#include <vcl/tabdlg.hxx>
++
++
++class TabControl;
++
++namespace sd {
++
++// --------------------------------------------------------------------
++
++class StyleSheetEffectTabPage;
++class STLPropertySet;
++
++class StyleSheetEffectCreateDialog : public TabDialog
++{
++ friend class StyleSheetEffectTabPage;
++public:
++ StyleSheetEffectCreateDialog( ::Window* pParent, bool bHasText, const ::rtl::OUString& rsPresetId, double fDuration );
++ ~StyleSheetEffectCreateDialog();
++
++ CustomAnimationPresetPtr getSelectedPreset() const;
++ double getSelectedDuration() const;
++ STLPropertySet* getResultSet() const;
++ void setPreset(const rtl::OUString& rsPresetId) ;
++ void setDuration(float fDuration) ;
++private:
++ StyleSheetEffectTabPage* getCurrentPage() const;
++
++ DECL_LINK( implActivatePagekHdl, Control* );
++ DECL_LINK( implDeactivatePagekHdl, Control* );
++
++private:
++ double mfDuration;
++
++ TabControl* mpTabControl;
++ OKButton* mpOKButton;
++ CancelButton* mpCancelButton;
++
++ StyleSheetEffectTabPage* mpTabPages[4];
++};
++
++}
++
++#endif // _SD_CUSTOMANIMATIONCREATEDIALOG_HXX
+diff --git sd/source/ui/animations/StyleSheetEffectCreateDialog.src sd/source/ui/animations/StyleSheetEffectCreateDialog.src
+new file mode 100644
+index 0000000..ee2648c
+--- /dev/null
++++ sd/source/ui/animations/StyleSheetEffectCreateDialog.src
+@@ -0,0 +1,117 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include "StyleSheetEffectCreateDialog.hrc"
++#include "CustomAnimation.hrc"
++TabDialog DLG_STYLESHEETEFFECT_CREATE
++{
++ Size = MAP_APPFONT ( 162 , 244 ) ;
++ OutputSize = TRUE ;
++ SVLook = TRUE ;
++ Moveable = TRUE ;
++ Closeable = TRUE ;
++
++ Text [ en-US ] = "Custom Stylesheet Animation" ;
++
++ TabControl 1
++ {
++ OutputSize = TRUE ;
++ Pos = MAP_APPFONT ( 3 , 3 ) ;
++ Size = MAP_APPFONT ( 156, 217 ) ;
++ PageList =
++ {
++ PageItem
++ {
++ Identifier = RID_TP_CUSTOMANIMATION_ENTRANCE_SS ;
++ Text [ en-US ] = "Entrance" ;
++ };
++
++ PageItem
++ {
++ Identifier = RID_TP_CUSTOMANIMATION_EMPHASIS_SS;
++ Text [ en-US ] = "Emphasis";
++ };
++
++ PageItem
++ {
++ Identifier = RID_TP_CUSTOMANIMATION_EXIT_SS;
++ Text [ en-US ] = "Exit";
++ };
++
++ PageItem
++ {
++ Identifier = RID_TP_CUSTOMANIMATION_MISCEFFECTS_SS;
++ Text [ en-US ] = "Misc Effects";
++ };
++ };
++ };
++ OKButton 1
++ {
++ Pos = MAP_APPFONT ( 3 , 223 ) ;
++ Size = MAP_APPFONT ( 50 , 14 ) ;
++ TabStop = TRUE ;
++ };
++ CancelButton 1
++ {
++ Pos = MAP_APPFONT ( 56 , 223 ) ;
++ Size = MAP_APPFONT ( 50 , 14 ) ;
++ TabStop = TRUE ;
++ };
++};
++
++TabPage RID_TP_CUSTOMANIMATION_ENTRANCE_SS
++{
++ Hide = TRUE;
++ Size = MAP_APPFONT ( 156, 217 );
++
++ ListBox LB_EFFECTS_SS
++ {
++ Pos = MAP_APPFONT ( 3 , 3 ) ;
++ Size = MAP_APPFONT( 144, 160 );
++ OutputSize = TRUE;
++ TabStop = TRUE ;
++ Border = TRUE ;
++ };
++
++ FixedText FT_SPEED_SS
++ {
++ OutputSize = TRUE;
++ Pos = MAP_APPFONT ( 3 , 167 ) ;
++ Size = MAP_APPFONT( 42, 8 );
++
++ Text [ en-US ] = "Speed";
++ };
++
++ ComboBox CB_SPEED_SS
++ {
++ Pos = MAP_APPFONT ( 48 , 166 ) ;
++ Size = MAP_APPFONT ( 101, 48 );
++ TabStop = TRUE ;
++ Border = TRUE ;
++ DropDown = TRUE ;
++ };
++};
+diff --git sd/source/ui/animations/animationtab.cxx sd/source/ui/animations/animationtab.cxx
+new file mode 100644
+index 0000000..71fbb57
+--- /dev/null
++++ sd/source/ui/animations/animationtab.cxx
+@@ -0,0 +1,231 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include <animationtab.hxx>
++#include <sdtools.hxx>
++#include <animationitem.hxx>
++
++#include <CustomAnimationPane.hxx>
++#include <CustomAnimationPreset.hxx>
++#include <StyleSheetEffectCreateDialog.hxx>
++
++#include <vcl/button.hxx>
++#include <vcl/fixed.hxx>
++
++#include <svx/dialmgr.hxx>
++#include <svx/svxids.hrc>
++#include <svx/dialogs.hrc>
++
++#include "app.hrc"
++#include "animationtab.hrc"
++
++#include "sdresid.hxx"
++#include "dlgsnap.hrc"
++
++using ::com::sun::star::uno::makeAny;
++
++namespace sd {
++
++USHORT AnimationTabPage::mnWhichPairTable[] = { SID_ANIMATION_ITEM, SID_ANIMATION_ITEM,
++ 0, 0 };
++
++//-------------------------------------------------------------------------------
++
++AnimationTabPage::AnimationTabPage(Window* pParent, const SfxItemSet& rCoreAttrs)
++ :SvxTabPage( pParent, SdResId( RID_SDPAGE_CUSTOMANIMATION ), rCoreAttrs )
++{
++ // make UI components
++ mpEffectName = new FixedText(this, SdResId(FT_STYLESHEET_EFFECT));
++ maDefaultEffectName = mpEffectName->GetText();
++
++ mpAddEffectButton = new PushButton(this, SdResId(PB_ADD_EFFECT_TO_STYLESHEET));
++ mpAddEffectButton->SetClickHdl( LINK( this, AnimationTabPage, implAddEffect ) );
++
++ mpRemoveEffectButton = new PushButton(this, SdResId(PB_REMOVE_EFFECT_FROM_STYLESHEET));
++ mpRemoveEffectButton->SetClickHdl( LINK( this, AnimationTabPage, implRemoveEffect ) );
++
++ FreeResource();
++}
++
++//-------------------------------------------------------------------------------
++
++AnimationTabPage::~AnimationTabPage()
++{
++ delete mpEffectName;
++ delete mpAddEffectButton;
++ delete mpRemoveEffectButton;
++ delete mpSet;
++}
++
++//-------------------------------------------------------------------------------
++
++SfxTabPage* AnimationTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
++{
++ return new AnimationTabPage(pParent, rAttrSet);
++}
++
++//-------------------------------------------------------------------------------
++
++BOOL AnimationTabPage::FillItemSet( SfxItemSet& rItemSet )
++{
++ if (mpSet)
++ {
++ rItemSet.Put(SfxAnimationItem(SID_ANIMATION_ITEM, new STLPropertySet(*mpSet)));
++ return TRUE;
++ }
++ else
++ {
++ if (mbHadAnimation)
++ // @@@@@@ TODO @@@@@@
++ // Implement removing the old effect from the main sequence
++ // That can be done in the following way:
++ // * Extend the animationItem to have a previous effect,
++ // and maybe a bool var to flag the removal
++ // * Fill the AnimationItem with the details of the previous preset
++ // * When the stylesheet is applied, in sd::tools::applyAnimationFromStyleSheet,
++ // detect that and remove the effect
++ {
++ ;
++ }
++ return FALSE;
++ }
++}
++
++//-------------------------------------------------------------------------------
++
++void AnimationTabPage::Reset( const SfxItemSet& rSet )
++{
++ // Prepopulate with the effect from the Stylesheet, if applicable
++ rtl::OUString aPresetId = rtl::OUString::createFromAscii("");
++ float fDuration = 2.0f;
++ if (sd::tools::getPresetData(rSet, aPresetId, fDuration))
++ {
++ mbHadAnimation = TRUE;
++ updateEffectName(aPresetId);
++ mpSet = STLPropertySet::createDefaultSet();
++ mpSet->setPropertyValue(nHandlePresetId, makeAny(aPresetId));
++ mpSet->setPropertyValue(nHandleDuration, makeAny(fDuration));
++ }
++ else
++ {
++ mbHadAnimation = FALSE;
++ mpSet = NULL;
++ }
++ mpAddEffectButton->Enable(TRUE);
++ mpRemoveEffectButton->Enable(mpSet != NULL);
++}
++
++//-------------------------------------------------------------------------------
++
++int AnimationTabPage::DeactivatePage( SfxItemSet* _pSet )
++{
++ if (_pSet)
++ FillItemSet(*_pSet);
++ return(LEAVE_PAGE);
++}
++
++//-------------------------------------------------------------------------------
++
++void AnimationTabPage::PointChanged(Window* , RECT_POINT )
++{
++}
++
++//-------------------------------------------------------------------------------
++
++void AnimationTabPage::addEffect()
++{
++ rtl::OUString aPresetId = rtl::OUString::createFromAscii("");
++ float fDuration = 2.0f;
++ if (mpSet) {
++
++ if( mpSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
++ {
++ mpSet->getPropertyValue( nHandleDuration ) >>= fDuration;
++ }
++ else fDuration = 2.0f;
++
++
++ if (mpSet->getPropertyState( nHandlePresetId ) == STLPropertyState_DIRECT )
++ {
++ mpSet->getPropertyValue(nHandlePresetId) >>= aPresetId;
++ }
++ }
++ rtl::OUString aNewPresetId;
++ mpDialog = new StyleSheetEffectCreateDialog(this, true, aPresetId, fDuration);
++ if( mpDialog->Execute() )
++ {
++ fDuration = mpDialog->getSelectedDuration();
++ aNewPresetId = mpDialog->getSelectedPreset()->getPresetId();
++ if (mpSet == NULL)
++ {
++ mpSet = STLPropertySet::createDefaultSet();
++ }
++ mpSet->setPropertyValue(nHandlePresetId, makeAny(aNewPresetId));
++ mpSet->setPropertyValue(nHandleDuration, makeAny(fDuration));
++ updateEffectName(aNewPresetId);
++ }
++ delete mpDialog;
++ mpRemoveEffectButton->Enable(mpSet != NULL);
++}
++
++//-------------------------------------------------------------------------------
++
++void AnimationTabPage::updateEffectName(rtl::OUString aPresetId)
++{
++ rtl::OUString aPresetName( CustomAnimationPresets::getCustomAnimationPresets().getUINameForPresetId( aPresetId));
++ rtl::OUString aFinalName(maDefaultEffectName);
++ if( aPresetName.getLength() )
++ {
++ aFinalName += rtl::OUString( (sal_Unicode)' ' );
++ aFinalName += aPresetName;
++ }
++ mpEffectName->SetText( aFinalName );
++}
++
++//-------------------------------------------------------------------------------
++
++IMPL_LINK( AnimationTabPage, implAddEffect, PushButton*, EMPTYARG )
++{
++ addEffect();
++ return 0;
++}
++
++//-------------------------------------------------------------------------------
++
++IMPL_LINK( AnimationTabPage, implRemoveEffect, PushButton*, EMPTYARG )
++{
++ if (mbHadAnimation)
++ {
++ delete mpSet;
++ mpSet = NULL;
++ }
++ updateEffectName(rtl::OUString());
++ mpRemoveEffectButton->Enable(FALSE);
++ return 0;
++}
++
++} //namespace sd
+diff --git sd/source/ui/animations/animationtab.hrc sd/source/ui/animations/animationtab.hrc
+new file mode 100644
+index 0000000..25da5f8
+--- /dev/null
++++ sd/source/ui/animations/animationtab.hrc
+@@ -0,0 +1,38 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef _SD_ANIMATIONTAB_HRC_
++#define _SD_ANIMATIONTAB_HRC_
++
++#include <dialogs.hrc>
++
++#define FL_SS_EFFECT 1
++#define FT_STYLESHEET_EFFECT 2
++#define PB_ADD_EFFECT_TO_STYLESHEET 3
++#define PB_REMOVE_EFFECT_FROM_STYLESHEET 4
++
++#endif
+\ No newline at end of file
+diff --git sd/source/ui/animations/animationtab.src sd/source/ui/animations/animationtab.src
+new file mode 100644
+index 0000000..8722bb5
+--- /dev/null
++++ sd/source/ui/animations/animationtab.src
+@@ -0,0 +1,63 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include <dialogs.hrc>
++#include "animationtab.hrc"
++
++TabPage RID_SDPAGE_CUSTOMANIMATION
++{
++ Size = MAP_APPFONT ( 260 , 185 );
++ Hide = TRUE ;
++ Text [ en-US ] = "Custom Animation" ;
++
++ FixedText FT_STYLESHEET_EFFECT
++ {
++ OutputSize = TRUE;
++ Size = MAP_APPFONT( 260, 14 );
++ Pos = MAP_APPFONT (5, 10);
++ Text [ en-US ] = "Effect";
++ };
++
++ PushButton PB_ADD_EFFECT_TO_STYLESHEET
++ {
++ OutputSize = TRUE;
++ TabStop = TRUE;
++ Size = MAP_APPFONT( 50, 14 );
++ Pos = MAP_APPFONT (10, 20);
++ Text [ en-US ] = "Set effect";
++ };
++
++ PushButton PB_REMOVE_EFFECT_FROM_STYLESHEET
++ {
++ OutputSize = TRUE;
++ TabStop = TRUE;
++ Size = MAP_APPFONT( 50, 14 );
++ Pos = MAP_APPFONT (70, 20);
++ Text [ en-US ] = "Remove effect";
++ };
++
++};
+\ No newline at end of file
+diff --git sd/source/ui/animations/makefile.mk sd/source/ui/animations/makefile.mk
+index 149f0c4..377bc76 100644
+--- sd/source/ui/animations/makefile.mk
++++ sd/source/ui/animations/makefile.mk
+@@ -1,3 +1,4 @@
++
+ #*************************************************************************
+ #
+ # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+@@ -48,18 +49,21 @@ SRC1FILES =\
+ CustomAnimationCreateDialog.src\
+ SlideTransitionPane.src\
+ CustomAnimationSchemesPane.src\
++ StyleSheetEffectCreateDialog.src\
++ animationtab.src\
+ CustomAnimation.src
+
+ SLOFILES = \
+ $(SLO)$/AnimationSchemesPane.obj \
+ $(SLO)$/CustomAnimationCreateDialog.obj\
++ $(SLO)$/StyleSheetEffectCreateDialog.obj\
+ $(SLO)$/CustomAnimationDialog.obj\
+ $(SLO)$/CustomAnimationPane.obj \
+ $(SLO)$/CustomAnimationList.obj \
+ $(SLO)$/DialogListBox.obj \
+ $(SLO)$/SlideTransitionPane.obj \
+- $(SLO)$/STLPropertySet.obj \
+- $(SLO)$/motionpathtag.obj
++ $(SLO)$/motionpathtag.obj \
++ $(SLO)$/animationtab.obj
+
+ # --- Tagets -------------------------------------------------------
+
+diff --git sd/source/ui/dlg/prltempl.cxx sd/source/ui/dlg/prltempl.cxx
+index 65d2900..41ab7e4 100644
+--- sd/source/ui/dlg/prltempl.cxx
++++ sd/source/ui/dlg/prltempl.cxx
+@@ -50,6 +50,7 @@
+
+ #include "DrawDocShell.hxx"
+ #include "glob.hrc"
++#include "dialogs.hrc"
+ #include "sdresid.hxx"
+ #include "prltempl.hxx"
+ #include "prltempl.hrc"
+@@ -62,6 +63,9 @@
+ #include "drawdoc.hxx"
+ #define IS_OUTLINE(x) (x >= PO_OUTLINE_1 && x <= PO_OUTLINE_9)
+
++// For the animations tab
++#include <animationtab.hxx>
++
+ /*************************************************************************
+ |*
+ |* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu
+@@ -173,6 +177,11 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
+ AddTabPage( RID_SVXPAGE_PICK_BMP );
+ AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
+ AddTabPage( RID_SVXPAGE_TABULATOR );
++
++ AddTabPage( RID_SDPAGE_CUSTOMANIMATION,
++ sd::AnimationTabPage::Create,
++ sd::AnimationTabPage::GetRanges);
++
+ }
+ break;
+
+diff --git sd/source/ui/dlg/prltempl.src sd/source/ui/dlg/prltempl.src
+index b6ca7df..bbf0efe 100644
+--- sd/source/ui/dlg/prltempl.src
++++ sd/source/ui/dlg/prltempl.src
+@@ -27,6 +27,7 @@
+
+ #include "enumdlg.hrc"
+ #include "prltempl.hrc"
++#include "dialogs.hrc"
+ #include <svx/dialogs.hrc>
+ TabDialog TAB_PRES_LAYOUT_TEMPLATE
+ {
+@@ -131,6 +132,13 @@ TabDialog TAB_PRES_LAYOUT_TEMPLATE
+ PageResID = RID_SVXPAGE_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ };
++ PageItem
++ {
++ Identifier = RID_SDPAGE_CUSTOMANIMATION ;
++ Text [ en-US ] = "Custom Animation" ;
++ PageResID = RID_SDPAGE_CUSTOMANIMATION ;
++ };
++
+ };
+ };
+ };
+diff --git sd/source/ui/func/futempl.cxx sd/source/ui/func/futempl.cxx
+index c9235e5..0ac6503 100644
+--- sd/source/ui/func/futempl.cxx
++++ sd/source/ui/func/futempl.cxx
+@@ -37,7 +37,7 @@
+
+ #include <svx/editdata.hxx>
+ #include <svx/bulitem.hxx>
+-#include <svx/svxids.hrc> // fuer SID_OBJECT_SELECT
++#include <svx/svxids.hrc> // for SID_OBJECT_SELECT
+ #include <sfx2/bindings.hxx>
+ #include <svtools/aeitem.hxx>
+ #include <sfx2/dispatch.hxx>
+@@ -48,6 +48,7 @@
+ #include <svx/editeng.hxx>
+ #include <svx/lrspitem.hxx>
+ #include <svx/svdopage.hxx>
++#include <svx/svdmodel.hxx>
+ #include <svx/svditer.hxx>
+
+ #include <sfx2/viewfrm.hxx>
+@@ -78,6 +79,7 @@
+ #include "strings.hrc"
+ #include "helpids.h"
+ #include "sdabstdlg.hxx"
++#include "sdtools.hxx"
+
+ using rtl::OUString;
+ using namespace com::sun::star::uno;
+@@ -260,6 +262,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
+ (pOldStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE && mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
+ {
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
++ sd::tools::assignAnimationToObjects(mpView, (SfxStyleSheet*) pStyleSheet);
+ mpDoc->SetChanged(TRUE);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+diff --git sd/source/ui/inc/EventMultiplexer.hxx sd/source/ui/inc/EventMultiplexer.hxx
+index 398b885..c02d0ae 100644
+--- sd/source/ui/inc/EventMultiplexer.hxx
++++ sd/source/ui/inc/EventMultiplexer.hxx
+@@ -136,6 +136,9 @@ public:
+ */
+ static const EventId EID_EDIT_MODE_MASTER = 0x00080000;
+
++ /** An animation has been added/changed/removed in a stylesheet
++ */
++ static const EventId EID_STYLESHEET_ANIMATION = 0x00100000;
+ const ViewShellBase& mrBase;
+ EventId meEventId;
+ const void* mpUserData;
+diff --git sd/source/ui/inc/animationtab.hxx sd/source/ui/inc/animationtab.hxx
+new file mode 100644
+index 0000000..b7db752
+--- /dev/null
++++ sd/source/ui/inc/animationtab.hxx
+@@ -0,0 +1,79 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef _SVX_ANIMATIONTAB_HXX
++#define _SVX_ANIMATIONTAB_HXX
++
++// includes
++#include <svx/dlgctrl.hxx>
++#include <svtools/valueset.hxx>
++#include <sddllapi.h>
++
++// ============================================================================
++
++class PushButton;
++class FixedText;
++namespace sd {
++ class StyleSheetEffectCreateDialog;
++ class STLPropertySet;
++class SD_DLLPUBLIC AnimationTabPage : public SvxTabPage
++{
++ using TabPage::DeactivatePage;
++
++public:
++ static SD_DLLPUBLIC SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
++ virtual ~AnimationTabPage();
++
++ static USHORT* GetRanges() { return AnimationTabPage::mnWhichPairTable; }
++ virtual BOOL FillItemSet( SfxItemSet& rSet );
++ virtual void Reset( const SfxItemSet& rSet );
++ virtual int DeactivatePage( SfxItemSet* pSet );
++ virtual void PointChanged(Window*, RECT_POINT);
++
++private:
++ AnimationTabPage(Window* pParent, const SfxItemSet& rCoreAttrs);
++ static USHORT mnWhichPairTable[];
++
++ StyleSheetEffectCreateDialog* mpDialog;
++
++ String maDefaultEffectName;
++ FixedText* mpEffectName;
++ PushButton* mpAddEffectButton;
++ PushButton* mpRemoveEffectButton;
++
++ bool mbHadAnimation;
++ STLPropertySet* mpSet;
++ void addEffect();
++ void updateEffectName(rtl::OUString aPresetId);
++
++ DECL_LINK( implAddEffect, PushButton* );
++ DECL_LINK( implRemoveEffect, PushButton* );
++
++};
++
++} // namespace sd
++
++#endif
+diff --git sd/source/ui/inc/dialogs.hrc sd/source/ui/inc/dialogs.hrc
+index 61bb62b..a9dba26 100644
+--- sd/source/ui/inc/dialogs.hrc
++++ sd/source/ui/inc/dialogs.hrc
+@@ -33,4 +33,5 @@
+ #define RID_SD_TABPAGE_HEADERFOOTER (1000)
+ #define RID_SD_TABPAGE_HEADERFOOTER_SLIDE (1001)
+ #define RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT (1002)
++#define RID_SDPAGE_CUSTOMANIMATION (1003)
+
+diff --git sd/source/ui/tools/EventMultiplexer.cxx sd/source/ui/tools/EventMultiplexer.cxx
+index 01e4073..8837c98 100644
+--- sd/source/ui/tools/EventMultiplexer.cxx
++++ sd/source/ui/tools/EventMultiplexer.cxx
+@@ -44,6 +44,7 @@
+ #include <cppuhelper/weak.hxx>
+ #include <cppuhelper/compbase4.hxx>
+ #include <sfx2/viewfrm.hxx>
++#include <sdtools.hxx>
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::lang;
+@@ -748,6 +749,10 @@ void EventMultiplexer::Implementation::Notify (
+ const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ break;
+
++ case HINT_STYLESHEETANIMATION:
++ sd::tools::applyAnimationFromStyleSheet(const_cast<SdrObject*>(rSdrHint.GetObject()),
++ const_cast<SfxStyleSheet*>(rSdrHint.GetObject()->GetStyleSheet()));
++ break;
+ case HINT_OBJINSERTED:
+ CallListeners(EventMultiplexerEvent::EID_SHAPE_INSERTED,
+ const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+diff --git sd/test/animationitemtest.cxx sd/test/animationitemtest.cxx
+new file mode 100644
+index 0000000..4f4cee0
+--- /dev/null
++++ sd/test/animationitemtest.cxx
+@@ -0,0 +1,119 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: animationitemtest.cxx,v $
++ * $Revision: 1.14 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org 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 version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sd.hxx"
++// autogenerated file with codegen.pl
++
++#include <cppunit/simpleheader.hxx>
++#include <com/sun/star/text/WritingMode.hpp>
++#include "animationitem.hxx"
++#include "app.hrc"
++#include "STLPropertySet.hxx"
++
++class AnimationItemTest : public CppUnit::TestFixture
++{
++public:
++ AnimationItemTest() {}
++
++ // initialise your test code values here.
++ void setUp()
++ {
++ }
++
++ void tearDown()
++ {
++ }
++
++ // insert your test code here.
++
++ void cloneTest() {
++ const int nWhich = 13;
++ sd::SfxAnimationItem item(nWhich, NULL);
++
++ SfxPoolItem* clone = item.Clone();
++ CPPUNIT_ASSERT_MESSAGE("Testing clone", clone != NULL);
++ sd::SfxAnimationItem* itemClone = dynamic_cast<sd::SfxAnimationItem*>(clone);
++ CPPUNIT_ASSERT_MESSAGE("Testing downcasting of the clone", itemClone != NULL);
++ CPPUNIT_ASSERT_MESSAGE("Check that they're equal", *itemClone == item);
++ }
++
++ void equalTest() {
++ const int nWhich = SID_ANIMATION_ITEM;
++ sd::SfxAnimationItem item1(nWhich, NULL);
++ sd::SfxAnimationItem item2(nWhich, NULL);
++ CPPUNIT_ASSERT_MESSAGE("Testing equals of default items", item1 == item2);
++
++ sd::SfxAnimationItem item3(nWhich, sd::STLPropertySet::createDefaultSet());
++ sd::SfxAnimationItem item4(nWhich, sd::STLPropertySet::createDefaultSet());
++ CPPUNIT_ASSERT_MESSAGE("Testing equals of not so default items", item3 == item4);
++
++
++ }
++
++ void constructorTest() {
++ sd::SfxAnimationItem item1;
++ CPPUNIT_ASSERT_MESSAGE("Count should be one", sd::SfxAnimationItem::count == 1);
++ sd::SfxAnimationItem item2(21, NULL);
++ CPPUNIT_ASSERT_MESSAGE("Count should be two", sd::SfxAnimationItem::count == 2);
++ {
++ sd::SfxAnimationItem item3(item2);
++ CPPUNIT_ASSERT_MESSAGE("Count should be three", sd::SfxAnimationItem::count = 3);
++ }
++ CPPUNIT_ASSERT_MESSAGE("Count should be two again", sd::SfxAnimationItem::count == 2);
++
++ }
++
++ // Change the following lines only, if you add, remove or rename
++ // member functions of the current class,
++ // because these macros are need by auto register mechanism.
++
++
++
++ CPPUNIT_TEST_SUITE(AnimationItemTest);
++
++ CPPUNIT_TEST(constructorTest);
++ CPPUNIT_TEST(cloneTest);
++ CPPUNIT_TEST(equalTest);
++
++ CPPUNIT_TEST_SUITE_END();
++};
++
++// -----------------------------------------------------------------------------
++
++CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(AnimationItemTest, "AnimationItem test");
++
++// -----------------------------------------------------------------------------
++
++// this macro creates an empty function, which will called by the RegisterAllFunctions()
++// to let the user the possibility to also register some functions by hand.
++NOADDITIONAL;
++
+diff --git sd/test/export.map sd/test/export.map
+new file mode 100644
+index 0000000..6e36ffc
+--- /dev/null
++++ sd/test/export.map
+@@ -0,0 +1,38 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++#
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: export.map,v $
++#
++# $Revision: 1.4 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org. If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++UDK_3.1 {
++ global:
++ registerAllTestFunction;
++
++ local:
++ *;
++};
+diff --git sd/test/makefile.mk sd/test/makefile.mk
+new file mode 100644
+index 0000000..5692d86
+--- /dev/null
++++ sd/test/makefile.mk
+@@ -0,0 +1,84 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++#
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.7 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org 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 version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org. If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..
++
++PRJNAME=sd
++TARGET=tests
++PRJINC=$(PRJ)$/source/ui
++ENABLE_EXCEPTIONS=TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE : settings.mk
++
++# --- Common ----------------------------------------------------------
++
++SHL1OBJS= \
++ $(SLO)$/animationitemtest.obj \
++ $(SLO)$/animationitem.obj \
++ $(SLO)$/STLPropertySet.obj
++
++
++SHL1TARGET= sd_tests
++SHL1STDLIBS= \
++ $(CPPUNITLIB) \
++ $(SALLIB) \
++ $(TOOLSLIB) \
++ $(SVLLIB) \
++ $(CPPULIB)
++
++SHL1IMPLIB= i$(SHL1TARGET)
++
++DEF1NAME =$(SHL1TARGET)
++SHL1VERSIONMAP = export.map
++
++# END ------------------------------------------------------------------
++
++#------------------------------- All object files -------------------------------
++# do this here, so we get correct dependencies
++SLOFILES=$(SHL1OBJS)
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE : target.mk
++.INCLUDE : _cppunit.mk
++
++# --- Enable testshl2 execution in normal build ------------------------
++
++$(MISC)$/unittest_succeeded : $(SHL1TARGETN)
++ @echo ----------------------------------------------------------
++ @echo - start unit test on library $(SHL1TARGETN)
++ @echo ----------------------------------------------------------
++ $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/testshl2 -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN)
++ $(TOUCH) $@
++
++ALLTAR : $(MISC)$/unittest_succeeded
+diff --git svx/inc/svx/svdmodel.hxx svx/inc/svx/svdmodel.hxx
+index 43e3bb6..a2c79cc 100644
+--- svx/inc/svx/svdmodel.hxx
++++ svx/inc/svx/svdmodel.hxx
+@@ -120,7 +120,7 @@ namespace sdr { namespace media {
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+
+-enum SdrHintKind
++enum SVX_DLLPUBLIC SdrHintKind
+ {
+ HINT_UNKNOWN, // Unbekannt
+ HINT_LAYERCHG, // Layerdefinition geaendert
+@@ -136,7 +136,8 @@ enum SdrHintKind
+ HINT_MODELSAVED, // Dokument wurde gesichert
+ HINT_SWITCHTOPAGE, // #94278# UNDO/REDO at an object evtl. on another page
+ HINT_BEGEDIT, // Is called after the object has entered text edit mode
+- HINT_ENDEDIT // Is called after the object has left text edit mode
++ HINT_ENDEDIT, // Is called after the object has left text edit mode
++ HINT_STYLESHEETANIMATION // Called when a stylesheet has an animation
+ };
+
+ class SVX_DLLPUBLIC SdrHint: public SfxHint
+diff --git svx/source/sdr/properties/attributeproperties.cxx svx/source/sdr/properties/attributeproperties.cxx
+index 1b514e8..d28f76e 100644
+--- svx/source/sdr/properties/attributeproperties.cxx
++++ svx/source/sdr/properties/attributeproperties.cxx
+@@ -624,12 +624,19 @@ namespace sdr
+ const SfxSimpleHint *pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint);
+
+ if(pSimpleHint
+- && pSimpleHint->GetId() == SFX_HINT_DATACHANGED
+- && GetSdrObject().IsMasterPageBackgroundObject())
+- {
+- GetSdrObject().GetPage()->ActionChanged();
++ && pSimpleHint->GetId() == SFX_HINT_DATACHANGED) {
++ // notify stylesheet change
++ SdrObject* pObj = &GetSdrObject();
++ SdrHint aHint(HINT_STYLESHEETANIMATION);
++ aHint.SetObject(pObj);
++ SdrModel* pModel = pObj->GetModel();
++ if (pModel)
++ pModel->Broadcast(aHint);
++ if (GetSdrObject().IsMasterPageBackgroundObject())
++ {
++ GetSdrObject().GetPage()->ActionChanged();
++ }
+ }
+-
+ if(!bHintUsed)
+ {
+ // forward to SdrObject ATM. Not sure if this will be necessary