1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SD_SLIDETRANSITIONPANE_HXX
28 #define SD_SLIDETRANSITIONPANE_HXX
29 
30 #include "EventMultiplexer.hxx"
31 
32 #include "SlideSorterViewShell.hxx"
33 
34 #include <vcl/ctrl.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/button.hxx>
38 #include <vcl/field.hxx>
39 #include <com/sun/star/drawing/XDrawView.hpp>
40 #include <com/sun/star/frame/XModel.hpp>
41 
42 #include <vector>
43 #include <map>
44 
45 class SdDrawDocument;
46 class SdPage;
47 
48 namespace sd
49 {
50 
51 class ViewShellBase;
52 
53 namespace impl
54 {
55     struct TransitionEffect;
56 }
57 
58 class SlideTransitionPane : public Control
59 {
60 public:
61     explicit SlideTransitionPane(
62         ::Window * pParent,
63         ViewShellBase & rBase,
64         const Size& rMinSize,
65         SdDrawDocument* pDoc );
66 	virtual ~SlideTransitionPane();
67 
68     virtual void Resize();
69 
70 	void onSelectionChanged();
71 	void onChangeCurrentPage();
72 
73 private:
74     void updateLayout();
75 	void updateControls();
76     void updateControlState();
77 
78     void updateSoundList();
79     void openSoundFileDialog();
80 
81     impl::TransitionEffect getTransitionEffectFromControls() const;
82 
83     void applyToSelectedPages();
84     void playCurrentEffect();
85 
86 	void addListener();
87 	void removeListener();
88 
89     ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const;
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 private:
106     ViewShellBase &   mrBase;
107     SdDrawDocument *  mpDrawDoc;
108     Size              maMinSize;
109 
110     FixedLine    maFL_APPLY_TRANSITION;
111     ListBox      maLB_SLIDE_TRANSITIONS;
112     FixedLine    maFL_MODIFY_TRANSITION;
113     FixedText    maFT_SPEED;
114     ListBox      maLB_SPEED;
115     FixedText    maFT_SOUND;
116     ListBox      maLB_SOUND;
117     CheckBox     maCB_LOOP_SOUND;
118     FixedLine    maFL_ADVANCE_SLIDE;
119     RadioButton  maRB_ADVANCE_ON_MOUSE;
120     RadioButton  maRB_ADVANCE_AUTO;
121     MetricField  maMF_ADVANCE_AUTO_AFTER;
122     FixedLine    maFL_EMPTY1;
123     PushButton   maPB_APPLY_TO_ALL;
124     PushButton   maPB_PLAY;
125     PushButton   maPB_SLIDE_SHOW;
126     FixedLine    maFL_EMPTY2;
127     CheckBox     maCB_AUTO_PREVIEW;
128 
129     String       maSTR_NO_TRANSITION;
130 
131 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView >             mxView;
132 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                  mxModel;
133 
134     bool         mbHasSelection;
135     bool         mbUpdatingControls;
136     bool         mbIsMainViewChangePending;
137 
138     typedef ::std::vector< String > tSoundListType;
139     tSoundListType  maSoundList;
140     mutable String  maCurrentSoundFile;
141 
142     typedef ::std::map< sal_uInt16, sal_uInt16 > tPresetIndexesType;
143     tPresetIndexesType m_aPresetIndexes;
144 
145     Timer maLateInitTimer;
146 };
147 
148 } //  namespace sd
149 
150 // SD_SLIDETRANSITIONPANE_HXX
151 #endif
152