Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <com/sun/star/lang/SystemDependent.hpp>
21 :
22 : #if defined UNX && ! defined MACOSX
23 : #include <com/sun/star/awt/SystemDependentXWindow.hpp>
24 : #endif
25 :
26 : #include <toolkit/awt/vclxsystemdependentwindow.hxx>
27 : #include <toolkit/helper/macros.hxx>
28 : #include <cppuhelper/typeprovider.hxx>
29 :
30 : #ifdef MACOSX
31 : #include "premac.h"
32 : #include <Cocoa/Cocoa.h>
33 : #include "postmac.h"
34 : #endif
35 :
36 : #include <vcl/svapp.hxx>
37 : #include <vcl/syschild.hxx>
38 : #include <vcl/sysdata.hxx>
39 :
40 :
41 : // class VCLXSystemDependentWindow
42 :
43 0 : VCLXSystemDependentWindow::VCLXSystemDependentWindow()
44 : {
45 0 : }
46 :
47 0 : VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
48 : {
49 0 : }
50 :
51 : // ::com::sun::star::uno::XInterface
52 0 : ::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
53 : {
54 : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
55 0 : (static_cast< ::com::sun::star::awt::XSystemDependentWindowPeer* >(this)) );
56 0 : return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
57 : }
58 :
59 : // ::com::sun::star::lang::XTypeProvider
60 0 : IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow )
61 0 : cppu::UnoType<com::sun::star::awt::XSystemDependentWindowPeer>::get(),
62 : VCLXWindow::getTypes()
63 0 : IMPL_XTYPEPROVIDER_END
64 :
65 0 : ::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, std::exception)
66 : {
67 0 : SolarMutexGuard aGuard;
68 :
69 : // TODO, check the process id
70 0 : ::com::sun::star::uno::Any aRet;
71 0 : vcl::Window* pWindow = GetWindow();
72 0 : if ( pWindow )
73 : {
74 0 : const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow)->GetSystemData();
75 0 : if( pSysData )
76 : {
77 : #if (defined WNT)
78 : if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
79 : {
80 : aRet <<= reinterpret_cast<sal_IntPtr>(pSysData->hWnd);
81 : }
82 : #elif (defined MACOSX)
83 : if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
84 : {
85 : aRet <<= reinterpret_cast<sal_IntPtr>(pSysData->mpNSView);
86 : }
87 : #elif (defined ANDROID)
88 : // Nothing
89 : (void) SystemType;
90 : #elif (defined IOS)
91 : // Nothing
92 : (void) SystemType;
93 : #elif (defined UNX)
94 0 : if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
95 : {
96 0 : ::com::sun::star::awt::SystemDependentXWindow aSD;
97 0 : aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay));
98 0 : aSD.WindowHandle = pSysData->aWindow;
99 0 : aRet <<= aSD;
100 : }
101 : #endif
102 : }
103 : }
104 0 : return aRet;
105 1227 : }
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|