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 _SD_CUSTOMANIMATIONLIST_HXX
21 : #define _SD_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, const ResId& rResId, ICustomAnimationListController* pController );
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();
70 : virtual sal_Bool DoubleClickHdl();
71 :
72 : virtual void Paint( const Rectangle& rRect );
73 :
74 : virtual PopupMenu* CreateContextMenu( void );
75 : virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
76 :
77 : virtual void KeyInput( const KeyEvent& rKEvt );
78 :
79 : virtual void SetTabs();
80 :
81 : virtual void notify_change();
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 : private:
91 : bool mbIgnorePaint;
92 :
93 : /** appends the given effect to the list*/
94 : void append( CustomAnimationEffectPtr pEffect );
95 :
96 : ICustomAnimationListController* mpController;
97 :
98 : MainSequencePtr mpMainSequence;
99 :
100 : Image maImgEmpty;
101 :
102 : Image maImages[ IMG_CUSTOMANIMATION_MEDIA_STOP - IMG_CUSTOMANIMATION_ON_CLICK + 1];
103 :
104 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxLastTargetShape;
105 : sal_Int32 mnLastGroupId;
106 : SvTreeListEntry* mpLastParentEntry;
107 :
108 : };
109 :
110 : }
111 :
112 : #endif // _SD_CUSTOMANIMATIONLIST_HXX
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|