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
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>
29 #include <cppuhelper/queryinterface.hxx>
33 #include <Cocoa/Cocoa.h>
37 #include <vcl/svapp.hxx>
38 #include <vcl/syschild.hxx>
39 #include <vcl/sysdata.hxx>
42 // class VCLXSystemDependentWindow
44 VCLXSystemDependentWindow::VCLXSystemDependentWindow()
48 VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
52 // css::uno::XInterface
53 css::uno::Any
VCLXSystemDependentWindow::queryInterface( const css::uno::Type
& rType
)
55 css::uno::Any aRet
= ::cppu::queryInterface( rType
,
56 static_cast< css::awt::XSystemDependentWindowPeer
* >(this) );
57 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
60 IMPL_IMPLEMENTATION_ID( VCLXSystemDependentWindow
)
62 // css::lang::XTypeProvider
63 css::uno::Sequence
< css::uno::Type
> VCLXSystemDependentWindow::getTypes()
65 static const ::cppu::OTypeCollection
aTypeList(
66 cppu::UnoType
<css::lang::XTypeProvider
>::get(),
67 cppu::UnoType
<css::awt::XSystemDependentWindowPeer
>::get(),
68 VCLXWindow::getTypes()
70 return aTypeList
.getTypes();
73 css::uno::Any
VCLXSystemDependentWindow::getWindowHandle( const css::uno::Sequence
< sal_Int8
>& /*ProcessId*/, sal_Int16 SystemType
)
75 SolarMutexGuard aGuard
;
77 // TODO, check the process id
79 VclPtr
<vcl::Window
> pWindow
= GetWindow();
82 const SystemEnvData
* pSysData
= static_cast<SystemChildWindow
*>(pWindow
.get())->GetSystemData();
86 if( SystemType
== css::lang::SystemDependent::SYSTEM_WIN32
)
88 aRet
<<= reinterpret_cast<sal_IntPtr
>(pSysData
->hWnd
);
91 if( SystemType
== css::lang::SystemDependent::SYSTEM_MAC
)
93 aRet
<<= reinterpret_cast<sal_IntPtr
>(pSysData
->mpNSView
);
95 #elif defined(ANDROID)
102 if( SystemType
== css::lang::SystemDependent::SYSTEM_XWINDOW
)
104 css::awt::SystemDependentXWindow aSD
;
105 aSD
.DisplayPointer
= sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(pSysData
->pDisplay
));
106 aSD
.WindowHandle
= pSysData
->aWindow
;
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */