1f39251c4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f39251c4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f39251c4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f39251c4SAndrew Rist  * distributed with this work for additional information
6f39251c4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f39251c4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f39251c4SAndrew Rist  * "License"); you may not use this file except in compliance
9f39251c4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f39251c4SAndrew Rist  *
11f39251c4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f39251c4SAndrew Rist  *
13f39251c4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f39251c4SAndrew Rist  * software distributed under the License is distributed on an
15f39251c4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f39251c4SAndrew Rist  * KIND, either express or implied.  See the License for the
17f39251c4SAndrew Rist  * specific language governing permissions and limitations
18f39251c4SAndrew Rist  * under the License.
19f39251c4SAndrew Rist  *
20f39251c4SAndrew Rist  *************************************************************/
21f39251c4SAndrew Rist 
22f39251c4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "mediacontrol.hxx"
25cdf0e10cSrcweir #include "mediacontrol.hrc"
26cdf0e10cSrcweir #include "mediamisc.hxx"
27cdf0e10cSrcweir #include <avmedia/mediawindow.hxx>
28cdf0e10cSrcweir #include <avmedia/mediaplayer.hxx>
29cdf0e10cSrcweir #include "helpids.hrc"
30cdf0e10cSrcweir #include <tools/time.hxx>
31cdf0e10cSrcweir #include <vcl/svapp.hxx>
32cdf0e10cSrcweir #include <vcl/lstbox.hxx>
33cdf0e10cSrcweir #include <unotools/syslocale.hxx>
34cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
35cdf0e10cSrcweir #include <math.h>
36cdf0e10cSrcweir #include <algorithm>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #define AVMEDIA_TIMEOUT				100
39cdf0e10cSrcweir #define AVMEDIA_TIME_RANGE 			2048
40cdf0e10cSrcweir #define AVMEDIA_DB_RANGE 			-40
41cdf0e10cSrcweir #define AVMEDIA_LINEINCREMENT		1.0
42cdf0e10cSrcweir #define AVMEDIA_PAGEINCREMENT		10.0
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_PLAY 	0x0001
45cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_PLAYFFW 0x0002
46cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_PAUSE 	0x0004
47cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_STOP 	0x0008
48cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_MUTE	0x0010
49cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_LOOP	0x0011
50cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_ZOOM	0x0012
51cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_OPEN 	0x0014
52cdf0e10cSrcweir #define AVMEDIA_TOOLBOXITEM_INSERT 	0x0018
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #define AVMEDIA_ZOOMLEVEL_50		0
55cdf0e10cSrcweir #define AVMEDIA_ZOOMLEVEL_100		1
56cdf0e10cSrcweir #define AVMEDIA_ZOOMLEVEL_200		2
57cdf0e10cSrcweir #define AVMEDIA_ZOOMLEVEL_FIT		3
58cdf0e10cSrcweir #define AVMEDIA_ZOOMLEVEL_SCALED	4
59cdf0e10cSrcweir #define AVMEDIA_ZOOMLEVEL_INVALID	65535
60cdf0e10cSrcweir 
61cdf0e10cSrcweir namespace avmedia
62cdf0e10cSrcweir {
63cdf0e10cSrcweir 
64cdf0e10cSrcweir // ----------------
65cdf0e10cSrcweir // - MediaControl -
66cdf0e10cSrcweir // ---------------
67cdf0e10cSrcweir 
MediaControl(Window * pParent,MediaControlStyle eControlStyle)68cdf0e10cSrcweir MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) :
69cdf0e10cSrcweir     Control( pParent ),
70cdf0e10cSrcweir 	maImageList( AVMEDIA_RESID( AVMEDIA_IMGLST ) ),
71cdf0e10cSrcweir 	maItem( 0, AVMEDIA_SETMASK_ALL ),
72cdf0e10cSrcweir     maPlayToolBox( this, WB_3DLOOK ),
73cdf0e10cSrcweir 	maTimeSlider( this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET ),
74cdf0e10cSrcweir     maMuteToolBox( this, WB_3DLOOK ),
75cdf0e10cSrcweir 	maVolumeSlider( this, WB_HORZ | WB_DRAG | WB_SLIDERSET ),
76cdf0e10cSrcweir 	maZoomToolBox( this, WB_3DLOOK ),
77cdf0e10cSrcweir 	mpZoomListBox( new ListBox( &maZoomToolBox, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ),
78cdf0e10cSrcweir     maTimeEdit( this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY ),
79cdf0e10cSrcweir 	meControlStyle( eControlStyle ),
80cdf0e10cSrcweir 	mbLocked( false )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir     const String aTimeText( RTL_CONSTASCII_USTRINGPARAM( " 00:00:00/00:00:00 " ) );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	SetBackground();
85cdf0e10cSrcweir     SetPaintTransparent( sal_True );
86cdf0e10cSrcweir     SetParentClipMode( PARENTCLIPMODE_NOCLIP );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle )
89cdf0e10cSrcweir 	{
90cdf0e10cSrcweir     	maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), String( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) );
91cdf0e10cSrcweir     	maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     	maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, implGetImage( AVMEDIA_IMG_INSERT ), String( AVMEDIA_RESID( AVMEDIA_STR_INSERT ) ) );
94cdf0e10cSrcweir     	maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 		maPlayToolBox.InsertSeparator();
97cdf0e10cSrcweir 	}
98cdf0e10cSrcweir 	else
99cdf0e10cSrcweir 	{
100cdf0e10cSrcweir 		mpZoomListBox->SetBackground();
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		maZoomToolBox.SetBackground();
103cdf0e10cSrcweir 		maZoomToolBox.SetPaintTransparent( sal_True );
104cdf0e10cSrcweir 		maPlayToolBox.SetBackground();
105cdf0e10cSrcweir 		maPlayToolBox.SetPaintTransparent( sal_True );
106cdf0e10cSrcweir 		maMuteToolBox.SetBackground();
107cdf0e10cSrcweir 		maMuteToolBox.SetPaintTransparent( sal_True );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	}
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, implGetImage( AVMEDIA_IMG_PLAY ), String( AVMEDIA_RESID( AVMEDIA_STR_PLAY ) ), TIB_CHECKABLE );
112cdf0e10cSrcweir    	maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, implGetImage( AVMEDIA_IMG_PAUSE ), String( AVMEDIA_RESID( AVMEDIA_STR_PAUSE ) ), TIB_CHECKABLE );
115cdf0e10cSrcweir    	maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_STOP, implGetImage( AVMEDIA_IMG_STOP ), String( AVMEDIA_RESID( AVMEDIA_STR_STOP ) ), TIB_CHECKABLE );
118cdf0e10cSrcweir    	maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	maPlayToolBox.InsertSeparator();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, implGetImage( AVMEDIA_IMG_ENDLESS ), String( AVMEDIA_RESID( AVMEDIA_STR_ENDLESS ) ) );
123cdf0e10cSrcweir    	maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
126cdf0e10cSrcweir 		maPlayToolBox.InsertSeparator();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     maPlayToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
129cdf0e10cSrcweir     maPlayToolBox.SetSizePixel( maPlayToolBox.CalcWindowSizePixel() );
130cdf0e10cSrcweir     maPlayToolBox.Show();
131cdf0e10cSrcweir 	maMinSize = maPlayToolBox.GetSizePixel();
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     maTimeSlider.SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) );
134cdf0e10cSrcweir     maTimeSlider.SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) );
135cdf0e10cSrcweir     maTimeSlider.SetRange( Range( 0, AVMEDIA_TIME_RANGE ) );
136cdf0e10cSrcweir 	maTimeSlider.SetHelpId( HID_AVMEDIA_TIMESLIDER );
137cdf0e10cSrcweir     maTimeSlider.SetUpdateMode( true );
138cdf0e10cSrcweir     maTimeSlider.SetSizePixel( Size( 128, maPlayToolBox.GetSizePixel().Height() ) );
139cdf0e10cSrcweir     maTimeSlider.Show();
140cdf0e10cSrcweir 	maMinSize.Width() += maTimeSlider.GetSizePixel().Width();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     maTimeEdit.SetText( aTimeText );
143cdf0e10cSrcweir     maTimeEdit.SetUpdateMode( true );
144cdf0e10cSrcweir     maTimeEdit.SetSizePixel( Size( maTimeEdit.GetTextWidth( aTimeText ) + 8, maPlayToolBox.GetSizePixel().Height() ) );
145cdf0e10cSrcweir 	maTimeEdit.SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() );
146cdf0e10cSrcweir 	maTimeEdit.SetHelpId( HID_AVMEDIA_TIMEEDIT );
147cdf0e10cSrcweir 	maTimeEdit.Disable();
148cdf0e10cSrcweir     maTimeEdit.Show();
149cdf0e10cSrcweir 	maMinSize.Width() += maTimeEdit.GetSizePixel().Width();
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
152cdf0e10cSrcweir 		maMuteToolBox.InsertSeparator();
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     maMuteToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, implGetImage( AVMEDIA_IMG_MUTE ), String( AVMEDIA_RESID( AVMEDIA_STR_MUTE ) ) );
155cdf0e10cSrcweir    	maMuteToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	maMuteToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
158cdf0e10cSrcweir     maMuteToolBox.SetSizePixel( maMuteToolBox.CalcWindowSizePixel() );
159cdf0e10cSrcweir     maMuteToolBox.Show();
160cdf0e10cSrcweir 	maMinSize.Width() += maMuteToolBox.GetSizePixel().Width();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     maVolumeSlider.SetSlideHdl( LINK( this, MediaControl, implVolumeHdl ) );
163cdf0e10cSrcweir     maVolumeSlider.SetEndSlideHdl( LINK( this, MediaControl, implVolumeEndHdl ) );
164cdf0e10cSrcweir     maVolumeSlider.SetRange( Range( AVMEDIA_DB_RANGE, 0 ) );
165cdf0e10cSrcweir     maVolumeSlider.SetUpdateMode( true );
166cdf0e10cSrcweir     maVolumeSlider.SetHelpId( HID_AVMEDIA_VOLUMESLIDER );
167cdf0e10cSrcweir     maVolumeSlider.SetSizePixel( Size( 48, maPlayToolBox.GetSizePixel().Height() ) );
168cdf0e10cSrcweir 	maVolumeSlider.Show();
169cdf0e10cSrcweir 	maMinSize.Width() += maVolumeSlider.GetSizePixel().Width();
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	mpZoomListBox->SetSizePixel( Size( maTimeEdit.GetSizePixel().Width(), 260 ) );
172cdf0e10cSrcweir 	mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_50 ) ), AVMEDIA_ZOOMLEVEL_50 );
173cdf0e10cSrcweir 	mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_100 ) ), AVMEDIA_ZOOMLEVEL_100 );
174cdf0e10cSrcweir 	mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_200 ) ), AVMEDIA_ZOOMLEVEL_200 );
175cdf0e10cSrcweir 	mpZoomListBox->InsertEntry( String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM_FIT ) ), AVMEDIA_ZOOMLEVEL_FIT );
176cdf0e10cSrcweir     mpZoomListBox->SetSelectHdl( LINK( this, MediaControl, implZoomSelectHdl ) );
177cdf0e10cSrcweir     mpZoomListBox->SetHelpId( HID_AVMEDIA_ZOOMLISTBOX );
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     maZoomToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, String( AVMEDIA_RESID( AVMEDIA_STR_ZOOM ) ) );
180cdf0e10cSrcweir     maZoomToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox );
183cdf0e10cSrcweir 	maZoomToolBox.SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) );
184cdf0e10cSrcweir     maZoomToolBox.SetSizePixel( maZoomToolBox.CalcWindowSizePixel() );
185cdf0e10cSrcweir     maZoomToolBox.Show();
186cdf0e10cSrcweir 	maMinSize.Width() += maZoomToolBox.GetSizePixel().Width();
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	if( MEDIACONTROLSTYLE_MULTILINE == meControlStyle )
189cdf0e10cSrcweir 	{
190cdf0e10cSrcweir 		maMinSize.Width() = 256;
191cdf0e10cSrcweir 		maMinSize.Height() = ( maMinSize.Height() << 1 ) + AVMEDIA_CONTROLOFFSET;
192cdf0e10cSrcweir 	}
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	maTimer.SetTimeout( AVMEDIA_TIMEOUT );
195cdf0e10cSrcweir     maTimer.SetTimeoutHdl( LINK( this, MediaControl, implTimeoutHdl ) );
196cdf0e10cSrcweir 	maTimer.Start();
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // ------------------------------------------------------------------------------
200cdf0e10cSrcweir 
~MediaControl()201cdf0e10cSrcweir MediaControl::~MediaControl()
202cdf0e10cSrcweir {
203cdf0e10cSrcweir     maZoomToolBox.SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL );
204cdf0e10cSrcweir 	delete mpZoomListBox;
205cdf0e10cSrcweir }
206cdf0e10cSrcweir 
207cdf0e10cSrcweir // ------------------------------------------------------------------------------
208cdf0e10cSrcweir 
getMinSizePixel() const209cdf0e10cSrcweir const Size&	MediaControl::getMinSizePixel() const
210cdf0e10cSrcweir {
211cdf0e10cSrcweir 	return maMinSize;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir // ------------------------------------------------------------------------------
215cdf0e10cSrcweir 
Resize()216cdf0e10cSrcweir void MediaControl::Resize()
217cdf0e10cSrcweir {
218cdf0e10cSrcweir 	Point 			aPos( 0, 0 );
219cdf0e10cSrcweir 	const sal_Int32	nPlayToolBoxWidth = maPlayToolBox.GetSizePixel().Width();
220cdf0e10cSrcweir 	const sal_Int32	nMuteToolBoxWidth = maMuteToolBox.GetSizePixel().Width();
221cdf0e10cSrcweir 	const sal_Int32	nVolumeSliderWidth = maVolumeSlider.GetSizePixel().Width();
222cdf0e10cSrcweir 	const sal_Int32 nZoomToolBoxWidth = maZoomToolBox.GetSizePixel().Width();
223cdf0e10cSrcweir 	const sal_Int32	nTimeEditWidth = maTimeEdit.GetSizePixel().Width();
224cdf0e10cSrcweir 	const sal_Int32	nTimeSliderHeight = maTimeSlider.GetSizePixel().Height();
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 	if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
227cdf0e10cSrcweir 	{
228cdf0e10cSrcweir 		const sal_Int32	nTimeSliderWidth = GetSizePixel().Width() - ( AVMEDIA_CONTROLOFFSET * 3 ) -
229cdf0e10cSrcweir 										   nPlayToolBoxWidth - nMuteToolBoxWidth - nVolumeSliderWidth - nTimeEditWidth - nZoomToolBoxWidth;
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 		maPlayToolBox.SetPosSizePixel( aPos, maPlayToolBox.GetSizePixel() );
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 		aPos.X() += nPlayToolBoxWidth;
234cdf0e10cSrcweir 		maTimeSlider.SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) );
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 		aPos.X() += nTimeSliderWidth + AVMEDIA_CONTROLOFFSET;
237cdf0e10cSrcweir 		maTimeEdit.SetPosSizePixel( aPos, maTimeEdit.GetSizePixel() );
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 		aPos.X() += nTimeEditWidth + AVMEDIA_CONTROLOFFSET;
240cdf0e10cSrcweir 		maMuteToolBox.SetPosSizePixel( aPos, maMuteToolBox.GetSizePixel() );
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 		aPos.X() += nMuteToolBoxWidth;
243cdf0e10cSrcweir 		maVolumeSlider.SetPosSizePixel( aPos, maVolumeSlider.GetSizePixel() );
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 		aPos.X() += nVolumeSliderWidth + AVMEDIA_CONTROLOFFSET;
246cdf0e10cSrcweir 		maZoomToolBox.SetPosSizePixel( aPos, maZoomToolBox.GetSizePixel() );
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir 	else
249cdf0e10cSrcweir 	{
250cdf0e10cSrcweir 		const sal_Int32	nTimeSliderWidth = GetSizePixel().Width() - AVMEDIA_CONTROLOFFSET - nTimeEditWidth;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 		maTimeSlider.SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 		aPos.X() += nTimeSliderWidth + AVMEDIA_CONTROLOFFSET;
255cdf0e10cSrcweir 		maTimeEdit.SetPosSizePixel( aPos, maTimeEdit.GetSizePixel() );
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 		aPos.X() = 0;
258cdf0e10cSrcweir 		aPos.Y() += nTimeSliderHeight + AVMEDIA_CONTROLOFFSET;
259cdf0e10cSrcweir 		maPlayToolBox.SetPosSizePixel( aPos, maPlayToolBox.GetSizePixel() );
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 		aPos.X() = GetSizePixel().Width() - nVolumeSliderWidth - nMuteToolBoxWidth - nZoomToolBoxWidth - AVMEDIA_CONTROLOFFSET;
262cdf0e10cSrcweir 		maMuteToolBox.SetPosSizePixel( aPos, maMuteToolBox.GetSizePixel() );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 		aPos.X() += nMuteToolBoxWidth;
265cdf0e10cSrcweir 		maVolumeSlider.SetPosSizePixel( aPos, maVolumeSlider.GetSizePixel() );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 		aPos.X() = GetSizePixel().Width() - nZoomToolBoxWidth;
268cdf0e10cSrcweir 		maZoomToolBox.SetPosSizePixel( aPos, maZoomToolBox.GetSizePixel() );
269cdf0e10cSrcweir 	}
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir // ------------------------------------------------------------------------------
273cdf0e10cSrcweir 
setState(const MediaItem & rItem)274cdf0e10cSrcweir void MediaControl::setState( const MediaItem& rItem )
275cdf0e10cSrcweir {
276cdf0e10cSrcweir     if( !mbLocked )
277cdf0e10cSrcweir     {
278cdf0e10cSrcweir 	    maItem.merge( rItem );
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	    implUpdateToolboxes();
281cdf0e10cSrcweir 	    implUpdateTimeSlider();
282cdf0e10cSrcweir 	    implUpdateVolumeSlider();
283cdf0e10cSrcweir 	    implUpdateTimeField( maItem.getTime() );
284cdf0e10cSrcweir 	}
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir // ------------------------------------------------------------------------------
288cdf0e10cSrcweir 
getState(MediaItem & rItem) const289cdf0e10cSrcweir void MediaControl::getState( MediaItem& rItem ) const
290cdf0e10cSrcweir {
291cdf0e10cSrcweir 	rItem.merge( maItem );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir // ------------------------------------------------------------------------------
295cdf0e10cSrcweir 
update()296cdf0e10cSrcweir void MediaControl::update()
297cdf0e10cSrcweir {
298cdf0e10cSrcweir }
299cdf0e10cSrcweir 
300cdf0e10cSrcweir // ------------------------------------------------------------------------------
301cdf0e10cSrcweir 
execute(const MediaItem &)302cdf0e10cSrcweir void MediaControl::execute( const MediaItem& )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir }
305cdf0e10cSrcweir 
306cdf0e10cSrcweir // ------------------------------------------------------------------------------
307cdf0e10cSrcweir 
implUpdateToolboxes()308cdf0e10cSrcweir void MediaControl::implUpdateToolboxes()
309cdf0e10cSrcweir {
310*144e4e62SHerbert Dürr 	const bool bValidURL = !maItem.getURL().isEmpty();
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_INSERT, bValidURL );
313cdf0e10cSrcweir 	maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PLAY, bValidURL );
314cdf0e10cSrcweir 	maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PLAYFFW, bValidURL );
315cdf0e10cSrcweir 	maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_PAUSE, bValidURL );
316cdf0e10cSrcweir 	maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_STOP, bValidURL );
317cdf0e10cSrcweir 	maPlayToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_LOOP, bValidURL );
318cdf0e10cSrcweir 	maMuteToolBox.EnableItem( AVMEDIA_TOOLBOXITEM_MUTE, bValidURL );
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	if( !bValidURL || !IsEnabled() )
321cdf0e10cSrcweir 	{
322cdf0e10cSrcweir 		mpZoomListBox->Disable();
323cdf0e10cSrcweir 
324cdf0e10cSrcweir         if( MEDIACONTROLSTYLE_SINGLELINE == meControlStyle )
325cdf0e10cSrcweir     	    maPlayToolBox.Disable();
326cdf0e10cSrcweir 
327cdf0e10cSrcweir         maMuteToolBox.Disable();
328cdf0e10cSrcweir 	}
329cdf0e10cSrcweir 	else
330cdf0e10cSrcweir 	{
331cdf0e10cSrcweir 	    maPlayToolBox.Enable();
332cdf0e10cSrcweir 	    maMuteToolBox.Enable();
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 		if( MEDIASTATE_PLAY == maItem.getState() || MEDIASTATE_PLAYFFW == maItem.getState() )
335cdf0e10cSrcweir 		{
336cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, true );
337cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAYFFW, MEDIASTATE_PLAYFFW == maItem.getState() );
338cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
339cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false );
340cdf0e10cSrcweir 		}
341cdf0e10cSrcweir 		else if( maItem.getTime() > 0.0 && ( maItem.getTime() < maItem.getDuration() ) )
342cdf0e10cSrcweir 		{
343cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false );
344cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAYFFW, false );
345cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, true );
346cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false );
347cdf0e10cSrcweir 		}
348cdf0e10cSrcweir 		else
349cdf0e10cSrcweir 		{
350cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false );
351cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PLAYFFW, false );
352cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false );
353cdf0e10cSrcweir 			maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_STOP, true );
354cdf0e10cSrcweir 		}
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 		maPlayToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_LOOP, maItem.isLoop() );
357cdf0e10cSrcweir 		maMuteToolBox.CheckItem( AVMEDIA_TOOLBOXITEM_MUTE, maItem.isMute() );
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 		if( !mpZoomListBox->IsTravelSelect() && !mpZoomListBox->IsInDropDown() )
360cdf0e10cSrcweir 		{
361cdf0e10cSrcweir 			sal_uInt16 nSelectEntryPos ;
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 			switch( maItem.getZoom() )
364cdf0e10cSrcweir 			{
365cdf0e10cSrcweir 				case( ::com::sun::star::media::ZoomLevel_ZOOM_1_TO_2 ): nSelectEntryPos = AVMEDIA_ZOOMLEVEL_50; break;
366cdf0e10cSrcweir 				case( ::com::sun::star::media::ZoomLevel_ORIGINAL ): nSelectEntryPos = AVMEDIA_ZOOMLEVEL_100; break;
367cdf0e10cSrcweir 				case( ::com::sun::star::media::ZoomLevel_ZOOM_2_TO_1 ): nSelectEntryPos = AVMEDIA_ZOOMLEVEL_200; break;
368cdf0e10cSrcweir 				case( ::com::sun::star::media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): nSelectEntryPos = AVMEDIA_ZOOMLEVEL_FIT; break;
369cdf0e10cSrcweir 				case( ::com::sun::star::media::ZoomLevel_FIT_TO_WINDOW ): nSelectEntryPos = AVMEDIA_ZOOMLEVEL_SCALED; break;
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 				default: nSelectEntryPos = AVMEDIA_ZOOMLEVEL_INVALID; break;
372cdf0e10cSrcweir 			}
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 			if( nSelectEntryPos != AVMEDIA_ZOOMLEVEL_INVALID )
375cdf0e10cSrcweir 			{
376cdf0e10cSrcweir 				mpZoomListBox->Enable();
377cdf0e10cSrcweir 				mpZoomListBox->SelectEntryPos( nSelectEntryPos );
378cdf0e10cSrcweir 			}
379cdf0e10cSrcweir 			else
380cdf0e10cSrcweir 				mpZoomListBox->Disable();
381cdf0e10cSrcweir 		}
382cdf0e10cSrcweir 	}
383cdf0e10cSrcweir }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir // ------------------------------------------------------------------------------
386cdf0e10cSrcweir 
implUpdateTimeSlider()387cdf0e10cSrcweir void MediaControl::implUpdateTimeSlider()
388cdf0e10cSrcweir {
389*144e4e62SHerbert Dürr 	if( maItem.getURL().isEmpty() || !IsEnabled() )
390cdf0e10cSrcweir 		maTimeSlider.Disable();
391cdf0e10cSrcweir 	else
392cdf0e10cSrcweir 	{
393cdf0e10cSrcweir 		maTimeSlider.Enable();
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 		const double fDuration = maItem.getDuration();
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 		if( fDuration > 0.0 )
398cdf0e10cSrcweir 		{
399cdf0e10cSrcweir 			const double fTime = ::std::min( maItem.getTime(), fDuration );
400cdf0e10cSrcweir 
401cdf0e10cSrcweir 			if( !maTimeSlider.GetLineSize() )
402cdf0e10cSrcweir 				maTimeSlider.SetLineSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration ) );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 			if( !maTimeSlider.GetPageSize() )
405cdf0e10cSrcweir 				maTimeSlider.SetPageSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration ) );
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 			maTimeSlider.SetThumbPos( static_cast< sal_Int32 >( fTime / fDuration * AVMEDIA_TIME_RANGE ) );
408cdf0e10cSrcweir 		}
409cdf0e10cSrcweir 	}
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir // ------------------------------------------------------------------------------
413cdf0e10cSrcweir 
implUpdateVolumeSlider()414cdf0e10cSrcweir void MediaControl::implUpdateVolumeSlider()
415cdf0e10cSrcweir {
416*144e4e62SHerbert Dürr 	if( maItem.getURL().isEmpty() || !IsEnabled() )
417cdf0e10cSrcweir 		maVolumeSlider.Disable();
418cdf0e10cSrcweir 	else
419cdf0e10cSrcweir 	{
420cdf0e10cSrcweir 		maVolumeSlider.Enable();
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 		const sal_Int32 nVolumeDB = maItem.getVolumeDB();
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 		maVolumeSlider.SetThumbPos( ::std::min( ::std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ),
425cdf0e10cSrcweir 												static_cast< sal_Int32 >( 0 ) ) );
426cdf0e10cSrcweir 	}
427cdf0e10cSrcweir }
428cdf0e10cSrcweir 
429cdf0e10cSrcweir // ------------------------------------------------------------------------------
430cdf0e10cSrcweir 
implUpdateTimeField(double fCurTime)431cdf0e10cSrcweir void MediaControl::implUpdateTimeField( double fCurTime )
432cdf0e10cSrcweir {
433*144e4e62SHerbert Dürr     if( !maItem.getURL().isEmpty() )
434cdf0e10cSrcweir 	{
435cdf0e10cSrcweir 		String				aTimeString;
436cdf0e10cSrcweir 
437cdf0e10cSrcweir         SvtSysLocale aSysLocale;
438cdf0e10cSrcweir         const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
439cdf0e10cSrcweir 
440cdf0e10cSrcweir         aTimeString += rLocaleData.getDuration( Time( 0, 0, static_cast< sal_uInt32 >( floor( fCurTime ) ) ) );
441cdf0e10cSrcweir 		aTimeString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
442cdf0e10cSrcweir         aTimeString += rLocaleData.getDuration( Time( 0, 0, static_cast< sal_uInt32 >( floor( maItem.getDuration() ) )) );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 		if( maTimeEdit.GetText() != aTimeString )
445cdf0e10cSrcweir 		    maTimeEdit.SetText( aTimeString );
446cdf0e10cSrcweir 	}
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir // ------------------------------------------------------------------------------
450cdf0e10cSrcweir 
implGetImage(sal_Int32 nImageId) const451cdf0e10cSrcweir Image MediaControl::implGetImage( sal_Int32 nImageId ) const
452cdf0e10cSrcweir {
453cdf0e10cSrcweir 	return maImageList.GetImage( static_cast< sal_uInt16 >( nImageId ) );
454cdf0e10cSrcweir }
455cdf0e10cSrcweir 
456cdf0e10cSrcweir // ------------------------------------------------------------------------------
457cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implTimeHdl,Slider *,p)458cdf0e10cSrcweir IMPL_LINK( MediaControl, implTimeHdl, Slider*, p )
459cdf0e10cSrcweir {
460cdf0e10cSrcweir     mbLocked = true;
461cdf0e10cSrcweir 	maTimer.Stop();
462cdf0e10cSrcweir 	implUpdateTimeField( p->GetThumbPos() * maItem.getDuration() / AVMEDIA_TIME_RANGE );
463cdf0e10cSrcweir 
464cdf0e10cSrcweir 	return 0;
465cdf0e10cSrcweir }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir // ------------------------------------------------------------------------------
468cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implTimeEndHdl,Slider *,p)469cdf0e10cSrcweir IMPL_LINK( MediaControl, implTimeEndHdl, Slider*, p )
470cdf0e10cSrcweir {
471cdf0e10cSrcweir 	MediaItem aExecItem;
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 	aExecItem.setTime( p->GetThumbPos() * maItem.getDuration() / AVMEDIA_TIME_RANGE );
474cdf0e10cSrcweir 	execute( aExecItem );
475cdf0e10cSrcweir 	update();
476cdf0e10cSrcweir 	maTimer.Start();
477cdf0e10cSrcweir 	mbLocked = false;
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 	return 0;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
482cdf0e10cSrcweir // ------------------------------------------------------------------------------
483cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implVolumeHdl,Slider *,p)484cdf0e10cSrcweir IMPL_LINK( MediaControl, implVolumeHdl, Slider*, p )
485cdf0e10cSrcweir {
486cdf0e10cSrcweir 	MediaItem aExecItem;
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 	aExecItem.setVolumeDB( static_cast< sal_Int16 >( p->GetThumbPos() ) );
489cdf0e10cSrcweir 	execute( aExecItem );
490cdf0e10cSrcweir 	update();
491cdf0e10cSrcweir 
492cdf0e10cSrcweir 	return 0;
493cdf0e10cSrcweir }
494cdf0e10cSrcweir 
495cdf0e10cSrcweir // ------------------------------------------------------------------------------
496cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implVolumeEndHdl,Slider *,EMPTYARG)497cdf0e10cSrcweir IMPL_LINK( MediaControl, implVolumeEndHdl, Slider*, EMPTYARG )
498cdf0e10cSrcweir {
499cdf0e10cSrcweir 	return 0;
500cdf0e10cSrcweir }
501cdf0e10cSrcweir 
502cdf0e10cSrcweir // ------------------------------------------------------------------------------
503cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implSelectHdl,ToolBox *,p)504cdf0e10cSrcweir IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p )
505cdf0e10cSrcweir {
506cdf0e10cSrcweir     if( p )
507cdf0e10cSrcweir     {
508cdf0e10cSrcweir 		MediaItem aExecItem;
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 		switch( p->GetCurItemId() )
511cdf0e10cSrcweir         {
512cdf0e10cSrcweir 			case( AVMEDIA_TOOLBOXITEM_OPEN ):
513cdf0e10cSrcweir 			{
514cdf0e10cSrcweir 				::rtl::OUString aURL;
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 				 if( ::avmedia::MediaWindow::executeMediaURLDialog( GetParent(), aURL, false ) )
517cdf0e10cSrcweir 				 {
518cdf0e10cSrcweir 				 	if( !::avmedia::MediaWindow::isMediaURL( aURL, true ) )
519cdf0e10cSrcweir 						::avmedia::MediaWindow::executeFormatErrorBox( this );
520cdf0e10cSrcweir 					else
521cdf0e10cSrcweir 					{
522cdf0e10cSrcweir 						aExecItem.setURL( aURL );
523cdf0e10cSrcweir 						aExecItem.setState( MEDIASTATE_PLAY );
524cdf0e10cSrcweir 					}
525cdf0e10cSrcweir 				}
526cdf0e10cSrcweir 			}
527cdf0e10cSrcweir 			break;
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 			case( AVMEDIA_TOOLBOXITEM_INSERT ):
530cdf0e10cSrcweir 			{
531cdf0e10cSrcweir 				MediaFloater* pFloater = AVMEDIA_MEDIAWINDOW();
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 				if( pFloater )
534cdf0e10cSrcweir 					pFloater->dispatchCurrentURL();
535cdf0e10cSrcweir 			}
536cdf0e10cSrcweir 			break;
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 			case( AVMEDIA_TOOLBOXITEM_PLAY ):
539cdf0e10cSrcweir 			case( AVMEDIA_TOOLBOXITEM_PLAYFFW ):
540cdf0e10cSrcweir             {
541cdf0e10cSrcweir 				aExecItem.setState( ( AVMEDIA_TOOLBOXITEM_PLAYFFW == p->GetCurItemId() ) ? MEDIASTATE_PLAYFFW : MEDIASTATE_PLAY );
542cdf0e10cSrcweir 
543cdf0e10cSrcweir                 if( maItem.getTime() == maItem.getDuration() )
544cdf0e10cSrcweir 					aExecItem.setTime( 0.0 );
545cdf0e10cSrcweir 				else
546cdf0e10cSrcweir 					aExecItem.setTime( maItem.getTime() );
547cdf0e10cSrcweir             }
548cdf0e10cSrcweir             break;
549cdf0e10cSrcweir 
550cdf0e10cSrcweir             case( AVMEDIA_TOOLBOXITEM_PAUSE ):
551cdf0e10cSrcweir 			{
552cdf0e10cSrcweir 				aExecItem.setState( MEDIASTATE_PAUSE );
553cdf0e10cSrcweir 			}
554cdf0e10cSrcweir             break;
555cdf0e10cSrcweir 
556cdf0e10cSrcweir 			case( AVMEDIA_TOOLBOXITEM_STOP ):
557cdf0e10cSrcweir             {
558cdf0e10cSrcweir 				aExecItem.setState( MEDIASTATE_STOP );
559cdf0e10cSrcweir 				aExecItem.setTime( 0.0 );
560cdf0e10cSrcweir             }
561cdf0e10cSrcweir             break;
562cdf0e10cSrcweir 
563cdf0e10cSrcweir             case( AVMEDIA_TOOLBOXITEM_MUTE ):
564cdf0e10cSrcweir 			{
565cdf0e10cSrcweir                 aExecItem.setMute( !maMuteToolBox.IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) );
566cdf0e10cSrcweir 			}
567cdf0e10cSrcweir             break;
568cdf0e10cSrcweir 
569cdf0e10cSrcweir             case( AVMEDIA_TOOLBOXITEM_LOOP ):
570cdf0e10cSrcweir 			{
571cdf0e10cSrcweir                 aExecItem.setLoop( !maPlayToolBox.IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) );
572cdf0e10cSrcweir 			}
573cdf0e10cSrcweir             break;
574cdf0e10cSrcweir 
575cdf0e10cSrcweir             default:
576cdf0e10cSrcweir             break;
577cdf0e10cSrcweir         }
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 		if( aExecItem.getMaskSet() != AVMEDIA_SETMASK_NONE )
580cdf0e10cSrcweir 			execute( aExecItem );
581cdf0e10cSrcweir     }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 	update();
584cdf0e10cSrcweir 	p->Invalidate( INVALIDATE_UPDATE );
585cdf0e10cSrcweir 
586cdf0e10cSrcweir     return 0;
587cdf0e10cSrcweir }
588cdf0e10cSrcweir 
589cdf0e10cSrcweir // ------------------------------------------------------------------------------
590cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implZoomSelectHdl,ListBox *,p)591cdf0e10cSrcweir IMPL_LINK( MediaControl, implZoomSelectHdl, ListBox*, p )
592cdf0e10cSrcweir {
593cdf0e10cSrcweir     if( p )
594cdf0e10cSrcweir     {
595cdf0e10cSrcweir 		MediaItem aExecItem;
596cdf0e10cSrcweir 		::com::sun::star::media::ZoomLevel eLevel;
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 		switch( p->GetSelectEntryPos() )
599cdf0e10cSrcweir 		{
600cdf0e10cSrcweir 			case( AVMEDIA_ZOOMLEVEL_50 ): eLevel = ::com::sun::star::media::ZoomLevel_ZOOM_1_TO_2; break;
601cdf0e10cSrcweir 			case( AVMEDIA_ZOOMLEVEL_100 ): eLevel = ::com::sun::star::media::ZoomLevel_ORIGINAL; break;
602cdf0e10cSrcweir 			case( AVMEDIA_ZOOMLEVEL_200 ): eLevel = ::com::sun::star::media::ZoomLevel_ZOOM_2_TO_1; break;
603cdf0e10cSrcweir 			case( AVMEDIA_ZOOMLEVEL_FIT ): eLevel = ::com::sun::star::media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT; break;
604cdf0e10cSrcweir 			case( AVMEDIA_ZOOMLEVEL_SCALED ): eLevel = ::com::sun::star::media::ZoomLevel_FIT_TO_WINDOW; break;
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 			default: eLevel = ::com::sun::star::media::ZoomLevel_NOT_AVAILABLE; break;
607cdf0e10cSrcweir 		}
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 		aExecItem.setZoom( eLevel );
610cdf0e10cSrcweir 		execute( aExecItem );
611cdf0e10cSrcweir 		update();
612cdf0e10cSrcweir 	}
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	return 0;
615cdf0e10cSrcweir }
616cdf0e10cSrcweir 
617cdf0e10cSrcweir // ------------------------------------------------------------------------------
618cdf0e10cSrcweir 
IMPL_LINK(MediaControl,implTimeoutHdl,Timer *,EMPTYARG)619cdf0e10cSrcweir IMPL_LINK( MediaControl, implTimeoutHdl, Timer*, EMPTYARG )
620cdf0e10cSrcweir {
621cdf0e10cSrcweir 	update();
622cdf0e10cSrcweir 	maTimer.Start();
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 	return 0;
625cdf0e10cSrcweir }
626cdf0e10cSrcweir 
627cdf0e10cSrcweir }
628