1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SD_CUSTOMANIMATIONLIST_HXX
25cdf0e10cSrcweir #define _SD_CUSTOMANIMATIONLIST_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
28cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
29cdf0e10cSrcweir #include <CustomAnimationEffect.hxx>
30cdf0e10cSrcweir #include "CustomAnimationPreset.hxx"
31cdf0e10cSrcweir #ifndef _SD_CUSTOMANIMATION_HRC
32cdf0e10cSrcweir #include "CustomAnimation.hrc"
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace sd {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class CustomAnimationEffect;
38cdf0e10cSrcweir typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class ICustomAnimationListController
41cdf0e10cSrcweir {
42cdf0e10cSrcweir public:
43cdf0e10cSrcweir 	virtual void onSelect() = 0;
44cdf0e10cSrcweir 	virtual void onDoubleClick() = 0;
45cdf0e10cSrcweir 	virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0;
~ICustomAnimationListController()46cdf0e10cSrcweir 	virtual ~ICustomAnimationListController() {}
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class CustomAnimationList : public SvTreeListBox, public ISequenceListener
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	friend class CustomAnimationListEntryItem;
52cdf0e10cSrcweir 	friend struct stl_append_effect_func;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir 	CustomAnimationList( ::Window* pParent, const ResId& rResId, ICustomAnimationListController* pController );
56cdf0e10cSrcweir 	virtual ~CustomAnimationList();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	// methods
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	/** selects or deselects the given effect.
61cdf0e10cSrcweir 		Selections of other effects are not changed */
62cdf0e10cSrcweir 	void select( CustomAnimationEffectPtr pEffect, bool bSelect = true );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	/** populates the list with all effects from the given MainSequence */
65cdf0e10cSrcweir 	void update( MainSequencePtr pMainSequence );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	/** updates the given effect in the list */
68cdf0e10cSrcweir //	void update( CustomAnimationEffectPtr pEffect );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	void update();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	/** removes the given effect to the list*/
73cdf0e10cSrcweir //	void remove( CustomAnimationEffectPtr pEffect );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	EffectSequence getSelection() const;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	// events
78cdf0e10cSrcweir 	void onSelectionChanged( ::com::sun::star::uno::Any aSelection );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	// overrides
81cdf0e10cSrcweir 	virtual void 	SelectHdl();
82cdf0e10cSrcweir 	virtual sal_Bool 	DoubleClickHdl();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	virtual void    Paint( const Rectangle& rRect );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	virtual PopupMenu* CreateContextMenu( void );
87cdf0e10cSrcweir 	virtual void	ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	virtual void KeyInput( const KeyEvent& rKEvt );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir //	virtual SvLBoxEntry* CreateEntry() const;
92cdf0e10cSrcweir 	virtual void	SetTabs();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	virtual void notify_change();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	const Image& getImage( sal_uInt16 nId, bool bHighContrast );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	/// clears all entries from the listbox
101cdf0e10cSrcweir 	void clear();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir private:
104cdf0e10cSrcweir 	bool	mbIgnorePaint;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	/** appends the given effect to the list*/
107cdf0e10cSrcweir 	void append( CustomAnimationEffectPtr pEffect );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	ICustomAnimationListController* mpController;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	MainSequencePtr	mpMainSequence;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	Image maImgEmpty;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	Image maImages[ IMG_CUSTOMANIMATION_MEDIA_STOP_H - IMG_CUSTOMANIMATION_ON_CLICK + 1];
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxLastTargetShape;
118cdf0e10cSrcweir 	sal_Int32 mnLastGroupId;
119cdf0e10cSrcweir 	SvLBoxEntry* mpLastParentEntry;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir #endif // _SD_CUSTOMANIMATIONLIST_HXX
126cdf0e10cSrcweir 
127