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 : #include <cppuhelper/queryinterface.hxx>
30 :
31 : #ifdef MACOSX
32 : #include "premac.h"
33 : #include <Cocoa/Cocoa.h>
34 : #include "postmac.h"
35 : #endif
36 :
37 : #include <vcl/svapp.hxx>
38 : #include <vcl/syschild.hxx>
39 : #include <vcl/sysdata.hxx>
40 :
41 :
42 : // class VCLXSystemDependentWindow
43 :
44 0 : VCLXSystemDependentWindow::VCLXSystemDependentWindow()
45 : {
46 0 : }
47 :
48 0 : VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
49 : {
50 0 : }
51 :
52 : // ::com::sun::star::uno::XInterface
53 0 : ::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
54 : {
55 : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
56 0 : (static_cast< ::com::sun::star::awt::XSystemDependentWindowPeer* >(this)) );
57 0 : return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
58 : }
59 :
60 : // ::com::sun::star::lang::XTypeProvider
61 0 : IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow )
62 0 : cppu::UnoType<com::sun::star::awt::XSystemDependentWindowPeer>::get(),
63 : VCLXWindow::getTypes()
64 0 : IMPL_XTYPEPROVIDER_END
65 :
66 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)
67 : {
68 0 : SolarMutexGuard aGuard;
69 :
70 : // TODO, check the process id
71 0 : ::com::sun::star::uno::Any aRet;
72 0 : vcl::Window* pWindow = GetWindow();
73 0 : if ( pWindow )
74 : {
75 0 : const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow)->GetSystemData();
76 0 : if( pSysData )
77 : {
78 : #if (defined WNT)
79 : if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
80 : {
81 : aRet <<= reinterpret_cast<sal_IntPtr>(pSysData->hWnd);
82 : }
83 : #elif (defined MACOSX)
84 : if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
85 : {
86 : aRet <<= reinterpret_cast<sal_IntPtr>(pSysData->mpNSView);
87 : }
88 : #elif (defined ANDROID)
89 : // Nothing
90 : (void) SystemType;
91 : #elif (defined IOS)
92 : // Nothing
93 : (void) SystemType;
94 : #elif (defined UNX)
95 0 : if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
96 : {
97 0 : ::com::sun::star::awt::SystemDependentXWindow aSD;
98 0 : aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay));
99 0 : aSD.WindowHandle = pSysData->aWindow;
100 0 : aRet <<= aSD;
101 : }
102 : #endif
103 : }
104 : }
105 0 : return aRet;
106 : }
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|