1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vclxsystemdependentwindow.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
35 #include <com/sun/star/lang/SystemDependent.hpp>
37 #if defined UNX && ! defined QUARTZ && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_
38 #include <com/sun/star/awt/SystemDependentXWindow.hpp>
41 #include <toolkit/awt/vclxsystemdependentwindow.hxx>
42 #include <toolkit/helper/macros.hxx>
43 #include <cppuhelper/typeprovider.hxx>
46 #include <tools/prewin.h>
48 #include <tools/postwin.h>
53 #include <Cocoa/Cocoa.h>
57 #include <vcl/syschild.hxx>
58 #include <vcl/sysdata.hxx>
60 // ----------------------------------------------------
61 // class VCLXSystemDependentWindow
62 // ----------------------------------------------------
63 VCLXSystemDependentWindow::VCLXSystemDependentWindow()
67 VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
71 // ::com::sun::star::uno::XInterface
72 ::com::sun::star::uno::Any
VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
74 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
75 SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer
*, this ) );
76 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
79 // ::com::sun::star::lang::XTypeProvider
80 IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow
)
81 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSystemDependentWindowPeer
>* ) NULL
),
82 VCLXWindow::getTypes()
83 IMPL_XTYPEPROVIDER_END
85 ::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
)
87 ::vos::OGuard
aGuard( GetMutex() );
89 // TODO, check the process id
90 ::com::sun::star::uno::Any aRet
;
91 Window
* pWindow
= GetWindow();
94 const SystemEnvData
* pSysData
= ((SystemChildWindow
*)pWindow
)->GetSystemData();
98 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
)
100 aRet
<<= (sal_Int32
)pSysData
->hWnd
;
103 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_OS2
)
105 aRet
<<= (sal_Int32
)pSysData
->hWnd
;
107 #elif (defined QUARTZ)
108 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
)
110 aRet
<<= (sal_IntPtr
)pSysData
->pView
;
113 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
)
115 ::com::sun::star::awt::SystemDependentXWindow aSD
;
116 aSD
.DisplayPointer
= sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(pSysData
->pDisplay
));
117 aSD
.WindowHandle
= pSysData
->aWindow
;