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 : #ifndef _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
21 : #define _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
22 :
23 : #include <com/sun/star/lang/XServiceInfo.hpp>
24 : #include <com/sun/star/awt/XToolkitExperimental.hpp>
25 : #include <com/sun/star/lang/XTypeProvider.hpp>
26 : #include <com/sun/star/awt/XMessageBoxFactory.hpp>
27 : #include <cppuhelper/compbase2.hxx>
28 : #include "cppuhelper/interfacecontainer.hxx"
29 : #include <osl/mutex.hxx>
30 : #include <osl/module.h>
31 : #include <tools/link.hxx>
32 : #include <tools/wintypes.hxx>
33 :
34 : #include <toolkit/dllapi.h>
35 :
36 : TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType );
37 :
38 : class Window;
39 : class VCLXWindow;
40 : class VclSimpleEvent;
41 :
42 : namespace com {
43 : namespace sun {
44 : namespace star {
45 : namespace lang {
46 : struct EventObject;
47 : }
48 : namespace awt {
49 : struct WindowDescriptor;
50 : } } } }
51 :
52 : extern "C" {
53 : typedef Window* (SAL_CALL *FN_SvtCreateWindow)( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor* pDescriptor, Window* pParent, WinBits nWinBits );
54 : }
55 :
56 :
57 : // ----------------------------------------------------
58 : // class VCLXTOOLKIT
59 : // ----------------------------------------------------
60 :
61 6441 : class VCLXToolkit_Impl
62 : {
63 : protected:
64 : ::osl::Mutex maMutex;
65 : };
66 :
67 : class VCLXToolkit : public VCLXToolkit_Impl,
68 : public cppu::WeakComponentImplHelper2<
69 : ::com::sun::star::awt::XToolkitExperimental,
70 : ::com::sun::star::lang::XServiceInfo >
71 : {
72 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
73 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection;
74 :
75 : oslModule hSvToolsLib;
76 : FN_SvtCreateWindow fnSvtCreateWindow;
77 :
78 : ::cppu::OInterfaceContainerHelper m_aTopWindowListeners;
79 : ::cppu::OInterfaceContainerHelper m_aKeyHandlers;
80 : ::cppu::OInterfaceContainerHelper m_aFocusListeners;
81 : ::Link m_aEventListenerLink;
82 : ::Link m_aKeyListenerLink;
83 : bool m_bEventListener;
84 : bool m_bKeyListener;
85 :
86 : DECL_LINK(eventListenerHandler, ::VclSimpleEvent const *);
87 :
88 : DECL_LINK(keyListenerHandler, ::VclSimpleEvent const *);
89 :
90 : void callTopWindowListeners(
91 : ::VclSimpleEvent const * pEvent,
92 : void (SAL_CALL ::com::sun::star::awt::XTopWindowListener::* pFn)(
93 : ::com::sun::star::lang::EventObject const &));
94 :
95 : long callKeyHandlers(::VclSimpleEvent const * pEvent, bool bPressed);
96 :
97 : void callFocusListeners(::VclSimpleEvent const * pEvent, bool bGained);
98 :
99 : protected:
100 5469 : ::osl::Mutex& GetMutex() { return maMutex; }
101 :
102 : virtual void SAL_CALL disposing();
103 :
104 : Window* ImplCreateWindow( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, WinBits nWinBits );
105 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplCreateWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor, WinBits nWinBits );
106 :
107 : public:
108 :
109 : VCLXToolkit();
110 : ~VCLXToolkit();
111 :
112 : // ::com::sun::star::awt::XToolkitExperimental
113 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDeviceUsingBuffer( sal_Int32 Width, sal_Int32 Height, sal_Int32 ScaleNumerator, sal_Int32 ScaleDenominator, sal_Int32 XOffset, sal_Int32 YOffset, sal_Int64 AddressOfMemoryBufferForSharedArrayWrapper ) throw
114 : (::com::sun::star::uno::RuntimeException);
115 :
116 : // ::com::sun::star::awt::XToolkit
117 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException);
118 : ::com::sun::star::awt::Rectangle SAL_CALL getWorkArea( ) throw(::com::sun::star::uno::RuntimeException);
119 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
120 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > SAL_CALL createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& Descriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
121 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw
122 : (::com::sun::star::uno::RuntimeException);
123 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > SAL_CALL createRegion( ) throw(::com::sun::star::uno::RuntimeException);
124 :
125 : // ::com::sun::star::awt::XSystemChildFactory
126 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
127 :
128 : // ::com::sun::star::awt::XMessageBoxFactory
129 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > SAL_CALL createMessageBox( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& aParent, const ::com::sun::star::awt::Rectangle& aPosSize, const ::rtl::OUString& aType, ::sal_Int32 aButtons, const ::rtl::OUString& aTitle, const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException);
130 :
131 : // ::com::sun::star::awt::XDataTransfer
132 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException);
133 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException);
134 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException);
135 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException);
136 :
137 : // ::com::sun::star::lang::XServiceInfo
138 : ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
139 : sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
140 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
141 :
142 : // ::com::sun::star::awt::XExtendedToolkit:
143 :
144 : virtual ::sal_Int32 SAL_CALL getTopWindowCount()
145 : throw (::com::sun::star::uno::RuntimeException);
146 :
147 : virtual
148 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >
149 : SAL_CALL getTopWindow(::sal_Int32 nIndex)
150 : throw (::com::sun::star::uno::RuntimeException);
151 :
152 : virtual
153 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >
154 : SAL_CALL getActiveTopWindow()
155 : throw (::com::sun::star::uno::RuntimeException);
156 :
157 : virtual void SAL_CALL addTopWindowListener(
158 : ::com::sun::star::uno::Reference<
159 : ::com::sun::star::awt::XTopWindowListener > const & rListener)
160 : throw (::com::sun::star::uno::RuntimeException);
161 :
162 : virtual void SAL_CALL removeTopWindowListener(
163 : ::com::sun::star::uno::Reference<
164 : ::com::sun::star::awt::XTopWindowListener > const & rListener)
165 : throw (::com::sun::star::uno::RuntimeException);
166 :
167 : virtual void SAL_CALL addKeyHandler(
168 : ::com::sun::star::uno::Reference<
169 : ::com::sun::star::awt::XKeyHandler > const & rHandler)
170 : throw (::com::sun::star::uno::RuntimeException);
171 :
172 : virtual void SAL_CALL removeKeyHandler(
173 : ::com::sun::star::uno::Reference<
174 : ::com::sun::star::awt::XKeyHandler > const & rHandler)
175 : throw (::com::sun::star::uno::RuntimeException);
176 :
177 : virtual void SAL_CALL addFocusListener(
178 : ::com::sun::star::uno::Reference<
179 : ::com::sun::star::awt::XFocusListener > const & rListener)
180 : throw (::com::sun::star::uno::RuntimeException);
181 :
182 : virtual void SAL_CALL removeFocusListener(
183 : ::com::sun::star::uno::Reference<
184 : ::com::sun::star::awt::XFocusListener > const & rListener)
185 : throw (::com::sun::star::uno::RuntimeException);
186 :
187 : virtual void SAL_CALL fireFocusGained(
188 : ::com::sun::star::uno::Reference<
189 : ::com::sun::star::uno::XInterface > const & source)
190 : throw (::com::sun::star::uno::RuntimeException);
191 :
192 : virtual void SAL_CALL fireFocusLost(
193 : ::com::sun::star::uno::Reference<
194 : ::com::sun::star::uno::XInterface > const & source)
195 : throw (::com::sun::star::uno::RuntimeException);
196 :
197 : // ::com::sun::star::awt::XReschedule:
198 : virtual void SAL_CALL reschedule()
199 : throw (::com::sun::star::uno::RuntimeException);
200 :
201 :
202 : };
203 :
204 : #endif // _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
205 :
206 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|