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>
58 #include <toolkit/awt/vclxwindows.hxx>
59 #include <toolkit/awt/vclxsystemdependentwindow.hxx>
60 #include <toolkit/awt/vclxregion.hxx>
61 #include <toolkit/awt/vclxtoolkit.hxx>
63 #include <toolkit/awt/xsimpleanimation.hxx>
64 #include <toolkit/awt/xthrobber.hxx>
65 #include <toolkit/awt/vclxtopwindow.hxx>
66 #include <toolkit/awt/vclxwindow.hxx>
67 #include <toolkit/helper/vclunohelper.hxx>
68 #include <toolkit/helper/unowrapper.hxx>
69 #include <toolkit/helper/servicenames.hxx>
72 #include <toolkit/helper/macros.hxx>
73 #include <toolkit/helper/convert.hxx>
74 #include <vcl/unohelp.hxx>
75 #include <vcl/btndlg.hxx>
76 #ifndef _SV_BUTTON_HXX
77 #include <vcl/button.hxx>
79 #include <vcl/combobox.hxx>
80 #include <vcl/ctrl.hxx>
81 #include <vcl/dialog.hxx>
82 #include <vcl/dockingarea.hxx>
83 #include <vcl/dockwin.hxx>
84 #include <vcl/edit.hxx>
85 #include <vcl/field.hxx>
86 #include <vcl/fixed.hxx>
87 #include <vcl/floatwin.hxx>
88 #include <vcl/group.hxx>
89 #include <vcl/imgctrl.hxx>
90 #include <vcl/longcurr.hxx>
91 #include <vcl/lstbox.hxx>
92 #include <vcl/menubtn.hxx>
93 #include <vcl/morebtn.hxx>
94 #include <vcl/msgbox.hxx>
95 #include <vcl/scrbar.hxx>
96 #include <vcl/spin.hxx>
97 #include <vcl/split.hxx>
98 #include <vcl/splitwin.hxx>
99 #include <vcl/status.hxx>
100 #include <vcl/svapp.hxx>
101 #include <vcl/syschild.hxx>
102 #include <vcl/tabctrl.hxx>
103 #include <vcl/tabdlg.hxx>
104 #include <vcl/tabpage.hxx>
105 #include <vcl/toolbox.hxx>
106 #include <vcl/virdev.hxx>
107 #include <vcl/window.hxx>
108 #include <vcl/wrkwin.hxx>
109 #include "toolkit/awt/vclxspinbutton.hxx"
113 #include <Cocoa/Cocoa.h>
116 #include <vcl/sysdata.hxx>
117 #include <tools/debug.hxx>
118 #include <comphelper/processfactory.hxx>
120 namespace css
= ::com::sun::star
;
122 #define VCLWINDOW_FRAMEWINDOW 0x1000
123 #define VCLWINDOW_SYSTEMCHILDWINDOW 0x1001
126 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
128 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_OS2
129 #elif (defined QUARTZ)
130 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
132 #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
135 TOOLKIT_DLLPUBLIC WinBits
ImplGetWinBits( sal_uInt32 nComponentAttribs
, sal_uInt16 nCompType
)
137 WinBits nWinBits
= 0;
139 sal_Bool bMessBox
= sal_False
;
140 if ( ( nCompType
== WINDOW_INFOBOX
) ||
141 ( nCompType
== WINDOW_MESSBOX
) ||
142 ( nCompType
== WINDOW_QUERYBOX
) ||
143 ( nCompType
== WINDOW_WARNINGBOX
) ||
144 ( nCompType
== WINDOW_ERRORBOX
) )
149 bool bDecoratedWindow
= false;
151 || ( nCompType
== WINDOW_DIALOG
)
152 || ( nCompType
== WINDOW_MODELESSDIALOG
)
153 || ( nCompType
== WINDOW_MODALDIALOG
)
154 || ( nCompType
== WINDOW_SYSTEMDIALOG
)
155 || ( nCompType
== WINDOW_PATHDIALOG
)
156 || ( nCompType
== WINDOW_FILEDIALOG
)
157 || ( nCompType
== WINDOW_PRINTERSETUPDIALOG
)
158 || ( nCompType
== WINDOW_PRINTDIALOG
)
159 || ( nCompType
== WINDOW_COLORDIALOG
)
160 || ( nCompType
== WINDOW_FONTDIALOG
)
161 || ( nCompType
== WINDOW_DOCKINGWINDOW
)
162 || ( nCompType
== WINDOW_TABDIALOG
)
163 || ( nCompType
== WINDOW_BUTTONDIALOG
)
164 || ( nCompType
== WINDOW_SYSTEMCHILDWINDOW
)
167 bDecoratedWindow
= true;
170 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::BORDER
)
171 nWinBits
|= WB_BORDER
;
172 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER
)
173 nWinBits
|= WB_NOBORDER
;
174 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::SIZEABLE
)
175 nWinBits
|= WB_SIZEABLE
;
176 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::MOVEABLE
)
177 nWinBits
|= WB_MOVEABLE
;
178 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::CLOSEABLE
)
179 nWinBits
|= WB_CLOSEABLE
;
180 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL
)
181 nWinBits
|= WB_HSCROLL
;
182 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL
)
183 nWinBits
|= WB_VSCROLL
;
184 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::LEFT
)
186 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::CENTER
)
187 nWinBits
|= WB_CENTER
;
188 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT
)
189 nWinBits
|= WB_RIGHT
;
190 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::SPIN
)
192 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::SORT
)
194 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN
)
195 nWinBits
|= WB_DROPDOWN
;
196 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEFBUTTON
)
197 nWinBits
|= WB_DEFBUTTON
;
198 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::READONLY
)
199 nWinBits
|= WB_READONLY
;
200 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::CLIPCHILDREN
)
201 nWinBits
|= WB_CLIPCHILDREN
;
202 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::GROUP
)
203 nWinBits
|= WB_GROUP
;
204 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::NOLABEL
) //added for issue79712
205 nWinBits
|= WB_NOLABEL
;
207 // These bits are not uniqe
210 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::OK
)
212 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::OK_CANCEL
)
213 nWinBits
|= WB_OK_CANCEL
;
214 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO
)
215 nWinBits
|= WB_YES_NO
;
216 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO_CANCEL
)
217 nWinBits
|= WB_YES_NO_CANCEL
;
218 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::RETRY_CANCEL
)
219 nWinBits
|= WB_RETRY_CANCEL
;
220 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_OK
)
221 nWinBits
|= WB_DEF_OK
;
222 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_CANCEL
)
223 nWinBits
|= WB_DEF_CANCEL
;
224 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_RETRY
)
225 nWinBits
|= WB_DEF_RETRY
;
226 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_YES
)
227 nWinBits
|= WB_DEF_YES
;
228 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO
)
229 nWinBits
|= WB_DEF_NO
;
231 if ( nCompType
== WINDOW_MULTILINEEDIT
)
233 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL
)
234 nWinBits
|= WB_AUTOHSCROLL
;
235 if( nComponentAttribs
& ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL
)
236 nWinBits
|= WB_AUTOVSCROLL
;
240 if ( bDecoratedWindow
)
242 if( nComponentAttribs
& ::com::sun::star::awt::WindowAttribute::NODECORATION
)
244 // No decoration removes several window attributes and must
246 nWinBits
&= ~WB_BORDER
;
247 nWinBits
&= ~WB_SIZEABLE
;
248 nWinBits
&= ~WB_MOVEABLE
;
249 nWinBits
&= ~WB_CLOSEABLE
;
250 nWinBits
|= WB_NOBORDER
;
263 static ComponentInfo __FAR_DATA aComponentInfos
[] =
265 { "buttondialog", WINDOW_BUTTONDIALOG
},
266 { "cancelbutton", WINDOW_CANCELBUTTON
},
267 { "checkbox", WINDOW_CHECKBOX
},
268 { "combobox", WINDOW_COMBOBOX
},
269 { "control", WINDOW_CONTROL
},
270 { "currencybox", WINDOW_CURRENCYBOX
},
271 { "currencyfield", WINDOW_CURRENCYFIELD
},
272 { "datebox", WINDOW_DATEBOX
},
273 { "datefield", WINDOW_DATEFIELD
},
274 { "dialog", WINDOW_DIALOG
},
275 { "dockingarea", WINDOW_DOCKINGAREA
},
276 { "dockingwindow", WINDOW_DOCKINGWINDOW
},
277 { "edit", WINDOW_EDIT
},
278 { "errorbox", WINDOW_ERRORBOX
},
279 { "fixedbitmap", WINDOW_FIXEDBITMAP
},
280 { "fixedimage", WINDOW_FIXEDIMAGE
},
281 { "fixedline", WINDOW_FIXEDLINE
},
282 { "fixedtext", WINDOW_FIXEDTEXT
},
283 { "floatingwindow", WINDOW_FLOATINGWINDOW
},
284 { "framewindow", VCLWINDOW_FRAMEWINDOW
},
285 { "groupbox", WINDOW_GROUPBOX
},
286 { "helpbutton", WINDOW_HELPBUTTON
},
287 { "imagebutton", WINDOW_IMAGEBUTTON
},
288 { "imageradiobutton", WINDOW_IMAGERADIOBUTTON
},
289 { "infobox", WINDOW_INFOBOX
},
290 { "listbox", WINDOW_LISTBOX
},
291 { "longcurrencybox", WINDOW_LONGCURRENCYBOX
},
292 { "longcurrencyfield", WINDOW_LONGCURRENCYFIELD
},
293 { "menubutton", WINDOW_MENUBUTTON
},
294 { "messbox", WINDOW_MESSBOX
},
295 { "metricbox", WINDOW_METRICBOX
},
296 { "metricfield", WINDOW_METRICFIELD
},
297 { "modaldialog", WINDOW_MODALDIALOG
},
298 { "modelessdialog", WINDOW_MODELESSDIALOG
},
299 { "morebutton", WINDOW_MOREBUTTON
},
300 { "multilineedit", WINDOW_MULTILINEEDIT
},
301 { "multilistbox", WINDOW_MULTILISTBOX
},
302 { "numericbox", WINDOW_NUMERICBOX
},
303 { "numericfield", WINDOW_NUMERICFIELD
},
304 { "okbutton", WINDOW_OKBUTTON
},
305 { "patternbox", WINDOW_PATTERNBOX
},
306 { "patternfield", WINDOW_PATTERNFIELD
},
307 { "pushbutton", WINDOW_PUSHBUTTON
},
308 { "querybox", WINDOW_QUERYBOX
},
309 { "radiobutton", WINDOW_RADIOBUTTON
},
310 { "scrollbar", WINDOW_SCROLLBAR
},
311 { "scrollbarbox", WINDOW_SCROLLBARBOX
},
312 { "simpleanimation", WINDOW_CONTROL
},
313 { "spinbutton", WINDOW_SPINBUTTON
},
314 { "spinfield", WINDOW_SPINFIELD
},
315 { "throbber", WINDOW_CONTROL
},
316 { "splitter", WINDOW_SPLITTER
},
317 { "splitwindow", WINDOW_SPLITWINDOW
},
318 { "statusbar", WINDOW_STATUSBAR
},
319 { "systemchildwindow", VCLWINDOW_SYSTEMCHILDWINDOW
},
320 { "tabcontrol", WINDOW_TABCONTROL
},
321 { "tabdialog", WINDOW_TABDIALOG
},
322 { "tabpage", WINDOW_TABPAGE
},
323 { "timebox", WINDOW_TIMEBOX
},
324 { "timefield", WINDOW_TIMEFIELD
},
325 { "toolbox", WINDOW_TOOLBOX
},
326 { "tristatebox", WINDOW_TRISTATEBOX
},
327 { "warningbox", WINDOW_WARNINGBOX
},
328 { "window", WINDOW_WINDOW
},
329 { "workwindow", WINDOW_WORKWINDOW
}
338 #if defined( ICC ) && defined( OS2 )
341 ComponentInfoCompare( const void* pFirst
, const void* pSecond
)
343 return( strcmp( ((ComponentInfo
*)pFirst
)->pName
,
344 ((ComponentInfo
*)pSecond
)->pName
) );
348 sal_uInt16
ImplGetComponentType( const String
& rServiceName
)
350 static sal_Bool bSorted
= sal_False
;
353 qsort( (void*) aComponentInfos
,
354 sizeof( aComponentInfos
) / sizeof( ComponentInfo
),
355 sizeof( ComponentInfo
),
356 ComponentInfoCompare
);
361 ComponentInfo aSearch
;
362 ByteString
aServiceName( rServiceName
, gsl_getSystemTextEncoding() );
363 aServiceName
.ToLowerAscii();
364 if ( aServiceName
.Len() )
365 aSearch
.pName
= aServiceName
.GetBuffer();
367 aSearch
.pName
= "window";
369 ComponentInfo
* pInf
= (ComponentInfo
*) bsearch( &aSearch
,
370 (void*) aComponentInfos
,
371 sizeof( aComponentInfos
) / sizeof( ComponentInfo
),
372 sizeof( ComponentInfo
),
373 ComponentInfoCompare
);
375 return pInf
? pInf
->nWinType
: 0;
379 // ----------------------------------------------------
381 // ----------------------------------------------------
383 static sal_Int32 nVCLToolkitInstanceCount
= 0;
384 static BOOL bInitedByVCLToolkit
= sal_False
;
385 //static cppu::OInterfaceContainerHelper * pToolkits = 0;
387 static osl::Mutex
& getInitMutex()
389 static osl::Mutex
* pM
;
392 osl::Guard
< osl::Mutex
> aGuard( osl::Mutex::getGlobalMutex() );
395 static osl::Mutex aMutex
;
402 static osl::Condition
& getInitCondition()
404 static osl::Condition
* pC
= 0;
407 osl::Guard
< osl::Mutex
> aGuard( osl::Mutex::getGlobalMutex() );
410 static osl::Condition aCondition
;
417 struct ToolkitThreadData
420 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xSMgr
;
422 ToolkitThreadData( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & rSMgr
, VCLXToolkit
* pTk_
)
431 static void SAL_CALL
ToolkitWorkerFunction( void* pArgs
)
433 ToolkitThreadData
* pTTD
= (ToolkitThreadData
*)pArgs
;
434 bInitedByVCLToolkit
= InitVCL( pTTD
->xSMgr
);
435 if( bInitedByVCLToolkit
)
437 UnoWrapper
* pUnoWrapper
= new UnoWrapper( pTTD
->pTk
);
438 Application::SetUnoWrapper( pUnoWrapper
);
440 getInitCondition().set();
441 if( bInitedByVCLToolkit
)
444 osl::Guard
< vos::IMutex
> aGuard( Application::GetSolarMutex() );
445 Application::Execute();
449 pTTD
->pTk
->dispose();
451 catch( com::sun::star::uno::Exception
& )
457 cppu::OInterfaceIteratorHelper aIt( *pToolkits );
458 ::com::sun::star::uno::XInterface * pI;
459 while( pI = aIt.next() )
460 ((::com::sun::star::lang::XComponent *)pI)->dispose();
462 // delete toolkit container
463 osl::Guard< osl::Mutex > aGuard( getInitMutex() );
472 JoinMainLoopThread();
478 // contructor, which might initialize VCL
479 VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & rSMgr
):
480 cppu::WeakComponentImplHelper7
<
481 ::com::sun::star::awt::XToolkit
,
482 ::com::sun::star::lang::XServiceInfo
,
483 ::com::sun::star::awt::XSystemChildFactory
,
484 ::com::sun::star::awt::XMessageBoxFactory
,
485 ::com::sun::star::awt::XDataTransferProviderAccess
,
486 ::com::sun::star::awt::XExtendedToolkit
,
487 ::com::sun::star::awt::XReschedule
>( GetMutex() ),
488 m_aTopWindowListeners(rBHelper
.rMutex
),
489 m_aKeyHandlers(rBHelper
.rMutex
),
490 m_aFocusListeners(rBHelper
.rMutex
),
491 m_aEventListenerLink(LINK(this, VCLXToolkit
, eventListenerHandler
)),
492 m_aKeyListenerLink(LINK(this, VCLXToolkit
, keyListenerHandler
)),
493 m_bEventListener(false),
494 m_bKeyListener(false)
497 fnSvtCreateWindow
= NULL
;
499 osl::Guard
< osl::Mutex
> aGuard( getInitMutex() );
500 nVCLToolkitInstanceCount
++;
501 if( ( nVCLToolkitInstanceCount
== 1 ) && ( !Application::IsInMain() ) )
503 // setup execute thread
504 CreateMainLoopThread( ToolkitWorkerFunction
, new ToolkitThreadData( rSMgr
, this ) );
505 getInitCondition().wait();
507 if( bInitedByVCLToolkit )
509 // insert in disposing list
511 pToolkits = new cppu::OInterfaceContainerHelper( getInitMutex() );
512 pToolkits->addInterface( (::com::sun::star::lang::XComponent *)this );
518 VCLXToolkit::~VCLXToolkit()
523 void SAL_CALL
VCLXToolkit::disposing()
527 osl_unloadModule( hSvToolsLib
);
529 fnSvtCreateWindow
= NULL
;
533 osl::Guard
< osl::Mutex
> aGuard( getInitMutex() );
534 if( --nVCLToolkitInstanceCount
== 0 )
536 if( bInitedByVCLToolkit
)
539 JoinMainLoopThread();
540 bInitedByVCLToolkit
= sal_False
;
545 if (m_bEventListener
)
547 ::Application::RemoveEventListener(m_aEventListenerLink
);
548 m_bEventListener
= false;
552 ::Application::RemoveKeyListener(m_aKeyListenerLink
);
553 m_bKeyListener
= false;
555 ::css::lang::EventObject
aEvent(
556 static_cast< ::cppu::OWeakObject
* >(this));
557 m_aTopWindowListeners
.disposeAndClear(aEvent
);
558 m_aKeyHandlers
.disposeAndClear(aEvent
);
559 m_aFocusListeners
.disposeAndClear(aEvent
);
562 osl::Guard< osl::Mutex > aGuard( getInitMutex() );
563 // insert in disposing list
566 // remove from the disposing list
567 pToolkits->removeInterface( (::com::sun::star::lang::XComponent *)this );
573 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> VCLXToolkit::getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException
)
575 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> xRef
;
576 // 07/00: AppWindow doesn't exist anymore...
580 ::com::sun::star::awt::Rectangle
VCLXToolkit::getWorkArea( ) throw(::com::sun::star::uno::RuntimeException
)
582 ::com::sun::star::awt::Rectangle aRect
;
583 // 07/00: AppWindow doesn't exist anymore...
587 ::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
)
589 return ImplCreateWindow( rDescriptor
, WinBits(0) );
592 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDevice
> VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width
, sal_Int32 Height
) throw(::com::sun::star::uno::RuntimeException
)
594 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
596 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDevice
> xRef
;
597 VCLXVirtualDevice
* pVDev
= new VCLXVirtualDevice
;
599 osl::Guard
< vos::IMutex
> aSolarGuard( Application::GetSolarMutex() );
601 VirtualDevice
* pV
= new VirtualDevice
;
602 pV
->SetOutputSizePixel( Size( Width
, Height
) );
603 pVDev
->SetVirtualDevice( pV
);
609 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XRegion
> VCLXToolkit::createRegion( ) throw(::com::sun::star::uno::RuntimeException
)
611 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
613 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XRegion
> xRef
= new VCLXRegion
;
617 Window
* VCLXToolkit::ImplCreateWindow( VCLXWindow
** ppNewComp
,
618 const ::com::sun::star::awt::WindowDescriptor
& rDescriptor
,
619 Window
* pParent
, WinBits nWinBits
)
621 String
aServiceName( rDescriptor
.WindowServiceName
);
622 aServiceName
.ToLowerAscii();
624 Window
* pNewWindow
= NULL
;
625 sal_uInt16 nType
= ImplGetComponentType( aServiceName
);
629 // Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
630 // spaeter mal ::com::sun::star::uno::Exception...
631 sal_Bool bException
= sal_True
;
632 if ( ( nType
== WINDOW_DIALOG
) || ( nType
== WINDOW_MODALDIALOG
) || ( nType
== WINDOW_MODELESSDIALOG
) )
633 bException
= sal_False
;
634 else if ( ( nType
== WINDOW_WINDOW
) ||
635 ( nType
== WINDOW_WORKWINDOW
) ||
636 ( nType
== VCLWINDOW_FRAMEWINDOW
) )
638 if ( rDescriptor
.Type
== ::com::sun::star::awt::WindowClass_TOP
)
639 bException
= sal_False
;
651 NAMESPACE_VOS(OGuard
) aVclGuard( Application::GetSolarMutex() );
652 switch ( (WindowType
)nType
)
654 case WINDOW_CANCELBUTTON
:
655 pNewWindow
= new CancelButton( pParent
, nWinBits
);
656 *ppNewComp
= new VCLXButton
;
658 case WINDOW_CHECKBOX
:
659 pNewWindow
= new CheckBox( pParent
, nWinBits
);
660 *ppNewComp
= new VCLXCheckBox
;
662 case WINDOW_COMBOBOX
:
663 pNewWindow
= new ComboBox( pParent
, nWinBits
|WB_AUTOHSCROLL
);
664 ((ComboBox
*)pNewWindow
)->EnableAutoSize( sal_False
);
665 *ppNewComp
= new VCLXComboBox
;
667 case WINDOW_CURRENCYBOX
:
668 pNewWindow
= new CurrencyBox( pParent
, nWinBits
);
670 case WINDOW_CURRENCYFIELD
:
671 pNewWindow
= new CurrencyField( pParent
, nWinBits
);
672 static_cast<CurrencyField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
673 *ppNewComp
= new VCLXNumericField
;
674 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(CurrencyField
*)pNewWindow
);
677 pNewWindow
= new DateBox( pParent
, nWinBits
);
679 case WINDOW_DATEFIELD
:
680 pNewWindow
= new DateField( pParent
, nWinBits
);
681 static_cast<DateField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
682 *ppNewComp
= new VCLXDateField
;
683 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(DateField
*)pNewWindow
);
685 case WINDOW_DOCKINGAREA
:
686 pNewWindow
= new DockingAreaWindow( pParent
);
688 case WINDOW_MULTILINEEDIT
:
690 pNewWindow
= new Edit( pParent
, nWinBits
);
691 *ppNewComp
= new VCLXEdit
;
693 case WINDOW_ERRORBOX
:
694 pNewWindow
= new ErrorBox( pParent
, nWinBits
, String() );
695 *ppNewComp
= new VCLXMessageBox
;
697 case WINDOW_FIXEDBITMAP
:
698 pNewWindow
= new FixedBitmap( pParent
, nWinBits
);
700 case WINDOW_FIXEDIMAGE
:
701 pNewWindow
= new ImageControl( pParent
, nWinBits
);
702 *ppNewComp
= new VCLXImageControl
;
704 case WINDOW_FIXEDLINE
:
705 pNewWindow
= new FixedLine( pParent
, nWinBits
);
707 case WINDOW_FIXEDTEXT
:
708 pNewWindow
= new FixedText( pParent
, nWinBits
);
709 *ppNewComp
= new VCLXFixedText
;
711 case WINDOW_FLOATINGWINDOW
:
712 pNewWindow
= new FloatingWindow( pParent
, nWinBits
);
714 case WINDOW_GROUPBOX
:
715 pNewWindow
= new GroupBox( pParent
, nWinBits
);
717 case WINDOW_HELPBUTTON
:
718 pNewWindow
= new HelpButton( pParent
, nWinBits
);
719 *ppNewComp
= new VCLXButton
;
721 case WINDOW_IMAGEBUTTON
:
722 pNewWindow
= new ImageButton( pParent
, nWinBits
);
723 *ppNewComp
= new VCLXButton
;
725 case WINDOW_IMAGERADIOBUTTON
:
726 pNewWindow
= new ImageRadioButton( pParent
, nWinBits
);
727 *ppNewComp
= new VCLXButton
;
730 pNewWindow
= new InfoBox( pParent
, String() );
731 *ppNewComp
= new VCLXMessageBox
;
734 pNewWindow
= new ListBox( pParent
, nWinBits
|WB_SIMPLEMODE
|WB_AUTOHSCROLL
);
735 ((ListBox
*)pNewWindow
)->EnableAutoSize( sal_False
);
736 *ppNewComp
= new VCLXListBox
;
738 case WINDOW_LONGCURRENCYBOX
:
739 pNewWindow
= new LongCurrencyBox( pParent
, nWinBits
);
741 case WINDOW_LONGCURRENCYFIELD
:
742 pNewWindow
= new LongCurrencyField( pParent
, nWinBits
);
743 *ppNewComp
= new VCLXCurrencyField
;
744 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(LongCurrencyField
*)pNewWindow
);
746 case WINDOW_MENUBUTTON
:
747 pNewWindow
= new MenuButton( pParent
, nWinBits
);
748 *ppNewComp
= new VCLXButton
;
751 pNewWindow
= new MessBox( pParent
, nWinBits
, String(), String() );
752 *ppNewComp
= new VCLXMessageBox
;
754 case WINDOW_METRICBOX
:
755 pNewWindow
= new MetricBox( pParent
, nWinBits
);
757 case WINDOW_METRICFIELD
:
758 pNewWindow
= new MetricField( pParent
, nWinBits
);
759 *ppNewComp
= new VCLXMetricField
;
760 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(MetricField
*)pNewWindow
);
763 case WINDOW_MODALDIALOG
:
764 case WINDOW_MODELESSDIALOG
:
766 // Modal/Modeless nur durch Show/Execute
767 if ( (pParent
== NULL
) && ( rDescriptor
.ParentIndex
== -1 ) )
768 pParent
= DIALOG_NO_PARENT
;
769 pNewWindow
= new Dialog( pParent
, nWinBits
);
770 *ppNewComp
= new VCLXDialog
;
773 case WINDOW_MOREBUTTON
:
774 pNewWindow
= new MoreButton( pParent
, nWinBits
);
775 *ppNewComp
= new VCLXButton
;
777 case WINDOW_MULTILISTBOX
:
778 pNewWindow
= new MultiListBox( pParent
, nWinBits
);
779 *ppNewComp
= new VCLXListBox
;
781 case WINDOW_NUMERICBOX
:
782 pNewWindow
= new NumericBox( pParent
, nWinBits
);
784 case WINDOW_NUMERICFIELD
:
785 pNewWindow
= new NumericField( pParent
, nWinBits
);
786 static_cast<NumericField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
787 *ppNewComp
= new VCLXNumericField
;
788 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(NumericField
*)pNewWindow
);
790 case WINDOW_OKBUTTON
:
791 pNewWindow
= new OKButton( pParent
, nWinBits
);
792 *ppNewComp
= new VCLXButton
;
794 case WINDOW_PATTERNBOX
:
795 pNewWindow
= new PatternBox( pParent
, nWinBits
);
797 case WINDOW_PATTERNFIELD
:
798 pNewWindow
= new PatternField( pParent
, nWinBits
);
799 *ppNewComp
= new VCLXPatternField
;
800 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(PatternField
*)pNewWindow
);
802 case WINDOW_PUSHBUTTON
:
803 pNewWindow
= new PushButton( pParent
, nWinBits
);
804 *ppNewComp
= new VCLXButton
;
806 case WINDOW_QUERYBOX
:
807 pNewWindow
= new QueryBox( pParent
, nWinBits
, String() );
808 *ppNewComp
= new VCLXMessageBox
;
810 case WINDOW_RADIOBUTTON
:
811 pNewWindow
= new RadioButton( pParent
, nWinBits
);
812 *ppNewComp
= new VCLXRadioButton
;
814 // by default, disable RadioCheck
815 // Since the VCLXRadioButton really cares for it's RadioCheck settings, this is important:
816 // if we enable it, the VCLXRadioButton will use RadioButton::Check instead of RadioButton::SetState
817 // This leads to a strange behaviour if the control is newly created: when settings the initial
818 // state to "checked", the RadioButton::Check (called because RadioCheck=TRUE) will uncheck
819 // _all_other_ radio buttons in the same group. However, at this moment the grouping of the controls
820 // is not really valid: the controls are grouped after they have been created, but we're still in
821 // the creation process, so the RadioButton::Check relies on invalid grouping information.
822 // 07.08.2001 - #87254# - frank.schoenheit@sun.com
823 static_cast<RadioButton
*>(pNewWindow
)->EnableRadioCheck( FALSE
);
825 case WINDOW_SCROLLBAR
:
826 pNewWindow
= new ScrollBar( pParent
, nWinBits
);
827 *ppNewComp
= new VCLXScrollBar
;
829 case WINDOW_SCROLLBARBOX
:
830 pNewWindow
= new ScrollBarBox( pParent
, nWinBits
);
832 case WINDOW_SPINBUTTON
:
833 pNewWindow
= new SpinButton( pParent
, nWinBits
);
834 *ppNewComp
= new ::toolkit::VCLXSpinButton
;
836 case WINDOW_SPINFIELD
:
837 pNewWindow
= new SpinField( pParent
, nWinBits
);
838 *ppNewComp
= new VCLXNumericField
;
840 case WINDOW_SPLITTER
:
841 pNewWindow
= new Splitter( pParent
, nWinBits
);
843 case WINDOW_SPLITWINDOW
:
844 pNewWindow
= new SplitWindow( pParent
, nWinBits
);
846 case WINDOW_STATUSBAR
:
847 pNewWindow
= new StatusBar( pParent
, nWinBits
);
849 case VCLWINDOW_SYSTEMCHILDWINDOW
:
850 pNewWindow
= new SystemChildWindow( pParent
, nWinBits
);
851 *ppNewComp
= new VCLXSystemDependentWindow();
853 case WINDOW_TABCONTROL
:
854 pNewWindow
= new TabControl( pParent
, nWinBits
);
856 case WINDOW_TABDIALOG
:
857 pNewWindow
= new TabDialog( pParent
, nWinBits
);
860 pNewWindow
= new TabPage( pParent
, nWinBits
);
861 *ppNewComp
= new VCLXTabPage
;
864 pNewWindow
= new TimeBox( pParent
, nWinBits
);
866 case WINDOW_TIMEFIELD
:
867 pNewWindow
= new TimeField( pParent
, nWinBits
);
868 static_cast<TimeField
*>(pNewWindow
)->EnableEmptyFieldValue( TRUE
);
869 *ppNewComp
= new VCLXTimeField
;
870 ((VCLXFormattedSpinField
*)*ppNewComp
)->SetFormatter( (FormatterBase
*)(TimeField
*)pNewWindow
);
873 pNewWindow
= new ToolBox( pParent
, nWinBits
);
874 *ppNewComp
= new VCLXToolBox
;
876 case WINDOW_TRISTATEBOX
:
877 pNewWindow
= new TriStateBox( pParent
, nWinBits
);
879 case WINDOW_WARNINGBOX
:
880 pNewWindow
= new WarningBox( pParent
, nWinBits
, String() );
881 *ppNewComp
= new VCLXMessageBox
;
883 case WINDOW_WORKWINDOW
:
885 case VCLWINDOW_FRAMEWINDOW
:
886 case WINDOW_DOCKINGWINDOW
:
887 if ( rDescriptor
.Type
== ::com::sun::star::awt::WindowClass_TOP
)
889 if (nType
== WINDOW_DOCKINGWINDOW
)
890 pNewWindow
= new DockingWindow( pParent
, nWinBits
);
893 if ((pParent
== NULL
) && rDescriptor
.Parent
.is())
895 // try to get a system dependent window handle
896 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSystemDependentWindowPeer
> xSystemDepParent(rDescriptor
.Parent
, ::com::sun::star::uno::UNO_QUERY
);
898 if (xSystemDepParent
.is())
900 sal_Int8 processID
[16];
902 rtl_getGlobalProcessId( (sal_uInt8
*)processID
);
904 ::com::sun::star::uno::Sequence
<sal_Int8
> processIdSeq(processID
, 16);
906 ::com::sun::star::uno::Any anyHandle
= xSystemDepParent
->getWindowHandle(processIdSeq
, SYSTEM_DEPENDENT_TYPE
);
908 // use sal_Int64 here to accomodate all int types
909 // uno::Any shift operator whill upcast if necessary
910 sal_Int64 nWindowHandle
= 0;
911 sal_Bool bXEmbed
= sal_False
;
913 bool bUseParentData
= true;
914 if( ! (anyHandle
>>= nWindowHandle
) )
916 css::uno::Sequence
< css::beans::NamedValue
> aProps
;
917 if( anyHandle
>>= aProps
)
919 const int nProps
= aProps
.getLength();
920 const css::beans::NamedValue
* pProps
= aProps
.getConstArray();
921 for( int i
= 0; i
< nProps
; i
++ )
923 if( pProps
[i
].Name
.equalsAscii( "WINDOW" ) )
924 pProps
[i
].Value
>>= nWindowHandle
;
925 else if( pProps
[i
].Name
.equalsAscii( "XEMBED" ) )
926 pProps
[i
].Value
>>= bXEmbed
;
930 bUseParentData
= false;
935 SystemParentData aParentData
;
936 aParentData
.nSize
= sizeof( aParentData
);
938 aParentData
.pView
= reinterpret_cast<NSView
*>(nWindowHandle
);
940 aParentData
.aWindow
= nWindowHandle
;
941 aParentData
.bXEmbedSupport
= bXEmbed
;
943 aParentData
.hWnd
= reinterpret_cast<HWND
>(nWindowHandle
);
945 aParentData
.hWnd
= (HWND
)nWindowHandle
;
947 pNewWindow
= new WorkWindow( &aParentData
);
953 pNewWindow
= new WorkWindow( pParent
, nWinBits
);
956 *ppNewComp
= new VCLXTopWindow( pNewWindow
->GetType() == WINDOW_WORKWINDOW
);
958 else if ( rDescriptor
.Type
== ::com::sun::star::awt::WindowClass_CONTAINER
)
960 if (nType
== WINDOW_DOCKINGWINDOW
)
961 pNewWindow
= new DockingWindow( pParent
, nWinBits
);
963 pNewWindow
= new Window( pParent
, nWinBits
);
964 *ppNewComp
= new VCLXContainer
;
968 if (nType
== WINDOW_DOCKINGWINDOW
)
969 pNewWindow
= new DockingWindow( pParent
, nWinBits
);
971 pNewWindow
= new Window( pParent
, nWinBits
);
972 *ppNewComp
= new VCLXWindow
;
976 if ( rDescriptor
.WindowServiceName
.equalsIgnoreAsciiCase(
977 ::rtl::OUString::createFromAscii("simpleanimation") ) )
979 nWinBits
|= WB_SCALE
;
980 pNewWindow
= new FixedImage( pParent
, nWinBits
);
981 *ppNewComp
= new ::toolkit::XSimpleAnimation
;
983 else if ( rDescriptor
.WindowServiceName
.equalsIgnoreAsciiCase(
984 ::rtl::OUString::createFromAscii("throbber") ) )
986 nWinBits
|= WB_SCALE
;
987 pNewWindow
= new FixedImage( pParent
, nWinBits
);
988 *ppNewComp
= new ::toolkit::XThrobber
;
991 default: DBG_ERRORFILE( "UNO3!" );
998 extern "C" { static void SAL_CALL
thisModule() {} }
1000 css::uno::Reference
< css::awt::XWindowPeer
> VCLXToolkit::ImplCreateWindow(
1001 const css::awt::WindowDescriptor
& rDescriptor
,
1002 WinBits nForceWinBits
)
1004 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
1006 osl::Guard
< vos::IMutex
> aSolarGuard( Application::GetSolarMutex() );
1008 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> xRef
;
1010 Window
* pParent
= NULL
;
1011 if ( rDescriptor
.Parent
.is() )
1013 VCLXWindow
* pParentComponent
= VCLXWindow::GetImplementation( rDescriptor
.Parent
);
1015 // #103939# Don't through assertion, may be it's a system dependend window, used in ImplCreateWindow.
1016 // DBG_ASSERT( pParentComponent, "ParentComponent not valid" );
1018 if ( pParentComponent
)
1019 pParent
= pParentComponent
->GetWindow();
1022 WinBits nWinBits
= ImplGetWinBits( rDescriptor
.WindowAttributes
,
1023 ImplGetComponentType( rDescriptor
.WindowServiceName
) );
1024 nWinBits
|= nForceWinBits
;
1026 VCLXWindow
* pNewComp
= NULL
;
1028 Window
* pNewWindow
= NULL
;
1029 // Try to create the window with SvTools
1030 // (do this _before_ creating it on our own: The old mechanism (extended toolkit in SvTools) did it this way,
1031 // and we need to stay compatible)
1032 // try to load the lib
1033 if ( !fnSvtCreateWindow
&& !hSvToolsLib
)
1035 ::rtl::OUString aLibName
= ::vcl::unohelper::CreateLibraryName( "svt", TRUE
);
1036 hSvToolsLib
= osl_loadModuleRelative(
1037 &thisModule
, aLibName
.pData
, SAL_LOADMODULE_DEFAULT
);
1040 ::rtl::OUString
aFunctionName( RTL_CONSTASCII_USTRINGPARAM( "CreateWindow" ) );
1041 fnSvtCreateWindow
= (FN_SvtCreateWindow
)osl_getFunctionSymbol( hSvToolsLib
, aFunctionName
.pData
);
1044 // ask the SvTool creation function
1045 if ( fnSvtCreateWindow
)
1046 pNewWindow
= fnSvtCreateWindow( &pNewComp
, &rDescriptor
, pParent
, nWinBits
);
1048 // if SvTools could not provide a window, create it ourself
1050 pNewWindow
= ImplCreateWindow( &pNewComp
, rDescriptor
, pParent
, nWinBits
);
1052 DBG_ASSERT( pNewWindow
, "createWindow: Unknown Component!" );
1053 DBG_ASSERTWARNING( pNewComp
, "createWindow: No special Interface!" );
1057 pNewWindow
->SetCreatedWithToolkit( sal_True
);
1058 //pNewWindow->SetPosPixel( Point() ); // do not force (0,0) position, keep default pos instead
1060 if ( rDescriptor
.WindowAttributes
& ::com::sun::star::awt::WindowAttribute::MINSIZE
)
1062 pNewWindow
->SetSizePixel( Size() );
1064 else if ( rDescriptor
.WindowAttributes
& ::com::sun::star::awt::WindowAttribute::FULLSIZE
)
1067 pNewWindow
->SetSizePixel( pParent
->GetOutputSizePixel() );
1069 else if ( !VCLUnoHelper::IsZero( rDescriptor
.Bounds
) )
1071 Rectangle aRect
= VCLRectangle( rDescriptor
.Bounds
);
1072 pNewWindow
->SetPosSizePixel( aRect
.TopLeft(), aRect
.GetSize() );
1077 // Default-Interface
1078 xRef
= pNewWindow
->GetComponentInterface( sal_True
);
1082 pNewComp
->SetCreatedWithToolkit( TRUE
);
1084 pNewWindow
->SetComponentInterface( xRef
);
1086 DBG_ASSERT( pNewWindow
->GetComponentInterface( FALSE
) == xRef
,
1087 "VCLXToolkit::createWindow: did #133706# resurge?" );
1089 if ( rDescriptor
.WindowAttributes
& ::com::sun::star::awt::WindowAttribute::SHOW
)
1096 ::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
)
1098 ::osl::Guard
< ::osl::Mutex
> aGuard( GetMutex() );
1100 sal_uInt32 nComponents
= rDescriptors
.getLength();
1101 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> > aSeq( nComponents
);
1102 for ( sal_uInt32 n
= 0; n
< nComponents
; n
++ )
1104 ::com::sun::star::awt::WindowDescriptor aDescr
= rDescriptors
.getConstArray()[n
];
1106 if ( aDescr
.ParentIndex
== (-1) )
1107 aDescr
.Parent
= NULL
;
1108 else if ( ( aDescr
.ParentIndex
>= 0 ) && ( aDescr
.ParentIndex
< (short)n
) )
1109 aDescr
.Parent
= aSeq
.getConstArray()[aDescr
.ParentIndex
];
1110 aSeq
.getArray()[n
] = createWindow( aDescr
);
1115 // ::com::sun::star::awt::XSystemChildFactory
1116 ::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
)
1118 Window
* pChildWindow
= NULL
;
1119 if ( nSystemType
== SYSTEM_DEPENDENT_TYPE
)
1121 // use sal_Int64 here to accomodate all int types
1122 // uno::Any shift operator whill upcast if necessary
1123 sal_Int64 nWindowHandle
= 0;
1124 sal_Bool bXEmbed
= sal_False
;
1126 bool bUseParentData
= true;
1127 if( ! (Parent
>>= nWindowHandle
) )
1129 css::uno::Sequence
< css::beans::NamedValue
> aProps
;
1130 if( Parent
>>= aProps
)
1132 const int nProps
= aProps
.getLength();
1133 const css::beans::NamedValue
* pProps
= aProps
.getConstArray();
1134 for( int i
= 0; i
< nProps
; i
++ )
1136 if( pProps
[i
].Name
.equalsAscii( "WINDOW" ) )
1137 pProps
[i
].Value
>>= nWindowHandle
;
1138 else if( pProps
[i
].Name
.equalsAscii( "XEMBED" ) )
1139 pProps
[i
].Value
>>= bXEmbed
;
1143 bUseParentData
= false;
1146 if( bUseParentData
)
1148 SystemParentData aParentData
;
1149 aParentData
.nSize
= sizeof( aParentData
);
1151 aParentData
.pView
= reinterpret_cast<NSView
*>(nWindowHandle
);
1153 aParentData
.aWindow
= nWindowHandle
;
1154 aParentData
.bXEmbedSupport
= bXEmbed
;
1156 aParentData
.hWnd
= reinterpret_cast<HWND
>(nWindowHandle
);
1158 aParentData
.hWnd
= (HWND
)nWindowHandle
;
1160 osl::Guard
< vos::IMutex
> aGuard( Application::GetSolarMutex() );
1163 pChildWindow
= new WorkWindow( &aParentData
);
1165 catch ( ::com::sun::star::uno::RuntimeException
& rEx
)
1167 // system child window could not be created
1169 "VCLXToolkit::createSystemChild: caught %s\n",
1170 ::rtl::OUStringToOString(
1171 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1172 pChildWindow
= NULL
;
1176 else if (nSystemType
== com::sun::star::lang::SystemDependent::SYSTEM_JAVA
)
1178 osl::Guard
< vos::IMutex
> aGuard(Application::GetSolarMutex());
1179 pChildWindow
= new WorkWindow(0, Parent
);
1182 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> xPeer
;
1185 VCLXTopWindow
* pPeer
= new VCLXTopWindow(true);
1186 osl::Guard
< vos::IMutex
> aGuard( Application::GetSolarMutex() );
1187 pPeer
->SetWindow( pChildWindow
);
1194 // ::com::sun::star::awt::XMessageBoxFactory
1195 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMessageBox
> SAL_CALL
VCLXToolkit::createMessageBox(
1196 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& aParent
,
1197 const ::com::sun::star::awt::Rectangle
& aPosSize
,
1198 const ::rtl::OUString
& aType
,
1199 ::sal_Int32 aButtons
,
1200 const ::rtl::OUString
& aTitle
,
1201 const ::rtl::OUString
& aMessage
) throw (::com::sun::star::uno::RuntimeException
)
1203 ::com::sun::star::awt::WindowDescriptor aDescriptor
;
1205 sal_Int32 nWindowAttributes
= css::awt::WindowAttribute::BORDER
|css::awt::WindowAttribute::MOVEABLE
|css::awt::WindowAttribute::CLOSEABLE
;
1207 // Map button definitions to window attributes
1208 if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_OK
)
1209 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::OK
;
1210 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_OK_CANCEL
)
1211 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::OK_CANCEL
;
1212 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_YES_NO
)
1213 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::YES_NO
;
1214 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_YES_NO_CANCEL
)
1215 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::YES_NO_CANCEL
;
1216 else if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_RETRY_CANCEL
)
1217 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::RETRY_CANCEL
;
1219 // Map default button definitions to window attributes
1220 if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_OK
)
1221 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_OK
;
1222 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_CANCEL
)
1223 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_CANCEL
;
1224 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_YES
)
1225 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_YES
;
1226 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_NO
)
1227 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_NO
;
1228 else if (sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_RETRY
)
1229 nWindowAttributes
|= css::awt::VclWindowPeerAttribute::DEF_RETRY
;
1231 // No more bits for VclWindowPeerAttribute possible. Mapping must be
1232 // done explicitly using VCL methods
1233 WinBits
nAddWinBits( 0 );
1234 if (( aButtons
& 0x0000ffffL
) == css::awt::MessageBoxButtons::BUTTONS_ABORT_IGNORE_RETRY
)
1235 nAddWinBits
|= WB_ABORT_RETRY_IGNORE
;
1236 if ( sal_Int32( aButtons
& 0xffff0000L
) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_IGNORE
)
1237 nAddWinBits
|= WB_DEF_IGNORE
;
1239 aDescriptor
.Type
= css::awt::WindowClass_MODALTOP
;
1240 aDescriptor
.WindowServiceName
= aType
;
1241 aDescriptor
.ParentIndex
= -1;
1242 aDescriptor
.Parent
= aParent
;
1243 aDescriptor
.Bounds
= aPosSize
;
1244 aDescriptor
.WindowAttributes
= nWindowAttributes
;
1245 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMessageBox
> xMsgBox(
1246 ImplCreateWindow( aDescriptor
, nAddWinBits
), css::uno::UNO_QUERY
);
1247 css::uno::Reference
< css::awt::XWindow
> xWindow( xMsgBox
, css::uno::UNO_QUERY
);
1248 if ( xMsgBox
.is() && xWindow
.is() )
1250 Window
* pWindow
= VCLUnoHelper::GetWindow( xWindow
);
1253 osl::Guard
< vos::IMutex
> aGuard(Application::GetSolarMutex());
1254 xMsgBox
->setCaptionText( aTitle
);
1255 xMsgBox
->setMessageText( aMessage
);
1262 ::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
)
1264 Window
* pWindow
= VCLUnoHelper::GetWindow( window
);
1267 return pWindow
->GetDragGestureRecognizer();
1269 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer
>();
1272 ::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
)
1274 Window
* pWindow
= VCLUnoHelper::GetWindow( window
);
1277 return pWindow
->GetDragSource();
1279 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragSource
>();
1282 ::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
)
1284 Window
* pWindow
= VCLUnoHelper::GetWindow( window
);
1287 return pWindow
->GetDropTarget();
1289 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTarget
>();
1292 ::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
)
1294 if( clipboardName
.getLength() == 0 )
1296 if( !mxClipboard
.is() )
1298 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xFactory
= ::comphelper::getProcessServiceFactory();
1299 if ( xFactory
.is() )
1301 // remember clipboard here
1302 mxClipboard
= ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> (
1303 xFactory
->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), ::com::sun::star::uno::UNO_QUERY
);
1310 else if( clipboardName
.equals( ::rtl::OUString::createFromAscii("Selection") ) )
1315 return ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
>();
1319 ::rtl::OUString
VCLXToolkit::getImplementationName() throw(::com::sun::star::uno::RuntimeException
)
1321 return rtl::OUString::createFromAscii( "stardiv.Toolkit.VCLXToolkit" );
1324 sal_Bool
VCLXToolkit::supportsService( const ::rtl::OUString
& rServiceName
) throw(::com::sun::star::uno::RuntimeException
)
1326 ::osl::MutexGuard
aGuard( GetMutex() );
1328 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSNL
= getSupportedServiceNames();
1329 const ::rtl::OUString
* pArray
= aSNL
.getConstArray();
1330 const ::rtl::OUString
* pArrayEnd
= aSNL
.getConstArray();
1331 for (; pArray
!= pArrayEnd
; ++pArray
)
1332 if( *pArray
== rServiceName
)
1335 return pArray
!= pArrayEnd
;
1338 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXToolkit::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
)
1340 ::rtl::OUString
aServiceName( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit
) );
1341 return ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( &aServiceName
, 1);
1344 // css::awt::XExtendedToolkit:
1347 ::sal_Int32 SAL_CALL
VCLXToolkit::getTopWindowCount()
1348 throw (::css::uno::RuntimeException
)
1350 return static_cast< ::sal_Int32
>(::Application::GetTopWindowCount());
1351 // XXX numeric overflow
1355 ::css::uno::Reference
< ::css::awt::XTopWindow
> SAL_CALL
1356 VCLXToolkit::getTopWindow(::sal_Int32 nIndex
)
1357 throw (::css::uno::RuntimeException
)
1359 ::Window
* p
= ::Application::GetTopWindow(static_cast< long >(nIndex
));
1360 // XXX numeric overflow
1361 return ::css::uno::Reference
< ::css::awt::XTopWindow
>(
1362 p
== 0 ? 0 : static_cast< ::css::awt::XWindow
* >(p
->GetWindowPeer()),
1363 ::css::uno::UNO_QUERY
);
1367 ::css::uno::Reference
< ::css::awt::XTopWindow
> SAL_CALL
1368 VCLXToolkit::getActiveTopWindow() throw (::css::uno::RuntimeException
)
1370 ::Window
* p
= ::Application::GetActiveTopWindow();
1371 return ::css::uno::Reference
< ::css::awt::XTopWindow
>(
1372 p
== 0 ? 0 : static_cast< ::css::awt::XWindow
* >(p
->GetWindowPeer()),
1373 ::css::uno::UNO_QUERY
);
1377 void SAL_CALL
VCLXToolkit::addTopWindowListener(
1378 ::css::uno::Reference
< ::css::awt::XTopWindowListener
> const & rListener
)
1379 throw (::css::uno::RuntimeException
)
1381 OSL_ENSURE(rListener
.is(), "Null rListener");
1382 ::osl::ClearableMutexGuard
aGuard(rBHelper
.rMutex
);
1383 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1386 rListener
->disposing(
1387 ::css::lang::EventObject(
1388 static_cast< ::cppu::OWeakObject
* >(this)));
1390 else if (m_aTopWindowListeners
.addInterface(rListener
) == 1
1391 && !m_bEventListener
)
1393 m_bEventListener
= true;
1394 ::Application::AddEventListener(m_aEventListenerLink
);
1399 void SAL_CALL
VCLXToolkit::removeTopWindowListener(
1400 ::css::uno::Reference
< ::css::awt::XTopWindowListener
> const & rListener
)
1401 throw (::css::uno::RuntimeException
)
1403 ::osl::MutexGuard
aGuard(rBHelper
.rMutex
);
1404 if (!(rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1405 && m_aTopWindowListeners
.removeInterface(rListener
) == 0
1406 && m_aFocusListeners
.getLength() == 0 && m_bEventListener
)
1408 ::Application::RemoveEventListener(m_aEventListenerLink
);
1409 m_bEventListener
= false;
1414 void SAL_CALL
VCLXToolkit::addKeyHandler(
1415 ::css::uno::Reference
< ::css::awt::XKeyHandler
> const & rHandler
)
1416 throw (::css::uno::RuntimeException
)
1418 OSL_ENSURE(rHandler
.is(), "Null rHandler");
1419 ::osl::ClearableMutexGuard
aGuard(rBHelper
.rMutex
);
1420 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1423 rHandler
->disposing(
1424 ::css::lang::EventObject(
1425 static_cast< ::cppu::OWeakObject
* >(this)));
1427 else if (m_aKeyHandlers
.addInterface(rHandler
) == 1 && !m_bKeyListener
)
1429 m_bKeyListener
= true;
1430 ::Application::AddKeyListener(m_aKeyListenerLink
);
1435 void SAL_CALL
VCLXToolkit::removeKeyHandler(
1436 ::css::uno::Reference
< ::css::awt::XKeyHandler
> const & rHandler
)
1437 throw (::css::uno::RuntimeException
)
1439 ::osl::MutexGuard
aGuard(rBHelper
.rMutex
);
1440 if (!(rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1441 && m_aKeyHandlers
.removeInterface(rHandler
) == 0 && m_bKeyListener
)
1443 ::Application::RemoveKeyListener(m_aKeyListenerLink
);
1444 m_bKeyListener
= false;
1449 void SAL_CALL
VCLXToolkit::addFocusListener(
1450 ::css::uno::Reference
< ::css::awt::XFocusListener
> const & rListener
)
1451 throw (::css::uno::RuntimeException
)
1453 OSL_ENSURE(rListener
.is(), "Null rListener");
1454 ::osl::ClearableMutexGuard
aGuard(rBHelper
.rMutex
);
1455 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1458 rListener
->disposing(
1459 ::css::lang::EventObject(
1460 static_cast< ::cppu::OWeakObject
* >(this)));
1462 else if (m_aFocusListeners
.addInterface(rListener
) == 1
1463 && !m_bEventListener
)
1465 m_bEventListener
= true;
1466 ::Application::AddEventListener(m_aEventListenerLink
);
1471 void SAL_CALL
VCLXToolkit::removeFocusListener(
1472 ::css::uno::Reference
< ::css::awt::XFocusListener
> const & rListener
)
1473 throw (::css::uno::RuntimeException
)
1475 ::osl::MutexGuard
aGuard(rBHelper
.rMutex
);
1476 if (!(rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
1477 && m_aFocusListeners
.removeInterface(rListener
) == 0
1478 && m_aTopWindowListeners
.getLength() == 0 && m_bEventListener
)
1480 ::Application::RemoveEventListener(m_aEventListenerLink
);
1481 m_bEventListener
= false;
1486 void SAL_CALL
VCLXToolkit::fireFocusGained(
1487 ::com::sun::star::uno::Reference
<
1488 ::com::sun::star::uno::XInterface
> const &)
1489 throw (::com::sun::star::uno::RuntimeException
)
1494 void SAL_CALL
VCLXToolkit::fireFocusLost(
1495 ::com::sun::star::uno::Reference
<
1496 ::com::sun::star::uno::XInterface
> const &)
1497 throw (::com::sun::star::uno::RuntimeException
)
1502 IMPL_LINK(VCLXToolkit
, eventListenerHandler
, ::VclSimpleEvent
const *, pEvent
)
1504 switch (pEvent
->GetId())
1506 case VCLEVENT_WINDOW_SHOW
:
1507 callTopWindowListeners(
1508 pEvent
, &::css::awt::XTopWindowListener::windowOpened
);
1510 case VCLEVENT_WINDOW_HIDE
:
1511 callTopWindowListeners(
1512 pEvent
, &::css::awt::XTopWindowListener::windowClosed
);
1514 case VCLEVENT_WINDOW_ACTIVATE
:
1515 callTopWindowListeners(
1516 pEvent
, &::css::awt::XTopWindowListener::windowActivated
);
1518 case VCLEVENT_WINDOW_DEACTIVATE
:
1519 callTopWindowListeners(
1520 pEvent
, &::css::awt::XTopWindowListener::windowDeactivated
);
1522 case VCLEVENT_WINDOW_CLOSE
:
1523 callTopWindowListeners(
1524 pEvent
, &::css::awt::XTopWindowListener::windowClosing
);
1526 case VCLEVENT_WINDOW_GETFOCUS
:
1527 callFocusListeners(pEvent
, true);
1529 case VCLEVENT_WINDOW_LOSEFOCUS
:
1530 callFocusListeners(pEvent
, false);
1532 case VCLEVENT_WINDOW_MINIMIZE
:
1533 callTopWindowListeners(
1534 pEvent
, &::css::awt::XTopWindowListener::windowMinimized
);
1536 case VCLEVENT_WINDOW_NORMALIZE
:
1537 callTopWindowListeners(
1538 pEvent
, &::css::awt::XTopWindowListener::windowNormalized
);
1544 IMPL_LINK(VCLXToolkit
, keyListenerHandler
, ::VclSimpleEvent
const *, pEvent
)
1546 switch (pEvent
->GetId())
1548 case VCLEVENT_WINDOW_KEYINPUT
:
1549 return callKeyHandlers(pEvent
, true);
1550 case VCLEVENT_WINDOW_KEYUP
:
1551 return callKeyHandlers(pEvent
, false);
1556 void VCLXToolkit::callTopWindowListeners(
1557 ::VclSimpleEvent
const * pEvent
,
1558 void (SAL_CALL ::css::awt::XTopWindowListener::* pFn
)(
1559 ::css::lang::EventObject
const &))
1562 = static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow();
1563 if (pWindow
->IsTopWindow())
1565 ::css::uno::Sequence
< ::css::uno::Reference
< ::css::uno::XInterface
> >
1566 aListeners(m_aTopWindowListeners
.getElements());
1567 if (aListeners
.hasElements())
1569 ::css::lang::EventObject
aAwtEvent(
1570 static_cast< ::css::awt::XWindow
* >(pWindow
->GetWindowPeer()));
1571 for (::sal_Int32 i
= 0; i
< aListeners
.getLength(); ++i
)
1573 ::css::uno::Reference
< ::css::awt::XTopWindowListener
>
1574 xListener(aListeners
[i
], ::css::uno::UNO_QUERY
);
1577 (xListener
.get()->*pFn
)(aAwtEvent
);
1579 catch (::css::uno::RuntimeException
& rEx
)
1582 "VCLXToolkit::callTopWindowListeners: caught %s\n",
1583 ::rtl::OUStringToOString(
1584 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1591 long VCLXToolkit::callKeyHandlers(::VclSimpleEvent
const * pEvent
,
1594 ::css::uno::Sequence
< ::css::uno::Reference
< ::css::uno::XInterface
> >
1595 aHandlers(m_aKeyHandlers
.getElements());
1597 if (aHandlers
.hasElements())
1599 ::Window
* pWindow
= static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow();
1601 // See implementation in vclxwindow.cxx for mapping between VCL and UNO AWT event
1602 ::KeyEvent
* pKeyEvent
= static_cast< ::KeyEvent
* >(
1603 static_cast< ::VclWindowEvent
const * >(pEvent
)->GetData());
1604 ::css::awt::KeyEvent
aAwtEvent(
1605 static_cast< ::css::awt::XWindow
* >(pWindow
->GetWindowPeer()),
1606 (pKeyEvent
->GetKeyCode().IsShift()
1607 ? ::css::awt::KeyModifier::SHIFT
: 0)
1608 | (pKeyEvent
->GetKeyCode().IsMod1()
1609 ? ::css::awt::KeyModifier::MOD1
: 0)
1610 | (pKeyEvent
->GetKeyCode().IsMod2()
1611 ? ::css::awt::KeyModifier::MOD2
: 0),
1612 pKeyEvent
->GetKeyCode().GetCode(), pKeyEvent
->GetCharCode(),
1613 sal::static_int_cast
< sal_Int16
>(
1614 pKeyEvent
->GetKeyCode().GetFunction()));
1615 for (::sal_Int32 i
= 0; i
< aHandlers
.getLength(); ++i
)
1617 ::css::uno::Reference
< ::css::awt::XKeyHandler
> xHandler(
1618 aHandlers
[i
], ::css::uno::UNO_QUERY
);
1621 if ((bPressed
? xHandler
->keyPressed(aAwtEvent
)
1622 : xHandler
->keyReleased(aAwtEvent
)))
1625 catch (::css::uno::RuntimeException
& rEx
)
1628 "VCLXToolkit::callKeyHandlers: caught %s\n",
1629 ::rtl::OUStringToOString(
1630 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1637 void VCLXToolkit::callFocusListeners(::VclSimpleEvent
const * pEvent
,
1641 = static_cast< ::VclWindowEvent
const * >(pEvent
)->GetWindow();
1642 if (pWindow
->IsTopWindow())
1644 ::css::uno::Sequence
< ::css::uno::Reference
< ::css::uno::XInterface
> >
1645 aListeners(m_aFocusListeners
.getElements());
1646 if (aListeners
.hasElements())
1648 // Ignore the interior of compound controls when determining the
1649 // window that gets the focus next (see implementation in
1650 // vclxwindow.cxx for mapping between VCL and UNO AWT event):
1651 ::css::uno::Reference
< css::uno::XInterface
> xNext
;
1652 ::Window
* pFocus
= ::Application::GetFocusWindow();
1653 for (::Window
* p
= pFocus
; p
!= 0; p
= p
->GetParent())
1654 if (!p
->IsCompoundControl())
1660 xNext
= pFocus
->GetComponentInterface(true);
1661 ::css::awt::FocusEvent
aAwtEvent(
1662 static_cast< ::css::awt::XWindow
* >(pWindow
->GetWindowPeer()),
1663 pWindow
->GetGetFocusFlags(), xNext
, false);
1664 for (::sal_Int32 i
= 0; i
< aListeners
.getLength(); ++i
)
1666 ::css::uno::Reference
< ::css::awt::XFocusListener
> xListener(
1667 aListeners
[i
], ::css::uno::UNO_QUERY
);
1670 bGained
? xListener
->focusGained(aAwtEvent
)
1671 : xListener
->focusLost(aAwtEvent
);
1673 catch (::css::uno::RuntimeException
& rEx
)
1676 "VCLXToolkit::callFocusListeners: caught %s\n",
1677 ::rtl::OUStringToOString(
1678 rEx
.Message
, RTL_TEXTENCODING_UTF8
).getStr());
1685 // css::awt::XReschedule:
1687 void SAL_CALL
VCLXToolkit::reschedule()
1688 throw (::com::sun::star::uno::RuntimeException
)
1690 Application::Reschedule(true);