2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-02 14:13:40 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/lang/SystemDependent.hpp>
|
|
|
|
|
2014-05-14 17:43:00 +02:00
|
|
|
#if defined UNX && ! defined MACOSX
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/awt/SystemDependentXWindow.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <toolkit/awt/vclxsystemdependentwindow.hxx>
|
|
|
|
#include <toolkit/helper/macros.hxx>
|
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
2014-11-18 00:06:30 +01:00
|
|
|
#include <cppuhelper/queryinterface.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-01-11 11:07:23 +02:00
|
|
|
#ifdef MACOSX
|
2007-12-07 10:58:45 +00:00
|
|
|
#include "premac.h"
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
#include "postmac.h"
|
|
|
|
#endif
|
|
|
|
|
2010-11-01 00:22:41 -05:00
|
|
|
#include <vcl/svapp.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/syschild.hxx>
|
|
|
|
#include <vcl/sysdata.hxx>
|
|
|
|
|
2014-02-25 22:29:44 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// class VCLXSystemDependentWindow
|
2014-02-25 22:29:44 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
VCLXSystemDependentWindow::VCLXSystemDependentWindow()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::uno::XInterface
|
2014-02-25 21:31:58 +01:00
|
|
|
::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
|
2012-05-04 15:51:56 +02:00
|
|
|
(static_cast< ::com::sun::star::awt::XSystemDependentWindowPeer* >(this)) );
|
2000-09-18 16:07:07 +00:00
|
|
|
return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XTypeProvider
|
|
|
|
IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow )
|
2014-05-15 22:51:43 +02:00
|
|
|
cppu::UnoType<com::sun::star::awt::XSystemDependentWindowPeer>::get(),
|
2000-09-18 16:07:07 +00:00
|
|
|
VCLXWindow::getTypes()
|
|
|
|
IMPL_XTYPEPROVIDER_END
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
::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)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-11-01 00:22:41 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// TODO, check the process id
|
|
|
|
::com::sun::star::uno::Any aRet;
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pWindow = GetWindow();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pWindow )
|
|
|
|
{
|
2014-09-29 09:44:47 +02:00
|
|
|
const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow)->GetSystemData();
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pSysData )
|
|
|
|
{
|
2007-07-05 07:03:28 +00:00
|
|
|
#if (defined WNT)
|
2000-09-18 16:07:07 +00:00
|
|
|
if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
|
|
|
|
{
|
2014-09-29 09:44:47 +02:00
|
|
|
aRet <<= reinterpret_cast<sal_IntPtr>(pSysData->hWnd);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2013-01-11 11:07:23 +02:00
|
|
|
#elif (defined MACOSX)
|
2007-07-05 07:03:28 +00:00
|
|
|
if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
|
|
|
|
{
|
2014-09-29 09:44:47 +02:00
|
|
|
aRet <<= reinterpret_cast<sal_IntPtr>(pSysData->mpNSView);
|
2007-07-05 07:03:28 +00:00
|
|
|
}
|
2013-03-27 02:11:39 +02:00
|
|
|
#elif (defined ANDROID)
|
|
|
|
// Nothing
|
|
|
|
(void) SystemType;
|
2013-03-27 00:38:36 +02:00
|
|
|
#elif (defined IOS)
|
|
|
|
// Nothing
|
|
|
|
(void) SystemType;
|
2007-07-05 07:03:28 +00:00
|
|
|
#elif (defined UNX)
|
|
|
|
if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::SystemDependentXWindow aSD;
|
|
|
|
aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay));
|
|
|
|
aSD.WindowHandle = pSysData->aWindow;
|
|
|
|
aRet <<= aSD;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|