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 #ifndef MACAVF_WINDOW_HXX 23 #define MACAVF_WINDOW_HXX 24 25 #include "macavf_common.hxx" 26 27 #include <cppuhelper/interfacecontainer.h> 28 29 #include "com/sun/star/media/XPlayerWindow.hdl" 30 31 // --------------- 32 // - MyMediaView - 33 // --------------- 34 35 @interface MyMediaView : NSView 36 @property (nonatomic, readonly, strong) AVPlayer* player; 37 @property (nonatomic, readonly, strong) AVPlayerLayer* playerLayer; 38 @property (nonatomic, retain) NSURL* videoURL; 39 - (void) play; 40 @end 41 42 namespace avmedia { namespace macavf { 43 44 // --------------- 45 // - Window - 46 // --------------- 47 48 class Player; 49 50 class Window 51 : public MacAVObserverHandler 52 , public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow, 53 ::com::sun::star::lang::XServiceInfo > 54 { 55 public: 56 57 Window( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rxMgr, 58 Player& i_rPlayer, 59 NSView* i_pParentView 60 ); 61 virtual ~Window(); 62 63 bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ); 64 void processGraphEvent(); 65 void updatePointer(); 66 67 // XPlayerWindow 68 virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException); 69 virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel ) throw (::com::sun::star::uno::RuntimeException); 70 virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel( ) throw (::com::sun::star::uno::RuntimeException); 71 virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (::com::sun::star::uno::RuntimeException); 72 73 // XWindow 74 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); 75 virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException); 76 virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException); 77 virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); 78 virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException); 79 virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 80 virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 81 virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 82 virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 83 virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 84 virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 85 virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 86 virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 87 virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 88 virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 89 virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 90 virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 91 92 // XComponent 93 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); 94 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 95 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 96 97 // XServiceInfo 98 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 99 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 100 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 101 102 virtual bool handleObservation( NSString* pKeyPath ); 103 104 private: 105 106 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; 107 108 ::osl::Mutex maMutex; 109 ::cppu::OMultiTypeInterfaceContainerHelper maListeners; 110 ::com::sun::star::media::ZoomLevel meZoomLevel; 111 Player& mrPlayer; 112 int mnPointerType; 113 114 NSView* mpView; // parent-view == movie-view 115 AVPlayerLayer* mpPlayerLayer; 116 117 void ImplLayoutVideoWindow(); 118 }; 119 120 } // namespace macavf 121 } // namespace avmedia 122 123 #endif // _WINDOW_HXX 124 125