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 #ifndef SD_SLIDETRANSITIONPANE_HXX
24 #define SD_SLIDETRANSITIONPANE_HXX
25 
26 #include "EventMultiplexer.hxx"
27 
28 #include "SlideSorterViewShell.hxx"
29 
30 #include <vcl/ctrl.hxx>
31 #include <vcl/lstbox.hxx>
32 #include <vcl/fixed.hxx>
33 #include <vcl/button.hxx>
34 #include <vcl/field.hxx>
35 #include <com/sun/star/drawing/XDrawView.hpp>
36 #include <com/sun/star/frame/XModel.hpp>
37 
38 #include <vector>
39 #include <map>
40 
41 class SdDrawDocument;
42 class SdPage;
43 
44 namespace sd
45 {
46 
47 class ViewShellBase;
48 
49 namespace impl
50 {
51     struct TransitionEffect;
52 }
53 
54 class SlideTransitionPane : public Control
55 {
56 public:
57     explicit SlideTransitionPane(
58         ::Window * pParent,
59         ViewShellBase & rBase,
60         const Size& rMinSize,
61         SdDrawDocument* pDoc );
62 	virtual ~SlideTransitionPane();
63 
64     // Window
65     virtual void Resize();
66     virtual void DataChanged (const DataChangedEvent& rEvent);
67 
68 	void onSelectionChanged();
69 	void onChangeCurrentPage();
70 
71 private:
72     void updateLayout();
73 	void updateControls();
74     void updateControlState();
75 
76     void updateSoundList();
77     void openSoundFileDialog();
78 
79     impl::TransitionEffect getTransitionEffectFromControls() const;
80 
81     void applyToSelectedPages();
82     void playCurrentEffect();
83 
84 	void addListener();
85 	void removeListener();
86 
87     ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const;
88 
89     void UpdateLook (void);
90 
91     DECL_LINK( ApplyToAllButtonClicked, void * );
92     DECL_LINK( PlayButtonClicked, void * );
93     DECL_LINK( SlideShowButtonClicked, void * );
94 	DECL_LINK( AutoPreviewClicked, void * );
95 
96     DECL_LINK( TransitionSelected, void * );
97     DECL_LINK( AdvanceSlideRadioButtonToggled, void * );
98     DECL_LINK( AdvanceTimeModified, void * );
99     DECL_LINK( SpeedListBoxSelected, void * );
100     DECL_LINK( SoundListBoxSelected, void * );
101     DECL_LINK( LoopSoundBoxChecked, void * );
102     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
103     DECL_LINK(LateInitCallback, Timer*);
104 
105     ViewShellBase &   mrBase;
106     SdDrawDocument *  mpDrawDoc;
107     Size              maMinSize;
108 
109     FixedLine    maFL_APPLY_TRANSITION;
110     ListBox      maLB_SLIDE_TRANSITIONS;
111     FixedLine    maFL_MODIFY_TRANSITION;
112     FixedText    maFT_SPEED;
113     ListBox      maLB_SPEED;
114     FixedText    maFT_SOUND;
115     ListBox      maLB_SOUND;
116     CheckBox     maCB_LOOP_SOUND;
117     FixedLine    maFL_ADVANCE_SLIDE;
118     RadioButton  maRB_ADVANCE_ON_MOUSE;
119     RadioButton  maRB_ADVANCE_AUTO;
120     MetricField  maMF_ADVANCE_AUTO_AFTER;
121     FixedLine    maFL_EMPTY1;
122     PushButton   maPB_APPLY_TO_ALL;
123     PushButton   maPB_PLAY;
124     PushButton   maPB_SLIDE_SHOW;
125     FixedLine    maFL_EMPTY2;
126     CheckBox     maCB_AUTO_PREVIEW;
127 
128     String       maSTR_NO_TRANSITION;
129 
130 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView >             mxView;
131 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                  mxModel;
132 
133     bool         mbHasSelection;
134     bool         mbUpdatingControls;
135     bool         mbIsMainViewChangePending;
136 
137     typedef ::std::vector< String > tSoundListType;
138     tSoundListType  maSoundList;
139     mutable String  maCurrentSoundFile;
140 
141     typedef ::std::map< sal_uInt16, sal_uInt16 > tPresetIndexesType;
142     tPresetIndexesType m_aPresetIndexes;
143 
144     Timer maLateInitTimer;
145 };
146 
147 } //  namespace sd
148 
149 // SD_SLIDETRANSITIONPANE_HXX
150 #endif
151