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 
28 #ifndef _AVMEDIA_MEDIAWINDOWBASE_IMPL_HXX
29 #define _AVMEDIA_MEDIAWINDOWBASE_IMPL_HXX
30 
31 #include <avmedia/mediawindow.hxx>
32 #include <com/sun/star/media/XPlayer.hpp>
33 #include <com/sun/star/media/XPlayerWindow.hpp>
34 
35 namespace avmedia
36 {
37     namespace priv
38     {
39 		// --------------
40 		// - UpdateMode -
41 		// --------------
42 
43 		enum UpdateMode
44 		{
45 			UPDATEMODE_SYNC_STATUSBAR = 0,
46 			UPDATEMODE_SYNC_PLAYER = 1,
47 			UPDATEMODE_SYNC_NONE = 2
48 		};
49 
50         // -----------------------
51         // - MediaWindowBaseImpl -
52         // -----------------------
53 
54         class MediaWindowBaseImpl
55         {
56         public:
57 
58 							MediaWindowBaseImpl( MediaWindow* pMediaWindow );
59             virtual 		~MediaWindowBaseImpl();
60 
61             virtual void 	cleanUp();
62 			virtual void	onURLChanged();
63 
64     		static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL,
65                                                                                                       sal_Bool& rbJavaBased );
66 
67 		public:
68 
69 			void 	setURL( const ::rtl::OUString& rURL );
70 			const ::rtl::OUString&	getURL() const;
71 
72 			bool	isValid() const;
73 
74             bool    hasPreferredSize() const;
75             Size    getPreferredSize() const;
76 
77             bool    setZoom( ::com::sun::star::media::ZoomLevel eLevel );
78             ::com::sun::star::media::ZoomLevel getZoom() const;
79 
80             bool    start();
81             void    stop();
82 
83             bool    isPlaying() const;
84 
85             double  getDuration() const;
86 
87             void    setMediaTime( double fTime );
88             double  getMediaTime() const;
89 
90             void    setStopTime( double fTime );
91             double  getStopTime() const;
92 
93             void    setRate( double fRate );
94             double  getRate() const;
95 
96             void    setPlaybackLoop( bool bSet );
97             bool    isPlaybackLoop() const;
98 
99             void    setFixedAspectRatio( bool bSet );
100             bool    isFixedAspectRatio() const;
101 
102             void    setMute( bool bSet );
103             bool    isMute() const;
104 
105 			void    setVolumeDB( sal_Int16 nVolumeDB );
106             sal_Int16 getVolumeDB() const;
107 
108 			void	updateMediaItem( MediaItem& rItem ) const;
109 			void	executeMediaItem( const MediaItem& rItem );
110 
111         protected:
112 
113             void	stopPlayingInternal( bool );
114 
115             MediaWindow* getMediaWindow() const;
116             inline sal_Bool isMediaWindowJavaBased() const { return( mbIsMediaWindowJavaBased ); }
117 
118             ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const;
119 
120             void setPlayerWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow >& rxPlayerWindow );
121             ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > getPlayerWindow() const;
122 
123         private:
124 
125             ::rtl::OUString	 						                                   	maFileURL;
126             ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > 		mxPlayer;
127             ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow >	mxPlayerWindow;
128             MediaWindow*                                                                mpMediaWindow;
129             sal_Bool                                                                    mbIsMediaWindowJavaBased;
130         };
131     }
132 }
133 
134 #endif
135