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     virtual void Resize();
65 
66 	void onSelectionChanged();
67 	void onChangeCurrentPage();
68 
69 private:
70     void updateLayout();
71 	void updateControls();
72     void updateControlState();
73 
74     void updateSoundList();
75     void openSoundFileDialog();
76 
77     impl::TransitionEffect getTransitionEffectFromControls() const;
78 
79     void applyToSelectedPages();
80     void playCurrentEffect();
81 
82 	void addListener();
83 	void removeListener();
84 
85     ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const;
86 
87     DECL_LINK( ApplyToAllButtonClicked, void * );
88     DECL_LINK( PlayButtonClicked, void * );
89     DECL_LINK( SlideShowButtonClicked, void * );
90 	DECL_LINK( AutoPreviewClicked, void * );
91 
92     DECL_LINK( TransitionSelected, void * );
93     DECL_LINK( AdvanceSlideRadioButtonToggled, void * );
94     DECL_LINK( AdvanceTimeModified, void * );
95     DECL_LINK( SpeedListBoxSelected, void * );
96     DECL_LINK( SoundListBoxSelected, void * );
97     DECL_LINK( LoopSoundBoxChecked, void * );
98     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
99     DECL_LINK(LateInitCallback, Timer*);
100 
101 private:
102     ViewShellBase &   mrBase;
103     SdDrawDocument *  mpDrawDoc;
104     Size              maMinSize;
105 
106     FixedLine    maFL_APPLY_TRANSITION;
107     ListBox      maLB_SLIDE_TRANSITIONS;
108     FixedLine    maFL_MODIFY_TRANSITION;
109     FixedText    maFT_SPEED;
110     ListBox      maLB_SPEED;
111     FixedText    maFT_SOUND;
112     ListBox      maLB_SOUND;
113     CheckBox     maCB_LOOP_SOUND;
114     FixedLine    maFL_ADVANCE_SLIDE;
115     RadioButton  maRB_ADVANCE_ON_MOUSE;
116     RadioButton  maRB_ADVANCE_AUTO;
117     MetricField  maMF_ADVANCE_AUTO_AFTER;
118     FixedLine    maFL_EMPTY1;
119     PushButton   maPB_APPLY_TO_ALL;
120     PushButton   maPB_PLAY;
121     PushButton   maPB_SLIDE_SHOW;
122     FixedLine    maFL_EMPTY2;
123     CheckBox     maCB_AUTO_PREVIEW;
124 
125     String       maSTR_NO_TRANSITION;
126 
127 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView >             mxView;
128 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                  mxModel;
129 
130     bool         mbHasSelection;
131     bool         mbUpdatingControls;
132     bool         mbIsMainViewChangePending;
133 
134     typedef ::std::vector< String > tSoundListType;
135     tSoundListType  maSoundList;
136     mutable String  maCurrentSoundFile;
137 
138     typedef ::std::map< sal_uInt16, sal_uInt16 > tPresetIndexesType;
139     tPresetIndexesType m_aPresetIndexes;
140 
141     Timer maLateInitTimer;
142 };
143 
144 } //  namespace sd
145 
146 // SD_SLIDETRANSITIONPANE_HXX
147 #endif
148