Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX
21 : #define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX
22 :
23 : #include <com/sun/star/drawing/XShape.hpp>
24 : #include <svtools/treelistbox.hxx>
25 : #include <CustomAnimationEffect.hxx>
26 : #include "CustomAnimationPreset.hxx"
27 : #include "CustomAnimation.hrc"
28 :
29 : namespace sd {
30 :
31 : class CustomAnimationEffect;
32 : typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
33 :
34 0 : class ICustomAnimationListController
35 : {
36 : public:
37 : virtual void onSelect() = 0;
38 : virtual void onDoubleClick() = 0;
39 : virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0;
40 0 : virtual ~ICustomAnimationListController() {}
41 : };
42 :
43 : class CustomAnimationList : public SvTreeListBox, public ISequenceListener
44 : {
45 : friend class CustomAnimationListEntryItem;
46 : friend struct stl_append_effect_func;
47 :
48 : public:
49 : CustomAnimationList( ::Window* pParent );
50 : virtual ~CustomAnimationList();
51 :
52 : // methods
53 :
54 : /** selects or deselects the given effect.
55 : Selections of other effects are not changed */
56 : void select( CustomAnimationEffectPtr pEffect, bool bSelect = true );
57 :
58 : /** populates the list with all effects from the given MainSequence */
59 : void update( MainSequencePtr pMainSequence );
60 :
61 : void update();
62 :
63 : EffectSequence getSelection() const;
64 :
65 : // events
66 : void onSelectionChanged( ::com::sun::star::uno::Any aSelection );
67 :
68 : // overrides
69 : virtual void SelectHdl() SAL_OVERRIDE;
70 : virtual bool DoubleClickHdl() SAL_OVERRIDE;
71 :
72 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
73 :
74 : virtual PopupMenu* CreateContextMenu( void ) SAL_OVERRIDE;
75 : virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) SAL_OVERRIDE;
76 :
77 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
78 :
79 : virtual void SetTabs() SAL_OVERRIDE;
80 :
81 : virtual void notify_change() SAL_OVERRIDE;
82 :
83 : const Image& getImage( sal_uInt16 nId );
84 :
85 : bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const;
86 :
87 : /// clears all entries from the listbox
88 : void clear();
89 :
90 0 : void setController( ICustomAnimationListController* pController )
91 : {
92 0 : mpController = pController;
93 0 : };
94 :
95 : private:
96 : bool mbIgnorePaint;
97 :
98 : /** appends the given effect to the list*/
99 : void append( CustomAnimationEffectPtr pEffect );
100 :
101 : ICustomAnimationListController* mpController;
102 :
103 : MainSequencePtr mpMainSequence;
104 :
105 : Image maImgEmpty;
106 :
107 : Image maImages[ IMG_CUSTOMANIMATION_MEDIA_STOP - IMG_CUSTOMANIMATION_ON_CLICK + 1];
108 :
109 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxLastTargetShape;
110 : sal_Int32 mnLastGroupId;
111 : SvTreeListEntry* mpLastParentEntry;
112 :
113 : };
114 :
115 : }
116 :
117 : #endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|