1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SD_CUSTOMANIMATIONLIST_HXX
29*cdf0e10cSrcweir #define _SD_CUSTOMANIMATIONLIST_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
32*cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
33*cdf0e10cSrcweir #include <CustomAnimationEffect.hxx>
34*cdf0e10cSrcweir #include "CustomAnimationPreset.hxx"
35*cdf0e10cSrcweir #ifndef _SD_CUSTOMANIMATION_HRC
36*cdf0e10cSrcweir #include "CustomAnimation.hrc"
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir namespace sd {
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir class CustomAnimationEffect;
42*cdf0e10cSrcweir typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir class ICustomAnimationListController
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir public:
47*cdf0e10cSrcweir 	virtual void onSelect() = 0;
48*cdf0e10cSrcweir 	virtual void onDoubleClick() = 0;
49*cdf0e10cSrcweir 	virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0;
50*cdf0e10cSrcweir 	virtual ~ICustomAnimationListController() {}
51*cdf0e10cSrcweir };
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir class CustomAnimationList : public SvTreeListBox, public ISequenceListener
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 	friend class CustomAnimationListEntryItem;
56*cdf0e10cSrcweir 	friend struct stl_append_effect_func;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir public:
59*cdf0e10cSrcweir 	CustomAnimationList( ::Window* pParent, const ResId& rResId, ICustomAnimationListController* pController );
60*cdf0e10cSrcweir 	virtual ~CustomAnimationList();
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 	// methods
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 	/** selects or deselects the given effect.
65*cdf0e10cSrcweir 		Selections of other effects are not changed */
66*cdf0e10cSrcweir 	void select( CustomAnimationEffectPtr pEffect, bool bSelect = true );
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 	/** populates the list with all effects from the given MainSequence */
69*cdf0e10cSrcweir 	void update( MainSequencePtr pMainSequence );
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	/** updates the given effect in the list */
72*cdf0e10cSrcweir //	void update( CustomAnimationEffectPtr pEffect );
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 	void update();
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	/** removes the given effect to the list*/
77*cdf0e10cSrcweir //	void remove( CustomAnimationEffectPtr pEffect );
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	EffectSequence getSelection() const;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	// events
82*cdf0e10cSrcweir 	void onSelectionChanged( ::com::sun::star::uno::Any aSelection );
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	// overrides
85*cdf0e10cSrcweir 	virtual void 	SelectHdl();
86*cdf0e10cSrcweir 	virtual sal_Bool 	DoubleClickHdl();
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 	virtual void    Paint( const Rectangle& rRect );
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	virtual PopupMenu* CreateContextMenu( void );
91*cdf0e10cSrcweir 	virtual void	ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	virtual void KeyInput( const KeyEvent& rKEvt );
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir //	virtual SvLBoxEntry* CreateEntry() const;
96*cdf0e10cSrcweir 	virtual void	SetTabs();
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 	virtual void notify_change();
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	const Image& getImage( sal_uInt16 nId, bool bHighContrast );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 	/// clears all entries from the listbox
105*cdf0e10cSrcweir 	void clear();
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir private:
108*cdf0e10cSrcweir 	bool	mbIgnorePaint;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	/** appends the given effect to the list*/
111*cdf0e10cSrcweir 	void append( CustomAnimationEffectPtr pEffect );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 	ICustomAnimationListController* mpController;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	MainSequencePtr	mpMainSequence;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	Image maImgEmpty;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	Image maImages[ IMG_CUSTOMANIMATION_MEDIA_STOP_H - IMG_CUSTOMANIMATION_ON_CLICK + 1];
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxLastTargetShape;
122*cdf0e10cSrcweir 	sal_Int32 mnLastGroupId;
123*cdf0e10cSrcweir 	SvLBoxEntry* mpLastParentEntry;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir };
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir #endif // _SD_CUSTOMANIMATIONLIST_HXX
130*cdf0e10cSrcweir 
131