1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/lang/SystemDependent.hpp>
22 #if defined UNX && ! defined MACOSX && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_
23 #include <com/sun/star/awt/SystemDependentXWindow.hpp>
26 #include <toolkit/awt/vclxsystemdependentwindow.hxx>
27 #include <toolkit/helper/macros.hxx>
28 #include <cppuhelper/typeprovider.hxx>
32 #include <Cocoa/Cocoa.h>
36 #include <vcl/svapp.hxx>
37 #include <vcl/syschild.hxx>
38 #include <vcl/sysdata.hxx>
40 // ----------------------------------------------------
41 // class VCLXSystemDependentWindow
42 // ----------------------------------------------------
43 VCLXSystemDependentWindow::VCLXSystemDependentWindow()
47 VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
51 // ::com::sun::star::uno::XInterface
52 ::com::sun::star::uno::Any
VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
54 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
55 (static_cast< ::com::sun::star::awt::XSystemDependentWindowPeer
* >(this)) );
56 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
59 // ::com::sun::star::lang::XTypeProvider
60 IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow
)
61 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSystemDependentWindowPeer
>* ) NULL
),
62 VCLXWindow::getTypes()
63 IMPL_XTYPEPROVIDER_END
65 ::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
)
67 SolarMutexGuard aGuard
;
69 // TODO, check the process id
70 ::com::sun::star::uno::Any aRet
;
71 Window
* pWindow
= GetWindow();
74 const SystemEnvData
* pSysData
= ((SystemChildWindow
*)pWindow
)->GetSystemData();
78 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
)
80 aRet
<<= (sal_Int32
)pSysData
->hWnd
;
82 #elif (defined MACOSX)
83 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
)
85 aRet
<<= (sal_IntPtr
)pSysData
->pView
;
87 #elif (defined ANDROID)
94 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
)
96 ::com::sun::star::awt::SystemDependentXWindow aSD
;
97 aSD
.DisplayPointer
= sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(pSysData
->pDisplay
));
98 aSD
.WindowHandle
= pSysData
->aWindow
;
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */