Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / toolkit / source / awt / vclxsystemdependentwindow.cxx
blob660ca8957add34ba8663d876579412f40774c639
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
31 #include <com/sun/star/lang/SystemDependent.hpp>
33 #if defined UNX && ! defined QUARTZ && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_
34 #include <com/sun/star/awt/SystemDependentXWindow.hpp>
35 #endif
37 #include <toolkit/awt/vclxsystemdependentwindow.hxx>
38 #include <toolkit/helper/macros.hxx>
39 #include <cppuhelper/typeprovider.hxx>
41 #ifdef QUARTZ
42 #include "premac.h"
43 #include <Cocoa/Cocoa.h>
44 #include "postmac.h"
45 #endif
47 #ifdef IOS
48 #include "premac.h"
49 #include <UIKit/UIKit.h>
50 #include "postmac.h"
51 #endif
53 #include <vcl/svapp.hxx>
54 #include <vcl/syschild.hxx>
55 #include <vcl/sysdata.hxx>
57 // ----------------------------------------------------
58 // class VCLXSystemDependentWindow
59 // ----------------------------------------------------
60 VCLXSystemDependentWindow::VCLXSystemDependentWindow()
64 VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
68 // ::com::sun::star::uno::XInterface
69 ::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
71 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
72 (static_cast< ::com::sun::star::awt::XSystemDependentWindowPeer* >(this)) );
73 return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
76 // ::com::sun::star::lang::XTypeProvider
77 IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow )
78 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ),
79 VCLXWindow::getTypes()
80 IMPL_XTYPEPROVIDER_END
82 ::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)
84 SolarMutexGuard aGuard;
86 // TODO, check the process id
87 ::com::sun::star::uno::Any aRet;
88 Window* pWindow = GetWindow();
89 if ( pWindow )
91 const SystemEnvData* pSysData = ((SystemChildWindow *)pWindow)->GetSystemData();
92 if( pSysData )
94 #if (defined WNT)
95 if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
97 aRet <<= (sal_Int32)pSysData->hWnd;
99 #elif (defined QUARTZ)
100 if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
102 aRet <<= (sal_IntPtr)pSysData->pView;
104 #elif (defined IOS)
105 if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_IOS )
107 aRet <<= (sal_IntPtr)pSysData->pView;
109 #elif (defined UNX)
110 if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
112 ::com::sun::star::awt::SystemDependentXWindow aSD;
113 aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay));
114 aSD.WindowHandle = pSysData->aWindow;
115 aRet <<= aSD;
117 #endif
120 return aRet;
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */