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: vclxtoolkit.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"
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
36 #include <tools/svwin.h>
39 #include <com/sun/star/awt/WindowAttribute.hpp>
40 #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
41 #include <com/sun/star/awt/WindowClass.hpp>
42 #include <com/sun/star/awt/MessageBoxButtons.hpp>
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 #include <com/sun/star/lang/SystemDependent.hpp>
45 #include <com/sun/star/awt/FocusEvent.hpp>
46 #include <com/sun/star/awt/KeyEvent.hpp>
47 #include <com/sun/star/awt/KeyModifier.hpp>
48 #include <com/sun/star/lang/EventObject.hpp>
49 #include <com/sun/star/uno/Reference.hxx>
50 #include <com/sun/star/uno/Sequence.hxx>
51 #include <com/sun/star/uno/XInterface.hpp>
52 #include <com/sun/star/beans/NamedValue.hpp>
53 #include <cppuhelper/typeprovider.hxx>
54 #include <osl/conditn.hxx>
55 #include <rtl/memory.h>
57 #include <rtl/process.h>
60 #include <tools/prewin.h>
62 #include <tools/postwin.h>
63 #elif (defined QUARTZ)
65 #include <Cocoa/Cocoa.h>
68 #include <vcl/sysdata.hxx>
70 #include <toolkit/awt/vclxwindows.hxx>
71 #include <toolkit/awt/vclxsystemdependentwindow.hxx>
72 #include <toolkit/awt/vclxregion.hxx>
73 #include <toolkit/awt/vclxtoolkit.hxx>
75 #include <toolkit/awt/xsimpleanimation.hxx>
76 #include <toolkit/awt/xthrobber.hxx>
77 #include <toolkit/awt/vclxtopwindow.hxx>
78 #include <toolkit/awt/vclxwindow.hxx>
79 #include <toolkit/helper/vclunohelper.hxx>
80 #include <toolkit/helper/unowrapper.hxx>
81 #include <toolkit/helper/servicenames.hxx>
84 #include <toolkit/helper/macros.hxx>
85 #include <toolkit/helper/convert.hxx>
86 #include <vcl/unohelp.hxx>
87 #include <vcl/btndlg.hxx>
88 #ifndef _SV_BUTTON_HXX
89 #include <vcl/button.hxx>
91 #include <vcl/combobox.hxx>
92 #include <vcl/ctrl.hxx>
93 #include <vcl/dialog.hxx>
94 #include <vcl/dockingarea.hxx>
95 #include <vcl/dockwin.hxx>
96 #include <vcl/edit.hxx>
97 #include <vcl/field.hxx>
98 #include <vcl/fixed.hxx>
99 #include <vcl/floatwin.hxx>
100 #include <vcl/group.hxx>
101 #include <vcl/imgctrl.hxx>
102 #include <vcl/longcurr.hxx>
103 #include <vcl/lstbox.hxx>
104 #include <vcl/menubtn.hxx>
105 #include <vcl/morebtn.hxx>
106 #include <vcl/msgbox.hxx>
107 #include <vcl/scrbar.hxx>
108 #include <vcl/spin.hxx>
109 #include <vcl/split.hxx>
110 #include <vcl/splitwin.hxx>
111 #include <vcl/status.hxx>
112 #include <vcl/svapp.hxx>
113 #include <vcl/syschild.hxx>
114 #include <vcl/tabctrl.hxx>
115 #include <vcl/tabdlg.hxx>
116 #include <vcl/tabpage.hxx>
117 #include <vcl/toolbox.hxx>
118 #include <vcl/virdev.hxx>
119 #include <vcl/window.hxx>
120 #include <vcl/wrkwin.hxx>
121 #include "toolkit/awt/vclxspinbutton.hxx"
123 #include <tools/debug.hxx>
124 #include <comphelper/processfactory.hxx>
126 namespace css
= ::com::sun::star
;
128 #define VCLWINDOW_FRAMEWINDOW 0x1000
129 #define VCLWINDOW_SYSTEMCHILDWINDOW 0x1001
132 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
134 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_OS2
135 #elif (defined QUARTZ)
136 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
138 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
141 TOOLKIT_DLLPUBLIC WinBits
ImplGetWinBits( sal_uInt32 nComponentAttribs
, sal_uInt16 nCompType
)
143 WinBits nWinBits
= 0;
145 sal_Bool bMessBox
= sal_False
;
146 if ( ( nCompType
== WINDOW_INFOBOX
) ||
147 ( nCompType
== WINDOW_MESSBOX
) ||
148 ( nCompType
== WINDOW_QUERYBOX
) ||
149 ( nCompType
== WINDOW_WARNINGBOX
) ||
150 ( nCompType
== WINDOW_ERRORBOX
) )
155 bool bDecoratedWindow
= false;
157 || ( nCompType
== WINDOW_DIALOG
)
158 || ( nCompType
== WINDOW_MODELESSDIALOG
)
159 || ( nCompType
== WINDOW_MODALDIALOG
)
160 || ( nCompType
== WINDOW_SYSTEMDIALOG
)
161 || ( nCompType
== WINDOW_PATHDIALOG
)
162 || ( nCompType
== WINDOW_FILEDIALOG
)
163 || ( nCompType
== WINDOW_PRINTERSETUPDIALOG
)
164 || ( nCompType
== WINDOW_PRINTDIALOG
)
165 || ( nCompType
== WINDOW_COLORDIALOG
)
166 || ( nCompType
== WINDOW_FONTDIALOG
)
167 || ( nCompType
== WINDOW_DOCKINGWINDOW
)
168 || ( nCompType
== WINDOW_TABDIALOG
)
169 || ( nCompType
== WINDOW_BUTTONDIALOG
)
170 || ( nCompType
== WINDOW_SYSTEMCHILDWINDOW
)
173 bDecoratedWindow
= true;
176 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::BORDER
)
177 nWinBits
|= WB_BORDER
;
178 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER
)
179 nWinBits
|= WB_NOBORDER
;
180 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::SIZEABLE
)
181 nWinBits
|= WB_SIZEABLE
;
182 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::MOVEABLE
)
183 nWinBits
|= WB_MOVEABLE
;
184 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::CLOSEABLE
)
185 nWinBits
|= WB_CLOSEABLE
;
186 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL
)
187 nWinBits
|= WB_HSCROLL
;
188 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL
)
189 nWinBits
|= WB_VSCROLL
;
190 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::LEFT
)
192 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::CENTER
)
193 nWinBits
|= WB_CENTER
;
194 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT
)
195 nWinBits
|= WB_RIGHT
;
196 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::SPIN
)
198 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::SORT
)
200 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN
)
201 nWinBits
|= WB_DROPDOWN
;
202 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEFBUTTON
)
203 nWinBits
|= WB_DEFBUTTON
;
204 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::READONLY
)
205 nWinBits
|= WB_READONLY
;
206 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::CLIPCHILDREN
)
207 nWinBits
|= WB_CLIPCHILDREN
;
208 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::GROUP
)
209 nWinBits
|= WB_GROUP
;
210 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::NOLABEL
) //added for issue79712
211 nWinBits
|= WB_NOLABEL
;
213 // These bits are not uniqe
216 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::OK
)
218 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::OK_CANCEL
)
219 nWinBits
|= WB_OK_CANCEL
;
220 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO
)
221 nWinBits
|= WB_YES_NO
;
222 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO_CANCEL
)
223 nWinBits
|= WB_YES_NO_CANCEL
;
224 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::RETRY_CANCEL
)
225 nWinBits
|= WB_RETRY_CANCEL
;
226 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_OK
)
227 nWinBits
|= WB_DEF_OK
;
228 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_CANCEL
)
229 nWinBits
|= WB_DEF_CANCEL
;
230 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_RETRY
)
231 nWinBits
|= WB_DEF_RETRY
;
232 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_YES
)
233 nWinBits
|= WB_DEF_YES
;
234 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO
)
235 nWinBits
|= WB_DEF_NO
;
237 if ( nCompType
== WINDOW_MULTILINEEDIT
)
239 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL
)
240 nWinBits
|= WB_AUTOHSCROLL
;
241 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL
)
242 nWinBits
|= WB_AUTOVSCROLL
;
246 if ( bDecoratedWindow
)
248 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::NODECORATION
)
250 // No decoration removes several window attributes and must
252 nWinBits
&= ~WB_BORDER
;
253 nWinBits
&= ~WB_SIZEABLE
;
254 nWinBits
&= ~WB_MOVEABLE
;
255 nWinBits
&= ~WB_CLOSEABLE
;
256 nWinBits
|= WB_NOBORDER
;
269 static ComponentInfo __FAR_DATA aComponentInfos
[] =
271 { "buttondialog", WINDOW_BUTTONDIALOG
},
272 { "cancelbutton", WINDOW_CANCELBUTTON
},
273 { "checkbox", WINDOW_CHECKBOX
},
274 { "combobox", WINDOW_COMBOBOX
},
275 { "control", WINDOW_CONTROL
},
276 { "currencybox", WINDOW_CURRENCYBOX
},
277 { "currencyfield", WINDOW_CURRENCYFIELD
},
278 { "datebox", WINDOW_DATEBOX
},
279 { "datefield", WINDOW_DATEFIELD
},
280 { "dialog", WINDOW_DIALOG
},
281 { "dockingarea", WINDOW_DOCKINGAREA
},
282 { "dockingwindow", WINDOW_DOCKINGWINDOW
},
283 { "edit", WINDOW_EDIT
},
284 { "errorbox", WINDOW_ERRORBOX
},
285 { "fixedbitmap", WINDOW_FIXEDBITMAP
},
286 { "fixedimage", WINDOW_FIXEDIMAGE
},
287 { "fixedline", WINDOW_FIXEDLINE
},
288 { "fixedtext", WINDOW_FIXEDTEXT
},
289 { "floatingwindow", WINDOW_FLOATINGWINDOW
},
290 { "framewindow", VCLWINDOW_FRAMEWINDOW
},
291 { "groupbox", WINDOW_GROUPBOX
},
292 { "helpbutton", WINDOW_HELPBUTTON
},
293 { "imagebutton", WINDOW_IMAGEBUTTON
},
294 { "imageradiobutton", WINDOW_IMAGERADIOBUTTON
},
295 { "infobox", WINDOW_INFOBOX
},
296 { "listbox", WINDOW_LISTBOX
},
297 { "longcurrencybox", WINDOW_LONGCURRENCYBOX
},
298 { "longcurrencyfield", WINDOW_LONGCURRENCYFIELD
},
299 { "menubutton", WINDOW_MENUBUTTON
},
300 { "messbox", WINDOW_MESSBOX
},
301 { "metricbox", WINDOW_METRICBOX
},
302 { "metricfield", WINDOW_METRICFIELD
},
303 { "modaldialog", WINDOW_MODALDIALOG
},
304 { "modelessdialog", WINDOW_MODELESSDIALOG
},
305 { "morebutton", WINDOW_MOREBUTTON
},
306 { "multilineedit", WINDOW_MULTILINEEDIT
},
307 { "multilistbox", WINDOW_MULTILISTBOX
},
308 { "numericbox", WINDOW_NUMERICBOX
},
309 { "numericfield", WINDOW_NUMERICFIELD
},
310 { "okbutton", WINDOW_OKBUTTON
},
311 { "patternbox", WINDOW_PATTERNBOX
},
312 { "patternfield", WINDOW_PATTERNFIELD
},
313 { "pushbutton", WINDOW_PUSHBUTTON
},
314 { "querybox", WINDOW_QUERYBOX
},
315 { "radiobutton", WINDOW_RADIOBUTTON
},
316 { "scrollbar", WINDOW_SCROLLBAR
},
317 { "scrollbarbox", WINDOW_SCROLLBARBOX
},
318 { "simpleanimation", WINDOW_CONTROL
},
319 { "spinbutton", WINDOW_SPINBUTTON
},
320 { "spinfield", WINDOW_SPINFIELD
},
321 { "throbber", WINDOW_CONTROL
},
322 { "splitter", WINDOW_SPLITTER
},
323 { "splitwindow", WINDOW_SPLITWINDOW
},
324 { "statusbar", WINDOW_STATUSBAR
},
325 { "systemchildwindow", VCLWINDOW_SYSTEMCHILDWINDOW
},
326 { "tabcontrol", WINDOW_TABCONTROL
},
327 { "tabdialog", WINDOW_TABDIALOG
},
328 { "tabpage", WINDOW_TABPAGE
},
329 { "timebox", WINDOW_TIMEBOX
},
330 { "timefield", WINDOW_TIMEFIELD
},
331 { "toolbox", WINDOW_TOOLBOX
},
332 { "tristatebox", WINDOW_TRISTATEBOX
},
333 { "warningbox", WINDOW_WARNINGBOX
},
334 { "window", WINDOW_WINDOW
},
335 { "workwindow", WINDOW_WORKWINDOW
}
344 #if defined( ICC ) && defined( OS2 )
347 ComponentInfoCompare( const void* pFirst
, const void* pSecond
)
349 return( strcmp( ((ComponentInfo
*)pFirst
)->pName
,
350 ((ComponentInfo
*)pSecond
)->pName
) );
354 sal_uInt16
ImplGetComponentType( const String
& rServiceName
)
356 static sal_Bool bSorted
= sal_False
;
359 qsort( (void*) aComponentInfos
,
360 sizeof( aComponentInfos
) / sizeof( ComponentInfo
),
361 sizeof( ComponentInfo
),
362 ComponentInfoCompare
);
367 ComponentInfo aSearch
;
368 ByteString
aServiceName( rServiceName
, gsl_getSystemTextEncoding() );
369 aServiceName
.ToLowerAscii();
370 if ( aServiceName
.Len() )
371 aSearch
.pName
= aServiceName
.GetBuffer();
373 aSearch
.pName
= "window";
375 ComponentInfo
* pInf
= (ComponentInfo
*) bsearch( &aSearch
,
376 (void*) aComponentInfos
,
377 sizeof( aComponentInfos
) / sizeof( ComponentInfo
),
378 sizeof( ComponentInfo
),
379 ComponentInfoCompare
);
381 return pInf
? pInf
->nWinType
: 0;
385 // ----------------------------------------------------
387 // ----------------------------------------------------
389 static sal_Int32 nVCLToolkitInstanceCount
= 0;
390 static BOOL bInitedByVCLToolkit
= sal_False
;
391 //static cppu::OInterfaceContainerHelper * pToolkits = 0;
393 static osl::Mutex
& getInitMutex()
395 static osl::Mutex
* pM
;
398 osl::Guard
< osl::Mutex
> aGuard( osl::Mutex::getGlobalMutex() );
401 static osl::Mutex aMutex
;
408 static osl::Condition
& getInitCondition()
410 static osl::Condition
* pC
= 0;
413 osl::Guard
< osl::Mutex
> aGuard( osl::Mutex::getGlobalMutex() );
416 static osl::Condition aCondition
;
423 struct ToolkitThreadData
426 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xSMgr
;
428 ToolkitThreadData( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & rSMgr
, VCLXToolkit
* pTk_
)
437 static void SAL_CALL
ToolkitWorkerFunction( void* pArgs
)
439 ToolkitThreadData
* pTTD
= (ToolkitThreadData
*)pArgs
;
440 bInitedByVCLToolkit
= InitVCL( pTTD
->xSMgr
);
441 if( bInitedByVCLToolkit
)
443 UnoWrapper
* pUnoWrapper
= new UnoWrapper( pTTD
->pTk
);
444 Application::SetUnoWrapper( pUnoWrapper
);
446 getInitCondition().set();
447 if( bInitedByVCLToolkit
)
450 osl::Guard
< vos::IMutex
> aGuard( Application::GetSolarMutex() );
451 Application::Execute();
455 pTTD
->pTk
->dispose();
457 catch( com::sun::star::uno::Exception
& )
463 cppu::OInterfaceIteratorHelper aIt( *pToolkits );
464 ::com::sun::star::uno::XInterface * pI;
465 while( pI = aIt.next() )
466 ((::com::sun::star::lang::XComponent *)pI)->dispose();
468 // delete toolkit container
469 osl::Guard< osl::Mutex > aGuard( getInitMutex() );
478 JoinMainLoopThread();
484 // contructor, which might initialize VCL
485 VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & rSMgr
):
486 cppu::WeakComponentImplHelper7
<
487 ::com::sun::star::awt::XToolkit
,
488 ::com::sun::star::lang::XServiceInfo
,
489 ::com::sun::star::awt::XSystemChildFactory
,
490 ::com::sun::star::awt::XMessageBoxFactory
,
491 ::com::sun::star::awt::XDataTransferProviderAccess
,
492 ::com::sun::star::awt::XExtendedToolkit
,
493 ::com::sun::star::awt::XReschedule
>( GetMutex() ),
494 m_aTopWindowListeners(rBHelper
.rMutex
),
495 m_aKeyHandlers(rBHelper
.rMutex
),
496 m_aFocusListeners(rBHelper
.rMutex
),
497 m_aEventListenerLink(LINK(this, VCLXToolkit
, eventListenerHandler
)),
498 m_aKeyListenerLink(LINK(this, VCLXToolkit
, keyListenerHandler
)),
499 m_bEventListener(false),
500 m_bKeyListener(false)
503 fnSvtCreateWindow
= NULL
;
505 osl::Guard
< osl::Mutex
> aGuard( getInitMutex() );
506 nVCLToolkitInstanceCount
++;
507 if( ( nVCLToolkitInstanceCount
== 1 ) && ( !Application::IsInMain() ) )
509 // setup execute thread
510 CreateMainLoopThread( ToolkitWorkerFunction
, new ToolkitThreadData( rSMgr
, this ) );
511 getInitCondition().wait();
513 if( bInitedByVCLToolkit )
515 // insert in disposing list
517 pToolkits = new cppu::OInterfaceContainerHelper( getInitMutex() );
518 pToolkits->addInterface( (::com::sun::star::lang::XComponent *)this );
524 VCLXToolkit::~VCLXToolkit()
529 void SAL_CALL
VCLXToolkit::disposing()
533 osl_unloadModule( hSvToolsLib
);
535 fnSvtCreateWindow
= NULL
;
539 osl::Guard
< osl::Mutex
> aGuard( getInitMutex() );
540 if( --nVCLToolkitInstanceCount
== 0 )
542 if( bInitedByVCLToolkit
)
545 JoinMainLoopThread();
546 bInitedByVCLToolkit
= sal_False
;
551 if (m_bEventListener
)
553 ::Application::RemoveEventListener(m_aEventListenerLink
);
554 m_bEventListener
= false;
558 ::Application::RemoveKeyListener(m_aKeyListenerLink
);
559 m_bKeyListener
= false;
561 ::css::lang::EventObject
aEvent(
562 static_cast< ::cppu::OWeakObject
* >(this));
563 m_aTopWindowListeners
.disposeAndClear(aEvent
);
564 m_aKeyHandlers
.disposeAndClear(aEvent
);
565 m_aFocusListeners
.disposeAndClear(aEvent
);
568 osl::Guard< osl::Mutex > aGuard( getInitMutex() );
569 // insert in disposing list
572 // remove from the disposing list
573 pToolkits->removeInterface( (::com::sun::star::lang::XComponent *)this );
579 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> VCLXToolkit::getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException
)
581 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> xRef
;
582 // 07/00: AppWindow doesn't exist anymore...
586 ::com::sun::star::awt::Rectangle
VCLXToolkit::getWorkArea( ) throw(::com::sun::star::uno::RuntimeException
)
588 ::com::sun::star::awt::Rectangle aRect
;
589 // 07/00: AppWindow doesn't exist anymore...
593 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> VCLXToolkit::createWindow( const ::com::sun::star::awt::WindowDescriptor
& rDescriptor
) throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
595 return ImplCreateWindow( rDescriptor
, WinBits(0) );
598 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDevice
> VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width
, sal_Int32 Height
) throw(::com::sun::star::uno::RuntimeException
)
600 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
602 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDevice
> xRef
;
603 VCLXVirtualDevice
* pVDev
= new VCLXVirtualDevice
;
605 osl::Guard
< vos::IMutex
> aSolarGuard( Application::GetSolarMutex() );
607 VirtualDevice
* pV
= new VirtualDevice
;
608 pV
->SetOutputSizePixel( Size( Width
, Height
) );
609 pVDev
->SetVirtualDevice( pV
);
615 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XRegion
> VCLXToolkit::createRegion( ) throw(::com::sun::star::uno::RuntimeException
)
617 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
619 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XRegion
> xRef
= new VCLXRegion
;
623 Window
* VCLXToolkit::ImplCreateWindow( VCLXWindow
** ppNewComp
,
624 const ::com::sun::star::awt::WindowDescriptor
& rDescriptor
,
625 Window
* pParent
, WinBits nWinBits
)
627 String
aServiceName( rDescriptor
.WindowServiceName
);
628 aServiceName
.ToLowerAscii();
630 Window
* pNewWindow
= NULL
;
631 sal_uInt16 nType
= ImplGetComponentType( aServiceName
);
635 // Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
636 // spaeter mal ::com::sun::star::uno::Exception...
637 sal_Bool bException
= sal_True
;
638 if ( ( nType
== WINDOW_DIALOG
) || ( nType
== WINDOW_MODALDIALOG
) || ( nType
== WINDOW_MODELESSDIALOG
) )
639 bException
= sal_False
;
640 else if ( ( nType
== WINDOW_WINDOW
) ||
641 ( nType
== WINDOW_WORKWINDOW
) ||
642 ( nType
== VCLWINDOW_FRAMEWINDOW
) )
644 if ( rDescriptor
.Type
== ::com::sun::star::awt::WindowClass_TOP
)
645 bException
= sal_False
;
657 NAMESPACE_VOS(OGuard
) aVclGuard( Application::GetSolarMutex() );
658 switch ( (WindowType
)nType
)
660 case WINDOW_CANCELBUTTON
:
661 pNewWindow
= new CancelButton( pParent
, nWinBits
);
662 *ppNewComp
= new VCLXButton
;
664 case WINDOW_CHECKBOX
:
665 pNewWindow
= new CheckBox( pParent
, nWinBits
);
666 *ppNewComp
= new VCLXCheckBox
;
668 case WINDOW_COMBOBOX
:
669 pNewWindow
= new ComboBox( pParent
, nWinBits
|WB_AUTOHSCROLL
);
670 ((ComboBox
*)pNewWindow
)->EnableAutoSize( sal_False
);
671 *ppNewComp
= new VCLXComboBox
;
673 case WINDOW_CURRENCYBOX
:
674 pNewWindow
= new CurrencyBox( pParent
, nWinBits
);
676 case WINDOW_CURRENCYFIELD
:
677 pNewWindow
= new CurrencyField( pParent
, nWinBits
);
678 static_cast<CurrencyField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
679 *ppNewComp
= new VCLXNumericField
;
680 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(CurrencyField
*)pNewWindow
);
683 pNewWindow
= new DateBox( pParent
, nWinBits
);
685 case WINDOW_DATEFIELD
:
686 pNewWindow
= new DateField( pParent
, nWinBits
);
687 static_cast<DateField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
688 *ppNewComp
= new VCLXDateField
;
689 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(DateField
*)pNewWindow
);
691 case WINDOW_DOCKINGAREA
:
692 pNewWindow
= new DockingAreaWindow( pParent
);
694 case WINDOW_MULTILINEEDIT
:
696 pNewWindow
= new Edit( pParent
, nWinBits
);
697 *ppNewComp
= new VCLXEdit
;
699 case WINDOW_ERRORBOX
:
700 pNewWindow
= new ErrorBox( pParent
, nWinBits
, String() );
701 *ppNewComp
= new VCLXMessageBox
;
703 case WINDOW_FIXEDBITMAP
:
704 pNewWindow
= new FixedBitmap( pParent
, nWinBits
);
706 case WINDOW_FIXEDIMAGE
:
707 pNewWindow
= new ImageControl( pParent
, nWinBits
);
708 *ppNewComp
= new VCLXImageControl
;
710 case WINDOW_FIXEDLINE
:
711 pNewWindow
= new FixedLine( pParent
, nWinBits
);
713 case WINDOW_FIXEDTEXT
:
714 pNewWindow
= new FixedText( pParent
, nWinBits
);
715 *ppNewComp
= new VCLXFixedText
;
717 case WINDOW_FLOATINGWINDOW
:
718 pNewWindow
= new FloatingWindow( pParent
, nWinBits
);
720 case WINDOW_GROUPBOX
:
721 pNewWindow
= new GroupBox( pParent
, nWinBits
);
723 case WINDOW_HELPBUTTON
:
724 pNewWindow
= new HelpButton( pParent
, nWinBits
);
725 *ppNewComp
= new VCLXButton
;
727 case WINDOW_IMAGEBUTTON
:
728 pNewWindow
= new ImageButton( pParent
, nWinBits
);
729 *ppNewComp
= new VCLXButton
;
731 case WINDOW_IMAGERADIOBUTTON
:
732 pNewWindow
= new ImageRadioButton( pParent
, nWinBits
);
733 *ppNewComp
= new VCLXButton
;
736 pNewWindow
= new InfoBox( pParent
, String() );
737 *ppNewComp
= new VCLXMessageBox
;
740 pNewWindow
= new ListBox( pParent
, nWinBits
|WB_SIMPLEMODE
|WB_AUTOHSCROLL
);
741 ((ListBox
*)pNewWindow
)->EnableAutoSize( sal_False
);
742 *ppNewComp
= new VCLXListBox
;
744 case WINDOW_LONGCURRENCYBOX
:
745 pNewWindow
= new LongCurrencyBox( pParent
, nWinBits
);
747 case WINDOW_LONGCURRENCYFIELD
:
748 pNewWindow
= new LongCurrencyField( pParent
, nWinBits
);
749 *ppNewComp
= new VCLXCurrencyField
;
750 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(LongCurrencyField
*)pNewWindow
);
752 case WINDOW_MENUBUTTON
:
753 pNewWindow
= new MenuButton( pParent
, nWinBits
);
754 *ppNewComp
= new VCLXButton
;
757 pNewWindow
= new MessBox( pParent
, nWinBits
, String(), String() );
758 *ppNewComp
= new VCLXMessageBox
;
760 case WINDOW_METRICBOX
:
761 pNewWindow
= new MetricBox( pParent
, nWinBits
);
763 case WINDOW_METRICFIELD
:
764 pNewWindow
= new MetricField( pParent
, nWinBits
);
765 *ppNewComp
= new VCLXMetricField
;
766 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(MetricField
*)pNewWindow
);
769 case WINDOW_MODALDIALOG
:
770 case WINDOW_MODELESSDIALOG
:
772 // Modal/Modeless nur durch Show/Execute
773 if ( (pParent
== NULL
) && ( rDescriptor
.ParentIndex
== -1 ) )
774 pParent
= DIALOG_NO_PARENT
;
775 pNewWindow
= new Dialog( pParent
, nWinBits
);
776 *ppNewComp
= new VCLXDialog
;
779 case WINDOW_MOREBUTTON
:
780 pNewWindow
= new MoreButton( pParent
, nWinBits
);
781 *ppNewComp
= new VCLXButton
;
783 case WINDOW_MULTILISTBOX
:
784 pNewWindow
= new MultiListBox( pParent
, nWinBits
);
785 *ppNewComp
= new VCLXListBox
;
787 case WINDOW_NUMERICBOX
:
788 pNewWindow
= new NumericBox( pParent
, nWinBits
);
790 case WINDOW_NUMERICFIELD
:
791 pNewWindow
= new NumericField( pParent
, nWinBits
);
792 static_cast<NumericField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
793 *ppNewComp
= new VCLXNumericField
;
794 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(NumericField
*)pNewWindow
);
796 case WINDOW_OKBUTTON
:
797 pNewWindow
= new OKButton( pParent
, nWinBits
);
798 *ppNewComp
= new VCLXButton
;
800 case WINDOW_PATTERNBOX
:
801 pNewWindow
= new PatternBox( pParent
, nWinBits
);
803 case WINDOW_PATTERNFIELD
:
804 pNewWindow
= new PatternField( pParent
, nWinBits
);
805 *ppNewComp
= new VCLXPatternField
;
806 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(PatternField
*)pNewWindow
);
808 case WINDOW_PUSHBUTTON
:
809 pNewWindow
= new PushButton( pParent
, nWinBits
);
810 *ppNewComp
= new VCLXButton
;
812 case WINDOW_QUERYBOX
:
813 pNewWindow
= new QueryBox( pParent
, nWinBits
, String() );
814 *ppNewComp
= new VCLXMessageBox
;
816 case WINDOW_RADIOBUTTON
:
817 pNewWindow
= new RadioButton( pParent
, nWinBits
);
818 *ppNewComp
= new VCLXRadioButton
;
820 // by default, disable RadioCheck
821 // Since the VCLXRadioButton really cares for it's RadioCheck settings, this is important:
822 // if we enable it, the VCLXRadioButton will use RadioButton::Check instead of RadioButton::SetState
823 // This leads to a strange behaviour if the control is newly created: when settings the initial
824 // state to "checked", the RadioButton::Check (called because RadioCheck=TRUE) will uncheck
825 // _all_other_ radio buttons in the same group. However, at this moment the grouping of the controls
826 // is not really valid: the controls are grouped after they have been created, but we're still in
827 // the creation process, so the RadioButton::Check relies on invalid grouping information.
828 // 07.08.2001 - #87254# - frank.schoenheit@sun.com
829 static_cast<RadioButton
*>(pNewWindow
)->EnableRadioCheck( FALSE
);
831 case WINDOW_SCROLLBAR
:
832 pNewWindow
= new ScrollBar( pParent
, nWinBits
);
833 *ppNewComp
= new VCLXScrollBar
;
835 case WINDOW_SCROLLBARBOX
:
836 pNewWindow
= new ScrollBarBox( pParent
, nWinBits
);
838 case WINDOW_SPINBUTTON
:
839 pNewWindow
= new SpinButton( pParent
, nWinBits
);
840 *ppNewComp
= new ::toolkit::VCLXSpinButton
;
842 case WINDOW_SPINFIELD
:
843 pNewWindow
= new SpinField( pParent
, nWinBits
);
844 *ppNewComp
= new VCLXNumericField
;
846 case WINDOW_SPLITTER
:
847 pNewWindow
= new Splitter( pParent
, nWinBits
);
849 case WINDOW_SPLITWINDOW
:
850 pNewWindow
= new SplitWindow( pParent
, nWinBits
);
852 case WINDOW_STATUSBAR
:
853 pNewWindow
= new StatusBar( pParent
, nWinBits
);
855 case VCLWINDOW_SYSTEMCHILDWINDOW
:
856 pNewWindow
= new SystemChildWindow( pParent
, nWinBits
);
857 *ppNewComp
= new VCLXSystemDependentWindow();
859 case WINDOW_TABCONTROL
:
860 pNewWindow
= new TabControl( pParent
, nWinBits
);
862 case WINDOW_TABDIALOG
:
863 pNewWindow
= new TabDialog( pParent
, nWinBits
);
866 pNewWindow
= new TabPage( pParent
, nWinBits
);
867 *ppNewComp
= new VCLXTabPage
;
870 pNewWindow
= new TimeBox( pParent
, nWinBits
);
872 case WINDOW_TIMEFIELD
:
873 pNewWindow
= new TimeField( pParent
, nWinBits
);
874 static_cast<TimeField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
875 *ppNewComp
= new VCLXTimeField
;
876 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(TimeField
*)pNewWindow
);
879 pNewWindow
= new ToolBox( pParent
, nWinBits
);
880 *ppNewComp
= new VCLXToolBox
;
882 case WINDOW_TRISTATEBOX
:
883 pNewWindow
= new TriStateBox( pParent
, nWinBits
);
885 case WINDOW_WARNINGBOX
:
886 pNewWindow
= new WarningBox( pParent
, nWinBits
, String() );
887 *ppNewComp
= new VCLXMessageBox
;
889 case WINDOW_WORKWINDOW
:
891 case VCLWINDOW_FRAMEWINDOW
:
892 case WINDOW_DOCKINGWINDOW
:
893 if ( rDescriptor
.Type
== ::com::sun::star::awt::WindowClass_TOP
)
895 if (nType
== WINDOW_DOCKINGWINDOW
)
896 pNewWindow
= new DockingWindow( pParent
, nWinBits
);
899 if ((pParent
== NULL
) && rDescriptor
.Parent
.is())
901 // try to get a system dependent window handle
902 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSystemDependentWindowPeer
> xSystemDepParent(rDescriptor
.Parent
, ::com::sun::star::uno::UNO_QUERY
);
904 if (xSystemDepParent
.is())
906 sal_Int8 processID
[16];
908 rtl_getGlobalProcessId( (sal_uInt8
*)processID
);
910 ::com::sun::star::uno::Sequence
<sal_Int8
> processIdSeq(processID
, 16);
912 ::com::sun::star::uno::Any anyHandle
= xSystemDepParent
->getWindowHandle(processIdSeq
, SYSTEM_DEPENDENT_TYPE
);
914 // use sal_Int64 here to accomodate all int types
915 // uno::Any shift operator whill upcast if necessary
916 sal_Int64 nWindowHandle
= 0;
917 sal_Bool bXEmbed
= sal_False
;
919 bool bUseParentData
= true;
920 if( ! (anyHandle
>>= nWindowHandle
) )
922 css::uno::Sequence
< css::beans::NamedValue
> aProps
;
923 if( anyHandle
>>= aProps
)
925 const int nProps
= aProps
.getLength();
926 const css::beans::NamedValue
* pProps
= aProps
.getConstArray();
927 for( int i
= 0; i
< nProps
; i
++ )
929 if( pProps
[i
].Name
.equalsAscii( "WINDOW" ) )
930 pProps
[i
].Value
>>= nWindowHandle
;
931 else if( pProps
[i
].Name
.equalsAscii( "XEMBED" ) )
932 pProps
[i
].Value
>>= bXEmbed
;
936 bUseParentData
= false;
941 SystemParentData aParentData
;
942 aParentData
.nSize
= sizeof( aParentData
);
944 aParentData
.pView
= reinterpret_cast<NSView
*>(nWindowHandle
);
946 aParentData
.aWindow
= nWindowHandle
;
947 aParentData
.bXEmbedSupport
= bXEmbed
;
949 aParentData
.hWnd
= reinterpret_cast<HWND
>(nWindowHandle
);
951 aParentData
.hWnd
= (HWND
)nWindowHandle
;
953 pNewWindow
= new WorkWindow( &aParentData
);
959 pNewWindow
= new WorkWindow( pParent
, nWinBits
);
962 *ppNewComp
= new VCLXTopWindow( pNewWindow
->GetType() == WINDOW_WORKWINDOW
);
964 else if ( rDescriptor
.Type
== ::com::sun::star::awt::WindowClass_CONTAINER
)
966 if (nType
== WINDOW_DOCKINGWINDOW
)
967 pNewWindow
= new DockingWindow( pParent
, nWinBits
);
969 pNewWindow
= new Window( pParent
, nWinBits
);
970 *ppNewComp
= new VCLXContainer
;
974 if (nType
== WINDOW_DOCKINGWINDOW
)
975 pNewWindow
= new DockingWindow( pParent
, nWinBits
);
977 pNewWindow
= new Window( pParent
, nWinBits
);
978 *ppNewComp
= new VCLXWindow
;
982 if ( rDescriptor
.WindowServiceName
.equalsIgnoreAsciiCase(
983 ::rtl::OUString::createFromAscii("simpleanimation") ) )
985 nWinBits
|= WB_SCALE
;
986 pNewWindow
= new FixedImage( pParent
, nWinBits
);
987 *ppNewComp
= new ::toolkit::XSimpleAnimation
;
989 else if ( rDescriptor
.WindowServiceName
.equalsIgnoreAsciiCase(
990 ::rtl::OUString::createFromAscii("throbber") ) )
992 nWinBits
|= WB_SCALE
;
993 pNewWindow
= new FixedImage( pParent
, nWinBits
);
994 *ppNewComp
= new ::toolkit::XThrobber
;
997 default: DBG_ERRORFILE( "UNO3!" );
1004 extern "C" { static void SAL_CALL
thisModule() {} }
1006 css::uno::Reference
< css::awt::XWindowPeer
> VCLXToolkit::ImplCreateWindow(
1007 const css::awt::WindowDescriptor
& rDescriptor
,
1008 WinBits nForceWinBits
)
1010 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
1012 osl::Guard
< vos::IMutex
> aSolarGuard( Application::GetSolarMutex() );
1014 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> xRef
;
1016 Window
* pParent
= NULL
;
1017 if ( rDescriptor
.Parent
.is() )
1019 VCLXWindow
* pParentComponent
= VCLXWindow::GetImplementation( rDescriptor
.Parent
);
1021 // #103939# Don't through assertion, may be it's a system dependend window, used in ImplCreateWindow.
1022 // DBG_ASSERT( pParentComponent, "ParentComponent not valid" );
1024 if ( pParentComponent
)
1025 pParent
= pParentComponent
->GetWindow();
1028 WinBits nWinBits
= ImplGetWinBits( rDescriptor
.WindowAttributes
,
1029 ImplGetComponentType( rDescriptor
.WindowServiceName
) );
1030 nWinBits
|= nForceWinBits
;
1032 VCLXWindow
* pNewComp
= NULL
;
1034 Window
* pNewWindow
= NULL
;
1035 // Try to create the window with SvTools
1036 // (do this _before_ creating it on our own: The old mechanism (extended toolkit in SvTools) did it this way,
1037 // and we need to stay compatible)
1038 // try to load the lib
1039 if ( !fnSvtCreateWindow
&& !hSvToolsLib
)
1041 ::rtl::OUString aLibName
= ::vcl::unohelper::CreateLibraryName( "svt", TRUE
);
1042 hSvToolsLib
= osl_loadModuleRelative(
1043 &thisModule
, aLibName
.pData
, SAL_LOADMODULE_DEFAULT
);
1046 ::rtl::OUString
aFunctionName( RTL_CONSTASCII_USTRINGPARAM( "CreateWindow" ) );
1047 fnSvtCreateWindow
= (FN_SvtCreateWindow
)osl_getFunctionSymbol( hSvToolsLib
, aFunctionName
.pData
);
1050 // ask the SvTool creation function
1051 if ( fnSvtCreateWindow
)
1052 pNewWindow
= fnSvtCreateWindow( &pNewComp
, &rDescriptor
, pParent
, nWinBits
);
1054 // if SvTools could not provide a window, create it ourself
1056 pNewWindow
= ImplCreateWindow( &pNewComp
, rDescriptor
, pParent
, nWinBits
);
1058 DBG_ASSERT( pNewWindow
, "createWindow: Unknown Component!" );
1059 DBG_ASSERTWARNING( pNewComp
, "createWindow: No special Interface!" );
1063 pNewWindow
->SetCreatedWithToolkit( sal_True
);
1064 //pNewWindow->SetPosPixel( Point() ); // do not force (0,0) position, keep default pos instead
1066 if ( rDescriptor
.WindowAttributes
& ::com::sun::star::awt::WindowAttribute::MINSIZE
)
1068 pNewWindow
->SetSizePixel( Size() );
1070 else if ( rDescriptor
.WindowAttributes
& ::com::sun::star::awt::WindowAttribute::FULLSIZE
)
1073 pNewWindow
->SetSizePixel( pParent
->GetOutputSizePixel() );
1075 else if ( !VCLUnoHelper::IsZero( rDescriptor
.Bounds
) )
1077 Rectangle aRect
= VCLRectangle( rDescriptor
.Bounds
);
1078 pNewWindow
->SetPosSizePixel( aRect
.TopLeft(), aRect
.GetSize() );
1083 // Default-Interface
1084 xRef
= pNewWindow
->GetComponentInterface( sal_True
);
1088 pNewComp
->SetCreatedWithToolkit( TRUE
);
1090 pNewWindow
->SetComponentInterface( xRef
);
1092 DBG_ASSERT( pNewWindow
->GetComponentInterface( FALSE
) == xRef
,
1093 "VCLXToolkit::createWindow: did #133706# resurge?" );
1095 if ( rDescriptor
.WindowAttributes
& ::com::sun::star::awt::WindowAttribute::SHOW
)
1102 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> > VCLXToolkit::createWindows( const ::com::sun::star::uno::Sequence
< ::com::sun::star::awt::WindowDescriptor
>& rDescriptors
) throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
1104 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
1106 sal_uInt32 nComponents
= rDescriptors
.getLength();
1107 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> > aSeq( nComponents
);
1108 for ( sal_uInt32 n
= 0; n
< nComponents
; n
++ )
1110 ::com::sun::star::awt::WindowDescriptor aDescr
= rDescriptors
.getConstArray()[n
];
1112 if ( aDescr
.ParentIndex
== (-1) )
1113 aDescr
.Parent
= NULL
;
1114 else if ( ( aDescr
.ParentIndex
>= 0 ) && ( aDescr
.ParentIndex
< (short)n
) )
1115 aDescr
.Parent
= aSeq
.getConstArray()[aDescr
.ParentIndex
];
1116 aSeq
.getArray()[n
] = createWindow( aDescr
);
1121 // ::com::sun::star::awt::XSystemChildFactory
1122 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> VCLXToolkit::createSystemChild( const ::com::sun::star::uno::Any
& Parent
, const ::com::sun::star::uno::Sequence
< sal_Int8
>& /*ProcessId*/, sal_Int16 nSystemType
) throw(::com::sun::star::uno::RuntimeException
)
1124 Window
* pChildWindow
= NULL
;
1125 if ( nSystemType
== SYSTEM_DEPENDENT_TYPE
)
1127 // use sal_Int64 here to accomodate all int types
1128 // uno::Any shift operator whill upcast if necessary
1129 sal_Int64 nWindowHandle
= 0;
1130 sal_Bool bXEmbed
= sal_False
;
1132 bool bUseParentData
= true;
1133 if( ! (Parent
>>= nWindowHandle
) )
1135 css::uno::Sequence
< css::beans::NamedValue
> aProps
;
1136 if( Parent
>>= aProps
)
1138 const int nProps
= aProps
.getLength();
1139 const css::beans::NamedValue
* pProps
= aProps
.getConstArray();
1140 for( int i
= 0; i
< nProps
; i
++ )
1142 if( pProps
[i
].Name
.equalsAscii( "WINDOW" ) )
1143 pProps
[i
].Value
>>= nWindowHandle
;
1144 else if( pProps
[i
].Name
.equalsAscii( "XEMBED" ) )
1145 pProps
[i
].Value
>>= bXEmbed
;
1149 bUseParentData
= false;
1152 if( bUseParentData
)
1154 SystemParentData aParentData
;
1155 aParentData
.nSize
= sizeof( aParentData
);
1157 aParentData
.pView
= reinterpret_cast<NSView
*>(nWindowHandle
);
1159 aParentData
.aWindow
= nWindowHandle
;
1160 aParentData
.bXEmbedSupport
= bXEmbed
;
1162 aParentData
.hWnd
= reinterpret_cast<HWND
>(nWindowHandle
);
1164 aParentData
.hWnd
= (HWND
)nWindowHandle
;
1166 osl::Guard
< vos::IMutex
> aGuard( Application::GetSolarMutex() );
1169 pChildWindow
= new WorkWindow( &aParentData
);
1171 catch ( ::com::sun::star::uno::RuntimeException
& rEx
)
1173 // system child window could not be created
1175 "VCLXToolkit::createSystemChild: caught %s\n",
1176 ::rtl::OUStringToOString(
1177 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1178 pChildWindow
= NULL
;
1182 else if (nSystemType
== com::sun::star::lang::SystemDependent::SYSTEM_JAVA
)
1184 osl::Guard
< vos::IMutex
> aGuard(Application::GetSolarMutex());
1185 pChildWindow
= new WorkWindow(0, Parent
);
1188 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> xPeer
;
1191 VCLXTopWindow
* pPeer
= new VCLXTopWindow(true);
1192 osl::Guard
< vos::IMutex
> aGuard( Application::GetSolarMutex() );
1193 pPeer
->SetWindow( pChildWindow
);
1200 // ::com::sun::star::awt::XMessageBoxFactory
1201 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMessageBox
> SAL_CALL
VCLXToolkit::createMessageBox(
1202 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& aParent
,
1203 const ::com::sun::star::awt::Rectangle
& aPosSize
,
1204 const ::rtl::OUString
& aType
,
1205 ::sal_Int32 aButtons
,
1206 const ::rtl::OUString
& aTitle
,
1207 const ::rtl::OUString
& aMessage
) throw (::com::sun::star::uno::RuntimeException
)
1209 ::com::sun::star::awt::WindowDescriptor aDescriptor
;
1211 sal_Int32 nWindowAttributes
= css::awt::WindowAttribute::BORDER
|css::awt::WindowAttribute::MOVEABLE
|css::awt::WindowAttribute::CLOSEABLE
;
1213 // Map button definitions to window attributes
1214 if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_OK
)
1215 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::OK
;
1216 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_OK_CANCEL
)
1217 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::OK_CANCEL
;
1218 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_YES_NO
)
1219 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::YES_NO
;
1220 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_YES_NO_CANCEL
)
1221 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::YES_NO_CANCEL
;
1222 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_RETRY_CANCEL
)
1223 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::RETRY_CANCEL
;
1225 // Map default button definitions to window attributes
1226 if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_OK
)
1227 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_OK
;
1228 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_CANCEL
)
1229 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_CANCEL
;
1230 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_YES
)
1231 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_YES
;
1232 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_NO
)
1233 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_NO
;
1234 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_RETRY
)
1235 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_RETRY
;
1237 // No more bits for VclWindowPeerAttribute possible. Mapping must be
1238 // done explicitly using VCL methods
1239 WinBits
nAddWinBits( 0 );
1240 if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_ABORT_IGNORE_RETRY
)
1241 nAddWinBits
|= WB_ABORT_RETRY_IGNORE
;
1242 if ( sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_IGNORE
)
1243 nAddWinBits
|= WB_DEF_IGNORE
;
1245 aDescriptor
.Type
= css::awt::WindowClass_MODALTOP
;
1246 aDescriptor
.WindowServiceName
= aType
;
1247 aDescriptor
.ParentIndex
= -1;
1248 aDescriptor
.Parent
= aParent
;
1249 aDescriptor
.Bounds
= aPosSize
;
1250 aDescriptor
.WindowAttributes
= nWindowAttributes
;
1251 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMessageBox
> xMsgBox(
1252 ImplCreateWindow( aDescriptor
, nAddWinBits
), css::uno::UNO_QUERY
);
1253 css::uno::Reference
< css::awt::XWindow
> xWindow( xMsgBox
, css::uno::UNO_QUERY
);
1254 if ( xMsgBox
.is() && xWindow
.is() )
1256 Window
* pWindow
= VCLUnoHelper::GetWindow( xWindow
);
1259 osl::Guard
< vos::IMutex
> aGuard(Application::GetSolarMutex());
1260 xMsgBox
->setCaptionText( aTitle
);
1261 xMsgBox
->setMessageText( aMessage
);
1268 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer
> SAL_CALL
VCLXToolkit::getDragGestureRecognizer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>& window
) throw(::com::sun::star::uno::RuntimeException
)
1270 Window
* pWindow
= VCLUnoHelper::GetWindow( window
);
1273 return pWindow
->GetDragGestureRecognizer();
1275 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer
>();
1278 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragSource
> SAL_CALL
VCLXToolkit::getDragSource( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>& window
) throw(::com::sun::star::uno::RuntimeException
)
1280 Window
* pWindow
= VCLUnoHelper::GetWindow( window
);
1283 return pWindow
->GetDragSource();
1285 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragSource
>();
1288 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTarget
> SAL_CALL
VCLXToolkit::getDropTarget( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>& window
) throw(::com::sun::star::uno::RuntimeException
)
1290 Window
* pWindow
= VCLUnoHelper::GetWindow( window
);
1293 return pWindow
->GetDropTarget();
1295 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTarget
>();
1298 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> SAL_CALL
VCLXToolkit::getClipboard( const ::rtl::OUString
& clipboardName
) throw(::com::sun::star::uno::RuntimeException
)
1300 if( clipboardName
.getLength() == 0 )
1302 if( !mxClipboard
.is() )
1304 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xFactory
= ::comphelper::getProcessServiceFactory();
1305 if ( xFactory
.is() )
1307 // remember clipboard here
1308 mxClipboard
= ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> (
1309 xFactory
->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), ::com::sun::star::uno::UNO_QUERY
);
1316 else if( clipboardName
.equals( ::rtl::OUString::createFromAscii("Selection") ) )
1321 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
>();
1325 ::rtl::OUString
VCLXToolkit::getImplementationName() throw(::com::sun::star::uno::RuntimeException
)
1327 return rtl::OUString::createFromAscii( "stardiv.Toolkit.VCLXToolkit" );
1330 sal_Bool
VCLXToolkit::supportsService( const ::rtl::OUString
& rServiceName
) throw(::com::sun::star::uno::RuntimeException
)
1332 ::osl::MutexGuard
aGuard( GetMutex() );
1334 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSNL
= getSupportedServiceNames();
1335 const ::rtl::OUString
* pArray
= aSNL
.getConstArray();
1336 const ::rtl::OUString
* pArrayEnd
= aSNL
.getConstArray();
1337 for (; pArray
!= pArrayEnd
; ++pArray
)
1338 if( *pArray
== rServiceName
)
1341 return pArray
!= pArrayEnd
;
1344 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXToolkit::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
)
1346 ::rtl::OUString
aServiceName( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit
) );
1347 return ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( &aServiceName
, 1);
1350 // css::awt::XExtendedToolkit:
1353 ::sal_Int32 SAL_CALL
VCLXToolkit::getTopWindowCount()
1354 throw (::css::uno::RuntimeException
)
1356 return static_cast< ::sal_Int32
>(::Application::GetTopWindowCount());
1357 // XXX numeric overflow
1361 ::css::uno::Reference
< ::css::awt::XTopWindow
> SAL_CALL
1362 VCLXToolkit::getTopWindow(::sal_Int32 nIndex
)
1363 throw (::css::uno::RuntimeException
)
1365 ::Window
* p
= ::Application::GetTopWindow(static_cast< long >(nIndex
));
1366 // XXX numeric overflow
1367 return ::css::uno::Reference
< ::css::awt::XTopWindow
>(
1368 p
== 0 ? 0 : static_cast< ::css::awt::XWindow
* >(p
->GetWindowPeer()),
1369 ::css::uno::UNO_QUERY
);
1373 ::css::uno::Reference
< ::css::awt::XTopWindow
> SAL_CALL
1374 VCLXToolkit::getActiveTopWindow() throw (::css::uno::RuntimeException
)
1376 ::Window
* p
= ::Application::GetActiveTopWindow();
1377 return ::css::uno::Reference
< ::css::awt::XTopWindow
>(
1378 p
== 0 ? 0 : static_cast< ::css::awt::XWindow
* >(p
->GetWindowPeer()),
1379 ::css::uno::UNO_QUERY
);
1383 void SAL_CALL
VCLXToolkit::addTopWindowListener(
1384 ::css::uno::Reference
< ::css::awt::XTopWindowListener
> const & rListener
)
1385 throw (::css::uno::RuntimeException
)
1387 OSL_ENSURE(rListener
.is(), "Null rListener");
1388 ::osl::ClearableMutexGuard
aGuard(rBHelper
.rMutex
);
1389 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1392 rListener
->disposing(
1393 ::css::lang::EventObject(
1394 static_cast< ::cppu::OWeakObject
* >(this)));
1396 else if (m_aTopWindowListeners
.addInterface(rListener
) == 1
1397 && !m_bEventListener
)
1399 m_bEventListener
= true;
1400 ::Application::AddEventListener(m_aEventListenerLink
);
1405 void SAL_CALL
VCLXToolkit::removeTopWindowListener(
1406 ::css::uno::Reference
< ::css::awt::XTopWindowListener
> const & rListener
)
1407 throw (::css::uno::RuntimeException
)
1409 ::osl::MutexGuard
aGuard(rBHelper
.rMutex
);
1410 if (!(rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1411 && m_aTopWindowListeners
.removeInterface(rListener
) == 0
1412 && m_aFocusListeners
.getLength() == 0 && m_bEventListener
)
1414 ::Application::RemoveEventListener(m_aEventListenerLink
);
1415 m_bEventListener
= false;
1420 void SAL_CALL
VCLXToolkit::addKeyHandler(
1421 ::css::uno::Reference
< ::css::awt::XKeyHandler
> const & rHandler
)
1422 throw (::css::uno::RuntimeException
)
1424 OSL_ENSURE(rHandler
.is(), "Null rHandler");
1425 ::osl::ClearableMutexGuard
aGuard(rBHelper
.rMutex
);
1426 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1429 rHandler
->disposing(
1430 ::css::lang::EventObject(
1431 static_cast< ::cppu::OWeakObject
* >(this)));
1433 else if (m_aKeyHandlers
.addInterface(rHandler
) == 1 && !m_bKeyListener
)
1435 m_bKeyListener
= true;
1436 ::Application::AddKeyListener(m_aKeyListenerLink
);
1441 void SAL_CALL
VCLXToolkit::removeKeyHandler(
1442 ::css::uno::Reference
< ::css::awt::XKeyHandler
> const & rHandler
)
1443 throw (::css::uno::RuntimeException
)
1445 ::osl::MutexGuard
aGuard(rBHelper
.rMutex
);
1446 if (!(rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1447 && m_aKeyHandlers
.removeInterface(rHandler
) == 0 && m_bKeyListener
)
1449 ::Application::RemoveKeyListener(m_aKeyListenerLink
);
1450 m_bKeyListener
= false;
1455 void SAL_CALL
VCLXToolkit::addFocusListener(
1456 ::css::uno::Reference
< ::css::awt::XFocusListener
> const & rListener
)
1457 throw (::css::uno::RuntimeException
)
1459 OSL_ENSURE(rListener
.is(), "Null rListener");
1460 ::osl::ClearableMutexGuard
aGuard(rBHelper
.rMutex
);
1461 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1464 rListener
->disposing(
1465 ::css::lang::EventObject(
1466 static_cast< ::cppu::OWeakObject
* >(this)));
1468 else if (m_aFocusListeners
.addInterface(rListener
) == 1
1469 && !m_bEventListener
)
1471 m_bEventListener
= true;
1472 ::Application::AddEventListener(m_aEventListenerLink
);
1477 void SAL_CALL
VCLXToolkit::removeFocusListener(
1478 ::css::uno::Reference
< ::css::awt::XFocusListener
> const & rListener
)
1479 throw (::css::uno::RuntimeException
)
1481 ::osl::MutexGuard
aGuard(rBHelper
.rMutex
);
1482 if (!(rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1483 && m_aFocusListeners
.removeInterface(rListener
) == 0
1484 && m_aTopWindowListeners
.getLength() == 0 && m_bEventListener
)
1486 ::Application::RemoveEventListener(m_aEventListenerLink
);
1487 m_bEventListener
= false;
1492 void SAL_CALL
VCLXToolkit::fireFocusGained(
1493 ::com::sun::star::uno::Reference
<
1494 ::com::sun::star::uno::XInterface
> const &)
1495 throw (::com::sun::star::uno::RuntimeException
)
1500 void SAL_CALL
VCLXToolkit::fireFocusLost(
1501 ::com::sun::star::uno::Reference
<
1502 ::com::sun::star::uno::XInterface
> const &)
1503 throw (::com::sun::star::uno::RuntimeException
)
1508 IMPL_LINK(VCLXToolkit
, eventListenerHandler
, ::VclSimpleEvent
const *, pEvent
)
1510 switch (pEvent
->GetId())
1512 case VCLEVENT_WINDOW_SHOW
:
1513 callTopWindowListeners(
1514 pEvent
, &::css::awt::XTopWindowListener::windowOpened
);
1516 case VCLEVENT_WINDOW_HIDE
:
1517 callTopWindowListeners(
1518 pEvent
, &::css::awt::XTopWindowListener::windowClosed
);
1520 case VCLEVENT_WINDOW_ACTIVATE
:
1521 callTopWindowListeners(
1522 pEvent
, &::css::awt::XTopWindowListener::windowActivated
);
1524 case VCLEVENT_WINDOW_DEACTIVATE
:
1525 callTopWindowListeners(
1526 pEvent
, &::css::awt::XTopWindowListener::windowDeactivated
);
1528 case VCLEVENT_WINDOW_CLOSE
:
1529 callTopWindowListeners(
1530 pEvent
, &::css::awt::XTopWindowListener::windowClosing
);
1532 case VCLEVENT_WINDOW_GETFOCUS
:
1533 callFocusListeners(pEvent
, true);
1535 case VCLEVENT_WINDOW_LOSEFOCUS
:
1536 callFocusListeners(pEvent
, false);
1538 case VCLEVENT_WINDOW_MINIMIZE
:
1539 callTopWindowListeners(
1540 pEvent
, &::css::awt::XTopWindowListener::windowMinimized
);
1542 case VCLEVENT_WINDOW_NORMALIZE
:
1543 callTopWindowListeners(
1544 pEvent
, &::css::awt::XTopWindowListener::windowNormalized
);
1550 IMPL_LINK(VCLXToolkit
, keyListenerHandler
, ::VclSimpleEvent
const *, pEvent
)
1552 switch (pEvent
->GetId())
1554 case VCLEVENT_WINDOW_KEYINPUT
:
1555 return callKeyHandlers(pEvent
, true);
1556 case VCLEVENT_WINDOW_KEYUP
:
1557 return callKeyHandlers(pEvent
, false);
1562 void VCLXToolkit::callTopWindowListeners(
1563 ::VclSimpleEvent
const * pEvent
,
1564 void (SAL_CALL ::css::awt::XTopWindowListener::* pFn
)(
1565 ::css::lang::EventObject
const &))
1568 = static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow();
1569 if (pWindow
->IsTopWindow())
1571 ::css::uno::Sequence
< ::css::uno::Reference
< ::css::uno::XInterface
> >
1572 aListeners(m_aTopWindowListeners
.getElements());
1573 if (aListeners
.hasElements())
1575 ::css::lang::EventObject
aAwtEvent(
1576 static_cast< ::css::awt::XWindow
* >(pWindow
->GetWindowPeer()));
1577 for (::sal_Int32 i
= 0; i
< aListeners
.getLength(); ++i
)
1579 ::css::uno::Reference
< ::css::awt::XTopWindowListener
>
1580 xListener(aListeners
[i
], ::css::uno::UNO_QUERY
);
1583 (xListener
.get()->*pFn
)(aAwtEvent
);
1585 catch (::css::uno::RuntimeException
& rEx
)
1588 "VCLXToolkit::callTopWindowListeners: caught %s\n",
1589 ::rtl::OUStringToOString(
1590 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1597 long VCLXToolkit::callKeyHandlers(::VclSimpleEvent
const * pEvent
,
1600 ::css::uno::Sequence
< ::css::uno::Reference
< ::css::uno::XInterface
> >
1601 aHandlers(m_aKeyHandlers
.getElements());
1603 if (aHandlers
.hasElements())
1605 ::Window
* pWindow
= static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow();
1607 // See implementation in vclxwindow.cxx for mapping between VCL and UNO AWT event
1608 ::KeyEvent
* pKeyEvent
= static_cast< ::KeyEvent
* >(
1609 static_cast< ::VclWindowEvent
const * >(pEvent
)->GetData());
1610 ::css::awt::KeyEvent
aAwtEvent(
1611 static_cast< ::css::awt::XWindow
* >(pWindow
->GetWindowPeer()),
1612 (pKeyEvent
->GetKeyCode().IsShift()
1613 ? ::css::awt::KeyModifier::SHIFT
: 0)
1614 | (pKeyEvent
->GetKeyCode().IsMod1()
1615 ? ::css::awt::KeyModifier::MOD1
: 0)
1616 | (pKeyEvent
->GetKeyCode().IsMod2()
1617 ? ::css::awt::KeyModifier::MOD2
: 0)
1618 | (pKeyEvent
->GetKeyCode().IsMod3()
1619 ? ::css::awt::KeyModifier::MOD3
: 0),
1620 pKeyEvent
->GetKeyCode().GetCode(), pKeyEvent
->GetCharCode(),
1621 sal::static_int_cast
< sal_Int16
>(
1622 pKeyEvent
->GetKeyCode().GetFunction()));
1623 for (::sal_Int32 i
= 0; i
< aHandlers
.getLength(); ++i
)
1625 ::css::uno::Reference
< ::css::awt::XKeyHandler
> xHandler(
1626 aHandlers
[i
], ::css::uno::UNO_QUERY
);
1629 if ((bPressed
? xHandler
->keyPressed(aAwtEvent
)
1630 : xHandler
->keyReleased(aAwtEvent
)))
1633 catch (::css::uno::RuntimeException
& rEx
)
1636 "VCLXToolkit::callKeyHandlers: caught %s\n",
1637 ::rtl::OUStringToOString(
1638 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1645 void VCLXToolkit::callFocusListeners(::VclSimpleEvent
const * pEvent
,
1649 = static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow();
1650 if (pWindow
->IsTopWindow())
1652 ::css::uno::Sequence
< ::css::uno::Reference
< ::css::uno::XInterface
> >
1653 aListeners(m_aFocusListeners
.getElements());
1654 if (aListeners
.hasElements())
1656 // Ignore the interior of compound controls when determining the
1657 // window that gets the focus next (see implementation in
1658 // vclxwindow.cxx for mapping between VCL and UNO AWT event):
1659 ::css::uno::Reference
< css::uno::XInterface
> xNext
;
1660 ::Window
* pFocus
= ::Application::GetFocusWindow();
1661 for (::Window
* p
= pFocus
; p
!= 0; p
= p
->GetParent())
1662 if (!p
->IsCompoundControl())
1668 xNext
= pFocus
->GetComponentInterface(true);
1669 ::css::awt::FocusEvent
aAwtEvent(
1670 static_cast< ::css::awt::XWindow
* >(pWindow
->GetWindowPeer()),
1671 pWindow
->GetGetFocusFlags(), xNext
, false);
1672 for (::sal_Int32 i
= 0; i
< aListeners
.getLength(); ++i
)
1674 ::css::uno::Reference
< ::css::awt::XFocusListener
> xListener(
1675 aListeners
[i
], ::css::uno::UNO_QUERY
);
1678 bGained
? xListener
->focusGained(aAwtEvent
)
1679 : xListener
->focusLost(aAwtEvent
);
1681 catch (::css::uno::RuntimeException
& rEx
)
1684 "VCLXToolkit::callFocusListeners: caught %s\n",
1685 ::rtl::OUStringToOString(
1686 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1693 // css::awt::XReschedule:
1695 void SAL_CALL
VCLXToolkit::reschedule()
1696 throw (::com::sun::star::uno::RuntimeException
)
1698 Application::Reschedule(true);