xref: /aoo41x/main/toolkit/source/awt/vclxwindows.cxx (revision ff7e158d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_toolkit.hxx"
26 #include <toolkit/awt/vclxwindows.hxx>
27 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
28 #include <com/sun/star/graphic/XGraphicProvider.hpp>
29 #include <toolkit/helper/vclunohelper.hxx>
30 #include <toolkit/helper/macros.hxx>
31 #include <toolkit/helper/property.hxx>
32 #include <toolkit/helper/convert.hxx>
33 #include <toolkit/helper/imagealign.hxx>
34 #include <toolkit/helper/accessibilityclient.hxx>
35 #include <toolkit/helper/fixedhyperbase.hxx>
36 #include <toolkit/helper/tkresmgr.hxx>
37 #include <cppuhelper/typeprovider.hxx>
38 #include <com/sun/star/awt/VisualEffect.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/system/XSystemShellExecute.hpp>
41 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
42 #include <com/sun/star/resource/XStringResourceResolver.hpp>
43 #include <com/sun/star/awt/ImageScaleMode.hpp>
44 #include <com/sun/star/awt/XItemList.hpp>
45 #include <comphelper/componentcontext.hxx>
46 #include <comphelper/namedvaluecollection.hxx>
47 #include <comphelper/processfactory.hxx>
48 
49 #ifndef _SV_BUTTON_HXX
50 #include <vcl/button.hxx>
51 #endif
52 #include <vcl/lstbox.hxx>
53 #include <vcl/combobox.hxx>
54 #include <vcl/field.hxx>
55 #include <vcl/longcurr.hxx>
56 #include <vcl/imgctrl.hxx>
57 #include <vcl/dialog.hxx>
58 #include <vcl/msgbox.hxx>
59 #include <vcl/scrbar.hxx>
60 #include <vcl/svapp.hxx>
61 #include <vcl/tabpage.hxx>
62 #include <vcl/tabctrl.hxx>
63 #include <tools/diagnose_ex.h>
64 
65 #include <boost/bind.hpp>
66 #include <boost/function.hpp>
67 
68 using ::com::sun::star::uno::Any;
69 using ::com::sun::star::uno::Reference;
70 using ::com::sun::star::uno::makeAny;
71 using ::com::sun::star::uno::RuntimeException;
72 using ::com::sun::star::lang::EventObject;
73 using ::com::sun::star::awt::ItemListEvent;
74 using ::com::sun::star::awt::XItemList;
75 using ::com::sun::star::graphic::XGraphic;
76 using ::com::sun::star::graphic::XGraphicProvider;
77 
78 using namespace ::com::sun::star;
79 using namespace ::com::sun::star::awt::VisualEffect;
80 namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
81 
82 static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits )
83 {
84 	double n = nValue;
85 	for ( sal_uInt16 d = 0; d < nDigits; d++ )
86 		n *= 10;
87 	return n;
88 }
89 
90 static double ImplCalcDoubleValue( double nValue, sal_uInt16 nDigits )
91 {
92 	double n = nValue;
93 	for ( sal_uInt16 d = 0; d < nDigits; d++ )
94 		n /= 10;
95 	return n;
96 }
97 
98 namespace toolkit
99 {
100     /** sets the "face color" for button like controls (scroll bar, spin button)
101     */
102     void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue )
103     {
104         AllSettings aSettings = _pWindow->GetSettings();
105 	    StyleSettings aStyleSettings = aSettings.GetStyleSettings();
106 
107         if ( !_rColorValue.hasValue() )
108         {
109 	        const StyleSettings& aAppStyle = Application::GetSettings().GetStyleSettings();
110             aStyleSettings.SetFaceColor( aAppStyle.GetFaceColor( ) );
111             aStyleSettings.SetCheckedColor( aAppStyle.GetCheckedColor( ) );
112             aStyleSettings.SetLightBorderColor( aAppStyle.GetLightBorderColor() );
113             aStyleSettings.SetLightColor( aAppStyle.GetLightColor() );
114             aStyleSettings.SetShadowColor( aAppStyle.GetShadowColor() );
115             aStyleSettings.SetDarkShadowColor( aAppStyle.GetDarkShadowColor() );
116         }
117         else
118         {
119 			sal_Int32 nBackgroundColor = 0;
120             _rColorValue >>= nBackgroundColor;
121             aStyleSettings.SetFaceColor( nBackgroundColor );
122 
123             // for the real background (everything except the buttons and the thumb),
124             // use an average between the desired color and "white"
125             Color aWhite( COL_WHITE );
126             Color aBackground( nBackgroundColor );
127             aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 );
128             aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
129             aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
130             aStyleSettings.SetCheckedColor( aBackground );
131 
132             sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance();
133             sal_Int32 nWhiteLuminance = Color( COL_WHITE ).GetLuminance();
134 
135             Color aLightShadow( nBackgroundColor );
136             aLightShadow.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) );
137             aStyleSettings.SetLightBorderColor( aLightShadow );
138 
139             Color aLight( nBackgroundColor );
140             aLight.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) );
141             aStyleSettings.SetLightColor( aLight );
142 
143             Color aShadow( nBackgroundColor );
144             aShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 1 / 3 ) );
145             aStyleSettings.SetShadowColor( aShadow );
146 
147             Color aDarkShadow( nBackgroundColor );
148             aDarkShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 2 / 3 ) );
149             aStyleSettings.SetDarkShadowColor( aDarkShadow );
150         }
151 
152         aSettings.SetStyleSettings( aStyleSettings );
153         _pWindow->SetSettings( aSettings, sal_True );
154     }
155 
156     Any getButtonLikeFaceColor( const Window* _pWindow )
157     {
158 		sal_Int32 nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
159         return makeAny( nBackgroundColor );
160     }
161 
162     static void adjustBooleanWindowStyle( const Any& _rValue, Window* _pWindow, WinBits _nBits, sal_Bool _bInverseSemantics )
163     {
164         WinBits nStyle = _pWindow->GetStyle();
165         sal_Bool bValue( sal_False );
166         OSL_VERIFY( _rValue >>= bValue );
167         if ( bValue != _bInverseSemantics )
168             nStyle |= _nBits;
169         else
170             nStyle &= ~_nBits;
171         _pWindow->SetStyle( nStyle );
172     }
173 
174     static void setVisualEffect( const Any& _rValue, Window* _pWindow )
175     {
176         AllSettings aSettings = _pWindow->GetSettings();
177 	    StyleSettings aStyleSettings = aSettings.GetStyleSettings();
178 
179         sal_Int16 nStyle = LOOK3D;
180         OSL_VERIFY( _rValue >>= nStyle );
181         switch ( nStyle )
182         {
183         case FLAT:
184             aStyleSettings.SetOptions( aStyleSettings.GetOptions() & ~STYLE_OPTION_MONO );
185             break;
186         case LOOK3D:
187         default:
188             aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_MONO );
189         }
190         aSettings.SetStyleSettings( aStyleSettings );
191         _pWindow->SetSettings( aSettings );
192     }
193 
194     static Any getVisualEffect( Window* _pWindow )
195     {
196         Any aEffect;
197 
198         StyleSettings aStyleSettings = _pWindow->GetSettings().GetStyleSettings();
199         if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
200             aEffect <<= (sal_Int16)FLAT;
201         else
202             aEffect <<= (sal_Int16)LOOK3D;
203         return aEffect;
204     }
205 }
206 
207 //	----------------------------------------------------
208 //	class VCLXGraphicControl
209 //	----------------------------------------------------
210 
211 void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
212 {
213     VCLXWindow::ImplGetPropertyIds( rIds );
214 }
215 
216 void VCLXGraphicControl::ImplSetNewImage()
217 {
218     OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
219 	Button* pButton = static_cast< Button* >( GetWindow() );
220 	pButton->SetModeImage( GetImage() );
221 }
222 
223 void VCLXGraphicControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException)
224 {
225 	::vos::OGuard aGuard( GetMutex() );
226 
227 	if ( GetWindow() )
228 	{
229 		Size aOldSize = GetWindow()->GetSizePixel();
230 		VCLXWindow::setPosSize( X, Y, Width, Height, Flags );
231 		if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) )
232 			ImplSetNewImage();
233 	}
234 }
235 
236 void VCLXGraphicControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
237 {
238 	::vos::OGuard aGuard( GetMutex() );
239 
240 	Button* pButton = static_cast< Button* >( GetWindow() );
241     if ( !pButton )
242         return;
243     sal_uInt16 nPropType = GetPropertyId( PropertyName );
244     switch ( nPropType )
245     {
246         case BASEPROPERTY_GRAPHIC:
247         {
248             Reference< XGraphic > xGraphic;
249             OSL_VERIFY( Value >>= xGraphic );
250             maImage = Image( xGraphic );
251             ImplSetNewImage();
252         }
253         break;
254 
255         case BASEPROPERTY_IMAGEALIGN:
256         {
257             WindowType eType = GetWindow()->GetType();
258             if (  ( eType == WINDOW_PUSHBUTTON )
259                || ( eType == WINDOW_RADIOBUTTON )
260                || ( eType == WINDOW_CHECKBOX )
261                )
262             {
263                 sal_Int16 nAlignment = sal_Int16();
264                 if ( Value >>= nAlignment )
265                     pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
266             }
267         }
268         break;
269         case BASEPROPERTY_IMAGEPOSITION:
270         {
271             WindowType eType = GetWindow()->GetType();
272             if (  ( eType == WINDOW_PUSHBUTTON )
273                || ( eType == WINDOW_RADIOBUTTON )
274                || ( eType == WINDOW_CHECKBOX )
275                )
276             {
277                 sal_Int16 nImagePosition = 2;
278                 OSL_VERIFY( Value >>= nImagePosition );
279                 pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
280             }
281         }
282         break;
283         default:
284             VCLXWindow::setProperty( PropertyName, Value );
285             break;
286 	}
287 }
288 
289 ::com::sun::star::uno::Any VCLXGraphicControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
290 {
291 	::vos::OGuard aGuard( GetMutex() );
292 
293 	::com::sun::star::uno::Any aProp;
294     if ( !GetWindow() )
295         return aProp;
296 
297     sal_uInt16 nPropType = GetPropertyId( PropertyName );
298 	switch ( nPropType )
299 	{
300         case BASEPROPERTY_GRAPHIC:
301             aProp <<= maImage.GetXGraphic();
302             break;
303 		case BASEPROPERTY_IMAGEALIGN:
304 		{
305             WindowType eType = GetWindow()->GetType();
306             if  (  ( eType == WINDOW_PUSHBUTTON )
307                 || ( eType == WINDOW_RADIOBUTTON )
308                 || ( eType == WINDOW_CHECKBOX )
309                 )
310             {
311  				aProp <<= ::toolkit::getCompatibleImageAlign( static_cast< Button* >( GetWindow() )->GetImageAlign() );
312             }
313 		}
314 		break;
315 		case BASEPROPERTY_IMAGEPOSITION:
316         {
317             WindowType eType = GetWindow()->GetType();
318             if  (  ( eType == WINDOW_PUSHBUTTON )
319                 || ( eType == WINDOW_RADIOBUTTON )
320                 || ( eType == WINDOW_CHECKBOX )
321                 )
322             {
323                 aProp <<= ::toolkit::translateImagePosition( static_cast< Button* >( GetWindow() )->GetImageAlign() );
324             }
325         }
326         break;
327 		default:
328 		{
329 			aProp <<= VCLXWindow::getProperty( PropertyName );
330 		}
331         break;
332 	}
333 	return aProp;
334 }
335 
336 //--------------------------------------------------------------------
337 //	class VCLXButton
338 //	----------------------------------------------------
339 
340 void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
341 {
342     PushPropertyIds( rIds,
343                      BASEPROPERTY_BACKGROUNDCOLOR,
344                      BASEPROPERTY_DEFAULTBUTTON,
345                      BASEPROPERTY_DEFAULTCONTROL,
346                      BASEPROPERTY_ENABLED,
347                      BASEPROPERTY_ENABLEVISIBLE,
348                      BASEPROPERTY_FONTDESCRIPTOR,
349                      BASEPROPERTY_GRAPHIC,
350                      BASEPROPERTY_HELPTEXT,
351                      BASEPROPERTY_HELPURL,
352                      BASEPROPERTY_IMAGEALIGN,
353                      BASEPROPERTY_IMAGEPOSITION,
354                      BASEPROPERTY_IMAGEURL,
355                      BASEPROPERTY_LABEL,
356                      BASEPROPERTY_PRINTABLE,
357                      BASEPROPERTY_PUSHBUTTONTYPE,
358                      BASEPROPERTY_REPEAT,
359                      BASEPROPERTY_REPEAT_DELAY,
360                      BASEPROPERTY_STATE,
361                      BASEPROPERTY_TABSTOP,
362                      BASEPROPERTY_TOGGLE,
363                      BASEPROPERTY_FOCUSONCLICK,
364                      BASEPROPERTY_MULTILINE,
365                      BASEPROPERTY_ALIGN,
366                      BASEPROPERTY_VERTICALALIGN,
367                      BASEPROPERTY_WRITING_MODE,
368                      BASEPROPERTY_CONTEXT_WRITING_MODE,
369                      BASEPROPERTY_REFERENCE_DEVICE,
370                      0);
371     VCLXGraphicControl::ImplGetPropertyIds( rIds );
372 }
373 
374 VCLXButton::VCLXButton()
375     :maActionListeners( *this )
376     ,maItemListeners( *this )
377 {
378 }
379 
380 VCLXButton::~VCLXButton()
381 {
382 }
383 
384 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
385 {
386     return getAccessibleFactory().createAccessibleContext( this );
387 }
388 
389 void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException)
390 {
391 	::vos::OGuard aGuard( GetMutex() );
392 
393 	::com::sun::star::lang::EventObject aObj;
394 	aObj.Source = (::cppu::OWeakObject*)this;
395 	maActionListeners.disposeAndClear( aObj );
396 	maItemListeners.disposeAndClear( aObj );
397 	VCLXGraphicControl::dispose();
398 }
399 
400 void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
401 {
402 	::vos::OGuard aGuard( GetMutex() );
403 	maActionListeners.addInterface( l );
404 }
405 
406 void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
407 {
408 	::vos::OGuard aGuard( GetMutex() );
409 	maActionListeners.removeInterface( l );
410 }
411 
412 void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l  )throw(::com::sun::star::uno::RuntimeException)
413 {
414 	::vos::OGuard aGuard( GetMutex() );
415 	maItemListeners.addInterface( l );
416 }
417 
418 void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
419 {
420 	::vos::OGuard aGuard( GetMutex() );
421 	maItemListeners.removeInterface( l );
422 }
423 
424 void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
425 {
426 	::vos::OGuard aGuard( GetMutex() );
427 
428 	Window* pWindow = GetWindow();
429 	if ( pWindow )
430 		pWindow->SetText( rLabel );
431 }
432 
433 void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
434 {
435 	::vos::OGuard aGuard( GetMutex() );
436 
437 	maActionCommand = rCommand;
438 }
439 
440 ::com::sun::star::awt::Size VCLXButton::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
441 {
442 	::vos::OGuard aGuard( GetMutex() );
443 
444 	Size aSz;
445 	PushButton* pButton = (PushButton*) GetWindow();
446 	if ( pButton )
447 		aSz = pButton->CalcMinimumSize();
448 	return AWTSize(aSz);
449 }
450 
451 ::com::sun::star::awt::Size VCLXButton::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
452 {
453 	::com::sun::star::awt::Size aSz = getMinimumSize();
454 	aSz.Width += 16;
455 	aSz.Height += 10;
456 	return aSz;
457 }
458 
459 ::com::sun::star::awt::Size VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
460 {
461 	::vos::OGuard aGuard( GetMutex() );
462 
463 	Size aSz = VCLSize(rNewSize);
464 	PushButton* pButton = (PushButton*) GetWindow();
465 	if ( pButton )
466 	{
467 		Size aMinSz = pButton->CalcMinimumSize();
468 		// Kein Text, also Image
469 		if ( !pButton->GetText().Len() )
470 		{
471 			if ( aSz.Width() < aMinSz.Width() )
472 				aSz.Width() = aMinSz.Width();
473 			if ( aSz.Height() < aMinSz.Height() )
474 				aSz.Height() = aMinSz.Height();
475 		}
476 		else
477 		{
478 			if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
479 				aSz.Height() = aMinSz.Height();
480 			else
481 				aSz = aMinSz;
482 		}
483 	}
484 	return AWTSize(aSz);
485 }
486 
487 void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
488 {
489 	::vos::OGuard aGuard( GetMutex() );
490 
491 	Button* pButton = (Button*)GetWindow();
492 	if ( pButton )
493 	{
494 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
495 		switch ( nPropType )
496 		{
497             case BASEPROPERTY_FOCUSONCLICK:
498                 ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, sal_True );
499                 break;
500 
501             case BASEPROPERTY_TOGGLE:
502                 ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, sal_False );
503                 break;
504 
505             case BASEPROPERTY_DEFAULTBUTTON:
506 			{
507 				WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
508 				sal_Bool b = sal_Bool();
509 				if ( ( Value >>= b ) && !b )
510 					nStyle &= ~WB_DEFBUTTON;
511 				pButton->SetStyle( nStyle );
512 			}
513 			break;
514 			case BASEPROPERTY_STATE:
515 			{
516                 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
517                 {
518 				    sal_Int16 n = sal_Int16();
519 				    if ( Value >>= n )
520 					    ((PushButton*)pButton)->SetState( (TriState)n );
521                 }
522 			}
523 			break;
524 			default:
525 			{
526 				VCLXGraphicControl::setProperty( PropertyName, Value );
527 			}
528 		}
529 	}
530 }
531 
532 ::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
533 {
534 	::vos::OGuard aGuard( GetMutex() );
535 
536 	::com::sun::star::uno::Any aProp;
537 	Button* pButton = (Button*)GetWindow();
538 	if ( pButton )
539 	{
540 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
541 		switch ( nPropType )
542 		{
543             case BASEPROPERTY_FOCUSONCLICK:
544                 aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_NOPOINTERFOCUS ) == 0 );
545                 break;
546 
547             case BASEPROPERTY_TOGGLE:
548                 aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_TOGGLE ) != 0 );
549                 break;
550 
551 			case BASEPROPERTY_DEFAULTBUTTON:
552 			{
553 				aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False );
554 			}
555 			break;
556 			case BASEPROPERTY_STATE:
557 			{
558                 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
559                 {
560  				    aProp <<= (sal_Int16)((PushButton*)pButton)->GetState();
561                 }
562 			}
563 			break;
564 			default:
565 			{
566 				aProp <<= VCLXGraphicControl::getProperty( PropertyName );
567 			}
568 		}
569 	}
570 	return aProp;
571 }
572 
573 void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
574 {
575 	switch ( rVclWindowEvent.GetId() )
576 	{
577 		case VCLEVENT_BUTTON_CLICK:
578         {
579             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
580                 // since we call listeners below, there is a potential that we will be destroyed
581                 // during the listener call. To prevent the resulting crashs, we keep us
582                 // alive as long as we're here
583                 // #20178# - 2003-10-01 - fs@openoffice.org
584 
585 			if ( maActionListeners.getLength() )
586 			{
587 				::com::sun::star::awt::ActionEvent aEvent;
588 				aEvent.Source = (::cppu::OWeakObject*)this;
589 				aEvent.ActionCommand = maActionCommand;
590 
591                 Callback aCallback = ::boost::bind(
592                     &ActionListenerMultiplexer::actionPerformed,
593                     &maActionListeners,
594                     aEvent
595                 );
596                 ImplExecuteAsyncWithoutSolarLock( aCallback );
597 			}
598         }
599 		break;
600 
601         case VCLEVENT_PUSHBUTTON_TOGGLE:
602         {
603 	        PushButton& rButton = dynamic_cast< PushButton& >( *rVclWindowEvent.GetWindow() );
604 
605             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
606 			if ( maItemListeners.getLength() )
607 			{
608 				::com::sun::star::awt::ItemEvent aEvent;
609 				aEvent.Source = (::cppu::OWeakObject*)this;
610                 aEvent.Selected = ( rButton.GetState() == STATE_CHECK ) ? 1 : 0;
611 				maItemListeners.itemStateChanged( aEvent );
612 			}
613         }
614 		break;
615 
616 		default:
617 			VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
618 			break;
619 	}
620 }
621 
622 //	----------------------------------------------------
623 //	class VCLXImageControl
624 //	----------------------------------------------------
625 
626 void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
627 {
628     PushPropertyIds( rIds,
629                      BASEPROPERTY_BACKGROUNDCOLOR,
630                      BASEPROPERTY_BORDER,
631                      BASEPROPERTY_BORDERCOLOR,
632                      BASEPROPERTY_DEFAULTCONTROL,
633                      BASEPROPERTY_ENABLED,
634                      BASEPROPERTY_ENABLEVISIBLE,
635                      BASEPROPERTY_GRAPHIC,
636                      BASEPROPERTY_HELPTEXT,
637                      BASEPROPERTY_HELPURL,
638                      BASEPROPERTY_IMAGEURL,
639                      BASEPROPERTY_PRINTABLE,
640                      BASEPROPERTY_SCALEIMAGE,
641                      BASEPROPERTY_IMAGE_SCALE_MODE,
642                      BASEPROPERTY_TABSTOP,
643                      BASEPROPERTY_WRITING_MODE,
644                      BASEPROPERTY_CONTEXT_WRITING_MODE,
645                      0);
646     VCLXGraphicControl::ImplGetPropertyIds( rIds );
647 }
648 
649 VCLXImageControl::VCLXImageControl()
650 {
651 }
652 
653 VCLXImageControl::~VCLXImageControl()
654 {
655 }
656 
657 void VCLXImageControl::ImplSetNewImage()
658 {
659     OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
660 	ImageControl* pControl = static_cast< ImageControl* >( GetWindow() );
661 	pControl->SetImage( GetImage() );
662 }
663 
664 ::com::sun::star::awt::Size VCLXImageControl::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
665 {
666 	::vos::OGuard aGuard( GetMutex() );
667 
668 	Size aSz = GetImage().GetSizePixel();
669 	aSz = ImplCalcWindowSize( aSz );
670 
671 	return AWTSize(aSz);
672 }
673 
674 ::com::sun::star::awt::Size VCLXImageControl::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
675 {
676 	return getMinimumSize();
677 }
678 
679 ::com::sun::star::awt::Size VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
680 {
681 	::vos::OGuard aGuard( GetMutex() );
682 
683 	::com::sun::star::awt::Size aSz = rNewSize;
684 	::com::sun::star::awt::Size aMinSz = getMinimumSize();
685 	if ( aSz.Width < aMinSz.Width )
686 		aSz.Width = aMinSz.Width;
687 	if ( aSz.Height < aMinSz.Height )
688 		aSz.Height = aMinSz.Height;
689 	return aSz;
690 }
691 
692 void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
693 {
694 	::vos::OGuard aGuard( GetMutex() );
695 
696 	ImageControl* pImageControl = (ImageControl*)GetWindow();
697 
698     sal_uInt16 nPropType = GetPropertyId( PropertyName );
699 	switch ( nPropType )
700 	{
701         case BASEPROPERTY_IMAGE_SCALE_MODE:
702         {
703             sal_Int16 nScaleMode( ImageScaleMode::Anisotropic );
704             if ( pImageControl && ( Value >>= nScaleMode ) )
705             {
706                 pImageControl->SetScaleMode( nScaleMode );
707             }
708         }
709         break;
710 
711 		case BASEPROPERTY_SCALEIMAGE:
712 		{
713             // this is for compatibility only, nowadays, the ImageScaleMode property should be used
714 			sal_Bool bScaleImage = sal_False;
715             if ( pImageControl && ( Value >>= bScaleImage ) )
716             {
717                 pImageControl->SetScaleMode( bScaleImage ? ImageScaleMode::Anisotropic : ImageScaleMode::None );
718             }
719 		}
720 		break;
721 
722         default:
723 			VCLXGraphicControl::setProperty( PropertyName, Value );
724             break;
725 	}
726 }
727 
728 ::com::sun::star::uno::Any VCLXImageControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
729 {
730 	::vos::OGuard aGuard( GetMutex() );
731 
732 	::com::sun::star::uno::Any aProp;
733 	ImageControl* pImageControl = (ImageControl*)GetWindow();
734 	sal_uInt16 nPropType = GetPropertyId( PropertyName );
735 
736     switch ( nPropType )
737 	{
738         case BASEPROPERTY_IMAGE_SCALE_MODE:
739             aProp <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic );
740             break;
741 
742 		case BASEPROPERTY_SCALEIMAGE:
743             aProp <<= ( pImageControl && pImageControl->GetScaleMode() != ImageScaleMode::None ) ? sal_True : sal_False;
744 		    break;
745 
746 		default:
747 			aProp = VCLXGraphicControl::getProperty( PropertyName );
748             break;
749 	}
750 	return aProp;
751 }
752 
753 //	----------------------------------------------------
754 //	class VCLXCheckBox
755 //	----------------------------------------------------
756 
757 
758 void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
759 {
760     PushPropertyIds( rIds,
761                      BASEPROPERTY_DEFAULTCONTROL,
762                      BASEPROPERTY_ENABLED,
763                      BASEPROPERTY_ENABLEVISIBLE,
764                      BASEPROPERTY_FONTDESCRIPTOR,
765                      BASEPROPERTY_GRAPHIC,
766                      BASEPROPERTY_HELPTEXT,
767                      BASEPROPERTY_HELPURL,
768                      BASEPROPERTY_IMAGEPOSITION,
769                      BASEPROPERTY_IMAGEURL,
770                      BASEPROPERTY_LABEL,
771                      BASEPROPERTY_PRINTABLE,
772                      BASEPROPERTY_STATE,
773                      BASEPROPERTY_TABSTOP,
774                      BASEPROPERTY_TRISTATE,
775                      BASEPROPERTY_VISUALEFFECT,
776                      BASEPROPERTY_MULTILINE,
777                      BASEPROPERTY_BACKGROUNDCOLOR,
778                      BASEPROPERTY_ALIGN,
779                      BASEPROPERTY_VERTICALALIGN,
780                      BASEPROPERTY_WRITING_MODE,
781                      BASEPROPERTY_CONTEXT_WRITING_MODE,
782                      BASEPROPERTY_REFERENCE_DEVICE,
783                      0);
784     VCLXGraphicControl::ImplGetPropertyIds( rIds );
785 }
786 
787 VCLXCheckBox::VCLXCheckBox() :  maActionListeners( *this ), maItemListeners( *this )
788 {
789 }
790 
791 // ::com::sun::star::uno::XInterface
792 ::com::sun::star::uno::Any VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
793 {
794 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
795 										SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ),
796 										SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ) );
797 	return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType ));
798 }
799 
800 // ::com::sun::star::lang::XTypeProvider
801 IMPL_XTYPEPROVIDER_START( VCLXCheckBox )
802 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
803 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ),
804 	VCLXGraphicControl::getTypes()
805 IMPL_XTYPEPROVIDER_END
806 
807 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXCheckBox::CreateAccessibleContext()
808 {
809     return getAccessibleFactory().createAccessibleContext( this );
810 }
811 
812 void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException)
813 {
814 	::vos::OGuard aGuard( GetMutex() );
815 
816 	::com::sun::star::lang::EventObject aObj;
817 	aObj.Source = (::cppu::OWeakObject*)this;
818 	maItemListeners.disposeAndClear( aObj );
819 	VCLXGraphicControl::dispose();
820 }
821 
822 void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
823 {
824 	::vos::OGuard aGuard( GetMutex() );
825 	maItemListeners.addInterface( l );
826 }
827 
828 void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
829 {
830 	::vos::OGuard aGuard( GetMutex() );
831 	maItemListeners.removeInterface( l );
832 }
833 
834 void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
835 {
836 	::vos::OGuard aGuard( GetMutex() );
837 	maActionListeners.addInterface( l );
838 }
839 
840 void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
841 {
842 	::vos::OGuard aGuard( GetMutex() );
843 	maActionListeners.removeInterface( l );
844 }
845 
846 void VCLXCheckBox::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
847 {
848 	::vos::OGuard aGuard( GetMutex() );
849 	maActionCommand = rCommand;
850 }
851 
852 void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
853 {
854 	::vos::OGuard aGuard( GetMutex() );
855 
856 	Window* pWindow = GetWindow();
857 	if ( pWindow )
858 		pWindow->SetText( rLabel );
859 }
860 
861 void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException)
862 {
863 	::vos::OGuard aGuard( GetMutex() );
864 
865 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
866 	if ( pCheckBox)
867 	{
868         TriState eState;
869         switch ( n )
870         {
871             case 0:     eState = STATE_NOCHECK;     break;
872             case 1:     eState = STATE_CHECK;       break;
873             case 2:     eState = STATE_DONTKNOW;    break;
874             default:    eState = STATE_NOCHECK;
875         }
876 		pCheckBox->SetState( eState );
877 
878         // #105198# call C++ click listeners (needed for accessibility)
879         // pCheckBox->GetClickHdl().Call( pCheckBox );
880 
881         // #107218# Call same virtual methods and listeners like VCL would do after user interaction
882         SetSynthesizingVCLEvent( sal_True );
883         pCheckBox->Toggle();
884         pCheckBox->Click();
885         SetSynthesizingVCLEvent( sal_False );
886 	}
887 }
888 
889 short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException)
890 {
891     ::vos::OGuard aGuard( GetMutex() );
892 
893     short nState = -1;
894     CheckBox* pCheckBox = (CheckBox*)GetWindow();
895     if ( pCheckBox )
896     {
897         switch ( pCheckBox->GetState() )
898         {
899             case STATE_NOCHECK:     nState = 0; break;
900             case STATE_CHECK:       nState = 1; break;
901             case STATE_DONTKNOW:    nState = 2; break;
902             default:                DBG_ERROR( "VCLXCheckBox::getState(): unknown TriState!" );
903         }
904     }
905 
906     return nState;
907 }
908 
909 void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
910 {
911 	::vos::OGuard aGuard( GetMutex() );
912 
913 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
914 	if ( pCheckBox)
915 		pCheckBox->EnableTriState( b );
916 }
917 
918 ::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
919 {
920 	::vos::OGuard aGuard( GetMutex() );
921 
922 	Size aSz;
923 	CheckBox* pCheckBox = (CheckBox*) GetWindow();
924 	if ( pCheckBox )
925 		aSz = pCheckBox->CalcMinimumSize();
926 	return AWTSize(aSz);
927 }
928 
929 ::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
930 {
931 	return getMinimumSize();
932 }
933 
934 ::com::sun::star::awt::Size VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
935 {
936 	::vos::OGuard aGuard( GetMutex() );
937 
938 	Size aSz = VCLSize(rNewSize);
939 	CheckBox* pCheckBox = (CheckBox*) GetWindow();
940 	if ( pCheckBox )
941 	{
942 		Size aMinSz = pCheckBox->CalcMinimumSize();
943 		if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
944 			aSz.Height() = aMinSz.Height();
945 		else
946 			aSz = aMinSz;
947 	}
948 	return AWTSize(aSz);
949 }
950 
951 void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
952 {
953 	::vos::OGuard aGuard( GetMutex() );
954 
955 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
956 	if ( pCheckBox )
957 	{
958 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
959 		switch ( nPropType )
960 		{
961             case BASEPROPERTY_VISUALEFFECT:
962                 ::toolkit::setVisualEffect( Value, pCheckBox );
963                 break;
964 
965 			case BASEPROPERTY_TRISTATE:
966 			{
967 				sal_Bool b = sal_Bool();
968 				if ( Value >>= b )
969  					pCheckBox->EnableTriState( b );
970 			}
971 			break;
972 			case BASEPROPERTY_STATE:
973 			{
974 				sal_Int16 n = sal_Int16();
975 				if ( Value >>= n )
976 					setState( n );
977 			}
978 			break;
979 			default:
980 			{
981 				VCLXGraphicControl::setProperty( PropertyName, Value );
982 			}
983 		}
984 	}
985 }
986 
987 ::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
988 {
989 	::vos::OGuard aGuard( GetMutex() );
990 
991 	::com::sun::star::uno::Any aProp;
992 	CheckBox* pCheckBox = (CheckBox*)GetWindow();
993 	if ( pCheckBox )
994 	{
995 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
996 		switch ( nPropType )
997 		{
998             case BASEPROPERTY_VISUALEFFECT:
999                 aProp = ::toolkit::getVisualEffect( pCheckBox );
1000                 break;
1001 			case BASEPROPERTY_TRISTATE:
1002  				aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled();
1003     			break;
1004 			case BASEPROPERTY_STATE:
1005  				aProp <<= (sal_Int16)pCheckBox->GetState();
1006     			break;
1007 			default:
1008 			{
1009 				aProp <<= VCLXGraphicControl::getProperty( PropertyName );
1010 			}
1011 		}
1012 	}
1013 	return aProp;
1014 }
1015 
1016 void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1017 {
1018 	switch ( rVclWindowEvent.GetId() )
1019 	{
1020 		case VCLEVENT_CHECKBOX_TOGGLE:
1021         {
1022             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1023                 // since we call listeners below, there is a potential that we will be destroyed
1024                 // in during the listener call. To prevent the resulting crashs, we keep us
1025                 // alive as long as we're here
1026                 // #20178# - 2003-10-01 - fs@openoffice.org
1027 
1028 			CheckBox* pCheckBox = (CheckBox*)GetWindow();
1029 			if ( pCheckBox )
1030 			{
1031     			if ( maItemListeners.getLength() )
1032     			{
1033     				::com::sun::star::awt::ItemEvent aEvent;
1034     				aEvent.Source = (::cppu::OWeakObject*)this;
1035     				aEvent.Highlighted = sal_False;
1036     				aEvent.Selected = pCheckBox->GetState();
1037     				maItemListeners.itemStateChanged( aEvent );
1038     			}
1039     			if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
1040     			{
1041     				::com::sun::star::awt::ActionEvent aEvent;
1042     				aEvent.Source = (::cppu::OWeakObject*)this;
1043     				aEvent.ActionCommand = maActionCommand;
1044     				maActionListeners.actionPerformed( aEvent );
1045     			}
1046 			}
1047 		}
1048 		break;
1049 
1050 		default:
1051 			VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
1052 			break;
1053 	}
1054 }
1055 
1056 //	----------------------------------------------------
1057 //	class VCLXRadioButton
1058 //	----------------------------------------------------
1059 void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1060 {
1061     PushPropertyIds( rIds,
1062                      BASEPROPERTY_DEFAULTCONTROL,
1063                      BASEPROPERTY_ENABLED,
1064                      BASEPROPERTY_ENABLEVISIBLE,
1065                      BASEPROPERTY_FONTDESCRIPTOR,
1066                      BASEPROPERTY_GRAPHIC,
1067                      BASEPROPERTY_HELPTEXT,
1068                      BASEPROPERTY_HELPURL,
1069                      BASEPROPERTY_IMAGEPOSITION,
1070                      BASEPROPERTY_IMAGEURL,
1071                      BASEPROPERTY_LABEL,
1072                      BASEPROPERTY_PRINTABLE,
1073                      BASEPROPERTY_STATE,
1074                      BASEPROPERTY_TABSTOP,
1075                      BASEPROPERTY_VISUALEFFECT,
1076                      BASEPROPERTY_MULTILINE,
1077                      BASEPROPERTY_BACKGROUNDCOLOR,
1078                      BASEPROPERTY_ALIGN,
1079                      BASEPROPERTY_VERTICALALIGN,
1080                      BASEPROPERTY_WRITING_MODE,
1081                      BASEPROPERTY_CONTEXT_WRITING_MODE,
1082                      BASEPROPERTY_REFERENCE_DEVICE,
1083                      0);
1084     VCLXGraphicControl::ImplGetPropertyIds( rIds );
1085 }
1086 
1087 
1088 VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
1089 {
1090 }
1091 
1092 // ::com::sun::star::uno::XInterface
1093 ::com::sun::star::uno::Any VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1094 {
1095 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1096 										SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ),
1097 										SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) );
1098 	return (aRet.hasValue() ? aRet : VCLXGraphicControl::queryInterface( rType ));
1099 }
1100 
1101 // ::com::sun::star::lang::XTypeProvider
1102 IMPL_XTYPEPROVIDER_START( VCLXRadioButton )
1103 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
1104 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
1105 	VCLXGraphicControl::getTypes()
1106 IMPL_XTYPEPROVIDER_END
1107 
1108 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXRadioButton::CreateAccessibleContext()
1109 {
1110     return getAccessibleFactory().createAccessibleContext( this );
1111 }
1112 
1113 void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException)
1114 {
1115 	::vos::OGuard aGuard( GetMutex() );
1116 
1117 	::com::sun::star::lang::EventObject aObj;
1118 	aObj.Source = (::cppu::OWeakObject*)this;
1119 	maItemListeners.disposeAndClear( aObj );
1120 	VCLXGraphicControl::dispose();
1121 }
1122 
1123 void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1124 {
1125 	::vos::OGuard aGuard( GetMutex() );
1126 
1127 	RadioButton* pButton = (RadioButton*)GetWindow();
1128 	if ( pButton )
1129 	{
1130 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1131 		switch ( nPropType )
1132 		{
1133             case BASEPROPERTY_VISUALEFFECT:
1134                 ::toolkit::setVisualEffect( Value, pButton );
1135                 break;
1136 
1137 			case BASEPROPERTY_STATE:
1138 			{
1139 				sal_Int16 n = sal_Int16();
1140 				if ( Value >>= n )
1141 				{
1142 					sal_Bool b = n ? sal_True : sal_False;
1143 					if ( pButton->IsRadioCheckEnabled() )
1144 						pButton->Check( b );
1145 					else
1146 						pButton->SetState( b );
1147 				}
1148 			}
1149 			break;
1150 			case BASEPROPERTY_AUTOTOGGLE:
1151 			{
1152 				sal_Bool b = sal_Bool();
1153 				if ( Value >>= b )
1154 					pButton->EnableRadioCheck( b );
1155 			}
1156 			break;
1157 			default:
1158 			{
1159 				VCLXGraphicControl::setProperty( PropertyName, Value );
1160 			}
1161 		}
1162 	}
1163 }
1164 
1165 ::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1166 {
1167 	::vos::OGuard aGuard( GetMutex() );
1168 
1169 	::com::sun::star::uno::Any aProp;
1170 	RadioButton* pButton = (RadioButton*)GetWindow();
1171 	if ( pButton )
1172 	{
1173 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1174 		switch ( nPropType )
1175 		{
1176             case BASEPROPERTY_VISUALEFFECT:
1177                 aProp = ::toolkit::getVisualEffect( pButton );
1178                 break;
1179 			case BASEPROPERTY_STATE:
1180 				aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 );
1181     			break;
1182 			case BASEPROPERTY_AUTOTOGGLE:
1183 				aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled();
1184     			break;
1185 			default:
1186 			{
1187 				aProp <<= VCLXGraphicControl::getProperty( PropertyName );
1188 			}
1189 		}
1190 	}
1191 	return aProp;
1192 }
1193 
1194 void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1195 {
1196 	::vos::OGuard aGuard( GetMutex() );
1197 	maItemListeners.addInterface( l );
1198 }
1199 
1200 void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1201 {
1202 	::vos::OGuard aGuard( GetMutex() );
1203 	maItemListeners.removeInterface( l );
1204 }
1205 
1206 void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
1207 {
1208 	::vos::OGuard aGuard( GetMutex() );
1209 	maActionListeners.addInterface( l );
1210 }
1211 
1212 void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1213 {
1214 	::vos::OGuard aGuard( GetMutex() );
1215 	maActionListeners.removeInterface( l );
1216 }
1217 
1218 void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
1219 {
1220 	::vos::OGuard aGuard( GetMutex() );
1221 
1222 	Window* pWindow = GetWindow();
1223 	if ( pWindow )
1224 		pWindow->SetText( rLabel );
1225 }
1226 
1227 void VCLXRadioButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
1228 {
1229 	::vos::OGuard aGuard( GetMutex() );
1230 	maActionCommand = rCommand;
1231 }
1232 
1233 void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
1234 {
1235 	::vos::OGuard aGuard( GetMutex() );
1236 
1237 	RadioButton* pRadioButton = (RadioButton*)GetWindow();
1238 	if ( pRadioButton)
1239     {
1240 		pRadioButton->Check( b );
1241         // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
1242         // But this is needed in old code because Accessibility API uses it.
1243         // pRadioButton->GetClickHdl().Call( pRadioButton );
1244 
1245         // #107218# Call same virtual methods and listeners like VCL would do after user interaction
1246         SetSynthesizingVCLEvent( sal_True );
1247         pRadioButton->Click();
1248         SetSynthesizingVCLEvent( sal_False );
1249     }
1250 }
1251 
1252 sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException)
1253 {
1254 	::vos::OGuard aGuard( GetMutex() );
1255 
1256 	RadioButton* pRadioButton = (RadioButton*)GetWindow();
1257 	return pRadioButton ? pRadioButton->IsChecked() : sal_False;
1258 }
1259 
1260 ::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
1261 {
1262 	::vos::OGuard aGuard( GetMutex() );
1263 
1264 	Size aSz;
1265 	RadioButton* pRadioButton = (RadioButton*) GetWindow();
1266 	if ( pRadioButton )
1267 		aSz = pRadioButton->CalcMinimumSize();
1268 	return AWTSize(aSz);
1269 }
1270 
1271 ::com::sun::star::awt::Size VCLXRadioButton::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
1272 {
1273 	return getMinimumSize();
1274 }
1275 
1276 ::com::sun::star::awt::Size VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
1277 {
1278 	::vos::OGuard aGuard( GetMutex() );
1279 
1280 	Size aSz = VCLSize(rNewSize);
1281 	RadioButton* pRadioButton = (RadioButton*) GetWindow();
1282 	if ( pRadioButton )
1283 	{
1284 		Size aMinSz = pRadioButton->CalcMinimumSize();
1285 		if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
1286 			aSz.Height() = aMinSz.Height();
1287 		else
1288 			aSz = aMinSz;
1289 	}
1290 	return AWTSize(aSz);
1291 }
1292 
1293 void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1294 {
1295     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1296         // since we call listeners below, there is a potential that we will be destroyed
1297         // in during the listener call. To prevent the resulting crashs, we keep us
1298         // alive as long as we're here
1299         // #20178# - 2003-10-01 - fs@openoffice.org
1300 
1301 	switch ( rVclWindowEvent.GetId() )
1302 	{
1303 		case VCLEVENT_BUTTON_CLICK:
1304 			if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
1305 			{
1306 				::com::sun::star::awt::ActionEvent aEvent;
1307 				aEvent.Source = (::cppu::OWeakObject*)this;
1308 				aEvent.ActionCommand = maActionCommand;
1309 				maActionListeners.actionPerformed( aEvent );
1310 			}
1311 			ImplClickedOrToggled( sal_False );
1312             break;
1313 
1314 		case VCLEVENT_RADIOBUTTON_TOGGLE:
1315 		    ImplClickedOrToggled( sal_True );
1316             break;
1317 
1318 		default:
1319 			VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
1320 			break;
1321 	}
1322 }
1323 
1324 void VCLXRadioButton::ImplClickedOrToggled( sal_Bool bToggled )
1325 {
1326 	// In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
1327 	// In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
1328 	RadioButton* pRadioButton = (RadioButton*)GetWindow();
1329 	if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() )
1330 	{
1331 		::com::sun::star::awt::ItemEvent aEvent;
1332 		aEvent.Source = (::cppu::OWeakObject*)this;
1333 		aEvent.Highlighted = sal_False;
1334 		aEvent.Selected = pRadioButton->IsChecked();
1335 		maItemListeners.itemStateChanged( aEvent );
1336 	}
1337 }
1338 
1339 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener ()
1340 {
1341     if (!maItemListeners.getLength ())
1342         return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ();
1343     return maActionListeners.getElements()[0];
1344 }
1345 
1346 //	----------------------------------------------------
1347 //	class VCLXSpinField
1348 //	----------------------------------------------------
1349 void VCLXSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1350 {
1351     PushPropertyIds( rIds,
1352                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
1353                      0 );
1354     VCLXEdit::ImplGetPropertyIds( rIds );
1355 }
1356 
1357 VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
1358 {
1359 }
1360 
1361 // ::com::sun::star::uno::XInterface
1362 ::com::sun::star::uno::Any VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
1363 {
1364 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
1365 										SAL_STATIC_CAST( ::com::sun::star::awt::XSpinField*, this ) );
1366 	return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
1367 }
1368 
1369 // ::com::sun::star::lang::XTypeProvider
1370 IMPL_XTYPEPROVIDER_START( VCLXSpinField )
1371 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinField>* ) NULL ),
1372 	VCLXEdit::getTypes()
1373 IMPL_XTYPEPROVIDER_END
1374 
1375 void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1376 {
1377 	::vos::OGuard aGuard( GetMutex() );
1378 	maSpinListeners.addInterface( l );
1379 }
1380 
1381 void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1382 {
1383 	::vos::OGuard aGuard( GetMutex() );
1384 	maSpinListeners.removeInterface( l );
1385 }
1386 
1387 void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException)
1388 {
1389 	::vos::OGuard aGuard( GetMutex() );
1390 
1391 	SpinField* pSpinField = (SpinField*) GetWindow();
1392 	if ( pSpinField )
1393 		pSpinField->Up();
1394 }
1395 
1396 void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException)
1397 {
1398 	::vos::OGuard aGuard( GetMutex() );
1399 
1400 	SpinField* pSpinField = (SpinField*) GetWindow();
1401 	if ( pSpinField )
1402 		pSpinField->Down();
1403 }
1404 
1405 void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException)
1406 {
1407 	::vos::OGuard aGuard( GetMutex() );
1408 
1409 	SpinField* pSpinField = (SpinField*) GetWindow();
1410 	if ( pSpinField )
1411 		pSpinField->First();
1412 }
1413 
1414 void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException)
1415 {
1416 	::vos::OGuard aGuard( GetMutex() );
1417 
1418 	SpinField* pSpinField = (SpinField*) GetWindow();
1419 	if ( pSpinField )
1420 		pSpinField->Last();
1421 }
1422 
1423 void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
1424 {
1425 	::vos::OGuard aGuard( GetMutex() );
1426 
1427 	Window* pWindow = GetWindow();
1428 	if ( pWindow )
1429 	{
1430 		WinBits nStyle = pWindow->GetStyle();
1431 		if ( bRepeat )
1432 			nStyle |= WB_REPEAT;
1433 		else
1434 			nStyle &= ~WB_REPEAT;
1435 		pWindow->SetStyle( nStyle );
1436 	}
1437 }
1438 
1439 void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1440 {
1441 	switch ( rVclWindowEvent.GetId() )
1442 	{
1443 		case VCLEVENT_SPINFIELD_UP:
1444 		case VCLEVENT_SPINFIELD_DOWN:
1445 		case VCLEVENT_SPINFIELD_FIRST:
1446 		case VCLEVENT_SPINFIELD_LAST:
1447         {
1448             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1449                 // since we call listeners below, there is a potential that we will be destroyed
1450                 // in during the listener call. To prevent the resulting crashs, we keep us
1451                 // alive as long as we're here
1452                 // #20178# - 2003-10-01 - fs@openoffice.org
1453 
1454 			if ( maSpinListeners.getLength() )
1455 			{
1456 				::com::sun::star::awt::SpinEvent aEvent;
1457 				aEvent.Source = (::cppu::OWeakObject*)this;
1458 				switch ( rVclWindowEvent.GetId() )
1459 				{
1460 					case VCLEVENT_SPINFIELD_UP:     maSpinListeners.up( aEvent );
1461 													break;
1462 					case VCLEVENT_SPINFIELD_DOWN:   maSpinListeners.down( aEvent );
1463 													break;
1464 					case VCLEVENT_SPINFIELD_FIRST:  maSpinListeners.first( aEvent );
1465 													break;
1466 					case VCLEVENT_SPINFIELD_LAST:   maSpinListeners.last( aEvent );
1467 													break;
1468 				}
1469 
1470 			}
1471 		}
1472 		break;
1473 
1474 		default:
1475 			VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
1476 			break;
1477 	}
1478 }
1479 
1480 
1481 //	----------------------------------------------------
1482 //	class VCLXListBox
1483 //	----------------------------------------------------
1484 void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
1485 {
1486     PushPropertyIds( rIds,
1487                      BASEPROPERTY_BACKGROUNDCOLOR,
1488                      BASEPROPERTY_BORDER,
1489                      BASEPROPERTY_BORDERCOLOR,
1490                      BASEPROPERTY_DEFAULTCONTROL,
1491                      BASEPROPERTY_DROPDOWN,
1492                      BASEPROPERTY_ENABLED,
1493                      BASEPROPERTY_ENABLEVISIBLE,
1494                      BASEPROPERTY_FONTDESCRIPTOR,
1495                      BASEPROPERTY_HELPTEXT,
1496                      BASEPROPERTY_HELPURL,
1497                      BASEPROPERTY_LINECOUNT,
1498                      BASEPROPERTY_MULTISELECTION,
1499                      BASEPROPERTY_MULTISELECTION_SIMPLEMODE,
1500                      BASEPROPERTY_ITEM_SEPARATOR_POS,
1501                      BASEPROPERTY_PRINTABLE,
1502                      BASEPROPERTY_SELECTEDITEMS,
1503                      BASEPROPERTY_STRINGITEMLIST,
1504                      BASEPROPERTY_TABSTOP,
1505                      BASEPROPERTY_READONLY,
1506                      BASEPROPERTY_ALIGN,
1507                      BASEPROPERTY_WRITING_MODE,
1508                      BASEPROPERTY_CONTEXT_WRITING_MODE,
1509                      BASEPROPERTY_REFERENCE_DEVICE,
1510                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
1511                      0);
1512     VCLXWindow::ImplGetPropertyIds( rIds );
1513 }
1514 
1515 
1516 VCLXListBox::VCLXListBox()
1517 	: maActionListeners( *this ),
1518 	  maItemListeners( *this )
1519 {
1520 }
1521 
1522 void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
1523 {
1524 	::vos::OGuard aGuard( GetMutex() );
1525 
1526 	::com::sun::star::lang::EventObject aObj;
1527 	aObj.Source = (::cppu::OWeakObject*)this;
1528 	maItemListeners.disposeAndClear( aObj );
1529 	maActionListeners.disposeAndClear( aObj );
1530 	VCLXWindow::dispose();
1531 }
1532 
1533 void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1534 {
1535 	::vos::OGuard aGuard( GetMutex() );
1536 	maItemListeners.addInterface( l );
1537 }
1538 
1539 void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1540 {
1541 	::vos::OGuard aGuard( GetMutex() );
1542 	maItemListeners.removeInterface( l );
1543 }
1544 
1545 void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1546 {
1547 	::vos::OGuard aGuard( GetMutex() );
1548 	maActionListeners.addInterface( l );
1549 }
1550 
1551 void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
1552 {
1553 	::vos::OGuard aGuard( GetMutex() );
1554 	maActionListeners.removeInterface( l );
1555 }
1556 
1557 void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1558 {
1559 	::vos::OGuard aGuard( GetMutex() );
1560 
1561 	ListBox* pBox = (ListBox*) GetWindow();
1562 	if ( pBox )
1563 		pBox->InsertEntry( aItem, nPos );
1564 }
1565 
1566 void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1567 {
1568 	::vos::OGuard aGuard( GetMutex() );
1569 
1570 	ListBox* pBox = (ListBox*) GetWindow();
1571 	if ( pBox )
1572 	{
1573 	    sal_uInt16 nP = nPos;
1574         const ::rtl::OUString* pItems = aItems.getConstArray();
1575         const ::rtl::OUString* pItemsEnd = aItems.getConstArray() + aItems.getLength();
1576 		while ( pItems != pItemsEnd )
1577 		{
1578 			if ( (sal_uInt16)nP == 0xFFFF )
1579             {
1580                 OSL_ENSURE( false, "VCLXListBox::addItems: too many entries!" );
1581                 // skip remaining entries, list cannot hold them, anyway
1582                 break;
1583             }
1584 
1585             pBox->InsertEntry( *pItems++, nP++ );
1586 		}
1587 	}
1588 }
1589 
1590 void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
1591 {
1592 	::vos::OGuard aGuard( GetMutex() );
1593 
1594 	ListBox* pBox = (ListBox*) GetWindow();
1595 	if ( pBox )
1596 	{
1597 		for ( sal_uInt16 n = nCount; n; )
1598 			pBox->RemoveEntry( nPos + (--n) );
1599 	}
1600 }
1601 
1602 sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
1603 {
1604 	::vos::OGuard aGuard( GetMutex() );
1605 
1606 	ListBox* pBox = (ListBox*) GetWindow();
1607 	return pBox ? pBox->GetEntryCount() : 0;
1608 }
1609 
1610 ::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
1611 {
1612 	::vos::OGuard aGuard( GetMutex() );
1613 
1614 	String aItem;
1615 	ListBox* pBox = (ListBox*) GetWindow();
1616 	if ( pBox )
1617 		aItem = pBox->GetEntry( nPos );
1618 	return aItem;
1619 }
1620 
1621 ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException)
1622 {
1623 	::vos::OGuard aGuard( GetMutex() );
1624 
1625 	::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
1626 	ListBox* pBox = (ListBox*) GetWindow();
1627 	if ( pBox )
1628 	{
1629 		sal_uInt16 nEntries = pBox->GetEntryCount();
1630 		aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
1631 		for ( sal_uInt16 n = nEntries; n; )
1632 		{
1633 			--n;
1634 			aSeq.getArray()[n] = ::rtl::OUString( pBox->GetEntry( n ) );
1635 		}
1636 	}
1637 	return aSeq;
1638 }
1639 
1640 sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException)
1641 {
1642 	::vos::OGuard aGuard( GetMutex() );
1643 
1644 	ListBox* pBox = (ListBox*) GetWindow();
1645 	return pBox ? pBox->GetSelectEntryPos() : 0;
1646 }
1647 
1648 ::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException)
1649 {
1650 	::vos::OGuard aGuard( GetMutex() );
1651 
1652 	::com::sun::star::uno::Sequence<sal_Int16> aSeq;
1653 	ListBox* pBox = (ListBox*) GetWindow();
1654 	if ( pBox )
1655 	{
1656 		sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
1657 		aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries );
1658 		for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
1659 			aSeq.getArray()[n] = pBox->GetSelectEntryPos( n );
1660 	}
1661 	return aSeq;
1662 }
1663 
1664 ::rtl::OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException)
1665 {
1666 	::vos::OGuard aGuard( GetMutex() );
1667 
1668 	String aItem;
1669 	ListBox* pBox = (ListBox*) GetWindow();
1670 	if ( pBox )
1671 		aItem = pBox->GetSelectEntry();
1672 	return aItem;
1673 }
1674 
1675 ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException)
1676 {
1677 	::vos::OGuard aGuard( GetMutex() );
1678 
1679 	::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
1680 	ListBox* pBox = (ListBox*) GetWindow();
1681 	if ( pBox )
1682 	{
1683 		sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
1684 		aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nSelEntries );
1685 		for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
1686 			aSeq.getArray()[n] = ::rtl::OUString( pBox->GetSelectEntry( n ) );
1687 	}
1688 	return aSeq;
1689 }
1690 
1691 void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1692 {
1693 	::vos::OGuard aGuard( GetMutex() );
1694 
1695 	ListBox* pBox = (ListBox*) GetWindow();
1696 	if ( pBox && ( pBox->IsEntryPosSelected( nPos ) != bSelect ) )
1697     {
1698 		pBox->SelectEntryPos( nPos, bSelect );
1699 
1700         // VCL doesn't call select handler after API call.
1701         // ImplCallItemListeners();
1702 
1703         // #107218# Call same listeners like VCL would do after user interaction
1704         SetSynthesizingVCLEvent( sal_True );
1705         pBox->Select();
1706         SetSynthesizingVCLEvent( sal_False );
1707     }
1708 }
1709 
1710 void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1711 {
1712 	::vos::OGuard aGuard( GetMutex() );
1713 
1714 	ListBox* pBox = (ListBox*) GetWindow();
1715 	if ( pBox )
1716 	{
1717         sal_Bool bChanged = sal_False;
1718 		for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
1719         {
1720             sal_uInt16 nPos = (sal_uInt16) aPositions.getConstArray()[--n];
1721             if ( pBox->IsEntryPosSelected( nPos ) != bSelect )
1722             {
1723 			    pBox->SelectEntryPos( nPos, bSelect );
1724                 bChanged = sal_True;
1725             }
1726         }
1727 
1728         if ( bChanged )
1729         {
1730             // VCL doesn't call select handler after API call.
1731             // ImplCallItemListeners();
1732 
1733             // #107218# Call same listeners like VCL would do after user interaction
1734             SetSynthesizingVCLEvent( sal_True );
1735             pBox->Select();
1736             SetSynthesizingVCLEvent( sal_False );
1737         }
1738 	}
1739 }
1740 
1741 void VCLXListBox::selectItem( const ::rtl::OUString& rItemText, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
1742 {
1743 	::vos::OGuard aGuard( GetMutex() );
1744 
1745 	ListBox* pBox = (ListBox*) GetWindow();
1746 	if ( pBox )
1747     {
1748         String aItemText( rItemText );
1749 		selectItemPos( pBox->GetEntryPos( aItemText ), bSelect );
1750     }
1751 }
1752 
1753 
1754 void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
1755 {
1756 	::vos::OGuard aGuard( GetMutex() );
1757 
1758 	ListBox* pBox = (ListBox*) GetWindow();
1759 	if ( pBox )
1760 		pBox->SetDropDownLineCount( nLines );
1761 }
1762 
1763 sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
1764 {
1765 	::vos::OGuard aGuard( GetMutex() );
1766 
1767 	sal_Int16 nLines = 0;
1768 	ListBox* pBox = (ListBox*) GetWindow();
1769 	if ( pBox )
1770 		nLines = pBox->GetDropDownLineCount();
1771 	return nLines;
1772 }
1773 
1774 sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException)
1775 {
1776 	::vos::OGuard aGuard( GetMutex() );
1777 
1778 	sal_Bool bMulti = sal_False;
1779 	ListBox* pBox = (ListBox*) GetWindow();
1780 	if ( pBox )
1781 		bMulti = pBox->IsMultiSelectionEnabled();
1782 	return bMulti;
1783 }
1784 
1785 void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException)
1786 {
1787 	::vos::OGuard aGuard( GetMutex() );
1788 
1789 	ListBox* pBox = (ListBox*) GetWindow();
1790 	if ( pBox )
1791 		pBox->EnableMultiSelection( bMulti );
1792 }
1793 
1794 void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException)
1795 {
1796 	::vos::OGuard aGuard( GetMutex() );
1797 
1798 	ListBox* pBox = (ListBox*) GetWindow();
1799 	if ( pBox )
1800 		pBox->SetTopEntry( nEntry );
1801 }
1802 
1803 void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
1804 {
1805     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
1806         // since we call listeners below, there is a potential that we will be destroyed
1807         // in during the listener call. To prevent the resulting crashs, we keep us
1808         // alive as long as we're here
1809         // #20178# - 2003-10-01 - fs@openoffice.org
1810 
1811 	switch ( rVclWindowEvent.GetId() )
1812 	{
1813 		case VCLEVENT_LISTBOX_SELECT:
1814 		{
1815 			ListBox* pListBox = (ListBox*)GetWindow();
1816 
1817             if( pListBox )
1818             {
1819 			    sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False;
1820 			    if ( bDropDown && !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
1821 			    {
1822 				    // Bei DropDown den ActionListener rufen...
1823 				    ::com::sun::star::awt::ActionEvent aEvent;
1824 				    aEvent.Source = (::cppu::OWeakObject*)this;
1825 				    aEvent.ActionCommand = pListBox->GetSelectEntry();
1826 				    maActionListeners.actionPerformed( aEvent );
1827 			    }
1828 
1829 			    if ( maItemListeners.getLength() )
1830 			    {
1831                     ImplCallItemListeners();
1832 			    }
1833             }
1834 		}
1835 		break;
1836 
1837 		case VCLEVENT_LISTBOX_DOUBLECLICK:
1838 			if ( GetWindow() && maActionListeners.getLength() )
1839 			{
1840 				::com::sun::star::awt::ActionEvent aEvent;
1841 				aEvent.Source = (::cppu::OWeakObject*)this;
1842 				aEvent.ActionCommand = ((ListBox*)GetWindow())->GetSelectEntry();
1843 				maActionListeners.actionPerformed( aEvent );
1844 			}
1845     		break;
1846 
1847 		default:
1848             VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
1849 			break;
1850 	}
1851 }
1852 
1853 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXListBox::CreateAccessibleContext()
1854 {
1855 	::vos::OGuard aGuard( GetMutex() );
1856 
1857     return getAccessibleFactory().createAccessibleContext( this );
1858 }
1859 
1860 void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
1861 {
1862 	::vos::OGuard aGuard( GetMutex() );
1863 
1864 	ListBox* pListBox = (ListBox*)GetWindow();
1865 	if ( pListBox )
1866 	{
1867 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1868 		switch ( nPropType )
1869 		{
1870             case BASEPROPERTY_ITEM_SEPARATOR_POS:
1871             {
1872                 sal_Int16 nSeparatorPos(0);
1873                 if ( Value >>= nSeparatorPos )
1874                     pListBox->SetSeparatorPos( nSeparatorPos );
1875             }
1876             break;
1877 			case BASEPROPERTY_READONLY:
1878 			{
1879 				sal_Bool b = sal_Bool();
1880 				if ( Value >>= b )
1881  					pListBox->SetReadOnly( b);
1882 			}
1883 			break;
1884 			case BASEPROPERTY_MULTISELECTION:
1885 			{
1886 				sal_Bool b = sal_Bool();
1887 				if ( Value >>= b )
1888  					pListBox->EnableMultiSelection( b );
1889 			}
1890 			break;
1891 			case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
1892                 ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False );
1893 			    break;
1894 			case BASEPROPERTY_LINECOUNT:
1895 			{
1896 				sal_Int16 n = sal_Int16();
1897 				if ( Value >>= n )
1898  					pListBox->SetDropDownLineCount( n );
1899 			}
1900 			break;
1901 			case BASEPROPERTY_STRINGITEMLIST:
1902 			{
1903 				::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
1904 				if ( Value >>= aItems )
1905 				{
1906 					pListBox->Clear();
1907 					addItems( aItems, 0 );
1908 				}
1909 			}
1910 			break;
1911 			case BASEPROPERTY_SELECTEDITEMS:
1912 			{
1913 				::com::sun::star::uno::Sequence<sal_Int16> aItems;
1914 				if ( Value >>= aItems )
1915 				{
1916 					for ( sal_uInt16 n = pListBox->GetEntryCount(); n; )
1917 						pListBox->SelectEntryPos( --n, sal_False );
1918 
1919                     if ( aItems.getLength() )
1920 					    selectItemsPos( aItems, sal_True );
1921                     else
1922                         pListBox->SetNoSelection();
1923 
1924 					if ( !pListBox->GetSelectEntryCount() )
1925 						pListBox->SetTopEntry( 0 );
1926 				}
1927 			}
1928 			break;
1929 			default:
1930 			{
1931 				VCLXWindow::setProperty( PropertyName, Value );
1932 			}
1933 		}
1934 	}
1935 }
1936 
1937 ::com::sun::star::uno::Any VCLXListBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
1938 {
1939 	::vos::OGuard aGuard( GetMutex() );
1940 
1941 	::com::sun::star::uno::Any aProp;
1942 	ListBox* pListBox = (ListBox*)GetWindow();
1943 	if ( pListBox )
1944 	{
1945 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
1946 		switch ( nPropType )
1947 		{
1948             case BASEPROPERTY_ITEM_SEPARATOR_POS:
1949                 aProp <<= sal_Int16( pListBox->GetSeparatorPos() );
1950                 break;
1951 			case BASEPROPERTY_READONLY:
1952 			{
1953  				aProp <<= (sal_Bool) pListBox->IsReadOnly();
1954 			}
1955 			break;
1956 			case BASEPROPERTY_MULTISELECTION:
1957 			{
1958  				aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
1959 			}
1960 			break;
1961 			case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
1962             {
1963                 aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 );
1964             }
1965             break;
1966 			case BASEPROPERTY_LINECOUNT:
1967 			{
1968  				aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
1969 			}
1970 			break;
1971 			case BASEPROPERTY_STRINGITEMLIST:
1972 			{
1973 				sal_uInt16 nItems = pListBox->GetEntryCount();
1974 				::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
1975 				::rtl::OUString* pStrings = aSeq.getArray();
1976 				for ( sal_uInt16 n = 0; n < nItems; n++ )
1977 					pStrings[n] = pListBox->GetEntry( n );
1978 				aProp <<= aSeq;
1979 
1980 			}
1981 			break;
1982 			default:
1983 			{
1984 				aProp <<= VCLXWindow::getProperty( PropertyName );
1985 			}
1986 		}
1987 	}
1988 	return aProp;
1989 }
1990 
1991 ::com::sun::star::awt::Size VCLXListBox::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
1992 {
1993 	::vos::OGuard aGuard( GetMutex() );
1994 
1995 	Size aSz;
1996 	ListBox* pListBox = (ListBox*) GetWindow();
1997 	if ( pListBox )
1998 		aSz = pListBox->CalcMinimumSize();
1999 	return AWTSize(aSz);
2000 }
2001 
2002 ::com::sun::star::awt::Size VCLXListBox::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
2003 {
2004 	::vos::OGuard aGuard( GetMutex() );
2005 
2006 	Size aSz;
2007 	ListBox* pListBox = (ListBox*) GetWindow();
2008 	if ( pListBox )
2009 	{
2010 		aSz = pListBox->CalcMinimumSize();
2011 		if ( pListBox->GetStyle() & WB_DROPDOWN )
2012 			aSz.Height() += 4;
2013 	}
2014 	return AWTSize(aSz);
2015 }
2016 
2017 ::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
2018 {
2019 	::vos::OGuard aGuard( GetMutex() );
2020 
2021 	Size aSz = VCLSize(rNewSize);
2022 	ListBox* pListBox = (ListBox*) GetWindow();
2023 	if ( pListBox )
2024 		aSz = pListBox->CalcAdjustedSize( aSz );
2025 	return AWTSize(aSz);
2026 }
2027 
2028 ::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
2029 {
2030 	::vos::OGuard aGuard( GetMutex() );
2031 
2032 	Size aSz;
2033 	ListBox* pListBox = (ListBox*) GetWindow();
2034 	if ( pListBox )
2035 		aSz = pListBox->CalcSize( nCols, nLines );
2036 	return AWTSize(aSz);
2037 }
2038 
2039 void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
2040 {
2041 	::vos::OGuard aGuard( GetMutex() );
2042 
2043 	nCols = nLines = 0;
2044 	ListBox* pListBox = (ListBox*) GetWindow();
2045 	if ( pListBox )
2046 	{
2047 		sal_uInt16 nC, nL;
2048 		pListBox->GetMaxVisColumnsAndLines( nC, nL );
2049 		nCols = nC;
2050 		nLines = nL;
2051 	}
2052 }
2053 
2054 void VCLXListBox::ImplCallItemListeners()
2055 {
2056 	ListBox* pListBox = (ListBox*) GetWindow();
2057     if ( pListBox && maItemListeners.getLength() )
2058     {
2059 	    ::com::sun::star::awt::ItemEvent aEvent;
2060 	    aEvent.Source = (::cppu::OWeakObject*)this;
2061 	    aEvent.Highlighted = sal_False;
2062 
2063 	    // Bei Mehrfachselektion 0xFFFF, sonst die ID
2064 	    aEvent.Selected = (pListBox->GetSelectEntryCount() == 1 ) ? pListBox->GetSelectEntryPos() : 0xFFFF;
2065 
2066 	    maItemListeners.itemStateChanged( aEvent );
2067     }
2068 }
2069 namespace
2070 {
2071 	 Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
2072 	 {
2073 		 if ( !i_rImageURL.getLength() )
2074 			 return Image();
2075 
2076 		try
2077 		{
2078 			 ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
2079 			 Reference< XGraphicProvider > xProvider;
2080 			 if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
2081 			 {
2082 				 ::comphelper::NamedValueCollection aMediaProperties;
2083 				 aMediaProperties.put( "URL", i_rImageURL );
2084 				 Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
2085 				return Image( xGraphic );
2086 			 }
2087 		 }
2088 		 catch( const uno::Exception& )
2089 		 {
2090 			 DBG_UNHANDLED_EXCEPTION();
2091 		 }
2092 		 return Image();
2093 	 }
2094 }
2095 void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2096 {
2097 	::vos::OGuard aGuard( GetMutex() );
2098 
2099     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2100 
2101     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
2102     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
2103         "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
2104     pListBox->InsertEntry(
2105         i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
2106         i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
2107         i_rEvent.ItemPosition );
2108 }
2109 
2110 void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2111 {
2112 	::vos::OGuard aGuard( GetMutex() );
2113 
2114     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2115 
2116     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
2117     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
2118         "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
2119 
2120     pListBox->RemoveEntry( i_rEvent.ItemPosition );
2121 }
2122 
2123 void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
2124 {
2125 	::vos::OGuard aGuard( GetMutex() );
2126 
2127     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2128 
2129     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2130     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
2131         "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
2132 
2133     // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
2134 
2135     const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
2136     const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition  ) );
2137 
2138     pListBox->RemoveEntry( i_rEvent.ItemPosition );
2139     pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
2140 }
2141 
2142 void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
2143 {
2144 	::vos::OGuard aGuard( GetMutex() );
2145 
2146     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2147     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2148 
2149     pListBox->Clear();
2150 
2151     (void)i_rEvent;
2152 }
2153 
2154 void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
2155 {
2156 	::vos::OGuard aGuard( GetMutex() );
2157 
2158     ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
2159     ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
2160 
2161     pListBox->Clear();
2162 
2163     uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
2164     uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
2165     uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
2166     if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
2167     {
2168         xStringResourceResolver.set(
2169             xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
2170             uno::UNO_QUERY
2171         );
2172     }
2173 
2174 
2175     Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
2176     uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
2177     for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
2178     {
2179         ::rtl::OUString aLocalizationKey( aItems[i].First );
2180         if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
2181         {
2182             aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
2183         }
2184         pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
2185     }
2186 }
2187 
2188 void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
2189 {
2190     // just disambiguate
2191     VCLXWindow::disposing( i_rEvent );
2192 }
2193 
2194 //	----------------------------------------------------
2195 //	class VCLXMessageBox
2196 //	----------------------------------------------------
2197 
2198 void VCLXMessageBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2199 {
2200     VCLXTopWindow::ImplGetPropertyIds( rIds );
2201 }
2202 
2203 VCLXMessageBox::VCLXMessageBox()
2204 {
2205 }
2206 
2207 VCLXMessageBox::~VCLXMessageBox()
2208 {
2209 }
2210 
2211 // ::com::sun::star::uno::XInterface
2212 ::com::sun::star::uno::Any VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2213 {
2214 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2215 										SAL_STATIC_CAST( ::com::sun::star::awt::XMessageBox*, this ) );
2216 	return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
2217 }
2218 
2219 // ::com::sun::star::lang::XTypeProvider
2220 IMPL_XTYPEPROVIDER_START( VCLXMessageBox )
2221 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ),
2222 	VCLXTopWindow::getTypes()
2223 IMPL_XTYPEPROVIDER_END
2224 
2225 void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
2226 {
2227 	::vos::OGuard aGuard( GetMutex() );
2228 
2229 	Window* pWindow = GetWindow();
2230 	if ( pWindow )
2231 		pWindow->SetText( rText );
2232 }
2233 
2234 ::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException)
2235 {
2236 	::vos::OGuard aGuard( GetMutex() );
2237 
2238 	String aText;
2239 	Window* pWindow = GetWindow();
2240 	if ( pWindow )
2241 		aText = pWindow->GetText();
2242 	return aText;
2243 }
2244 
2245 void VCLXMessageBox::setMessageText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
2246 {
2247 	::vos::OGuard aGuard( GetMutex() );
2248 
2249 	MessBox* pBox = (MessBox*)GetWindow();
2250 	if ( pBox )
2251 		pBox->SetMessText( rText );
2252 }
2253 
2254 ::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException)
2255 {
2256 	::vos::OGuard aGuard( GetMutex() );
2257 
2258 	::rtl::OUString aText;
2259 	MessBox* pBox = (MessBox*)GetWindow();
2260 	if ( pBox )
2261 		aText = pBox->GetMessText();
2262 	return aText;
2263 }
2264 
2265 sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException)
2266 {
2267 	::vos::OGuard aGuard( GetMutex() );
2268 
2269 	MessBox* pBox = (MessBox*)GetWindow();
2270 	return pBox ? pBox->Execute() : 0;
2271 }
2272 
2273 ::com::sun::star::awt::Size SAL_CALL VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
2274 {
2275     ::vos::OGuard aGuard( GetMutex() );
2276     return ::com::sun::star::awt::Size( 250, 100 );
2277 }
2278 
2279 //	----------------------------------------------------
2280 //	class VCLXDialog
2281 //	----------------------------------------------------
2282 void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2283 {
2284     VCLXTopWindow::ImplGetPropertyIds( rIds );
2285 }
2286 
2287 VCLXDialog::VCLXDialog()
2288 {
2289 }
2290 
2291 VCLXDialog::~VCLXDialog()
2292 {
2293 #ifndef __SUNPRO_CC
2294     OSL_TRACE ("%s", __FUNCTION__);
2295 #endif
2296 }
2297 
2298 // ::com::sun::star::uno::XInterface
2299 ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2300 {
2301 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2302 										SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ),
2303 										SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
2304 	return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
2305 }
2306 
2307 // ::com::sun::star::lang::XTypeProvider
2308 IMPL_XTYPEPROVIDER_START( VCLXDialog )
2309 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
2310 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
2311 	VCLXTopWindow::getTypes()
2312 IMPL_XTYPEPROVIDER_END
2313 
2314 void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
2315 {
2316     ::vos::OGuard aGuard( GetMutex() );
2317 
2318     Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
2319     if ( pDialog )
2320         pDialog->EndDialog( i_result );
2321 }
2322 
2323 void SAL_CALL VCLXDialog::setHelpId( const ::rtl::OUString& rId ) throw (RuntimeException)
2324 {
2325     ::vos::OGuard aGuard( GetMutex() );
2326 
2327     Window* pWindow = GetWindow();
2328     if ( pWindow )
2329         pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) );
2330 }
2331 
2332 void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
2333 {
2334 	::vos::OGuard aGuard( GetMutex() );
2335 
2336 	Window* pWindow = GetWindow();
2337 	if ( pWindow )
2338 		pWindow->SetText( Title );
2339 }
2340 
2341 ::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
2342 {
2343 	::vos::OGuard aGuard( GetMutex() );
2344 
2345 	::rtl::OUString aTitle;
2346 	Window* pWindow = GetWindow();
2347 	if ( pWindow )
2348 		aTitle = pWindow->GetText();
2349 	return aTitle;
2350 }
2351 
2352 sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
2353 {
2354 	::vos::OGuard aGuard( GetMutex() );
2355 
2356 	sal_Int16 nRet = 0;
2357 	if ( GetWindow() )
2358 	{
2359 		Dialog* pDlg = (Dialog*) GetWindow();
2360 		Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
2361 		Window* pOldParent = NULL;
2362         Window* pSetParent = NULL;
2363 		if ( pParent && !pParent->IsReallyVisible() )
2364 		{
2365 			pOldParent = pDlg->GetParent();
2366             Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
2367             if( pFrame != pDlg )
2368             {
2369                 pDlg->SetParent( pFrame );
2370                 pSetParent = pFrame;
2371             }
2372 		}
2373 
2374 		nRet = pDlg->Execute();
2375 
2376         // set the parent back only in case no new parent was set from outside
2377         // in other words, revert only own changes
2378 		if ( pOldParent && pDlg->GetParent() == pSetParent )
2379 			pDlg->SetParent( pOldParent );
2380 	}
2381 	return nRet;
2382 }
2383 
2384 void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
2385 {
2386     endDialog(0);
2387 }
2388 
2389 void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
2390 {
2391 	::vos::OGuard aGuard( GetMutex() );
2392 	Window* pWindow = GetWindow();
2393 
2394 	if ( pWindow )
2395 	{
2396 		OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2397 		if ( !pDev )
2398 			pDev = pWindow->GetParent();
2399 
2400 		Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2401 		Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2402 
2403 		pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2404     }
2405 }
2406 
2407 ::com::sun::star::awt::DeviceInfo VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException)
2408 {
2409 	::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2410 
2411 	::vos::OGuard aGuard( GetMutex() );
2412 	Dialog* pDlg = (Dialog*) GetWindow();
2413 	if ( pDlg )
2414 	    pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
2415 
2416 	return aInfo;
2417 }
2418 
2419 
2420 void SAL_CALL VCLXDialog::setProperty(
2421     const ::rtl::OUString& PropertyName,
2422     const ::com::sun::star::uno::Any& Value )
2423 throw(::com::sun::star::uno::RuntimeException)
2424 {
2425 	::vos::OGuard aGuard( GetMutex() );
2426 
2427 	Dialog* pDialog = (Dialog*)GetWindow();
2428 	if ( pDialog )
2429 	{
2430 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2431 
2432 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
2433 		switch ( nPropType )
2434 		{
2435 			case BASEPROPERTY_GRAPHIC:
2436             {
2437                 Reference< XGraphic > xGraphic;
2438                 if (( Value >>= xGraphic ) && xGraphic.is() )
2439                 {
2440                     Image aImage( xGraphic );
2441 
2442                     Wallpaper aWallpaper( aImage.GetBitmapEx());
2443                     aWallpaper.SetStyle( WALLPAPER_SCALE );
2444                     pDialog->SetBackground( aWallpaper );
2445                 }
2446                 else if ( bVoid || !xGraphic.is() )
2447                 {
2448                     Color aColor = pDialog->GetControlBackground().GetColor();
2449                     if ( aColor == COL_AUTO )
2450                         aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
2451 
2452                     Wallpaper aWallpaper( aColor );
2453                     pDialog->SetBackground( aWallpaper );
2454                 }
2455             }
2456             break;
2457 
2458             default:
2459 			{
2460 				VCLXWindow::setProperty( PropertyName, Value );
2461 			}
2462         }
2463     }
2464 }
2465 
2466 //	----------------------------------------------------
2467 //	class VCLXTabPage
2468 //	----------------------------------------------------
2469 VCLXTabPage::VCLXTabPage()
2470 {
2471 }
2472 
2473 VCLXTabPage::~VCLXTabPage()
2474 {
2475 }
2476 
2477 ::com::sun::star::uno::Any SAL_CALL VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type & rType )
2478 throw(::com::sun::star::uno::RuntimeException)
2479 {
2480 	return VCLXContainer::queryInterface( rType );
2481 }
2482 
2483 // ::com::sun::star::lang::XTypeProvider
2484 IMPL_XTYPEPROVIDER_START( VCLXTabPage )
2485 	VCLXContainer::getTypes()
2486 IMPL_XTYPEPROVIDER_END
2487 
2488 // ::com::sun::star::awt::XView
2489 void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY )
2490 throw(::com::sun::star::uno::RuntimeException)
2491 {
2492 	::vos::OGuard aGuard( GetMutex() );
2493 	Window* pWindow = GetWindow();
2494 
2495 	if ( pWindow )
2496 	{
2497 		OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
2498 		if ( !pDev )
2499 			pDev = pWindow->GetParent();
2500 
2501 		Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
2502 		Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
2503 
2504 		pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
2505     }
2506 }
2507 
2508 // ::com::sun::star::awt::XDevice,
2509 ::com::sun::star::awt::DeviceInfo SAL_CALL VCLXTabPage::getInfo()
2510 throw(::com::sun::star::uno::RuntimeException)
2511 {
2512 	::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
2513 	return aInfo;
2514 }
2515 
2516 void SAL_CALL VCLXTabPage::setProperty(
2517     const ::rtl::OUString& PropertyName,
2518     const ::com::sun::star::uno::Any& Value )
2519 throw(::com::sun::star::uno::RuntimeException)
2520 {
2521 	::vos::OGuard aGuard( GetMutex() );
2522 
2523 	TabPage* pTabPage = (TabPage*)GetWindow();
2524 	if ( pTabPage )
2525 	{
2526 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2527 
2528 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
2529 		switch ( nPropType )
2530 		{
2531 			case BASEPROPERTY_GRAPHIC:
2532             {
2533                 Reference< XGraphic > xGraphic;
2534                 if (( Value >>= xGraphic ) && xGraphic.is() )
2535                 {
2536                     Image aImage( xGraphic );
2537 
2538                     Wallpaper aWallpaper( aImage.GetBitmapEx());
2539                     aWallpaper.SetStyle( WALLPAPER_SCALE );
2540                     pTabPage->SetBackground( aWallpaper );
2541                 }
2542                 else if ( bVoid || !xGraphic.is() )
2543                 {
2544                     Color aColor = pTabPage->GetControlBackground().GetColor();
2545                     if ( aColor == COL_AUTO )
2546                         aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
2547 
2548                     Wallpaper aWallpaper( aColor );
2549                     pTabPage->SetBackground( aWallpaper );
2550                 }
2551             }
2552             break;
2553             case BASEPROPERTY_TITLE:
2554                 {
2555                     ::rtl::OUString sTitle;
2556                     if ( Value >>= sTitle )
2557                     {
2558                         pTabPage->SetText(sTitle);
2559                     }
2560                 }
2561                 break;
2562 
2563             default:
2564 			{
2565 				VCLXContainer::setProperty( PropertyName, Value );
2566 			}
2567         }
2568     }
2569 }
2570 
2571 //	----------------------------------------------------
2572 //  class VCLXFixedHyperlink
2573 //	----------------------------------------------------
2574 VCLXFixedHyperlink::VCLXFixedHyperlink() :
2575 
2576     maActionListeners( *this )
2577 
2578 {
2579 }
2580 
2581 VCLXFixedHyperlink::~VCLXFixedHyperlink()
2582 {
2583 }
2584 
2585 // ::com::sun::star::uno::XInterface
2586 ::com::sun::star::uno::Any VCLXFixedHyperlink::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2587 {
2588 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2589                                         SAL_STATIC_CAST( ::com::sun::star::awt::XFixedHyperlink*, this ) );
2590 	return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
2591 }
2592 
2593 void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException)
2594 {
2595         ::vos::OGuard aGuard( GetMutex() );
2596 
2597         ::com::sun::star::lang::EventObject aObj;
2598         aObj.Source = (::cppu::OWeakObject*)this;
2599         maActionListeners.disposeAndClear( aObj );
2600         VCLXWindow::dispose();
2601 }
2602 
2603 // ::com::sun::star::lang::XTypeProvider
2604 IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink )
2605     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedHyperlink>* ) NULL ),
2606 	VCLXWindow::getTypes()
2607 IMPL_XTYPEPROVIDER_END
2608 
2609 void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
2610 {
2611     switch ( rVclWindowEvent.GetId() )
2612     {
2613         case VCLEVENT_BUTTON_CLICK:
2614         {
2615             if ( maActionListeners.getLength() )
2616             {
2617                 ::com::sun::star::awt::ActionEvent aEvent;
2618                 aEvent.Source = (::cppu::OWeakObject*)this;
2619                 maActionListeners.actionPerformed( aEvent );
2620             }
2621             else
2622             {
2623                 // open the URL
2624                 ::rtl::OUString sURL;
2625                 ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2626                 if ( pBase )
2627                     sURL = pBase->GetURL();
2628                 Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
2629                     ::comphelper::getProcessServiceFactory()->createInstance(
2630                         ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), uno::UNO_QUERY );
2631                 if ( sURL.getLength() > 0 && xSystemShellExecute.is() )
2632                 {
2633                     try
2634                     {
2635                         // start browser
2636                         xSystemShellExecute->execute(
2637                             sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS );
2638                     }
2639                     catch( uno::Exception& )
2640                     {
2641                     }
2642                 }
2643             }
2644         }
2645 
2646         default:
2647             VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
2648             break;
2649     }
2650 }
2651 
2652 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedHyperlink::CreateAccessibleContext()
2653 {
2654     return getAccessibleFactory().createAccessibleContext( this );
2655 }
2656 
2657 void VCLXFixedHyperlink::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
2658 {
2659 	::vos::OGuard aGuard( GetMutex() );
2660 
2661     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2662     if ( pBase )
2663         pBase->SetDescription( Text );
2664 }
2665 
2666 ::rtl::OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException)
2667 {
2668 	::vos::OGuard aGuard( GetMutex() );
2669 
2670 	::rtl::OUString aText;
2671     Window* pWindow = GetWindow();
2672     if ( pWindow )
2673         aText = pWindow->GetText();
2674 	return aText;
2675 }
2676 
2677 void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
2678 {
2679     ::vos::OGuard aGuard( GetMutex() );
2680 
2681     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2682     if ( pBase )
2683         pBase->SetURL( URL );
2684 }
2685 
2686 ::rtl::OUString VCLXFixedHyperlink::getURL(  ) throw(::com::sun::star::uno::RuntimeException)
2687 {
2688     ::vos::OGuard aGuard( GetMutex() );
2689 
2690     ::rtl::OUString aText;
2691     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2692     if ( pBase )
2693         aText = pBase->GetURL();
2694     return aText;
2695 }
2696 
2697 void VCLXFixedHyperlink::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
2698 {
2699 	::vos::OGuard aGuard( GetMutex() );
2700 
2701 	Window* pWindow = GetWindow();
2702 	if ( pWindow )
2703 	{
2704 		WinBits nNewBits = 0;
2705 		if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
2706 			nNewBits = WB_LEFT;
2707 		else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
2708 			nNewBits = WB_CENTER;
2709 		else
2710 			nNewBits = WB_RIGHT;
2711 
2712 		WinBits nStyle = pWindow->GetStyle();
2713 		nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
2714 		pWindow->SetStyle( nStyle | nNewBits );
2715 	}
2716 }
2717 
2718 short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException)
2719 {
2720 	::vos::OGuard aGuard( GetMutex() );
2721 
2722 	short nAlign = 0;
2723 	Window* pWindow = GetWindow();
2724 	if ( pWindow )
2725 	{
2726 		WinBits nStyle = pWindow->GetStyle();
2727 		if ( nStyle & WB_LEFT )
2728 			nAlign = ::com::sun::star::awt::TextAlign::LEFT;
2729 		else if ( nStyle & WB_CENTER )
2730 			nAlign = ::com::sun::star::awt::TextAlign::CENTER;
2731 		else
2732 			nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
2733 	}
2734 	return nAlign;
2735 }
2736 
2737 void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l  )throw(::com::sun::star::uno::RuntimeException)
2738 {
2739         ::vos::OGuard aGuard( GetMutex() );
2740         maActionListeners.addInterface( l );
2741 }
2742 
2743 void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
2744 {
2745         ::vos::OGuard aGuard( GetMutex() );
2746         maActionListeners.removeInterface( l );
2747 }
2748 
2749 ::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
2750 {
2751 	::vos::OGuard aGuard( GetMutex() );
2752 
2753 	Size aSz;
2754     FixedText* pFixedText = (FixedText*)GetWindow();
2755     if ( pFixedText )
2756         aSz = pFixedText->CalcMinimumSize();
2757 	return AWTSize(aSz);
2758 }
2759 
2760 ::com::sun::star::awt::Size VCLXFixedHyperlink::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
2761 {
2762 	return getMinimumSize();
2763 }
2764 
2765 ::com::sun::star::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
2766 {
2767 	::vos::OGuard aGuard( GetMutex() );
2768 
2769 	::com::sun::star::awt::Size aSz = rNewSize;
2770 	::com::sun::star::awt::Size aMinSz = getMinimumSize();
2771 	if ( aSz.Height != aMinSz.Height )
2772 		aSz.Height = aMinSz.Height;
2773 
2774 	return aSz;
2775 }
2776 
2777 void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
2778 {
2779     ::vos::OGuard aGuard( GetMutex() );
2780 
2781     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2782     if ( pBase )
2783     {
2784         sal_uInt16 nPropType = GetPropertyId( PropertyName );
2785         switch ( nPropType )
2786         {
2787             case BASEPROPERTY_LABEL:
2788             {
2789                 ::rtl::OUString sNewLabel;
2790                 if ( Value >>= sNewLabel )
2791                     pBase->SetDescription( sNewLabel );
2792                 break;
2793             }
2794 
2795             case BASEPROPERTY_URL:
2796             {
2797                 ::rtl::OUString sNewURL;
2798                 if ( Value >>= sNewURL )
2799                     pBase->SetURL( sNewURL );
2800                 break;
2801             }
2802 
2803             default:
2804             {
2805                 VCLXWindow::setProperty( PropertyName, Value );
2806             }
2807         }
2808     }
2809 }
2810 
2811 ::com::sun::star::uno::Any VCLXFixedHyperlink::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
2812 {
2813     ::vos::OGuard aGuard( GetMutex() );
2814 
2815     ::com::sun::star::uno::Any aProp;
2816     ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
2817     if ( pBase )
2818     {
2819         sal_uInt16 nPropType = GetPropertyId( PropertyName );
2820         switch ( nPropType )
2821         {
2822             case BASEPROPERTY_URL:
2823             {
2824                 aProp = makeAny( ::rtl::OUString( pBase->GetURL() ) );
2825                 break;
2826             }
2827 
2828             default:
2829             {
2830                 aProp <<= VCLXWindow::getProperty( PropertyName );
2831             }
2832         }
2833     }
2834     return aProp;
2835 }
2836 
2837 void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2838 {
2839     PushPropertyIds( rIds,
2840                      BASEPROPERTY_ALIGN,
2841                      BASEPROPERTY_BACKGROUNDCOLOR,
2842                      BASEPROPERTY_BORDER,
2843                      BASEPROPERTY_BORDERCOLOR,
2844                      BASEPROPERTY_DEFAULTCONTROL,
2845                      BASEPROPERTY_ENABLED,
2846                      BASEPROPERTY_ENABLEVISIBLE,
2847                      BASEPROPERTY_FONTDESCRIPTOR,
2848                      BASEPROPERTY_HELPTEXT,
2849                      BASEPROPERTY_HELPURL,
2850                      BASEPROPERTY_LABEL,
2851                      BASEPROPERTY_MULTILINE,
2852                      BASEPROPERTY_NOLABEL,
2853                      BASEPROPERTY_PRINTABLE,
2854                      BASEPROPERTY_TABSTOP,
2855                      BASEPROPERTY_VERTICALALIGN,
2856                      BASEPROPERTY_URL,
2857                      BASEPROPERTY_WRITING_MODE,
2858                      BASEPROPERTY_CONTEXT_WRITING_MODE,
2859                      0);
2860     VCLXWindow::ImplGetPropertyIds( rIds );
2861 }
2862 
2863 //  ----------------------------------------------------
2864 //  class VCLXFixedText
2865 //  ----------------------------------------------------
2866 void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
2867 {
2868     PushPropertyIds( rIds,
2869                      BASEPROPERTY_ALIGN,
2870                      BASEPROPERTY_BACKGROUNDCOLOR,
2871                      BASEPROPERTY_BORDER,
2872                      BASEPROPERTY_BORDERCOLOR,
2873                      BASEPROPERTY_DEFAULTCONTROL,
2874                      BASEPROPERTY_ENABLED,
2875                      BASEPROPERTY_ENABLEVISIBLE,
2876                      BASEPROPERTY_FONTDESCRIPTOR,
2877                      BASEPROPERTY_HELPTEXT,
2878                      BASEPROPERTY_HELPURL,
2879                      BASEPROPERTY_LABEL,
2880                      BASEPROPERTY_MULTILINE,
2881                      BASEPROPERTY_NOLABEL,
2882                      BASEPROPERTY_PRINTABLE,
2883                      BASEPROPERTY_TABSTOP,
2884                      BASEPROPERTY_VERTICALALIGN,
2885                      BASEPROPERTY_WRITING_MODE,
2886                      BASEPROPERTY_CONTEXT_WRITING_MODE,
2887                      BASEPROPERTY_REFERENCE_DEVICE,
2888                      0);
2889     VCLXWindow::ImplGetPropertyIds( rIds );
2890 }
2891 
2892 VCLXFixedText::VCLXFixedText()
2893 {
2894 }
2895 
2896 VCLXFixedText::~VCLXFixedText()
2897 {
2898 }
2899 
2900 // ::com::sun::star::uno::XInterface
2901 ::com::sun::star::uno::Any VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
2902 {
2903     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
2904                                         SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText*, this ) );
2905     return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
2906 }
2907 
2908 // ::com::sun::star::lang::XTypeProvider
2909 IMPL_XTYPEPROVIDER_START( VCLXFixedText )
2910     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ),
2911     VCLXWindow::getTypes()
2912 IMPL_XTYPEPROVIDER_END
2913 
2914 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedText::CreateAccessibleContext()
2915 {
2916     return getAccessibleFactory().createAccessibleContext( this );
2917 }
2918 
2919 void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
2920 {
2921     ::vos::OGuard aGuard( GetMutex() );
2922 
2923     Window* pWindow = GetWindow();
2924     if ( pWindow )
2925         pWindow->SetText( Text );
2926 }
2927 
2928 ::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException)
2929 {
2930     ::vos::OGuard aGuard( GetMutex() );
2931 
2932     ::rtl::OUString aText;
2933     Window* pWindow = GetWindow();
2934     if ( pWindow )
2935         aText = pWindow->GetText();
2936     return aText;
2937 }
2938 
2939 void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
2940 {
2941     ::vos::OGuard aGuard( GetMutex() );
2942 
2943     Window* pWindow = GetWindow();
2944     if ( pWindow )
2945     {
2946         WinBits nNewBits = 0;
2947         if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
2948             nNewBits = WB_LEFT;
2949         else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
2950             nNewBits = WB_CENTER;
2951         else
2952             nNewBits = WB_RIGHT;
2953 
2954         WinBits nStyle = pWindow->GetStyle();
2955         nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
2956         pWindow->SetStyle( nStyle | nNewBits );
2957     }
2958 }
2959 
2960 short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException)
2961 {
2962     ::vos::OGuard aGuard( GetMutex() );
2963 
2964     short nAlign = 0;
2965     Window* pWindow = GetWindow();
2966     if ( pWindow )
2967     {
2968         WinBits nStyle = pWindow->GetStyle();
2969         if ( nStyle & WB_LEFT )
2970             nAlign = ::com::sun::star::awt::TextAlign::LEFT;
2971         else if ( nStyle & WB_CENTER )
2972             nAlign = ::com::sun::star::awt::TextAlign::CENTER;
2973         else
2974             nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
2975     }
2976     return nAlign;
2977 }
2978 
2979 ::com::sun::star::awt::Size VCLXFixedText::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
2980 {
2981     ::vos::OGuard aGuard( GetMutex() );
2982 
2983     Size aSz;
2984     FixedText* pFixedText = (FixedText*)GetWindow();
2985     if ( pFixedText )
2986         aSz = pFixedText->CalcMinimumSize();
2987     return AWTSize(aSz);
2988 }
2989 
2990 ::com::sun::star::awt::Size VCLXFixedText::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
2991 {
2992     return getMinimumSize();
2993 }
2994 
2995 ::com::sun::star::awt::Size VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size& rMaxSize ) throw(::com::sun::star::uno::RuntimeException)
2996 {
2997     ::vos::OGuard aGuard( GetMutex() );
2998 
2999     Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) );
3000     FixedText* pFixedText = (FixedText*)GetWindow();
3001     if ( pFixedText )
3002         aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width );
3003     return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize );
3004 }
3005 
3006 //	----------------------------------------------------
3007 //	class VCLXScrollBar
3008 //	----------------------------------------------------
3009 void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3010 {
3011     PushPropertyIds( rIds,
3012                      BASEPROPERTY_BACKGROUNDCOLOR,
3013                      BASEPROPERTY_BLOCKINCREMENT,
3014                      BASEPROPERTY_BORDER,
3015                      BASEPROPERTY_BORDERCOLOR,
3016                      BASEPROPERTY_DEFAULTCONTROL,
3017                      BASEPROPERTY_ENABLED,
3018                      BASEPROPERTY_ENABLEVISIBLE,
3019                      BASEPROPERTY_HELPTEXT,
3020                      BASEPROPERTY_HELPURL,
3021                      BASEPROPERTY_LINEINCREMENT,
3022                      BASEPROPERTY_LIVE_SCROLL,
3023                      BASEPROPERTY_ORIENTATION,
3024                      BASEPROPERTY_PRINTABLE,
3025                      BASEPROPERTY_REPEAT_DELAY,
3026                      BASEPROPERTY_SCROLLVALUE,
3027                      BASEPROPERTY_SCROLLVALUE_MAX,
3028                      BASEPROPERTY_SCROLLVALUE_MIN,
3029                      BASEPROPERTY_SYMBOL_COLOR,
3030                      BASEPROPERTY_TABSTOP,
3031                      BASEPROPERTY_VISIBLESIZE,
3032                      BASEPROPERTY_WRITING_MODE,
3033                      BASEPROPERTY_CONTEXT_WRITING_MODE,
3034                      0);
3035     VCLXWindow::ImplGetPropertyIds( rIds );
3036 }
3037 
3038 VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
3039 {
3040 }
3041 
3042 // ::com::sun::star::uno::XInterface
3043 ::com::sun::star::uno::Any VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3044 {
3045 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3046 										SAL_STATIC_CAST( ::com::sun::star::awt::XScrollBar*, this ) );
3047 	return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3048 }
3049 
3050 // ::com::sun::star::lang::XTypeProvider
3051 IMPL_XTYPEPROVIDER_START( VCLXScrollBar )
3052 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XScrollBar>* ) NULL ),
3053 	VCLXWindow::getTypes()
3054 IMPL_XTYPEPROVIDER_END
3055 
3056 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXScrollBar::CreateAccessibleContext()
3057 {
3058     return getAccessibleFactory().createAccessibleContext( this );
3059 }
3060 
3061 // ::com::sun::star::lang::XComponent
3062 void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException)
3063 {
3064 	::vos::OGuard aGuard( GetMutex() );
3065 
3066 	::com::sun::star::lang::EventObject aObj;
3067 	aObj.Source = (::cppu::OWeakObject*)this;
3068 	maAdjustmentListeners.disposeAndClear( aObj );
3069 	VCLXWindow::dispose();
3070 }
3071 
3072 // ::com::sun::star::awt::XScrollbar
3073 void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3074 {
3075 	::vos::OGuard aGuard( GetMutex() );
3076 	maAdjustmentListeners.addInterface( l );
3077 }
3078 
3079 void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3080 {
3081 	::vos::OGuard aGuard( GetMutex() );
3082 	maAdjustmentListeners.removeInterface( l );
3083 }
3084 
3085 void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3086 {
3087 	::vos::OGuard aGuard( GetMutex() );
3088 
3089 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3090 	if ( pScrollBar )
3091 		pScrollBar->DoScroll( n );
3092 }
3093 
3094 void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
3095 {
3096 	::vos::OGuard aGuard( GetMutex() );
3097 
3098 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3099 	if ( pScrollBar )
3100 	{
3101 		pScrollBar->SetVisibleSize( nVisible );
3102 		pScrollBar->SetRangeMax( nMax );
3103 		pScrollBar->DoScroll( nValue );
3104 	}
3105 }
3106 
3107 sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException)
3108 {
3109 	::vos::OGuard aGuard( GetMutex() );
3110 
3111 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3112 	return pScrollBar ? pScrollBar->GetThumbPos() : 0;
3113 }
3114 
3115 void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3116 {
3117 	::vos::OGuard aGuard( GetMutex() );
3118 
3119 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3120 	if ( pScrollBar )
3121 		pScrollBar->SetRangeMax( n );
3122 }
3123 
3124 sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException)
3125 {
3126 	::vos::OGuard aGuard( GetMutex() );
3127 
3128 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3129 	return pScrollBar ? pScrollBar->GetRangeMax() : 0;
3130 }
3131 
3132 void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3133 {
3134 	::vos::OGuard aGuard( GetMutex() );
3135 
3136 	ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
3137 	if ( pScrollBar )
3138 		pScrollBar->SetRangeMin( n );
3139 }
3140 
3141 sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException)
3142 {
3143 	::vos::OGuard aGuard( GetMutex() );
3144 
3145 	ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
3146 	return pScrollBar ? pScrollBar->GetRangeMin() : 0;
3147 }
3148 
3149 void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3150 {
3151 	::vos::OGuard aGuard( GetMutex() );
3152 
3153 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3154 	if ( pScrollBar )
3155 		pScrollBar->SetLineSize( n );
3156 }
3157 
3158 sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
3159 {
3160 	::vos::OGuard aGuard( GetMutex() );
3161 
3162 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3163 	return pScrollBar ? pScrollBar->GetLineSize() : 0;
3164 }
3165 
3166 void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3167 {
3168 	::vos::OGuard aGuard( GetMutex() );
3169 
3170 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3171 	if ( pScrollBar )
3172 		pScrollBar->SetPageSize( n );
3173 }
3174 
3175 sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
3176 {
3177 	::vos::OGuard aGuard( GetMutex() );
3178 
3179 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3180 	return pScrollBar ? pScrollBar->GetPageSize() : 0;
3181 }
3182 
3183 void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3184 {
3185 	::vos::OGuard aGuard( GetMutex() );
3186 
3187 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3188 	if ( pScrollBar )
3189 		pScrollBar->SetVisibleSize( n );
3190 }
3191 
3192 sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
3193 {
3194 	::vos::OGuard aGuard( GetMutex() );
3195 
3196 	ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
3197 	return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
3198 }
3199 
3200 void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
3201 {
3202 	::vos::OGuard aGuard( GetMutex() );
3203 
3204 	Window* pWindow = GetWindow();
3205 	if ( pWindow )
3206 	{
3207 		WinBits nStyle = pWindow->GetStyle();
3208 		nStyle &= ~(WB_HORZ|WB_VERT);
3209 		if ( n == ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL )
3210 			nStyle |= WB_HORZ;
3211 		else
3212 			nStyle |= WB_VERT;
3213 
3214 		pWindow->SetStyle( nStyle );
3215         pWindow->Resize();
3216 	}
3217 }
3218 
3219 sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException)
3220 {
3221 	::vos::OGuard aGuard( GetMutex() );
3222 
3223 	sal_Int32 n = 0;
3224 	Window* pWindow = GetWindow();
3225 	if ( pWindow )
3226 	{
3227 		WinBits nStyle = pWindow->GetStyle();
3228 		if ( nStyle & WB_HORZ )
3229 			n = ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL;
3230 		else
3231 			n = ::com::sun::star::awt::ScrollBarOrientation::VERTICAL;
3232 	}
3233 	return n;
3234 
3235 }
3236 
3237 // ::com::sun::star::awt::VclWindowPeer
3238 void VCLXScrollBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
3239 {
3240 	::vos::OGuard aGuard( GetMutex() );
3241 
3242 	ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3243 	if ( pScrollBar )
3244 	{
3245 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
3246 
3247 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3248 		switch ( nPropType )
3249 		{
3250 			case BASEPROPERTY_LIVE_SCROLL:
3251             {
3252                 sal_Bool bDo = sal_False;
3253                 if ( !bVoid )
3254                 {
3255                     OSL_VERIFY( Value >>= bDo );
3256                 }
3257                 AllSettings aSettings( pScrollBar->GetSettings() );
3258                 StyleSettings aStyle( aSettings.GetStyleSettings() );
3259                 sal_uLong nDragOptions = aStyle.GetDragFullOptions();
3260                 if ( bDo )
3261                     nDragOptions |= DRAGFULL_OPTION_SCROLL;
3262                 else
3263                     nDragOptions &= ~DRAGFULL_OPTION_SCROLL;
3264                 aStyle.SetDragFullOptions( nDragOptions );
3265                 aSettings.SetStyleSettings( aStyle );
3266                 pScrollBar->SetSettings( aSettings );
3267             }
3268             break;
3269 
3270 			case BASEPROPERTY_SCROLLVALUE:
3271 			{
3272 				if ( !bVoid )
3273 				{
3274 					sal_Int32 n = 0;
3275 					if ( Value >>= n )
3276 						setValue( n );
3277 				}
3278 			}
3279 			break;
3280 			case BASEPROPERTY_SCROLLVALUE_MAX:
3281             case BASEPROPERTY_SCROLLVALUE_MIN:
3282 			{
3283 				if ( !bVoid )
3284 				{
3285 					sal_Int32 n = 0;
3286 					if ( Value >>= n )
3287                     {
3288                         if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX )
3289 						    setMaximum( n );
3290                         else
3291 						    setMinimum( n );
3292                     }
3293 				}
3294 			}
3295 			break;
3296 			case BASEPROPERTY_LINEINCREMENT:
3297 			{
3298 				if ( !bVoid )
3299 				{
3300 					sal_Int32 n = 0;
3301 					if ( Value >>= n )
3302 						setLineIncrement( n );
3303 				}
3304 			}
3305 			break;
3306 			case BASEPROPERTY_BLOCKINCREMENT:
3307 			{
3308 				if ( !bVoid )
3309 				{
3310 					sal_Int32 n = 0;
3311 					if ( Value >>= n )
3312 						setBlockIncrement( n );
3313 				}
3314 			}
3315 			break;
3316 			case BASEPROPERTY_VISIBLESIZE:
3317 			{
3318 				if ( !bVoid )
3319 				{
3320 					sal_Int32 n = 0;
3321 					if ( Value >>= n )
3322 						setVisibleSize( n );
3323 				}
3324 			}
3325 			break;
3326 			case BASEPROPERTY_ORIENTATION:
3327 			{
3328 				if ( !bVoid )
3329 				{
3330 					sal_Int32 n = 0;
3331 					if ( Value >>= n )
3332 						setOrientation( n );
3333 				}
3334 			}
3335 			break;
3336 
3337             case BASEPROPERTY_BACKGROUNDCOLOR:
3338             {
3339                 // the default implementation of the base class doesn't work here, since our
3340                 // interpretation for this property is slightly different
3341                 ::toolkit::setButtonLikeFaceColor( pScrollBar, Value);
3342             }
3343             break;
3344 
3345 			default:
3346 			{
3347 				VCLXWindow::setProperty( PropertyName, Value );
3348 			}
3349 		}
3350 	}
3351 }
3352 
3353 ::com::sun::star::uno::Any VCLXScrollBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
3354 {
3355 	::vos::OGuard aGuard( GetMutex() );
3356 
3357 	::com::sun::star::uno::Any aProp;
3358 	ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3359 	if ( pScrollBar )
3360 	{
3361 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3362 
3363 		switch ( nPropType )
3364 		{
3365 			case BASEPROPERTY_LIVE_SCROLL:
3366             {
3367                 aProp <<= (sal_Bool)( 0 != ( pScrollBar->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL ) );
3368             }
3369             break;
3370 			case BASEPROPERTY_SCROLLVALUE:
3371 			{
3372 				aProp <<= (sal_Int32) getValue();
3373 			}
3374 			break;
3375 			case BASEPROPERTY_SCROLLVALUE_MAX:
3376 			{
3377 				aProp <<= (sal_Int32) getMaximum();
3378 			}
3379 			break;
3380             case BASEPROPERTY_SCROLLVALUE_MIN:
3381 			{
3382 				aProp <<= (sal_Int32) getMinimum();
3383 			}
3384 			break;
3385 			case BASEPROPERTY_LINEINCREMENT:
3386 			{
3387 				aProp <<= (sal_Int32) getLineIncrement();
3388 			}
3389 			break;
3390 			case BASEPROPERTY_BLOCKINCREMENT:
3391 			{
3392 				aProp <<= (sal_Int32) getBlockIncrement();
3393 			}
3394 			break;
3395 			case BASEPROPERTY_VISIBLESIZE:
3396 			{
3397 				aProp <<= (sal_Int32) getVisibleSize();
3398 			}
3399 			break;
3400 			case BASEPROPERTY_ORIENTATION:
3401 			{
3402 				aProp <<= (sal_Int32) getOrientation();
3403 			}
3404 			break;
3405             case BASEPROPERTY_BACKGROUNDCOLOR:
3406             {
3407                 // the default implementation of the base class doesn't work here, since our
3408                 // interpretation for this property is slightly different
3409                 aProp = ::toolkit::getButtonLikeFaceColor( pScrollBar );
3410             }
3411             break;
3412 
3413 			default:
3414 			{
3415 				aProp <<= VCLXWindow::getProperty( PropertyName );
3416 			}
3417 		}
3418 	}
3419 	return aProp;
3420 }
3421 
3422 void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
3423 {
3424 	switch ( rVclWindowEvent.GetId() )
3425 	{
3426 		case VCLEVENT_SCROLLBAR_SCROLL:
3427         {
3428             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
3429                 // since we call listeners below, there is a potential that we will be destroyed
3430                 // in during the listener call. To prevent the resulting crashs, we keep us
3431                 // alive as long as we're here
3432                 // #20178# - 2003-10-01 - fs@openoffice.org
3433 
3434 			if ( maAdjustmentListeners.getLength() )
3435 			{
3436     			ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
3437 
3438                 if( pScrollBar )
3439                 {
3440 				    ::com::sun::star::awt::AdjustmentEvent aEvent;
3441 				    aEvent.Source = (::cppu::OWeakObject*)this;
3442 				    aEvent.Value = pScrollBar->GetThumbPos();
3443 
3444 				    // set adjustment type
3445 				    ScrollType aType = pScrollBar->GetType();
3446 				    if ( aType == SCROLL_LINEUP || aType == SCROLL_LINEDOWN )
3447 				    {
3448 					    aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_LINE;
3449 				    }
3450 				    else if ( aType == SCROLL_PAGEUP || aType == SCROLL_PAGEDOWN )
3451 				    {
3452 					    aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE;
3453 				    }
3454 				    else if ( aType == SCROLL_DRAG )
3455 				    {
3456 					    aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_ABS;
3457 				    }
3458 
3459 				    maAdjustmentListeners.adjustmentValueChanged( aEvent );
3460                 }
3461 			}
3462         }
3463         break;
3464 
3465 		default:
3466 			VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
3467 			break;
3468 	}
3469 }
3470 
3471 ::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::implGetMinimumSize( Window* p ) throw(::com::sun::star::uno::RuntimeException)
3472 {
3473     long n = p->GetSettings().GetStyleSettings().GetScrollBarSize();
3474     return ::com::sun::star::awt::Size( n, n );
3475 }
3476 
3477 ::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
3478 {
3479 	::vos::OGuard aGuard( GetMutex() );
3480     return implGetMinimumSize( GetWindow() );
3481 }
3482 
3483 
3484 //	----------------------------------------------------
3485 //	class VCLXEdit
3486 //	----------------------------------------------------
3487 
3488 void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3489 {
3490     PushPropertyIds( rIds,
3491                      BASEPROPERTY_ALIGN,
3492                      BASEPROPERTY_BACKGROUNDCOLOR,
3493                      BASEPROPERTY_BORDER,
3494                      BASEPROPERTY_BORDERCOLOR,
3495                      BASEPROPERTY_DEFAULTCONTROL,
3496                      BASEPROPERTY_ECHOCHAR,
3497                      BASEPROPERTY_ENABLED,
3498                      BASEPROPERTY_ENABLEVISIBLE,
3499                      BASEPROPERTY_FONTDESCRIPTOR,
3500                      BASEPROPERTY_HARDLINEBREAKS,
3501                      BASEPROPERTY_HELPTEXT,
3502                      BASEPROPERTY_HELPURL,
3503                      BASEPROPERTY_HSCROLL,
3504                      BASEPROPERTY_LINE_END_FORMAT,
3505                      BASEPROPERTY_MAXTEXTLEN,
3506                      BASEPROPERTY_MULTILINE,
3507                      BASEPROPERTY_PRINTABLE,
3508                      BASEPROPERTY_READONLY,
3509                      BASEPROPERTY_TABSTOP,
3510                      BASEPROPERTY_TEXT,
3511                      BASEPROPERTY_VSCROLL,
3512                      BASEPROPERTY_HIDEINACTIVESELECTION,
3513                      BASEPROPERTY_PAINTTRANSPARENT,
3514                      BASEPROPERTY_AUTOHSCROLL,
3515                      BASEPROPERTY_AUTOVSCROLL,
3516                      BASEPROPERTY_VERTICALALIGN,
3517                      BASEPROPERTY_WRITING_MODE,
3518                      BASEPROPERTY_CONTEXT_WRITING_MODE,
3519                      0);
3520     VCLXWindow::ImplGetPropertyIds( rIds );
3521 }
3522 
3523 VCLXEdit::VCLXEdit() : maTextListeners( *this )
3524 {
3525 }
3526 
3527 // ::com::sun::star::uno::XInterface
3528 ::com::sun::star::uno::Any VCLXEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
3529 {
3530 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
3531 										SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
3532 										SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField*, this ),
3533 										SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
3534 	return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
3535 }
3536 
3537 // ::com::sun::star::lang::XTypeProvider
3538 IMPL_XTYPEPROVIDER_START( VCLXEdit )
3539 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
3540 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextEditField>* ) NULL ),
3541 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
3542 	VCLXWindow::getTypes()
3543 IMPL_XTYPEPROVIDER_END
3544 
3545 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXEdit::CreateAccessibleContext()
3546 {
3547     return getAccessibleFactory().createAccessibleContext( this );
3548 }
3549 
3550 void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException)
3551 {
3552 	::vos::OGuard aGuard( GetMutex() );
3553 
3554 	::com::sun::star::lang::EventObject aObj;
3555 	aObj.Source = (::cppu::OWeakObject*)this;
3556 	maTextListeners.disposeAndClear( aObj );
3557 	VCLXWindow::dispose();
3558 }
3559 
3560 void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3561 {
3562 	::vos::OGuard aGuard( GetMutex() );
3563 	GetTextListeners().addInterface( l );
3564 }
3565 
3566 void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3567 {
3568 	::vos::OGuard aGuard( GetMutex() );
3569 	GetTextListeners().removeInterface( l );
3570 }
3571 
3572 void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
3573 {
3574 	::vos::OGuard aGuard( GetMutex() );
3575 
3576 	Edit* pEdit = (Edit*)GetWindow();
3577 	if ( pEdit )
3578 	{
3579 		pEdit->SetText( aText );
3580 
3581         // #107218# Call same listeners like VCL would do after user interaction
3582         SetSynthesizingVCLEvent( sal_True );
3583         pEdit->SetModifyFlag();
3584         pEdit->Modify();
3585         SetSynthesizingVCLEvent( sal_False );
3586 	}
3587 }
3588 
3589 void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
3590 {
3591 	::vos::OGuard aGuard( GetMutex() );
3592 
3593 	Edit* pEdit = (Edit*)GetWindow();
3594 	if ( pEdit )
3595 	{
3596 		pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
3597 		pEdit->ReplaceSelected( aText );
3598 
3599         // #107218# Call same listeners like VCL would do after user interaction
3600         SetSynthesizingVCLEvent( sal_True );
3601         pEdit->SetModifyFlag();
3602         pEdit->Modify();
3603         SetSynthesizingVCLEvent( sal_False );
3604 	}
3605 }
3606 
3607 ::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException)
3608 {
3609 	::vos::OGuard aGuard( GetMutex() );
3610 
3611 	::rtl::OUString aText;
3612 	Window* pWindow = GetWindow();
3613 	if ( pWindow )
3614 		aText = pWindow->GetText();
3615 	return aText;
3616 }
3617 
3618 ::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
3619 {
3620 	::vos::OGuard aGuard( GetMutex() );
3621 
3622 	::rtl::OUString aText;
3623 	Edit* pEdit = (Edit*) GetWindow();
3624 	if ( pEdit)
3625 		aText = pEdit->GetSelected();
3626 	return aText;
3627 
3628 }
3629 
3630 void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
3631 {
3632 	::vos::OGuard aGuard( GetMutex() );
3633 
3634 	Edit* pEdit = (Edit*) GetWindow();
3635 	if ( pEdit )
3636 		pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
3637 }
3638 
3639 ::com::sun::star::awt::Selection VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
3640 {
3641 	::vos::OGuard aGuard( GetMutex() );
3642 
3643 	Selection aSel;
3644 	Edit* pEdit = (Edit*) GetWindow();
3645 	if ( pEdit )
3646 		aSel = pEdit->GetSelection();
3647 	return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
3648 }
3649 
3650 sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
3651 {
3652 	::vos::OGuard aGuard( GetMutex() );
3653 
3654 	Edit* pEdit = (Edit*) GetWindow();
3655 	return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
3656 }
3657 
3658 void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
3659 {
3660 	::vos::OGuard aGuard( GetMutex() );
3661 
3662 	Edit* pEdit = (Edit*) GetWindow();
3663 	if ( pEdit )
3664 		pEdit->SetReadOnly( !bEditable );
3665 }
3666 
3667 
3668 void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
3669 {
3670 	::vos::OGuard aGuard( GetMutex() );
3671 
3672 	Edit* pEdit = (Edit*) GetWindow();
3673 	if ( pEdit )
3674 		pEdit->SetMaxTextLen( nLen );
3675 }
3676 
3677 sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
3678 {
3679 	::vos::OGuard aGuard( GetMutex() );
3680 
3681 	Edit* pEdit = (Edit*) GetWindow();
3682 	return pEdit ? pEdit->GetMaxTextLen() : 0;
3683 }
3684 
3685 void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException)
3686 {
3687 	::vos::OGuard aGuard( GetMutex() );
3688 
3689 	Edit* pEdit = (Edit*) GetWindow();
3690 	if ( pEdit )
3691 		pEdit->SetEchoChar( cEcho );
3692 }
3693 
3694 void VCLXEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
3695 {
3696 	::vos::OGuard aGuard( GetMutex() );
3697 
3698 	Edit* pEdit = (Edit*)GetWindow();
3699 	if ( pEdit )
3700 	{
3701 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3702 		switch ( nPropType )
3703 		{
3704             case BASEPROPERTY_HIDEINACTIVESELECTION:
3705                 ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, sal_True );
3706                 if ( pEdit->GetSubEdit() )
3707                     ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, sal_True );
3708                 break;
3709 
3710             case BASEPROPERTY_READONLY:
3711 			{
3712 				sal_Bool b = sal_Bool();
3713 				if ( Value >>= b )
3714  					pEdit->SetReadOnly( b );
3715 			}
3716 			break;
3717 			case BASEPROPERTY_ECHOCHAR:
3718 			{
3719 				sal_Int16 n = sal_Int16();
3720 				if ( Value >>= n )
3721  					pEdit->SetEchoChar( n );
3722 			}
3723 			break;
3724 			case BASEPROPERTY_MAXTEXTLEN:
3725 			{
3726 				sal_Int16 n = sal_Int16();
3727 				if ( Value >>= n )
3728  					pEdit->SetMaxTextLen( n );
3729 			}
3730 			break;
3731 			default:
3732 			{
3733 				VCLXWindow::setProperty( PropertyName, Value );
3734 			}
3735 		}
3736 	}
3737 }
3738 
3739 ::com::sun::star::uno::Any VCLXEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
3740 {
3741 	::vos::OGuard aGuard( GetMutex() );
3742 
3743 	::com::sun::star::uno::Any aProp;
3744 	Edit* pEdit = (Edit*)GetWindow();
3745 	if ( pEdit )
3746 	{
3747 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
3748 		switch ( nPropType )
3749 		{
3750             case BASEPROPERTY_HIDEINACTIVESELECTION:
3751                 aProp <<= (sal_Bool)( ( pEdit->GetStyle() & WB_NOHIDESELECTION ) == 0 );
3752                 break;
3753 			case BASEPROPERTY_READONLY:
3754  				aProp <<= (sal_Bool) pEdit->IsReadOnly();
3755     			break;
3756 			case BASEPROPERTY_ECHOCHAR:
3757  				aProp <<= (sal_Int16) pEdit->GetEchoChar();
3758     			break;
3759 			case BASEPROPERTY_MAXTEXTLEN:
3760  				aProp <<= (sal_Int16) pEdit->GetMaxTextLen();
3761     			break;
3762 			default:
3763 			{
3764 				aProp = VCLXWindow::getProperty( PropertyName );
3765 			}
3766 		}
3767 	}
3768 	return aProp;
3769 }
3770 
3771 ::com::sun::star::awt::Size VCLXEdit::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
3772 {
3773 	::vos::OGuard aGuard( GetMutex() );
3774 
3775 	Size aSz;
3776 	Edit* pEdit = (Edit*) GetWindow();
3777 	if ( pEdit )
3778 		aSz = pEdit->CalcMinimumSize();
3779 	return AWTSize(aSz);
3780 }
3781 
3782 ::com::sun::star::awt::Size VCLXEdit::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
3783 {
3784 	::vos::OGuard aGuard( GetMutex() );
3785 
3786 	Size aSz;
3787 	Edit* pEdit = (Edit*) GetWindow();
3788 	if ( pEdit )
3789 	{
3790 		aSz = pEdit->CalcMinimumSize();
3791 		aSz.Height() += 4;
3792 	}
3793 	return AWTSize(aSz);
3794 }
3795 
3796 ::com::sun::star::awt::Size VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
3797 {
3798 	::vos::OGuard aGuard( GetMutex() );
3799 
3800 	::com::sun::star::awt::Size aSz = rNewSize;
3801 	::com::sun::star::awt::Size aMinSz = getMinimumSize();
3802 	if ( aSz.Height != aMinSz.Height )
3803 		aSz.Height = aMinSz.Height;
3804 
3805 	return aSz;
3806 }
3807 
3808 ::com::sun::star::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException)
3809 {
3810 	::vos::OGuard aGuard( GetMutex() );
3811 
3812 	Size aSz;
3813 	Edit* pEdit = (Edit*) GetWindow();
3814 	if ( pEdit )
3815 	{
3816 		if ( nCols )
3817 			aSz = pEdit->CalcSize( nCols );
3818 		else
3819 			aSz = pEdit->CalcMinimumSize();
3820 	}
3821 	return AWTSize(aSz);
3822 }
3823 
3824 void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
3825 {
3826 	::vos::OGuard aGuard( GetMutex() );
3827 
3828 	nLines = 1;
3829 	nCols = 0;
3830 	Edit* pEdit = (Edit*) GetWindow();
3831 	if ( pEdit )
3832 		nCols = pEdit->GetMaxVisChars();
3833 }
3834 
3835 void VCLXEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
3836 {
3837 	switch ( rVclWindowEvent.GetId() )
3838 	{
3839 		case VCLEVENT_EDIT_MODIFY:
3840         {
3841             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
3842                 // since we call listeners below, there is a potential that we will be destroyed
3843                 // during the listener call. To prevent the resulting crashs, we keep us
3844                 // alive as long as we're here
3845                 // #20178# - 2003-10-01 - fs@openoffice.org
3846 
3847 			if ( GetTextListeners().getLength() )
3848 			{
3849 				::com::sun::star::awt::TextEvent aEvent;
3850 				aEvent.Source = (::cppu::OWeakObject*)this;
3851 				GetTextListeners().textChanged( aEvent );
3852 			}
3853         }
3854 		break;
3855 
3856 		default:
3857 			VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
3858 			break;
3859 	}
3860 }
3861 
3862 //	----------------------------------------------------
3863 //	class VCLXComboBox
3864 //	----------------------------------------------------
3865 
3866 void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
3867 {
3868     PushPropertyIds( rIds,
3869                      BASEPROPERTY_AUTOCOMPLETE,
3870                      BASEPROPERTY_BACKGROUNDCOLOR,
3871                      BASEPROPERTY_BORDER,
3872                      BASEPROPERTY_BORDERCOLOR,
3873                      BASEPROPERTY_DEFAULTCONTROL,
3874                      BASEPROPERTY_DROPDOWN,
3875                      BASEPROPERTY_ENABLED,
3876                      BASEPROPERTY_ENABLEVISIBLE,
3877                      BASEPROPERTY_FONTDESCRIPTOR,
3878                      BASEPROPERTY_HELPTEXT,
3879                      BASEPROPERTY_HELPURL,
3880                      BASEPROPERTY_LINECOUNT,
3881                      BASEPROPERTY_MAXTEXTLEN,
3882                      BASEPROPERTY_PRINTABLE,
3883                      BASEPROPERTY_READONLY,
3884                      BASEPROPERTY_STRINGITEMLIST,
3885                      BASEPROPERTY_TABSTOP,
3886                      BASEPROPERTY_TEXT,
3887                      BASEPROPERTY_HIDEINACTIVESELECTION,
3888                      BASEPROPERTY_ALIGN,
3889                      BASEPROPERTY_WRITING_MODE,
3890                      BASEPROPERTY_CONTEXT_WRITING_MODE,
3891                      BASEPROPERTY_REFERENCE_DEVICE,
3892                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
3893                      0);
3894     // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box
3895     // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
3896     // VCLXEdit::ImplGetPropertyIds( rIds );
3897     VCLXWindow::ImplGetPropertyIds( rIds );
3898 }
3899 
3900 VCLXComboBox::VCLXComboBox()
3901 	: maActionListeners( *this ), maItemListeners( *this )
3902 {
3903 }
3904 
3905 VCLXComboBox::~VCLXComboBox()
3906 {
3907 #ifndef __SUNPRO_CC
3908     OSL_TRACE ("%s", __FUNCTION__);
3909 #endif
3910 }
3911 
3912 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext()
3913 {
3914 	::vos::OGuard aGuard( GetMutex() );
3915 
3916     return getAccessibleFactory().createAccessibleContext( this );
3917 }
3918 
3919 void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException)
3920 {
3921 	::vos::OGuard aGuard( GetMutex() );
3922 
3923 	::com::sun::star::lang::EventObject aObj;
3924 	aObj.Source = (::cppu::OWeakObject*)this;
3925 	maItemListeners.disposeAndClear( aObj );
3926 	maActionListeners.disposeAndClear( aObj );
3927 	VCLXEdit::dispose();
3928 }
3929 
3930 
3931 void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3932 {
3933 	::vos::OGuard aGuard( GetMutex() );
3934 	maItemListeners.addInterface( l );
3935 }
3936 
3937 void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3938 {
3939 	::vos::OGuard aGuard( GetMutex() );
3940 	maItemListeners.removeInterface( l );
3941 }
3942 
3943 void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3944 {
3945 	::vos::OGuard aGuard( GetMutex() );
3946 	maActionListeners.addInterface( l );
3947 }
3948 
3949 void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
3950 {
3951 	::vos::OGuard aGuard( GetMutex() );
3952 	maActionListeners.removeInterface( l );
3953 }
3954 
3955 void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
3956 {
3957 	::vos::OGuard aGuard( GetMutex() );
3958 
3959 	ComboBox* pBox = (ComboBox*) GetWindow();
3960 	if ( pBox )
3961 		pBox->InsertEntry( aItem, nPos );
3962 }
3963 
3964 void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
3965 {
3966 	::vos::OGuard aGuard( GetMutex() );
3967 
3968 	ComboBox* pBox = (ComboBox*) GetWindow();
3969 	if ( pBox )
3970 	{
3971 		sal_uInt16 nP = nPos;
3972 		for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
3973 		{
3974 			pBox->InsertEntry( aItems.getConstArray()[n], nP );
3975 			if ( nP == 0xFFFF )
3976             {
3977                 OSL_ENSURE( false, "VCLXComboBox::addItems: too many entries!" );
3978                 // skip remaining entries, list cannot hold them, anyway
3979                 break;
3980             }
3981 		}
3982 	}
3983 }
3984 
3985 void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
3986 {
3987 	::vos::OGuard aGuard( GetMutex() );
3988 
3989 	ComboBox* pBox = (ComboBox*) GetWindow();
3990 	if ( pBox )
3991 	{
3992 		for ( sal_uInt16 n = nCount; n; )
3993 			pBox->RemoveEntry( nPos + (--n) );
3994 	}
3995 }
3996 
3997 sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
3998 {
3999 	::vos::OGuard aGuard( GetMutex() );
4000 
4001 	ComboBox* pBox = (ComboBox*) GetWindow();
4002 	return pBox ? pBox->GetEntryCount() : 0;
4003 }
4004 
4005 ::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
4006 {
4007 	::vos::OGuard aGuard( GetMutex() );
4008 
4009 	::rtl::OUString aItem;
4010 	ComboBox* pBox = (ComboBox*) GetWindow();
4011 	if ( pBox )
4012 		aItem = pBox->GetEntry( nPos );
4013 	return aItem;
4014 }
4015 
4016 ::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException)
4017 {
4018 	::vos::OGuard aGuard( GetMutex() );
4019 
4020 	::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
4021 	ComboBox* pBox = (ComboBox*) GetWindow();
4022 	if ( pBox )
4023 	{
4024 		sal_uInt16 nEntries = pBox->GetEntryCount();
4025 		aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
4026 		for ( sal_uInt16 n = nEntries; n; )
4027 		{
4028 			--n;
4029 			aSeq.getArray()[n] = pBox->GetEntry( n );
4030 		}
4031 	}
4032 	return aSeq;
4033 }
4034 
4035 void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
4036 {
4037 	::vos::OGuard aGuard( GetMutex() );
4038 
4039 	ComboBox* pBox = (ComboBox*) GetWindow();
4040 	if ( pBox )
4041 		pBox->SetDropDownLineCount( nLines );
4042 }
4043 
4044 sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
4045 {
4046 	::vos::OGuard aGuard( GetMutex() );
4047 
4048 	sal_Int16 nLines = 0;
4049 	ComboBox* pBox = (ComboBox*) GetWindow();
4050 	if ( pBox )
4051 		nLines = pBox->GetDropDownLineCount();
4052 	return nLines;
4053 }
4054 
4055 void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4056 {
4057 	::vos::OGuard aGuard( GetMutex() );
4058 
4059 	ComboBox* pComboBox = (ComboBox*)GetWindow();
4060 	if ( pComboBox )
4061 	{
4062 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4063 		switch ( nPropType )
4064 		{
4065 			case BASEPROPERTY_LINECOUNT:
4066 			{
4067 				sal_Int16 n = sal_Int16();
4068 				if ( Value >>= n )
4069  					pComboBox->SetDropDownLineCount( n );
4070 			}
4071 			break;
4072 			case BASEPROPERTY_AUTOCOMPLETE:
4073 			{
4074 				sal_Int16 n = sal_Int16();
4075 				if ( Value >>= n )
4076  					pComboBox->EnableAutocomplete( n != 0 );
4077 			}
4078 			break;
4079 			case BASEPROPERTY_STRINGITEMLIST:
4080 			{
4081                 ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
4082 				if ( Value >>= aItems )
4083 				{
4084 					pComboBox->Clear();
4085 					addItems( aItems, 0 );
4086 				}
4087 			}
4088 			break;
4089 			default:
4090 			{
4091 				VCLXEdit::setProperty( PropertyName, Value );
4092 
4093 				// #109385# SetBorderStyle is not virtual
4094 				if ( nPropType == BASEPROPERTY_BORDER )
4095 				{
4096 					sal_uInt16 nBorder = sal_uInt16();
4097 					if ( (Value >>= nBorder) && nBorder != 0 )
4098 						pComboBox->SetBorderStyle( nBorder );
4099 				}
4100 			}
4101 		}
4102 	}
4103 }
4104 
4105 ::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4106 {
4107 	::vos::OGuard aGuard( GetMutex() );
4108 
4109 	::com::sun::star::uno::Any aProp;
4110 	ComboBox* pComboBox = (ComboBox*)GetWindow();
4111 	if ( pComboBox )
4112 	{
4113 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4114 		switch ( nPropType )
4115 		{
4116 			case BASEPROPERTY_LINECOUNT:
4117 			{
4118  				aProp <<= (sal_Int16)  pComboBox->GetDropDownLineCount();
4119 			}
4120 			break;
4121 			case BASEPROPERTY_AUTOCOMPLETE:
4122 			{
4123  				aProp <<= (sal_Bool) pComboBox->IsAutocompleteEnabled();
4124 			}
4125 			break;
4126 			case BASEPROPERTY_STRINGITEMLIST:
4127 			{
4128 				sal_uInt16 nItems = pComboBox->GetEntryCount();
4129 				::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
4130 				::rtl::OUString* pStrings = aSeq.getArray();
4131 				for ( sal_uInt16 n = 0; n < nItems; n++ )
4132 					pStrings[n] = pComboBox->GetEntry( n );
4133 				aProp <<= aSeq;
4134 
4135 			}
4136 			break;
4137 			default:
4138 			{
4139 				aProp <<= VCLXEdit::getProperty( PropertyName );
4140 			}
4141 		}
4142 	}
4143 	return aProp;
4144 }
4145 
4146 void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
4147 {
4148     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
4149         // since we call listeners below, there is a potential that we will be destroyed
4150         // during the listener call. To prevent the resulting crashs, we keep us
4151         // alive as long as we're here
4152         // #20178# - 2003-10-01 - fs@openoffice.org
4153 
4154 	switch ( rVclWindowEvent.GetId() )
4155 	{
4156 		case VCLEVENT_COMBOBOX_SELECT:
4157 			if ( maItemListeners.getLength() )
4158 			{
4159 				ComboBox* pComboBox = (ComboBox*)GetWindow();
4160                 if( pComboBox )
4161                 {
4162 				    if ( !pComboBox->IsTravelSelect() )
4163 				    {
4164 					    ::com::sun::star::awt::ItemEvent aEvent;
4165 					    aEvent.Source = (::cppu::OWeakObject*)this;
4166 					    aEvent.Highlighted = sal_False;
4167 
4168 					    // Bei Mehrfachselektion 0xFFFF, sonst die ID
4169 					    aEvent.Selected = pComboBox->GetEntryPos( pComboBox->GetText() );
4170 
4171 					    maItemListeners.itemStateChanged( aEvent );
4172 				    }
4173                 }
4174 			}
4175 			break;
4176 
4177 		case VCLEVENT_COMBOBOX_DOUBLECLICK:
4178 			if ( maActionListeners.getLength() )
4179 			{
4180 				::com::sun::star::awt::ActionEvent aEvent;
4181 				aEvent.Source = (::cppu::OWeakObject*)this;
4182 //				aEvent.ActionCommand = ...;
4183 				maActionListeners.actionPerformed( aEvent );
4184 			}
4185 			break;
4186 
4187 		default:
4188 			VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
4189 			break;
4190 	}
4191 }
4192 
4193 ::com::sun::star::awt::Size VCLXComboBox::getMinimumSize(  ) throw(::com::sun::star::uno::RuntimeException)
4194 {
4195 	::vos::OGuard aGuard( GetMutex() );
4196 
4197 	Size aSz;
4198 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4199 	if ( pComboBox )
4200 		aSz = pComboBox->CalcMinimumSize();
4201 	return AWTSize(aSz);
4202 }
4203 
4204 ::com::sun::star::awt::Size VCLXComboBox::getPreferredSize(  ) throw(::com::sun::star::uno::RuntimeException)
4205 {
4206 	::vos::OGuard aGuard( GetMutex() );
4207 
4208 	Size aSz;
4209 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4210 	if ( pComboBox )
4211 	{
4212 		aSz = pComboBox->CalcMinimumSize();
4213 		if ( pComboBox->GetStyle() & WB_DROPDOWN )
4214 			aSz.Height() += 4;
4215 	}
4216 	return AWTSize(aSz);
4217 }
4218 
4219 ::com::sun::star::awt::Size VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
4220 {
4221 	::vos::OGuard aGuard( GetMutex() );
4222 
4223 	Size aSz = VCLSize(rNewSize);
4224 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4225 	if ( pComboBox )
4226 		aSz = pComboBox->CalcAdjustedSize( aSz );
4227 	return AWTSize(aSz);
4228 }
4229 
4230 ::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
4231 {
4232 	::vos::OGuard aGuard( GetMutex() );
4233 
4234 	Size aSz;
4235 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4236 	if ( pComboBox )
4237 		aSz = pComboBox->CalcSize( nCols, nLines );
4238 	return AWTSize(aSz);
4239 }
4240 
4241 void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
4242 {
4243 	::vos::OGuard aGuard( GetMutex() );
4244 
4245 	nCols = nLines = 0;
4246 	ComboBox* pComboBox = (ComboBox*) GetWindow();
4247 	if ( pComboBox )
4248 	{
4249 		sal_uInt16 nC, nL;
4250 		pComboBox->GetMaxVisColumnsAndLines( nC, nL );
4251 		nCols = nC;
4252 		nLines = nL;
4253 	}
4254 }
4255 void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4256 {
4257 	::vos::OGuard aGuard( GetMutex() );
4258 
4259     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4260 
4261     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" );
4262     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ),
4263         "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" );
4264     pComboBox->InsertEntry(
4265         i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
4266         i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
4267         i_rEvent.ItemPosition );
4268 }
4269 
4270 void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4271 {
4272 	::vos::OGuard aGuard( GetMutex() );
4273 
4274     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4275 
4276     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
4277     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
4278         "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" );
4279 
4280     pComboBox->RemoveEntry( i_rEvent.ItemPosition );
4281 }
4282 
4283 void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
4284 {
4285 	::vos::OGuard aGuard( GetMutex() );
4286 
4287     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4288 
4289     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4290     ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
4291         "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" );
4292 
4293     // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert
4294 
4295     const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) );
4296     const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition  ) );
4297 
4298     pComboBox->RemoveEntry( i_rEvent.ItemPosition );
4299     pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
4300 }
4301 
4302 void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
4303 {
4304 	::vos::OGuard aGuard( GetMutex() );
4305 
4306     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4307     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4308 
4309     pComboBox->Clear();
4310 
4311     (void)i_rEvent;
4312 }
4313 
4314 void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
4315 {
4316 	::vos::OGuard aGuard( GetMutex() );
4317 
4318     ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
4319     ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
4320 
4321     pComboBox->Clear();
4322 
4323     uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
4324     uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
4325     // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
4326     uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
4327     if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
4328     {
4329         xStringResourceResolver.set(
4330             xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
4331             uno::UNO_QUERY
4332         );
4333     }
4334 
4335 
4336     Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
4337     uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
4338     for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
4339     {
4340         ::rtl::OUString aLocalizationKey( aItems[i].First );
4341         if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
4342         {
4343             aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
4344         }
4345         pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
4346     }
4347 }
4348 void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
4349 {
4350     // just disambiguate
4351     VCLXEdit::disposing( i_rEvent );
4352 }
4353 
4354 //	----------------------------------------------------
4355 //	class VCLXFormattedSpinField
4356 //	----------------------------------------------------
4357 void VCLXFormattedSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4358 {
4359     // Interestingly in the UnoControl API this is
4360     // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
4361 //    VCLXSpinField::ImplGetPropertyIds( rIds );
4362     VCLXWindow::ImplGetPropertyIds( rIds );
4363 }
4364 
4365 VCLXFormattedSpinField::VCLXFormattedSpinField()
4366 {
4367 }
4368 
4369 VCLXFormattedSpinField::~VCLXFormattedSpinField()
4370 {
4371 }
4372 
4373 void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict )
4374 {
4375 	::vos::OGuard aGuard( GetMutex() );
4376 
4377 	FormatterBase* pFormatter = GetFormatter();
4378 	if ( pFormatter )
4379 		pFormatter->SetStrictFormat( bStrict );
4380 }
4381 
4382 sal_Bool VCLXFormattedSpinField::isStrictFormat()
4383 {
4384 	FormatterBase* pFormatter = GetFormatter();
4385 	return pFormatter ? pFormatter->IsStrictFormat() : sal_False;
4386 }
4387 
4388 
4389 void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4390 {
4391 	::vos::OGuard aGuard( GetMutex() );
4392 
4393 	FormatterBase* pFormatter = GetFormatter();
4394 	if ( pFormatter )
4395 	{
4396 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4397 		switch ( nPropType )
4398 		{
4399 			case BASEPROPERTY_SPIN:
4400 			{
4401 				sal_Bool b = sal_Bool();
4402 				if ( Value >>= b )
4403 				{
4404 					WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
4405 					if ( !b )
4406 						nStyle &= ~WB_SPIN;
4407 					GetWindow()->SetStyle( nStyle );
4408 				}
4409 			}
4410 			break;
4411 			case BASEPROPERTY_STRICTFORMAT:
4412 			{
4413 				sal_Bool b = sal_Bool();
4414 				if ( Value >>= b )
4415 				{
4416 	 				pFormatter->SetStrictFormat( b );
4417 				}
4418 			}
4419 			break;
4420 			default:
4421 			{
4422 				VCLXSpinField::setProperty( PropertyName, Value );
4423 			}
4424 		}
4425 	}
4426 }
4427 
4428 ::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4429 {
4430 	::vos::OGuard aGuard( GetMutex() );
4431 
4432 	::com::sun::star::uno::Any aProp;
4433 	FormatterBase* pFormatter = GetFormatter();
4434 	if ( pFormatter )
4435 	{
4436 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4437 		switch ( nPropType )
4438 		{
4439 			case BASEPROPERTY_TABSTOP:
4440 			{
4441                 aProp <<= (sal_Bool) ( ( GetWindow()->GetStyle() & WB_SPIN ) ? sal_True : sal_False );
4442 			}
4443 			break;
4444 			case BASEPROPERTY_STRICTFORMAT:
4445 			{
4446 				aProp <<= (sal_Bool) pFormatter->IsStrictFormat();
4447 			}
4448 			break;
4449 			default:
4450 			{
4451 				aProp <<= VCLXSpinField::getProperty( PropertyName );
4452 			}
4453 		}
4454 	}
4455 	return aProp;
4456 }
4457 
4458 
4459 //	----------------------------------------------------
4460 //	class VCLXDateField
4461 //	----------------------------------------------------
4462 
4463 void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4464 {
4465     PushPropertyIds( rIds,
4466                      BASEPROPERTY_ALIGN,
4467                      BASEPROPERTY_BACKGROUNDCOLOR,
4468                      BASEPROPERTY_BORDER,
4469                      BASEPROPERTY_BORDERCOLOR,
4470                      BASEPROPERTY_DATE,
4471                      BASEPROPERTY_DATEMAX,
4472                      BASEPROPERTY_DATEMIN,
4473                      BASEPROPERTY_DATESHOWCENTURY,
4474                      BASEPROPERTY_DEFAULTCONTROL,
4475                      BASEPROPERTY_DROPDOWN,
4476                      BASEPROPERTY_ENABLED,
4477                      BASEPROPERTY_ENABLEVISIBLE,
4478                      BASEPROPERTY_EXTDATEFORMAT,
4479                      BASEPROPERTY_FONTDESCRIPTOR,
4480                      BASEPROPERTY_HELPTEXT,
4481                      BASEPROPERTY_HELPURL,
4482                      BASEPROPERTY_PRINTABLE,
4483                      BASEPROPERTY_READONLY,
4484                      BASEPROPERTY_REPEAT,
4485                      BASEPROPERTY_REPEAT_DELAY,
4486                      BASEPROPERTY_SPIN,
4487                      BASEPROPERTY_STRICTFORMAT,
4488                      BASEPROPERTY_TABSTOP,
4489                      BASEPROPERTY_ENFORCE_FORMAT,
4490                      BASEPROPERTY_TEXT,
4491                      BASEPROPERTY_HIDEINACTIVESELECTION,
4492                      BASEPROPERTY_VERTICALALIGN,
4493                      BASEPROPERTY_WRITING_MODE,
4494                      BASEPROPERTY_CONTEXT_WRITING_MODE,
4495                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
4496                      0);
4497     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
4498 }
4499 
4500 VCLXDateField::VCLXDateField()
4501 {
4502 }
4503 
4504 VCLXDateField::~VCLXDateField()
4505 {
4506 }
4507 
4508 //IAccessibility2 Implementation 2009-----
4509 //change the window type here to match the role
4510 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXDateField::CreateAccessibleContext()
4511 {
4512 	Window* pWindow = GetWindow();
4513 	if ( pWindow )
4514 	{
4515 		pWindow->SetType( WINDOW_DATEFIELD );
4516 	}
4517 	return getAccessibleFactory().createAccessibleContext( this );
4518 }
4519 //-----IAccessibility2 Implementation 2009
4520 
4521 // ::com::sun::star::uno::XInterface
4522 ::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
4523 {
4524 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
4525 										SAL_STATIC_CAST( ::com::sun::star::awt::XDateField*, this ) );
4526 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
4527 }
4528 
4529 // ::com::sun::star::lang::XTypeProvider
4530 IMPL_XTYPEPROVIDER_START( VCLXDateField )
4531 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ),
4532 	VCLXFormattedSpinField::getTypes()
4533 IMPL_XTYPEPROVIDER_END
4534 
4535 void VCLXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
4536 {
4537 	::vos::OGuard aGuard( GetMutex() );
4538 
4539 	if ( GetWindow() )
4540 	{
4541 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
4542 
4543 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4544 		switch ( nPropType )
4545 		{
4546 			case BASEPROPERTY_DATE:
4547 			{
4548 				if ( bVoid )
4549 				{
4550 					((DateField*)GetWindow())->EnableEmptyFieldValue( sal_True );
4551 					((DateField*)GetWindow())->SetEmptyFieldValue();
4552 				}
4553 				else
4554 				{
4555 					sal_Int32 n = 0;
4556 					if ( Value >>= n )
4557  						setDate( n );
4558 				}
4559 			}
4560 			break;
4561 			case BASEPROPERTY_DATEMIN:
4562 			{
4563 				sal_Int32 n = 0;
4564 				if ( Value >>= n )
4565  					setMin( n );
4566 			}
4567 			break;
4568 			case BASEPROPERTY_DATEMAX:
4569 			{
4570 				sal_Int32 n = 0;
4571 				if ( Value >>= n )
4572  					setMax( n );
4573 			}
4574 			break;
4575 			case BASEPROPERTY_EXTDATEFORMAT:
4576 			{
4577 				sal_Int16 n = sal_Int16();
4578 				if ( Value >>= n )
4579 					((DateField*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n );
4580 			}
4581 			break;
4582 			case BASEPROPERTY_DATESHOWCENTURY:
4583 			{
4584 				sal_Bool b = sal_Bool();
4585 				if ( Value >>= b )
4586  					((DateField*)GetWindow())->SetShowDateCentury( b );
4587 			}
4588 			break;
4589             case BASEPROPERTY_ENFORCE_FORMAT:
4590             {
4591 				sal_Bool bEnforce( sal_True );
4592 				OSL_VERIFY( Value >>= bEnforce );
4593                 static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce );
4594             }
4595             break;
4596 			default:
4597 			{
4598 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
4599 			}
4600 		}
4601 	}
4602 }
4603 
4604 ::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
4605 {
4606 	::vos::OGuard aGuard( GetMutex() );
4607 
4608 	::com::sun::star::uno::Any aProp;
4609 	FormatterBase* pFormatter = GetFormatter();
4610 	if ( pFormatter )
4611 	{
4612 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
4613 		switch ( nPropType )
4614 		{
4615 			case BASEPROPERTY_DATE:
4616 			{
4617 				aProp <<= (sal_Int32) getDate();
4618 			}
4619 			break;
4620 			case BASEPROPERTY_DATEMIN:
4621 			{
4622 				aProp <<= (sal_Int32) getMin();
4623 			}
4624 			break;
4625 			case BASEPROPERTY_DATEMAX:
4626 			{
4627 				aProp <<= (sal_Int32) getMax();
4628 			}
4629 			break;
4630 			case BASEPROPERTY_DATESHOWCENTURY:
4631 			{
4632 			    aProp <<= ((DateField*)GetWindow())->IsShowDateCentury();
4633 			}
4634 			break;
4635             case BASEPROPERTY_ENFORCE_FORMAT:
4636             {
4637                 aProp <<= (sal_Bool)static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( );
4638             }
4639             break;
4640 			default:
4641 			{
4642 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
4643 			}
4644 		}
4645 	}
4646 	return aProp;
4647 }
4648 
4649 
4650 void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4651 {
4652 	::vos::OGuard aGuard( GetMutex() );
4653 
4654 	DateField* pDateField = (DateField*) GetWindow();
4655 	if ( pDateField )
4656     {
4657 		pDateField->SetDate( nDate );
4658 
4659         // #107218# Call same listeners like VCL would do after user interaction
4660         SetSynthesizingVCLEvent( sal_True );
4661         pDateField->SetModifyFlag();
4662         pDateField->Modify();
4663         SetSynthesizingVCLEvent( sal_False );
4664     }
4665 }
4666 
4667 sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
4668 {
4669 	::vos::OGuard aGuard( GetMutex() );
4670 
4671 	sal_Int32 nDate = 0;
4672 	DateField* pDateField = (DateField*) GetWindow();
4673 	if ( pDateField )
4674 		nDate = pDateField->GetDate().GetDate();
4675 
4676 	return nDate;
4677 }
4678 
4679 void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4680 {
4681 	::vos::OGuard aGuard( GetMutex() );
4682 
4683 	DateField* pDateField = (DateField*) GetWindow();
4684 	if ( pDateField )
4685 		pDateField->SetMin( nDate );
4686 }
4687 
4688 sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
4689 {
4690 	::vos::OGuard aGuard( GetMutex() );
4691 
4692 	sal_Int32 nDate = 0;
4693 	DateField* pDateField = (DateField*) GetWindow();
4694 	if ( pDateField )
4695 		nDate = pDateField->GetMin().GetDate();
4696 
4697 	return nDate;
4698 }
4699 
4700 void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4701 {
4702 	::vos::OGuard aGuard( GetMutex() );
4703 
4704 	DateField* pDateField = (DateField*) GetWindow();
4705 	if ( pDateField )
4706 		pDateField->SetMax( nDate );
4707 }
4708 
4709 sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
4710 {
4711 	::vos::OGuard aGuard( GetMutex() );
4712 
4713 	sal_Int32 nDate = 0;
4714 	DateField* pDateField = (DateField*) GetWindow();
4715 	if ( pDateField )
4716 		nDate = pDateField->GetMax().GetDate();
4717 
4718 	return nDate;
4719 }
4720 
4721 void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4722 {
4723 	::vos::OGuard aGuard( GetMutex() );
4724 
4725 	DateField* pDateField = (DateField*) GetWindow();
4726 	if ( pDateField )
4727 		pDateField->SetFirst( nDate );
4728 }
4729 
4730 sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
4731 {
4732 	::vos::OGuard aGuard( GetMutex() );
4733 
4734 	sal_Int32 nDate = 0;
4735 	DateField* pDateField = (DateField*) GetWindow();
4736 	if ( pDateField )
4737 		nDate = pDateField->GetFirst().GetDate();
4738 
4739 	return nDate;
4740 }
4741 
4742 void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
4743 {
4744 	::vos::OGuard aGuard( GetMutex() );
4745 
4746 	DateField* pDateField = (DateField*) GetWindow();
4747 	if ( pDateField )
4748 		pDateField->SetLast( nDate );
4749 }
4750 
4751 sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
4752 {
4753 	::vos::OGuard aGuard( GetMutex() );
4754 
4755 	sal_Int32 nDate = 0;
4756 	DateField* pDateField = (DateField*) GetWindow();
4757 	if ( pDateField )
4758 		nDate = pDateField->GetLast().GetDate();
4759 
4760 	return nDate;
4761 }
4762 
4763 void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
4764 {
4765 	::vos::OGuard aGuard( GetMutex() );
4766 
4767 	DateField* pDateField = (DateField*) GetWindow();
4768 	if ( pDateField )
4769 		pDateField->SetLongFormat( bLong );
4770 }
4771 
4772 sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException)
4773 {
4774 	::vos::OGuard aGuard( GetMutex() );
4775 
4776 	DateField* pDateField = (DateField*) GetWindow();
4777 	return pDateField ? pDateField->IsLongFormat() : sal_False;
4778 }
4779 
4780 void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
4781 {
4782 	::vos::OGuard aGuard( GetMutex() );
4783 
4784 	DateField* pDateField = (DateField*) GetWindow();
4785 	if ( pDateField )
4786     {
4787 		pDateField->SetEmptyDate();
4788 
4789         // #107218# Call same listeners like VCL would do after user interaction
4790         SetSynthesizingVCLEvent( sal_True );
4791         pDateField->SetModifyFlag();
4792         pDateField->Modify();
4793         SetSynthesizingVCLEvent( sal_False );
4794     }
4795 }
4796 
4797 sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
4798 {
4799 	::vos::OGuard aGuard( GetMutex() );
4800 
4801 	DateField* pDateField = (DateField*) GetWindow();
4802 	return pDateField ? pDateField->IsEmptyDate() : sal_False;
4803 }
4804 
4805 void VCLXDateField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
4806 {
4807 	VCLXFormattedSpinField::setStrictFormat( bStrict );
4808 }
4809 
4810 sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
4811 {
4812 	return VCLXFormattedSpinField::isStrictFormat();
4813 }
4814 
4815 
4816 //	----------------------------------------------------
4817 //	class VCLXTimeField
4818 //	----------------------------------------------------
4819 
4820 void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
4821 {
4822     PushPropertyIds( rIds,
4823                      BASEPROPERTY_ALIGN,
4824                      BASEPROPERTY_BACKGROUNDCOLOR,
4825                      BASEPROPERTY_BORDER,
4826                      BASEPROPERTY_BORDERCOLOR,
4827                      BASEPROPERTY_DEFAULTCONTROL,
4828                      BASEPROPERTY_ENABLED,
4829                      BASEPROPERTY_ENABLEVISIBLE,
4830                      BASEPROPERTY_EXTTIMEFORMAT,
4831                      BASEPROPERTY_FONTDESCRIPTOR,
4832                      BASEPROPERTY_HELPTEXT,
4833                      BASEPROPERTY_HELPURL,
4834                      BASEPROPERTY_PRINTABLE,
4835                      BASEPROPERTY_READONLY,
4836                      BASEPROPERTY_REPEAT,
4837                      BASEPROPERTY_REPEAT_DELAY,
4838                      BASEPROPERTY_SPIN,
4839                      BASEPROPERTY_STRICTFORMAT,
4840                      BASEPROPERTY_TABSTOP,
4841                      BASEPROPERTY_TIME,
4842                      BASEPROPERTY_TIMEMAX,
4843                      BASEPROPERTY_TIMEMIN,
4844                      BASEPROPERTY_ENFORCE_FORMAT,
4845                      BASEPROPERTY_TEXT,
4846                      BASEPROPERTY_HIDEINACTIVESELECTION,
4847                      BASEPROPERTY_VERTICALALIGN,
4848                      BASEPROPERTY_WRITING_MODE,
4849                      BASEPROPERTY_CONTEXT_WRITING_MODE,
4850                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
4851                      0);
4852     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
4853 }
4854 
4855 VCLXTimeField::VCLXTimeField()
4856 {
4857 }
4858 
4859 VCLXTimeField::~VCLXTimeField()
4860 {
4861 }
4862 //IAccessibility2 Implementation 2009-----
4863 //change the window type here to match the role
4864 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXTimeField::CreateAccessibleContext()
4865 {
4866 	Window* pWindow = GetWindow();
4867 	if ( pWindow )
4868 	{
4869 		pWindow->SetType( WINDOW_TIMEFIELD );
4870 	}
4871 	return getAccessibleFactory().createAccessibleContext( this );
4872 }
4873 //-----IAccessibility2 Implementation 2009
4874 
4875 // ::com::sun::star::uno::XInterface
4876 ::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
4877 {
4878 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
4879 										SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField*, this ) );
4880 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
4881 }
4882 
4883 // ::com::sun::star::lang::XTypeProvider
4884 IMPL_XTYPEPROVIDER_START( VCLXTimeField )
4885 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ),
4886 	VCLXFormattedSpinField::getTypes()
4887 IMPL_XTYPEPROVIDER_END
4888 
4889 void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4890 {
4891 	::vos::OGuard aGuard( GetMutex() );
4892 
4893 	TimeField* pTimeField = (TimeField*) GetWindow();
4894 	if ( pTimeField )
4895     {
4896 		pTimeField->SetTime( nTime );
4897 
4898         // #107218# Call same listeners like VCL would do after user interaction
4899         SetSynthesizingVCLEvent( sal_True );
4900         pTimeField->SetModifyFlag();
4901         pTimeField->Modify();
4902         SetSynthesizingVCLEvent( sal_False );
4903     }
4904 }
4905 
4906 sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
4907 {
4908 	::vos::OGuard aGuard( GetMutex() );
4909 
4910 	sal_Int32 nTime = 0;
4911 	TimeField* pTimeField = (TimeField*) GetWindow();
4912 	if ( pTimeField )
4913 		nTime = pTimeField->GetTime().GetTime();
4914 
4915 	return nTime;
4916 }
4917 
4918 void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4919 {
4920 	::vos::OGuard aGuard( GetMutex() );
4921 
4922 	TimeField* pTimeField = (TimeField*) GetWindow();
4923 	if ( pTimeField )
4924 		pTimeField->SetMin( nTime );
4925 }
4926 
4927 sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
4928 {
4929 	::vos::OGuard aGuard( GetMutex() );
4930 
4931 	sal_Int32 nTime = 0;
4932 	TimeField* pTimeField = (TimeField*) GetWindow();
4933 	if ( pTimeField )
4934 		nTime = pTimeField->GetMin().GetTime();
4935 
4936 	return nTime;
4937 }
4938 
4939 void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4940 {
4941 	::vos::OGuard aGuard( GetMutex() );
4942 
4943 	TimeField* pTimeField = (TimeField*) GetWindow();
4944 	if ( pTimeField )
4945 		pTimeField->SetMax( nTime );
4946 }
4947 
4948 sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
4949 {
4950 	::vos::OGuard aGuard( GetMutex() );
4951 
4952 	sal_Int32 nTime = 0;
4953 	TimeField* pTimeField = (TimeField*) GetWindow();
4954 	if ( pTimeField )
4955 		nTime = pTimeField->GetMax().GetTime();
4956 
4957 	return nTime;
4958 }
4959 
4960 void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4961 {
4962 	::vos::OGuard aGuard( GetMutex() );
4963 
4964 	TimeField* pTimeField = (TimeField*) GetWindow();
4965 	if ( pTimeField )
4966 		pTimeField->SetFirst( nTime );
4967 }
4968 
4969 sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
4970 {
4971 	::vos::OGuard aGuard( GetMutex() );
4972 
4973 	sal_Int32 nTime = 0;
4974 	TimeField* pTimeField = (TimeField*) GetWindow();
4975 	if ( pTimeField )
4976 		nTime = pTimeField->GetFirst().GetTime();
4977 
4978 	return nTime;
4979 }
4980 
4981 void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
4982 {
4983 	::vos::OGuard aGuard( GetMutex() );
4984 
4985 	TimeField* pTimeField = (TimeField*) GetWindow();
4986 	if ( pTimeField )
4987 		pTimeField->SetLast( nTime );
4988 }
4989 
4990 sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
4991 {
4992 	::vos::OGuard aGuard( GetMutex() );
4993 
4994 	sal_Int32 nTime = 0;
4995 	TimeField* pTimeField = (TimeField*) GetWindow();
4996 	if ( pTimeField )
4997 		nTime = pTimeField->GetLast().GetTime();
4998 
4999 	return nTime;
5000 }
5001 
5002 void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
5003 {
5004 	::vos::OGuard aGuard( GetMutex() );
5005 
5006 	TimeField* pTimeField = (TimeField*) GetWindow();
5007 	if ( pTimeField )
5008 		pTimeField->SetEmptyTime();
5009 }
5010 
5011 sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
5012 {
5013 	::vos::OGuard aGuard( GetMutex() );
5014 
5015 	TimeField* pTimeField = (TimeField*) GetWindow();
5016 	return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
5017 }
5018 
5019 void VCLXTimeField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5020 {
5021 	VCLXFormattedSpinField::setStrictFormat( bStrict );
5022 }
5023 
5024 sal_Bool VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5025 {
5026 	return VCLXFormattedSpinField::isStrictFormat();
5027 }
5028 
5029 
5030 void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5031 {
5032 	::vos::OGuard aGuard( GetMutex() );
5033 
5034 	if ( GetWindow() )
5035 	{
5036 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5037 
5038 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5039 		switch ( nPropType )
5040 		{
5041 			case BASEPROPERTY_TIME:
5042 			{
5043 				if ( bVoid )
5044 				{
5045 					((TimeField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5046 					((TimeField*)GetWindow())->SetEmptyFieldValue();
5047 				}
5048 				else
5049 				{
5050 					sal_Int32 n = 0;
5051 					if ( Value >>= n )
5052  						setTime( n );
5053 				}
5054 			}
5055 			break;
5056 			case BASEPROPERTY_TIMEMIN:
5057 			{
5058 				sal_Int32 n = 0;
5059 				if ( Value >>= n )
5060  					setMin( n );
5061 			}
5062 			break;
5063 			case BASEPROPERTY_TIMEMAX:
5064 			{
5065 				sal_Int32 n = 0;
5066 				if ( Value >>= n )
5067  					setMax( n );
5068 			}
5069 			break;
5070 			case BASEPROPERTY_EXTTIMEFORMAT:
5071 			{
5072 				sal_Int16 n = sal_Int16();
5073 				if ( Value >>= n )
5074 					((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
5075 			}
5076 			break;
5077             case BASEPROPERTY_ENFORCE_FORMAT:
5078             {
5079 				sal_Bool bEnforce( sal_True );
5080 				OSL_VERIFY( Value >>= bEnforce );
5081                 static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
5082             }
5083             break;
5084 			default:
5085 			{
5086 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
5087 			}
5088 		}
5089 	}
5090 }
5091 
5092 ::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5093 {
5094 	::vos::OGuard aGuard( GetMutex() );
5095 
5096 	::com::sun::star::uno::Any aProp;
5097 	if ( GetWindow() )
5098 	{
5099 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5100 		switch ( nPropType )
5101 		{
5102 			case BASEPROPERTY_TIME:
5103 			{
5104 				aProp <<= (sal_Int32) getTime();
5105 			}
5106 			break;
5107 			case BASEPROPERTY_TIMEMIN:
5108 			{
5109 				aProp <<= (sal_Int32) getMin();
5110 			}
5111 			break;
5112 			case BASEPROPERTY_TIMEMAX:
5113 			{
5114 				aProp <<= (sal_Int32) getMax();
5115 			}
5116 			break;
5117             case BASEPROPERTY_ENFORCE_FORMAT:
5118             {
5119                 aProp <<= (sal_Bool)static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
5120             }
5121             break;
5122 			default:
5123 			{
5124 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5125 			}
5126 		}
5127 	}
5128 	return aProp;
5129 }
5130 
5131 //	----------------------------------------------------
5132 //	class VCLXNumericField
5133 //	----------------------------------------------------
5134 
5135 void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5136 {
5137     PushPropertyIds( rIds,
5138                      BASEPROPERTY_ALIGN,
5139                      BASEPROPERTY_BACKGROUNDCOLOR,
5140                      BASEPROPERTY_BORDER,
5141                      BASEPROPERTY_BORDERCOLOR,
5142                      BASEPROPERTY_DECIMALACCURACY,
5143                      BASEPROPERTY_DEFAULTCONTROL,
5144                      BASEPROPERTY_ENABLED,
5145                      BASEPROPERTY_ENABLEVISIBLE,
5146                      BASEPROPERTY_FONTDESCRIPTOR,
5147                      BASEPROPERTY_HELPTEXT,
5148                      BASEPROPERTY_HELPURL,
5149                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5150                      BASEPROPERTY_PRINTABLE,
5151                      BASEPROPERTY_READONLY,
5152                      BASEPROPERTY_REPEAT,
5153                      BASEPROPERTY_REPEAT_DELAY,
5154                      BASEPROPERTY_SPIN,
5155                      BASEPROPERTY_STRICTFORMAT,
5156                      BASEPROPERTY_TABSTOP,
5157                      BASEPROPERTY_VALUEMAX_DOUBLE,
5158                      BASEPROPERTY_VALUEMIN_DOUBLE,
5159                      BASEPROPERTY_VALUESTEP_DOUBLE,
5160                      BASEPROPERTY_VALUE_DOUBLE,
5161                      BASEPROPERTY_ENFORCE_FORMAT,
5162                      BASEPROPERTY_HIDEINACTIVESELECTION,
5163                      BASEPROPERTY_VERTICALALIGN,
5164                      BASEPROPERTY_WRITING_MODE,
5165                      BASEPROPERTY_CONTEXT_WRITING_MODE,
5166                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5167                      0);
5168     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5169 }
5170 
5171 VCLXNumericField::VCLXNumericField()
5172 {
5173 }
5174 
5175 VCLXNumericField::~VCLXNumericField()
5176 {
5177 }
5178 
5179 // ::com::sun::star::uno::XInterface
5180 ::com::sun::star::uno::Any VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5181 {
5182 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5183 										SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ) );
5184 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5185 }
5186 
5187 // ::com::sun::star::lang::XTypeProvider
5188 IMPL_XTYPEPROVIDER_START( VCLXNumericField )
5189 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
5190 	VCLXFormattedSpinField::getTypes()
5191 IMPL_XTYPEPROVIDER_END
5192 
5193 void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
5194 {
5195 	::vos::OGuard aGuard( GetMutex() );
5196 
5197 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5198 	if ( pNumericFormatter )
5199 	{
5200 		// z.B. 105, 2 Digits => 1,05
5201 		// ein float 1,05 muss also eine 105 einstellen...
5202 		pNumericFormatter->SetValue(
5203 			(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5204 
5205         // #107218# Call same listeners like VCL would do after user interaction
5206 	    Edit* pEdit = (Edit*)GetWindow();
5207 	    if ( pEdit )
5208         {
5209             SetSynthesizingVCLEvent( sal_True );
5210             pEdit->SetModifyFlag();
5211             pEdit->Modify();
5212             SetSynthesizingVCLEvent( sal_False );
5213         }
5214 	}
5215 }
5216 
5217 double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
5218 {
5219 	::vos::OGuard aGuard( GetMutex() );
5220 
5221 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5222 	return pNumericFormatter
5223 		? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() )
5224 		: 0;
5225 }
5226 
5227 void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
5228 {
5229 	::vos::OGuard aGuard( GetMutex() );
5230 
5231 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5232 	if ( pNumericFormatter )
5233 		pNumericFormatter->SetMin(
5234 			(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5235 }
5236 
5237 double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
5238 {
5239 	::vos::OGuard aGuard( GetMutex() );
5240 
5241 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5242 	return pNumericFormatter
5243 		? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() )
5244 		: 0;
5245 }
5246 
5247 void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
5248 {
5249 	::vos::OGuard aGuard( GetMutex() );
5250 
5251 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5252 	if ( pNumericFormatter )
5253 		pNumericFormatter->SetMax(
5254 			(long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
5255 }
5256 
5257 double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
5258 {
5259 	::vos::OGuard aGuard( GetMutex() );
5260 
5261 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5262 	return pNumericFormatter
5263 		? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() )
5264 		: 0;
5265 }
5266 
5267 void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
5268 {
5269 	::vos::OGuard aGuard( GetMutex() );
5270 
5271 	NumericField* pNumericField = (NumericField*) GetWindow();
5272 	if ( pNumericField )
5273 		pNumericField->SetFirst(
5274 			(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5275 }
5276 
5277 double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5278 {
5279 	::vos::OGuard aGuard( GetMutex() );
5280 
5281 	NumericField* pNumericField = (NumericField*) GetWindow();
5282 	return pNumericField
5283 		? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
5284 		: 0;
5285 }
5286 
5287 void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
5288 {
5289 	::vos::OGuard aGuard( GetMutex() );
5290 
5291 	NumericField* pNumericField = (NumericField*) GetWindow();
5292 	if ( pNumericField )
5293 		pNumericField->SetLast(
5294 			(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5295 }
5296 
5297 double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
5298 {
5299 	::vos::OGuard aGuard( GetMutex() );
5300 
5301 	NumericField* pNumericField = (NumericField*) GetWindow();
5302 	return pNumericField
5303 		? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
5304 		: 0;
5305 }
5306 
5307 void VCLXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5308 {
5309 	VCLXFormattedSpinField::setStrictFormat( bStrict );
5310 }
5311 
5312 sal_Bool VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5313 {
5314 	return VCLXFormattedSpinField::isStrictFormat();
5315 }
5316 
5317 
5318 void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
5319 {
5320 	::vos::OGuard aGuard( GetMutex() );
5321 
5322 	NumericField* pNumericField = (NumericField*) GetWindow();
5323 	if ( pNumericField )
5324 		pNumericField->SetSpinSize(
5325 			(long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
5326 }
5327 
5328 double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5329 {
5330 	::vos::OGuard aGuard( GetMutex() );
5331 
5332 	NumericField* pNumericField = (NumericField*) GetWindow();
5333 	return pNumericField
5334 		? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
5335 		: 0;
5336 }
5337 
5338 void VCLXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5339 {
5340 	::vos::OGuard aGuard( GetMutex() );
5341 
5342 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5343 	if ( pNumericFormatter )
5344 	{
5345 		double n = getValue();
5346 		pNumericFormatter->SetDecimalDigits( Value );
5347 		setValue( n );
5348    	}
5349 }
5350 
5351 sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5352 {
5353 	::vos::OGuard aGuard( GetMutex() );
5354 
5355 	NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5356 	return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
5357 }
5358 
5359 void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5360 {
5361 	::vos::OGuard aGuard( GetMutex() );
5362 
5363 	if ( GetWindow() )
5364 	{
5365 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5366 
5367 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5368 		switch ( nPropType )
5369 		{
5370 			case BASEPROPERTY_VALUE_DOUBLE:
5371 			{
5372 				if ( bVoid )
5373 				{
5374 					((NumericField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5375 					((NumericField*)GetWindow())->SetEmptyFieldValue();
5376 				}
5377 				else
5378 				{
5379 					double d = 0;
5380 					if ( Value >>= d )
5381  						setValue( d );
5382 				}
5383 			}
5384 			break;
5385 			case BASEPROPERTY_VALUEMIN_DOUBLE:
5386 			{
5387 				double d = 0;
5388 				if ( Value >>= d )
5389  					setMin( d );
5390 			}
5391 			break;
5392 			case BASEPROPERTY_VALUEMAX_DOUBLE:
5393 			{
5394 				double d = 0;
5395 				if ( Value >>= d )
5396  					setMax( d );
5397 			}
5398 			break;
5399 			case BASEPROPERTY_VALUESTEP_DOUBLE:
5400 			{
5401 				double d = 0;
5402 				if ( Value >>= d )
5403  					setSpinSize( d );
5404 			}
5405 			break;
5406 			case BASEPROPERTY_DECIMALACCURACY:
5407 			{
5408 				sal_Int16 n = sal_Int16();
5409 				if ( Value >>= n )
5410  					setDecimalDigits( n );
5411 			}
5412 			break;
5413 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5414 			{
5415 				sal_Bool b = sal_Bool();
5416 				if ( Value >>= b )
5417  					((NumericField*)GetWindow())->SetUseThousandSep( b );
5418 			}
5419 			break;
5420 			default:
5421 			{
5422 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
5423 			}
5424 		}
5425 	}
5426 }
5427 
5428 ::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5429 {
5430 	::vos::OGuard aGuard( GetMutex() );
5431 
5432 	::com::sun::star::uno::Any aProp;
5433 	FormatterBase* pFormatter = GetFormatter();
5434 	if ( pFormatter )
5435 	{
5436 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5437 		switch ( nPropType )
5438 		{
5439 			case BASEPROPERTY_VALUE_DOUBLE:
5440 			{
5441 				aProp <<= (double) getValue();
5442 			}
5443 			break;
5444 			case BASEPROPERTY_VALUEMIN_DOUBLE:
5445 			{
5446 				aProp <<= (double) getMin();
5447 			}
5448 			break;
5449 			case BASEPROPERTY_VALUEMAX_DOUBLE:
5450 			{
5451 				aProp <<= (double) getMax();
5452 			}
5453 			break;
5454 			case BASEPROPERTY_VALUESTEP_DOUBLE:
5455 			{
5456 				aProp <<= (double) getSpinSize();
5457 			}
5458 			break;
5459 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5460 			{
5461 			    aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
5462 			}
5463 			break;
5464 			default:
5465 			{
5466 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5467 			}
5468 		}
5469 	}
5470 	return aProp;
5471 }
5472 
5473 
5474 //    ----------------------------------------------------
5475 //    class VCLXMetricField
5476 //    ----------------------------------------------------
5477 
5478 void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5479 {
5480     PushPropertyIds( rIds,
5481                      BASEPROPERTY_ALIGN,
5482                      BASEPROPERTY_BACKGROUNDCOLOR,
5483                      BASEPROPERTY_BORDER,
5484                      BASEPROPERTY_BORDERCOLOR,
5485                      BASEPROPERTY_DECIMALACCURACY,
5486                      BASEPROPERTY_DEFAULTCONTROL,
5487                      BASEPROPERTY_ENABLED,
5488                      BASEPROPERTY_ENABLEVISIBLE,
5489                      BASEPROPERTY_FONTDESCRIPTOR,
5490                      BASEPROPERTY_HELPTEXT,
5491                      BASEPROPERTY_HELPURL,
5492                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5493                      BASEPROPERTY_PRINTABLE,
5494                      BASEPROPERTY_READONLY,
5495                      BASEPROPERTY_REPEAT,
5496                      BASEPROPERTY_REPEAT_DELAY,
5497                      BASEPROPERTY_SPIN,
5498                      BASEPROPERTY_STRICTFORMAT,
5499                      BASEPROPERTY_TABSTOP,
5500                      BASEPROPERTY_ENFORCE_FORMAT,
5501                      BASEPROPERTY_HIDEINACTIVESELECTION,
5502                      BASEPROPERTY_UNIT,
5503                      BASEPROPERTY_CUSTOMUNITTEXT,
5504                      BASEPROPERTY_WRITING_MODE,
5505                      BASEPROPERTY_CONTEXT_WRITING_MODE,
5506                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5507                      0);
5508     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5509 }
5510 
5511 VCLXMetricField::VCLXMetricField()
5512 {
5513 }
5514 
5515 VCLXMetricField::~VCLXMetricField()
5516 {
5517 }
5518 
5519 MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException)
5520 {
5521     MetricFormatter *pFormatter = (MetricFormatter *) GetFormatter();
5522     if (!pFormatter)
5523         throw ::com::sun::star::uno::RuntimeException();
5524     return pFormatter;
5525 }
5526 
5527 MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
5528 {
5529     MetricField *pField = (MetricField *) GetWindow();
5530     if (!pField)
5531         throw ::com::sun::star::uno::RuntimeException();
5532     return pField;
5533 }
5534 
5535 // ::com::sun::star::uno::XInterface
5536 ::com::sun::star::uno::Any VCLXMetricField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5537 {
5538     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5539                                                               SAL_STATIC_CAST( ::com::sun::star::awt::XMetricField*, this ) );
5540     return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5541 }
5542 
5543 // ::com::sun::star::lang::XTypeProvider
5544 IMPL_XTYPEPROVIDER_START( VCLXMetricField )
5545     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMetricField>* ) NULL ),
5546     VCLXFormattedSpinField::getTypes()
5547 IMPL_XTYPEPROVIDER_END
5548 
5549 // FIXME: later ...
5550 #define MetricUnitUnoToVcl(a) ((FieldUnit)(a))
5551 
5552 #define METRIC_MAP_PAIR(method,parent) \
5553     sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5554     { \
5555         ::vos::OGuard aGuard( GetMutex() ); \
5556         return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
5557     } \
5558     void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5559     { \
5560         ::vos::OGuard aGuard( GetMutex() ); \
5561         GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
5562     }
5563 
5564 METRIC_MAP_PAIR(Min, Formatter)
5565 METRIC_MAP_PAIR(Max, Formatter)
5566 METRIC_MAP_PAIR(First, Field)
5567 METRIC_MAP_PAIR(Last,  Field)
5568 
5569 #undef METRIC_MAP_PAIR
5570 
5571 ::sal_Int64 VCLXMetricField::getValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
5572 {
5573     ::vos::OGuard aGuard( GetMutex() );
5574     return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit ) );
5575 }
5576 
5577 ::sal_Int64 VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
5578 {
5579     ::vos::OGuard aGuard( GetMutex() );
5580     return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit ) );
5581 }
5582 
5583 // FIXME: acute cut/paste evilness - move this to the parent Edit class ?
5584 void VCLXMetricField::CallListeners()
5585 {
5586     // #107218# Call same listeners like VCL would do after user interaction
5587     Edit* pEdit = (Edit*)GetWindow();
5588     if ( pEdit )
5589     {
5590         SetSynthesizingVCLEvent( sal_True );
5591         pEdit->SetModifyFlag();
5592         pEdit->Modify();
5593         SetSynthesizingVCLEvent( sal_False );
5594     }
5595 }
5596 
5597 void VCLXMetricField::setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
5598 {
5599     ::vos::OGuard aGuard( GetMutex() );
5600     GetMetricFormatter()->SetValue( Value, MetricUnitUnoToVcl( Unit ) );
5601     CallListeners();
5602 }
5603 
5604 void VCLXMetricField::setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
5605 {
5606     ::vos::OGuard aGuard( GetMutex() );
5607     GetMetricFormatter()->SetUserValue( Value, MetricUnitUnoToVcl( Unit ) );
5608     CallListeners();
5609 }
5610 
5611 void VCLXMetricField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5612 {
5613     VCLXFormattedSpinField::setStrictFormat( bStrict );
5614 }
5615 
5616 sal_Bool VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5617 {
5618     return VCLXFormattedSpinField::isStrictFormat();
5619 }
5620 
5621 void VCLXMetricField::setSpinSize( sal_Int64 Value ) throw(::com::sun::star::uno::RuntimeException)
5622 {
5623     ::vos::OGuard aGuard( GetMutex() );
5624     GetMetricField()->SetSpinSize( Value );
5625 }
5626 
5627 sal_Int64 VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5628 {
5629     ::vos::OGuard aGuard( GetMutex() );
5630     return GetMetricField()->GetSpinSize();
5631 }
5632 
5633 void VCLXMetricField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5634 {
5635     ::vos::OGuard aGuard( GetMutex() );
5636     GetMetricFormatter()->SetDecimalDigits( Value );
5637 }
5638 
5639 sal_Int16 VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5640 {
5641     ::vos::OGuard aGuard( GetMutex() );
5642 
5643     NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
5644     return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
5645 }
5646 
5647 void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5648 {
5649     ::vos::OGuard aGuard( GetMutex() );
5650 
5651     if ( GetWindow() )
5652     {
5653         sal_uInt16 nPropType = GetPropertyId( PropertyName );
5654         switch ( nPropType )
5655         {
5656             case BASEPROPERTY_DECIMALACCURACY:
5657             {
5658                 sal_Int16 n = 0;
5659                 if ( Value >>= n )
5660                      setDecimalDigits( n );
5661                 break;
5662             }
5663             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5664             {
5665                 sal_Bool b = sal_False;
5666                 if ( Value >>= b )
5667                      ((NumericField*)GetWindow())->SetUseThousandSep( b );
5668             }
5669             break;
5670             case BASEPROPERTY_UNIT:
5671             {
5672                 sal_uInt16 nVal = 0;
5673                 if ( Value >>= nVal )
5674                     ((MetricField*)GetWindow())->SetUnit( (FieldUnit) nVal );
5675                 break;
5676             }
5677             case BASEPROPERTY_CUSTOMUNITTEXT:
5678             {
5679                 rtl::OUString aStr;
5680                 if ( Value >>= aStr )
5681                     ((MetricField*)GetWindow())->SetCustomUnitText( aStr );
5682                 break;
5683             }
5684             default:
5685             {
5686                 VCLXFormattedSpinField::setProperty( PropertyName, Value );
5687                 break;
5688             }
5689         }
5690     }
5691 }
5692 
5693 ::com::sun::star::uno::Any VCLXMetricField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
5694 {
5695     ::vos::OGuard aGuard( GetMutex() );
5696 
5697     ::com::sun::star::uno::Any aProp;
5698     FormatterBase* pFormatter = GetFormatter();
5699     if ( pFormatter )
5700     {
5701         sal_uInt16 nPropType = GetPropertyId( PropertyName );
5702         switch ( nPropType )
5703         {
5704             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
5705                 aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
5706                 break;
5707             case BASEPROPERTY_UNIT:
5708                 aProp <<= (sal_uInt16) ((MetricField*)GetWindow())->GetUnit();
5709                 break;
5710             case BASEPROPERTY_CUSTOMUNITTEXT:
5711                 aProp <<= rtl::OUString (((MetricField*)GetWindow())->GetCustomUnitText());
5712                 break;
5713             default:
5714             {
5715                 aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
5716                 break;
5717             }
5718         }
5719     }
5720     return aProp;
5721 }
5722 
5723 
5724 //	----------------------------------------------------
5725 //	class VCLXCurrencyField
5726 //	----------------------------------------------------
5727 
5728 void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
5729 {
5730     PushPropertyIds( rIds,
5731                      BASEPROPERTY_ALIGN,
5732                      BASEPROPERTY_BACKGROUNDCOLOR,
5733                      BASEPROPERTY_BORDER,
5734                      BASEPROPERTY_BORDERCOLOR,
5735                      BASEPROPERTY_CURRENCYSYMBOL,
5736                      BASEPROPERTY_CURSYM_POSITION,
5737                      BASEPROPERTY_DECIMALACCURACY,
5738                      BASEPROPERTY_DEFAULTCONTROL,
5739                      BASEPROPERTY_ENABLED,
5740                      BASEPROPERTY_ENABLEVISIBLE,
5741                      BASEPROPERTY_FONTDESCRIPTOR,
5742                      BASEPROPERTY_HELPTEXT,
5743                      BASEPROPERTY_HELPURL,
5744                      BASEPROPERTY_NUMSHOWTHOUSANDSEP,
5745                      BASEPROPERTY_PRINTABLE,
5746                      BASEPROPERTY_READONLY,
5747                      BASEPROPERTY_REPEAT,
5748                      BASEPROPERTY_REPEAT_DELAY,
5749                      BASEPROPERTY_SPIN,
5750                      BASEPROPERTY_STRICTFORMAT,
5751                      BASEPROPERTY_TABSTOP,
5752                      BASEPROPERTY_VALUEMAX_DOUBLE,
5753                      BASEPROPERTY_VALUEMIN_DOUBLE,
5754                      BASEPROPERTY_VALUESTEP_DOUBLE,
5755                      BASEPROPERTY_VALUE_DOUBLE,
5756                      BASEPROPERTY_ENFORCE_FORMAT,
5757                      BASEPROPERTY_HIDEINACTIVESELECTION,
5758                      BASEPROPERTY_VERTICALALIGN,
5759                      BASEPROPERTY_WRITING_MODE,
5760                      BASEPROPERTY_CONTEXT_WRITING_MODE,
5761                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
5762                      0);
5763     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
5764 }
5765 
5766 VCLXCurrencyField::VCLXCurrencyField()
5767 {
5768 }
5769 
5770 VCLXCurrencyField::~VCLXCurrencyField()
5771 {
5772 }
5773 
5774 // ::com::sun::star::uno::XInterface
5775 ::com::sun::star::uno::Any VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
5776 {
5777 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
5778 										SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ) );
5779 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
5780 }
5781 
5782 // ::com::sun::star::lang::XTypeProvider
5783 IMPL_XTYPEPROVIDER_START( VCLXCurrencyField )
5784 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
5785 	VCLXFormattedSpinField::getTypes()
5786 IMPL_XTYPEPROVIDER_END
5787 
5788 void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
5789 {
5790 	::vos::OGuard aGuard( GetMutex() );
5791 
5792 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5793 	if ( pCurrencyFormatter )
5794 	{
5795 		// z.B. 105, 2 Digits => 1,05
5796 		// ein float 1,05 muss also eine 105 einstellen...
5797 		pCurrencyFormatter->SetValue(
5798 			ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
5799 
5800         // #107218# Call same listeners like VCL would do after user interaction
5801 	    Edit* pEdit = (Edit*)GetWindow();
5802 	    if ( pEdit )
5803         {
5804             SetSynthesizingVCLEvent( sal_True );
5805             pEdit->SetModifyFlag();
5806             pEdit->Modify();
5807             SetSynthesizingVCLEvent( sal_False );
5808         }
5809 	}
5810 }
5811 
5812 double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
5813 {
5814 	::vos::OGuard aGuard( GetMutex() );
5815 
5816 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5817 	return pCurrencyFormatter
5818 		? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() )
5819 		: 0;
5820 }
5821 
5822 void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
5823 {
5824 	::vos::OGuard aGuard( GetMutex() );
5825 
5826 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5827 	if ( pCurrencyFormatter )
5828 		pCurrencyFormatter->SetMin(
5829 			ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
5830 }
5831 
5832 double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
5833 {
5834 	::vos::OGuard aGuard( GetMutex() );
5835 
5836 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5837 	return pCurrencyFormatter
5838 		? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() )
5839 		: 0;
5840 }
5841 
5842 void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
5843 {
5844 	::vos::OGuard aGuard( GetMutex() );
5845 
5846 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5847 	if ( pCurrencyFormatter )
5848 		pCurrencyFormatter->SetMax(
5849 			ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
5850 }
5851 
5852 double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
5853 {
5854 	::vos::OGuard aGuard( GetMutex() );
5855 
5856 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5857 	return pCurrencyFormatter
5858 		? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() )
5859 		: 0;
5860 }
5861 
5862 void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
5863 {
5864 	::vos::OGuard aGuard( GetMutex() );
5865 
5866 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5867 	if ( pCurrencyField )
5868 		pCurrencyField->SetFirst(
5869 			ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
5870 }
5871 
5872 double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
5873 {
5874 	::vos::OGuard aGuard( GetMutex() );
5875 
5876 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5877 	return pCurrencyField
5878 		? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
5879 		: 0;
5880 }
5881 
5882 void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
5883 {
5884 	::vos::OGuard aGuard( GetMutex() );
5885 
5886 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5887 	if ( pCurrencyField )
5888 		pCurrencyField->SetLast(
5889 			ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
5890 }
5891 
5892 double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
5893 {
5894 	::vos::OGuard aGuard( GetMutex() );
5895 
5896 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5897 	return pCurrencyField
5898 		? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
5899 		: 0;
5900 }
5901 
5902 void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
5903 {
5904 	::vos::OGuard aGuard( GetMutex() );
5905 
5906 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5907 	if ( pCurrencyField )
5908 		pCurrencyField->SetSpinSize(
5909 			ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
5910 }
5911 
5912 double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
5913 {
5914 	::vos::OGuard aGuard( GetMutex() );
5915 
5916 	LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
5917 	return pCurrencyField
5918 		? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
5919 		: 0;
5920 }
5921 
5922 void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
5923 {
5924 	VCLXFormattedSpinField::setStrictFormat( bStrict );
5925 }
5926 
5927 sal_Bool VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
5928 {
5929 	return VCLXFormattedSpinField::isStrictFormat();
5930 }
5931 
5932 
5933 void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
5934 {
5935 	::vos::OGuard aGuard( GetMutex() );
5936 
5937 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5938 	if ( pCurrencyFormatter )
5939 	{
5940 		double n = getValue();
5941 		pCurrencyFormatter->SetDecimalDigits( Value );
5942 		setValue( n );
5943    	}
5944 }
5945 
5946 sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
5947 {
5948 	::vos::OGuard aGuard( GetMutex() );
5949 
5950 	LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
5951 	return pCurrencyFormatter ? pCurrencyFormatter->GetDecimalDigits() : 0;
5952 }
5953 
5954 void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
5955 {
5956 	::vos::OGuard aGuard( GetMutex() );
5957 
5958 	if ( GetWindow() )
5959 	{
5960 		sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
5961 
5962 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
5963 		switch ( nPropType )
5964 		{
5965 			case BASEPROPERTY_VALUE_DOUBLE:
5966 			{
5967 				if ( bVoid )
5968 				{
5969 					((LongCurrencyField*)GetWindow())->EnableEmptyFieldValue( sal_True );
5970 					((LongCurrencyField*)GetWindow())->SetEmptyFieldValue();
5971 				}
5972 				else
5973 				{
5974 					double d = 0;
5975 					if ( Value >>= d )
5976  						setValue( d );
5977 				}
5978 			}
5979 			break;
5980 			case BASEPROPERTY_VALUEMIN_DOUBLE:
5981 			{
5982 				double d = 0;
5983 				if ( Value >>= d )
5984  					setMin( d );
5985 			}
5986 			break;
5987 			case BASEPROPERTY_VALUEMAX_DOUBLE:
5988 			{
5989 				double d = 0;
5990 				if ( Value >>= d )
5991  					setMax( d );
5992 			}
5993 			break;
5994 			case BASEPROPERTY_VALUESTEP_DOUBLE:
5995 			{
5996 				double d = 0;
5997 				if ( Value >>= d )
5998  					setSpinSize( d );
5999 			}
6000 			break;
6001 			case BASEPROPERTY_DECIMALACCURACY:
6002 			{
6003 				sal_Int16 n = sal_Int16();
6004 				if ( Value >>= n )
6005  					setDecimalDigits( n );
6006 			}
6007 			break;
6008 			case BASEPROPERTY_CURRENCYSYMBOL:
6009 			{
6010 				::rtl::OUString aString;
6011 				if ( Value >>= aString )
6012  					((LongCurrencyField*)GetWindow())->SetCurrencySymbol( aString );
6013 			}
6014 			break;
6015 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
6016 			{
6017 				sal_Bool b = sal_Bool();
6018 				if ( Value >>= b )
6019  					((LongCurrencyField*)GetWindow())->SetUseThousandSep( b );
6020 			}
6021 			break;
6022 			default:
6023 			{
6024 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
6025 			}
6026 		}
6027 	}
6028 }
6029 
6030 ::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6031 {
6032 	::vos::OGuard aGuard( GetMutex() );
6033 
6034 	::com::sun::star::uno::Any aProp;
6035 	FormatterBase* pFormatter = GetFormatter();
6036 	if ( pFormatter )
6037 	{
6038 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
6039 		switch ( nPropType )
6040 		{
6041 			case BASEPROPERTY_VALUE_DOUBLE:
6042 			{
6043 				aProp <<= (double) getValue();
6044 			}
6045 			break;
6046 			case BASEPROPERTY_VALUEMIN_DOUBLE:
6047 			{
6048 				aProp <<= (double) getMin();
6049 			}
6050 			break;
6051 			case BASEPROPERTY_VALUEMAX_DOUBLE:
6052 			{
6053 				aProp <<= (double) getMax();
6054 			}
6055 			break;
6056 			case BASEPROPERTY_VALUESTEP_DOUBLE:
6057 			{
6058 				aProp <<= (double) getSpinSize();
6059 			}
6060 			break;
6061 			case BASEPROPERTY_CURRENCYSYMBOL:
6062 			{
6063 			    aProp <<= ::rtl::OUString( ((LongCurrencyField*)GetWindow())->GetCurrencySymbol() );
6064 			}
6065 			break;
6066 			case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
6067 			{
6068 			    aProp <<= (sal_Bool) ((LongCurrencyField*)GetWindow())->IsUseThousandSep();
6069 			}
6070 			break;
6071 			default:
6072 			{
6073 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6074 			}
6075 		}
6076 	}
6077 	return aProp;
6078 }
6079 
6080 //	----------------------------------------------------
6081 //	class VCLXPatternField
6082 //	----------------------------------------------------
6083 
6084 void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
6085 {
6086     PushPropertyIds( rIds,
6087                      BASEPROPERTY_ALIGN,
6088                      BASEPROPERTY_BACKGROUNDCOLOR,
6089                      BASEPROPERTY_BORDER,
6090                      BASEPROPERTY_BORDERCOLOR,
6091                      BASEPROPERTY_DEFAULTCONTROL,
6092                      BASEPROPERTY_EDITMASK,
6093                      BASEPROPERTY_ENABLED,
6094                      BASEPROPERTY_ENABLEVISIBLE,
6095                      BASEPROPERTY_FONTDESCRIPTOR,
6096                      BASEPROPERTY_HELPTEXT,
6097                      BASEPROPERTY_HELPURL,
6098                      BASEPROPERTY_LITERALMASK,
6099                      BASEPROPERTY_MAXTEXTLEN,
6100                      BASEPROPERTY_PRINTABLE,
6101                      BASEPROPERTY_READONLY,
6102                      BASEPROPERTY_STRICTFORMAT,
6103                      BASEPROPERTY_TABSTOP,
6104                      BASEPROPERTY_TEXT,
6105                      BASEPROPERTY_HIDEINACTIVESELECTION,
6106                      BASEPROPERTY_VERTICALALIGN,
6107                      BASEPROPERTY_WRITING_MODE,
6108                      BASEPROPERTY_CONTEXT_WRITING_MODE,
6109                      BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
6110                      0);
6111     VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
6112 }
6113 
6114 VCLXPatternField::VCLXPatternField()
6115 {
6116 }
6117 
6118 VCLXPatternField::~VCLXPatternField()
6119 {
6120 }
6121 
6122 // ::com::sun::star::uno::XInterface
6123 ::com::sun::star::uno::Any VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
6124 {
6125 	::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
6126 										SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField*, this ) );
6127 	return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
6128 }
6129 
6130 // ::com::sun::star::lang::XTypeProvider
6131 IMPL_XTYPEPROVIDER_START( VCLXPatternField )
6132 	getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ),
6133 	VCLXFormattedSpinField::getTypes()
6134 IMPL_XTYPEPROVIDER_END
6135 
6136 void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
6137 {
6138 	::vos::OGuard aGuard( GetMutex() );
6139 
6140 	PatternField* pPatternField = (PatternField*) GetWindow();
6141 	if ( pPatternField )
6142 	{
6143 		pPatternField->SetMask(	ByteString( UniString( EditMask ), RTL_TEXTENCODING_ASCII_US ), LiteralMask );
6144 	}
6145 }
6146 
6147 void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
6148 {
6149 	::vos::OGuard aGuard( GetMutex() );
6150 
6151 	PatternField* pPatternField = (PatternField*) GetWindow();
6152 	if ( pPatternField )
6153 	{
6154 		EditMask = String( pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US );
6155 		LiteralMask = pPatternField->GetLiteralMask();
6156 	}
6157 }
6158 
6159 void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException)
6160 {
6161 	::vos::OGuard aGuard( GetMutex() );
6162 
6163 	PatternField* pPatternField = (PatternField*) GetWindow();
6164 	if ( pPatternField )
6165 	{
6166 		pPatternField->SetString( Str );
6167 	}
6168 }
6169 
6170 ::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException)
6171 {
6172 	::vos::OGuard aGuard( GetMutex() );
6173 
6174 	::rtl::OUString aString;
6175 	PatternField* pPatternField = (PatternField*) GetWindow();
6176 	if ( pPatternField )
6177 		aString = pPatternField->GetString();
6178 	return aString;
6179 }
6180 
6181 void VCLXPatternField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
6182 {
6183 	VCLXFormattedSpinField::setStrictFormat( bStrict );
6184 }
6185 
6186 sal_Bool VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
6187 {
6188 	return VCLXFormattedSpinField::isStrictFormat();
6189 }
6190 
6191 void VCLXPatternField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
6192 {
6193 	::vos::OGuard aGuard( GetMutex() );
6194 
6195 	if ( GetWindow() )
6196 	{
6197 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
6198 		switch ( nPropType )
6199 		{
6200 			case BASEPROPERTY_EDITMASK:
6201 			case BASEPROPERTY_LITERALMASK:
6202 			{
6203 				::rtl::OUString aString;
6204 				if ( Value >>= aString )
6205 				{
6206 					::rtl::OUString aEditMask, aLiteralMask;
6207 					getMasks( aEditMask, aLiteralMask );
6208 					if ( nPropType == BASEPROPERTY_EDITMASK )
6209 						aEditMask = aString;
6210 					else
6211 						aLiteralMask = aString;
6212  					setMasks( aEditMask, aLiteralMask );
6213 				}
6214 			}
6215 			break;
6216 			default:
6217 			{
6218 				VCLXFormattedSpinField::setProperty( PropertyName, Value );
6219 			}
6220 		}
6221 	}
6222 }
6223 
6224 ::com::sun::star::uno::Any VCLXPatternField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
6225 {
6226 	::vos::OGuard aGuard( GetMutex() );
6227 
6228 	::com::sun::star::uno::Any aProp;
6229 	if ( GetWindow() )
6230 	{
6231 		sal_uInt16 nPropType = GetPropertyId( PropertyName );
6232 		switch ( nPropType )
6233 		{
6234 			case BASEPROPERTY_EDITMASK:
6235 			case BASEPROPERTY_LITERALMASK:
6236 			{
6237 				::rtl::OUString aEditMask, aLiteralMask;
6238 				getMasks( aEditMask, aLiteralMask );
6239 				if ( nPropType == BASEPROPERTY_EDITMASK )
6240 					aProp <<= aEditMask;
6241 				else
6242 					aProp <<= aLiteralMask;
6243 			}
6244 			break;
6245 			default:
6246 			{
6247 				aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
6248 			}
6249 		}
6250 	}
6251 	return aProp;
6252 }
6253 
6254 //	----------------------------------------------------
6255 //	class VCLXToolBox
6256 //	----------------------------------------------------
6257 VCLXToolBox::VCLXToolBox()
6258 {
6259 }
6260 
6261 VCLXToolBox::~VCLXToolBox()
6262 {
6263 }
6264 
6265 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXToolBox::CreateAccessibleContext()
6266 {
6267     return getAccessibleFactory().createAccessibleContext( this );
6268 }
6269 
6270