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 _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ 25 #define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ 26 27 #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> 28 #include <com/sun/star/awt/XTopWindow2.hpp> 29 #include <com/sun/star/awt/XMenuBar.hpp> 30 #include <cppuhelper/weak.hxx> 31 #include <osl/mutex.hxx> 32 33 #include <cppuhelper/implbase1.hxx> 34 35 #include <toolkit/awt/vclxcontainer.hxx> 36 37 typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XTopWindow2 38 > VCLXTopWindow_XBase; 39 typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSystemDependentWindowPeer 40 > VCLXTopWindow_SBase; 41 42 class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base :public VCLXTopWindow_XBase 43 ,public VCLXTopWindow_SBase 44 { 45 private: 46 const bool m_bWHWND; 47 48 protected: 49 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar; 50 isSystemDependentWindowPeer() const51 bool isSystemDependentWindowPeer() const { return m_bWHWND; } 52 53 virtual ::vos::IMutex& GetMutexImpl() = 0; 54 virtual Window* GetWindowImpl() = 0; 55 virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; 56 57 VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ); 58 59 public: 60 virtual ~VCLXTopWindow_Base(); 61 62 // XInterface equivalents 63 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 64 // XTypeProvider equivalents 65 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 66 67 // ::com::sun::star::awt::XSystemDependentWindowPeer 68 ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException); 69 70 // ::com::sun::star::awt::XTopWindow 71 void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); 72 void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); 73 void SAL_CALL toFront() throw(::com::sun::star::uno::RuntimeException); 74 void SAL_CALL toBack() throw(::com::sun::star::uno::RuntimeException); 75 void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException); 76 77 // XTopWindow2 78 virtual ::sal_Bool SAL_CALL getIsMaximized() throw (::com::sun::star::uno::RuntimeException); 79 virtual void SAL_CALL setIsMaximized( ::sal_Bool _ismaximized ) throw (::com::sun::star::uno::RuntimeException); 80 virtual ::sal_Bool SAL_CALL getIsMinimized() throw (::com::sun::star::uno::RuntimeException); 81 virtual void SAL_CALL setIsMinimized( ::sal_Bool _isminimized ) throw (::com::sun::star::uno::RuntimeException); 82 virtual ::sal_Int32 SAL_CALL getDisplay() throw (::com::sun::star::uno::RuntimeException); 83 virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 84 }; 85 86 // ---------------------------------------------------- 87 // class VCLXTopWindow 88 // ---------------------------------------------------- 89 90 class TOOLKIT_DLLPUBLIC VCLXTopWindow: public VCLXTopWindow_Base, 91 public VCLXContainer 92 { 93 protected: 94 virtual vos::IMutex& GetMutexImpl(); 95 virtual Window* GetWindowImpl(); 96 virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl(); 97 98 public: 99 VCLXTopWindow(bool bWHWND = false); 100 ~VCLXTopWindow(); 101 102 // ::com::sun::star::uno::XInterface 103 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); acquire()104 void SAL_CALL acquire() throw() { OWeakObject::acquire(); } release()105 void SAL_CALL release() throw() { OWeakObject::release(); } 106 107 // ::com::sun::star::lang::XTypeProvider 108 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 109 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 110 111 static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); GetPropertyIds(std::list<sal_uInt16> & aIds)112 virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } 113 }; 114 115 116 117 118 #endif // _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ 119 120