1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vclxwindows.cxx,v $
10 * $Revision: 1.69.4.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include <toolkit/awt/vclxwindows.hxx>
34 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
35 #include <com/sun/star/graphic/XGraphic.hpp>
36 #include <toolkit/helper/vclunohelper.hxx>
37 #include <toolkit/helper/macros.hxx>
38 #include <toolkit/helper/property.hxx>
39 #include <toolkit/helper/convert.hxx>
40 #include <toolkit/helper/imagealign.hxx>
41 #include <toolkit/helper/accessibilityclient.hxx>
42 #include <toolkit/helper/fixedhyperbase.hxx>
43 #include <cppuhelper/typeprovider.hxx>
44 #include <com/sun/star/awt/VisualEffect.hpp>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 #include <com/sun/star/system/XSystemShellExecute.hpp>
47 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
48 #include <com/sun/star/awt/ImageScaleMode.hpp>
49 #include <comphelper/processfactory.hxx>
51 #ifndef _SV_BUTTON_HXX
52 #include <vcl/button.hxx>
54 #include <vcl/lstbox.hxx>
55 #include <vcl/combobox.hxx>
56 #include <vcl/field.hxx>
57 #include <vcl/longcurr.hxx>
58 #include <vcl/imgctrl.hxx>
59 #include <vcl/dialog.hxx>
60 #include <vcl/msgbox.hxx>
61 #include <vcl/scrbar.hxx>
62 #include <vcl/svapp.hxx>
63 #include <vcl/tabpage.hxx>
64 #include <tools/debug.hxx>
66 using ::com::sun::star::uno::Any
;
67 using ::com::sun::star::uno::Reference
;
68 using ::com::sun::star::uno::makeAny
;
69 using ::com::sun::star::graphic::XGraphic
;
71 using namespace ::com::sun::star
;
72 using namespace ::com::sun::star::awt::VisualEffect
;
73 namespace ImageScaleMode
= ::com::sun::star::awt::ImageScaleMode
;
75 static double ImplCalcLongValue( double nValue
, sal_uInt16 nDigits
)
78 for ( sal_uInt16 d
= 0; d
< nDigits
; d
++ )
83 static double ImplCalcDoubleValue( double nValue
, sal_uInt16 nDigits
)
86 for ( sal_uInt16 d
= 0; d
< nDigits
; d
++ )
93 /** sets the "face color" for button like controls (scroll bar, spin button)
95 void setButtonLikeFaceColor( Window
* _pWindow
, const ::com::sun::star::uno::Any
& _rColorValue
)
97 AllSettings aSettings
= _pWindow
->GetSettings();
98 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
100 if ( !_rColorValue
.hasValue() )
102 const StyleSettings
& aAppStyle
= Application::GetSettings().GetStyleSettings();
103 aStyleSettings
.SetFaceColor( aAppStyle
.GetFaceColor( ) );
104 aStyleSettings
.SetCheckedColor( aAppStyle
.GetCheckedColor( ) );
105 aStyleSettings
.SetLightBorderColor( aAppStyle
.GetLightBorderColor() );
106 aStyleSettings
.SetLightColor( aAppStyle
.GetLightColor() );
107 aStyleSettings
.SetShadowColor( aAppStyle
.GetShadowColor() );
108 aStyleSettings
.SetDarkShadowColor( aAppStyle
.GetDarkShadowColor() );
112 sal_Int32 nBackgroundColor
= 0;
113 _rColorValue
>>= nBackgroundColor
;
114 aStyleSettings
.SetFaceColor( nBackgroundColor
);
116 // for the real background (everything except the buttons and the thumb),
117 // use an average between the desired color and "white"
118 Color
aWhite( COL_WHITE
);
119 Color
aBackground( nBackgroundColor
);
120 aBackground
.SetRed( ( aBackground
.GetRed() + aWhite
.GetRed() ) / 2 );
121 aBackground
.SetGreen( ( aBackground
.GetGreen() + aWhite
.GetGreen() ) / 2 );
122 aBackground
.SetBlue( ( aBackground
.GetBlue() + aWhite
.GetBlue() ) / 2 );
123 aStyleSettings
.SetCheckedColor( aBackground
);
125 sal_Int32 nBackgroundLuminance
= Color( nBackgroundColor
).GetLuminance();
126 sal_Int32 nWhiteLuminance
= Color( COL_WHITE
).GetLuminance();
128 Color
aLightShadow( nBackgroundColor
);
129 aLightShadow
.IncreaseLuminance( (UINT8
)( ( nWhiteLuminance
- nBackgroundLuminance
) * 2 / 3 ) );
130 aStyleSettings
.SetLightBorderColor( aLightShadow
);
132 Color
aLight( nBackgroundColor
);
133 aLight
.IncreaseLuminance( (UINT8
)( ( nWhiteLuminance
- nBackgroundLuminance
) * 1 / 3 ) );
134 aStyleSettings
.SetLightColor( aLight
);
136 Color
aShadow( nBackgroundColor
);
137 aShadow
.DecreaseLuminance( (UINT8
)( nBackgroundLuminance
* 1 / 3 ) );
138 aStyleSettings
.SetShadowColor( aShadow
);
140 Color
aDarkShadow( nBackgroundColor
);
141 aDarkShadow
.DecreaseLuminance( (UINT8
)( nBackgroundLuminance
* 2 / 3 ) );
142 aStyleSettings
.SetDarkShadowColor( aDarkShadow
);
145 aSettings
.SetStyleSettings( aStyleSettings
);
146 _pWindow
->SetSettings( aSettings
, TRUE
);
149 Any
getButtonLikeFaceColor( const Window
* _pWindow
)
151 sal_Int32 nBackgroundColor
= _pWindow
->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
152 return makeAny( nBackgroundColor
);
155 static void adjustBooleanWindowStyle( const Any
& _rValue
, Window
* _pWindow
, WinBits _nBits
, sal_Bool _bInverseSemantics
)
157 WinBits nStyle
= _pWindow
->GetStyle();
158 sal_Bool
bValue( sal_False
);
159 OSL_VERIFY( _rValue
>>= bValue
);
160 if ( bValue
!= _bInverseSemantics
)
164 _pWindow
->SetStyle( nStyle
);
167 static void setVisualEffect( const Any
& _rValue
, Window
* _pWindow
, void (StyleSettings::*pSetter
)( USHORT
), sal_Int16 _nFlatBits
, sal_Int16 _n3DBits
)
169 AllSettings aSettings
= _pWindow
->GetSettings();
170 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
172 sal_Int16 nStyle
= LOOK3D
;
173 OSL_VERIFY( _rValue
>>= nStyle
);
177 (aStyleSettings
.*pSetter
)( _nFlatBits
);
181 (aStyleSettings
.*pSetter
)( _n3DBits
);
183 aSettings
.SetStyleSettings( aStyleSettings
);
184 _pWindow
->SetSettings( aSettings
);
187 static Any
getVisualEffect( Window
* _pWindow
, USHORT (StyleSettings::*pGetter
)( ) const, sal_Int16 _nFlatBits
)
191 StyleSettings aStyleSettings
= _pWindow
->GetSettings().GetStyleSettings();
192 if ( (aStyleSettings
.*pGetter
)() == _nFlatBits
)
193 aEffect
<<= (sal_Int16
)FLAT
;
195 aEffect
<<= (sal_Int16
)LOOK3D
;
200 // ----------------------------------------------------
201 // class VCLXImageConsumer
202 // ----------------------------------------------------
204 void VCLXImageConsumer::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
206 VCLXWindow::ImplGetPropertyIds( rIds
);
209 void VCLXImageConsumer::ImplSetNewImage()
211 OSL_PRECOND( GetWindow(), "VCLXImageConsumer::ImplSetNewImage: window is required to be not-NULL!" );
212 Button
* pButton
= static_cast< Button
* >( GetWindow() );
213 pButton
->SetModeBitmap( GetBitmap() );
216 void VCLXImageConsumer::ImplUpdateImage( sal_Bool bGetNewImage
)
221 if ( bGetNewImage
&& !maImageConsumer
.GetData( maImage
) )
227 void VCLXImageConsumer::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, short Flags
) throw(::com::sun::star::uno::RuntimeException
)
229 ::vos::OGuard
aGuard( GetMutex() );
233 Size aOldSize
= GetWindow()->GetSizePixel();
234 VCLXWindow::setPosSize( X
, Y
, Width
, Height
, Flags
);
235 if ( ( aOldSize
.Width() != Width
) || ( aOldSize
.Height() != Height
) )
236 ImplUpdateImage( sal_False
);
240 void VCLXImageConsumer::init( sal_Int32 Width
, sal_Int32 Height
) throw(::com::sun::star::uno::RuntimeException
)
242 ::vos::OGuard
aGuard( GetMutex() );
244 maImageConsumer
.Init( Width
, Height
);
247 void VCLXImageConsumer::setColorModel( sal_Int16 BitCount
, const ::com::sun::star::uno::Sequence
< sal_Int32
>& RGBAPal
, sal_Int32 RedMask
, sal_Int32 GreenMask
, sal_Int32 BlueMask
, sal_Int32 AlphaMask
) throw(::com::sun::star::uno::RuntimeException
)
249 ::vos::OGuard
aGuard( GetMutex() );
251 maImageConsumer
.SetColorModel( BitCount
, RGBAPal
.getLength(), (const sal_uInt32
*) RGBAPal
.getConstArray(), RedMask
, GreenMask
, BlueMask
, AlphaMask
);
254 void VCLXImageConsumer::setPixelsByBytes( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, const ::com::sun::star::uno::Sequence
< sal_Int8
>& ProducerData
, sal_Int32 Offset
, sal_Int32 Scansize
) throw(::com::sun::star::uno::RuntimeException
)
256 ::vos::OGuard
aGuard( GetMutex() );
258 maImageConsumer
.SetPixelsByBytes( X
, Y
, Width
, Height
, (sal_uInt8
*)ProducerData
.getConstArray(), Offset
, Scansize
);
259 ImplUpdateImage( sal_True
);
262 void VCLXImageConsumer::setPixelsByLongs( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, const ::com::sun::star::uno::Sequence
< sal_Int32
>& ProducerData
, sal_Int32 Offset
, sal_Int32 Scansize
) throw(::com::sun::star::uno::RuntimeException
)
264 ::vos::OGuard
aGuard( GetMutex() );
266 maImageConsumer
.SetPixelsByLongs( X
, Y
, Width
, Height
, (const sal_uInt32
*) ProducerData
.getConstArray(), Offset
, Scansize
);
267 ImplUpdateImage( sal_True
);
270 void VCLXImageConsumer::complete( sal_Int32 Status
, const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XImageProducer
> & ) throw(::com::sun::star::uno::RuntimeException
)
272 ::vos::OGuard
aGuard( GetMutex() );
274 maImageConsumer
.Completed( Status
);
275 ImplUpdateImage( sal_True
);
278 void VCLXImageConsumer::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
280 ::vos::OGuard
aGuard( GetMutex() );
282 Button
* pButton
= static_cast< Button
* >( GetWindow() );
285 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
288 case BASEPROPERTY_GRAPHIC
:
290 Reference
< XGraphic
> xGraphic
;
291 OSL_VERIFY( Value
>>= xGraphic
);
292 maImage
= Image( xGraphic
);
297 case BASEPROPERTY_IMAGEALIGN
:
299 WindowType eType
= GetWindow()->GetType();
300 if ( ( eType
== WINDOW_PUSHBUTTON
)
301 || ( eType
== WINDOW_RADIOBUTTON
)
302 || ( eType
== WINDOW_CHECKBOX
)
305 sal_Int16 nAlignment
= sal_Int16();
306 if ( Value
>>= nAlignment
)
307 pButton
->SetImageAlign( static_cast< ImageAlign
>( nAlignment
) );
311 case BASEPROPERTY_IMAGEPOSITION
:
313 WindowType eType
= GetWindow()->GetType();
314 if ( ( eType
== WINDOW_PUSHBUTTON
)
315 || ( eType
== WINDOW_RADIOBUTTON
)
316 || ( eType
== WINDOW_CHECKBOX
)
319 sal_Int16 nImagePosition
= 2;
320 OSL_VERIFY( Value
>>= nImagePosition
);
321 pButton
->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition
) );
326 VCLXWindow::setProperty( PropertyName
, Value
);
331 ::com::sun::star::uno::Any
VCLXImageConsumer::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
333 ::vos::OGuard
aGuard( GetMutex() );
335 ::com::sun::star::uno::Any aProp
;
339 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
342 case BASEPROPERTY_GRAPHIC
:
343 aProp
<<= maImage
.GetXGraphic();
345 case BASEPROPERTY_IMAGEALIGN
:
347 WindowType eType
= GetWindow()->GetType();
348 if ( ( eType
== WINDOW_PUSHBUTTON
)
349 || ( eType
== WINDOW_RADIOBUTTON
)
350 || ( eType
== WINDOW_CHECKBOX
)
353 aProp
<<= ::toolkit::getCompatibleImageAlign( static_cast< Button
* >( GetWindow() )->GetImageAlign() );
357 case BASEPROPERTY_IMAGEPOSITION
:
359 WindowType eType
= GetWindow()->GetType();
360 if ( ( eType
== WINDOW_PUSHBUTTON
)
361 || ( eType
== WINDOW_RADIOBUTTON
)
362 || ( eType
== WINDOW_CHECKBOX
)
365 aProp
<<= ::toolkit::translateImagePosition( static_cast< Button
* >( GetWindow() )->GetImageAlign() );
371 aProp
<<= VCLXWindow::getProperty( PropertyName
);
378 //--------------------------------------------------------------------
380 // ----------------------------------------------------
382 void VCLXButton::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
384 PushPropertyIds( rIds
,
385 BASEPROPERTY_BACKGROUNDCOLOR
,
386 BASEPROPERTY_DEFAULTBUTTON
,
387 BASEPROPERTY_DEFAULTCONTROL
,
388 BASEPROPERTY_ENABLED
,
389 BASEPROPERTY_ENABLEVISIBLE
,
390 BASEPROPERTY_FONTDESCRIPTOR
,
391 BASEPROPERTY_GRAPHIC
,
392 BASEPROPERTY_HELPTEXT
,
393 BASEPROPERTY_HELPURL
,
394 BASEPROPERTY_IMAGEALIGN
,
395 BASEPROPERTY_IMAGEPOSITION
,
396 BASEPROPERTY_IMAGEURL
,
398 BASEPROPERTY_PRINTABLE
,
399 BASEPROPERTY_PUSHBUTTONTYPE
,
401 BASEPROPERTY_REPEAT_DELAY
,
403 BASEPROPERTY_TABSTOP
,
405 BASEPROPERTY_FOCUSONCLICK
,
406 BASEPROPERTY_MULTILINE
,
408 BASEPROPERTY_VERTICALALIGN
,
409 BASEPROPERTY_WRITING_MODE
,
410 BASEPROPERTY_CONTEXT_WRITING_MODE
,
412 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
415 VCLXButton::VCLXButton()
416 :maActionListeners( *this )
417 ,maItemListeners( *this )
421 VCLXButton::~VCLXButton()
423 OSL_TRACE ("%s", __FUNCTION__
);
426 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXButton::CreateAccessibleContext()
428 return getAccessibleFactory().createAccessibleContext( this );
431 void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException
)
433 ::vos::OGuard
aGuard( GetMutex() );
435 ::com::sun::star::lang::EventObject aObj
;
436 aObj
.Source
= (::cppu::OWeakObject
*)this;
437 maActionListeners
.disposeAndClear( aObj
);
438 maItemListeners
.disposeAndClear( aObj
);
439 VCLXImageConsumer::dispose();
442 void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
444 ::vos::OGuard
aGuard( GetMutex() );
445 maActionListeners
.addInterface( l
);
448 void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
450 ::vos::OGuard
aGuard( GetMutex() );
451 maActionListeners
.removeInterface( l
);
454 void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
456 ::vos::OGuard
aGuard( GetMutex() );
457 maItemListeners
.addInterface( l
);
460 void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
462 ::vos::OGuard
aGuard( GetMutex() );
463 maItemListeners
.removeInterface( l
);
466 void VCLXButton::setLabel( const ::rtl::OUString
& rLabel
) throw(::com::sun::star::uno::RuntimeException
)
468 ::vos::OGuard
aGuard( GetMutex() );
470 Window
* pWindow
= GetWindow();
472 pWindow
->SetText( rLabel
);
475 void VCLXButton::setActionCommand( const ::rtl::OUString
& rCommand
) throw(::com::sun::star::uno::RuntimeException
)
477 ::vos::OGuard
aGuard( GetMutex() );
479 maActionCommand
= rCommand
;
482 ::com::sun::star::awt::Size
VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
484 ::vos::OGuard
aGuard( GetMutex() );
487 PushButton
* pButton
= (PushButton
*) GetWindow();
489 aSz
= pButton
->CalcMinimumSize();
493 ::com::sun::star::awt::Size
VCLXButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
495 ::com::sun::star::awt::Size aSz
= getMinimumSize();
501 ::com::sun::star::awt::Size
VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
503 ::vos::OGuard
aGuard( GetMutex() );
505 Size aSz
= VCLSize(rNewSize
);
506 PushButton
* pButton
= (PushButton
*) GetWindow();
509 Size aMinSz
= pButton
->CalcMinimumSize();
510 // Kein Text, also Image
511 if ( !pButton
->GetText().Len() )
513 if ( aSz
.Width() < aMinSz
.Width() )
514 aSz
.Width() = aMinSz
.Width();
515 if ( aSz
.Height() < aMinSz
.Height() )
516 aSz
.Height() = aMinSz
.Height();
520 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
521 aSz
.Height() = aMinSz
.Height();
529 void VCLXButton::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
531 ::vos::OGuard
aGuard( GetMutex() );
533 Button
* pButton
= (Button
*)GetWindow();
536 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
539 case BASEPROPERTY_FOCUSONCLICK
:
540 ::toolkit::adjustBooleanWindowStyle( Value
, pButton
, WB_NOPOINTERFOCUS
, sal_True
);
543 case BASEPROPERTY_TOGGLE
:
544 ::toolkit::adjustBooleanWindowStyle( Value
, pButton
, WB_TOGGLE
, sal_False
);
547 case BASEPROPERTY_DEFAULTBUTTON
:
549 WinBits nStyle
= pButton
->GetStyle() | WB_DEFBUTTON
;
550 sal_Bool b
= sal_Bool();
551 if ( ( Value
>>= b
) && !b
)
552 nStyle
&= ~WB_DEFBUTTON
;
553 pButton
->SetStyle( nStyle
);
556 case BASEPROPERTY_STATE
:
558 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON
)
560 sal_Int16 n
= sal_Int16();
562 ((PushButton
*)pButton
)->SetState( (TriState
)n
);
568 VCLXImageConsumer::setProperty( PropertyName
, Value
);
574 ::com::sun::star::uno::Any
VCLXButton::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
576 ::vos::OGuard
aGuard( GetMutex() );
578 ::com::sun::star::uno::Any aProp
;
579 Button
* pButton
= (Button
*)GetWindow();
582 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
585 case BASEPROPERTY_FOCUSONCLICK
:
586 aProp
<<= (sal_Bool
)( ( pButton
->GetStyle() & WB_NOPOINTERFOCUS
) == 0 );
589 case BASEPROPERTY_TOGGLE
:
590 aProp
<<= (sal_Bool
)( ( pButton
->GetStyle() & WB_TOGGLE
) != 0 );
593 case BASEPROPERTY_DEFAULTBUTTON
:
595 aProp
<<= (sal_Bool
) ( ( pButton
->GetStyle() & WB_DEFBUTTON
) ? sal_True
: sal_False
);
598 case BASEPROPERTY_STATE
:
600 if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON
)
602 aProp
<<= (sal_Int16
)((PushButton
*)pButton
)->GetState();
608 aProp
<<= VCLXImageConsumer::getProperty( PropertyName
);
615 void VCLXButton::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
617 switch ( rVclWindowEvent
.GetId() )
619 case VCLEVENT_BUTTON_CLICK
:
621 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
622 // since we call listeners below, there is a potential that we will be destroyed
623 // during the listener call. To prevent the resulting crashs, we keep us
624 // alive as long as we're here
625 // #20178# - 2003-10-01 - fs@openoffice.org
627 if ( maActionListeners
.getLength() )
629 ::com::sun::star::awt::ActionEvent aEvent
;
630 aEvent
.Source
= (::cppu::OWeakObject
*)this;
631 aEvent
.ActionCommand
= maActionCommand
;
632 maActionListeners
.actionPerformed( aEvent
);
637 case VCLEVENT_PUSHBUTTON_TOGGLE
:
639 PushButton
& rButton
= dynamic_cast< PushButton
& >( *rVclWindowEvent
.GetWindow() );
641 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
642 if ( maItemListeners
.getLength() )
644 ::com::sun::star::awt::ItemEvent aEvent
;
645 aEvent
.Source
= (::cppu::OWeakObject
*)this;
646 aEvent
.Selected
= ( rButton
.GetState() == STATE_CHECK
) ? 1 : 0;
647 maItemListeners
.itemStateChanged( aEvent
);
653 VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent
);
658 // ----------------------------------------------------
659 // class VCLXImageControl
660 // ----------------------------------------------------
662 void VCLXImageControl::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
664 PushPropertyIds( rIds
,
665 BASEPROPERTY_BACKGROUNDCOLOR
,
667 BASEPROPERTY_BORDERCOLOR
,
668 BASEPROPERTY_DEFAULTCONTROL
,
669 BASEPROPERTY_ENABLED
,
670 BASEPROPERTY_ENABLEVISIBLE
,
671 BASEPROPERTY_GRAPHIC
,
672 BASEPROPERTY_HELPTEXT
,
673 BASEPROPERTY_HELPURL
,
674 BASEPROPERTY_IMAGEURL
,
675 BASEPROPERTY_PRINTABLE
,
676 BASEPROPERTY_SCALEIMAGE
,
677 BASEPROPERTY_IMAGE_SCALE_MODE
,
678 BASEPROPERTY_TABSTOP
,
679 BASEPROPERTY_WRITING_MODE
,
680 BASEPROPERTY_CONTEXT_WRITING_MODE
,
682 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
685 VCLXImageControl::VCLXImageControl()
689 VCLXImageControl::~VCLXImageControl()
693 void VCLXImageControl::ImplSetNewImage()
695 OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
696 ImageControl
* pControl
= static_cast< ImageControl
* >( GetWindow() );
697 pControl
->SetBitmap( GetBitmap() );
700 ::com::sun::star::awt::Size
VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
702 ::vos::OGuard
aGuard( GetMutex() );
704 Size aSz
= GetBitmap().GetSizePixel();
705 aSz
= ImplCalcWindowSize( aSz
);
710 ::com::sun::star::awt::Size
VCLXImageControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
712 return getMinimumSize();
715 ::com::sun::star::awt::Size
VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
717 ::vos::OGuard
aGuard( GetMutex() );
719 ::com::sun::star::awt::Size aSz
= rNewSize
;
720 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
721 if ( aSz
.Width
< aMinSz
.Width
)
722 aSz
.Width
= aMinSz
.Width
;
723 if ( aSz
.Height
< aMinSz
.Height
)
724 aSz
.Height
= aMinSz
.Height
;
728 void VCLXImageControl::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
730 ::vos::OGuard
aGuard( GetMutex() );
732 ImageControl
* pImageControl
= (ImageControl
*)GetWindow();
734 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
737 case BASEPROPERTY_IMAGE_SCALE_MODE
:
739 sal_Int16
nScaleMode( ImageScaleMode::Anisotropic
);
740 if ( pImageControl
&& ( Value
>>= nScaleMode
) )
742 pImageControl
->SetScaleMode( nScaleMode
);
747 case BASEPROPERTY_SCALEIMAGE
:
749 // this is for compatibility only, nowadays, the ImageScaleMode property should be used
750 sal_Bool bScaleImage
= sal_False
;
751 if ( pImageControl
&& ( Value
>>= bScaleImage
) )
753 pImageControl
->SetScaleMode( bScaleImage
? ImageScaleMode::Anisotropic
: ImageScaleMode::None
);
759 VCLXImageConsumer::setProperty( PropertyName
, Value
);
764 ::com::sun::star::uno::Any
VCLXImageControl::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
766 ::vos::OGuard
aGuard( GetMutex() );
768 ::com::sun::star::uno::Any aProp
;
769 ImageControl
* pImageControl
= (ImageControl
*)GetWindow();
770 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
774 case BASEPROPERTY_IMAGE_SCALE_MODE
:
775 aProp
<<= ( pImageControl
? pImageControl
->GetScaleMode() : ImageScaleMode::Anisotropic
);
778 case BASEPROPERTY_SCALEIMAGE
:
779 aProp
<<= ( pImageControl
&& pImageControl
->GetScaleMode() != ImageScaleMode::None
) ? sal_True
: sal_False
;
783 aProp
= VCLXImageConsumer::getProperty( PropertyName
);
789 // ----------------------------------------------------
790 // class VCLXCheckBox
791 // ----------------------------------------------------
794 void VCLXCheckBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
796 PushPropertyIds( rIds
,
797 BASEPROPERTY_DEFAULTCONTROL
,
798 BASEPROPERTY_ENABLED
,
799 BASEPROPERTY_ENABLEVISIBLE
,
800 BASEPROPERTY_FONTDESCRIPTOR
,
801 BASEPROPERTY_GRAPHIC
,
802 BASEPROPERTY_HELPTEXT
,
803 BASEPROPERTY_HELPURL
,
804 BASEPROPERTY_IMAGEPOSITION
,
805 BASEPROPERTY_IMAGEURL
,
807 BASEPROPERTY_PRINTABLE
,
809 BASEPROPERTY_TABSTOP
,
810 BASEPROPERTY_TRISTATE
,
811 BASEPROPERTY_VISUALEFFECT
,
812 BASEPROPERTY_MULTILINE
,
813 BASEPROPERTY_BACKGROUNDCOLOR
,
815 BASEPROPERTY_VERTICALALIGN
,
816 BASEPROPERTY_WRITING_MODE
,
817 BASEPROPERTY_CONTEXT_WRITING_MODE
,
819 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
822 VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this )
826 // ::com::sun::star::uno::XInterface
827 ::com::sun::star::uno::Any
VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
829 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
830 SAL_STATIC_CAST( ::com::sun::star::awt::XButton
*, this ),
831 SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox
*, this ) );
832 return (aRet
.hasValue() ? aRet
: VCLXImageConsumer::queryInterface( rType
));
835 // ::com::sun::star::lang::XTypeProvider
836 IMPL_XTYPEPROVIDER_START( VCLXCheckBox
)
837 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XButton
>* ) NULL
),
838 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XCheckBox
>* ) NULL
),
839 VCLXImageConsumer::getTypes()
840 IMPL_XTYPEPROVIDER_END
842 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXCheckBox::CreateAccessibleContext()
844 return getAccessibleFactory().createAccessibleContext( this );
847 void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException
)
849 ::vos::OGuard
aGuard( GetMutex() );
851 ::com::sun::star::lang::EventObject aObj
;
852 aObj
.Source
= (::cppu::OWeakObject
*)this;
853 maItemListeners
.disposeAndClear( aObj
);
854 VCLXImageConsumer::dispose();
857 void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
859 ::vos::OGuard
aGuard( GetMutex() );
860 maItemListeners
.addInterface( l
);
863 void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
865 ::vos::OGuard
aGuard( GetMutex() );
866 maItemListeners
.removeInterface( l
);
869 void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
871 ::vos::OGuard
aGuard( GetMutex() );
872 maActionListeners
.addInterface( l
);
875 void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
877 ::vos::OGuard
aGuard( GetMutex() );
878 maActionListeners
.removeInterface( l
);
881 void VCLXCheckBox::setActionCommand( const ::rtl::OUString
& rCommand
) throw(::com::sun::star::uno::RuntimeException
)
883 ::vos::OGuard
aGuard( GetMutex() );
884 maActionCommand
= rCommand
;
887 void VCLXCheckBox::setLabel( const ::rtl::OUString
& rLabel
) throw(::com::sun::star::uno::RuntimeException
)
889 ::vos::OGuard
aGuard( GetMutex() );
891 Window
* pWindow
= GetWindow();
893 pWindow
->SetText( rLabel
);
896 void VCLXCheckBox::setState( short n
) throw(::com::sun::star::uno::RuntimeException
)
898 ::vos::OGuard
aGuard( GetMutex() );
900 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
906 case 0: eState
= STATE_NOCHECK
; break;
907 case 1: eState
= STATE_CHECK
; break;
908 case 2: eState
= STATE_DONTKNOW
; break;
909 default: eState
= STATE_NOCHECK
;
911 pCheckBox
->SetState( eState
);
913 // #105198# call C++ click listeners (needed for accessibility)
914 // pCheckBox->GetClickHdl().Call( pCheckBox );
916 // #107218# Call same virtual methods and listeners like VCL would do after user interaction
917 SetSynthesizingVCLEvent( sal_True
);
920 SetSynthesizingVCLEvent( sal_False
);
924 short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException
)
926 ::vos::OGuard
aGuard( GetMutex() );
929 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
932 switch ( pCheckBox
->GetState() )
934 case STATE_NOCHECK
: nState
= 0; break;
935 case STATE_CHECK
: nState
= 1; break;
936 case STATE_DONTKNOW
: nState
= 2; break;
937 default: DBG_ERROR( "VCLXCheckBox::getState(): unknown TriState!" );
944 void VCLXCheckBox::enableTriState( sal_Bool b
) throw(::com::sun::star::uno::RuntimeException
)
946 ::vos::OGuard
aGuard( GetMutex() );
948 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
950 pCheckBox
->EnableTriState( b
);
953 ::com::sun::star::awt::Size
VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
955 ::vos::OGuard
aGuard( GetMutex() );
958 CheckBox
* pCheckBox
= (CheckBox
*) GetWindow();
960 aSz
= pCheckBox
->CalcMinimumSize();
964 ::com::sun::star::awt::Size
VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
966 return getMinimumSize();
969 ::com::sun::star::awt::Size
VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
971 ::vos::OGuard
aGuard( GetMutex() );
973 Size aSz
= VCLSize(rNewSize
);
974 CheckBox
* pCheckBox
= (CheckBox
*) GetWindow();
977 Size aMinSz
= pCheckBox
->CalcMinimumSize();
978 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
979 aSz
.Height() = aMinSz
.Height();
986 void VCLXCheckBox::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
988 ::vos::OGuard
aGuard( GetMutex() );
990 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
993 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
996 case BASEPROPERTY_VISUALEFFECT
:
997 ::toolkit::setVisualEffect( Value
, pCheckBox
, &StyleSettings::SetCheckBoxStyle
, STYLE_CHECKBOX_MONO
, STYLE_CHECKBOX_WIN
);
1000 case BASEPROPERTY_TRISTATE
:
1002 sal_Bool b
= sal_Bool();
1004 pCheckBox
->EnableTriState( b
);
1007 case BASEPROPERTY_STATE
:
1009 sal_Int16 n
= sal_Int16();
1016 VCLXImageConsumer::setProperty( PropertyName
, Value
);
1022 ::com::sun::star::uno::Any
VCLXCheckBox::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1024 ::vos::OGuard
aGuard( GetMutex() );
1026 ::com::sun::star::uno::Any aProp
;
1027 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
1030 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1031 switch ( nPropType
)
1033 case BASEPROPERTY_VISUALEFFECT
:
1034 aProp
= ::toolkit::getVisualEffect( pCheckBox
, &StyleSettings::GetCheckBoxStyle
, STYLE_CHECKBOX_MONO
);
1036 case BASEPROPERTY_TRISTATE
:
1037 aProp
<<= (sal_Bool
)pCheckBox
->IsTriStateEnabled();
1039 case BASEPROPERTY_STATE
:
1040 aProp
<<= (sal_Int16
)pCheckBox
->GetState();
1044 aProp
<<= VCLXImageConsumer::getProperty( PropertyName
);
1051 void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1053 switch ( rVclWindowEvent
.GetId() )
1055 case VCLEVENT_CHECKBOX_TOGGLE
:
1057 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1058 // since we call listeners below, there is a potential that we will be destroyed
1059 // in during the listener call. To prevent the resulting crashs, we keep us
1060 // alive as long as we're here
1061 // #20178# - 2003-10-01 - fs@openoffice.org
1063 CheckBox
* pCheckBox
= (CheckBox
*)GetWindow();
1066 if ( maItemListeners
.getLength() )
1068 ::com::sun::star::awt::ItemEvent aEvent
;
1069 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1070 aEvent
.Highlighted
= sal_False
;
1071 aEvent
.Selected
= pCheckBox
->GetState();
1072 maItemListeners
.itemStateChanged( aEvent
);
1074 if ( !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1076 ::com::sun::star::awt::ActionEvent aEvent
;
1077 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1078 aEvent
.ActionCommand
= maActionCommand
;
1079 maActionListeners
.actionPerformed( aEvent
);
1086 VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent
);
1091 // ----------------------------------------------------
1092 // class VCLXRadioButton
1093 // ----------------------------------------------------
1094 void VCLXRadioButton::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1096 PushPropertyIds( rIds
,
1097 BASEPROPERTY_DEFAULTCONTROL
,
1098 BASEPROPERTY_ENABLED
,
1099 BASEPROPERTY_ENABLEVISIBLE
,
1100 BASEPROPERTY_FONTDESCRIPTOR
,
1101 BASEPROPERTY_GRAPHIC
,
1102 BASEPROPERTY_HELPTEXT
,
1103 BASEPROPERTY_HELPURL
,
1104 BASEPROPERTY_IMAGEPOSITION
,
1105 BASEPROPERTY_IMAGEURL
,
1107 BASEPROPERTY_PRINTABLE
,
1109 BASEPROPERTY_TABSTOP
,
1110 BASEPROPERTY_VISUALEFFECT
,
1111 BASEPROPERTY_MULTILINE
,
1112 BASEPROPERTY_BACKGROUNDCOLOR
,
1114 BASEPROPERTY_VERTICALALIGN
,
1115 BASEPROPERTY_WRITING_MODE
,
1116 BASEPROPERTY_CONTEXT_WRITING_MODE
,
1117 BASEPROPERTY_GROUPNAME
,
1119 VCLXImageConsumer::ImplGetPropertyIds( rIds
);
1123 VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
1127 // ::com::sun::star::uno::XInterface
1128 ::com::sun::star::uno::Any
VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1130 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1131 SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton
*, this ),
1132 SAL_STATIC_CAST( ::com::sun::star::awt::XButton
*, this ) );
1133 return (aRet
.hasValue() ? aRet
: VCLXImageConsumer::queryInterface( rType
));
1136 // ::com::sun::star::lang::XTypeProvider
1137 IMPL_XTYPEPROVIDER_START( VCLXRadioButton
)
1138 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XRadioButton
>* ) NULL
),
1139 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XButton
>* ) NULL
),
1140 VCLXImageConsumer::getTypes()
1141 IMPL_XTYPEPROVIDER_END
1143 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXRadioButton::CreateAccessibleContext()
1145 return getAccessibleFactory().createAccessibleContext( this );
1148 void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException
)
1150 ::vos::OGuard
aGuard( GetMutex() );
1152 ::com::sun::star::lang::EventObject aObj
;
1153 aObj
.Source
= (::cppu::OWeakObject
*)this;
1154 maItemListeners
.disposeAndClear( aObj
);
1155 VCLXImageConsumer::dispose();
1158 void VCLXRadioButton::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1160 ::vos::OGuard
aGuard( GetMutex() );
1162 RadioButton
* pButton
= (RadioButton
*)GetWindow();
1165 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1166 switch ( nPropType
)
1168 case BASEPROPERTY_VISUALEFFECT
:
1169 ::toolkit::setVisualEffect( Value
, pButton
, &StyleSettings::SetRadioButtonStyle
, STYLE_RADIOBUTTON_MONO
, STYLE_RADIOBUTTON_WIN
);
1172 case BASEPROPERTY_STATE
:
1174 sal_Int16 n
= sal_Int16();
1177 BOOL b
= n
? sal_True
: sal_False
;
1178 if ( pButton
->IsRadioCheckEnabled() )
1179 pButton
->Check( b
);
1181 pButton
->SetState( b
);
1182 // If VBA - need to be able to test
1183 // simulate click event
1184 if ( maActionListeners
.getLength() )
1186 ::com::sun::star::awt::ActionEvent aEvent
;
1187 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1188 aEvent
.ActionCommand
= maActionCommand
;
1189 maActionListeners
.actionPerformed( aEvent
);
1195 case BASEPROPERTY_AUTOTOGGLE
:
1197 sal_Bool b
= sal_Bool();
1199 pButton
->EnableRadioCheck( b
);
1204 VCLXImageConsumer::setProperty( PropertyName
, Value
);
1210 ::com::sun::star::uno::Any
VCLXRadioButton::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1212 ::vos::OGuard
aGuard( GetMutex() );
1214 ::com::sun::star::uno::Any aProp
;
1215 RadioButton
* pButton
= (RadioButton
*)GetWindow();
1218 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1219 switch ( nPropType
)
1221 case BASEPROPERTY_VISUALEFFECT
:
1222 aProp
= ::toolkit::getVisualEffect( pButton
, &StyleSettings::GetRadioButtonStyle
, STYLE_RADIOBUTTON_MONO
);
1224 case BASEPROPERTY_STATE
:
1225 aProp
<<= (sal_Int16
) ( pButton
->IsChecked() ? 1 : 0 );
1227 case BASEPROPERTY_AUTOTOGGLE
:
1228 aProp
<<= (sal_Bool
) pButton
->IsRadioCheckEnabled();
1232 aProp
<<= VCLXImageConsumer::getProperty( PropertyName
);
1239 void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1241 ::vos::OGuard
aGuard( GetMutex() );
1242 maItemListeners
.addInterface( l
);
1245 void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1247 ::vos::OGuard
aGuard( GetMutex() );
1248 maItemListeners
.removeInterface( l
);
1251 void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
1253 ::vos::OGuard
aGuard( GetMutex() );
1254 maActionListeners
.addInterface( l
);
1257 void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1259 ::vos::OGuard
aGuard( GetMutex() );
1260 maActionListeners
.removeInterface( l
);
1263 void VCLXRadioButton::setLabel( const ::rtl::OUString
& rLabel
) throw(::com::sun::star::uno::RuntimeException
)
1265 ::vos::OGuard
aGuard( GetMutex() );
1267 Window
* pWindow
= GetWindow();
1269 pWindow
->SetText( rLabel
);
1272 void VCLXRadioButton::setActionCommand( const ::rtl::OUString
& rCommand
) throw(::com::sun::star::uno::RuntimeException
)
1274 ::vos::OGuard
aGuard( GetMutex() );
1275 maActionCommand
= rCommand
;
1278 void VCLXRadioButton::setState( sal_Bool b
) throw(::com::sun::star::uno::RuntimeException
)
1280 ::vos::OGuard
aGuard( GetMutex() );
1282 RadioButton
* pRadioButton
= (RadioButton
*)GetWindow();
1285 pRadioButton
->Check( b
);
1286 // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
1287 // But this is needed in old code because Accessibility API uses it.
1288 // pRadioButton->GetClickHdl().Call( pRadioButton );
1290 // #107218# Call same virtual methods and listeners like VCL would do after user interaction
1291 SetSynthesizingVCLEvent( sal_True
);
1292 pRadioButton
->Click();
1293 SetSynthesizingVCLEvent( sal_False
);
1297 sal_Bool
VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException
)
1299 ::vos::OGuard
aGuard( GetMutex() );
1301 RadioButton
* pRadioButton
= (RadioButton
*)GetWindow();
1302 return pRadioButton
? pRadioButton
->IsChecked() : sal_False
;
1305 ::com::sun::star::awt::Size
VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
1307 ::vos::OGuard
aGuard( GetMutex() );
1310 RadioButton
* pRadioButton
= (RadioButton
*) GetWindow();
1312 aSz
= pRadioButton
->CalcMinimumSize();
1313 return AWTSize(aSz
);
1316 ::com::sun::star::awt::Size
VCLXRadioButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
1318 return getMinimumSize();
1321 ::com::sun::star::awt::Size
VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
1323 ::vos::OGuard
aGuard( GetMutex() );
1325 Size aSz
= VCLSize(rNewSize
);
1326 RadioButton
* pRadioButton
= (RadioButton
*) GetWindow();
1329 Size aMinSz
= pRadioButton
->CalcMinimumSize();
1330 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
1331 aSz
.Height() = aMinSz
.Height();
1335 return AWTSize(aSz
);
1338 void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1340 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1341 // since we call listeners below, there is a potential that we will be destroyed
1342 // in during the listener call. To prevent the resulting crashs, we keep us
1343 // alive as long as we're here
1344 // #20178# - 2003-10-01 - fs@openoffice.org
1346 switch ( rVclWindowEvent
.GetId() )
1348 case VCLEVENT_BUTTON_CLICK
:
1349 if ( !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1351 ::com::sun::star::awt::ActionEvent aEvent
;
1352 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1353 aEvent
.ActionCommand
= maActionCommand
;
1354 maActionListeners
.actionPerformed( aEvent
);
1356 ImplClickedOrToggled( FALSE
);
1359 case VCLEVENT_RADIOBUTTON_TOGGLE
:
1360 ImplClickedOrToggled( TRUE
);
1364 VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent
);
1369 void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled
)
1371 // In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
1372 // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
1373 RadioButton
* pRadioButton
= (RadioButton
*)GetWindow();
1374 if ( pRadioButton
&& ( pRadioButton
->IsRadioCheckEnabled() == bToggled
) && ( bToggled
|| pRadioButton
->IsStateChanged() ) && maItemListeners
.getLength() )
1376 ::com::sun::star::awt::ItemEvent aEvent
;
1377 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1378 aEvent
.Highlighted
= sal_False
;
1379 aEvent
.Selected
= pRadioButton
->IsChecked();
1380 maItemListeners
.itemStateChanged( aEvent
);
1384 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> VCLXRadioButton::getFirstActionListener ()
1386 if (!maItemListeners
.getLength ())
1387 return ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> ();
1388 return maActionListeners
.getElements()[0];
1391 // ----------------------------------------------------
1392 // class VCLXSpinField
1393 // ----------------------------------------------------
1394 void VCLXSpinField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1396 VCLXEdit::ImplGetPropertyIds( rIds
);
1399 VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
1403 // ::com::sun::star::uno::XInterface
1404 ::com::sun::star::uno::Any
VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1406 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1407 SAL_STATIC_CAST( ::com::sun::star::awt::XSpinField
*, this ) );
1408 return (aRet
.hasValue() ? aRet
: VCLXEdit::queryInterface( rType
));
1411 // ::com::sun::star::lang::XTypeProvider
1412 IMPL_XTYPEPROVIDER_START( VCLXSpinField
)
1413 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSpinField
>* ) NULL
),
1414 VCLXEdit::getTypes()
1415 IMPL_XTYPEPROVIDER_END
1417 void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSpinListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1419 ::vos::OGuard
aGuard( GetMutex() );
1420 maSpinListeners
.addInterface( l
);
1423 void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XSpinListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1425 ::vos::OGuard
aGuard( GetMutex() );
1426 maSpinListeners
.removeInterface( l
);
1429 void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException
)
1431 ::vos::OGuard
aGuard( GetMutex() );
1433 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1438 void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException
)
1440 ::vos::OGuard
aGuard( GetMutex() );
1442 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1447 void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException
)
1449 ::vos::OGuard
aGuard( GetMutex() );
1451 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1453 pSpinField
->First();
1456 void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException
)
1458 ::vos::OGuard
aGuard( GetMutex() );
1460 SpinField
* pSpinField
= (SpinField
*) GetWindow();
1465 void VCLXSpinField::enableRepeat( sal_Bool bRepeat
) throw(::com::sun::star::uno::RuntimeException
)
1467 ::vos::OGuard
aGuard( GetMutex() );
1469 Window
* pWindow
= GetWindow();
1472 WinBits nStyle
= pWindow
->GetStyle();
1474 nStyle
|= WB_REPEAT
;
1476 nStyle
&= ~WB_REPEAT
;
1477 pWindow
->SetStyle( nStyle
);
1481 void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1483 switch ( rVclWindowEvent
.GetId() )
1485 case VCLEVENT_SPINFIELD_UP
:
1486 case VCLEVENT_SPINFIELD_DOWN
:
1487 case VCLEVENT_SPINFIELD_FIRST
:
1488 case VCLEVENT_SPINFIELD_LAST
:
1490 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1491 // since we call listeners below, there is a potential that we will be destroyed
1492 // in during the listener call. To prevent the resulting crashs, we keep us
1493 // alive as long as we're here
1494 // #20178# - 2003-10-01 - fs@openoffice.org
1496 if ( maSpinListeners
.getLength() )
1498 ::com::sun::star::awt::SpinEvent aEvent
;
1499 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1500 switch ( rVclWindowEvent
.GetId() )
1502 case VCLEVENT_SPINFIELD_UP
: maSpinListeners
.up( aEvent
);
1504 case VCLEVENT_SPINFIELD_DOWN
: maSpinListeners
.down( aEvent
);
1506 case VCLEVENT_SPINFIELD_FIRST
: maSpinListeners
.first( aEvent
);
1508 case VCLEVENT_SPINFIELD_LAST
: maSpinListeners
.last( aEvent
);
1517 VCLXEdit::ProcessWindowEvent( rVclWindowEvent
);
1523 // ----------------------------------------------------
1524 // class VCLXListBox
1525 // ----------------------------------------------------
1526 void VCLXListBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
1528 PushPropertyIds( rIds
,
1529 BASEPROPERTY_BACKGROUNDCOLOR
,
1530 BASEPROPERTY_BORDER
,
1531 BASEPROPERTY_BORDERCOLOR
,
1532 BASEPROPERTY_DEFAULTCONTROL
,
1533 BASEPROPERTY_DROPDOWN
,
1534 BASEPROPERTY_ENABLED
,
1535 BASEPROPERTY_ENABLEVISIBLE
,
1536 BASEPROPERTY_FONTDESCRIPTOR
,
1537 BASEPROPERTY_HELPTEXT
,
1538 BASEPROPERTY_HELPURL
,
1539 BASEPROPERTY_LINECOUNT
,
1540 BASEPROPERTY_MULTISELECTION
,
1541 BASEPROPERTY_PRINTABLE
,
1542 BASEPROPERTY_SELECTEDITEMS
,
1543 BASEPROPERTY_STRINGITEMLIST
,
1544 BASEPROPERTY_TABSTOP
,
1545 BASEPROPERTY_READONLY
,
1547 BASEPROPERTY_WRITING_MODE
,
1548 BASEPROPERTY_CONTEXT_WRITING_MODE
,
1550 VCLXWindow::ImplGetPropertyIds( rIds
);
1554 VCLXListBox::VCLXListBox()
1555 : maActionListeners( *this ),
1556 maItemListeners( *this )
1560 // ::com::sun::star::uno::XInterface
1561 ::com::sun::star::uno::Any
VCLXListBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
1563 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
1564 SAL_STATIC_CAST( ::com::sun::star::awt::XListBox
*, this ),
1565 SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains
*, this ) );
1566 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
1569 // ::com::sun::star::lang::XTypeProvider
1570 IMPL_XTYPEPROVIDER_START( VCLXListBox
)
1571 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XListBox
>* ) NULL
),
1572 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextLayoutConstrains
>* ) NULL
),
1573 VCLXWindow::getTypes()
1574 IMPL_XTYPEPROVIDER_END
1576 void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException
)
1578 ::vos::OGuard
aGuard( GetMutex() );
1580 ::com::sun::star::lang::EventObject aObj
;
1581 aObj
.Source
= (::cppu::OWeakObject
*)this;
1582 maItemListeners
.disposeAndClear( aObj
);
1583 maActionListeners
.disposeAndClear( aObj
);
1584 VCLXWindow::dispose();
1587 void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1589 ::vos::OGuard
aGuard( GetMutex() );
1590 maItemListeners
.addInterface( l
);
1593 void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1595 ::vos::OGuard
aGuard( GetMutex() );
1596 maItemListeners
.removeInterface( l
);
1599 void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1601 ::vos::OGuard
aGuard( GetMutex() );
1602 maActionListeners
.addInterface( l
);
1605 void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
1607 ::vos::OGuard
aGuard( GetMutex() );
1608 maActionListeners
.removeInterface( l
);
1611 void VCLXListBox::addItem( const ::rtl::OUString
& aItem
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
1613 ::vos::OGuard
aGuard( GetMutex() );
1615 ListBox
* pBox
= (ListBox
*) GetWindow();
1617 pBox
->InsertEntry( aItem
, nPos
);
1620 void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aItems
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
1622 ::vos::OGuard
aGuard( GetMutex() );
1624 ListBox
* pBox
= (ListBox
*) GetWindow();
1627 sal_uInt16 nP
= nPos
;
1628 const ::rtl::OUString
* pItems
= aItems
.getConstArray();
1629 const ::rtl::OUString
* pItemsEnd
= aItems
.getConstArray() + aItems
.getLength();
1630 while ( pItems
!= pItemsEnd
)
1632 if ( (sal_uInt16
)nP
== 0xFFFF )
1634 OSL_ENSURE( false, "VCLXListBox::addItems: too many entries!" );
1635 // skip remaining entries, list cannot hold them, anyway
1639 pBox
->InsertEntry( *pItems
++, nP
++ );
1644 void VCLXListBox::removeItems( sal_Int16 nPos
, sal_Int16 nCount
) throw(::com::sun::star::uno::RuntimeException
)
1646 ::vos::OGuard
aGuard( GetMutex() );
1648 ListBox
* pBox
= (ListBox
*) GetWindow();
1651 for ( sal_uInt16 n
= nCount
; n
; )
1652 pBox
->RemoveEntry( nPos
+ (--n
) );
1656 sal_Int16
VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException
)
1658 ::vos::OGuard
aGuard( GetMutex() );
1660 ListBox
* pBox
= (ListBox
*) GetWindow();
1661 return pBox
? pBox
->GetEntryCount() : 0;
1664 ::rtl::OUString
VCLXListBox::getItem( sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
1666 ::vos::OGuard
aGuard( GetMutex() );
1669 ListBox
* pBox
= (ListBox
*) GetWindow();
1671 aItem
= pBox
->GetEntry( nPos
);
1675 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException
)
1677 ::vos::OGuard
aGuard( GetMutex() );
1679 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq
;
1680 ListBox
* pBox
= (ListBox
*) GetWindow();
1683 sal_uInt16 nEntries
= pBox
->GetEntryCount();
1684 aSeq
= ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( nEntries
);
1685 for ( sal_uInt16 n
= nEntries
; n
; )
1688 aSeq
.getArray()[n
] = ::rtl::OUString( pBox
->GetEntry( n
) );
1694 sal_Int16
VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException
)
1696 ::vos::OGuard
aGuard( GetMutex() );
1698 ListBox
* pBox
= (ListBox
*) GetWindow();
1699 return pBox
? pBox
->GetSelectEntryPos() : 0;
1702 ::com::sun::star::uno::Sequence
<sal_Int16
> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException
)
1704 ::vos::OGuard
aGuard( GetMutex() );
1706 ::com::sun::star::uno::Sequence
<sal_Int16
> aSeq
;
1707 ListBox
* pBox
= (ListBox
*) GetWindow();
1710 sal_uInt16 nSelEntries
= pBox
->GetSelectEntryCount();
1711 aSeq
= ::com::sun::star::uno::Sequence
<sal_Int16
>( nSelEntries
);
1712 for ( sal_uInt16 n
= 0; n
< nSelEntries
; n
++ )
1713 aSeq
.getArray()[n
] = pBox
->GetSelectEntryPos( n
);
1718 ::rtl::OUString
VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException
)
1720 ::vos::OGuard
aGuard( GetMutex() );
1723 ListBox
* pBox
= (ListBox
*) GetWindow();
1725 aItem
= pBox
->GetSelectEntry();
1729 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException
)
1731 ::vos::OGuard
aGuard( GetMutex() );
1733 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq
;
1734 ListBox
* pBox
= (ListBox
*) GetWindow();
1737 sal_uInt16 nSelEntries
= pBox
->GetSelectEntryCount();
1738 aSeq
= ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( nSelEntries
);
1739 for ( sal_uInt16 n
= 0; n
< nSelEntries
; n
++ )
1740 aSeq
.getArray()[n
] = ::rtl::OUString( pBox
->GetSelectEntry( n
) );
1745 void VCLXListBox::selectItemPos( sal_Int16 nPos
, sal_Bool bSelect
) throw(::com::sun::star::uno::RuntimeException
)
1747 ::vos::OGuard
aGuard( GetMutex() );
1749 ListBox
* pBox
= (ListBox
*) GetWindow();
1750 if ( pBox
&& ( pBox
->IsEntryPosSelected( nPos
) != bSelect
) )
1752 pBox
->SelectEntryPos( nPos
, bSelect
);
1754 // VCL doesn't call select handler after API call.
1755 // ImplCallItemListeners();
1757 // #107218# Call same listeners like VCL would do after user interaction
1758 SetSynthesizingVCLEvent( sal_True
);
1760 SetSynthesizingVCLEvent( sal_False
);
1764 void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence
<sal_Int16
>& aPositions
, sal_Bool bSelect
) throw(::com::sun::star::uno::RuntimeException
)
1766 ::vos::OGuard
aGuard( GetMutex() );
1768 ListBox
* pBox
= (ListBox
*) GetWindow();
1771 BOOL bChanged
= FALSE
;
1772 for ( sal_uInt16 n
= (sal_uInt16
)aPositions
.getLength(); n
; )
1774 USHORT nPos
= (USHORT
) aPositions
.getConstArray()[--n
];
1775 if ( pBox
->IsEntryPosSelected( nPos
) != bSelect
)
1777 pBox
->SelectEntryPos( nPos
, bSelect
);
1784 // VCL doesn't call select handler after API call.
1785 // ImplCallItemListeners();
1787 // #107218# Call same listeners like VCL would do after user interaction
1788 SetSynthesizingVCLEvent( sal_True
);
1790 SetSynthesizingVCLEvent( sal_False
);
1795 void VCLXListBox::selectItem( const ::rtl::OUString
& rItemText
, sal_Bool bSelect
) throw(::com::sun::star::uno::RuntimeException
)
1797 ::vos::OGuard
aGuard( GetMutex() );
1799 ListBox
* pBox
= (ListBox
*) GetWindow();
1802 String
aItemText( rItemText
);
1803 selectItemPos( pBox
->GetEntryPos( aItemText
), bSelect
);
1808 void VCLXListBox::setDropDownLineCount( sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
1810 ::vos::OGuard
aGuard( GetMutex() );
1812 ListBox
* pBox
= (ListBox
*) GetWindow();
1814 pBox
->SetDropDownLineCount( nLines
);
1817 sal_Int16
VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException
)
1819 ::vos::OGuard
aGuard( GetMutex() );
1821 sal_Int16 nLines
= 0;
1822 ListBox
* pBox
= (ListBox
*) GetWindow();
1824 nLines
= pBox
->GetDropDownLineCount();
1828 sal_Bool
VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException
)
1830 ::vos::OGuard
aGuard( GetMutex() );
1832 sal_Bool bMulti
= sal_False
;
1833 ListBox
* pBox
= (ListBox
*) GetWindow();
1835 bMulti
= pBox
->IsMultiSelectionEnabled();
1839 void VCLXListBox::setMultipleMode( sal_Bool bMulti
) throw(::com::sun::star::uno::RuntimeException
)
1841 ::vos::OGuard
aGuard( GetMutex() );
1843 ListBox
* pBox
= (ListBox
*) GetWindow();
1845 pBox
->EnableMultiSelection( bMulti
);
1848 void VCLXListBox::makeVisible( sal_Int16 nEntry
) throw(::com::sun::star::uno::RuntimeException
)
1850 ::vos::OGuard
aGuard( GetMutex() );
1852 ListBox
* pBox
= (ListBox
*) GetWindow();
1854 pBox
->SetTopEntry( nEntry
);
1857 void VCLXListBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1859 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
1860 // since we call listeners below, there is a potential that we will be destroyed
1861 // in during the listener call. To prevent the resulting crashs, we keep us
1862 // alive as long as we're here
1863 // #20178# - 2003-10-01 - fs@openoffice.org
1865 switch ( rVclWindowEvent
.GetId() )
1867 case VCLEVENT_LISTBOX_SELECT
:
1869 ListBox
* pListBox
= (ListBox
*)GetWindow();
1873 sal_Bool bDropDown
= ( pListBox
->GetStyle() & WB_DROPDOWN
) ? sal_True
: sal_False
;
1874 if ( bDropDown
&& !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1876 // Bei DropDown den ActionListener rufen...
1877 ::com::sun::star::awt::ActionEvent aEvent
;
1878 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1879 aEvent
.ActionCommand
= pListBox
->GetSelectEntry();
1880 maActionListeners
.actionPerformed( aEvent
);
1883 if ( maItemListeners
.getLength() )
1885 ImplCallItemListeners();
1891 case VCLEVENT_LISTBOX_DOUBLECLICK
:
1892 if ( GetWindow() && maActionListeners
.getLength() )
1894 ::com::sun::star::awt::ActionEvent aEvent
;
1895 aEvent
.Source
= (::cppu::OWeakObject
*)this;
1896 aEvent
.ActionCommand
= ((ListBox
*)GetWindow())->GetSelectEntry();
1897 maActionListeners
.actionPerformed( aEvent
);
1902 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
1907 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXListBox::CreateAccessibleContext()
1909 ::vos::OGuard
aGuard( GetMutex() );
1911 return getAccessibleFactory().createAccessibleContext( this );
1914 void VCLXListBox::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
1916 ::vos::OGuard
aGuard( GetMutex() );
1918 ListBox
* pListBox
= (ListBox
*)GetWindow();
1921 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1922 switch ( nPropType
)
1924 case BASEPROPERTY_READONLY
:
1926 sal_Bool b
= sal_Bool();
1928 pListBox
->SetReadOnly( b
);
1931 case BASEPROPERTY_MULTISELECTION
:
1933 sal_Bool b
= sal_Bool();
1935 pListBox
->EnableMultiSelection( b
);
1938 case BASEPROPERTY_LINECOUNT
:
1940 sal_Int16 n
= sal_Int16();
1942 pListBox
->SetDropDownLineCount( n
);
1945 case BASEPROPERTY_STRINGITEMLIST
:
1947 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aItems
;
1948 if ( Value
>>= aItems
)
1950 sal_Int16 nElem
= pListBox
->GetEntryCount();
1952 addItems( aItems
, 0 );
1953 if ( aItems
.getLength() == 0 && nElem
&& maItemListeners
.getLength() )
1954 ImplCallItemListeners();
1958 case BASEPROPERTY_SELECTEDITEMS
:
1960 ::com::sun::star::uno::Sequence
<sal_Int16
> aItems
;
1961 if ( Value
>>= aItems
)
1963 for ( sal_uInt16 n
= pListBox
->GetEntryCount(); n
; )
1964 pListBox
->SelectEntryPos( --n
, sal_False
);
1966 if ( aItems
.getLength() )
1968 selectItemsPos( aItems
, sal_True
);
1969 if ( maItemListeners
.getLength() )
1970 ImplCallItemListeners();
1973 pListBox
->SetNoSelection();
1975 if ( !pListBox
->GetSelectEntryCount() )
1976 pListBox
->SetTopEntry( 0 );
1982 VCLXWindow::setProperty( PropertyName
, Value
);
1988 ::com::sun::star::uno::Any
VCLXListBox::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
1990 ::vos::OGuard
aGuard( GetMutex() );
1992 ::com::sun::star::uno::Any aProp
;
1993 ListBox
* pListBox
= (ListBox
*)GetWindow();
1996 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1997 switch ( nPropType
)
1999 case BASEPROPERTY_READONLY
:
2001 aProp
<<= (sal_Bool
) pListBox
->IsReadOnly();
2004 case BASEPROPERTY_MULTISELECTION
:
2006 aProp
<<= (sal_Bool
) pListBox
->IsMultiSelectionEnabled();
2009 case BASEPROPERTY_LINECOUNT
:
2011 aProp
<<= (sal_Int16
) pListBox
->GetDropDownLineCount();
2014 case BASEPROPERTY_STRINGITEMLIST
:
2016 sal_uInt16 nItems
= pListBox
->GetEntryCount();
2017 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq( nItems
);
2018 ::rtl::OUString
* pStrings
= aSeq
.getArray();
2019 for ( sal_uInt16 n
= 0; n
< nItems
; n
++ )
2020 pStrings
[n
] = pListBox
->GetEntry( n
);
2027 aProp
<<= VCLXWindow::getProperty( PropertyName
);
2034 ::com::sun::star::awt::Size
VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2036 ::vos::OGuard
aGuard( GetMutex() );
2039 ListBox
* pListBox
= (ListBox
*) GetWindow();
2041 aSz
= pListBox
->CalcMinimumSize();
2042 return AWTSize(aSz
);
2045 ::com::sun::star::awt::Size
VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2047 ::vos::OGuard
aGuard( GetMutex() );
2050 ListBox
* pListBox
= (ListBox
*) GetWindow();
2053 aSz
= pListBox
->CalcMinimumSize();
2054 if ( pListBox
->GetStyle() & WB_DROPDOWN
)
2057 return AWTSize(aSz
);
2060 ::com::sun::star::awt::Size
VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2062 ::vos::OGuard
aGuard( GetMutex() );
2064 Size aSz
= VCLSize(rNewSize
);
2065 ListBox
* pListBox
= (ListBox
*) GetWindow();
2067 aSz
= pListBox
->CalcAdjustedSize( aSz
);
2068 return AWTSize(aSz
);
2071 ::com::sun::star::awt::Size
VCLXListBox::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
2073 ::vos::OGuard
aGuard( GetMutex() );
2076 ListBox
* pListBox
= (ListBox
*) GetWindow();
2078 aSz
= pListBox
->CalcSize( nCols
, nLines
);
2079 return AWTSize(aSz
);
2082 void VCLXListBox::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
2084 ::vos::OGuard
aGuard( GetMutex() );
2087 ListBox
* pListBox
= (ListBox
*) GetWindow();
2091 pListBox
->GetMaxVisColumnsAndLines( nC
, nL
);
2097 void VCLXListBox::ImplCallItemListeners()
2099 ListBox
* pListBox
= (ListBox
*) GetWindow();
2100 if ( pListBox
&& maItemListeners
.getLength() )
2102 ::com::sun::star::awt::ItemEvent aEvent
;
2103 aEvent
.Source
= (::cppu::OWeakObject
*)this;
2104 aEvent
.Highlighted
= sal_False
;
2106 // Bei Mehrfachselektion 0xFFFF, sonst die ID
2107 aEvent
.Selected
= (pListBox
->GetSelectEntryCount() == 1 ) ? pListBox
->GetSelectEntryPos() : 0xFFFF;
2109 maItemListeners
.itemStateChanged( aEvent
);
2114 // ----------------------------------------------------
2115 // class VCLXMessageBox
2116 // ----------------------------------------------------
2118 void VCLXMessageBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2120 VCLXTopWindow::ImplGetPropertyIds( rIds
);
2123 VCLXMessageBox::VCLXMessageBox()
2127 VCLXMessageBox::~VCLXMessageBox()
2131 // ::com::sun::star::uno::XInterface
2132 ::com::sun::star::uno::Any
VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2134 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2135 SAL_STATIC_CAST( ::com::sun::star::awt::XMessageBox
*, this ) );
2136 return (aRet
.hasValue() ? aRet
: VCLXTopWindow::queryInterface( rType
));
2139 // ::com::sun::star::lang::XTypeProvider
2140 IMPL_XTYPEPROVIDER_START( VCLXMessageBox
)
2141 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMessageBox
>* ) NULL
),
2142 VCLXTopWindow::getTypes()
2143 IMPL_XTYPEPROVIDER_END
2145 void VCLXMessageBox::setCaptionText( const ::rtl::OUString
& rText
) throw(::com::sun::star::uno::RuntimeException
)
2147 ::vos::OGuard
aGuard( GetMutex() );
2149 Window
* pWindow
= GetWindow();
2151 pWindow
->SetText( rText
);
2154 ::rtl::OUString
VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException
)
2156 ::vos::OGuard
aGuard( GetMutex() );
2159 Window
* pWindow
= GetWindow();
2161 aText
= pWindow
->GetText();
2165 void VCLXMessageBox::setMessageText( const ::rtl::OUString
& rText
) throw(::com::sun::star::uno::RuntimeException
)
2167 ::vos::OGuard
aGuard( GetMutex() );
2169 MessBox
* pBox
= (MessBox
*)GetWindow();
2171 pBox
->SetMessText( rText
);
2174 ::rtl::OUString
VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException
)
2176 ::vos::OGuard
aGuard( GetMutex() );
2178 ::rtl::OUString aText
;
2179 MessBox
* pBox
= (MessBox
*)GetWindow();
2181 aText
= pBox
->GetMessText();
2185 sal_Int16
VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException
)
2187 ::vos::OGuard
aGuard( GetMutex() );
2189 MessBox
* pBox
= (MessBox
*)GetWindow();
2190 return pBox
? pBox
->Execute() : 0;
2193 ::com::sun::star::awt::Size SAL_CALL
VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
)
2195 ::vos::OGuard
aGuard( GetMutex() );
2196 return ::com::sun::star::awt::Size( 250, 100 );
2199 // ----------------------------------------------------
2201 // ----------------------------------------------------
2202 void VCLXDialog::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2204 VCLXTopWindow::ImplGetPropertyIds( rIds
);
2207 VCLXDialog::VCLXDialog()
2211 VCLXDialog::~VCLXDialog()
2213 OSL_TRACE ("%s", __FUNCTION__
);
2216 // ::com::sun::star::uno::XInterface
2217 ::com::sun::star::uno::Any
VCLXDialog::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2219 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2220 SAL_STATIC_CAST( ::com::sun::star::awt::XDialog
*, this ) );
2221 return (aRet
.hasValue() ? aRet
: VCLXTopWindow::queryInterface( rType
));
2224 // ::com::sun::star::lang::XTypeProvider
2225 IMPL_XTYPEPROVIDER_START( VCLXDialog
)
2226 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDialog
>* ) NULL
),
2227 VCLXTopWindow::getTypes()
2228 IMPL_XTYPEPROVIDER_END
2230 void VCLXDialog::setTitle( const ::rtl::OUString
& Title
) throw(::com::sun::star::uno::RuntimeException
)
2232 ::vos::OGuard
aGuard( GetMutex() );
2234 Window
* pWindow
= GetWindow();
2236 pWindow
->SetText( Title
);
2239 ::rtl::OUString
VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException
)
2241 ::vos::OGuard
aGuard( GetMutex() );
2243 ::rtl::OUString aTitle
;
2244 Window
* pWindow
= GetWindow();
2246 aTitle
= pWindow
->GetText();
2250 sal_Int16
VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException
)
2252 ::vos::OGuard
aGuard( GetMutex() );
2257 Dialog
* pDlg
= (Dialog
*) GetWindow();
2258 Window
* pParent
= pDlg
->GetWindow( WINDOW_PARENTOVERLAP
);
2259 Window
* pOldParent
= NULL
;
2260 if ( pParent
&& !pParent
->IsReallyVisible() )
2262 pOldParent
= pDlg
->GetParent();
2263 Window
* pFrame
= pDlg
->GetWindow( WINDOW_FRAME
);
2264 if( pFrame
!= pDlg
)
2265 pDlg
->SetParent( pFrame
);
2267 nRet
= pDlg
->Execute();
2269 pDlg
->SetParent( pOldParent
);
2274 void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException
)
2276 ::vos::OGuard
aGuard( GetMutex() );
2278 Dialog
* pDlg
= (Dialog
*) GetWindow();
2280 pDlg
->EndDialog( 0 );
2283 void SAL_CALL
VCLXDialog::draw( sal_Int32 nX
, sal_Int32 nY
) throw(::com::sun::star::uno::RuntimeException
)
2285 ::vos::OGuard
aGuard( GetMutex() );
2286 Window
* pWindow
= GetWindow();
2290 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2292 pDev
= pWindow
->GetParent();
2294 Size aSize
= pDev
->PixelToLogic( pWindow
->GetSizePixel() );
2295 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2297 pWindow
->Draw( pDev
, aPos
, aSize
, WINDOW_DRAW_NOCONTROLS
);
2301 ::com::sun::star::awt::DeviceInfo
VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException
)
2303 ::com::sun::star::awt::DeviceInfo aInfo
= VCLXDevice::getInfo();
2305 ::vos::OGuard
aGuard( GetMutex() );
2306 Dialog
* pDlg
= (Dialog
*) GetWindow();
2308 pDlg
->GetDrawWindowBorder( aInfo
.LeftInset
, aInfo
.TopInset
, aInfo
.RightInset
, aInfo
.BottomInset
);
2314 void SAL_CALL
VCLXDialog::setProperty(
2315 const ::rtl::OUString
& PropertyName
,
2316 const ::com::sun::star::uno::Any
& Value
)
2317 throw(::com::sun::star::uno::RuntimeException
)
2319 ::vos::OGuard
aGuard( GetMutex() );
2321 Dialog
* pDialog
= (Dialog
*)GetWindow();
2324 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
2326 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2327 switch ( nPropType
)
2329 case BASEPROPERTY_GRAPHIC
:
2331 Reference
< XGraphic
> xGraphic
;
2332 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2334 Image
aImage( xGraphic
);
2336 Wallpaper
aWallpaper( aImage
.GetBitmapEx());
2337 aWallpaper
.SetStyle( WALLPAPER_SCALE
);
2338 pDialog
->SetBackground( aWallpaper
);
2340 else if ( bVoid
|| !xGraphic
.is() )
2342 Color aColor
= pDialog
->GetControlBackground().GetColor();
2343 if ( aColor
== COL_AUTO
)
2344 aColor
= pDialog
->GetSettings().GetStyleSettings().GetDialogColor();
2346 Wallpaper
aWallpaper( aColor
);
2347 pDialog
->SetBackground( aWallpaper
);
2354 VCLXWindow::setProperty( PropertyName
, Value
);
2360 // ----------------------------------------------------
2361 // class VCLXTabPage
2362 // ----------------------------------------------------
2363 VCLXTabPage::VCLXTabPage()
2367 VCLXTabPage::~VCLXTabPage()
2371 ::com::sun::star::uno::Any SAL_CALL
VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type
& rType
)
2372 throw(::com::sun::star::uno::RuntimeException
)
2374 return VCLXContainer::queryInterface( rType
);
2377 // ::com::sun::star::lang::XTypeProvider
2378 IMPL_XTYPEPROVIDER_START( VCLXTabPage
)
2379 VCLXContainer::getTypes()
2380 IMPL_XTYPEPROVIDER_END
2382 // ::com::sun::star::awt::XView
2383 void SAL_CALL
VCLXTabPage::draw( sal_Int32 nX
, sal_Int32 nY
)
2384 throw(::com::sun::star::uno::RuntimeException
)
2386 ::vos::OGuard
aGuard( GetMutex() );
2387 Window
* pWindow
= GetWindow();
2391 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2393 pDev
= pWindow
->GetParent();
2395 Size aSize
= pDev
->PixelToLogic( pWindow
->GetSizePixel() );
2396 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2398 pWindow
->Draw( pDev
, aPos
, aSize
, WINDOW_DRAW_NOCONTROLS
);
2402 // ::com::sun::star::awt::XDevice,
2403 ::com::sun::star::awt::DeviceInfo SAL_CALL
VCLXTabPage::getInfo()
2404 throw(::com::sun::star::uno::RuntimeException
)
2406 ::com::sun::star::awt::DeviceInfo aInfo
= VCLXDevice::getInfo();
2410 void SAL_CALL
VCLXTabPage::setProperty(
2411 const ::rtl::OUString
& PropertyName
,
2412 const ::com::sun::star::uno::Any
& Value
)
2413 throw(::com::sun::star::uno::RuntimeException
)
2415 ::vos::OGuard
aGuard( GetMutex() );
2417 TabPage
* pTabPage
= (TabPage
*)GetWindow();
2420 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
2422 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2423 switch ( nPropType
)
2425 case BASEPROPERTY_GRAPHIC
:
2427 Reference
< XGraphic
> xGraphic
;
2428 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2430 Image
aImage( xGraphic
);
2432 Wallpaper
aWallpaper( aImage
.GetBitmapEx());
2433 aWallpaper
.SetStyle( WALLPAPER_SCALE
);
2434 pTabPage
->SetBackground( aWallpaper
);
2436 else if ( bVoid
|| !xGraphic
.is() )
2438 Color aColor
= pTabPage
->GetControlBackground().GetColor();
2439 if ( aColor
== COL_AUTO
)
2440 aColor
= pTabPage
->GetSettings().GetStyleSettings().GetDialogColor();
2442 Wallpaper
aWallpaper( aColor
);
2443 pTabPage
->SetBackground( aWallpaper
);
2450 VCLXContainer::setProperty( PropertyName
, Value
);
2456 // ----------------------------------------------------
2457 // class VCLXFixedHyperlink
2458 // ----------------------------------------------------
2459 VCLXFixedHyperlink::VCLXFixedHyperlink() :
2461 maActionListeners( *this )
2466 VCLXFixedHyperlink::~VCLXFixedHyperlink()
2470 // ::com::sun::star::uno::XInterface
2471 ::com::sun::star::uno::Any
VCLXFixedHyperlink::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2473 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2474 SAL_STATIC_CAST( ::com::sun::star::awt::XFixedHyperlink
*, this ) );
2475 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2478 void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException
)
2480 ::vos::OGuard
aGuard( GetMutex() );
2482 ::com::sun::star::lang::EventObject aObj
;
2483 aObj
.Source
= (::cppu::OWeakObject
*)this;
2484 maActionListeners
.disposeAndClear( aObj
);
2485 VCLXWindow::dispose();
2488 // ::com::sun::star::lang::XTypeProvider
2489 IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink
)
2490 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedHyperlink
>* ) NULL
),
2491 VCLXWindow::getTypes()
2492 IMPL_XTYPEPROVIDER_END
2494 void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
2496 switch ( rVclWindowEvent
.GetId() )
2498 case VCLEVENT_BUTTON_CLICK
:
2500 if ( maActionListeners
.getLength() )
2502 ::com::sun::star::awt::ActionEvent aEvent
;
2503 aEvent
.Source
= (::cppu::OWeakObject
*)this;
2504 maActionListeners
.actionPerformed( aEvent
);
2509 ::rtl::OUString sURL
;
2510 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2512 sURL
= pBase
->GetURL();
2513 Reference
< ::com::sun::star::system::XSystemShellExecute
> xSystemShellExecute(
2514 ::comphelper::getProcessServiceFactory()->createInstance(
2515 ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), uno::UNO_QUERY
);
2516 if ( sURL
.getLength() > 0 && xSystemShellExecute
.is() )
2521 xSystemShellExecute
->execute(
2522 sURL
, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS
);
2524 catch( uno::Exception
& )
2532 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
2537 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXFixedHyperlink::CreateAccessibleContext()
2539 return getAccessibleFactory().createAccessibleContext( this );
2542 void VCLXFixedHyperlink::setText( const ::rtl::OUString
& Text
) throw(::com::sun::star::uno::RuntimeException
)
2544 ::vos::OGuard
aGuard( GetMutex() );
2546 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2548 pBase
->SetDescription( Text
);
2551 ::rtl::OUString
VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException
)
2553 ::vos::OGuard
aGuard( GetMutex() );
2555 ::rtl::OUString aText
;
2556 Window
* pWindow
= GetWindow();
2558 aText
= pWindow
->GetText();
2562 void VCLXFixedHyperlink::setURL( const ::rtl::OUString
& URL
) throw(::com::sun::star::uno::RuntimeException
)
2564 ::vos::OGuard
aGuard( GetMutex() );
2566 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2568 pBase
->SetURL( URL
);
2571 ::rtl::OUString
VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeException
)
2573 ::vos::OGuard
aGuard( GetMutex() );
2575 ::rtl::OUString aText
;
2576 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2578 aText
= pBase
->GetURL();
2582 void VCLXFixedHyperlink::setAlignment( short nAlign
) throw(::com::sun::star::uno::RuntimeException
)
2584 ::vos::OGuard
aGuard( GetMutex() );
2586 Window
* pWindow
= GetWindow();
2589 WinBits nNewBits
= 0;
2590 if ( nAlign
== ::com::sun::star::awt::TextAlign::LEFT
)
2592 else if ( nAlign
== ::com::sun::star::awt::TextAlign::CENTER
)
2593 nNewBits
= WB_CENTER
;
2595 nNewBits
= WB_RIGHT
;
2597 WinBits nStyle
= pWindow
->GetStyle();
2598 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2599 pWindow
->SetStyle( nStyle
| nNewBits
);
2603 short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException
)
2605 ::vos::OGuard
aGuard( GetMutex() );
2608 Window
* pWindow
= GetWindow();
2611 WinBits nStyle
= pWindow
->GetStyle();
2612 if ( nStyle
& WB_LEFT
)
2613 nAlign
= ::com::sun::star::awt::TextAlign::LEFT
;
2614 else if ( nStyle
& WB_CENTER
)
2615 nAlign
= ::com::sun::star::awt::TextAlign::CENTER
;
2617 nAlign
= ::com::sun::star::awt::TextAlign::RIGHT
;
2622 void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
)throw(::com::sun::star::uno::RuntimeException
)
2624 ::vos::OGuard
aGuard( GetMutex() );
2625 maActionListeners
.addInterface( l
);
2628 void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
2630 ::vos::OGuard
aGuard( GetMutex() );
2631 maActionListeners
.removeInterface( l
);
2634 ::com::sun::star::awt::Size
VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2636 ::vos::OGuard
aGuard( GetMutex() );
2639 FixedText
* pFixedText
= (FixedText
*)GetWindow();
2641 aSz
= pFixedText
->CalcMinimumSize();
2642 return AWTSize(aSz
);
2645 ::com::sun::star::awt::Size
VCLXFixedHyperlink::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2647 return getMinimumSize();
2650 ::com::sun::star::awt::Size
VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2652 ::vos::OGuard
aGuard( GetMutex() );
2654 ::com::sun::star::awt::Size aSz
= rNewSize
;
2655 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
2656 if ( aSz
.Height
!= aMinSz
.Height
)
2657 aSz
.Height
= aMinSz
.Height
;
2662 void VCLXFixedHyperlink::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
2664 ::vos::OGuard
aGuard( GetMutex() );
2666 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2669 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2670 switch ( nPropType
)
2672 case BASEPROPERTY_LABEL
:
2674 ::rtl::OUString sNewLabel
;
2675 if ( Value
>>= sNewLabel
)
2676 pBase
->SetDescription( sNewLabel
);
2680 case BASEPROPERTY_URL
:
2682 ::rtl::OUString sNewURL
;
2683 if ( Value
>>= sNewURL
)
2684 pBase
->SetURL( sNewURL
);
2690 VCLXWindow::setProperty( PropertyName
, Value
);
2696 ::com::sun::star::uno::Any
VCLXFixedHyperlink::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
2698 ::vos::OGuard
aGuard( GetMutex() );
2700 ::com::sun::star::uno::Any aProp
;
2701 ::toolkit::FixedHyperlinkBase
* pBase
= (::toolkit::FixedHyperlinkBase
*)GetWindow();
2704 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2705 switch ( nPropType
)
2707 case BASEPROPERTY_URL
:
2709 aProp
= makeAny( ::rtl::OUString( pBase
->GetURL() ) );
2715 aProp
<<= VCLXWindow::getProperty( PropertyName
);
2722 void VCLXFixedHyperlink::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2724 PushPropertyIds( rIds
,
2726 BASEPROPERTY_BACKGROUNDCOLOR
,
2727 BASEPROPERTY_BORDER
,
2728 BASEPROPERTY_BORDERCOLOR
,
2729 BASEPROPERTY_DEFAULTCONTROL
,
2730 BASEPROPERTY_ENABLED
,
2731 BASEPROPERTY_ENABLEVISIBLE
,
2732 BASEPROPERTY_FONTDESCRIPTOR
,
2733 BASEPROPERTY_HELPTEXT
,
2734 BASEPROPERTY_HELPURL
,
2736 BASEPROPERTY_MULTILINE
,
2737 BASEPROPERTY_NOLABEL
,
2738 BASEPROPERTY_PRINTABLE
,
2739 BASEPROPERTY_TABSTOP
,
2740 BASEPROPERTY_VERTICALALIGN
,
2742 BASEPROPERTY_WRITING_MODE
,
2743 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2745 VCLXWindow::ImplGetPropertyIds( rIds
);
2748 // ----------------------------------------------------
2749 // class VCLXFixedText
2750 // ----------------------------------------------------
2751 void VCLXFixedText::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2753 PushPropertyIds( rIds
,
2755 BASEPROPERTY_BACKGROUNDCOLOR
,
2756 BASEPROPERTY_BORDER
,
2757 BASEPROPERTY_BORDERCOLOR
,
2758 BASEPROPERTY_DEFAULTCONTROL
,
2759 BASEPROPERTY_ENABLED
,
2760 BASEPROPERTY_ENABLEVISIBLE
,
2761 BASEPROPERTY_FONTDESCRIPTOR
,
2762 BASEPROPERTY_HELPTEXT
,
2763 BASEPROPERTY_HELPURL
,
2765 BASEPROPERTY_MULTILINE
,
2766 BASEPROPERTY_NOLABEL
,
2767 BASEPROPERTY_PRINTABLE
,
2768 BASEPROPERTY_TABSTOP
,
2769 BASEPROPERTY_VERTICALALIGN
,
2770 BASEPROPERTY_WRITING_MODE
,
2771 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2773 VCLXWindow::ImplGetPropertyIds( rIds
);
2776 VCLXFixedText::VCLXFixedText()
2780 VCLXFixedText::~VCLXFixedText()
2784 // ::com::sun::star::uno::XInterface
2785 ::com::sun::star::uno::Any
VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2787 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2788 SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText
*, this ) );
2789 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2792 // ::com::sun::star::lang::XTypeProvider
2793 IMPL_XTYPEPROVIDER_START( VCLXFixedText
)
2794 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
>* ) NULL
),
2795 VCLXWindow::getTypes()
2796 IMPL_XTYPEPROVIDER_END
2798 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXFixedText::CreateAccessibleContext()
2800 return getAccessibleFactory().createAccessibleContext( this );
2803 void VCLXFixedText::setText( const ::rtl::OUString
& Text
) throw(::com::sun::star::uno::RuntimeException
)
2805 ::vos::OGuard
aGuard( GetMutex() );
2807 Window
* pWindow
= GetWindow();
2809 pWindow
->SetText( Text
);
2812 ::rtl::OUString
VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException
)
2814 ::vos::OGuard
aGuard( GetMutex() );
2816 ::rtl::OUString aText
;
2817 Window
* pWindow
= GetWindow();
2819 aText
= pWindow
->GetText();
2823 void VCLXFixedText::setAlignment( short nAlign
) throw(::com::sun::star::uno::RuntimeException
)
2825 ::vos::OGuard
aGuard( GetMutex() );
2827 Window
* pWindow
= GetWindow();
2830 WinBits nNewBits
= 0;
2831 if ( nAlign
== ::com::sun::star::awt::TextAlign::LEFT
)
2833 else if ( nAlign
== ::com::sun::star::awt::TextAlign::CENTER
)
2834 nNewBits
= WB_CENTER
;
2836 nNewBits
= WB_RIGHT
;
2838 WinBits nStyle
= pWindow
->GetStyle();
2839 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2840 pWindow
->SetStyle( nStyle
| nNewBits
);
2844 short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException
)
2846 ::vos::OGuard
aGuard( GetMutex() );
2849 Window
* pWindow
= GetWindow();
2852 WinBits nStyle
= pWindow
->GetStyle();
2853 if ( nStyle
& WB_LEFT
)
2854 nAlign
= ::com::sun::star::awt::TextAlign::LEFT
;
2855 else if ( nStyle
& WB_CENTER
)
2856 nAlign
= ::com::sun::star::awt::TextAlign::CENTER
;
2858 nAlign
= ::com::sun::star::awt::TextAlign::RIGHT
;
2863 ::com::sun::star::awt::Size
VCLXFixedText::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
2865 ::vos::OGuard
aGuard( GetMutex() );
2868 FixedText
* pFixedText
= (FixedText
*)GetWindow();
2870 aSz
= pFixedText
->CalcMinimumSize();
2871 return AWTSize(aSz
);
2874 ::com::sun::star::awt::Size
VCLXFixedText::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
2876 return getMinimumSize();
2879 ::com::sun::star::awt::Size
VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
2881 ::vos::OGuard
aGuard( GetMutex() );
2883 ::com::sun::star::awt::Size aSz
= rNewSize
;
2884 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
2885 if ( aSz
.Height
!= aMinSz
.Height
)
2886 aSz
.Height
= aMinSz
.Height
;
2891 // ----------------------------------------------------
2892 // class VCLXScrollBar
2893 // ----------------------------------------------------
2894 void VCLXScrollBar::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
2896 PushPropertyIds( rIds
,
2897 BASEPROPERTY_BACKGROUNDCOLOR
,
2898 BASEPROPERTY_BLOCKINCREMENT
,
2899 BASEPROPERTY_BORDER
,
2900 BASEPROPERTY_BORDERCOLOR
,
2901 BASEPROPERTY_DEFAULTCONTROL
,
2902 BASEPROPERTY_ENABLED
,
2903 BASEPROPERTY_ENABLEVISIBLE
,
2904 BASEPROPERTY_HELPTEXT
,
2905 BASEPROPERTY_HELPURL
,
2906 BASEPROPERTY_LINEINCREMENT
,
2907 BASEPROPERTY_LIVE_SCROLL
,
2908 BASEPROPERTY_ORIENTATION
,
2909 BASEPROPERTY_PRINTABLE
,
2910 BASEPROPERTY_REPEAT_DELAY
,
2911 BASEPROPERTY_SCROLLVALUE
,
2912 BASEPROPERTY_SCROLLVALUE_MAX
,
2913 BASEPROPERTY_SCROLLVALUE_MIN
,
2914 BASEPROPERTY_SYMBOL_COLOR
,
2915 BASEPROPERTY_TABSTOP
,
2916 BASEPROPERTY_VISIBLESIZE
,
2917 BASEPROPERTY_WRITING_MODE
,
2918 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2920 VCLXWindow::ImplGetPropertyIds( rIds
);
2923 VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
2927 // ::com::sun::star::uno::XInterface
2928 ::com::sun::star::uno::Any
VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
2930 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
2931 SAL_STATIC_CAST( ::com::sun::star::awt::XScrollBar
*, this ) );
2932 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
2935 // ::com::sun::star::lang::XTypeProvider
2936 IMPL_XTYPEPROVIDER_START( VCLXScrollBar
)
2937 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XScrollBar
>* ) NULL
),
2938 VCLXWindow::getTypes()
2939 IMPL_XTYPEPROVIDER_END
2941 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXScrollBar::CreateAccessibleContext()
2943 return getAccessibleFactory().createAccessibleContext( this );
2946 // ::com::sun::star::lang::XComponent
2947 void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException
)
2949 ::vos::OGuard
aGuard( GetMutex() );
2951 ::com::sun::star::lang::EventObject aObj
;
2952 aObj
.Source
= (::cppu::OWeakObject
*)this;
2953 maAdjustmentListeners
.disposeAndClear( aObj
);
2954 VCLXWindow::dispose();
2957 // ::com::sun::star::awt::XScrollbar
2958 void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XAdjustmentListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
2960 ::vos::OGuard
aGuard( GetMutex() );
2961 maAdjustmentListeners
.addInterface( l
);
2964 void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XAdjustmentListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
2966 ::vos::OGuard
aGuard( GetMutex() );
2967 maAdjustmentListeners
.removeInterface( l
);
2970 void VCLXScrollBar::setValue( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
2972 ::vos::OGuard
aGuard( GetMutex() );
2974 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
2976 pScrollBar
->DoScroll( n
);
2979 void VCLXScrollBar::setValues( sal_Int32 nValue
, sal_Int32 nVisible
, sal_Int32 nMax
) throw(::com::sun::star::uno::RuntimeException
)
2981 ::vos::OGuard
aGuard( GetMutex() );
2983 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
2986 pScrollBar
->SetVisibleSize( nVisible
);
2987 pScrollBar
->SetRangeMax( nMax
);
2988 pScrollBar
->DoScroll( nValue
);
2992 sal_Int32
VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException
)
2994 ::vos::OGuard
aGuard( GetMutex() );
2996 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
2997 return pScrollBar
? pScrollBar
->GetThumbPos() : 0;
3000 void VCLXScrollBar::setMaximum( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3002 ::vos::OGuard
aGuard( GetMutex() );
3004 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3006 pScrollBar
->SetRangeMax( n
);
3009 sal_Int32
VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException
)
3011 ::vos::OGuard
aGuard( GetMutex() );
3013 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3014 return pScrollBar
? pScrollBar
->GetRangeMax() : 0;
3017 void VCLXScrollBar::setMinimum( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3019 ::vos::OGuard
aGuard( GetMutex() );
3021 ScrollBar
* pScrollBar
= static_cast< ScrollBar
* >( GetWindow() );
3023 pScrollBar
->SetRangeMin( n
);
3026 sal_Int32
VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException
)
3028 ::vos::OGuard
aGuard( GetMutex() );
3030 ScrollBar
* pScrollBar
= static_cast< ScrollBar
* >( GetWindow() );
3031 return pScrollBar
? pScrollBar
->GetRangeMin() : 0;
3034 void VCLXScrollBar::setLineIncrement( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3036 ::vos::OGuard
aGuard( GetMutex() );
3038 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3040 pScrollBar
->SetLineSize( n
);
3043 sal_Int32
VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException
)
3045 ::vos::OGuard
aGuard( GetMutex() );
3047 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3048 return pScrollBar
? pScrollBar
->GetLineSize() : 0;
3051 void VCLXScrollBar::setBlockIncrement( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3053 ::vos::OGuard
aGuard( GetMutex() );
3055 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3057 pScrollBar
->SetPageSize( n
);
3060 sal_Int32
VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException
)
3062 ::vos::OGuard
aGuard( GetMutex() );
3064 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3065 return pScrollBar
? pScrollBar
->GetPageSize() : 0;
3068 void VCLXScrollBar::setVisibleSize( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3070 ::vos::OGuard
aGuard( GetMutex() );
3072 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3074 pScrollBar
->SetVisibleSize( n
);
3077 sal_Int32
VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException
)
3079 ::vos::OGuard
aGuard( GetMutex() );
3081 ScrollBar
* pScrollBar
= (ScrollBar
*) GetWindow();
3082 return pScrollBar
? pScrollBar
->GetVisibleSize() : 0;
3085 void VCLXScrollBar::setOrientation( sal_Int32 n
) throw(::com::sun::star::uno::RuntimeException
)
3087 ::vos::OGuard
aGuard( GetMutex() );
3089 Window
* pWindow
= GetWindow();
3092 WinBits nStyle
= pWindow
->GetStyle();
3093 nStyle
&= ~(WB_HORZ
|WB_VERT
);
3094 if ( n
== ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL
)
3099 pWindow
->SetStyle( nStyle
);
3104 sal_Int32
VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException
)
3106 ::vos::OGuard
aGuard( GetMutex() );
3109 Window
* pWindow
= GetWindow();
3112 WinBits nStyle
= pWindow
->GetStyle();
3113 if ( nStyle
& WB_HORZ
)
3114 n
= ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL
;
3116 n
= ::com::sun::star::awt::ScrollBarOrientation::VERTICAL
;
3122 // ::com::sun::star::awt::VclWindowPeer
3123 void VCLXScrollBar::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
3125 ::vos::OGuard
aGuard( GetMutex() );
3127 ScrollBar
* pScrollBar
= (ScrollBar
*)GetWindow();
3130 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
3132 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3133 switch ( nPropType
)
3135 case BASEPROPERTY_LIVE_SCROLL
:
3137 sal_Bool bDo
= sal_False
;
3140 OSL_VERIFY( Value
>>= bDo
);
3142 AllSettings
aSettings( pScrollBar
->GetSettings() );
3143 StyleSettings
aStyle( aSettings
.GetStyleSettings() );
3144 ULONG nDragOptions
= aStyle
.GetDragFullOptions();
3146 nDragOptions
|= DRAGFULL_OPTION_SCROLL
;
3148 nDragOptions
&= ~DRAGFULL_OPTION_SCROLL
;
3149 aStyle
.SetDragFullOptions( nDragOptions
);
3150 aSettings
.SetStyleSettings( aStyle
);
3151 pScrollBar
->SetSettings( aSettings
);
3155 case BASEPROPERTY_SCROLLVALUE
:
3165 case BASEPROPERTY_SCROLLVALUE_MAX
:
3166 case BASEPROPERTY_SCROLLVALUE_MIN
:
3173 if ( nPropType
== BASEPROPERTY_SCROLLVALUE_MAX
)
3181 case BASEPROPERTY_LINEINCREMENT
:
3187 setLineIncrement( n
);
3191 case BASEPROPERTY_BLOCKINCREMENT
:
3197 setBlockIncrement( n
);
3201 case BASEPROPERTY_VISIBLESIZE
:
3207 setVisibleSize( n
);
3211 case BASEPROPERTY_ORIENTATION
:
3217 setOrientation( n
);
3222 case BASEPROPERTY_BACKGROUNDCOLOR
:
3224 // the default implementation of the base class doesn't work here, since our
3225 // interpretation for this property is slightly different
3226 ::toolkit::setButtonLikeFaceColor( pScrollBar
, Value
);
3232 VCLXWindow::setProperty( PropertyName
, Value
);
3238 ::com::sun::star::uno::Any
VCLXScrollBar::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
3240 ::vos::OGuard
aGuard( GetMutex() );
3242 ::com::sun::star::uno::Any aProp
;
3243 ScrollBar
* pScrollBar
= (ScrollBar
*)GetWindow();
3246 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3248 switch ( nPropType
)
3250 case BASEPROPERTY_LIVE_SCROLL
:
3252 aProp
<<= (sal_Bool
)( 0 != ( pScrollBar
->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL
) );
3255 case BASEPROPERTY_SCROLLVALUE
:
3257 aProp
<<= (sal_Int32
) getValue();
3260 case BASEPROPERTY_SCROLLVALUE_MAX
:
3262 aProp
<<= (sal_Int32
) getMaximum();
3265 case BASEPROPERTY_SCROLLVALUE_MIN
:
3267 aProp
<<= (sal_Int32
) getMinimum();
3270 case BASEPROPERTY_LINEINCREMENT
:
3272 aProp
<<= (sal_Int32
) getLineIncrement();
3275 case BASEPROPERTY_BLOCKINCREMENT
:
3277 aProp
<<= (sal_Int32
) getBlockIncrement();
3280 case BASEPROPERTY_VISIBLESIZE
:
3282 aProp
<<= (sal_Int32
) getVisibleSize();
3285 case BASEPROPERTY_ORIENTATION
:
3287 aProp
<<= (sal_Int32
) getOrientation();
3290 case BASEPROPERTY_BACKGROUNDCOLOR
:
3292 // the default implementation of the base class doesn't work here, since our
3293 // interpretation for this property is slightly different
3294 aProp
= ::toolkit::getButtonLikeFaceColor( pScrollBar
);
3300 aProp
<<= VCLXWindow::getProperty( PropertyName
);
3307 void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
3309 switch ( rVclWindowEvent
.GetId() )
3311 case VCLEVENT_SCROLLBAR_SCROLL
:
3313 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
3314 // since we call listeners below, there is a potential that we will be destroyed
3315 // in during the listener call. To prevent the resulting crashs, we keep us
3316 // alive as long as we're here
3317 // #20178# - 2003-10-01 - fs@openoffice.org
3319 if ( maAdjustmentListeners
.getLength() )
3321 ScrollBar
* pScrollBar
= (ScrollBar
*)GetWindow();
3325 ::com::sun::star::awt::AdjustmentEvent aEvent
;
3326 aEvent
.Source
= (::cppu::OWeakObject
*)this;
3327 aEvent
.Value
= pScrollBar
->GetThumbPos();
3329 // set adjustment type
3330 ScrollType aType
= pScrollBar
->GetType();
3331 if ( aType
== SCROLL_LINEUP
|| aType
== SCROLL_LINEDOWN
)
3333 aEvent
.Type
= ::com::sun::star::awt::AdjustmentType_ADJUST_LINE
;
3335 else if ( aType
== SCROLL_PAGEUP
|| aType
== SCROLL_PAGEDOWN
)
3337 aEvent
.Type
= ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE
;
3339 else if ( aType
== SCROLL_DRAG
)
3341 aEvent
.Type
= ::com::sun::star::awt::AdjustmentType_ADJUST_ABS
;
3344 maAdjustmentListeners
.adjustmentValueChanged( aEvent
);
3351 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
3356 ::com::sun::star::awt::Size SAL_CALL
VCLXScrollBar::implGetMinimumSize( Window
* p
) throw(::com::sun::star::uno::RuntimeException
)
3358 long n
= p
->GetSettings().GetStyleSettings().GetScrollBarSize();
3359 return ::com::sun::star::awt::Size( n
, n
);
3362 ::com::sun::star::awt::Size SAL_CALL
VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException
)
3364 ::vos::OGuard
aGuard( GetMutex() );
3365 return implGetMinimumSize( GetWindow() );
3369 // ----------------------------------------------------
3371 // ----------------------------------------------------
3373 void VCLXEdit::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
3375 PushPropertyIds( rIds
,
3377 BASEPROPERTY_BACKGROUNDCOLOR
,
3378 BASEPROPERTY_BORDER
,
3379 BASEPROPERTY_BORDERCOLOR
,
3380 BASEPROPERTY_DEFAULTCONTROL
,
3381 BASEPROPERTY_ECHOCHAR
,
3382 BASEPROPERTY_ENABLED
,
3383 BASEPROPERTY_ENABLEVISIBLE
,
3384 BASEPROPERTY_FONTDESCRIPTOR
,
3385 BASEPROPERTY_HARDLINEBREAKS
,
3386 BASEPROPERTY_HELPTEXT
,
3387 BASEPROPERTY_HELPURL
,
3388 BASEPROPERTY_HSCROLL
,
3389 BASEPROPERTY_LINE_END_FORMAT
,
3390 BASEPROPERTY_MAXTEXTLEN
,
3391 BASEPROPERTY_MULTILINE
,
3392 BASEPROPERTY_PRINTABLE
,
3393 BASEPROPERTY_READONLY
,
3394 BASEPROPERTY_TABSTOP
,
3396 BASEPROPERTY_VSCROLL
,
3397 BASEPROPERTY_HIDEINACTIVESELECTION
,
3398 BASEPROPERTY_PAINTTRANSPARENT
,
3399 BASEPROPERTY_AUTOHSCROLL
,
3400 BASEPROPERTY_AUTOVSCROLL
,
3401 BASEPROPERTY_WRITING_MODE
,
3402 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3404 VCLXWindow::ImplGetPropertyIds( rIds
);
3407 VCLXEdit::VCLXEdit() : maTextListeners( *this )
3411 // ::com::sun::star::uno::XInterface
3412 ::com::sun::star::uno::Any
VCLXEdit::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
3414 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
3415 SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent
*, this ),
3416 SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField
*, this ),
3417 SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains
*, this ) );
3418 return (aRet
.hasValue() ? aRet
: VCLXWindow::queryInterface( rType
));
3421 // ::com::sun::star::lang::XTypeProvider
3422 IMPL_XTYPEPROVIDER_START( VCLXEdit
)
3423 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextComponent
>* ) NULL
),
3424 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextEditField
>* ) NULL
),
3425 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextLayoutConstrains
>* ) NULL
),
3426 VCLXWindow::getTypes()
3427 IMPL_XTYPEPROVIDER_END
3429 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXEdit::CreateAccessibleContext()
3431 return getAccessibleFactory().createAccessibleContext( this );
3434 void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException
)
3436 ::vos::OGuard
aGuard( GetMutex() );
3438 ::com::sun::star::lang::EventObject aObj
;
3439 aObj
.Source
= (::cppu::OWeakObject
*)this;
3440 maTextListeners
.disposeAndClear( aObj
);
3441 VCLXWindow::dispose();
3444 void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3446 ::vos::OGuard
aGuard( GetMutex() );
3447 GetTextListeners().addInterface( l
);
3450 void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3452 ::vos::OGuard
aGuard( GetMutex() );
3453 GetTextListeners().removeInterface( l
);
3456 void VCLXEdit::setText( const ::rtl::OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
3458 ::vos::OGuard
aGuard( GetMutex() );
3460 Edit
* pEdit
= (Edit
*)GetWindow();
3463 pEdit
->SetText( aText
);
3465 // #107218# Call same listeners like VCL would do after user interaction
3466 SetSynthesizingVCLEvent( sal_True
);
3467 pEdit
->SetModifyFlag();
3469 SetSynthesizingVCLEvent( sal_False
);
3473 void VCLXEdit::insertText( const ::com::sun::star::awt::Selection
& rSel
, const ::rtl::OUString
& aText
) throw(::com::sun::star::uno::RuntimeException
)
3475 ::vos::OGuard
aGuard( GetMutex() );
3477 Edit
* pEdit
= (Edit
*)GetWindow();
3480 pEdit
->SetSelection( Selection( rSel
.Min
, rSel
.Max
) );
3481 pEdit
->ReplaceSelected( aText
);
3483 // #107218# Call same listeners like VCL would do after user interaction
3484 SetSynthesizingVCLEvent( sal_True
);
3485 pEdit
->SetModifyFlag();
3487 SetSynthesizingVCLEvent( sal_False
);
3491 ::rtl::OUString
VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException
)
3493 ::vos::OGuard
aGuard( GetMutex() );
3495 ::rtl::OUString aText
;
3496 Window
* pWindow
= GetWindow();
3498 aText
= pWindow
->GetText();
3502 ::rtl::OUString
VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException
)
3504 ::vos::OGuard
aGuard( GetMutex() );
3506 ::rtl::OUString aText
;
3507 Edit
* pEdit
= (Edit
*) GetWindow();
3509 aText
= pEdit
->GetSelected();
3514 void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw(::com::sun::star::uno::RuntimeException
)
3516 ::vos::OGuard
aGuard( GetMutex() );
3518 Edit
* pEdit
= (Edit
*) GetWindow();
3520 pEdit
->SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
3523 ::com::sun::star::awt::Selection
VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException
)
3525 ::vos::OGuard
aGuard( GetMutex() );
3528 Edit
* pEdit
= (Edit
*) GetWindow();
3530 aSel
= pEdit
->GetSelection();
3531 return ::com::sun::star::awt::Selection( aSel
.Min(), aSel
.Max() );
3534 sal_Bool
VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException
)
3536 ::vos::OGuard
aGuard( GetMutex() );
3538 Edit
* pEdit
= (Edit
*) GetWindow();
3539 return ( pEdit
&& !pEdit
->IsReadOnly() && pEdit
->IsEnabled() ) ? sal_True
: sal_False
;
3542 void VCLXEdit::setEditable( sal_Bool bEditable
) throw(::com::sun::star::uno::RuntimeException
)
3544 ::vos::OGuard
aGuard( GetMutex() );
3546 Edit
* pEdit
= (Edit
*) GetWindow();
3548 pEdit
->SetReadOnly( !bEditable
);
3552 void VCLXEdit::setMaxTextLen( sal_Int16 nLen
) throw(::com::sun::star::uno::RuntimeException
)
3554 ::vos::OGuard
aGuard( GetMutex() );
3556 Edit
* pEdit
= (Edit
*) GetWindow();
3558 pEdit
->SetMaxTextLen( nLen
);
3561 sal_Int16
VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException
)
3563 ::vos::OGuard
aGuard( GetMutex() );
3565 Edit
* pEdit
= (Edit
*) GetWindow();
3566 return pEdit
? pEdit
->GetMaxTextLen() : 0;
3569 void VCLXEdit::setEchoChar( sal_Unicode cEcho
) throw(::com::sun::star::uno::RuntimeException
)
3571 ::vos::OGuard
aGuard( GetMutex() );
3573 Edit
* pEdit
= (Edit
*) GetWindow();
3575 pEdit
->SetEchoChar( cEcho
);
3578 void VCLXEdit::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
3580 ::vos::OGuard
aGuard( GetMutex() );
3582 Edit
* pEdit
= (Edit
*)GetWindow();
3585 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3586 switch ( nPropType
)
3588 case BASEPROPERTY_HIDEINACTIVESELECTION
:
3589 ::toolkit::adjustBooleanWindowStyle( Value
, pEdit
, WB_NOHIDESELECTION
, sal_True
);
3590 if ( pEdit
->GetSubEdit() )
3591 ::toolkit::adjustBooleanWindowStyle( Value
, pEdit
->GetSubEdit(), WB_NOHIDESELECTION
, sal_True
);
3594 case BASEPROPERTY_READONLY
:
3596 sal_Bool b
= sal_Bool();
3598 pEdit
->SetReadOnly( b
);
3601 case BASEPROPERTY_ECHOCHAR
:
3603 sal_Int16 n
= sal_Int16();
3605 pEdit
->SetEchoChar( n
);
3608 case BASEPROPERTY_MAXTEXTLEN
:
3610 sal_Int16 n
= sal_Int16();
3612 pEdit
->SetMaxTextLen( n
);
3617 VCLXWindow::setProperty( PropertyName
, Value
);
3623 ::com::sun::star::uno::Any
VCLXEdit::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
3625 ::vos::OGuard
aGuard( GetMutex() );
3627 ::com::sun::star::uno::Any aProp
;
3628 Edit
* pEdit
= (Edit
*)GetWindow();
3631 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3632 switch ( nPropType
)
3634 case BASEPROPERTY_HIDEINACTIVESELECTION
:
3635 aProp
<<= (sal_Bool
)( ( pEdit
->GetStyle() & WB_NOHIDESELECTION
) == 0 );
3637 case BASEPROPERTY_READONLY
:
3638 aProp
<<= (sal_Bool
) pEdit
->IsReadOnly();
3640 case BASEPROPERTY_ECHOCHAR
:
3641 aProp
<<= (sal_Int16
) pEdit
->GetEchoChar();
3643 case BASEPROPERTY_MAXTEXTLEN
:
3644 aProp
<<= (sal_Int16
) pEdit
->GetMaxTextLen();
3648 aProp
= VCLXWindow::getProperty( PropertyName
);
3655 ::com::sun::star::awt::Size
VCLXEdit::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
3657 ::vos::OGuard
aGuard( GetMutex() );
3660 Edit
* pEdit
= (Edit
*) GetWindow();
3662 aSz
= pEdit
->CalcMinimumSize();
3663 return AWTSize(aSz
);
3666 ::com::sun::star::awt::Size
VCLXEdit::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
3668 ::vos::OGuard
aGuard( GetMutex() );
3671 Edit
* pEdit
= (Edit
*) GetWindow();
3674 aSz
= pEdit
->CalcMinimumSize();
3677 return AWTSize(aSz
);
3680 ::com::sun::star::awt::Size
VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
3682 ::vos::OGuard
aGuard( GetMutex() );
3684 ::com::sun::star::awt::Size aSz
= rNewSize
;
3685 ::com::sun::star::awt::Size aMinSz
= getMinimumSize();
3686 if ( aSz
.Height
!= aMinSz
.Height
)
3687 aSz
.Height
= aMinSz
.Height
;
3692 ::com::sun::star::awt::Size
VCLXEdit::getMinimumSize( sal_Int16 nCols
, sal_Int16
) throw(::com::sun::star::uno::RuntimeException
)
3694 ::vos::OGuard
aGuard( GetMutex() );
3697 Edit
* pEdit
= (Edit
*) GetWindow();
3701 aSz
= pEdit
->CalcSize( nCols
);
3703 aSz
= pEdit
->CalcMinimumSize();
3705 return AWTSize(aSz
);
3708 void VCLXEdit::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
3710 ::vos::OGuard
aGuard( GetMutex() );
3714 Edit
* pEdit
= (Edit
*) GetWindow();
3716 nCols
= pEdit
->GetMaxVisChars();
3719 void VCLXEdit::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
3721 switch ( rVclWindowEvent
.GetId() )
3723 case VCLEVENT_EDIT_MODIFY
:
3725 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
3726 // since we call listeners below, there is a potential that we will be destroyed
3727 // during the listener call. To prevent the resulting crashs, we keep us
3728 // alive as long as we're here
3729 // #20178# - 2003-10-01 - fs@openoffice.org
3731 if ( GetTextListeners().getLength() )
3733 ::com::sun::star::awt::TextEvent aEvent
;
3734 aEvent
.Source
= (::cppu::OWeakObject
*)this;
3735 GetTextListeners().textChanged( aEvent
);
3741 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
3746 // ----------------------------------------------------
3747 // class VCLXComboBox
3748 // ----------------------------------------------------
3750 void VCLXComboBox::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
3752 PushPropertyIds( rIds
,
3753 BASEPROPERTY_AUTOCOMPLETE
,
3754 BASEPROPERTY_BACKGROUNDCOLOR
,
3755 BASEPROPERTY_BORDER
,
3756 BASEPROPERTY_BORDERCOLOR
,
3757 BASEPROPERTY_DEFAULTCONTROL
,
3758 BASEPROPERTY_DROPDOWN
,
3759 BASEPROPERTY_ENABLED
,
3760 BASEPROPERTY_ENABLEVISIBLE
,
3761 BASEPROPERTY_FONTDESCRIPTOR
,
3762 BASEPROPERTY_HELPTEXT
,
3763 BASEPROPERTY_HELPURL
,
3764 BASEPROPERTY_LINECOUNT
,
3765 BASEPROPERTY_MAXTEXTLEN
,
3766 BASEPROPERTY_PRINTABLE
,
3767 BASEPROPERTY_READONLY
,
3768 BASEPROPERTY_STRINGITEMLIST
,
3769 BASEPROPERTY_TABSTOP
,
3771 BASEPROPERTY_HIDEINACTIVESELECTION
,
3773 BASEPROPERTY_WRITING_MODE
,
3774 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3776 // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box
3777 // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
3778 // VCLXEdit::ImplGetPropertyIds( rIds );
3779 VCLXWindow::ImplGetPropertyIds( rIds
);
3782 VCLXComboBox::VCLXComboBox()
3783 : maActionListeners( *this ), maItemListeners( *this )
3787 VCLXComboBox::~VCLXComboBox()
3789 OSL_TRACE ("%s", __FUNCTION__
);
3792 // ::com::sun::star::uno::XInterface
3793 ::com::sun::star::uno::Any
VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
3795 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
3796 SAL_STATIC_CAST( ::com::sun::star::awt::XComboBox
*, this ) );
3797 return (aRet
.hasValue() ? aRet
: VCLXEdit::queryInterface( rType
));
3800 // ::com::sun::star::lang::XTypeProvider
3801 IMPL_XTYPEPROVIDER_START( VCLXComboBox
)
3802 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XComboBox
>* ) NULL
),
3803 VCLXEdit::getTypes()
3804 IMPL_XTYPEPROVIDER_END
3806 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXComboBox::CreateAccessibleContext()
3808 ::vos::OGuard
aGuard( GetMutex() );
3810 return getAccessibleFactory().createAccessibleContext( this );
3813 void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException
)
3815 ::vos::OGuard
aGuard( GetMutex() );
3817 ::com::sun::star::lang::EventObject aObj
;
3818 aObj
.Source
= (::cppu::OWeakObject
*)this;
3819 maItemListeners
.disposeAndClear( aObj
);
3820 maActionListeners
.disposeAndClear( aObj
);
3821 VCLXEdit::dispose();
3825 void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3827 ::vos::OGuard
aGuard( GetMutex() );
3828 maItemListeners
.addInterface( l
);
3831 void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XItemListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3833 ::vos::OGuard
aGuard( GetMutex() );
3834 maItemListeners
.removeInterface( l
);
3837 void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3839 ::vos::OGuard
aGuard( GetMutex() );
3840 maActionListeners
.addInterface( l
);
3843 void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
> & l
) throw(::com::sun::star::uno::RuntimeException
)
3845 ::vos::OGuard
aGuard( GetMutex() );
3846 maActionListeners
.removeInterface( l
);
3849 void VCLXComboBox::addItem( const ::rtl::OUString
& aItem
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
3851 ::vos::OGuard
aGuard( GetMutex() );
3853 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3855 pBox
->InsertEntry( aItem
, nPos
);
3858 void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aItems
, sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
3860 ::vos::OGuard
aGuard( GetMutex() );
3862 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3865 sal_uInt16 nP
= nPos
;
3866 for ( sal_uInt16 n
= 0; n
< aItems
.getLength(); n
++ )
3868 pBox
->InsertEntry( aItems
.getConstArray()[n
], nP
);
3869 if ( (sal_uInt16
)nPos
< 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND
3875 void VCLXComboBox::removeItems( sal_Int16 nPos
, sal_Int16 nCount
) throw(::com::sun::star::uno::RuntimeException
)
3877 ::vos::OGuard
aGuard( GetMutex() );
3879 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3882 for ( sal_uInt16 n
= nCount
; n
; )
3883 pBox
->RemoveEntry( nPos
+ (--n
) );
3887 sal_Int16
VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException
)
3889 ::vos::OGuard
aGuard( GetMutex() );
3891 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3892 return pBox
? pBox
->GetEntryCount() : 0;
3895 ::rtl::OUString
VCLXComboBox::getItem( sal_Int16 nPos
) throw(::com::sun::star::uno::RuntimeException
)
3897 ::vos::OGuard
aGuard( GetMutex() );
3899 ::rtl::OUString aItem
;
3900 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3902 aItem
= pBox
->GetEntry( nPos
);
3906 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException
)
3908 ::vos::OGuard
aGuard( GetMutex() );
3910 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq
;
3911 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3914 sal_uInt16 nEntries
= pBox
->GetEntryCount();
3915 aSeq
= ::com::sun::star::uno::Sequence
< ::rtl::OUString
>( nEntries
);
3916 for ( sal_uInt16 n
= nEntries
; n
; )
3919 aSeq
.getArray()[n
] = pBox
->GetEntry( n
);
3925 void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
3927 ::vos::OGuard
aGuard( GetMutex() );
3929 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3931 pBox
->SetDropDownLineCount( nLines
);
3934 sal_Int16
VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException
)
3936 ::vos::OGuard
aGuard( GetMutex() );
3938 sal_Int16 nLines
= 0;
3939 ComboBox
* pBox
= (ComboBox
*) GetWindow();
3941 nLines
= pBox
->GetDropDownLineCount();
3945 void VCLXComboBox::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
3947 ::vos::OGuard
aGuard( GetMutex() );
3949 ComboBox
* pComboBox
= (ComboBox
*)GetWindow();
3952 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3953 switch ( nPropType
)
3955 case BASEPROPERTY_LINECOUNT
:
3957 sal_Int16 n
= sal_Int16();
3959 pComboBox
->SetDropDownLineCount( n
);
3962 case BASEPROPERTY_AUTOCOMPLETE
:
3964 sal_Int16 n
= sal_Int16();
3966 pComboBox
->EnableAutocomplete( n
!= 0 );
3969 case BASEPROPERTY_STRINGITEMLIST
:
3971 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aItems
;
3972 if ( Value
>>= aItems
)
3974 sal_Bool bUpdate
= pComboBox
->IsUpdateMode();
3975 pComboBox
->SetUpdateMode( sal_False
);
3977 const ::rtl::OUString
* pStrings
= aItems
.getConstArray();
3978 sal_Int32 nItems
= aItems
.getLength();
3979 for ( sal_Int32 n
= 0; n
< nItems
; n
++ )
3980 pComboBox
->InsertEntry( pStrings
[n
], LISTBOX_APPEND
);
3981 pComboBox
->SetUpdateMode( bUpdate
);
3987 VCLXEdit::setProperty( PropertyName
, Value
);
3989 // #109385# SetBorderStyle is not virtual
3990 if ( nPropType
== BASEPROPERTY_BORDER
)
3992 sal_uInt16 nBorder
= sal_uInt16();
3993 if ( (Value
>>= nBorder
) && nBorder
!= 0 )
3994 pComboBox
->SetBorderStyle( nBorder
);
4001 ::com::sun::star::uno::Any
VCLXComboBox::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4003 ::vos::OGuard
aGuard( GetMutex() );
4005 ::com::sun::star::uno::Any aProp
;
4006 ComboBox
* pComboBox
= (ComboBox
*)GetWindow();
4009 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4010 switch ( nPropType
)
4012 case BASEPROPERTY_LINECOUNT
:
4014 aProp
<<= (sal_Int16
) pComboBox
->GetDropDownLineCount();
4017 case BASEPROPERTY_AUTOCOMPLETE
:
4019 aProp
<<= (sal_Bool
) pComboBox
->IsAutocompleteEnabled();
4022 case BASEPROPERTY_STRINGITEMLIST
:
4024 sal_uInt16 nItems
= pComboBox
->GetEntryCount();
4025 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aSeq( nItems
);
4026 ::rtl::OUString
* pStrings
= aSeq
.getArray();
4027 for ( sal_uInt16 n
= 0; n
< nItems
; n
++ )
4028 pStrings
[n
] = pComboBox
->GetEntry( n
);
4035 aProp
<<= VCLXEdit::getProperty( PropertyName
);
4042 void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
4044 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> xKeepAlive( this );
4045 // since we call listeners below, there is a potential that we will be destroyed
4046 // during the listener call. To prevent the resulting crashs, we keep us
4047 // alive as long as we're here
4048 // #20178# - 2003-10-01 - fs@openoffice.org
4050 switch ( rVclWindowEvent
.GetId() )
4052 case VCLEVENT_COMBOBOX_SELECT
:
4053 if ( maItemListeners
.getLength() )
4055 ComboBox
* pComboBox
= (ComboBox
*)GetWindow();
4058 if ( !pComboBox
->IsTravelSelect() )
4060 ::com::sun::star::awt::ItemEvent aEvent
;
4061 aEvent
.Source
= (::cppu::OWeakObject
*)this;
4062 aEvent
.Highlighted
= sal_False
;
4064 // Bei Mehrfachselektion 0xFFFF, sonst die ID
4065 aEvent
.Selected
= pComboBox
->GetEntryPos( pComboBox
->GetText() );
4067 maItemListeners
.itemStateChanged( aEvent
);
4073 case VCLEVENT_COMBOBOX_DOUBLECLICK
:
4074 if ( maActionListeners
.getLength() )
4076 ::com::sun::star::awt::ActionEvent aEvent
;
4077 aEvent
.Source
= (::cppu::OWeakObject
*)this;
4078 // aEvent.ActionCommand = ...;
4079 maActionListeners
.actionPerformed( aEvent
);
4084 VCLXEdit::ProcessWindowEvent( rVclWindowEvent
);
4089 ::com::sun::star::awt::Size
VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException
)
4091 ::vos::OGuard
aGuard( GetMutex() );
4094 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4096 aSz
= pComboBox
->CalcMinimumSize();
4097 return AWTSize(aSz
);
4100 ::com::sun::star::awt::Size
VCLXComboBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException
)
4102 ::vos::OGuard
aGuard( GetMutex() );
4105 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4108 aSz
= pComboBox
->CalcMinimumSize();
4109 if ( pComboBox
->GetStyle() & WB_DROPDOWN
)
4112 return AWTSize(aSz
);
4115 ::com::sun::star::awt::Size
VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size
& rNewSize
) throw(::com::sun::star::uno::RuntimeException
)
4117 ::vos::OGuard
aGuard( GetMutex() );
4119 Size aSz
= VCLSize(rNewSize
);
4120 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4122 aSz
= pComboBox
->CalcAdjustedSize( aSz
);
4123 return AWTSize(aSz
);
4126 ::com::sun::star::awt::Size
VCLXComboBox::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
) throw(::com::sun::star::uno::RuntimeException
)
4128 ::vos::OGuard
aGuard( GetMutex() );
4131 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4133 aSz
= pComboBox
->CalcSize( nCols
, nLines
);
4134 return AWTSize(aSz
);
4137 void VCLXComboBox::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
) throw(::com::sun::star::uno::RuntimeException
)
4139 ::vos::OGuard
aGuard( GetMutex() );
4142 ComboBox
* pComboBox
= (ComboBox
*) GetWindow();
4146 pComboBox
->GetMaxVisColumnsAndLines( nC
, nL
);
4152 // ----------------------------------------------------
4153 // class VCLXFormattedSpinField
4154 // ----------------------------------------------------
4155 void VCLXFormattedSpinField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4157 // Interestingly in the UnoControl API this is
4158 // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
4159 // VCLXSpinField::ImplGetPropertyIds( rIds );
4160 VCLXWindow::ImplGetPropertyIds( rIds
);
4163 VCLXFormattedSpinField::VCLXFormattedSpinField()
4167 VCLXFormattedSpinField::~VCLXFormattedSpinField()
4171 void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict
)
4173 ::vos::OGuard
aGuard( GetMutex() );
4175 FormatterBase
* pFormatter
= GetFormatter();
4177 pFormatter
->SetStrictFormat( bStrict
);
4180 sal_Bool
VCLXFormattedSpinField::isStrictFormat()
4182 FormatterBase
* pFormatter
= GetFormatter();
4183 return pFormatter
? pFormatter
->IsStrictFormat() : sal_False
;
4187 void VCLXFormattedSpinField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
4189 ::vos::OGuard
aGuard( GetMutex() );
4191 FormatterBase
* pFormatter
= GetFormatter();
4194 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4195 switch ( nPropType
)
4197 case BASEPROPERTY_SPIN
:
4199 sal_Bool b
= sal_Bool();
4202 WinBits nStyle
= GetWindow()->GetStyle() | WB_SPIN
;
4205 GetWindow()->SetStyle( nStyle
);
4209 case BASEPROPERTY_STRICTFORMAT
:
4211 sal_Bool b
= sal_Bool();
4214 pFormatter
->SetStrictFormat( b
);
4220 VCLXSpinField::setProperty( PropertyName
, Value
);
4226 ::com::sun::star::uno::Any
VCLXFormattedSpinField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4228 ::vos::OGuard
aGuard( GetMutex() );
4230 ::com::sun::star::uno::Any aProp
;
4231 FormatterBase
* pFormatter
= GetFormatter();
4234 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4235 switch ( nPropType
)
4237 case BASEPROPERTY_TABSTOP
:
4239 aProp
<<= (sal_Bool
) ( ( GetWindow()->GetStyle() & WB_SPIN
) ? sal_True
: sal_False
);
4242 case BASEPROPERTY_STRICTFORMAT
:
4244 aProp
<<= (sal_Bool
) pFormatter
->IsStrictFormat();
4249 aProp
<<= VCLXSpinField::getProperty( PropertyName
);
4257 // ----------------------------------------------------
4258 // class VCLXDateField
4259 // ----------------------------------------------------
4261 void VCLXDateField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4263 PushPropertyIds( rIds
,
4265 BASEPROPERTY_BACKGROUNDCOLOR
,
4266 BASEPROPERTY_BORDER
,
4267 BASEPROPERTY_BORDERCOLOR
,
4269 BASEPROPERTY_DATEMAX
,
4270 BASEPROPERTY_DATEMIN
,
4271 BASEPROPERTY_DATESHOWCENTURY
,
4272 BASEPROPERTY_DEFAULTCONTROL
,
4273 BASEPROPERTY_DROPDOWN
,
4274 BASEPROPERTY_ENABLED
,
4275 BASEPROPERTY_ENABLEVISIBLE
,
4276 BASEPROPERTY_EXTDATEFORMAT
,
4277 BASEPROPERTY_FONTDESCRIPTOR
,
4278 BASEPROPERTY_HELPTEXT
,
4279 BASEPROPERTY_HELPURL
,
4280 BASEPROPERTY_PRINTABLE
,
4281 BASEPROPERTY_READONLY
,
4282 BASEPROPERTY_REPEAT
,
4283 BASEPROPERTY_REPEAT_DELAY
,
4285 BASEPROPERTY_STRICTFORMAT
,
4286 BASEPROPERTY_TABSTOP
,
4287 BASEPROPERTY_ENFORCE_FORMAT
,
4289 BASEPROPERTY_HIDEINACTIVESELECTION
,
4290 BASEPROPERTY_WRITING_MODE
,
4291 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4293 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4296 VCLXDateField::VCLXDateField()
4300 VCLXDateField::~VCLXDateField()
4304 // ::com::sun::star::uno::XInterface
4305 ::com::sun::star::uno::Any
VCLXDateField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
4307 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
4308 SAL_STATIC_CAST( ::com::sun::star::awt::XDateField
*, this ) );
4309 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
4312 // ::com::sun::star::lang::XTypeProvider
4313 IMPL_XTYPEPROVIDER_START( VCLXDateField
)
4314 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDateField
>* ) NULL
),
4315 VCLXFormattedSpinField::getTypes()
4316 IMPL_XTYPEPROVIDER_END
4318 void VCLXDateField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
4320 ::vos::OGuard
aGuard( GetMutex() );
4324 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
4326 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4327 switch ( nPropType
)
4329 case BASEPROPERTY_DATE
:
4333 ((DateField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
4334 ((DateField
*)GetWindow())->SetEmptyFieldValue();
4344 case BASEPROPERTY_DATEMIN
:
4351 case BASEPROPERTY_DATEMAX
:
4358 case BASEPROPERTY_EXTDATEFORMAT
:
4360 sal_Int16 n
= sal_Int16();
4362 ((DateField
*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat
) n
);
4365 case BASEPROPERTY_DATESHOWCENTURY
:
4367 sal_Bool b
= sal_Bool();
4369 ((DateField
*)GetWindow())->SetShowDateCentury( b
);
4372 case BASEPROPERTY_ENFORCE_FORMAT
:
4374 sal_Bool
bEnforce( sal_True
);
4375 OSL_VERIFY( Value
>>= bEnforce
);
4376 static_cast< DateField
* >( GetWindow() )->EnforceValidValue( bEnforce
);
4381 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
4387 ::com::sun::star::uno::Any
VCLXDateField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4389 ::vos::OGuard
aGuard( GetMutex() );
4391 ::com::sun::star::uno::Any aProp
;
4392 FormatterBase
* pFormatter
= GetFormatter();
4395 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4396 switch ( nPropType
)
4398 case BASEPROPERTY_DATE
:
4400 aProp
<<= (sal_Int32
) getDate();
4403 case BASEPROPERTY_DATEMIN
:
4405 aProp
<<= (sal_Int32
) getMin();
4408 case BASEPROPERTY_DATEMAX
:
4410 aProp
<<= (sal_Int32
) getMax();
4413 case BASEPROPERTY_DATESHOWCENTURY
:
4415 aProp
<<= ((DateField
*)GetWindow())->IsShowDateCentury();
4418 case BASEPROPERTY_ENFORCE_FORMAT
:
4420 aProp
<<= (sal_Bool
)static_cast< DateField
* >( GetWindow() )->IsEnforceValidValue( );
4425 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
4433 void VCLXDateField::setDate( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4435 ::vos::OGuard
aGuard( GetMutex() );
4437 DateField
* pDateField
= (DateField
*) GetWindow();
4440 pDateField
->SetDate( nDate
);
4442 // #107218# Call same listeners like VCL would do after user interaction
4443 SetSynthesizingVCLEvent( sal_True
);
4444 pDateField
->SetModifyFlag();
4445 pDateField
->Modify();
4446 SetSynthesizingVCLEvent( sal_False
);
4450 sal_Int32
VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException
)
4452 ::vos::OGuard
aGuard( GetMutex() );
4454 sal_Int32 nDate
= 0;
4455 DateField
* pDateField
= (DateField
*) GetWindow();
4457 nDate
= pDateField
->GetDate().GetDate();
4462 void VCLXDateField::setMin( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4464 ::vos::OGuard
aGuard( GetMutex() );
4466 DateField
* pDateField
= (DateField
*) GetWindow();
4468 pDateField
->SetMin( nDate
);
4471 sal_Int32
VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException
)
4473 ::vos::OGuard
aGuard( GetMutex() );
4475 sal_Int32 nDate
= 0;
4476 DateField
* pDateField
= (DateField
*) GetWindow();
4478 nDate
= pDateField
->GetMin().GetDate();
4483 void VCLXDateField::setMax( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4485 ::vos::OGuard
aGuard( GetMutex() );
4487 DateField
* pDateField
= (DateField
*) GetWindow();
4489 pDateField
->SetMax( nDate
);
4492 sal_Int32
VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException
)
4494 ::vos::OGuard
aGuard( GetMutex() );
4496 sal_Int32 nDate
= 0;
4497 DateField
* pDateField
= (DateField
*) GetWindow();
4499 nDate
= pDateField
->GetMax().GetDate();
4504 void VCLXDateField::setFirst( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4506 ::vos::OGuard
aGuard( GetMutex() );
4508 DateField
* pDateField
= (DateField
*) GetWindow();
4510 pDateField
->SetFirst( nDate
);
4513 sal_Int32
VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
4515 ::vos::OGuard
aGuard( GetMutex() );
4517 sal_Int32 nDate
= 0;
4518 DateField
* pDateField
= (DateField
*) GetWindow();
4520 nDate
= pDateField
->GetFirst().GetDate();
4525 void VCLXDateField::setLast( sal_Int32 nDate
) throw(::com::sun::star::uno::RuntimeException
)
4527 ::vos::OGuard
aGuard( GetMutex() );
4529 DateField
* pDateField
= (DateField
*) GetWindow();
4531 pDateField
->SetLast( nDate
);
4534 sal_Int32
VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException
)
4536 ::vos::OGuard
aGuard( GetMutex() );
4538 sal_Int32 nDate
= 0;
4539 DateField
* pDateField
= (DateField
*) GetWindow();
4541 nDate
= pDateField
->GetLast().GetDate();
4546 void VCLXDateField::setLongFormat( sal_Bool bLong
) throw(::com::sun::star::uno::RuntimeException
)
4548 ::vos::OGuard
aGuard( GetMutex() );
4550 DateField
* pDateField
= (DateField
*) GetWindow();
4552 pDateField
->SetLongFormat( bLong
);
4555 sal_Bool
VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException
)
4557 ::vos::OGuard
aGuard( GetMutex() );
4559 DateField
* pDateField
= (DateField
*) GetWindow();
4560 return pDateField
? pDateField
->IsLongFormat() : sal_False
;
4563 void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException
)
4565 ::vos::OGuard
aGuard( GetMutex() );
4567 DateField
* pDateField
= (DateField
*) GetWindow();
4570 pDateField
->SetEmptyDate();
4572 // #107218# Call same listeners like VCL would do after user interaction
4573 SetSynthesizingVCLEvent( sal_True
);
4574 pDateField
->SetModifyFlag();
4575 pDateField
->Modify();
4576 SetSynthesizingVCLEvent( sal_False
);
4580 sal_Bool
VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException
)
4582 ::vos::OGuard
aGuard( GetMutex() );
4584 DateField
* pDateField
= (DateField
*) GetWindow();
4585 return pDateField
? pDateField
->IsEmptyDate() : sal_False
;
4588 void VCLXDateField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
4590 VCLXFormattedSpinField::setStrictFormat( bStrict
);
4593 sal_Bool
VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
4595 return VCLXFormattedSpinField::isStrictFormat();
4599 // ----------------------------------------------------
4600 // class VCLXTimeField
4601 // ----------------------------------------------------
4603 void VCLXTimeField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4605 PushPropertyIds( rIds
,
4607 BASEPROPERTY_BACKGROUNDCOLOR
,
4608 BASEPROPERTY_BORDER
,
4609 BASEPROPERTY_BORDERCOLOR
,
4610 BASEPROPERTY_DEFAULTCONTROL
,
4611 BASEPROPERTY_ENABLED
,
4612 BASEPROPERTY_ENABLEVISIBLE
,
4613 BASEPROPERTY_EXTTIMEFORMAT
,
4614 BASEPROPERTY_FONTDESCRIPTOR
,
4615 BASEPROPERTY_HELPTEXT
,
4616 BASEPROPERTY_HELPURL
,
4617 BASEPROPERTY_PRINTABLE
,
4618 BASEPROPERTY_READONLY
,
4619 BASEPROPERTY_REPEAT
,
4620 BASEPROPERTY_REPEAT_DELAY
,
4622 BASEPROPERTY_STRICTFORMAT
,
4623 BASEPROPERTY_TABSTOP
,
4625 BASEPROPERTY_TIMEMAX
,
4626 BASEPROPERTY_TIMEMIN
,
4627 BASEPROPERTY_ENFORCE_FORMAT
,
4629 BASEPROPERTY_HIDEINACTIVESELECTION
,
4630 BASEPROPERTY_WRITING_MODE
,
4631 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4633 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4636 VCLXTimeField::VCLXTimeField()
4640 VCLXTimeField::~VCLXTimeField()
4644 // ::com::sun::star::uno::XInterface
4645 ::com::sun::star::uno::Any
VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
4647 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
4648 SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField
*, this ) );
4649 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
4652 // ::com::sun::star::lang::XTypeProvider
4653 IMPL_XTYPEPROVIDER_START( VCLXTimeField
)
4654 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTimeField
>* ) NULL
),
4655 VCLXFormattedSpinField::getTypes()
4656 IMPL_XTYPEPROVIDER_END
4658 void VCLXTimeField::setTime( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4660 ::vos::OGuard
aGuard( GetMutex() );
4662 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4665 pTimeField
->SetTime( nTime
);
4667 // #107218# Call same listeners like VCL would do after user interaction
4668 SetSynthesizingVCLEvent( sal_True
);
4669 pTimeField
->SetModifyFlag();
4670 pTimeField
->Modify();
4671 SetSynthesizingVCLEvent( sal_False
);
4675 sal_Int32
VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException
)
4677 ::vos::OGuard
aGuard( GetMutex() );
4679 sal_Int32 nTime
= 0;
4680 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4682 nTime
= pTimeField
->GetTime().GetTime();
4687 void VCLXTimeField::setMin( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4689 ::vos::OGuard
aGuard( GetMutex() );
4691 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4693 pTimeField
->SetMin( nTime
);
4696 sal_Int32
VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException
)
4698 ::vos::OGuard
aGuard( GetMutex() );
4700 sal_Int32 nTime
= 0;
4701 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4703 nTime
= pTimeField
->GetMin().GetTime();
4708 void VCLXTimeField::setMax( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4710 ::vos::OGuard
aGuard( GetMutex() );
4712 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4714 pTimeField
->SetMax( nTime
);
4717 sal_Int32
VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException
)
4719 ::vos::OGuard
aGuard( GetMutex() );
4721 sal_Int32 nTime
= 0;
4722 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4724 nTime
= pTimeField
->GetMax().GetTime();
4729 void VCLXTimeField::setFirst( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4731 ::vos::OGuard
aGuard( GetMutex() );
4733 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4735 pTimeField
->SetFirst( nTime
);
4738 sal_Int32
VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
4740 ::vos::OGuard
aGuard( GetMutex() );
4742 sal_Int32 nTime
= 0;
4743 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4745 nTime
= pTimeField
->GetFirst().GetTime();
4750 void VCLXTimeField::setLast( sal_Int32 nTime
) throw(::com::sun::star::uno::RuntimeException
)
4752 ::vos::OGuard
aGuard( GetMutex() );
4754 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4756 pTimeField
->SetLast( nTime
);
4759 sal_Int32
VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException
)
4761 ::vos::OGuard
aGuard( GetMutex() );
4763 sal_Int32 nTime
= 0;
4764 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4766 nTime
= pTimeField
->GetLast().GetTime();
4771 void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException
)
4773 ::vos::OGuard
aGuard( GetMutex() );
4775 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4777 pTimeField
->SetEmptyTime();
4780 sal_Bool
VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException
)
4782 ::vos::OGuard
aGuard( GetMutex() );
4784 TimeField
* pTimeField
= (TimeField
*) GetWindow();
4785 return pTimeField
? pTimeField
->IsEmptyTime() : sal_False
;
4788 void VCLXTimeField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
4790 VCLXFormattedSpinField::setStrictFormat( bStrict
);
4793 sal_Bool
VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
4795 return VCLXFormattedSpinField::isStrictFormat();
4799 void VCLXTimeField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
4801 ::vos::OGuard
aGuard( GetMutex() );
4805 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
4807 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4808 switch ( nPropType
)
4810 case BASEPROPERTY_TIME
:
4814 ((TimeField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
4815 ((TimeField
*)GetWindow())->SetEmptyFieldValue();
4825 case BASEPROPERTY_TIMEMIN
:
4832 case BASEPROPERTY_TIMEMAX
:
4839 case BASEPROPERTY_EXTTIMEFORMAT
:
4841 sal_Int16 n
= sal_Int16();
4843 ((TimeField
*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat
) n
);
4846 case BASEPROPERTY_ENFORCE_FORMAT
:
4848 sal_Bool
bEnforce( sal_True
);
4849 OSL_VERIFY( Value
>>= bEnforce
);
4850 static_cast< TimeField
* >( GetWindow() )->EnforceValidValue( bEnforce
);
4855 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
4861 ::com::sun::star::uno::Any
VCLXTimeField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
4863 ::vos::OGuard
aGuard( GetMutex() );
4865 ::com::sun::star::uno::Any aProp
;
4868 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4869 switch ( nPropType
)
4871 case BASEPROPERTY_TIME
:
4873 aProp
<<= (sal_Int32
) getTime();
4876 case BASEPROPERTY_TIMEMIN
:
4878 aProp
<<= (sal_Int32
) getMin();
4881 case BASEPROPERTY_TIMEMAX
:
4883 aProp
<<= (sal_Int32
) getMax();
4886 case BASEPROPERTY_ENFORCE_FORMAT
:
4888 aProp
<<= (sal_Bool
)static_cast< TimeField
* >( GetWindow() )->IsEnforceValidValue( );
4893 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
4900 // ----------------------------------------------------
4901 // class VCLXNumericField
4902 // ----------------------------------------------------
4904 void VCLXNumericField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
4906 PushPropertyIds( rIds
,
4908 BASEPROPERTY_BACKGROUNDCOLOR
,
4909 BASEPROPERTY_BORDER
,
4910 BASEPROPERTY_BORDERCOLOR
,
4911 BASEPROPERTY_DECIMALACCURACY
,
4912 BASEPROPERTY_DEFAULTCONTROL
,
4913 BASEPROPERTY_ENABLED
,
4914 BASEPROPERTY_ENABLEVISIBLE
,
4915 BASEPROPERTY_FONTDESCRIPTOR
,
4916 BASEPROPERTY_HELPTEXT
,
4917 BASEPROPERTY_HELPURL
,
4918 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
4919 BASEPROPERTY_PRINTABLE
,
4920 BASEPROPERTY_READONLY
,
4921 BASEPROPERTY_REPEAT
,
4922 BASEPROPERTY_REPEAT_DELAY
,
4924 BASEPROPERTY_STRICTFORMAT
,
4925 BASEPROPERTY_TABSTOP
,
4926 BASEPROPERTY_VALUEMAX_DOUBLE
,
4927 BASEPROPERTY_VALUEMIN_DOUBLE
,
4928 BASEPROPERTY_VALUESTEP_DOUBLE
,
4929 BASEPROPERTY_VALUE_DOUBLE
,
4930 BASEPROPERTY_ENFORCE_FORMAT
,
4931 BASEPROPERTY_HIDEINACTIVESELECTION
,
4932 BASEPROPERTY_WRITING_MODE
,
4933 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4935 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4938 VCLXNumericField::VCLXNumericField()
4942 VCLXNumericField::~VCLXNumericField()
4946 // ::com::sun::star::uno::XInterface
4947 ::com::sun::star::uno::Any
VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
4949 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
4950 SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField
*, this ) );
4951 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
4954 // ::com::sun::star::lang::XTypeProvider
4955 IMPL_XTYPEPROVIDER_START( VCLXNumericField
)
4956 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XNumericField
>* ) NULL
),
4957 VCLXFormattedSpinField::getTypes()
4958 IMPL_XTYPEPROVIDER_END
4960 void VCLXNumericField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
4962 ::vos::OGuard
aGuard( GetMutex() );
4964 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
4965 if ( pNumericFormatter
)
4967 // z.B. 105, 2 Digits => 1,05
4968 // ein float 1,05 muss also eine 105 einstellen...
4969 pNumericFormatter
->SetValue(
4970 (long)ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() ) );
4972 // #107218# Call same listeners like VCL would do after user interaction
4973 Edit
* pEdit
= (Edit
*)GetWindow();
4976 SetSynthesizingVCLEvent( sal_True
);
4977 pEdit
->SetModifyFlag();
4979 SetSynthesizingVCLEvent( sal_False
);
4984 double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException
)
4986 ::vos::OGuard
aGuard( GetMutex() );
4988 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
4989 return pNumericFormatter
4990 ? ImplCalcDoubleValue( (double)pNumericFormatter
->GetValue(), pNumericFormatter
->GetDecimalDigits() )
4994 void VCLXNumericField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
4996 ::vos::OGuard
aGuard( GetMutex() );
4998 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
4999 if ( pNumericFormatter
)
5000 pNumericFormatter
->SetMin(
5001 (long)ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() ) );
5004 double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException
)
5006 ::vos::OGuard
aGuard( GetMutex() );
5008 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5009 return pNumericFormatter
5010 ? ImplCalcDoubleValue( (double)pNumericFormatter
->GetMin(), pNumericFormatter
->GetDecimalDigits() )
5014 void VCLXNumericField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5016 ::vos::OGuard
aGuard( GetMutex() );
5018 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5019 if ( pNumericFormatter
)
5020 pNumericFormatter
->SetMax(
5021 (long)ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() ) );
5024 double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException
)
5026 ::vos::OGuard
aGuard( GetMutex() );
5028 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5029 return pNumericFormatter
5030 ? ImplCalcDoubleValue( (double)pNumericFormatter
->GetMax(), pNumericFormatter
->GetDecimalDigits() )
5034 void VCLXNumericField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5036 ::vos::OGuard
aGuard( GetMutex() );
5038 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5039 if ( pNumericField
)
5040 pNumericField
->SetFirst(
5041 (long)ImplCalcLongValue( Value
, pNumericField
->GetDecimalDigits() ) );
5044 double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
5046 ::vos::OGuard
aGuard( GetMutex() );
5048 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5049 return pNumericField
5050 ? ImplCalcDoubleValue( (double)pNumericField
->GetFirst(), pNumericField
->GetDecimalDigits() )
5054 void VCLXNumericField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5056 ::vos::OGuard
aGuard( GetMutex() );
5058 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5059 if ( pNumericField
)
5060 pNumericField
->SetLast(
5061 (long)ImplCalcLongValue( Value
, pNumericField
->GetDecimalDigits() ) );
5064 double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
)
5066 ::vos::OGuard
aGuard( GetMutex() );
5068 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5069 return pNumericField
5070 ? ImplCalcDoubleValue( (double)pNumericField
->GetLast(), pNumericField
->GetDecimalDigits() )
5074 void VCLXNumericField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5076 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5079 sal_Bool
VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5081 return VCLXFormattedSpinField::isStrictFormat();
5085 void VCLXNumericField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5087 ::vos::OGuard
aGuard( GetMutex() );
5089 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5090 if ( pNumericField
)
5091 pNumericField
->SetSpinSize(
5092 (long)ImplCalcLongValue( Value
, pNumericField
->GetDecimalDigits() ) );
5095 double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
5097 ::vos::OGuard
aGuard( GetMutex() );
5099 NumericField
* pNumericField
= (NumericField
*) GetWindow();
5100 return pNumericField
5101 ? ImplCalcDoubleValue( (double)pNumericField
->GetSpinSize(), pNumericField
->GetDecimalDigits() )
5105 void VCLXNumericField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
5107 ::vos::OGuard
aGuard( GetMutex() );
5109 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5110 if ( pNumericFormatter
)
5112 double n
= getValue();
5113 pNumericFormatter
->SetDecimalDigits( Value
);
5118 sal_Int16
VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
5120 ::vos::OGuard
aGuard( GetMutex() );
5122 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5123 return pNumericFormatter
? pNumericFormatter
->GetDecimalDigits() : 0;
5126 void VCLXNumericField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5128 ::vos::OGuard
aGuard( GetMutex() );
5132 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
5134 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5135 switch ( nPropType
)
5137 case BASEPROPERTY_VALUE_DOUBLE
:
5141 ((NumericField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
5142 ((NumericField
*)GetWindow())->SetEmptyFieldValue();
5152 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5159 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5166 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5173 case BASEPROPERTY_DECIMALACCURACY
:
5175 sal_Int16 n
= sal_Int16();
5177 setDecimalDigits( n
);
5180 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5182 sal_Bool b
= sal_Bool();
5184 ((NumericField
*)GetWindow())->SetUseThousandSep( b
);
5189 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5195 ::com::sun::star::uno::Any
VCLXNumericField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5197 ::vos::OGuard
aGuard( GetMutex() );
5199 ::com::sun::star::uno::Any aProp
;
5200 FormatterBase
* pFormatter
= GetFormatter();
5203 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5204 switch ( nPropType
)
5206 case BASEPROPERTY_VALUE_DOUBLE
:
5208 aProp
<<= (double) getValue();
5211 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5213 aProp
<<= (double) getMin();
5216 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5218 aProp
<<= (double) getMax();
5221 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5223 aProp
<<= (double) getSpinSize();
5226 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5228 aProp
<<= (sal_Bool
) ((NumericField
*)GetWindow())->IsUseThousandSep();
5233 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
5241 // ----------------------------------------------------
5242 // class VCLXMetricField
5243 // ----------------------------------------------------
5245 void VCLXMetricField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
5247 PushPropertyIds( rIds
,
5249 BASEPROPERTY_BACKGROUNDCOLOR
,
5250 BASEPROPERTY_BORDER
,
5251 BASEPROPERTY_BORDERCOLOR
,
5252 BASEPROPERTY_DECIMALACCURACY
,
5253 BASEPROPERTY_DEFAULTCONTROL
,
5254 BASEPROPERTY_ENABLED
,
5255 BASEPROPERTY_ENABLEVISIBLE
,
5256 BASEPROPERTY_FONTDESCRIPTOR
,
5257 BASEPROPERTY_HELPTEXT
,
5258 BASEPROPERTY_HELPURL
,
5259 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
5260 BASEPROPERTY_PRINTABLE
,
5261 BASEPROPERTY_READONLY
,
5262 BASEPROPERTY_REPEAT
,
5263 BASEPROPERTY_REPEAT_DELAY
,
5265 BASEPROPERTY_STRICTFORMAT
,
5266 BASEPROPERTY_TABSTOP
,
5267 BASEPROPERTY_ENFORCE_FORMAT
,
5268 BASEPROPERTY_HIDEINACTIVESELECTION
,
5270 BASEPROPERTY_CUSTOMUNITTEXT
,
5271 BASEPROPERTY_WRITING_MODE
,
5272 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5274 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5277 VCLXMetricField::VCLXMetricField()
5281 VCLXMetricField::~VCLXMetricField()
5285 MetricFormatter
*VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException
)
5287 MetricFormatter
*pFormatter
= (MetricFormatter
*) GetFormatter();
5289 throw ::com::sun::star::uno::RuntimeException();
5293 MetricField
*VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException
)
5295 MetricField
*pField
= (MetricField
*) GetWindow();
5297 throw ::com::sun::star::uno::RuntimeException();
5301 // ::com::sun::star::uno::XInterface
5302 ::com::sun::star::uno::Any
VCLXMetricField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
5304 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5305 SAL_STATIC_CAST( ::com::sun::star::awt::XMetricField
*, this ) );
5306 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5309 // ::com::sun::star::lang::XTypeProvider
5310 IMPL_XTYPEPROVIDER_START( VCLXMetricField
)
5311 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XMetricField
>* ) NULL
),
5312 VCLXFormattedSpinField::getTypes()
5313 IMPL_XTYPEPROVIDER_END
5316 #define MetricUnitUnoToVcl(a) ((FieldUnit)(a))
5318 #define METRIC_MAP_PAIR(method,parent) \
5319 sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5321 ::vos::OGuard aGuard( GetMutex() ); \
5322 return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
5324 void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
5326 ::vos::OGuard aGuard( GetMutex() ); \
5327 GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
5330 METRIC_MAP_PAIR(Min
, Formatter
)
5331 METRIC_MAP_PAIR(Max
, Formatter
)
5332 METRIC_MAP_PAIR(First
, Field
)
5333 METRIC_MAP_PAIR(Last
, Field
)
5335 #undef METRIC_MAP_PAIR
5337 ::sal_Int64
VCLXMetricField::getValue( ::sal_Int16 nUnit
) throw (::com::sun::star::uno::RuntimeException
)
5339 ::vos::OGuard
aGuard( GetMutex() );
5340 return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit
) );
5343 ::sal_Int64
VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit
) throw (::com::sun::star::uno::RuntimeException
)
5345 ::vos::OGuard
aGuard( GetMutex() );
5346 return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit
) );
5349 // FIXME: acute cut/paste evilness - move this to the parent Edit class ?
5350 void VCLXMetricField::CallListeners()
5352 // #107218# Call same listeners like VCL would do after user interaction
5353 Edit
* pEdit
= (Edit
*)GetWindow();
5356 SetSynthesizingVCLEvent( sal_True
);
5357 pEdit
->SetModifyFlag();
5359 SetSynthesizingVCLEvent( sal_False
);
5363 void VCLXMetricField::setValue( ::sal_Int64 Value
, ::sal_Int16 Unit
) throw (::com::sun::star::uno::RuntimeException
)
5365 ::vos::OGuard
aGuard( GetMutex() );
5366 GetMetricFormatter()->SetValue( Value
, MetricUnitUnoToVcl( Unit
) );
5370 void VCLXMetricField::setUserValue( ::sal_Int64 Value
, ::sal_Int16 Unit
) throw (::com::sun::star::uno::RuntimeException
)
5372 ::vos::OGuard
aGuard( GetMutex() );
5373 GetMetricFormatter()->SetUserValue( Value
, MetricUnitUnoToVcl( Unit
) );
5377 void VCLXMetricField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5379 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5382 sal_Bool
VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5384 return VCLXFormattedSpinField::isStrictFormat();
5387 void VCLXMetricField::setSpinSize( sal_Int64 Value
) throw(::com::sun::star::uno::RuntimeException
)
5389 ::vos::OGuard
aGuard( GetMutex() );
5390 GetMetricField()->SetSpinSize( Value
);
5393 sal_Int64
VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
5395 ::vos::OGuard
aGuard( GetMutex() );
5396 return GetMetricField()->GetSpinSize();
5399 void VCLXMetricField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
5401 ::vos::OGuard
aGuard( GetMutex() );
5402 GetMetricFormatter()->SetDecimalDigits( Value
);
5405 sal_Int16
VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
5407 ::vos::OGuard
aGuard( GetMutex() );
5409 NumericFormatter
* pNumericFormatter
= (NumericFormatter
*) GetFormatter();
5410 return pNumericFormatter
? pNumericFormatter
->GetDecimalDigits() : 0;
5413 void VCLXMetricField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5415 ::vos::OGuard
aGuard( GetMutex() );
5419 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5420 switch ( nPropType
)
5422 case BASEPROPERTY_DECIMALACCURACY
:
5426 setDecimalDigits( n
);
5429 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5431 sal_Bool b
= sal_False
;
5433 ((NumericField
*)GetWindow())->SetUseThousandSep( b
);
5436 case BASEPROPERTY_UNIT
:
5438 sal_uInt16 nVal
= 0;
5439 if ( Value
>>= nVal
)
5440 ((MetricField
*)GetWindow())->SetUnit( (FieldUnit
) nVal
);
5443 case BASEPROPERTY_CUSTOMUNITTEXT
:
5446 if ( Value
>>= aStr
)
5447 ((MetricField
*)GetWindow())->SetCustomUnitText( aStr
);
5452 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5459 ::com::sun::star::uno::Any
VCLXMetricField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5461 ::vos::OGuard
aGuard( GetMutex() );
5463 ::com::sun::star::uno::Any aProp
;
5464 FormatterBase
* pFormatter
= GetFormatter();
5467 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5468 switch ( nPropType
)
5470 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5471 aProp
<<= (sal_Bool
) ((NumericField
*)GetWindow())->IsUseThousandSep();
5473 case BASEPROPERTY_UNIT
:
5474 aProp
<<= (sal_uInt16
) ((MetricField
*)GetWindow())->GetUnit();
5476 case BASEPROPERTY_CUSTOMUNITTEXT
:
5477 aProp
<<= rtl::OUString (((MetricField
*)GetWindow())->GetCustomUnitText());
5481 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
5490 // ----------------------------------------------------
5491 // class VCLXCurrencyField
5492 // ----------------------------------------------------
5494 void VCLXCurrencyField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
5496 PushPropertyIds( rIds
,
5498 BASEPROPERTY_BACKGROUNDCOLOR
,
5499 BASEPROPERTY_BORDER
,
5500 BASEPROPERTY_BORDERCOLOR
,
5501 BASEPROPERTY_CURRENCYSYMBOL
,
5502 BASEPROPERTY_CURSYM_POSITION
,
5503 BASEPROPERTY_DECIMALACCURACY
,
5504 BASEPROPERTY_DEFAULTCONTROL
,
5505 BASEPROPERTY_ENABLED
,
5506 BASEPROPERTY_ENABLEVISIBLE
,
5507 BASEPROPERTY_FONTDESCRIPTOR
,
5508 BASEPROPERTY_HELPTEXT
,
5509 BASEPROPERTY_HELPURL
,
5510 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
5511 BASEPROPERTY_PRINTABLE
,
5512 BASEPROPERTY_READONLY
,
5513 BASEPROPERTY_REPEAT
,
5514 BASEPROPERTY_REPEAT_DELAY
,
5516 BASEPROPERTY_STRICTFORMAT
,
5517 BASEPROPERTY_TABSTOP
,
5518 BASEPROPERTY_VALUEMAX_DOUBLE
,
5519 BASEPROPERTY_VALUEMIN_DOUBLE
,
5520 BASEPROPERTY_VALUESTEP_DOUBLE
,
5521 BASEPROPERTY_VALUE_DOUBLE
,
5522 BASEPROPERTY_ENFORCE_FORMAT
,
5523 BASEPROPERTY_HIDEINACTIVESELECTION
,
5524 BASEPROPERTY_WRITING_MODE
,
5525 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5527 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5530 VCLXCurrencyField::VCLXCurrencyField()
5534 VCLXCurrencyField::~VCLXCurrencyField()
5538 // ::com::sun::star::uno::XInterface
5539 ::com::sun::star::uno::Any
VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
5541 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5542 SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField
*, this ) );
5543 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5546 // ::com::sun::star::lang::XTypeProvider
5547 IMPL_XTYPEPROVIDER_START( VCLXCurrencyField
)
5548 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XCurrencyField
>* ) NULL
),
5549 VCLXFormattedSpinField::getTypes()
5550 IMPL_XTYPEPROVIDER_END
5552 void VCLXCurrencyField::setValue( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5554 ::vos::OGuard
aGuard( GetMutex() );
5556 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5557 if ( pCurrencyFormatter
)
5559 // z.B. 105, 2 Digits => 1,05
5560 // ein float 1,05 muss also eine 105 einstellen...
5561 pCurrencyFormatter
->SetValue(
5562 ImplCalcLongValue( Value
, pCurrencyFormatter
->GetDecimalDigits() ) );
5564 // #107218# Call same listeners like VCL would do after user interaction
5565 Edit
* pEdit
= (Edit
*)GetWindow();
5568 SetSynthesizingVCLEvent( sal_True
);
5569 pEdit
->SetModifyFlag();
5571 SetSynthesizingVCLEvent( sal_False
);
5576 double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException
)
5578 ::vos::OGuard
aGuard( GetMutex() );
5580 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5581 return pCurrencyFormatter
5582 ? ImplCalcDoubleValue( (double)pCurrencyFormatter
->GetValue(), pCurrencyFormatter
->GetDecimalDigits() )
5586 void VCLXCurrencyField::setMin( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5588 ::vos::OGuard
aGuard( GetMutex() );
5590 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5591 if ( pCurrencyFormatter
)
5592 pCurrencyFormatter
->SetMin(
5593 ImplCalcLongValue( Value
, pCurrencyFormatter
->GetDecimalDigits() ) );
5596 double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
)
5598 ::vos::OGuard
aGuard( GetMutex() );
5600 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5601 return pCurrencyFormatter
5602 ? ImplCalcDoubleValue( (double)pCurrencyFormatter
->GetMin(), pCurrencyFormatter
->GetDecimalDigits() )
5606 void VCLXCurrencyField::setMax( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5608 ::vos::OGuard
aGuard( GetMutex() );
5610 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5611 if ( pCurrencyFormatter
)
5612 pCurrencyFormatter
->SetMax(
5613 ImplCalcLongValue( Value
, pCurrencyFormatter
->GetDecimalDigits() ) );
5616 double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
)
5618 ::vos::OGuard
aGuard( GetMutex() );
5620 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5621 return pCurrencyFormatter
5622 ? ImplCalcDoubleValue( (double)pCurrencyFormatter
->GetMax(), pCurrencyFormatter
->GetDecimalDigits() )
5626 void VCLXCurrencyField::setFirst( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5628 ::vos::OGuard
aGuard( GetMutex() );
5630 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5631 if ( pCurrencyField
)
5632 pCurrencyField
->SetFirst(
5633 ImplCalcLongValue( Value
, pCurrencyField
->GetDecimalDigits() ) );
5636 double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException
)
5638 ::vos::OGuard
aGuard( GetMutex() );
5640 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5641 return pCurrencyField
5642 ? ImplCalcDoubleValue( (double)pCurrencyField
->GetFirst(), pCurrencyField
->GetDecimalDigits() )
5646 void VCLXCurrencyField::setLast( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5648 ::vos::OGuard
aGuard( GetMutex() );
5650 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5651 if ( pCurrencyField
)
5652 pCurrencyField
->SetLast(
5653 ImplCalcLongValue( Value
, pCurrencyField
->GetDecimalDigits() ) );
5656 double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException
)
5658 ::vos::OGuard
aGuard( GetMutex() );
5660 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5661 return pCurrencyField
5662 ? ImplCalcDoubleValue( (double)pCurrencyField
->GetLast(), pCurrencyField
->GetDecimalDigits() )
5666 void VCLXCurrencyField::setSpinSize( double Value
) throw(::com::sun::star::uno::RuntimeException
)
5668 ::vos::OGuard
aGuard( GetMutex() );
5670 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5671 if ( pCurrencyField
)
5672 pCurrencyField
->SetSpinSize(
5673 ImplCalcLongValue( Value
, pCurrencyField
->GetDecimalDigits() ) );
5676 double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException
)
5678 ::vos::OGuard
aGuard( GetMutex() );
5680 LongCurrencyField
* pCurrencyField
= (LongCurrencyField
*) GetWindow();
5681 return pCurrencyField
5682 ? ImplCalcDoubleValue( (double)pCurrencyField
->GetSpinSize(), pCurrencyField
->GetDecimalDigits() )
5686 void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5688 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5691 sal_Bool
VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5693 return VCLXFormattedSpinField::isStrictFormat();
5697 void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value
) throw(::com::sun::star::uno::RuntimeException
)
5699 ::vos::OGuard
aGuard( GetMutex() );
5701 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5702 if ( pCurrencyFormatter
)
5704 double n
= getValue();
5705 pCurrencyFormatter
->SetDecimalDigits( Value
);
5710 sal_Int16
VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException
)
5712 ::vos::OGuard
aGuard( GetMutex() );
5714 LongCurrencyFormatter
* pCurrencyFormatter
= (LongCurrencyFormatter
*) GetFormatter();
5715 return pCurrencyFormatter
? pCurrencyFormatter
->GetDecimalDigits() : 0;
5718 void VCLXCurrencyField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5720 ::vos::OGuard
aGuard( GetMutex() );
5724 sal_Bool bVoid
= Value
.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID
;
5726 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5727 switch ( nPropType
)
5729 case BASEPROPERTY_VALUE_DOUBLE
:
5733 ((LongCurrencyField
*)GetWindow())->EnableEmptyFieldValue( sal_True
);
5734 ((LongCurrencyField
*)GetWindow())->SetEmptyFieldValue();
5744 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5751 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5758 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5765 case BASEPROPERTY_DECIMALACCURACY
:
5767 sal_Int16 n
= sal_Int16();
5769 setDecimalDigits( n
);
5772 case BASEPROPERTY_CURRENCYSYMBOL
:
5774 ::rtl::OUString aString
;
5775 if ( Value
>>= aString
)
5776 ((LongCurrencyField
*)GetWindow())->SetCurrencySymbol( aString
);
5779 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5781 sal_Bool b
= sal_Bool();
5783 ((LongCurrencyField
*)GetWindow())->SetUseThousandSep( b
);
5788 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5794 ::com::sun::star::uno::Any
VCLXCurrencyField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5796 ::vos::OGuard
aGuard( GetMutex() );
5798 ::com::sun::star::uno::Any aProp
;
5799 FormatterBase
* pFormatter
= GetFormatter();
5802 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5803 switch ( nPropType
)
5805 case BASEPROPERTY_VALUE_DOUBLE
:
5807 aProp
<<= (double) getValue();
5810 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5812 aProp
<<= (double) getMin();
5815 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5817 aProp
<<= (double) getMax();
5820 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5822 aProp
<<= (double) getSpinSize();
5825 case BASEPROPERTY_CURRENCYSYMBOL
:
5827 aProp
<<= ::rtl::OUString( ((LongCurrencyField
*)GetWindow())->GetCurrencySymbol() );
5830 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5832 aProp
<<= (sal_Bool
) ((LongCurrencyField
*)GetWindow())->IsUseThousandSep();
5837 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
5844 // ----------------------------------------------------
5845 // class VCLXPatternField
5846 // ----------------------------------------------------
5848 void VCLXPatternField::ImplGetPropertyIds( std::list
< sal_uInt16
> &rIds
)
5850 PushPropertyIds( rIds
,
5852 BASEPROPERTY_BACKGROUNDCOLOR
,
5853 BASEPROPERTY_BORDER
,
5854 BASEPROPERTY_BORDERCOLOR
,
5855 BASEPROPERTY_DEFAULTCONTROL
,
5856 BASEPROPERTY_EDITMASK
,
5857 BASEPROPERTY_ENABLED
,
5858 BASEPROPERTY_ENABLEVISIBLE
,
5859 BASEPROPERTY_FONTDESCRIPTOR
,
5860 BASEPROPERTY_HELPTEXT
,
5861 BASEPROPERTY_HELPURL
,
5862 BASEPROPERTY_LITERALMASK
,
5863 BASEPROPERTY_MAXTEXTLEN
,
5864 BASEPROPERTY_PRINTABLE
,
5865 BASEPROPERTY_READONLY
,
5866 BASEPROPERTY_STRICTFORMAT
,
5867 BASEPROPERTY_TABSTOP
,
5869 BASEPROPERTY_HIDEINACTIVESELECTION
,
5870 BASEPROPERTY_WRITING_MODE
,
5871 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5873 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5876 VCLXPatternField::VCLXPatternField()
5880 VCLXPatternField::~VCLXPatternField()
5884 // ::com::sun::star::uno::XInterface
5885 ::com::sun::star::uno::Any
VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
5887 ::com::sun::star::uno::Any aRet
= ::cppu::queryInterface( rType
,
5888 SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField
*, this ) );
5889 return (aRet
.hasValue() ? aRet
: VCLXFormattedSpinField::queryInterface( rType
));
5892 // ::com::sun::star::lang::XTypeProvider
5893 IMPL_XTYPEPROVIDER_START( VCLXPatternField
)
5894 getCppuType( ( ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XPatternField
>* ) NULL
),
5895 VCLXFormattedSpinField::getTypes()
5896 IMPL_XTYPEPROVIDER_END
5898 void VCLXPatternField::setMasks( const ::rtl::OUString
& EditMask
, const ::rtl::OUString
& LiteralMask
) throw(::com::sun::star::uno::RuntimeException
)
5900 ::vos::OGuard
aGuard( GetMutex() );
5902 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5903 if ( pPatternField
)
5905 pPatternField
->SetMask( ByteString( UniString( EditMask
), RTL_TEXTENCODING_ASCII_US
), LiteralMask
);
5909 void VCLXPatternField::getMasks( ::rtl::OUString
& EditMask
, ::rtl::OUString
& LiteralMask
) throw(::com::sun::star::uno::RuntimeException
)
5911 ::vos::OGuard
aGuard( GetMutex() );
5913 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5914 if ( pPatternField
)
5916 EditMask
= String( pPatternField
->GetEditMask(), RTL_TEXTENCODING_ASCII_US
);
5917 LiteralMask
= pPatternField
->GetLiteralMask();
5921 void VCLXPatternField::setString( const ::rtl::OUString
& Str
) throw(::com::sun::star::uno::RuntimeException
)
5923 ::vos::OGuard
aGuard( GetMutex() );
5925 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5926 if ( pPatternField
)
5928 pPatternField
->SetString( Str
);
5932 ::rtl::OUString
VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException
)
5934 ::vos::OGuard
aGuard( GetMutex() );
5936 ::rtl::OUString aString
;
5937 PatternField
* pPatternField
= (PatternField
*) GetWindow();
5938 if ( pPatternField
)
5939 aString
= pPatternField
->GetString();
5943 void VCLXPatternField::setStrictFormat( sal_Bool bStrict
) throw(::com::sun::star::uno::RuntimeException
)
5945 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5948 sal_Bool
VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException
)
5950 return VCLXFormattedSpinField::isStrictFormat();
5953 void VCLXPatternField::setProperty( const ::rtl::OUString
& PropertyName
, const ::com::sun::star::uno::Any
& Value
) throw(::com::sun::star::uno::RuntimeException
)
5955 ::vos::OGuard
aGuard( GetMutex() );
5959 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5960 switch ( nPropType
)
5962 case BASEPROPERTY_EDITMASK
:
5963 case BASEPROPERTY_LITERALMASK
:
5965 ::rtl::OUString aString
;
5966 if ( Value
>>= aString
)
5968 ::rtl::OUString aEditMask
, aLiteralMask
;
5969 getMasks( aEditMask
, aLiteralMask
);
5970 if ( nPropType
== BASEPROPERTY_EDITMASK
)
5971 aEditMask
= aString
;
5973 aLiteralMask
= aString
;
5974 setMasks( aEditMask
, aLiteralMask
);
5980 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5986 ::com::sun::star::uno::Any
VCLXPatternField::getProperty( const ::rtl::OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
)
5988 ::vos::OGuard
aGuard( GetMutex() );
5990 ::com::sun::star::uno::Any aProp
;
5993 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5994 switch ( nPropType
)
5996 case BASEPROPERTY_EDITMASK
:
5997 case BASEPROPERTY_LITERALMASK
:
5999 ::rtl::OUString aEditMask
, aLiteralMask
;
6000 getMasks( aEditMask
, aLiteralMask
);
6001 if ( nPropType
== BASEPROPERTY_EDITMASK
)
6002 aProp
<<= aEditMask
;
6004 aProp
<<= aLiteralMask
;
6009 aProp
<<= VCLXFormattedSpinField::getProperty( PropertyName
);
6016 // ----------------------------------------------------
6017 // class VCLXToolBox
6018 // ----------------------------------------------------
6019 VCLXToolBox::VCLXToolBox()
6023 VCLXToolBox::~VCLXToolBox()
6027 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> VCLXToolBox::CreateAccessibleContext()
6029 return getAccessibleFactory().createAccessibleContext( this );