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>
49 #elif defined ( QUARTZ )
51 #include <Cocoa/Cocoa.h>
55 #include <vcl/syschild.hxx>
56 #include <vcl/sysdata.hxx>
58 // ----------------------------------------------------
59 // class VCLXSystemDependentWindow
60 // ----------------------------------------------------
61 VCLXSystemDependentWindow::VCLXSystemDependentWindow()
65 VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
69 // ::com::sun::star::uno::XInterface
70 ::com::sun::star::uno::Any
VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
72 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
73 SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer
*, this ) );
74 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
77 // ::com::sun::star::lang::XTypeProvider
78 IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow
)
79 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSystemDependentWindowPeer
>* ) NULL
),
80 VCLXWindow::getTypes()
81 IMPL_XTYPEPROVIDER_END
83 ::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
)
85 ::vos::OGuard
aGuard( GetMutex() );
87 // TODO, check the process id
88 ::com::sun::star::uno::Any aRet
;
89 Window
* pWindow
= GetWindow();
92 const SystemEnvData
* pSysData
= ((SystemChildWindow
*)pWindow
)->GetSystemData();
96 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
)
98 aRet
<<= (sal_Int32
)pSysData
->hWnd
;
101 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_OS2
)
103 aRet
<<= (sal_Int32
)pSysData
->hWnd
;
105 #elif (defined QUARTZ)
106 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
)
108 aRet
<<= (sal_IntPtr
)pSysData
->pView
;
111 if( SystemType
== ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
)
113 ::com::sun::star::awt::SystemDependentXWindow aSD
;
114 aSD
.DisplayPointer
= sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(pSysData
->pDisplay
));
115 aSD
.WindowHandle
= pSysData
->aWindow
;