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 #ifndef _SD_CUSTOMANIMATIONLIST_HXX 23 #define _SD_CUSTOMANIMATIONLIST_HXX 24 25 #include <com/sun/star/drawing/XShape.hpp> 26 #include <svtools/svtreebx.hxx> 27 #include <CustomAnimationEffect.hxx> 28 #include "CustomAnimationPreset.hxx" 29 #ifndef _SD_CUSTOMANIMATION_HRC 30 #include "CustomAnimation.hrc" 31 #endif 32 33 namespace sd { 34 35 class CustomAnimationEffect; 36 typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr; 37 38 class ICustomAnimationListController 39 { 40 public: 41 virtual void onSelect() = 0; 42 virtual void onDoubleClick() = 0; 43 virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0; 44 virtual ~ICustomAnimationListController() {} 45 }; 46 47 class CustomAnimationList : public SvTreeListBox, public ISequenceListener 48 { 49 friend class CustomAnimationListEntryItem; 50 friend struct stl_append_effect_func; 51 52 public: 53 CustomAnimationList( ::Window* pParent, const ResId& rResId, ICustomAnimationListController* pController ); 54 virtual ~CustomAnimationList(); 55 56 // methods 57 58 /** selects or deselects the given effect. 59 Selections of other effects are not changed */ 60 void select( CustomAnimationEffectPtr pEffect, bool bSelect = true ); 61 62 /** populates the list with all effects from the given MainSequence */ 63 void update( MainSequencePtr pMainSequence ); 64 65 /** updates the given effect in the list */ 66 // void update( CustomAnimationEffectPtr pEffect ); 67 68 void update(); 69 70 /** removes the given effect to the list*/ 71 // void remove( CustomAnimationEffectPtr pEffect ); 72 73 EffectSequence getSelection() const; 74 75 // events 76 void onSelectionChanged( ::com::sun::star::uno::Any aSelection ); 77 78 // overrides 79 virtual void SelectHdl(); 80 virtual sal_Bool DoubleClickHdl(); 81 82 virtual void Paint( const Rectangle& rRect ); 83 84 virtual PopupMenu* CreateContextMenu( void ); 85 virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ); 86 87 virtual void KeyInput( const KeyEvent& rKEvt ); 88 89 // virtual SvLBoxEntry* CreateEntry() const; 90 virtual void SetTabs(); 91 92 virtual void notify_change(); 93 94 const Image& getImage( sal_uInt16 nId, bool bHighContrast ); 95 96 bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const; 97 98 // clears all entries from the listbox 99 void clear(); 100 101 private: 102 bool mbIgnorePaint; 103 104 /** appends the given effect to the list*/ 105 void append( CustomAnimationEffectPtr pEffect ); 106 107 ICustomAnimationListController* mpController; 108 109 MainSequencePtr mpMainSequence; 110 111 Image maImgEmpty; 112 113 Image maImages[ IMG_CUSTOMANIMATION_MEDIA_STOP_H - IMG_CUSTOMANIMATION_ON_CLICK + 1]; 114 115 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxLastTargetShape; 116 sal_Int32 mnLastGroupId; 117 SvLBoxEntry* mpLastParentEntry; 118 119 }; 120 121 } 122 123 #endif // _SD_CUSTOMANIMATIONLIST_HXX 124 125 /* vim: set noet sw=4 ts=4: */ 126