xref: /trunk/main/avmedia/source/gstreamer/gstwindow.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 _GSTWINDOW_HXX
25 #define _GSTWINDOW_HXX
26 
27 #include "gstcommon.hxx"
28 #include <cppuhelper/interfacecontainer.h>
29 
30 #ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_
31 #include "com/sun/star/media/XPlayerWindow.hdl"
32 #endif
33 
34 namespace avmedia
35 {
36 namespace gst
37 {
38 
39 class PlayerChildWindow;
40 
41 // ---------------
42 // - Window -
43 // ---------------
44 
45 class Player;
46 
47 class Window : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayerWindow,
48                                                ::com::sun::star::lang::XServiceInfo >
49 {
50     friend class Player;
51 
52 public:     Window( ::avmedia::gst::Player& rPlayer );
53     ~Window();
54 
55     bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
56 
57     // XPlayerWindow
58     virtual void SAL_CALL update();
59 
60     virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel );
61     virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel();
62 
63     virtual void SAL_CALL setPointerType( sal_Int32 nPointerType );
64 
65     // XWindow
66     virtual void SAL_CALL setPosSize( sal_Int32 X,
67                                       sal_Int32 Y,
68                                       sal_Int32 Width,
69                                       sal_Int32 Height,
70                                       sal_Int16 Flags );
71 
72     virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize();
73 
74     virtual void SAL_CALL setVisible( sal_Bool Visible );
75 
76     virtual void SAL_CALL setEnable( sal_Bool Enable );
77 
78     virtual void SAL_CALL setFocus();
79 
80     virtual void SAL_CALL addWindowListener(
81         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener );
82 
83     virtual void SAL_CALL removeWindowListener(
84         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener );
85 
86     virtual void SAL_CALL addFocusListener(
87         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener );
88 
89     virtual void SAL_CALL removeFocusListener(
90         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener );
91 
92     virtual void SAL_CALL addKeyListener(
93         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener );
94 
95     virtual void SAL_CALL removeKeyListener(
96         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener );
97 
98     virtual void SAL_CALL addMouseListener(
99         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener );
100 
101     virtual void SAL_CALL removeMouseListener(
102         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener );
103 
104     virtual void SAL_CALL addMouseMotionListener(
105         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener );
106 
107     virtual void SAL_CALL removeMouseMotionListener(
108         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener );
109 
110     virtual void SAL_CALL addPaintListener(
111         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener );
112 
113     virtual void SAL_CALL removePaintListener(
114         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener );
115 
116     // XComponent
117     virtual void SAL_CALL dispose();
118 
119     virtual void SAL_CALL addEventListener(
120         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener );
121 
122     virtual void SAL_CALL removeEventListener(
123         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener );
124 
125     // XServiceInfo
126     virtual ::rtl::OUString SAL_CALL getImplementationName();
127 
128     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName );
129 
130     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
131 
132 
133 public:
134 
135     void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
136 
137     void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
138 
139     void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
140 
141     void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
142 
143     void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
144 
145     void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt );
146 
147 protected:
148 
149     long getXWindowHandle() const;
150 
151 private:
152 
153     ::osl::Mutex maMutex;
154     ::cppu::OMultiTypeInterfaceContainerHelper maListeners;
155     ::com::sun::star::awt::Rectangle maWindowRect;
156     Player& mrPlayer;
157     PlayerChildWindow* mpPlayerWindow;
158     ::com::sun::star::media::ZoomLevel meZoomLevel;
159     sal_Int32 mnPointerType;
160 
161     void implLayoutVideoWindow();
162 };
163 } // namespace gst
164 } // namespace avmedia
165 
166 #endif // _GSTWINDOW_HXX
167