1*b0724fc6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*b0724fc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b0724fc6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b0724fc6SAndrew Rist * distributed with this work for additional information 6*b0724fc6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b0724fc6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b0724fc6SAndrew Rist * "License"); you may not use this file except in compliance 9*b0724fc6SAndrew Rist * with the License. You may obtain a copy of the License at 10*b0724fc6SAndrew Rist * 11*b0724fc6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*b0724fc6SAndrew Rist * 13*b0724fc6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b0724fc6SAndrew Rist * software distributed under the License is distributed on an 15*b0724fc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b0724fc6SAndrew Rist * KIND, either express or implied. See the License for the 17*b0724fc6SAndrew Rist * specific language governing permissions and limitations 18*b0724fc6SAndrew Rist * under the License. 19*b0724fc6SAndrew Rist * 20*b0724fc6SAndrew Rist *************************************************************/ 21*b0724fc6SAndrew Rist 22*b0724fc6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_toolkit.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <com/sun/star/lang/SystemDependent.hpp> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #if defined UNX && ! defined QUARTZ && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_ 31cdf0e10cSrcweir #include <com/sun/star/awt/SystemDependentXWindow.hpp> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <toolkit/awt/vclxsystemdependentwindow.hxx> 35cdf0e10cSrcweir #include <toolkit/helper/macros.hxx> 36cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #ifdef WNT 39cdf0e10cSrcweir #include <tools/prewin.h> 40cdf0e10cSrcweir #include <windows.h> 41cdf0e10cSrcweir #include <tools/postwin.h> 42cdf0e10cSrcweir #elif defined ( QUARTZ ) 43cdf0e10cSrcweir #include "premac.h" 44cdf0e10cSrcweir #include <Cocoa/Cocoa.h> 45cdf0e10cSrcweir #include "postmac.h" 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include <vcl/syschild.hxx> 49cdf0e10cSrcweir #include <vcl/sysdata.hxx> 50cdf0e10cSrcweir 51cdf0e10cSrcweir // ---------------------------------------------------- 52cdf0e10cSrcweir // class VCLXSystemDependentWindow 53cdf0e10cSrcweir // ---------------------------------------------------- 54cdf0e10cSrcweir VCLXSystemDependentWindow::VCLXSystemDependentWindow() 55cdf0e10cSrcweir { 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir VCLXSystemDependentWindow::~VCLXSystemDependentWindow() 59cdf0e10cSrcweir { 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir // ::com::sun::star::uno::XInterface 63cdf0e10cSrcweir ::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) 64cdf0e10cSrcweir { 65cdf0e10cSrcweir ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, 66cdf0e10cSrcweir SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) ); 67cdf0e10cSrcweir return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir // ::com::sun::star::lang::XTypeProvider 71cdf0e10cSrcweir IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow ) 72cdf0e10cSrcweir getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ), 73cdf0e10cSrcweir VCLXWindow::getTypes() 74cdf0e10cSrcweir IMPL_XTYPEPROVIDER_END 75cdf0e10cSrcweir 76cdf0e10cSrcweir ::com::sun::star::uno::Any VCLXSystemDependentWindow::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir ::vos::OGuard aGuard( GetMutex() ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir // TODO, check the process id 81cdf0e10cSrcweir ::com::sun::star::uno::Any aRet; 82cdf0e10cSrcweir Window* pWindow = GetWindow(); 83cdf0e10cSrcweir if ( pWindow ) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir const SystemEnvData* pSysData = ((SystemChildWindow *)pWindow)->GetSystemData(); 86cdf0e10cSrcweir if( pSysData ) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir #if (defined WNT) 89cdf0e10cSrcweir if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir aRet <<= (sal_Int32)pSysData->hWnd; 92cdf0e10cSrcweir } 93cdf0e10cSrcweir #elif (defined OS2) 94cdf0e10cSrcweir if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir aRet <<= (sal_Int32)pSysData->hWnd; 97cdf0e10cSrcweir } 98cdf0e10cSrcweir #elif (defined QUARTZ) 99cdf0e10cSrcweir if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC ) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir aRet <<= (sal_IntPtr)pSysData->pView; 102cdf0e10cSrcweir } 103cdf0e10cSrcweir #elif (defined UNX) 104cdf0e10cSrcweir if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir ::com::sun::star::awt::SystemDependentXWindow aSD; 107cdf0e10cSrcweir aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay)); 108cdf0e10cSrcweir aSD.WindowHandle = pSysData->aWindow; 109cdf0e10cSrcweir aRet <<= aSD; 110cdf0e10cSrcweir } 111cdf0e10cSrcweir #endif 112cdf0e10cSrcweir } 113cdf0e10cSrcweir } 114cdf0e10cSrcweir return aRet; 115cdf0e10cSrcweir } 116cdf0e10cSrcweir 117cdf0e10cSrcweir 118cdf0e10cSrcweir 119cdf0e10cSrcweir 120cdf0e10cSrcweir 121