xref: /trunk/main/avmedia/source/win/window.hxx (revision 9ea84ac5)
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 _WINDOW_HXX
25 #define _WINDOW_HXX
26 
27 #include "wincommon.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 struct IVideoWindow;
35 
36 namespace avmedia { namespace win {
37 
38 // ---------------
39 // - Window -
40 // ---------------
41 
42 class Player;
43 
44 class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow,
45                                                 ::com::sun::star::lang::XServiceInfo >
46 {
47 public:
48 
49             Window( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr,
50                     Player& rPlayer );
51             ~Window();
52 
53     bool    create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
54     void    processGraphEvent();
55     void    updatePointer();
56 
57     // XPlayerWindow
58     virtual void SAL_CALL update(  ) throw (::com::sun::star::uno::RuntimeException);
59     virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel ) throw (::com::sun::star::uno::RuntimeException);
60     virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel(  ) throw (::com::sun::star::uno::RuntimeException);
61     virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (::com::sun::star::uno::RuntimeException);
62 
63     // XWindow
64     virtual void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException);
65     virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(  ) throw (::com::sun::star::uno::RuntimeException);
66     virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException);
67     virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
68     virtual void SAL_CALL setFocus(  ) throw (::com::sun::star::uno::RuntimeException);
69     virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
70     virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
71     virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
72     virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
73     virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
74     virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
75     virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
76     virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
77     virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
78     virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
79     virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
80     virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
81 
82     // XComponent
83     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
84     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
85     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
86 
87     // XServiceInfo
88     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
89     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
90     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
91 
92 public:
93 
94     void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
95     void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
96     void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
97     void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
98     void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
99     void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt );
100 
101 private:
102 
103     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
104 
105     ::osl::Mutex                                maMutex;
106     ::cppu::OMultiTypeInterfaceContainerHelper  maListeners;
107     ::com::sun::star::media::ZoomLevel          meZoomLevel;
108     Player&                                     mrPlayer;
109     int                                         mnFrameWnd;
110     int                                         mnParentWnd;
111     int                                         mnPointerType;
112 
113     void                                        ImplLayoutVideoWindow();
114 };
115 
116 } // namespace win
117 } // namespace avmedia
118 
119 #endif // _WINDOW_HXX
120