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