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