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