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