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