1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <toolkit/awt/vclxwindows.hxx>
21 #include <toolkit/helper/accessiblefactory.hxx>
22 #include <com/sun/star/awt/LineEndFormat.hpp>
23 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
24 #include <com/sun/star/graphic/GraphicProvider.hpp>
25 #include <com/sun/star/graphic/XGraphicProvider.hpp>
26 #include <toolkit/helper/vclunohelper.hxx>
27 #include <helper/property.hxx>
28 #include <toolkit/helper/convert.hxx>
29 #include <com/sun/star/awt/VisualEffect.hpp>
30 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
31 #include <com/sun/star/resource/XStringResourceResolver.hpp>
32 #include <com/sun/star/awt/ImageScaleMode.hpp>
33 #include <com/sun/star/awt/XItemList.hpp>
34 #include <com/sun/star/awt/TextAlign.hpp>
35 #include <comphelper/namedvaluecollection.hxx>
36 #include <comphelper/processfactory.hxx>
37 #include <sal/log.hxx>
39 #include <awt/vclxwindows.hxx>
40 #include <controls/filectrl.hxx>
41 #include <controls/svmedit.hxx>
42 #include <vcl/toolkit/button.hxx>
43 #include <vcl/toolkit/fmtfield.hxx>
44 #include <vcl/graph.hxx>
45 #include <vcl/toolkit/lstbox.hxx>
46 #include <vcl/toolkit/combobox.hxx>
47 #include <vcl/toolkit/field.hxx>
48 #include <vcl/toolkit/fixedhyper.hxx>
49 #include <vcl/toolkit/imgctrl.hxx>
50 #include <vcl/toolkit/dialog.hxx>
51 #include <vcl/toolkit/prgsbar.hxx>
52 #include <vcl/toolkit/scrbar.hxx>
53 #include <vcl/svapp.hxx>
54 #include <vcl/tabpage.hxx>
55 #include <vcl/tabctrl.hxx>
56 #include <vcl/settings.hxx>
57 #include <comphelper/diagnose_ex.hxx>
58 #include <tools/debug.hxx>
60 #include <helper/imagealign.hxx>
61 #include <helper/msgbox.hxx>
62 #include <helper/tkresmgr.hxx>
63 #include "vclxwindows_internal.hxx"
64 #include <svl/numformat.hxx>
66 using ::com::sun::star::uno::Any
;
67 using ::com::sun::star::uno::Reference
;
68 using ::com::sun::star::uno::RuntimeException
;
69 using ::com::sun::star::lang::EventObject
;
70 using ::com::sun::star::awt::ItemListEvent
;
71 using ::com::sun::star::awt::XItemList
;
72 using ::com::sun::star::graphic::XGraphic
;
73 using ::com::sun::star::graphic::XGraphicProvider
;
75 using namespace ::com::sun::star
;
76 using namespace ::com::sun::star::awt::VisualEffect
;
77 namespace ImageScaleMode
= ::com::sun::star::awt::ImageScaleMode
;
79 static double ImplCalcLongValue( double nValue
, sal_uInt16 nDigits
)
82 for ( sal_uInt16 d
= 0; d
< nDigits
; d
++ )
87 static double ImplCalcDoubleValue( double nValue
, sal_uInt16 nDigits
)
90 for ( sal_uInt16 d
= 0; d
< nDigits
; d
++ )
97 /** sets the "face color" for button like controls (scroll bar, spin button)
99 void setButtonLikeFaceColor( vcl::Window
* _pWindow
, const css::uno::Any
& _rColorValue
)
101 AllSettings aSettings
= _pWindow
->GetSettings();
102 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
104 if ( !_rColorValue
.hasValue() )
106 const StyleSettings
& aAppStyle
= Application::GetSettings().GetStyleSettings();
107 aStyleSettings
.SetFaceColor( aAppStyle
.GetFaceColor( ) );
108 aStyleSettings
.SetCheckedColor( aAppStyle
.GetCheckedColor( ) );
109 aStyleSettings
.SetLightBorderColor( aAppStyle
.GetLightBorderColor() );
110 aStyleSettings
.SetLightColor( aAppStyle
.GetLightColor() );
111 aStyleSettings
.SetShadowColor( aAppStyle
.GetShadowColor() );
112 aStyleSettings
.SetDarkShadowColor( aAppStyle
.GetDarkShadowColor() );
116 Color nBackgroundColor
;
117 _rColorValue
>>= nBackgroundColor
;
118 aStyleSettings
.SetFaceColor( nBackgroundColor
);
120 // for the real background (everything except the buttons and the thumb),
121 // use an average between the desired color and "white"
122 Color
aWhite( COL_WHITE
);
123 Color
aCheckedBackground( nBackgroundColor
);
124 aCheckedBackground
.SetRed( ( aCheckedBackground
.GetRed() + aWhite
.GetRed() ) / 2 );
125 aCheckedBackground
.SetGreen( ( aCheckedBackground
.GetGreen() + aWhite
.GetGreen() ) / 2 );
126 aCheckedBackground
.SetBlue( ( aCheckedBackground
.GetBlue() + aWhite
.GetBlue() ) / 2 );
127 aStyleSettings
.SetCheckedColor( aCheckedBackground
);
129 sal_Int32 nBackgroundLuminance
= nBackgroundColor
.GetLuminance();
130 sal_Int32 nWhiteLuminance
= COL_WHITE
.GetLuminance();
132 Color
aLightShadow( nBackgroundColor
);
133 aLightShadow
.IncreaseLuminance( static_cast<sal_uInt8
>( ( nWhiteLuminance
- nBackgroundLuminance
) * 2 / 3 ) );
134 aStyleSettings
.SetLightBorderColor( aLightShadow
);
136 Color
aLight( nBackgroundColor
);
137 aLight
.IncreaseLuminance( static_cast<sal_uInt8
>( ( nWhiteLuminance
- nBackgroundLuminance
) * 1 / 3 ) );
138 aStyleSettings
.SetLightColor( aLight
);
140 Color
aShadow( nBackgroundColor
);
141 aShadow
.DecreaseLuminance( static_cast<sal_uInt8
>( nBackgroundLuminance
* 1 / 3 ) );
142 aStyleSettings
.SetShadowColor( aShadow
);
144 Color
aDarkShadow( nBackgroundColor
);
145 aDarkShadow
.DecreaseLuminance( static_cast<sal_uInt8
>( nBackgroundLuminance
* 2 / 3 ) );
146 aStyleSettings
.SetDarkShadowColor( aDarkShadow
);
149 aSettings
.SetStyleSettings( aStyleSettings
);
150 _pWindow
->SetSettings( aSettings
, true );
153 Any
getButtonLikeFaceColor( const vcl::Window
* _pWindow
)
155 Color nBackgroundColor
= _pWindow
->GetSettings().GetStyleSettings().GetFaceColor();
156 return Any( sal_Int32(nBackgroundColor
) );
159 static void adjustBooleanWindowStyle( const Any
& _rValue
, vcl::Window
* _pWindow
, WinBits _nBits
, bool _bInverseSemantics
)
161 WinBits nStyle
= _pWindow
->GetStyle();
162 bool bValue( false );
163 OSL_VERIFY( _rValue
>>= bValue
);
164 if ( bValue
!= _bInverseSemantics
)
168 _pWindow
->SetStyle( nStyle
);
171 static void setVisualEffect( const Any
& _rValue
, vcl::Window
* _pWindow
)
173 AllSettings aSettings
= _pWindow
->GetSettings();
174 StyleSettings aStyleSettings
= aSettings
.GetStyleSettings();
176 sal_Int16 nStyle
= LOOK3D
;
177 OSL_VERIFY( _rValue
>>= nStyle
);
181 aStyleSettings
.SetOptions( aStyleSettings
.GetOptions() | StyleSettingsOptions::Mono
);
185 aStyleSettings
.SetOptions( aStyleSettings
.GetOptions() & ~StyleSettingsOptions::Mono
);
187 aSettings
.SetStyleSettings( aStyleSettings
);
188 _pWindow
->SetSettings( aSettings
);
191 static Any
getVisualEffect( vcl::Window
const * _pWindow
)
195 StyleSettings aStyleSettings
= _pWindow
->GetSettings().GetStyleSettings();
196 if ( aStyleSettings
.GetOptions() & StyleSettingsOptions::Mono
)
197 aEffect
<<= sal_Int16(FLAT
);
199 aEffect
<<= sal_Int16(LOOK3D
);
207 void VCLXGraphicControl::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
209 VCLXWindow::ImplGetPropertyIds( rIds
);
212 void VCLXGraphicControl::ImplSetNewImage()
214 OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
215 VclPtr
< Button
> pButton
= GetAsDynamic
< Button
>();
216 pButton
->SetModeImage( GetImage() );
219 void VCLXGraphicControl::setPosSize( sal_Int32 X
, sal_Int32 Y
, sal_Int32 Width
, sal_Int32 Height
, sal_Int16 Flags
)
221 SolarMutexGuard aGuard
;
225 Size aOldSize
= GetWindow()->GetSizePixel();
226 VCLXWindow::setPosSize( X
, Y
, Width
, Height
, Flags
);
227 if ( ( aOldSize
.Width() != Width
) || ( aOldSize
.Height() != Height
) )
232 void VCLXGraphicControl::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
234 SolarMutexGuard aGuard
;
239 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
242 case BASEPROPERTY_GRAPHIC
:
244 Reference
< XGraphic
> xGraphic
;
245 OSL_VERIFY( Value
>>= xGraphic
);
246 maImage
= Image( xGraphic
);
251 case BASEPROPERTY_IMAGEALIGN
:
253 WindowType eType
= GetWindow()->GetType();
254 if ( ( eType
== WindowType::PUSHBUTTON
)
255 || ( eType
== WindowType::RADIOBUTTON
)
256 || ( eType
== WindowType::CHECKBOX
)
259 sal_Int16 nAlignment
= sal_Int16();
260 if ( Value
>>= nAlignment
)
261 GetAs
< Button
>()->SetImageAlign( static_cast< ImageAlign
>( nAlignment
) );
265 case BASEPROPERTY_IMAGEPOSITION
:
267 WindowType eType
= GetWindow()->GetType();
268 if ( ( eType
== WindowType::PUSHBUTTON
)
269 || ( eType
== WindowType::RADIOBUTTON
)
270 || ( eType
== WindowType::CHECKBOX
)
273 sal_Int16 nImagePosition
= 2;
274 OSL_VERIFY( Value
>>= nImagePosition
);
275 GetAs
<Button
>()->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition
) );
280 VCLXWindow::setProperty( PropertyName
, Value
);
285 css::uno::Any
VCLXGraphicControl::getProperty( const OUString
& PropertyName
)
287 SolarMutexGuard aGuard
;
293 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
296 case BASEPROPERTY_GRAPHIC
:
297 aProp
<<= Graphic(maImage
.GetBitmapEx()).GetXGraphic();
299 case BASEPROPERTY_IMAGEALIGN
:
301 WindowType eType
= GetWindow()->GetType();
302 if ( ( eType
== WindowType::PUSHBUTTON
)
303 || ( eType
== WindowType::RADIOBUTTON
)
304 || ( eType
== WindowType::CHECKBOX
)
307 aProp
<<= ::toolkit::getCompatibleImageAlign(
308 GetAs
<Button
>()->GetImageAlign() );
312 case BASEPROPERTY_IMAGEPOSITION
:
314 WindowType eType
= GetWindow()->GetType();
315 if ( ( eType
== WindowType::PUSHBUTTON
)
316 || ( eType
== WindowType::RADIOBUTTON
)
317 || ( eType
== WindowType::CHECKBOX
)
320 aProp
<<= ::toolkit::translateImagePosition(
321 GetAs
< Button
>()->GetImageAlign() );
327 aProp
= VCLXWindow::getProperty( PropertyName
);
337 void VCLXButton::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
339 PushPropertyIds( rIds
,
340 BASEPROPERTY_BACKGROUNDCOLOR
,
341 BASEPROPERTY_DEFAULTBUTTON
,
342 BASEPROPERTY_DEFAULTCONTROL
,
343 BASEPROPERTY_ENABLED
,
344 BASEPROPERTY_ENABLEVISIBLE
,
345 BASEPROPERTY_FONTDESCRIPTOR
,
346 BASEPROPERTY_GRAPHIC
,
347 BASEPROPERTY_HELPTEXT
,
348 BASEPROPERTY_HELPURL
,
349 BASEPROPERTY_IMAGEALIGN
,
350 BASEPROPERTY_IMAGEPOSITION
,
351 BASEPROPERTY_IMAGEURL
,
353 BASEPROPERTY_PRINTABLE
,
354 BASEPROPERTY_PUSHBUTTONTYPE
,
356 BASEPROPERTY_REPEAT_DELAY
,
358 BASEPROPERTY_TABSTOP
,
360 BASEPROPERTY_FOCUSONCLICK
,
361 BASEPROPERTY_MULTILINE
,
363 BASEPROPERTY_VERTICALALIGN
,
364 BASEPROPERTY_WRITING_MODE
,
365 BASEPROPERTY_CONTEXT_WRITING_MODE
,
366 BASEPROPERTY_REFERENCE_DEVICE
,
368 VCLXGraphicControl::ImplGetPropertyIds( rIds
);
371 VCLXButton::VCLXButton()
372 :maActionListeners( *this )
373 ,maItemListeners( *this )
377 VCLXButton::~VCLXButton()
381 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXButton::CreateAccessibleContext()
383 return getAccessibleFactory().createAccessibleContext( this );
386 void VCLXButton::dispose()
388 SolarMutexGuard aGuard
;
390 css::lang::EventObject aObj
;
391 aObj
.Source
= getXWeak();
392 maActionListeners
.disposeAndClear( aObj
);
393 maItemListeners
.disposeAndClear( aObj
);
394 VCLXGraphicControl::dispose();
397 void VCLXButton::addActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
399 SolarMutexGuard aGuard
;
400 maActionListeners
.addInterface( l
);
403 void VCLXButton::removeActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
405 SolarMutexGuard aGuard
;
406 maActionListeners
.removeInterface( l
);
409 void VCLXButton::addItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
411 SolarMutexGuard aGuard
;
412 maItemListeners
.addInterface( l
);
415 void VCLXButton::removeItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
417 SolarMutexGuard aGuard
;
418 maItemListeners
.removeInterface( l
);
421 void VCLXButton::setLabel( const OUString
& rLabel
)
423 SolarMutexGuard aGuard
;
425 VclPtr
<vcl::Window
> pWindow
= GetWindow();
427 pWindow
->SetText( rLabel
);
430 void VCLXButton::setActionCommand( const OUString
& rCommand
)
432 SolarMutexGuard aGuard
;
434 maActionCommand
= rCommand
;
437 css::awt::Size
VCLXButton::getMinimumSize( )
439 SolarMutexGuard aGuard
;
442 VclPtr
< PushButton
> pButton
= GetAs
< PushButton
>();
444 aSz
= pButton
->CalcMinimumSize();
448 css::awt::Size
VCLXButton::getPreferredSize( )
450 css::awt::Size aSz
= getMinimumSize();
456 css::awt::Size
VCLXButton::calcAdjustedSize( const css::awt::Size
& rNewSize
)
458 SolarMutexGuard aGuard
;
460 Size aSz
= VCLSize(rNewSize
);
461 VclPtr
< PushButton
> pButton
= GetAs
< PushButton
>();
464 Size aMinSz
= pButton
->CalcMinimumSize();
465 // no text, thus image
466 if ( pButton
->GetText().isEmpty() )
468 if ( aSz
.Width() < aMinSz
.Width() )
469 aSz
.setWidth( aMinSz
.Width() );
470 if ( aSz
.Height() < aMinSz
.Height() )
471 aSz
.setHeight( aMinSz
.Height() );
475 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
476 aSz
.setHeight( aMinSz
.Height() );
484 void VCLXButton::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
486 SolarMutexGuard aGuard
;
488 VclPtr
< Button
> pButton
= GetAs
< Button
>();
492 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
495 case BASEPROPERTY_FOCUSONCLICK
:
496 ::toolkit::adjustBooleanWindowStyle( Value
, pButton
, WB_NOPOINTERFOCUS
, true );
499 case BASEPROPERTY_TOGGLE
:
500 ::toolkit::adjustBooleanWindowStyle( Value
, pButton
, WB_TOGGLE
, false );
503 case BASEPROPERTY_DEFAULTBUTTON
:
505 WinBits nStyle
= pButton
->GetStyle() | WB_DEFBUTTON
;
507 if ( ( Value
>>= b
) && !b
)
508 nStyle
&= ~WB_DEFBUTTON
;
509 pButton
->SetStyle( nStyle
);
512 case BASEPROPERTY_STATE
:
514 if ( GetWindow()->GetType() == WindowType::PUSHBUTTON
)
516 sal_Int16 n
= sal_Int16();
518 static_cast<PushButton
*>(pButton
.get())->SetState( static_cast<TriState
>(n
) );
524 VCLXGraphicControl::setProperty( PropertyName
, Value
);
529 css::uno::Any
VCLXButton::getProperty( const OUString
& PropertyName
)
531 SolarMutexGuard aGuard
;
534 VclPtr
< Button
> pButton
= GetAs
< Button
>();
537 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
540 case BASEPROPERTY_FOCUSONCLICK
:
541 aProp
<<= ( ( pButton
->GetStyle() & WB_NOPOINTERFOCUS
) == 0 );
544 case BASEPROPERTY_TOGGLE
:
545 aProp
<<= ( ( pButton
->GetStyle() & WB_TOGGLE
) != 0 );
548 case BASEPROPERTY_DEFAULTBUTTON
:
550 aProp
<<= ( pButton
->GetStyle() & WB_DEFBUTTON
) != 0;
553 case BASEPROPERTY_STATE
:
555 if ( GetWindow()->GetType() == WindowType::PUSHBUTTON
)
557 aProp
<<= static_cast<sal_Int16
>(static_cast<PushButton
*>(pButton
.get())->GetState());
563 aProp
= VCLXGraphicControl::getProperty( PropertyName
);
570 void VCLXButton::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
572 switch ( rVclWindowEvent
.GetId() )
574 case VclEventId::ButtonClick
:
576 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
577 // since we call listeners below, there is a potential that we will be destroyed
578 // during the listener call. To prevent the resulting crashes, we keep us
579 // alive as long as we're here
581 if ( maActionListeners
.getLength() )
583 css::awt::ActionEvent aEvent
;
584 aEvent
.Source
= getXWeak();
585 aEvent
.ActionCommand
= maActionCommand
;
587 Callback aCallback
= [ this, aEvent
]()
588 { this->maActionListeners
.actionPerformed( aEvent
); };
590 ImplExecuteAsyncWithoutSolarLock( aCallback
);
595 case VclEventId::PushbuttonToggle
:
597 PushButton
& rButton
= dynamic_cast< PushButton
& >( *rVclWindowEvent
.GetWindow() );
599 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
600 if ( maItemListeners
.getLength() )
602 css::awt::ItemEvent aEvent
;
603 aEvent
.Source
= getXWeak();
604 aEvent
.Selected
= ( rButton
.GetState() == TRISTATE_TRUE
) ? 1 : 0;
605 maItemListeners
.itemStateChanged( aEvent
);
611 VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent
);
619 void VCLXImageControl::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
621 PushPropertyIds( rIds
,
622 BASEPROPERTY_BACKGROUNDCOLOR
,
624 BASEPROPERTY_BORDERCOLOR
,
625 BASEPROPERTY_DEFAULTCONTROL
,
626 BASEPROPERTY_ENABLED
,
627 BASEPROPERTY_ENABLEVISIBLE
,
628 BASEPROPERTY_GRAPHIC
,
629 BASEPROPERTY_HELPTEXT
,
630 BASEPROPERTY_HELPURL
,
631 BASEPROPERTY_IMAGEURL
,
632 BASEPROPERTY_PRINTABLE
,
633 BASEPROPERTY_SCALEIMAGE
,
634 BASEPROPERTY_IMAGE_SCALE_MODE
,
635 BASEPROPERTY_TABSTOP
,
636 BASEPROPERTY_WRITING_MODE
,
637 BASEPROPERTY_CONTEXT_WRITING_MODE
,
639 VCLXGraphicControl::ImplGetPropertyIds( rIds
);
642 VCLXImageControl::VCLXImageControl()
646 VCLXImageControl::~VCLXImageControl()
650 void VCLXImageControl::ImplSetNewImage()
652 OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
653 VclPtr
<ImageControl
> pControl
= GetAs
< ImageControl
>();
654 pControl
->SetImage( GetImage() );
657 css::awt::Size
VCLXImageControl::getMinimumSize( )
659 SolarMutexGuard aGuard
;
661 Size aSz
= GetImage().GetSizePixel();
662 aSz
= ImplCalcWindowSize( aSz
);
667 css::awt::Size
VCLXImageControl::getPreferredSize( )
669 return getMinimumSize();
672 css::awt::Size
VCLXImageControl::calcAdjustedSize( const css::awt::Size
& rNewSize
)
674 SolarMutexGuard aGuard
;
676 css::awt::Size aSz
= rNewSize
;
677 css::awt::Size aMinSz
= getMinimumSize();
678 if ( aSz
.Width
< aMinSz
.Width
)
679 aSz
.Width
= aMinSz
.Width
;
680 if ( aSz
.Height
< aMinSz
.Height
)
681 aSz
.Height
= aMinSz
.Height
;
685 void VCLXImageControl::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
687 SolarMutexGuard aGuard
;
689 VclPtr
< ImageControl
> pImageControl
= GetAs
< ImageControl
>();
691 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
694 case BASEPROPERTY_IMAGE_SCALE_MODE
:
696 sal_Int16
nScaleMode( ImageScaleMode::ANISOTROPIC
);
697 if ( pImageControl
&& ( Value
>>= nScaleMode
) )
699 pImageControl
->SetScaleMode( nScaleMode
);
704 case BASEPROPERTY_SCALEIMAGE
:
706 // this is for compatibility only, nowadays, the ImageScaleMode property should be used
707 bool bScaleImage
= false;
708 if ( pImageControl
&& ( Value
>>= bScaleImage
) )
710 pImageControl
->SetScaleMode( bScaleImage
? ImageScaleMode::ANISOTROPIC
: ImageScaleMode::NONE
);
716 VCLXGraphicControl::setProperty( PropertyName
, Value
);
721 css::uno::Any
VCLXImageControl::getProperty( const OUString
& PropertyName
)
723 SolarMutexGuard aGuard
;
726 VclPtr
< ImageControl
> pImageControl
= GetAs
< ImageControl
>();
727 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
731 case BASEPROPERTY_IMAGE_SCALE_MODE
:
732 aProp
<<= ( pImageControl
? pImageControl
->GetScaleMode() : ImageScaleMode::ANISOTROPIC
);
735 case BASEPROPERTY_SCALEIMAGE
:
736 aProp
<<= ( pImageControl
&& pImageControl
->GetScaleMode() != ImageScaleMode::NONE
);
740 aProp
= VCLXGraphicControl::getProperty( PropertyName
);
749 void VCLXCheckBox::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
751 PushPropertyIds( rIds
,
752 BASEPROPERTY_DEFAULTCONTROL
,
753 BASEPROPERTY_ENABLED
,
754 BASEPROPERTY_ENABLEVISIBLE
,
755 BASEPROPERTY_FONTDESCRIPTOR
,
756 BASEPROPERTY_GRAPHIC
,
757 BASEPROPERTY_HELPTEXT
,
758 BASEPROPERTY_HELPURL
,
759 BASEPROPERTY_IMAGEPOSITION
,
760 BASEPROPERTY_IMAGEURL
,
762 BASEPROPERTY_PRINTABLE
,
764 BASEPROPERTY_TABSTOP
,
765 BASEPROPERTY_TRISTATE
,
766 BASEPROPERTY_VISUALEFFECT
,
767 BASEPROPERTY_MULTILINE
,
768 BASEPROPERTY_BACKGROUNDCOLOR
,
770 BASEPROPERTY_VERTICALALIGN
,
771 BASEPROPERTY_WRITING_MODE
,
772 BASEPROPERTY_CONTEXT_WRITING_MODE
,
773 BASEPROPERTY_REFERENCE_DEVICE
,
775 VCLXGraphicControl::ImplGetPropertyIds( rIds
);
778 VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this )
782 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXCheckBox::CreateAccessibleContext()
784 return getAccessibleFactory().createAccessibleContext( this );
787 void VCLXCheckBox::dispose()
789 SolarMutexGuard aGuard
;
791 css::lang::EventObject aObj
;
792 aObj
.Source
= getXWeak();
793 maItemListeners
.disposeAndClear( aObj
);
794 VCLXGraphicControl::dispose();
797 void VCLXCheckBox::addItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
799 SolarMutexGuard aGuard
;
800 maItemListeners
.addInterface( l
);
803 void VCLXCheckBox::removeItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
805 SolarMutexGuard aGuard
;
806 maItemListeners
.removeInterface( l
);
809 void VCLXCheckBox::addActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
811 SolarMutexGuard aGuard
;
812 maActionListeners
.addInterface( l
);
815 void VCLXCheckBox::removeActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
817 SolarMutexGuard aGuard
;
818 maActionListeners
.removeInterface( l
);
821 void VCLXCheckBox::setActionCommand( const OUString
& rCommand
)
823 SolarMutexGuard aGuard
;
824 maActionCommand
= rCommand
;
827 void VCLXCheckBox::setLabel( const OUString
& rLabel
)
829 SolarMutexGuard aGuard
;
831 VclPtr
<vcl::Window
> pWindow
= GetWindow();
833 pWindow
->SetText( rLabel
);
836 void VCLXCheckBox::setState( sal_Int16 n
)
838 SolarMutexGuard aGuard
;
840 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
847 case 0: eState
= TRISTATE_FALSE
; break;
848 case 1: eState
= TRISTATE_TRUE
; break;
849 case 2: eState
= TRISTATE_INDET
; break;
850 default: eState
= TRISTATE_FALSE
;
852 pCheckBox
->SetState( eState
);
854 // #105198# call C++ click listeners (needed for accessibility)
855 // pCheckBox->GetClickHdl().Call( pCheckBox );
857 // #107218# Call same virtual methods and listeners like VCL would do after user interaction
858 SetSynthesizingVCLEvent( true );
861 SetSynthesizingVCLEvent( false );
864 sal_Int16
VCLXCheckBox::getState()
866 SolarMutexGuard aGuard
;
868 sal_Int16 nState
= -1;
869 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
872 switch ( pCheckBox
->GetState() )
874 case TRISTATE_FALSE
: nState
= 0; break;
875 case TRISTATE_TRUE
: nState
= 1; break;
876 case TRISTATE_INDET
: nState
= 2; break;
877 default: OSL_FAIL( "VCLXCheckBox::getState(): unknown TriState!" );
884 void VCLXCheckBox::enableTriState( sal_Bool b
)
886 SolarMutexGuard aGuard
;
888 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
890 pCheckBox
->EnableTriState( b
);
893 css::awt::Size
VCLXCheckBox::getMinimumSize()
895 SolarMutexGuard aGuard
;
898 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
900 aSz
= pCheckBox
->CalcMinimumSize();
904 css::awt::Size
VCLXCheckBox::getPreferredSize()
906 return getMinimumSize();
909 css::awt::Size
VCLXCheckBox::calcAdjustedSize( const css::awt::Size
& rNewSize
)
911 SolarMutexGuard aGuard
;
913 Size aSz
= VCLSize(rNewSize
);
914 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
917 Size aMinSz
= pCheckBox
->CalcMinimumSize(rNewSize
.Width
);
918 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
919 aSz
.setHeight( aMinSz
.Height() );
926 void VCLXCheckBox::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
928 SolarMutexGuard aGuard
;
930 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
934 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
937 case BASEPROPERTY_VISUALEFFECT
:
938 ::toolkit::setVisualEffect( Value
, pCheckBox
);
941 case BASEPROPERTY_TRISTATE
:
945 pCheckBox
->EnableTriState( b
);
948 case BASEPROPERTY_STATE
:
950 sal_Int16 n
= sal_Int16();
957 VCLXGraphicControl::setProperty( PropertyName
, Value
);
962 css::uno::Any
VCLXCheckBox::getProperty( const OUString
& PropertyName
)
964 SolarMutexGuard aGuard
;
967 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
970 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
973 case BASEPROPERTY_VISUALEFFECT
:
974 aProp
= ::toolkit::getVisualEffect( pCheckBox
);
976 case BASEPROPERTY_TRISTATE
:
977 aProp
<<= pCheckBox
->IsTriStateEnabled();
979 case BASEPROPERTY_STATE
:
980 aProp
<<= static_cast<sal_Int16
>(pCheckBox
->GetState());
984 aProp
= VCLXGraphicControl::getProperty( PropertyName
);
991 void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
993 switch ( rVclWindowEvent
.GetId() )
995 case VclEventId::CheckboxToggle
:
997 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
998 // since we call listeners below, there is a potential that we will be destroyed
999 // in during the listener call. To prevent the resulting crashes, we keep us
1000 // alive as long as we're here
1002 VclPtr
< CheckBox
> pCheckBox
= GetAs
< CheckBox
>();
1005 if ( maItemListeners
.getLength() )
1007 css::awt::ItemEvent aEvent
;
1008 aEvent
.Source
= getXWeak();
1009 aEvent
.Highlighted
= 0;
1010 aEvent
.Selected
= pCheckBox
->GetState();
1011 maItemListeners
.itemStateChanged( aEvent
);
1013 if ( !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1015 css::awt::ActionEvent aEvent
;
1016 aEvent
.Source
= getXWeak();
1017 aEvent
.ActionCommand
= maActionCommand
;
1018 maActionListeners
.actionPerformed( aEvent
);
1025 VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent
);
1032 void VCLXRadioButton::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
1034 PushPropertyIds( rIds
,
1035 BASEPROPERTY_DEFAULTCONTROL
,
1036 BASEPROPERTY_ENABLED
,
1037 BASEPROPERTY_ENABLEVISIBLE
,
1038 BASEPROPERTY_FONTDESCRIPTOR
,
1039 BASEPROPERTY_GRAPHIC
,
1040 BASEPROPERTY_HELPTEXT
,
1041 BASEPROPERTY_HELPURL
,
1042 BASEPROPERTY_IMAGEPOSITION
,
1043 BASEPROPERTY_IMAGEURL
,
1045 BASEPROPERTY_PRINTABLE
,
1047 BASEPROPERTY_TABSTOP
,
1048 BASEPROPERTY_VISUALEFFECT
,
1049 BASEPROPERTY_MULTILINE
,
1050 BASEPROPERTY_BACKGROUNDCOLOR
,
1052 BASEPROPERTY_VERTICALALIGN
,
1053 BASEPROPERTY_WRITING_MODE
,
1054 BASEPROPERTY_CONTEXT_WRITING_MODE
,
1055 BASEPROPERTY_REFERENCE_DEVICE
,
1056 BASEPROPERTY_GROUPNAME
,
1058 VCLXGraphicControl::ImplGetPropertyIds( rIds
);
1062 VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
1066 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXRadioButton::CreateAccessibleContext()
1068 return getAccessibleFactory().createAccessibleContext( this );
1071 void VCLXRadioButton::dispose()
1073 SolarMutexGuard aGuard
;
1075 css::lang::EventObject aObj
;
1076 aObj
.Source
= getXWeak();
1077 maItemListeners
.disposeAndClear( aObj
);
1078 VCLXGraphicControl::dispose();
1081 void VCLXRadioButton::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
1083 SolarMutexGuard aGuard
;
1085 VclPtr
< RadioButton
> pButton
= GetAs
< RadioButton
>();
1089 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1090 switch ( nPropType
)
1092 case BASEPROPERTY_VISUALEFFECT
:
1093 ::toolkit::setVisualEffect( Value
, pButton
);
1096 case BASEPROPERTY_STATE
:
1098 sal_Int16 n
= sal_Int16();
1102 if ( pButton
->IsRadioCheckEnabled() )
1103 pButton
->Check( b
);
1105 pButton
->SetState( b
);
1109 case BASEPROPERTY_AUTOTOGGLE
:
1113 pButton
->EnableRadioCheck( b
);
1118 VCLXGraphicControl::setProperty( PropertyName
, Value
);
1123 css::uno::Any
VCLXRadioButton::getProperty( const OUString
& PropertyName
)
1125 SolarMutexGuard aGuard
;
1127 css::uno::Any aProp
;
1128 VclPtr
< RadioButton
> pButton
= GetAs
< RadioButton
>();
1131 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1132 switch ( nPropType
)
1134 case BASEPROPERTY_VISUALEFFECT
:
1135 aProp
= ::toolkit::getVisualEffect( pButton
);
1137 case BASEPROPERTY_STATE
:
1138 aProp
<<= static_cast<sal_Int16
>( pButton
->IsChecked() ? 1 : 0 );
1140 case BASEPROPERTY_AUTOTOGGLE
:
1141 aProp
<<= pButton
->IsRadioCheckEnabled();
1145 aProp
= VCLXGraphicControl::getProperty( PropertyName
);
1152 void VCLXRadioButton::addItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
1154 SolarMutexGuard aGuard
;
1155 maItemListeners
.addInterface( l
);
1158 void VCLXRadioButton::removeItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
1160 SolarMutexGuard aGuard
;
1161 maItemListeners
.removeInterface( l
);
1164 void VCLXRadioButton::addActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
1166 SolarMutexGuard aGuard
;
1167 maActionListeners
.addInterface( l
);
1170 void VCLXRadioButton::removeActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
1172 SolarMutexGuard aGuard
;
1173 maActionListeners
.removeInterface( l
);
1176 void VCLXRadioButton::setLabel( const OUString
& rLabel
)
1178 SolarMutexGuard aGuard
;
1180 VclPtr
<vcl::Window
> pWindow
= GetWindow();
1182 pWindow
->SetText( rLabel
);
1185 void VCLXRadioButton::setActionCommand( const OUString
& rCommand
)
1187 SolarMutexGuard aGuard
;
1188 maActionCommand
= rCommand
;
1191 void VCLXRadioButton::setState( sal_Bool b
)
1193 SolarMutexGuard aGuard
;
1195 VclPtr
< RadioButton
> pRadioButton
= GetAs
< RadioButton
>();
1198 pRadioButton
->Check( b
);
1199 // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
1200 // But this is needed in old code because Accessibility API uses it.
1201 // pRadioButton->GetClickHdl().Call( pRadioButton );
1203 // #107218# Call same virtual methods and listeners like VCL would do after user interaction
1204 SetSynthesizingVCLEvent( true );
1205 pRadioButton
->Click();
1206 SetSynthesizingVCLEvent( false );
1210 sal_Bool
VCLXRadioButton::getState()
1212 SolarMutexGuard aGuard
;
1214 VclPtr
< RadioButton
> pRadioButton
= GetAs
< RadioButton
>();
1215 return pRadioButton
&& pRadioButton
->IsChecked();
1218 css::awt::Size
VCLXRadioButton::getMinimumSize( )
1220 SolarMutexGuard aGuard
;
1223 VclPtr
< RadioButton
> pRadioButton
= GetAs
< RadioButton
>();
1225 aSz
= pRadioButton
->CalcMinimumSize();
1226 return AWTSize(aSz
);
1229 css::awt::Size
VCLXRadioButton::getPreferredSize( )
1231 return getMinimumSize();
1234 css::awt::Size
VCLXRadioButton::calcAdjustedSize( const css::awt::Size
& rNewSize
)
1236 SolarMutexGuard aGuard
;
1238 Size aSz
= VCLSize(rNewSize
);
1239 VclPtr
< RadioButton
> pRadioButton
= GetAs
< RadioButton
>();
1242 Size aMinSz
= pRadioButton
->CalcMinimumSize(rNewSize
.Width
);
1243 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
1244 aSz
.setHeight( aMinSz
.Height() );
1248 return AWTSize(aSz
);
1251 void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1253 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
1254 // since we call listeners below, there is a potential that we will be destroyed
1255 // in during the listener call. To prevent the resulting crashes, we keep us
1256 // alive as long as we're here
1258 switch ( rVclWindowEvent
.GetId() )
1260 case VclEventId::ButtonClick
:
1261 if ( !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1263 css::awt::ActionEvent aEvent
;
1264 aEvent
.Source
= getXWeak();
1265 aEvent
.ActionCommand
= maActionCommand
;
1266 maActionListeners
.actionPerformed( aEvent
);
1268 ImplClickedOrToggled( false );
1271 case VclEventId::RadiobuttonToggle
:
1272 ImplClickedOrToggled( true );
1276 VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent
);
1281 void VCLXRadioButton::ImplClickedOrToggled( bool bToggled
)
1283 // In the forms, RadioChecked is not enabled, call itemStateChanged only for click
1284 // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
1285 VclPtr
< RadioButton
> pRadioButton
= GetAs
< RadioButton
>();
1286 if ( pRadioButton
&& ( pRadioButton
->IsRadioCheckEnabled() == bToggled
) && ( bToggled
|| pRadioButton
->IsStateChanged() ) && maItemListeners
.getLength() )
1288 css::awt::ItemEvent aEvent
;
1289 aEvent
.Source
= getXWeak();
1290 aEvent
.Highlighted
= 0;
1291 aEvent
.Selected
= pRadioButton
->IsChecked() ? 1 : 0;
1292 maItemListeners
.itemStateChanged( aEvent
);
1298 void VCLXSpinField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
1300 PushPropertyIds( rIds
,
1301 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
1303 VCLXEdit::ImplGetPropertyIds( rIds
);
1306 VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
1310 void VCLXSpinField::addSpinListener( const css::uno::Reference
< css::awt::XSpinListener
> & l
)
1312 SolarMutexGuard aGuard
;
1313 maSpinListeners
.addInterface( l
);
1316 void VCLXSpinField::removeSpinListener( const css::uno::Reference
< css::awt::XSpinListener
> & l
)
1318 SolarMutexGuard aGuard
;
1319 maSpinListeners
.removeInterface( l
);
1322 void VCLXSpinField::up()
1324 SolarMutexGuard aGuard
;
1326 VclPtr
< SpinField
> pSpinField
= GetAs
< SpinField
>();
1331 void VCLXSpinField::down()
1333 SolarMutexGuard aGuard
;
1335 VclPtr
< SpinField
> pSpinField
= GetAs
< SpinField
>();
1340 void VCLXSpinField::first()
1342 SolarMutexGuard aGuard
;
1344 VclPtr
< SpinField
> pSpinField
= GetAs
< SpinField
>();
1346 pSpinField
->First();
1349 void VCLXSpinField::last()
1351 SolarMutexGuard aGuard
;
1353 VclPtr
< SpinField
> pSpinField
= GetAs
< SpinField
>();
1358 void VCLXSpinField::enableRepeat( sal_Bool bRepeat
)
1360 SolarMutexGuard aGuard
;
1362 VclPtr
<vcl::Window
> pWindow
= GetWindow();
1365 WinBits nStyle
= pWindow
->GetStyle();
1367 nStyle
|= WB_REPEAT
;
1369 nStyle
&= ~WB_REPEAT
;
1370 pWindow
->SetStyle( nStyle
);
1374 void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1376 switch ( rVclWindowEvent
.GetId() )
1378 case VclEventId::SpinfieldUp
:
1379 case VclEventId::SpinfieldDown
:
1380 case VclEventId::SpinfieldFirst
:
1381 case VclEventId::SpinfieldLast
:
1383 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
1384 // since we call listeners below, there is a potential that we will be destroyed
1385 // in during the listener call. To prevent the resulting crashes, we keep us
1386 // alive as long as we're here
1388 if ( maSpinListeners
.getLength() )
1390 css::awt::SpinEvent aEvent
;
1391 aEvent
.Source
= getXWeak();
1392 switch ( rVclWindowEvent
.GetId() )
1394 case VclEventId::SpinfieldUp
: maSpinListeners
.up( aEvent
);
1396 case VclEventId::SpinfieldDown
: maSpinListeners
.down( aEvent
);
1398 case VclEventId::SpinfieldFirst
: maSpinListeners
.first( aEvent
);
1400 case VclEventId::SpinfieldLast
: maSpinListeners
.last( aEvent
);
1410 VCLXEdit::ProcessWindowEvent( rVclWindowEvent
);
1417 void VCLXListBox::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
1419 PushPropertyIds( rIds
,
1420 BASEPROPERTY_BACKGROUNDCOLOR
,
1421 BASEPROPERTY_BORDER
,
1422 BASEPROPERTY_BORDERCOLOR
,
1423 BASEPROPERTY_DEFAULTCONTROL
,
1424 BASEPROPERTY_DROPDOWN
,
1425 BASEPROPERTY_ENABLED
,
1426 BASEPROPERTY_ENABLEVISIBLE
,
1427 BASEPROPERTY_FONTDESCRIPTOR
,
1428 BASEPROPERTY_HELPTEXT
,
1429 BASEPROPERTY_HELPURL
,
1430 BASEPROPERTY_LINECOUNT
,
1431 BASEPROPERTY_MULTISELECTION
,
1432 BASEPROPERTY_MULTISELECTION_SIMPLEMODE
,
1433 BASEPROPERTY_ITEM_SEPARATOR_POS
,
1434 BASEPROPERTY_PRINTABLE
,
1435 BASEPROPERTY_SELECTEDITEMS
,
1436 BASEPROPERTY_STRINGITEMLIST
,
1437 BASEPROPERTY_TYPEDITEMLIST
,
1438 BASEPROPERTY_TABSTOP
,
1439 BASEPROPERTY_READONLY
,
1441 BASEPROPERTY_WRITING_MODE
,
1442 BASEPROPERTY_CONTEXT_WRITING_MODE
,
1443 BASEPROPERTY_REFERENCE_DEVICE
,
1444 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
1445 BASEPROPERTY_HIGHLIGHT_COLOR
,
1446 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
1448 VCLXWindow::ImplGetPropertyIds( rIds
);
1452 VCLXListBox::VCLXListBox()
1453 : maActionListeners( *this ),
1454 maItemListeners( *this )
1458 void VCLXListBox::dispose()
1460 SolarMutexGuard aGuard
;
1462 css::lang::EventObject aObj
;
1463 aObj
.Source
= getXWeak();
1464 maItemListeners
.disposeAndClear( aObj
);
1465 maActionListeners
.disposeAndClear( aObj
);
1466 VCLXWindow::dispose();
1469 void VCLXListBox::addItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
1471 SolarMutexGuard aGuard
;
1472 maItemListeners
.addInterface( l
);
1475 void VCLXListBox::removeItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
1477 SolarMutexGuard aGuard
;
1478 maItemListeners
.removeInterface( l
);
1481 void VCLXListBox::addActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
1483 SolarMutexGuard aGuard
;
1484 maActionListeners
.addInterface( l
);
1487 void VCLXListBox::removeActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
1489 SolarMutexGuard aGuard
;
1490 maActionListeners
.removeInterface( l
);
1493 void VCLXListBox::addItem( const OUString
& aItem
, sal_Int16 nPos
)
1495 SolarMutexGuard aGuard
;
1496 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1498 pBox
->InsertEntry( aItem
, nPos
);
1501 void VCLXListBox::addItems( const css::uno::Sequence
< OUString
>& aItems
, sal_Int16 nPos
)
1503 SolarMutexGuard aGuard
;
1504 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1508 sal_uInt16 nP
= nPos
;
1509 for ( auto const & item
: aItems
)
1513 OSL_FAIL( "VCLXListBox::addItems: too many entries!" );
1514 // skip remaining entries, list cannot hold them, anyway
1518 pBox
->InsertEntry( item
, nP
++ );
1522 void VCLXListBox::removeItems( sal_Int16 nPos
, sal_Int16 nCount
)
1524 SolarMutexGuard aGuard
;
1525 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1528 for ( sal_Int16 n
= nCount
; n
; )
1529 pBox
->RemoveEntry( nPos
+ (--n
) );
1533 sal_Int16
VCLXListBox::getItemCount()
1535 SolarMutexGuard aGuard
;
1537 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1538 return pBox
? pBox
->GetEntryCount() : 0;
1541 OUString
VCLXListBox::getItem( sal_Int16 nPos
)
1543 SolarMutexGuard aGuard
;
1546 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1548 aItem
= pBox
->GetEntry( nPos
);
1552 css::uno::Sequence
< OUString
> VCLXListBox::getItems()
1554 SolarMutexGuard aGuard
;
1556 css::uno::Sequence
< OUString
> aSeq
;
1557 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1560 auto n
= pBox
->GetEntryCount();
1561 aSeq
= css::uno::Sequence
< OUString
>( n
);
1565 aSeq
.getArray()[n
] = pBox
->GetEntry( n
);
1571 sal_Int16
VCLXListBox::getSelectedItemPos()
1573 SolarMutexGuard aGuard
;
1574 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1575 return pBox
? pBox
->GetSelectedEntryPos() : 0;
1578 css::uno::Sequence
<sal_Int16
> VCLXListBox::getSelectedItemsPos()
1580 SolarMutexGuard aGuard
;
1582 css::uno::Sequence
<sal_Int16
> aSeq
;
1583 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1586 const sal_Int32 nSelEntries
= pBox
->GetSelectedEntryCount();
1587 aSeq
= css::uno::Sequence
<sal_Int16
>( nSelEntries
);
1588 for ( sal_Int32 n
= 0; n
< nSelEntries
; ++n
)
1589 aSeq
.getArray()[n
] = pBox
->GetSelectedEntryPos( n
);
1594 OUString
VCLXListBox::getSelectedItem()
1596 SolarMutexGuard aGuard
;
1599 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1601 aItem
= pBox
->GetSelectedEntry();
1605 css::uno::Sequence
< OUString
> VCLXListBox::getSelectedItems()
1607 SolarMutexGuard aGuard
;
1609 css::uno::Sequence
< OUString
> aSeq
;
1610 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1613 const sal_Int32 nSelEntries
= pBox
->GetSelectedEntryCount();
1614 aSeq
= css::uno::Sequence
< OUString
>( nSelEntries
);
1615 for ( sal_Int32 n
= 0; n
< nSelEntries
; ++n
)
1616 aSeq
.getArray()[n
] = pBox
->GetSelectedEntry( n
);
1621 void VCLXListBox::selectItemPos( sal_Int16 nPos
, sal_Bool bSelect
)
1623 SolarMutexGuard aGuard
;
1625 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1626 if ( pBox
&& ( pBox
->IsEntryPosSelected( nPos
) != bool(bSelect
) ) )
1628 pBox
->SelectEntryPos( nPos
, bSelect
);
1630 // VCL doesn't call select handler after API call.
1631 // ImplCallItemListeners();
1633 // #107218# Call same listeners like VCL would do after user interaction
1634 SetSynthesizingVCLEvent( true );
1636 SetSynthesizingVCLEvent( false );
1640 void VCLXListBox::selectItemsPos( const css::uno::Sequence
<sal_Int16
>& aPositions
, sal_Bool bSelect
)
1642 SolarMutexGuard aGuard
;
1644 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1648 std::vector
<sal_Int32
> aPositionVec
;
1649 aPositionVec
.reserve(aPositions
.getLength());
1651 bool bChanged
= false;
1652 for ( auto n
= aPositions
.getLength(); n
; )
1654 const auto nPos
= aPositions
.getConstArray()[--n
];
1655 if ( pBox
->IsEntryPosSelected( nPos
) != bool(bSelect
) )
1657 aPositionVec
.push_back(nPos
);
1665 bool bOrigUpdateMode
= pBox
->IsUpdateMode();
1666 pBox
->SetUpdateMode(false);
1668 pBox
->SelectEntriesPos(aPositionVec
, bSelect
);
1670 pBox
->SetUpdateMode(bOrigUpdateMode
);
1672 // VCL doesn't call select handler after API call.
1673 // ImplCallItemListeners();
1675 // #107218# Call same listeners like VCL would do after user interaction
1676 SetSynthesizingVCLEvent( true );
1678 SetSynthesizingVCLEvent( false );
1681 void VCLXListBox::selectItem( const OUString
& rItemText
, sal_Bool bSelect
)
1683 SolarMutexGuard aGuard
;
1685 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1688 selectItemPos( pBox
->GetEntryPos( rItemText
), bSelect
);
1692 void VCLXListBox::setDropDownLineCount( sal_Int16 nLines
)
1694 SolarMutexGuard aGuard
;
1695 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1697 pBox
->SetDropDownLineCount( nLines
);
1700 sal_Int16
VCLXListBox::getDropDownLineCount()
1702 SolarMutexGuard aGuard
;
1704 sal_Int16 nLines
= 0;
1705 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1707 nLines
= pBox
->GetDropDownLineCount();
1711 sal_Bool
VCLXListBox::isMutipleMode()
1713 SolarMutexGuard aGuard
;
1714 bool bMulti
= false;
1715 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1717 bMulti
= pBox
->IsMultiSelectionEnabled();
1721 void VCLXListBox::setMultipleMode( sal_Bool bMulti
)
1723 SolarMutexGuard aGuard
;
1724 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1726 pBox
->EnableMultiSelection( bMulti
);
1729 void VCLXListBox::makeVisible( sal_Int16 nEntry
)
1731 SolarMutexGuard aGuard
;
1732 VclPtr
< ListBox
> pBox
= GetAs
< ListBox
>();
1734 pBox
->SetTopEntry( nEntry
);
1737 void VCLXListBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
1739 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
1740 // since we call listeners below, there is a potential that we will be destroyed
1741 // in during the listener call. To prevent the resulting crashes, we keep us
1742 // alive as long as we're here
1744 switch ( rVclWindowEvent
.GetId() )
1746 case VclEventId::ListboxSelect
:
1748 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1751 bool bDropDown
= ( pListBox
->GetStyle() & WB_DROPDOWN
) != 0;
1752 if ( bDropDown
&& !IsSynthesizingVCLEvent() && maActionListeners
.getLength() )
1754 // Call ActionListener on DropDown event
1755 css::awt::ActionEvent aEvent
;
1756 aEvent
.Source
= getXWeak();
1757 aEvent
.ActionCommand
= pListBox
->GetSelectedEntry();
1758 maActionListeners
.actionPerformed( aEvent
);
1761 if ( maItemListeners
.getLength() )
1763 ImplCallItemListeners();
1769 case VclEventId::ListboxDoubleClick
:
1770 if ( GetWindow() && maActionListeners
.getLength() )
1772 css::awt::ActionEvent aEvent
;
1773 aEvent
.Source
= getXWeak();
1774 aEvent
.ActionCommand
= GetAs
<ListBox
>()->GetSelectedEntry();
1775 maActionListeners
.actionPerformed( aEvent
);
1780 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
1785 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXListBox::CreateAccessibleContext()
1787 SolarMutexGuard aGuard
;
1789 return getAccessibleFactory().createAccessibleContext( this );
1792 void VCLXListBox::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
1794 SolarMutexGuard aGuard
;
1795 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1799 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1800 switch ( nPropType
)
1802 case BASEPROPERTY_ITEM_SEPARATOR_POS
:
1804 sal_Int16
nSeparatorPos(0);
1805 if ( Value
>>= nSeparatorPos
)
1806 pListBox
->SetSeparatorPos( nSeparatorPos
);
1809 case BASEPROPERTY_READONLY
:
1813 pListBox
->SetReadOnly( b
);
1816 case BASEPROPERTY_MULTISELECTION
:
1820 pListBox
->EnableMultiSelection( b
);
1823 case BASEPROPERTY_MULTISELECTION_SIMPLEMODE
:
1824 ::toolkit::adjustBooleanWindowStyle( Value
, pListBox
, WB_SIMPLEMODE
, false );
1826 case BASEPROPERTY_LINECOUNT
:
1830 pListBox
->SetDropDownLineCount( n
);
1833 case BASEPROPERTY_STRINGITEMLIST
:
1835 css::uno::Sequence
< OUString
> aItems
;
1836 if ( Value
>>= aItems
)
1839 addItems( aItems
, 0 );
1843 case BASEPROPERTY_SELECTEDITEMS
:
1845 css::uno::Sequence
<sal_Int16
> aItems
;
1846 if ( Value
>>= aItems
)
1848 for ( auto n
= pListBox
->GetEntryCount(); n
; )
1849 pListBox
->SelectEntryPos( --n
, false );
1851 if ( aItems
.hasElements() )
1852 selectItemsPos( aItems
, true );
1854 pListBox
->SetNoSelection();
1856 if ( !pListBox
->GetSelectedEntryCount() )
1857 pListBox
->SetTopEntry( 0 );
1861 case BASEPROPERTY_HIGHLIGHT_COLOR
:
1864 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
1867 nColor
= Application::GetSettings().GetStyleSettings().GetHighlightColor();
1871 if (!(Value
>>= nColor
))
1874 pListBox
->SetHighlightColor(nColor
);
1877 case BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
:
1880 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
1883 nColor
= Application::GetSettings().GetStyleSettings().GetHighlightTextColor();
1887 if (!(Value
>>= nColor
))
1890 pListBox
->SetHighlightTextColor(nColor
);
1895 VCLXWindow::setProperty( PropertyName
, Value
);
1900 css::uno::Any
VCLXListBox::getProperty( const OUString
& PropertyName
)
1902 SolarMutexGuard aGuard
;
1903 css::uno::Any aProp
;
1904 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1907 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
1908 switch ( nPropType
)
1910 case BASEPROPERTY_ITEM_SEPARATOR_POS
:
1911 aProp
<<= sal_Int16( pListBox
->GetSeparatorPos() );
1913 case BASEPROPERTY_READONLY
:
1915 aProp
<<= pListBox
->IsReadOnly();
1918 case BASEPROPERTY_MULTISELECTION
:
1920 aProp
<<= pListBox
->IsMultiSelectionEnabled();
1923 case BASEPROPERTY_MULTISELECTION_SIMPLEMODE
:
1925 aProp
<<= ( ( pListBox
->GetStyle() & WB_SIMPLEMODE
) == 0 );
1928 case BASEPROPERTY_LINECOUNT
:
1930 aProp
<<= static_cast<sal_Int16
>(pListBox
->GetDropDownLineCount());
1933 case BASEPROPERTY_STRINGITEMLIST
:
1935 const sal_Int32 nItems
= pListBox
->GetEntryCount();
1936 css::uno::Sequence
< OUString
> aSeq( nItems
);
1937 OUString
* pStrings
= aSeq
.getArray();
1938 for ( sal_Int32 n
= 0; n
< nItems
; ++n
)
1939 pStrings
[n
] = pListBox
->GetEntry( n
);
1946 aProp
= VCLXWindow::getProperty( PropertyName
);
1953 css::awt::Size
VCLXListBox::getMinimumSize( )
1955 SolarMutexGuard aGuard
;
1957 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1959 aSz
= pListBox
->CalcMinimumSize();
1960 return AWTSize(aSz
);
1963 css::awt::Size
VCLXListBox::getPreferredSize( )
1965 SolarMutexGuard aGuard
;
1967 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1970 aSz
= pListBox
->CalcMinimumSize();
1971 if ( pListBox
->GetStyle() & WB_DROPDOWN
)
1972 aSz
.AdjustHeight(4 );
1974 return AWTSize(aSz
);
1977 css::awt::Size
VCLXListBox::calcAdjustedSize( const css::awt::Size
& rNewSize
)
1979 SolarMutexGuard aGuard
;
1980 Size aSz
= VCLSize(rNewSize
);
1981 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1983 aSz
= pListBox
->CalcAdjustedSize( aSz
);
1984 return AWTSize(aSz
);
1987 css::awt::Size
VCLXListBox::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
)
1989 SolarMutexGuard aGuard
;
1991 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
1993 aSz
= pListBox
->CalcBlockSize( nCols
, nLines
);
1994 return AWTSize(aSz
);
1997 void VCLXListBox::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
)
1999 SolarMutexGuard aGuard
;
2001 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2005 pListBox
->GetMaxVisColumnsAndLines( nC
, nL
);
2011 void VCLXListBox::ImplCallItemListeners()
2013 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2014 if ( pListBox
&& maItemListeners
.getLength() )
2016 css::awt::ItemEvent aEvent
;
2017 aEvent
.Source
= getXWeak();
2018 aEvent
.Highlighted
= 0;
2020 // Set to 0xFFFF on multiple selection, selected entry ID otherwise
2021 aEvent
.Selected
= (pListBox
->GetSelectedEntryCount() == 1 ) ? pListBox
->GetSelectedEntryPos() : 0xFFFF;
2023 maItemListeners
.itemStateChanged( aEvent
);
2028 Image
lcl_getImageFromURL( const OUString
& i_rImageURL
)
2030 if ( i_rImageURL
.isEmpty() )
2035 Reference
< uno::XComponentContext
> xContext( ::comphelper::getProcessComponentContext() );
2036 Reference
< XGraphicProvider
> xProvider(graphic::GraphicProvider::create(xContext
));
2037 ::comphelper::NamedValueCollection aMediaProperties
;
2038 aMediaProperties
.put( "URL", i_rImageURL
);
2039 Reference
< XGraphic
> xGraphic
= xProvider
->queryGraphic( aMediaProperties
.getPropertyValues() );
2040 return Image( xGraphic
);
2042 catch( const uno::Exception
& )
2044 DBG_UNHANDLED_EXCEPTION("toolkit");
2049 void SAL_CALL
VCLXListBox::listItemInserted( const ItemListEvent
& i_rEvent
)
2051 SolarMutexGuard aGuard
;
2052 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2054 ENSURE_OR_RETURN_VOID( pListBox
, "VCLXListBox::listItemInserted: no ListBox?!" );
2055 ENSURE_OR_RETURN_VOID( ( i_rEvent
.ItemPosition
>= 0 ) && ( i_rEvent
.ItemPosition
<= pListBox
->GetEntryCount() ),
2056 "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
2057 pListBox
->InsertEntry(
2058 i_rEvent
.ItemText
.IsPresent
? i_rEvent
.ItemText
.Value
: OUString(),
2059 i_rEvent
.ItemImageURL
.IsPresent
? TkResMgr::getImageFromURL( i_rEvent
.ItemImageURL
.Value
) : Image(),
2060 i_rEvent
.ItemPosition
);
2063 void SAL_CALL
VCLXListBox::listItemRemoved( const ItemListEvent
& i_rEvent
)
2065 SolarMutexGuard aGuard
;
2066 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2068 ENSURE_OR_RETURN_VOID( pListBox
, "VCLXListBox::listItemRemoved: no ListBox?!" );
2069 ENSURE_OR_RETURN_VOID( ( i_rEvent
.ItemPosition
>= 0 ) && ( i_rEvent
.ItemPosition
< pListBox
->GetEntryCount() ),
2070 "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
2072 pListBox
->RemoveEntry( i_rEvent
.ItemPosition
);
2075 void SAL_CALL
VCLXListBox::listItemModified( const ItemListEvent
& i_rEvent
)
2077 SolarMutexGuard aGuard
;
2078 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2080 ENSURE_OR_RETURN_VOID( pListBox
, "VCLXListBox::listItemModified: no ListBox?!" );
2081 ENSURE_OR_RETURN_VOID( ( i_rEvent
.ItemPosition
>= 0 ) && ( i_rEvent
.ItemPosition
< pListBox
->GetEntryCount() ),
2082 "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
2084 // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
2086 const OUString sNewText
= i_rEvent
.ItemText
.IsPresent
? i_rEvent
.ItemText
.Value
: pListBox
->GetEntry( i_rEvent
.ItemPosition
);
2087 const Image
aNewImage( i_rEvent
.ItemImageURL
.IsPresent
? TkResMgr::getImageFromURL( i_rEvent
.ItemImageURL
.Value
) : pListBox
->GetEntryImage( i_rEvent
.ItemPosition
) );
2089 pListBox
->RemoveEntry( i_rEvent
.ItemPosition
);
2090 pListBox
->InsertEntry( sNewText
, aNewImage
, i_rEvent
.ItemPosition
);
2093 void SAL_CALL
VCLXListBox::allItemsRemoved( const EventObject
& )
2095 SolarMutexGuard aGuard
;
2097 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2098 ENSURE_OR_RETURN_VOID( pListBox
, "VCLXListBox::listItemModified: no ListBox?!" );
2103 void SAL_CALL
VCLXListBox::itemListChanged( const EventObject
& i_rEvent
)
2105 SolarMutexGuard aGuard
;
2107 VclPtr
< ListBox
> pListBox
= GetAs
< ListBox
>();
2108 ENSURE_OR_RETURN_VOID( pListBox
, "VCLXListBox::listItemModified: no ListBox?!" );
2112 uno::Reference
< beans::XPropertySet
> xPropSet( i_rEvent
.Source
, uno::UNO_QUERY_THROW
);
2113 uno::Reference
< beans::XPropertySetInfo
> xPSI( xPropSet
->getPropertySetInfo(), uno::UNO_SET_THROW
);
2114 uno::Reference
< resource::XStringResourceResolver
> xStringResourceResolver
;
2115 if ( xPSI
->hasPropertyByName("ResourceResolver") )
2117 xStringResourceResolver
.set(
2118 xPropSet
->getPropertyValue("ResourceResolver"),
2124 Reference
< XItemList
> xItemList( i_rEvent
.Source
, uno::UNO_QUERY_THROW
);
2125 const uno::Sequence
< beans::Pair
< OUString
, OUString
> > aItems
= xItemList
->getAllItems();
2126 for ( const auto& rItem
: aItems
)
2128 OUString
aLocalizationKey( rItem
.First
);
2129 if ( xStringResourceResolver
.is() && aLocalizationKey
.startsWith("&") )
2131 aLocalizationKey
= xStringResourceResolver
->resolveString(aLocalizationKey
.copy( 1 ));
2133 pListBox
->InsertEntry( aLocalizationKey
, lcl_getImageFromURL( rItem
.Second
) );
2137 void SAL_CALL
VCLXListBox::disposing( const EventObject
& i_rEvent
)
2139 // just disambiguate
2140 VCLXWindow::disposing( i_rEvent
);
2146 void VCLXMessageBox::GetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
2148 VCLXTopWindow::ImplGetPropertyIds( rIds
);
2151 VCLXMessageBox::VCLXMessageBox()
2155 VCLXMessageBox::~VCLXMessageBox()
2159 void VCLXMessageBox::setCaptionText( const OUString
& rText
)
2161 SolarMutexGuard aGuard
;
2163 VclPtr
<vcl::Window
> pWindow
= GetWindow();
2165 pWindow
->SetText( rText
);
2168 OUString
VCLXMessageBox::getCaptionText()
2170 SolarMutexGuard aGuard
;
2173 VclPtr
<vcl::Window
> pWindow
= GetWindow();
2175 aText
= pWindow
->GetText();
2179 void VCLXMessageBox::setMessageText( const OUString
& rText
)
2181 SolarMutexGuard aGuard
;
2182 VclPtr
< MessBox
> pBox
= GetAs
< MessBox
>();
2184 pBox
->SetMessText( rText
);
2187 OUString
VCLXMessageBox::getMessageText()
2189 SolarMutexGuard aGuard
;
2191 VclPtr
< MessBox
> pBox
= GetAs
< MessBox
>();
2193 aText
= pBox
->GetMessText();
2197 sal_Int16
VCLXMessageBox::execute()
2199 SolarMutexGuard aGuard
;
2200 VclPtr
< MessBox
> pBox
= GetAs
< MessBox
>();
2201 return pBox
? pBox
->Execute() : 0;
2204 css::awt::Size SAL_CALL
VCLXMessageBox::getMinimumSize()
2206 return css::awt::Size( 250, 100 );
2211 void VCLXDialog::GetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
2213 VCLXTopWindow::ImplGetPropertyIds( rIds
);
2216 VCLXDialog::VCLXDialog()
2218 SAL_INFO("toolkit", "XDialog created");
2221 VCLXDialog::~VCLXDialog()
2223 SAL_INFO("toolkit", __FUNCTION__
);
2226 void SAL_CALL
VCLXDialog::endDialog( ::sal_Int32 i_result
)
2228 SolarMutexGuard aGuard
;
2229 VclPtr
<Dialog
> pDialog
= GetAsDynamic
< Dialog
>();
2231 pDialog
->EndDialog( i_result
);
2234 void SAL_CALL
VCLXDialog::setHelpId( const OUString
& rId
)
2236 SolarMutexGuard aGuard
;
2237 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2239 pWindow
->SetHelpId( rId
);
2242 void VCLXDialog::setTitle( const OUString
& Title
)
2244 SolarMutexGuard aGuard
;
2245 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2247 pWindow
->SetText( Title
);
2250 OUString
VCLXDialog::getTitle()
2252 SolarMutexGuard aGuard
;
2255 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2257 aTitle
= pWindow
->GetText();
2261 sal_Int16
VCLXDialog::execute()
2263 SolarMutexGuard aGuard
;
2268 VclPtr
< Dialog
> pDlg
= GetAs
< Dialog
>();
2269 vcl::Window
* pParent
= pDlg
->GetWindow( GetWindowType::ParentOverlap
);
2270 vcl::Window
* pOldParent
= nullptr;
2271 vcl::Window
* pSetParent
= nullptr;
2272 if ( pParent
&& !pParent
->IsReallyVisible() )
2274 pOldParent
= pDlg
->GetParent();
2275 vcl::Window
* pFrame
= pDlg
->GetWindow( GetWindowType::Frame
);
2276 if( pFrame
!= pDlg
)
2278 pDlg
->SetParent( pFrame
);
2279 pSetParent
= pFrame
;
2283 nRet
= pDlg
->Execute();
2285 // set the parent back only in case no new parent was set from outside
2286 // in other words, revert only own changes
2287 if ( pOldParent
&& pDlg
->GetParent() == pSetParent
)
2288 pDlg
->SetParent( pOldParent
);
2293 void VCLXDialog::endExecute()
2298 void SAL_CALL
VCLXDialog::draw( sal_Int32 nX
, sal_Int32 nY
)
2300 SolarMutexGuard aGuard
;
2301 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2304 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2306 pDev
= pWindow
->GetParent()->GetOutDev();
2308 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2309 pWindow
->Draw( pDev
, aPos
, SystemTextColorFlags::NoControls
);
2313 css::awt::DeviceInfo
VCLXDialog::getInfo()
2315 css::awt::DeviceInfo aInfo
= VCLXDevice::getInfo();
2317 SolarMutexGuard aGuard
;
2318 VclPtr
< Dialog
> pDlg
= GetAs
< Dialog
>();
2320 pDlg
->GetDrawWindowBorder( aInfo
.LeftInset
, aInfo
.TopInset
, aInfo
.RightInset
, aInfo
.BottomInset
);
2325 void SAL_CALL
VCLXDialog::setProperty(
2326 const OUString
& PropertyName
,
2327 const css::uno::Any
& Value
)
2329 SolarMutexGuard aGuard
;
2330 VclPtr
< Dialog
> pDialog
= GetAs
< Dialog
>();
2334 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
2336 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2337 switch ( nPropType
)
2339 case BASEPROPERTY_GRAPHIC
:
2341 Reference
< XGraphic
> xGraphic
;
2342 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2344 Graphic
aImage(xGraphic
);
2346 Wallpaper
aWallpaper(aImage
.GetBitmapEx());
2347 aWallpaper
.SetStyle( WallpaperStyle::Scale
);
2348 pDialog
->SetBackground( aWallpaper
);
2350 else if ( bVoid
|| !xGraphic
.is() )
2352 Color aColor
= pDialog
->GetControlBackground();
2353 if ( aColor
== COL_AUTO
)
2354 aColor
= pDialog
->GetSettings().GetStyleSettings().GetDialogColor();
2356 Wallpaper
aWallpaper( aColor
);
2357 pDialog
->SetBackground( aWallpaper
);
2364 VCLXContainer::setProperty( PropertyName
, Value
);
2371 VCLXMultiPage::VCLXMultiPage() : maTabListeners( *this ), mTabId( 1 )
2373 SAL_INFO("toolkit", "VCLXMultiPage::VCLXMultiPage()" );
2376 void VCLXMultiPage::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
2378 PushPropertyIds( rIds
,
2379 BASEPROPERTY_BACKGROUNDCOLOR
,
2380 BASEPROPERTY_DEFAULTCONTROL
,
2381 BASEPROPERTY_ENABLED
,
2382 BASEPROPERTY_MULTIPAGEVALUE
,
2383 BASEPROPERTY_ENABLEVISIBLE
,
2384 BASEPROPERTY_FONTDESCRIPTOR
,
2385 BASEPROPERTY_GRAPHIC
,
2386 BASEPROPERTY_HELPTEXT
,
2387 BASEPROPERTY_HELPURL
,
2388 BASEPROPERTY_IMAGEALIGN
,
2389 BASEPROPERTY_IMAGEPOSITION
,
2390 BASEPROPERTY_IMAGEURL
,
2391 BASEPROPERTY_PRINTABLE
,
2392 BASEPROPERTY_TABSTOP
,
2393 BASEPROPERTY_FOCUSONCLICK
,
2395 VCLXContainer::ImplGetPropertyIds( rIds
);
2398 VCLXMultiPage::~VCLXMultiPage()
2401 void SAL_CALL
VCLXMultiPage::dispose()
2403 SolarMutexGuard aGuard
;
2405 css::lang::EventObject aObj
;
2406 aObj
.Source
= getXWeak();
2407 maTabListeners
.disposeAndClear( aObj
);
2408 VCLXContainer::dispose();
2411 void SAL_CALL
VCLXMultiPage::draw( sal_Int32 nX
, sal_Int32 nY
)
2413 SolarMutexGuard aGuard
;
2414 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2418 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2420 pDev
= pWindow
->GetParent()->GetOutDev();
2422 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2423 pWindow
->Draw( pDev
, aPos
, SystemTextColorFlags::NoControls
);
2427 uno::Any SAL_CALL
VCLXMultiPage::getProperty( const OUString
& PropertyName
)
2429 SAL_INFO("toolkit", " **** VCLXMultiPage::getProperty " << PropertyName
);
2430 SolarMutexGuard aGuard
;
2431 css::uno::Any aProp
;
2432 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2433 switch ( nPropType
)
2436 case BASEPROPERTY_MULTIPAGEVALUE
:
2438 aProp
<<= getActiveTabID();
2442 aProp
= VCLXContainer::getProperty( PropertyName
);
2447 void SAL_CALL
VCLXMultiPage::setProperty(
2448 const OUString
& PropertyName
,
2449 const css::uno::Any
& Value
)
2451 SAL_INFO("toolkit", " **** VCLXMultiPage::setProperty " << PropertyName
);
2452 SolarMutexGuard aGuard
;
2454 VclPtr
< TabControl
> pTabControl
= GetAs
< TabControl
>();
2458 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
2460 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2461 switch ( nPropType
)
2463 case BASEPROPERTY_MULTIPAGEVALUE
:
2465 SAL_INFO("toolkit", "***MULTIPAGE VALUE");
2468 // when the multipage is created we attempt to set the activepage
2469 // but no pages created
2470 if ( nId
&& nId
<= getWindows().getLength() )
2474 case BASEPROPERTY_GRAPHIC
:
2476 Reference
< XGraphic
> xGraphic
;
2477 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2479 Graphic
aImage(xGraphic
);
2481 Wallpaper
aWallpaper(aImage
.GetBitmapEx());
2482 aWallpaper
.SetStyle( WallpaperStyle::Scale
);
2483 pTabControl
->SetBackground( aWallpaper
);
2485 else if ( bVoid
|| !xGraphic
.is() )
2487 Color aColor
= pTabControl
->GetControlBackground();
2488 if ( aColor
== COL_AUTO
)
2489 aColor
= pTabControl
->GetSettings().GetStyleSettings().GetDialogColor();
2491 Wallpaper
aWallpaper( aColor
);
2492 pTabControl
->SetBackground( aWallpaper
);
2499 VCLXContainer::setProperty( PropertyName
, Value
);
2504 TabControl
*VCLXMultiPage::getTabControl() const
2506 VclPtr
<TabControl
> pTabControl
= GetAsDynamic
< TabControl
>();
2509 throw uno::RuntimeException();
2511 sal_Int32 SAL_CALL
VCLXMultiPage::insertTab()
2513 TabControl
*pTabControl
= getTabControl();
2514 VclPtrInstance
<TabPage
> pTab( pTabControl
);
2515 return static_cast< sal_Int32
>( insertTab( pTab
, OUString() ) );
2518 sal_uInt16
VCLXMultiPage::insertTab( TabPage
* pPage
, OUString
const & sTitle
)
2520 TabControl
*pTabControl
= getTabControl();
2521 sal_uInt16 id
= sal::static_int_cast
< sal_uInt16
>( mTabId
++ );
2522 pTabControl
->InsertPage( id
, sTitle
);
2523 pTabControl
->SetTabPage( id
, pPage
);
2527 void SAL_CALL
VCLXMultiPage::removeTab( sal_Int32 ID
)
2529 TabControl
*pTabControl
= getTabControl();
2530 if ( pTabControl
->GetTabPage( sal::static_int_cast
< sal_uInt16
>( ID
) ) == nullptr )
2531 throw lang::IndexOutOfBoundsException();
2532 pTabControl
->RemovePage( sal::static_int_cast
< sal_uInt16
>( ID
) );
2535 void SAL_CALL
VCLXMultiPage::activateTab( sal_Int32 ID
)
2537 TabControl
*pTabControl
= getTabControl();
2540 "Attempting to activate tab " << ID
<< ", active tab is "
2541 << getActiveTabID() << ", numtabs is " << getWindows().getLength());
2542 if ( pTabControl
->GetTabPage( sal::static_int_cast
< sal_uInt16
>( ID
) ) == nullptr )
2543 throw lang::IndexOutOfBoundsException();
2544 pTabControl
->SelectTabPage( sal::static_int_cast
< sal_uInt16
>( ID
) );
2547 sal_Int32 SAL_CALL
VCLXMultiPage::getActiveTabID()
2549 return getTabControl()->GetCurPageId( );
2552 void SAL_CALL
VCLXMultiPage::addTabListener( const uno::Reference
< awt::XTabListener
>& xListener
)
2554 SolarMutexGuard aGuard
;
2555 maTabListeners
.addInterface( xListener
);
2558 void SAL_CALL
VCLXMultiPage::removeTabListener( const uno::Reference
< awt::XTabListener
>& xListener
)
2560 SolarMutexGuard aGuard
;
2561 maTabListeners
.addInterface( xListener
);
2564 void SAL_CALL
VCLXMultiPage::setTabProps( sal_Int32 ID
, const uno::Sequence
< beans::NamedValue
>& Properties
)
2566 SolarMutexGuard aGuard
;
2567 TabControl
*pTabControl
= getTabControl();
2568 if ( pTabControl
->GetTabPage( sal::static_int_cast
< sal_uInt16
>( ID
) ) == nullptr )
2569 throw lang::IndexOutOfBoundsException();
2571 for (const auto& rProp
: Properties
)
2573 const OUString
&name
= rProp
.Name
;
2574 const uno::Any
&value
= rProp
.Value
;
2576 if (name
== "Title")
2578 OUString title
= value
.get
<OUString
>();
2579 pTabControl
->SetPageText( sal::static_int_cast
< sal_uInt16
>( ID
), title
);
2584 uno::Sequence
< beans::NamedValue
> SAL_CALL
VCLXMultiPage::getTabProps( sal_Int32 ID
)
2586 SolarMutexGuard aGuard
;
2587 TabControl
*pTabControl
= getTabControl();
2588 if ( pTabControl
->GetTabPage( sal::static_int_cast
< sal_uInt16
>( ID
) ) == nullptr )
2589 throw lang::IndexOutOfBoundsException();
2591 uno::Sequence
< beans::NamedValue
> props
2593 { "Title", css::uno::Any(pTabControl
->GetPageText( sal::static_int_cast
< sal_uInt16
>( ID
) )) },
2594 { "Position", css::uno::Any(pTabControl
->GetPagePos( sal::static_int_cast
< sal_uInt16
>( ID
) )) }
2598 void VCLXMultiPage::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
2600 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
2601 switch ( rVclWindowEvent
.GetId() )
2603 case VclEventId::TabpageDeactivate
:
2605 sal_uLong nPageID
= reinterpret_cast<sal_uLong
>( rVclWindowEvent
.GetData() );
2606 maTabListeners
.deactivated( nPageID
);
2610 case VclEventId::TabpageActivate
:
2612 sal_uLong nPageID
= reinterpret_cast<sal_uLong
>( rVclWindowEvent
.GetData() );
2613 maTabListeners
.activated( nPageID
);
2617 VCLXContainer::ProcessWindowEvent( rVclWindowEvent
);
2624 VCLXTabPage::VCLXTabPage()
2628 void VCLXTabPage::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
2630 PushPropertyIds( rIds
,
2631 BASEPROPERTY_BACKGROUNDCOLOR
,
2632 BASEPROPERTY_DEFAULTCONTROL
,
2633 BASEPROPERTY_ENABLED
,
2634 BASEPROPERTY_ENABLEVISIBLE
,
2635 BASEPROPERTY_FONTDESCRIPTOR
,
2636 BASEPROPERTY_GRAPHIC
,
2637 BASEPROPERTY_HELPTEXT
,
2638 BASEPROPERTY_HELPURL
,
2639 BASEPROPERTY_IMAGEALIGN
,
2640 BASEPROPERTY_IMAGEPOSITION
,
2641 BASEPROPERTY_IMAGEURL
,
2642 BASEPROPERTY_PRINTABLE
,
2643 BASEPROPERTY_TABSTOP
,
2644 BASEPROPERTY_FOCUSONCLICK
,
2646 VCLXContainer::ImplGetPropertyIds( rIds
);
2649 VCLXTabPage::~VCLXTabPage()
2654 void SAL_CALL
VCLXTabPage::draw( sal_Int32 nX
, sal_Int32 nY
)
2656 SolarMutexGuard aGuard
;
2657 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2661 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
2663 pDev
= pWindow
->GetParent()->GetOutDev();
2665 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
2666 pWindow
->Draw( pDev
, aPos
, SystemTextColorFlags::NoControls
);
2670 void SAL_CALL
VCLXTabPage::setProperty(
2671 const OUString
& PropertyName
,
2672 const css::uno::Any
& Value
)
2674 SolarMutexGuard aGuard
;
2675 VclPtr
< TabPage
> pTabPage
= GetAs
< TabPage
>();
2679 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
2681 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2682 switch ( nPropType
)
2684 case BASEPROPERTY_GRAPHIC
:
2686 Reference
< XGraphic
> xGraphic
;
2687 if (( Value
>>= xGraphic
) && xGraphic
.is() )
2689 Graphic
aImage(xGraphic
);
2691 Wallpaper
aWallpaper(aImage
.GetBitmapEx());
2692 aWallpaper
.SetStyle( WallpaperStyle::Scale
);
2693 pTabPage
->SetBackground( aWallpaper
);
2695 else if ( bVoid
|| !xGraphic
.is() )
2697 Color aColor
= pTabPage
->GetControlBackground();
2698 if ( aColor
== COL_AUTO
)
2699 aColor
= pTabPage
->GetSettings().GetStyleSettings().GetDialogColor();
2701 Wallpaper
aWallpaper( aColor
);
2702 pTabPage
->SetBackground( aWallpaper
);
2706 case BASEPROPERTY_TITLE
:
2709 if ( Value
>>= sTitle
)
2711 pTabPage
->SetText(sTitle
);
2718 VCLXContainer::setProperty( PropertyName
, Value
);
2723 TabPage
*VCLXTabPage::getTabPage() const
2725 VclPtr
< TabPage
> pTabPage
= GetAsDynamic
< TabPage
>();
2728 throw uno::RuntimeException();
2734 VCLXFixedHyperlink::VCLXFixedHyperlink() :
2736 maActionListeners( *this )
2741 VCLXFixedHyperlink::~VCLXFixedHyperlink()
2745 void VCLXFixedHyperlink::dispose()
2747 SolarMutexGuard aGuard
;
2749 css::lang::EventObject aObj
;
2750 aObj
.Source
= getXWeak();
2751 maActionListeners
.disposeAndClear( aObj
);
2752 VCLXWindow::dispose();
2755 void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
2757 switch ( rVclWindowEvent
.GetId() )
2759 case VclEventId::ButtonClick
:
2761 if ( maActionListeners
.getLength() )
2763 css::awt::ActionEvent aEvent
;
2764 aEvent
.Source
= getXWeak();
2765 maActionListeners
.actionPerformed( aEvent
);
2770 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
2775 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXFixedHyperlink::CreateAccessibleContext()
2777 return getAccessibleFactory().createAccessibleContext( this );
2780 void VCLXFixedHyperlink::setText( const OUString
& Text
)
2782 SolarMutexGuard aGuard
;
2783 VclPtr
< FixedHyperlink
> pBase
= GetAs
< FixedHyperlink
>();
2785 pBase
->SetText(Text
);
2788 OUString
VCLXFixedHyperlink::getText()
2790 SolarMutexGuard aGuard
;
2793 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2795 aText
= pWindow
->GetText();
2799 void VCLXFixedHyperlink::setURL( const OUString
& URL
)
2801 SolarMutexGuard aGuard
;
2802 VclPtr
< FixedHyperlink
> pBase
= GetAs
< FixedHyperlink
>();
2804 pBase
->SetURL( URL
);
2807 OUString
VCLXFixedHyperlink::getURL( )
2809 SolarMutexGuard aGuard
;
2812 VclPtr
< FixedHyperlink
> pBase
= GetAs
< FixedHyperlink
>();
2814 aText
= pBase
->GetURL();
2818 void VCLXFixedHyperlink::setAlignment( sal_Int16 nAlign
)
2820 SolarMutexGuard aGuard
;
2822 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2826 WinBits nNewBits
= 0;
2827 if ( nAlign
== css::awt::TextAlign::LEFT
)
2829 else if ( nAlign
== css::awt::TextAlign::CENTER
)
2830 nNewBits
= WB_CENTER
;
2832 nNewBits
= WB_RIGHT
;
2834 WinBits nStyle
= pWindow
->GetStyle();
2835 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
2836 pWindow
->SetStyle( nStyle
| nNewBits
);
2839 sal_Int16
VCLXFixedHyperlink::getAlignment()
2841 SolarMutexGuard aGuard
;
2843 sal_Int16 nAlign
= 0;
2844 VclPtr
< vcl::Window
> pWindow
= GetWindow();
2847 WinBits nStyle
= pWindow
->GetStyle();
2848 if ( nStyle
& WB_LEFT
)
2849 nAlign
= css::awt::TextAlign::LEFT
;
2850 else if ( nStyle
& WB_CENTER
)
2851 nAlign
= css::awt::TextAlign::CENTER
;
2853 nAlign
= css::awt::TextAlign::RIGHT
;
2858 void VCLXFixedHyperlink::addActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
2860 SolarMutexGuard aGuard
;
2861 maActionListeners
.addInterface( l
);
2864 void VCLXFixedHyperlink::removeActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
2866 SolarMutexGuard aGuard
;
2867 maActionListeners
.removeInterface( l
);
2870 css::awt::Size
VCLXFixedHyperlink::getMinimumSize( )
2872 SolarMutexGuard aGuard
;
2874 VclPtr
< FixedText
> pFixedText
= GetAs
< FixedText
>();
2876 aSz
= pFixedText
->CalcMinimumSize();
2877 return AWTSize(aSz
);
2880 css::awt::Size
VCLXFixedHyperlink::getPreferredSize( )
2882 return getMinimumSize();
2885 css::awt::Size
VCLXFixedHyperlink::calcAdjustedSize( const css::awt::Size
& rNewSize
)
2887 SolarMutexGuard aGuard
;
2888 Size
aSz( VCLUnoHelper::ConvertToVCLSize( rNewSize
));
2889 VclPtr
< FixedText
> pFixedText
= GetAs
< FixedText
>();
2892 Size aMinSz
= pFixedText
->CalcMinimumSize(rNewSize
.Width
);
2893 if ( ( aSz
.Width() > aMinSz
.Width() ) && ( aSz
.Height() < aMinSz
.Height() ) )
2894 aSz
.setHeight( aMinSz
.Height() );
2899 return VCLUnoHelper::ConvertToAWTSize(aSz
);
2902 void VCLXFixedHyperlink::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
2904 SolarMutexGuard aGuard
;
2906 VclPtr
< FixedHyperlink
> pBase
= GetAs
< FixedHyperlink
>();
2910 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2911 switch ( nPropType
)
2913 case BASEPROPERTY_LABEL
:
2916 if ( Value
>>= sNewLabel
)
2917 pBase
->SetText(sNewLabel
);
2921 case BASEPROPERTY_URL
:
2924 if ( Value
>>= sNewURL
)
2925 pBase
->SetURL( sNewURL
);
2931 VCLXWindow::setProperty( PropertyName
, Value
);
2936 css::uno::Any
VCLXFixedHyperlink::getProperty( const OUString
& PropertyName
)
2938 SolarMutexGuard aGuard
;
2940 css::uno::Any aProp
;
2941 VclPtr
< FixedHyperlink
> pBase
= GetAs
< FixedHyperlink
>();
2944 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
2945 switch ( nPropType
)
2947 case BASEPROPERTY_URL
:
2949 aProp
<<= pBase
->GetURL();
2955 aProp
= VCLXWindow::getProperty( PropertyName
);
2962 void VCLXFixedHyperlink::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
2964 PushPropertyIds( rIds
,
2966 BASEPROPERTY_BACKGROUNDCOLOR
,
2967 BASEPROPERTY_BORDER
,
2968 BASEPROPERTY_BORDERCOLOR
,
2969 BASEPROPERTY_DEFAULTCONTROL
,
2970 BASEPROPERTY_ENABLED
,
2971 BASEPROPERTY_ENABLEVISIBLE
,
2972 BASEPROPERTY_FONTDESCRIPTOR
,
2973 BASEPROPERTY_HELPTEXT
,
2974 BASEPROPERTY_HELPURL
,
2976 BASEPROPERTY_MULTILINE
,
2977 BASEPROPERTY_NOLABEL
,
2978 BASEPROPERTY_PRINTABLE
,
2979 BASEPROPERTY_TABSTOP
,
2980 BASEPROPERTY_VERTICALALIGN
,
2982 BASEPROPERTY_WRITING_MODE
,
2983 BASEPROPERTY_CONTEXT_WRITING_MODE
,
2985 VCLXWindow::ImplGetPropertyIds( rIds
);
2990 void VCLXFixedText::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
2992 PushPropertyIds( rIds
,
2994 BASEPROPERTY_BACKGROUNDCOLOR
,
2995 BASEPROPERTY_BORDER
,
2996 BASEPROPERTY_BORDERCOLOR
,
2997 BASEPROPERTY_DEFAULTCONTROL
,
2998 BASEPROPERTY_ENABLED
,
2999 BASEPROPERTY_ENABLEVISIBLE
,
3000 BASEPROPERTY_FONTDESCRIPTOR
,
3001 BASEPROPERTY_HELPTEXT
,
3002 BASEPROPERTY_HELPURL
,
3004 BASEPROPERTY_MULTILINE
,
3005 BASEPROPERTY_NOLABEL
,
3006 BASEPROPERTY_PRINTABLE
,
3007 BASEPROPERTY_TABSTOP
,
3008 BASEPROPERTY_VERTICALALIGN
,
3009 BASEPROPERTY_WRITING_MODE
,
3010 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3011 BASEPROPERTY_REFERENCE_DEVICE
,
3012 BASEPROPERTY_HIGHLIGHT_COLOR
,
3013 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
3015 VCLXWindow::ImplGetPropertyIds( rIds
);
3018 VCLXFixedText::VCLXFixedText()
3022 VCLXFixedText::~VCLXFixedText()
3026 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXFixedText::CreateAccessibleContext()
3028 return getAccessibleFactory().createAccessibleContext( this );
3031 void VCLXFixedText::setText( const OUString
& Text
)
3033 SolarMutexGuard aGuard
;
3035 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3037 pWindow
->SetText( Text
);
3040 OUString
VCLXFixedText::getText()
3042 SolarMutexGuard aGuard
;
3045 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3047 aText
= pWindow
->GetText();
3051 void VCLXFixedText::setAlignment( sal_Int16 nAlign
)
3053 SolarMutexGuard aGuard
;
3055 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3059 WinBits nNewBits
= 0;
3060 if ( nAlign
== css::awt::TextAlign::LEFT
)
3062 else if ( nAlign
== css::awt::TextAlign::CENTER
)
3063 nNewBits
= WB_CENTER
;
3065 nNewBits
= WB_RIGHT
;
3067 WinBits nStyle
= pWindow
->GetStyle();
3068 nStyle
&= ~(WB_LEFT
|WB_CENTER
|WB_RIGHT
);
3069 pWindow
->SetStyle( nStyle
| nNewBits
);
3072 sal_Int16
VCLXFixedText::getAlignment()
3074 SolarMutexGuard aGuard
;
3076 sal_Int16 nAlign
= 0;
3077 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3080 WinBits nStyle
= pWindow
->GetStyle();
3081 if ( nStyle
& WB_LEFT
)
3082 nAlign
= css::awt::TextAlign::LEFT
;
3083 else if ( nStyle
& WB_CENTER
)
3084 nAlign
= css::awt::TextAlign::CENTER
;
3086 nAlign
= css::awt::TextAlign::RIGHT
;
3091 css::awt::Size
VCLXFixedText::getMinimumSize( )
3093 SolarMutexGuard aGuard
;
3096 VclPtr
< FixedText
> pFixedText
= GetAs
< FixedText
>();
3098 aSz
= pFixedText
->CalcMinimumSize();
3099 return AWTSize(aSz
);
3102 css::awt::Size
VCLXFixedText::getPreferredSize( )
3104 return getMinimumSize();
3107 css::awt::Size
VCLXFixedText::calcAdjustedSize( const css::awt::Size
& rMaxSize
)
3109 SolarMutexGuard aGuard
;
3111 Size
aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize
) );
3112 VclPtr
< FixedText
> pFixedText
= GetAs
< FixedText
>();
3114 aAdjustedSize
= pFixedText
->CalcMinimumSize( rMaxSize
.Width
);
3115 return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize
);
3120 void VCLXScrollBar::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
3122 PushPropertyIds( rIds
,
3123 BASEPROPERTY_BACKGROUNDCOLOR
,
3124 BASEPROPERTY_BLOCKINCREMENT
,
3125 BASEPROPERTY_BORDER
,
3126 BASEPROPERTY_BORDERCOLOR
,
3127 BASEPROPERTY_DEFAULTCONTROL
,
3128 BASEPROPERTY_ENABLED
,
3129 BASEPROPERTY_ENABLEVISIBLE
,
3130 BASEPROPERTY_HELPTEXT
,
3131 BASEPROPERTY_HELPURL
,
3132 BASEPROPERTY_LINEINCREMENT
,
3133 BASEPROPERTY_LIVE_SCROLL
,
3134 BASEPROPERTY_ORIENTATION
,
3135 BASEPROPERTY_PRINTABLE
,
3136 BASEPROPERTY_REPEAT_DELAY
,
3137 BASEPROPERTY_SCROLLVALUE
,
3138 BASEPROPERTY_SCROLLVALUE_MAX
,
3139 BASEPROPERTY_SCROLLVALUE_MIN
,
3140 BASEPROPERTY_SYMBOL_COLOR
,
3141 BASEPROPERTY_TABSTOP
,
3142 BASEPROPERTY_VISIBLESIZE
,
3143 BASEPROPERTY_WRITING_MODE
,
3144 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3146 VCLXWindow::ImplGetPropertyIds( rIds
);
3149 VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
3153 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXScrollBar::CreateAccessibleContext()
3155 return getAccessibleFactory().createAccessibleContext( this );
3158 // css::lang::XComponent
3159 void VCLXScrollBar::dispose()
3161 SolarMutexGuard aGuard
;
3163 css::lang::EventObject aObj
;
3164 aObj
.Source
= getXWeak();
3165 maAdjustmentListeners
.disposeAndClear( aObj
);
3166 VCLXWindow::dispose();
3169 // css::awt::XScrollbar
3170 void VCLXScrollBar::addAdjustmentListener( const css::uno::Reference
< css::awt::XAdjustmentListener
> & l
)
3172 SolarMutexGuard aGuard
;
3173 maAdjustmentListeners
.addInterface( l
);
3176 void VCLXScrollBar::removeAdjustmentListener( const css::uno::Reference
< css::awt::XAdjustmentListener
> & l
)
3178 SolarMutexGuard aGuard
;
3179 maAdjustmentListeners
.removeInterface( l
);
3182 void VCLXScrollBar::setValue( sal_Int32 n
)
3184 SolarMutexGuard aGuard
;
3186 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3188 pScrollBar
->DoScroll( n
);
3191 void VCLXScrollBar::setValues( sal_Int32 nValue
, sal_Int32 nVisible
, sal_Int32 nMax
)
3193 SolarMutexGuard aGuard
;
3195 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3198 pScrollBar
->SetVisibleSize( nVisible
);
3199 pScrollBar
->SetRangeMax( nMax
);
3200 pScrollBar
->DoScroll( nValue
);
3204 sal_Int32
VCLXScrollBar::getValue()
3206 SolarMutexGuard aGuard
;
3208 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3209 return pScrollBar
? pScrollBar
->GetThumbPos() : 0;
3212 void VCLXScrollBar::setMaximum( sal_Int32 n
)
3214 SolarMutexGuard aGuard
;
3216 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3218 pScrollBar
->SetRangeMax( n
);
3221 sal_Int32
VCLXScrollBar::getMaximum()
3223 SolarMutexGuard aGuard
;
3225 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3226 return pScrollBar
? pScrollBar
->GetRangeMax() : 0;
3229 void VCLXScrollBar::setMinimum( sal_Int32 n
)
3231 SolarMutexGuard aGuard
;
3233 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3235 pScrollBar
->SetRangeMin( n
);
3238 sal_Int32
VCLXScrollBar::getMinimum() const
3240 SolarMutexGuard aGuard
;
3242 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3243 return pScrollBar
? pScrollBar
->GetRangeMin() : 0;
3246 void VCLXScrollBar::setLineIncrement( sal_Int32 n
)
3248 SolarMutexGuard aGuard
;
3250 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3252 pScrollBar
->SetLineSize( n
);
3255 sal_Int32
VCLXScrollBar::getLineIncrement()
3257 SolarMutexGuard aGuard
;
3259 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3260 return pScrollBar
? pScrollBar
->GetLineSize() : 0;
3263 void VCLXScrollBar::setBlockIncrement( sal_Int32 n
)
3265 SolarMutexGuard aGuard
;
3267 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3269 pScrollBar
->SetPageSize( n
);
3272 sal_Int32
VCLXScrollBar::getBlockIncrement()
3274 SolarMutexGuard aGuard
;
3276 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3277 return pScrollBar
? pScrollBar
->GetPageSize() : 0;
3280 void VCLXScrollBar::setVisibleSize( sal_Int32 n
)
3282 SolarMutexGuard aGuard
;
3284 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3286 pScrollBar
->SetVisibleSize( n
);
3289 sal_Int32
VCLXScrollBar::getVisibleSize()
3291 SolarMutexGuard aGuard
;
3293 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3294 return pScrollBar
? pScrollBar
->GetVisibleSize() : 0;
3297 void VCLXScrollBar::setOrientation( sal_Int32 n
)
3299 SolarMutexGuard aGuard
;
3301 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3304 WinBits nStyle
= pWindow
->GetStyle();
3305 nStyle
&= ~(WB_HORZ
|WB_VERT
);
3306 if ( n
== css::awt::ScrollBarOrientation::HORIZONTAL
)
3311 pWindow
->SetStyle( nStyle
);
3316 sal_Int32
VCLXScrollBar::getOrientation()
3318 SolarMutexGuard aGuard
;
3321 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3324 WinBits nStyle
= pWindow
->GetStyle();
3325 if ( nStyle
& WB_HORZ
)
3326 n
= css::awt::ScrollBarOrientation::HORIZONTAL
;
3328 n
= css::awt::ScrollBarOrientation::VERTICAL
;
3334 // css::awt::VclWindowPeer
3335 void VCLXScrollBar::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
3337 SolarMutexGuard aGuard
;
3339 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3343 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
3345 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3346 switch ( nPropType
)
3348 case BASEPROPERTY_LIVE_SCROLL
:
3353 OSL_VERIFY( Value
>>= bDo
);
3355 AllSettings
aSettings( pScrollBar
->GetSettings() );
3356 StyleSettings
aStyle( aSettings
.GetStyleSettings() );
3357 DragFullOptions nDragOptions
= aStyle
.GetDragFullOptions();
3359 nDragOptions
|= DragFullOptions::Scroll
;
3361 nDragOptions
&= ~DragFullOptions::Scroll
;
3362 aStyle
.SetDragFullOptions( nDragOptions
);
3363 aSettings
.SetStyleSettings( aStyle
);
3364 pScrollBar
->SetSettings( aSettings
);
3368 case BASEPROPERTY_SCROLLVALUE
:
3378 case BASEPROPERTY_SCROLLVALUE_MAX
:
3379 case BASEPROPERTY_SCROLLVALUE_MIN
:
3386 if ( nPropType
== BASEPROPERTY_SCROLLVALUE_MAX
)
3394 case BASEPROPERTY_LINEINCREMENT
:
3400 setLineIncrement( n
);
3404 case BASEPROPERTY_BLOCKINCREMENT
:
3410 setBlockIncrement( n
);
3414 case BASEPROPERTY_VISIBLESIZE
:
3420 setVisibleSize( n
);
3424 case BASEPROPERTY_ORIENTATION
:
3430 setOrientation( n
);
3435 case BASEPROPERTY_BACKGROUNDCOLOR
:
3437 // the default implementation of the base class doesn't work here, since our
3438 // interpretation for this property is slightly different
3439 ::toolkit::setButtonLikeFaceColor( pScrollBar
, Value
);
3445 VCLXWindow::setProperty( PropertyName
, Value
);
3450 css::uno::Any
VCLXScrollBar::getProperty( const OUString
& PropertyName
)
3452 SolarMutexGuard aGuard
;
3454 css::uno::Any aProp
;
3455 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3458 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3460 switch ( nPropType
)
3462 case BASEPROPERTY_LIVE_SCROLL
:
3464 aProp
<<= bool( pScrollBar
->GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Scroll
);
3467 case BASEPROPERTY_SCROLLVALUE
:
3469 aProp
<<= getValue();
3472 case BASEPROPERTY_SCROLLVALUE_MAX
:
3474 aProp
<<= getMaximum();
3477 case BASEPROPERTY_SCROLLVALUE_MIN
:
3479 aProp
<<= getMinimum();
3482 case BASEPROPERTY_LINEINCREMENT
:
3484 aProp
<<= getLineIncrement();
3487 case BASEPROPERTY_BLOCKINCREMENT
:
3489 aProp
<<= getBlockIncrement();
3492 case BASEPROPERTY_VISIBLESIZE
:
3494 aProp
<<= getVisibleSize();
3497 case BASEPROPERTY_ORIENTATION
:
3499 aProp
<<= getOrientation();
3502 case BASEPROPERTY_BACKGROUNDCOLOR
:
3504 // the default implementation of the base class doesn't work here, since our
3505 // interpretation for this property is slightly different
3506 aProp
= ::toolkit::getButtonLikeFaceColor( pScrollBar
);
3512 aProp
= VCLXWindow::getProperty( PropertyName
);
3519 void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
3521 switch ( rVclWindowEvent
.GetId() )
3523 case VclEventId::ScrollbarScroll
:
3525 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
3526 // since we call listeners below, there is a potential that we will be destroyed
3527 // in during the listener call. To prevent the resulting crashes, we keep us
3528 // alive as long as we're here
3530 if ( maAdjustmentListeners
.getLength() )
3532 VclPtr
< ScrollBar
> pScrollBar
= GetAs
< ScrollBar
>();
3536 css::awt::AdjustmentEvent aEvent
;
3537 aEvent
.Source
= getXWeak();
3538 aEvent
.Value
= pScrollBar
->GetThumbPos();
3540 // set adjustment type
3541 ScrollType aType
= pScrollBar
->GetType();
3542 if ( aType
== ScrollType::LineUp
|| aType
== ScrollType::LineDown
)
3544 aEvent
.Type
= css::awt::AdjustmentType_ADJUST_LINE
;
3546 else if ( aType
== ScrollType::PageUp
|| aType
== ScrollType::PageDown
)
3548 aEvent
.Type
= css::awt::AdjustmentType_ADJUST_PAGE
;
3550 else if ( aType
== ScrollType::Drag
)
3552 aEvent
.Type
= css::awt::AdjustmentType_ADJUST_ABS
;
3555 maAdjustmentListeners
.adjustmentValueChanged( aEvent
);
3562 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
3567 css::awt::Size
VCLXScrollBar::implGetMinimumSize( vcl::Window
const * p
)
3569 tools::Long n
= p
->GetSettings().GetStyleSettings().GetScrollBarSize();
3570 return css::awt::Size( n
, n
);
3573 css::awt::Size SAL_CALL
VCLXScrollBar::getMinimumSize()
3575 SolarMutexGuard aGuard
;
3576 return implGetMinimumSize( GetWindow() );
3582 void VCLXEdit::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
3584 PushPropertyIds( rIds
,
3586 BASEPROPERTY_BACKGROUNDCOLOR
,
3587 BASEPROPERTY_BORDER
,
3588 BASEPROPERTY_BORDERCOLOR
,
3589 BASEPROPERTY_DEFAULTCONTROL
,
3590 BASEPROPERTY_ECHOCHAR
,
3591 BASEPROPERTY_ENABLED
,
3592 BASEPROPERTY_ENABLEVISIBLE
,
3593 BASEPROPERTY_FONTDESCRIPTOR
,
3594 BASEPROPERTY_HARDLINEBREAKS
,
3595 BASEPROPERTY_HELPTEXT
,
3596 BASEPROPERTY_HELPURL
,
3597 BASEPROPERTY_HSCROLL
,
3598 BASEPROPERTY_LINE_END_FORMAT
,
3599 BASEPROPERTY_MAXTEXTLEN
,
3600 BASEPROPERTY_MULTILINE
,
3601 BASEPROPERTY_PRINTABLE
,
3602 BASEPROPERTY_READONLY
,
3603 BASEPROPERTY_TABSTOP
,
3605 BASEPROPERTY_VSCROLL
,
3606 BASEPROPERTY_HIDEINACTIVESELECTION
,
3607 BASEPROPERTY_PAINTTRANSPARENT
,
3608 BASEPROPERTY_AUTOHSCROLL
,
3609 BASEPROPERTY_AUTOVSCROLL
,
3610 BASEPROPERTY_VERTICALALIGN
,
3611 BASEPROPERTY_WRITING_MODE
,
3612 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3613 BASEPROPERTY_HIGHLIGHT_COLOR
,
3614 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
3616 VCLXWindow::ImplGetPropertyIds( rIds
);
3619 VCLXEdit::VCLXEdit() : maTextListeners( *this )
3623 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXEdit::CreateAccessibleContext()
3625 return getAccessibleFactory().createAccessibleContext( this );
3628 void VCLXEdit::dispose()
3630 SolarMutexGuard aGuard
;
3632 css::lang::EventObject aObj
;
3633 aObj
.Source
= getXWeak();
3634 maTextListeners
.disposeAndClear( aObj
);
3635 VCLXWindow::dispose();
3638 void VCLXEdit::addTextListener( const css::uno::Reference
< css::awt::XTextListener
> & l
)
3640 SolarMutexGuard aGuard
;
3641 GetTextListeners().addInterface( l
);
3644 void VCLXEdit::removeTextListener( const css::uno::Reference
< css::awt::XTextListener
> & l
)
3646 SolarMutexGuard aGuard
;
3647 GetTextListeners().removeInterface( l
);
3650 void VCLXEdit::setText( const OUString
& aText
)
3652 SolarMutexGuard aGuard
;
3654 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3657 pEdit
->SetText( aText
);
3659 // #107218# Call same listeners like VCL would do after user interaction
3660 SetSynthesizingVCLEvent( true );
3661 pEdit
->SetModifyFlag();
3663 SetSynthesizingVCLEvent( false );
3667 void VCLXEdit::insertText( const css::awt::Selection
& rSel
, const OUString
& aText
)
3669 SolarMutexGuard aGuard
;
3671 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3674 pEdit
->SetSelection( Selection( rSel
.Min
, rSel
.Max
) );
3675 pEdit
->ReplaceSelected( aText
);
3677 // #107218# Call same listeners like VCL would do after user interaction
3678 SetSynthesizingVCLEvent( true );
3679 pEdit
->SetModifyFlag();
3681 SetSynthesizingVCLEvent( false );
3685 OUString
VCLXEdit::getText()
3687 SolarMutexGuard aGuard
;
3690 VclPtr
< vcl::Window
> pWindow
= GetWindow();
3692 aText
= pWindow
->GetText();
3696 OUString
VCLXEdit::getSelectedText()
3698 SolarMutexGuard aGuard
;
3701 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3703 aText
= pEdit
->GetSelected();
3708 void VCLXEdit::setSelection( const css::awt::Selection
& aSelection
)
3710 SolarMutexGuard aGuard
;
3712 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3714 pEdit
->SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
3717 css::awt::Selection
VCLXEdit::getSelection()
3719 SolarMutexGuard aGuard
;
3722 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3724 aSel
= pEdit
->GetSelection();
3725 return css::awt::Selection( aSel
.Min(), aSel
.Max() );
3728 sal_Bool
VCLXEdit::isEditable()
3730 SolarMutexGuard aGuard
;
3732 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3733 return pEdit
&& !pEdit
->IsReadOnly() && pEdit
->IsEnabled();
3736 void VCLXEdit::setEditable( sal_Bool bEditable
)
3738 SolarMutexGuard aGuard
;
3740 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3742 pEdit
->SetReadOnly( !bEditable
);
3746 void VCLXEdit::setMaxTextLen( sal_Int16 nLen
)
3748 SolarMutexGuard aGuard
;
3750 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3752 pEdit
->SetMaxTextLen( nLen
);
3755 sal_Int16
VCLXEdit::getMaxTextLen()
3757 SolarMutexGuard aGuard
;
3759 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3760 return pEdit
? pEdit
->GetMaxTextLen() : 0;
3763 void VCLXEdit::setEchoChar( sal_Unicode cEcho
)
3765 SolarMutexGuard aGuard
;
3767 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3769 pEdit
->SetEchoChar( cEcho
);
3772 void VCLXEdit::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
3774 SolarMutexGuard aGuard
;
3776 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3780 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3781 switch ( nPropType
)
3783 case BASEPROPERTY_HIDEINACTIVESELECTION
:
3784 ::toolkit::adjustBooleanWindowStyle( Value
, pEdit
, WB_NOHIDESELECTION
, true );
3785 if ( pEdit
->GetSubEdit() )
3786 ::toolkit::adjustBooleanWindowStyle( Value
, pEdit
->GetSubEdit(), WB_NOHIDESELECTION
, true );
3789 case BASEPROPERTY_READONLY
:
3793 pEdit
->SetReadOnly( b
);
3796 case BASEPROPERTY_ECHOCHAR
:
3798 sal_Int16 n
= sal_Int16();
3800 pEdit
->SetEchoChar( n
);
3803 case BASEPROPERTY_MAXTEXTLEN
:
3805 sal_Int16 n
= sal_Int16();
3807 pEdit
->SetMaxTextLen( n
);
3812 VCLXWindow::setProperty( PropertyName
, Value
);
3817 css::uno::Any
VCLXEdit::getProperty( const OUString
& PropertyName
)
3819 SolarMutexGuard aGuard
;
3821 css::uno::Any aProp
;
3822 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3825 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
3826 switch ( nPropType
)
3828 case BASEPROPERTY_HIDEINACTIVESELECTION
:
3829 aProp
<<= ( ( pEdit
->GetStyle() & WB_NOHIDESELECTION
) == 0 );
3831 case BASEPROPERTY_READONLY
:
3832 aProp
<<= pEdit
->IsReadOnly();
3834 case BASEPROPERTY_ECHOCHAR
:
3835 aProp
<<= static_cast<sal_Int16
>(pEdit
->GetEchoChar());
3837 case BASEPROPERTY_MAXTEXTLEN
:
3838 aProp
<<= static_cast<sal_Int16
>(pEdit
->GetMaxTextLen());
3842 aProp
= VCLXWindow::getProperty( PropertyName
);
3849 css::awt::Size
VCLXEdit::getMinimumSize( )
3851 SolarMutexGuard aGuard
;
3854 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3856 aSz
= pEdit
->CalcMinimumSize();
3857 return AWTSize(aSz
);
3860 css::awt::Size
VCLXEdit::getPreferredSize( )
3862 SolarMutexGuard aGuard
;
3865 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3868 aSz
= pEdit
->CalcMinimumSize();
3869 aSz
.AdjustHeight(4 );
3871 return AWTSize(aSz
);
3874 css::awt::Size
VCLXEdit::calcAdjustedSize( const css::awt::Size
& rNewSize
)
3876 SolarMutexGuard aGuard
;
3878 css::awt::Size aSz
= rNewSize
;
3879 css::awt::Size aMinSz
= getMinimumSize();
3880 if ( aSz
.Height
!= aMinSz
.Height
)
3881 aSz
.Height
= aMinSz
.Height
;
3886 css::awt::Size
VCLXEdit::getMinimumSize( sal_Int16 nCols
, sal_Int16
)
3888 SolarMutexGuard aGuard
;
3891 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3895 aSz
= pEdit
->CalcSize( nCols
);
3897 aSz
= pEdit
->CalcMinimumSize();
3899 return AWTSize(aSz
);
3902 void VCLXEdit::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
)
3904 SolarMutexGuard aGuard
;
3908 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
3910 nCols
= pEdit
->GetMaxVisChars();
3913 void VCLXEdit::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
3915 switch ( rVclWindowEvent
.GetId() )
3917 case VclEventId::EditModify
:
3919 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
3920 // since we call listeners below, there is a potential that we will be destroyed
3921 // during the listener call. To prevent the resulting crashes, we keep us
3922 // alive as long as we're here
3924 if ( GetTextListeners().getLength() )
3926 css::awt::TextEvent aEvent
;
3927 aEvent
.Source
= getXWeak();
3928 GetTextListeners().textChanged( aEvent
);
3934 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
3942 void VCLXComboBox::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
3944 PushPropertyIds( rIds
,
3945 BASEPROPERTY_AUTOCOMPLETE
,
3946 BASEPROPERTY_BACKGROUNDCOLOR
,
3947 BASEPROPERTY_BORDER
,
3948 BASEPROPERTY_BORDERCOLOR
,
3949 BASEPROPERTY_DEFAULTCONTROL
,
3950 BASEPROPERTY_DROPDOWN
,
3951 BASEPROPERTY_ENABLED
,
3952 BASEPROPERTY_ENABLEVISIBLE
,
3953 BASEPROPERTY_FONTDESCRIPTOR
,
3954 BASEPROPERTY_HELPTEXT
,
3955 BASEPROPERTY_HELPURL
,
3956 BASEPROPERTY_LINECOUNT
,
3957 BASEPROPERTY_MAXTEXTLEN
,
3958 BASEPROPERTY_PRINTABLE
,
3959 BASEPROPERTY_READONLY
,
3960 BASEPROPERTY_STRINGITEMLIST
,
3961 BASEPROPERTY_TYPEDITEMLIST
,
3962 BASEPROPERTY_TABSTOP
,
3964 BASEPROPERTY_HIDEINACTIVESELECTION
,
3966 BASEPROPERTY_WRITING_MODE
,
3967 BASEPROPERTY_CONTEXT_WRITING_MODE
,
3968 BASEPROPERTY_REFERENCE_DEVICE
,
3969 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
3970 BASEPROPERTY_HIGHLIGHT_COLOR
,
3971 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
3973 // no, don't call VCLXEdit here - it has properties which we do *not* want to have at combo box
3974 // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
3975 // VCLXEdit::ImplGetPropertyIds( rIds );
3976 VCLXWindow::ImplGetPropertyIds( rIds
);
3979 VCLXComboBox::VCLXComboBox()
3980 : maActionListeners( *this ), maItemListeners( *this )
3984 VCLXComboBox::~VCLXComboBox()
3986 SAL_INFO("toolkit", __FUNCTION__
);
3989 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXComboBox::CreateAccessibleContext()
3991 SolarMutexGuard aGuard
;
3993 return getAccessibleFactory().createAccessibleContext( this );
3996 void VCLXComboBox::dispose()
3998 SolarMutexGuard aGuard
;
4000 css::lang::EventObject aObj
;
4001 aObj
.Source
= getXWeak();
4002 maItemListeners
.disposeAndClear( aObj
);
4003 maActionListeners
.disposeAndClear( aObj
);
4004 VCLXEdit::dispose();
4008 void VCLXComboBox::addItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
4010 SolarMutexGuard aGuard
;
4011 maItemListeners
.addInterface( l
);
4014 void VCLXComboBox::removeItemListener( const css::uno::Reference
< css::awt::XItemListener
> & l
)
4016 SolarMutexGuard aGuard
;
4017 maItemListeners
.removeInterface( l
);
4020 void VCLXComboBox::addActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
4022 SolarMutexGuard aGuard
;
4023 maActionListeners
.addInterface( l
);
4026 void VCLXComboBox::removeActionListener( const css::uno::Reference
< css::awt::XActionListener
> & l
)
4028 SolarMutexGuard aGuard
;
4029 maActionListeners
.removeInterface( l
);
4032 void VCLXComboBox::addItem( const OUString
& aItem
, sal_Int16 nPos
)
4034 SolarMutexGuard aGuard
;
4036 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4038 pBox
->InsertEntry( aItem
, nPos
);
4041 void VCLXComboBox::addItems( const css::uno::Sequence
< OUString
>& aItems
, sal_Int16 nPos
)
4043 SolarMutexGuard aGuard
;
4045 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4049 sal_uInt16 nP
= nPos
;
4050 for ( const auto& rItem
: aItems
)
4052 pBox
->InsertEntry( rItem
, nP
);
4055 OSL_FAIL( "VCLXComboBox::addItems: too many entries!" );
4056 // skip remaining entries, list cannot hold them, anyway
4062 void VCLXComboBox::removeItems( sal_Int16 nPos
, sal_Int16 nCount
)
4064 SolarMutexGuard aGuard
;
4066 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4069 for ( sal_uInt16 n
= nCount
; n
; )
4070 pBox
->RemoveEntryAt( nPos
+ (--n
) );
4074 sal_Int16
VCLXComboBox::getItemCount()
4076 SolarMutexGuard aGuard
;
4078 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4079 return pBox
? pBox
->GetEntryCount() : 0;
4082 OUString
VCLXComboBox::getItem( sal_Int16 nPos
)
4084 SolarMutexGuard aGuard
;
4087 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4089 aItem
= pBox
->GetEntry( nPos
);
4093 css::uno::Sequence
< OUString
> VCLXComboBox::getItems()
4095 SolarMutexGuard aGuard
;
4097 css::uno::Sequence
< OUString
> aSeq
;
4098 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4101 auto n
= pBox
->GetEntryCount();
4102 aSeq
= css::uno::Sequence
< OUString
>( n
);
4106 aSeq
.getArray()[n
] = pBox
->GetEntry( n
);
4112 void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines
)
4114 SolarMutexGuard aGuard
;
4116 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4118 pBox
->SetDropDownLineCount( nLines
);
4121 sal_Int16
VCLXComboBox::getDropDownLineCount()
4123 SolarMutexGuard aGuard
;
4125 sal_Int16 nLines
= 0;
4126 VclPtr
< ComboBox
> pBox
= GetAs
< ComboBox
>();
4128 nLines
= pBox
->GetDropDownLineCount();
4132 void VCLXComboBox::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
4134 SolarMutexGuard aGuard
;
4136 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4140 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
4141 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4142 switch ( nPropType
)
4144 case BASEPROPERTY_LINECOUNT
:
4146 sal_Int16 n
= sal_Int16();
4148 pComboBox
->SetDropDownLineCount( n
);
4151 case BASEPROPERTY_AUTOCOMPLETE
:
4153 sal_Int16 n
= sal_Int16();
4155 pComboBox
->EnableAutocomplete( n
!= 0 );
4160 pComboBox
->EnableAutocomplete( b
);
4164 case BASEPROPERTY_STRINGITEMLIST
:
4166 css::uno::Sequence
< OUString
> aItems
;
4167 if ( Value
>>= aItems
)
4170 addItems( aItems
, 0 );
4174 case BASEPROPERTY_HIGHLIGHT_COLOR
:
4179 nColor
= Application::GetSettings().GetStyleSettings().GetHighlightColor();
4183 if (!(Value
>>= nColor
))
4186 pComboBox
->SetHighlightColor(nColor
);
4189 case BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
:
4194 nColor
= Application::GetSettings().GetStyleSettings().GetHighlightTextColor();
4198 if (!(Value
>>= nColor
))
4201 pComboBox
->SetHighlightTextColor(nColor
);
4206 VCLXEdit::setProperty( PropertyName
, Value
);
4208 // #109385# SetBorderStyle is not virtual
4209 if ( nPropType
== BASEPROPERTY_BORDER
)
4211 sal_uInt16 nBorder
= sal_uInt16();
4212 if ( (Value
>>= nBorder
) && nBorder
!= 0 )
4213 pComboBox
->SetBorderStyle( static_cast<WindowBorderStyle
>(nBorder
) );
4219 css::uno::Any
VCLXComboBox::getProperty( const OUString
& PropertyName
)
4221 SolarMutexGuard aGuard
;
4223 css::uno::Any aProp
;
4224 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4227 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4228 switch ( nPropType
)
4230 case BASEPROPERTY_LINECOUNT
:
4232 aProp
<<= static_cast<sal_Int16
>(pComboBox
->GetDropDownLineCount());
4235 case BASEPROPERTY_AUTOCOMPLETE
:
4237 aProp
<<= pComboBox
->IsAutocompleteEnabled();
4240 case BASEPROPERTY_STRINGITEMLIST
:
4242 const sal_Int32 nItems
= pComboBox
->GetEntryCount();
4243 css::uno::Sequence
< OUString
> aSeq( nItems
);
4244 OUString
* pStrings
= aSeq
.getArray();
4245 for ( sal_Int32 n
= 0; n
< nItems
; ++n
)
4246 pStrings
[n
] = pComboBox
->GetEntry( n
);
4253 aProp
= VCLXEdit::getProperty( PropertyName
);
4260 void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
4262 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
4263 // since we call listeners below, there is a potential that we will be destroyed
4264 // during the listener call. To prevent the resulting crashes, we keep us
4265 // alive as long as we're here
4267 switch ( rVclWindowEvent
.GetId() )
4269 case VclEventId::ComboboxSelect
:
4270 if ( maItemListeners
.getLength() )
4272 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4275 if ( !pComboBox
->IsTravelSelect() )
4277 css::awt::ItemEvent aEvent
;
4278 aEvent
.Source
= getXWeak();
4279 aEvent
.Highlighted
= 0;
4281 // Set to 0xFFFF on multiple selection, selected entry ID otherwise
4282 aEvent
.Selected
= pComboBox
->GetEntryPos( pComboBox
->GetText() );
4284 maItemListeners
.itemStateChanged( aEvent
);
4290 case VclEventId::ComboboxDoubleClick
:
4291 if ( maActionListeners
.getLength() )
4293 css::awt::ActionEvent aEvent
;
4294 aEvent
.Source
= getXWeak();
4295 // aEvent.ActionCommand = ...;
4296 maActionListeners
.actionPerformed( aEvent
);
4301 VCLXEdit::ProcessWindowEvent( rVclWindowEvent
);
4306 css::awt::Size
VCLXComboBox::getMinimumSize( )
4308 SolarMutexGuard aGuard
;
4311 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4313 aSz
= pComboBox
->CalcMinimumSize();
4314 return AWTSize(aSz
);
4317 css::awt::Size
VCLXComboBox::getPreferredSize( )
4319 SolarMutexGuard aGuard
;
4322 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4325 aSz
= pComboBox
->CalcMinimumSize();
4326 if ( pComboBox
->GetStyle() & WB_DROPDOWN
)
4327 aSz
.AdjustHeight(4 );
4329 return AWTSize(aSz
);
4332 css::awt::Size
VCLXComboBox::calcAdjustedSize( const css::awt::Size
& rNewSize
)
4334 SolarMutexGuard aGuard
;
4336 Size aSz
= VCLSize(rNewSize
);
4337 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4339 aSz
= pComboBox
->CalcAdjustedSize( aSz
);
4340 return AWTSize(aSz
);
4343 css::awt::Size
VCLXComboBox::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
)
4345 SolarMutexGuard aGuard
;
4348 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4350 aSz
= pComboBox
->CalcBlockSize( nCols
, nLines
);
4351 return AWTSize(aSz
);
4354 void VCLXComboBox::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
)
4356 SolarMutexGuard aGuard
;
4359 VclPtr
< ComboBox
> pComboBox
= GetAs
< ComboBox
>();
4363 pComboBox
->GetMaxVisColumnsAndLines( nC
, nL
);
4368 void SAL_CALL
VCLXComboBox::listItemInserted( const ItemListEvent
& i_rEvent
)
4370 SolarMutexGuard aGuard
;
4372 VclPtr
< ComboBox
> pComboBox
= GetAsDynamic
< ComboBox
>();
4374 ENSURE_OR_RETURN_VOID( pComboBox
, "VCLXComboBox::listItemInserted: no ComboBox?!" );
4375 ENSURE_OR_RETURN_VOID( ( i_rEvent
.ItemPosition
>= 0 ) && ( i_rEvent
.ItemPosition
<= pComboBox
->GetEntryCount() ),
4376 "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" );
4377 pComboBox
->InsertEntryWithImage(
4378 i_rEvent
.ItemText
.IsPresent
? i_rEvent
.ItemText
.Value
: OUString(),
4379 i_rEvent
.ItemImageURL
.IsPresent
? lcl_getImageFromURL( i_rEvent
.ItemImageURL
.Value
) : Image(),
4380 i_rEvent
.ItemPosition
);
4383 void SAL_CALL
VCLXComboBox::listItemRemoved( const ItemListEvent
& i_rEvent
)
4385 SolarMutexGuard aGuard
;
4387 VclPtr
< ComboBox
> pComboBox
= GetAsDynamic
< ComboBox
>();
4389 ENSURE_OR_RETURN_VOID( pComboBox
, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
4390 ENSURE_OR_RETURN_VOID( ( i_rEvent
.ItemPosition
>= 0 ) && ( i_rEvent
.ItemPosition
< pComboBox
->GetEntryCount() ),
4391 "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" );
4393 pComboBox
->RemoveEntryAt( i_rEvent
.ItemPosition
);
4396 void SAL_CALL
VCLXComboBox::listItemModified( const ItemListEvent
& i_rEvent
)
4398 SolarMutexGuard aGuard
;
4400 VclPtr
< ComboBox
> pComboBox
= GetAsDynamic
< ComboBox
>();
4402 ENSURE_OR_RETURN_VOID( pComboBox
, "VCLXComboBox::listItemModified: no ComboBox?!" );
4403 ENSURE_OR_RETURN_VOID( ( i_rEvent
.ItemPosition
>= 0 ) && ( i_rEvent
.ItemPosition
< pComboBox
->GetEntryCount() ),
4404 "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" );
4406 // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert
4408 const OUString sNewText
= i_rEvent
.ItemText
.IsPresent
? i_rEvent
.ItemText
.Value
: pComboBox
->GetEntry( i_rEvent
.ItemPosition
);
4409 const Image
aNewImage( i_rEvent
.ItemImageURL
.IsPresent
? lcl_getImageFromURL( i_rEvent
.ItemImageURL
.Value
) : pComboBox
->GetEntryImage( i_rEvent
.ItemPosition
) );
4411 pComboBox
->RemoveEntryAt( i_rEvent
.ItemPosition
);
4412 pComboBox
->InsertEntryWithImage(sNewText
, aNewImage
, i_rEvent
.ItemPosition
);
4415 void SAL_CALL
VCLXComboBox::allItemsRemoved( const EventObject
& )
4417 SolarMutexGuard aGuard
;
4419 VclPtr
< ComboBox
> pComboBox
= GetAsDynamic
< ComboBox
>();
4420 ENSURE_OR_RETURN_VOID( pComboBox
, "VCLXComboBox::listItemModified: no ComboBox?!" );
4425 void SAL_CALL
VCLXComboBox::itemListChanged( const EventObject
& i_rEvent
)
4427 SolarMutexGuard aGuard
;
4429 VclPtr
< ComboBox
> pComboBox
= GetAsDynamic
< ComboBox
>();
4430 ENSURE_OR_RETURN_VOID( pComboBox
, "VCLXComboBox::listItemModified: no ComboBox?!" );
4434 uno::Reference
< beans::XPropertySet
> xPropSet( i_rEvent
.Source
, uno::UNO_QUERY_THROW
);
4435 uno::Reference
< beans::XPropertySetInfo
> xPSI( xPropSet
->getPropertySetInfo(), uno::UNO_SET_THROW
);
4436 // bool localize = xPSI->hasPropertyByName("ResourceResolver");
4437 uno::Reference
< resource::XStringResourceResolver
> xStringResourceResolver
;
4438 if ( xPSI
->hasPropertyByName("ResourceResolver") )
4440 xStringResourceResolver
.set(
4441 xPropSet
->getPropertyValue("ResourceResolver"),
4447 Reference
< XItemList
> xItemList( i_rEvent
.Source
, uno::UNO_QUERY_THROW
);
4448 const uno::Sequence
< beans::Pair
< OUString
, OUString
> > aItems
= xItemList
->getAllItems();
4449 for ( const auto& rItem
: aItems
)
4451 OUString
aLocalizationKey( rItem
.First
);
4452 if ( xStringResourceResolver
.is() && !aLocalizationKey
.isEmpty() && aLocalizationKey
[0] == '&' )
4454 aLocalizationKey
= xStringResourceResolver
->resolveString(aLocalizationKey
.copy( 1 ));
4456 pComboBox
->InsertEntryWithImage(aLocalizationKey
,
4457 lcl_getImageFromURL(rItem
.Second
));
4460 void SAL_CALL
VCLXComboBox::disposing( const EventObject
& i_rEvent
)
4462 // just disambiguate
4463 VCLXEdit::disposing( i_rEvent
);
4468 void VCLXFormattedSpinField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
4470 // Interestingly in the UnoControl API this is
4471 // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
4472 // VCLXSpinField::ImplGetPropertyIds( rIds );
4473 VCLXWindow::ImplGetPropertyIds( rIds
);
4476 VCLXFormattedSpinField::VCLXFormattedSpinField()
4477 : mpFormatter(nullptr)
4481 VCLXFormattedSpinField::~VCLXFormattedSpinField()
4485 void VCLXFormattedSpinField::setStrictFormat( bool bStrict
)
4487 SolarMutexGuard aGuard
;
4489 FormatterBase
* pFormatter
= GetFormatter();
4491 pFormatter
->SetStrictFormat( bStrict
);
4494 bool VCLXFormattedSpinField::isStrictFormat() const
4496 FormatterBase
* pFormatter
= GetFormatter();
4497 return pFormatter
&& pFormatter
->IsStrictFormat();
4501 void VCLXFormattedSpinField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
4503 SolarMutexGuard aGuard
;
4505 FormatterBase
* pFormatter
= GetFormatter();
4509 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4510 switch ( nPropType
)
4512 case BASEPROPERTY_SPIN
:
4517 WinBits nStyle
= GetWindow()->GetStyle() | WB_SPIN
;
4520 GetWindow()->SetStyle( nStyle
);
4524 case BASEPROPERTY_STRICTFORMAT
:
4529 pFormatter
->SetStrictFormat( b
);
4535 VCLXSpinField::setProperty( PropertyName
, Value
);
4540 css::uno::Any
VCLXFormattedSpinField::getProperty( const OUString
& PropertyName
)
4542 SolarMutexGuard aGuard
;
4544 css::uno::Any aProp
;
4545 FormatterBase
* pFormatter
= GetFormatter();
4548 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4549 switch ( nPropType
)
4551 case BASEPROPERTY_TABSTOP
:
4553 aProp
<<= ( GetWindow()->GetStyle() & WB_SPIN
) != 0;
4556 case BASEPROPERTY_STRICTFORMAT
:
4558 aProp
<<= pFormatter
->IsStrictFormat();
4563 aProp
= VCLXSpinField::getProperty( PropertyName
);
4573 void VCLXDateField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
4575 PushPropertyIds( rIds
,
4577 BASEPROPERTY_BACKGROUNDCOLOR
,
4578 BASEPROPERTY_BORDER
,
4579 BASEPROPERTY_BORDERCOLOR
,
4581 BASEPROPERTY_DATEMAX
,
4582 BASEPROPERTY_DATEMIN
,
4583 BASEPROPERTY_DATESHOWCENTURY
,
4584 BASEPROPERTY_DEFAULTCONTROL
,
4585 BASEPROPERTY_DROPDOWN
,
4586 BASEPROPERTY_ENABLED
,
4587 BASEPROPERTY_ENABLEVISIBLE
,
4588 BASEPROPERTY_EXTDATEFORMAT
,
4589 BASEPROPERTY_FONTDESCRIPTOR
,
4590 BASEPROPERTY_HELPTEXT
,
4591 BASEPROPERTY_HELPURL
,
4592 BASEPROPERTY_PRINTABLE
,
4593 BASEPROPERTY_READONLY
,
4594 BASEPROPERTY_REPEAT
,
4595 BASEPROPERTY_REPEAT_DELAY
,
4597 BASEPROPERTY_STRICTFORMAT
,
4598 BASEPROPERTY_TABSTOP
,
4599 BASEPROPERTY_ENFORCE_FORMAT
,
4601 BASEPROPERTY_HIDEINACTIVESELECTION
,
4602 BASEPROPERTY_VERTICALALIGN
,
4603 BASEPROPERTY_WRITING_MODE
,
4604 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4605 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
4606 BASEPROPERTY_HIGHLIGHT_COLOR
,
4607 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
4609 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4612 VCLXDateField::VCLXDateField()
4616 VCLXDateField::~VCLXDateField()
4620 //change the window type here to match the role
4621 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXDateField::CreateAccessibleContext()
4623 VclPtr
< vcl::Window
> pWindow
= GetWindow();
4626 pWindow
->SetType( WindowType::DATEFIELD
);
4628 return getAccessibleFactory().createAccessibleContext( this );
4631 void VCLXDateField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
4633 SolarMutexGuard aGuard
;
4635 if ( !(GetWindow()) )
4638 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
4640 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4641 switch ( nPropType
)
4643 case BASEPROPERTY_DATE
:
4647 GetAs
< DateField
>()->EnableEmptyFieldValue( true );
4648 GetAs
< DateField
>()->SetEmptyFieldValue();
4653 if ((Value
>>= d
) && d
.Year
!= 0)
4658 case BASEPROPERTY_DATEMIN
:
4661 if ((Value
>>= d
) && d
.Year
!= 0)
4665 case BASEPROPERTY_DATEMAX
:
4668 if ((Value
>>= d
) && d
.Year
!= 0)
4672 case BASEPROPERTY_EXTDATEFORMAT
:
4674 sal_Int16 n
= sal_Int16();
4676 GetAs
< DateField
>()->SetExtDateFormat( static_cast<ExtDateFieldFormat
>(n
) );
4679 case BASEPROPERTY_DATESHOWCENTURY
:
4683 GetAs
< DateField
>()->SetShowDateCentury( b
);
4686 case BASEPROPERTY_ENFORCE_FORMAT
:
4688 bool bEnforce( true );
4689 OSL_VERIFY( Value
>>= bEnforce
);
4690 GetAs
< DateField
>()->EnforceValidValue( bEnforce
);
4695 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
4700 css::uno::Any
VCLXDateField::getProperty( const OUString
& PropertyName
)
4702 SolarMutexGuard aGuard
;
4704 css::uno::Any aProp
;
4705 FormatterBase
* pFormatter
= GetFormatter();
4708 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
4709 switch ( nPropType
)
4711 case BASEPROPERTY_DATE
:
4713 aProp
<<= getDate();
4716 case BASEPROPERTY_DATEMIN
:
4721 case BASEPROPERTY_DATEMAX
:
4726 case BASEPROPERTY_DATESHOWCENTURY
:
4728 aProp
<<= GetAs
< DateField
>()->IsShowDateCentury();
4731 case BASEPROPERTY_ENFORCE_FORMAT
:
4733 aProp
<<= GetAs
< DateField
>()->IsEnforceValidValue( );
4738 aProp
= VCLXFormattedSpinField::getProperty( PropertyName
);
4746 void VCLXDateField::setDate( const util::Date
& aDate
)
4748 SolarMutexGuard aGuard
;
4750 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4753 pDateField
->SetDate( aDate
);
4755 // #107218# Call same listeners like VCL would do after user interaction
4756 SetSynthesizingVCLEvent( true );
4757 pDateField
->SetModifyFlag();
4758 pDateField
->Modify();
4759 SetSynthesizingVCLEvent( false );
4763 util::Date
VCLXDateField::getDate()
4765 SolarMutexGuard aGuard
;
4767 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4769 return pDateField
->GetDate().GetUNODate();
4771 return util::Date();
4774 void VCLXDateField::setMin( const util::Date
& aDate
)
4776 SolarMutexGuard aGuard
;
4778 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4780 pDateField
->SetMin( aDate
);
4783 util::Date
VCLXDateField::getMin()
4785 SolarMutexGuard aGuard
;
4787 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4789 return pDateField
->GetMin().GetUNODate();
4791 return util::Date();
4794 void VCLXDateField::setMax( const util::Date
& aDate
)
4796 SolarMutexGuard aGuard
;
4798 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4800 pDateField
->SetMax( aDate
);
4803 util::Date
VCLXDateField::getMax()
4805 SolarMutexGuard aGuard
;
4807 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4809 return pDateField
->GetMax().GetUNODate();
4811 return util::Date();
4814 void VCLXDateField::setFirst( const util::Date
& aDate
)
4816 SolarMutexGuard aGuard
;
4818 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4820 pDateField
->SetFirst( aDate
);
4823 util::Date
VCLXDateField::getFirst()
4825 SolarMutexGuard aGuard
;
4827 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4829 return pDateField
->GetFirst().GetUNODate();
4831 return util::Date();
4834 void VCLXDateField::setLast( const util::Date
& aDate
)
4836 SolarMutexGuard aGuard
;
4838 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4840 pDateField
->SetLast( aDate
);
4843 util::Date
VCLXDateField::getLast()
4845 SolarMutexGuard aGuard
;
4847 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4849 return pDateField
->GetLast().GetUNODate();
4851 return util::Date();
4854 void VCLXDateField::setLongFormat( sal_Bool bLong
)
4856 SolarMutexGuard aGuard
;
4858 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4860 pDateField
->SetLongFormat( bLong
);
4863 sal_Bool
VCLXDateField::isLongFormat()
4865 SolarMutexGuard aGuard
;
4867 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4868 return pDateField
&& pDateField
->IsLongFormat();
4871 void VCLXDateField::setEmpty()
4873 SolarMutexGuard aGuard
;
4875 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4878 pDateField
->SetEmptyDate();
4880 // #107218# Call same listeners like VCL would do after user interaction
4881 SetSynthesizingVCLEvent( true );
4882 pDateField
->SetModifyFlag();
4883 pDateField
->Modify();
4884 SetSynthesizingVCLEvent( false );
4888 sal_Bool
VCLXDateField::isEmpty()
4890 SolarMutexGuard aGuard
;
4892 VclPtr
< DateField
> pDateField
= GetAs
< DateField
>();
4893 return pDateField
&& pDateField
->IsEmptyDate();
4896 void VCLXDateField::setStrictFormat( sal_Bool bStrict
)
4898 VCLXFormattedSpinField::setStrictFormat( bStrict
);
4901 sal_Bool
VCLXDateField::isStrictFormat()
4903 return VCLXFormattedSpinField::isStrictFormat();
4909 void VCLXTimeField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
4911 PushPropertyIds( rIds
,
4913 BASEPROPERTY_BACKGROUNDCOLOR
,
4914 BASEPROPERTY_BORDER
,
4915 BASEPROPERTY_BORDERCOLOR
,
4916 BASEPROPERTY_DEFAULTCONTROL
,
4917 BASEPROPERTY_ENABLED
,
4918 BASEPROPERTY_ENABLEVISIBLE
,
4919 BASEPROPERTY_EXTTIMEFORMAT
,
4920 BASEPROPERTY_FONTDESCRIPTOR
,
4921 BASEPROPERTY_HELPTEXT
,
4922 BASEPROPERTY_HELPURL
,
4923 BASEPROPERTY_PRINTABLE
,
4924 BASEPROPERTY_READONLY
,
4925 BASEPROPERTY_REPEAT
,
4926 BASEPROPERTY_REPEAT_DELAY
,
4928 BASEPROPERTY_STRICTFORMAT
,
4929 BASEPROPERTY_TABSTOP
,
4931 BASEPROPERTY_TIMEMAX
,
4932 BASEPROPERTY_TIMEMIN
,
4933 BASEPROPERTY_ENFORCE_FORMAT
,
4935 BASEPROPERTY_HIDEINACTIVESELECTION
,
4936 BASEPROPERTY_VERTICALALIGN
,
4937 BASEPROPERTY_WRITING_MODE
,
4938 BASEPROPERTY_CONTEXT_WRITING_MODE
,
4939 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
4940 BASEPROPERTY_HIGHLIGHT_COLOR
,
4941 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
4943 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
4946 VCLXTimeField::VCLXTimeField()
4950 VCLXTimeField::~VCLXTimeField()
4954 //change the window type here to match the role
4955 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXTimeField::CreateAccessibleContext()
4957 VclPtr
< vcl::Window
> pWindow
= GetWindow();
4960 pWindow
->SetType( WindowType::TIMEFIELD
);
4962 return getAccessibleFactory().createAccessibleContext( this );
4965 void VCLXTimeField::setTime( const util::Time
& aTime
)
4967 SolarMutexGuard aGuard
;
4969 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
4972 pTimeField
->SetTime( aTime
);
4974 // #107218# Call same listeners like VCL would do after user interaction
4975 SetSynthesizingVCLEvent( true );
4976 pTimeField
->SetModifyFlag();
4977 pTimeField
->Modify();
4978 SetSynthesizingVCLEvent( false );
4982 util::Time
VCLXTimeField::getTime()
4984 SolarMutexGuard aGuard
;
4986 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
4988 return pTimeField
->GetTime().GetUNOTime();
4990 return util::Time();
4993 void VCLXTimeField::setMin( const util::Time
& aTime
)
4995 SolarMutexGuard aGuard
;
4997 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
4999 pTimeField
->SetMin( aTime
);
5002 util::Time
VCLXTimeField::getMin()
5004 SolarMutexGuard aGuard
;
5006 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5008 return pTimeField
->GetMin().GetUNOTime();
5010 return util::Time();
5013 void VCLXTimeField::setMax( const util::Time
& aTime
)
5015 SolarMutexGuard aGuard
;
5017 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5019 pTimeField
->SetMax( aTime
);
5022 util::Time
VCLXTimeField::getMax()
5024 SolarMutexGuard aGuard
;
5026 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5028 return pTimeField
->GetMax().GetUNOTime();
5030 return util::Time();
5033 void VCLXTimeField::setFirst( const util::Time
& aTime
)
5035 SolarMutexGuard aGuard
;
5037 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5039 pTimeField
->SetFirst( aTime
);
5042 util::Time
VCLXTimeField::getFirst()
5044 SolarMutexGuard aGuard
;
5046 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5048 return pTimeField
->GetFirst().GetUNOTime();
5050 return util::Time();
5053 void VCLXTimeField::setLast( const util::Time
& aTime
)
5055 SolarMutexGuard aGuard
;
5057 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5059 pTimeField
->SetLast( aTime
);
5062 util::Time
VCLXTimeField::getLast()
5064 SolarMutexGuard aGuard
;
5066 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5068 return pTimeField
->GetLast().GetUNOTime();
5070 return util::Time();
5073 void VCLXTimeField::setEmpty()
5075 SolarMutexGuard aGuard
;
5077 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5079 pTimeField
->SetEmptyTime();
5082 sal_Bool
VCLXTimeField::isEmpty()
5084 SolarMutexGuard aGuard
;
5086 VclPtr
< TimeField
> pTimeField
= GetAs
< TimeField
>();
5087 return pTimeField
&& pTimeField
->IsEmptyTime();
5090 void VCLXTimeField::setStrictFormat( sal_Bool bStrict
)
5092 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5095 sal_Bool
VCLXTimeField::isStrictFormat()
5097 return VCLXFormattedSpinField::isStrictFormat();
5101 void VCLXTimeField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
5103 SolarMutexGuard aGuard
;
5105 if ( !(GetWindow()) )
5108 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
5110 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5111 switch ( nPropType
)
5113 case BASEPROPERTY_TIME
:
5117 GetAs
< TimeField
>()->EnableEmptyFieldValue( true );
5118 GetAs
< TimeField
>()->SetEmptyFieldValue();
5128 case BASEPROPERTY_TIMEMIN
:
5135 case BASEPROPERTY_TIMEMAX
:
5142 case BASEPROPERTY_EXTTIMEFORMAT
:
5144 sal_Int16 n
= sal_Int16();
5146 GetAs
< TimeField
>()->SetExtFormat( static_cast<ExtTimeFieldFormat
>(n
) );
5149 case BASEPROPERTY_ENFORCE_FORMAT
:
5151 bool bEnforce( true );
5152 OSL_VERIFY( Value
>>= bEnforce
);
5153 GetAs
< TimeField
>()->EnforceValidValue( bEnforce
);
5158 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5163 css::uno::Any
VCLXTimeField::getProperty( const OUString
& PropertyName
)
5165 SolarMutexGuard aGuard
;
5167 css::uno::Any aProp
;
5170 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5171 switch ( nPropType
)
5173 case BASEPROPERTY_TIME
:
5175 aProp
<<= getTime();
5178 case BASEPROPERTY_TIMEMIN
:
5183 case BASEPROPERTY_TIMEMAX
:
5188 case BASEPROPERTY_ENFORCE_FORMAT
:
5190 aProp
<<= GetAs
< TimeField
>()->IsEnforceValidValue( );
5195 aProp
= VCLXFormattedSpinField::getProperty( PropertyName
);
5205 void VCLXNumericField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
5207 PushPropertyIds( rIds
,
5209 BASEPROPERTY_BACKGROUNDCOLOR
,
5210 BASEPROPERTY_BORDER
,
5211 BASEPROPERTY_BORDERCOLOR
,
5212 BASEPROPERTY_DECIMALACCURACY
,
5213 BASEPROPERTY_DEFAULTCONTROL
,
5214 BASEPROPERTY_ENABLED
,
5215 BASEPROPERTY_ENABLEVISIBLE
,
5216 BASEPROPERTY_FONTDESCRIPTOR
,
5217 BASEPROPERTY_HELPTEXT
,
5218 BASEPROPERTY_HELPURL
,
5219 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
5220 BASEPROPERTY_PRINTABLE
,
5221 BASEPROPERTY_READONLY
,
5222 BASEPROPERTY_REPEAT
,
5223 BASEPROPERTY_REPEAT_DELAY
,
5225 BASEPROPERTY_STRICTFORMAT
,
5226 BASEPROPERTY_TABSTOP
,
5227 BASEPROPERTY_VALUEMAX_DOUBLE
,
5228 BASEPROPERTY_VALUEMIN_DOUBLE
,
5229 BASEPROPERTY_VALUESTEP_DOUBLE
,
5230 BASEPROPERTY_VALUE_DOUBLE
,
5231 BASEPROPERTY_ENFORCE_FORMAT
,
5232 BASEPROPERTY_HIDEINACTIVESELECTION
,
5233 BASEPROPERTY_VERTICALALIGN
,
5234 BASEPROPERTY_WRITING_MODE
,
5235 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5236 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
5237 BASEPROPERTY_HIGHLIGHT_COLOR
,
5238 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
5240 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5243 VCLXNumericField::VCLXNumericField()
5247 VCLXNumericField::~VCLXNumericField()
5251 void VCLXNumericField::setValue( double Value
)
5253 SolarMutexGuard aGuard
;
5255 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5256 if ( !pNumericFormatter
)
5259 // shift long value using decimal digits
5260 // (e.g., input 105 using 2 digits returns 1,05)
5261 // Thus, to set a value of 1,05, insert 105 and 2 digits
5262 pNumericFormatter
->SetValue(
5263 static_cast<tools::Long
>(ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() )) );
5265 // #107218# Call same listeners like VCL would do after user interaction
5266 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
5269 SetSynthesizingVCLEvent( true );
5270 pEdit
->SetModifyFlag();
5272 SetSynthesizingVCLEvent( false );
5276 double VCLXNumericField::getValue()
5278 SolarMutexGuard aGuard
;
5280 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5281 return pNumericFormatter
5282 ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter
->GetValue()), pNumericFormatter
->GetDecimalDigits() )
5286 void VCLXNumericField::setMin( double Value
)
5288 SolarMutexGuard aGuard
;
5290 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5291 if ( pNumericFormatter
)
5292 pNumericFormatter
->SetMin(
5293 static_cast<tools::Long
>(ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() )) );
5296 double VCLXNumericField::getMin()
5298 SolarMutexGuard aGuard
;
5300 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5301 return pNumericFormatter
5302 ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter
->GetMin()), pNumericFormatter
->GetDecimalDigits() )
5306 void VCLXNumericField::setMax( double Value
)
5308 SolarMutexGuard aGuard
;
5310 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5311 if ( pNumericFormatter
)
5312 pNumericFormatter
->SetMax(
5313 static_cast<tools::Long
>(ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() )) );
5316 double VCLXNumericField::getMax()
5318 SolarMutexGuard aGuard
;
5320 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5321 return pNumericFormatter
5322 ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter
->GetMax()), pNumericFormatter
->GetDecimalDigits() )
5326 void VCLXNumericField::setFirst( double Value
)
5328 SolarMutexGuard aGuard
;
5330 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5331 if ( pNumericFormatter
)
5332 pNumericFormatter
->SetFirst(
5333 static_cast<tools::Long
>(ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() )) );
5336 double VCLXNumericField::getFirst()
5338 SolarMutexGuard aGuard
;
5340 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5341 return pNumericFormatter
5342 ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter
->GetFirst()), pNumericFormatter
->GetDecimalDigits() )
5346 void VCLXNumericField::setLast( double Value
)
5348 SolarMutexGuard aGuard
;
5350 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5351 if ( pNumericFormatter
)
5352 pNumericFormatter
->SetLast(
5353 static_cast<tools::Long
>(ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() )) );
5356 double VCLXNumericField::getLast()
5358 SolarMutexGuard aGuard
;
5360 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5361 return pNumericFormatter
5362 ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter
->GetLast()), pNumericFormatter
->GetDecimalDigits() )
5366 void VCLXNumericField::setStrictFormat( sal_Bool bStrict
)
5368 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5371 sal_Bool
VCLXNumericField::isStrictFormat()
5373 return VCLXFormattedSpinField::isStrictFormat();
5376 void VCLXNumericField::setSpinSize( double Value
)
5378 SolarMutexGuard aGuard
;
5380 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5381 if ( pNumericFormatter
)
5382 pNumericFormatter
->SetSpinSize(
5383 static_cast<tools::Long
>(ImplCalcLongValue( Value
, pNumericFormatter
->GetDecimalDigits() )) );
5386 double VCLXNumericField::getSpinSize()
5388 SolarMutexGuard aGuard
;
5390 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5391 return pNumericFormatter
5392 ? ImplCalcDoubleValue( static_cast<double>(pNumericFormatter
->GetSpinSize()), pNumericFormatter
->GetDecimalDigits() )
5396 void VCLXNumericField::setDecimalDigits( sal_Int16 Value
)
5398 SolarMutexGuard aGuard
;
5400 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5401 if ( pNumericFormatter
)
5403 double n
= getValue();
5404 pNumericFormatter
->SetDecimalDigits( Value
);
5409 sal_Int16
VCLXNumericField::getDecimalDigits()
5411 SolarMutexGuard aGuard
;
5413 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5414 return pNumericFormatter
? pNumericFormatter
->GetDecimalDigits() : 0;
5417 void VCLXNumericField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
5419 SolarMutexGuard aGuard
;
5421 if ( !(GetWindow()) )
5424 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
5426 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5427 switch ( nPropType
)
5429 case BASEPROPERTY_VALUE_DOUBLE
:
5433 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5434 if (!pNumericFormatter
)
5436 pNumericFormatter
->EnableEmptyFieldValue( true );
5437 pNumericFormatter
->SetEmptyFieldValue();
5447 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5454 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5461 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5468 case BASEPROPERTY_DECIMALACCURACY
:
5470 sal_Int16 n
= sal_Int16();
5472 setDecimalDigits( n
);
5475 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5480 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5481 if (!pNumericFormatter
)
5483 pNumericFormatter
->SetUseThousandSep( b
);
5489 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5494 css::uno::Any
VCLXNumericField::getProperty( const OUString
& PropertyName
)
5496 SolarMutexGuard aGuard
;
5498 css::uno::Any aProp
;
5499 FormatterBase
* pFormatter
= GetFormatter();
5502 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5503 switch ( nPropType
)
5505 case BASEPROPERTY_VALUE_DOUBLE
:
5507 aProp
<<= getValue();
5510 case BASEPROPERTY_VALUEMIN_DOUBLE
:
5515 case BASEPROPERTY_VALUEMAX_DOUBLE
:
5520 case BASEPROPERTY_VALUESTEP_DOUBLE
:
5522 aProp
<<= getSpinSize();
5525 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5527 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(pFormatter
);
5528 aProp
<<= pNumericFormatter
->IsUseThousandSep();
5533 aProp
= VCLXFormattedSpinField::getProperty( PropertyName
);
5541 // ----------------------------------------------------
5542 // ----------------------------------------------------
5544 void VCLXMetricField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
5546 PushPropertyIds( rIds
,
5548 BASEPROPERTY_BACKGROUNDCOLOR
,
5549 BASEPROPERTY_BORDER
,
5550 BASEPROPERTY_BORDERCOLOR
,
5551 BASEPROPERTY_DECIMALACCURACY
,
5552 BASEPROPERTY_DEFAULTCONTROL
,
5553 BASEPROPERTY_ENABLED
,
5554 BASEPROPERTY_ENABLEVISIBLE
,
5555 BASEPROPERTY_FONTDESCRIPTOR
,
5556 BASEPROPERTY_HELPTEXT
,
5557 BASEPROPERTY_HELPURL
,
5558 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
5559 BASEPROPERTY_PRINTABLE
,
5560 BASEPROPERTY_READONLY
,
5561 BASEPROPERTY_REPEAT
,
5562 BASEPROPERTY_REPEAT_DELAY
,
5564 BASEPROPERTY_STRICTFORMAT
,
5565 BASEPROPERTY_TABSTOP
,
5566 BASEPROPERTY_ENFORCE_FORMAT
,
5567 BASEPROPERTY_HIDEINACTIVESELECTION
,
5569 BASEPROPERTY_CUSTOMUNITTEXT
,
5570 BASEPROPERTY_WRITING_MODE
,
5571 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5572 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
5574 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5577 VCLXMetricField::VCLXMetricField()
5581 VCLXMetricField::~VCLXMetricField()
5585 MetricFormatter
*VCLXMetricField::GetMetricFormatter()
5587 MetricFormatter
*pFormatter
= static_cast<MetricFormatter
*>(GetFormatter());
5589 throw css::uno::RuntimeException();
5593 MetricField
*VCLXMetricField::GetMetricField()
5595 VclPtr
< MetricField
> pField
= GetAs
< MetricField
>();
5597 throw css::uno::RuntimeException();
5602 #define MetricUnitUnoToVcl(a) (static_cast<FieldUnit>(a))
5604 #define METRIC_MAP_PAIR(method,parent) \
5605 sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) \
5607 SolarMutexGuard aGuard; \
5608 return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
5610 void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) \
5612 SolarMutexGuard aGuard; \
5613 GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
5616 METRIC_MAP_PAIR(Min
, Formatter
)
5617 METRIC_MAP_PAIR(Max
, Formatter
)
5618 METRIC_MAP_PAIR(First
, Field
)
5619 METRIC_MAP_PAIR(Last
, Field
)
5621 #undef METRIC_MAP_PAIR
5623 ::sal_Int64
VCLXMetricField::getValue( ::sal_Int16 nUnit
)
5625 SolarMutexGuard aGuard
;
5626 return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit
) );
5629 ::sal_Int64
VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit
)
5631 SolarMutexGuard aGuard
;
5632 return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit
) );
5635 // FIXME: acute cut/paste evilness - move this to the parent Edit class ?
5636 void VCLXMetricField::CallListeners()
5638 // #107218# Call same listeners like VCL would do after user interaction
5639 VclPtr
< Edit
> pEdit
= GetAs
< Edit
>();
5642 SetSynthesizingVCLEvent( true );
5643 pEdit
->SetModifyFlag();
5645 SetSynthesizingVCLEvent( false );
5649 void VCLXMetricField::setValue( ::sal_Int64 Value
, ::sal_Int16 Unit
)
5651 SolarMutexGuard aGuard
;
5652 GetMetricFormatter()->SetValue( Value
, MetricUnitUnoToVcl( Unit
) );
5656 void VCLXMetricField::setUserValue( ::sal_Int64 Value
, ::sal_Int16 Unit
)
5658 SolarMutexGuard aGuard
;
5659 GetMetricFormatter()->SetUserValue( Value
, MetricUnitUnoToVcl( Unit
) );
5663 void VCLXMetricField::setStrictFormat( sal_Bool bStrict
)
5665 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5668 sal_Bool
VCLXMetricField::isStrictFormat()
5670 return VCLXFormattedSpinField::isStrictFormat();
5673 void VCLXMetricField::setSpinSize( sal_Int64 Value
)
5675 SolarMutexGuard aGuard
;
5676 GetMetricField()->SetSpinSize( Value
);
5679 sal_Int64
VCLXMetricField::getSpinSize()
5681 SolarMutexGuard aGuard
;
5682 return GetMetricField()->GetSpinSize();
5685 void VCLXMetricField::setDecimalDigits( sal_Int16 Value
)
5687 SolarMutexGuard aGuard
;
5688 GetMetricFormatter()->SetDecimalDigits( Value
);
5691 sal_Int16
VCLXMetricField::getDecimalDigits()
5693 SolarMutexGuard aGuard
;
5695 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5696 return pNumericFormatter
? pNumericFormatter
->GetDecimalDigits() : 0;
5699 void VCLXMetricField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
5701 SolarMutexGuard aGuard
;
5703 if ( !(GetWindow()) )
5706 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5707 switch ( nPropType
)
5709 case BASEPROPERTY_DECIMALACCURACY
:
5713 setDecimalDigits( n
);
5716 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5721 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(GetFormatter());
5722 if (!pNumericFormatter
)
5724 pNumericFormatter
->SetUseThousandSep( b
);
5728 case BASEPROPERTY_UNIT
:
5730 sal_uInt16 nVal
= 0;
5731 if ( Value
>>= nVal
)
5732 GetAs
< MetricField
>()->SetUnit( static_cast<FieldUnit
>(nVal
) );
5735 case BASEPROPERTY_CUSTOMUNITTEXT
:
5738 if ( Value
>>= aStr
)
5739 GetAs
< MetricField
>()->SetCustomUnitText( aStr
);
5744 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5750 css::uno::Any
VCLXMetricField::getProperty( const OUString
& PropertyName
)
5752 SolarMutexGuard aGuard
;
5754 css::uno::Any aProp
;
5755 FormatterBase
* pFormatter
= GetFormatter();
5758 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5759 switch ( nPropType
)
5761 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
5763 NumericFormatter
* pNumericFormatter
= static_cast<NumericFormatter
*>(pFormatter
);
5764 aProp
<<= pNumericFormatter
->IsUseThousandSep();
5767 case BASEPROPERTY_UNIT
:
5768 aProp
<<= static_cast<sal_uInt16
>(GetAs
< MetricField
>()->GetUnit());
5770 case BASEPROPERTY_CUSTOMUNITTEXT
:
5771 aProp
<<= GetAs
< MetricField
>()->GetCustomUnitText();
5775 aProp
= VCLXFormattedSpinField::getProperty( PropertyName
);
5783 void VCLXPatternField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
5785 PushPropertyIds( rIds
,
5787 BASEPROPERTY_BACKGROUNDCOLOR
,
5788 BASEPROPERTY_BORDER
,
5789 BASEPROPERTY_BORDERCOLOR
,
5790 BASEPROPERTY_DEFAULTCONTROL
,
5791 BASEPROPERTY_EDITMASK
,
5792 BASEPROPERTY_ENABLED
,
5793 BASEPROPERTY_ENABLEVISIBLE
,
5794 BASEPROPERTY_FONTDESCRIPTOR
,
5795 BASEPROPERTY_HELPTEXT
,
5796 BASEPROPERTY_HELPURL
,
5797 BASEPROPERTY_LITERALMASK
,
5798 BASEPROPERTY_MAXTEXTLEN
,
5799 BASEPROPERTY_PRINTABLE
,
5800 BASEPROPERTY_READONLY
,
5801 BASEPROPERTY_STRICTFORMAT
,
5802 BASEPROPERTY_TABSTOP
,
5804 BASEPROPERTY_HIDEINACTIVESELECTION
,
5805 BASEPROPERTY_VERTICALALIGN
,
5806 BASEPROPERTY_WRITING_MODE
,
5807 BASEPROPERTY_CONTEXT_WRITING_MODE
,
5808 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
5809 BASEPROPERTY_HIGHLIGHT_COLOR
,
5810 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
5812 VCLXFormattedSpinField::ImplGetPropertyIds( rIds
);
5815 VCLXPatternField::VCLXPatternField()
5819 VCLXPatternField::~VCLXPatternField()
5823 void VCLXPatternField::setMasks( const OUString
& EditMask
, const OUString
& LiteralMask
)
5825 SolarMutexGuard aGuard
;
5827 VclPtr
< PatternField
> pPatternField
= GetAs
< PatternField
>();
5828 if ( pPatternField
)
5830 pPatternField
->SetMask( OUStringToOString(EditMask
, RTL_TEXTENCODING_ASCII_US
), LiteralMask
);
5834 void VCLXPatternField::getMasks( OUString
& EditMask
, OUString
& LiteralMask
)
5836 SolarMutexGuard aGuard
;
5838 VclPtr
< PatternField
> pPatternField
= GetAs
< PatternField
>();
5839 if ( pPatternField
)
5841 EditMask
= OStringToOUString(pPatternField
->GetEditMask(), RTL_TEXTENCODING_ASCII_US
);
5842 LiteralMask
= pPatternField
->GetLiteralMask();
5846 void VCLXPatternField::setString( const OUString
& Str
)
5848 SolarMutexGuard aGuard
;
5849 VclPtr
< PatternField
> pPatternField
= GetAs
< PatternField
>();
5850 if ( pPatternField
)
5851 pPatternField
->SetString( Str
);
5854 OUString
VCLXPatternField::getString()
5856 SolarMutexGuard aGuard
;
5859 VclPtr
< PatternField
> pPatternField
= GetAs
< PatternField
>();
5860 if ( pPatternField
)
5861 aString
= pPatternField
->GetString();
5865 void VCLXPatternField::setStrictFormat( sal_Bool bStrict
)
5867 VCLXFormattedSpinField::setStrictFormat( bStrict
);
5870 sal_Bool
VCLXPatternField::isStrictFormat()
5872 return VCLXFormattedSpinField::isStrictFormat();
5875 void VCLXPatternField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
5877 SolarMutexGuard aGuard
;
5879 if ( !(GetWindow()) )
5882 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5883 switch ( nPropType
)
5885 case BASEPROPERTY_EDITMASK
:
5886 case BASEPROPERTY_LITERALMASK
:
5889 if ( Value
>>= aString
)
5891 OUString aEditMask
, aLiteralMask
;
5892 getMasks( aEditMask
, aLiteralMask
);
5893 if ( nPropType
== BASEPROPERTY_EDITMASK
)
5894 aEditMask
= aString
;
5896 aLiteralMask
= aString
;
5897 setMasks( aEditMask
, aLiteralMask
);
5903 VCLXFormattedSpinField::setProperty( PropertyName
, Value
);
5908 css::uno::Any
VCLXPatternField::getProperty( const OUString
& PropertyName
)
5910 SolarMutexGuard aGuard
;
5912 css::uno::Any aProp
;
5915 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
5916 switch ( nPropType
)
5918 case BASEPROPERTY_EDITMASK
:
5919 case BASEPROPERTY_LITERALMASK
:
5921 OUString aEditMask
, aLiteralMask
;
5922 getMasks( aEditMask
, aLiteralMask
);
5923 if ( nPropType
== BASEPROPERTY_EDITMASK
)
5924 aProp
<<= aEditMask
;
5926 aProp
<<= aLiteralMask
;
5931 aProp
= VCLXFormattedSpinField::getProperty( PropertyName
);
5940 VCLXToolBox::VCLXToolBox()
5944 VCLXToolBox::~VCLXToolBox()
5948 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXToolBox::CreateAccessibleContext()
5950 return getAccessibleFactory().createAccessibleContext( this );
5953 VCLXHeaderBar::VCLXHeaderBar()
5957 VCLXHeaderBar::~VCLXHeaderBar()
5961 css::uno::Reference
< css::accessibility::XAccessibleContext
> VCLXHeaderBar::CreateAccessibleContext()
5963 return getAccessibleFactory().createAccessibleContext( this );
5967 VCLXFrame::VCLXFrame()
5971 void VCLXFrame::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
5973 PushPropertyIds( rIds
,
5974 BASEPROPERTY_BACKGROUNDCOLOR
,
5975 BASEPROPERTY_DEFAULTCONTROL
,
5976 BASEPROPERTY_ENABLED
,
5977 BASEPROPERTY_ENABLEVISIBLE
,
5978 BASEPROPERTY_FONTDESCRIPTOR
,
5979 BASEPROPERTY_GRAPHIC
,
5980 BASEPROPERTY_HELPTEXT
,
5981 BASEPROPERTY_HELPURL
,
5982 BASEPROPERTY_PRINTABLE
,
5985 VCLXContainer::ImplGetPropertyIds( rIds
);
5988 VCLXFrame::~VCLXFrame()
5993 void SAL_CALL
VCLXFrame::draw( sal_Int32 nX
, sal_Int32 nY
)
5995 SolarMutexGuard aGuard
;
5996 VclPtr
< vcl::Window
> pWindow
= GetWindow();
6000 OutputDevice
* pDev
= VCLUnoHelper::GetOutputDevice( getGraphics() );
6002 pDev
= pWindow
->GetParent()->GetOutDev();
6004 Point aPos
= pDev
->PixelToLogic( Point( nX
, nY
) );
6005 pWindow
->Draw( pDev
, aPos
, SystemTextColorFlags::NoControls
);
6009 void SAL_CALL
VCLXFrame::setProperty(
6010 const OUString
& PropertyName
,
6011 const css::uno::Any
& Value
)
6013 SolarMutexGuard aGuard
;
6015 VCLXContainer::setProperty( PropertyName
, Value
);
6018 void VCLXFrame::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
6020 css::uno::Reference
< css::awt::XWindow
> xKeepAlive( this );
6021 VCLXContainer::ProcessWindowEvent( rVclWindowEvent
);
6024 VCLXProgressBar::VCLXProgressBar()
6031 VCLXProgressBar::~VCLXProgressBar()
6035 void VCLXProgressBar::ImplUpdateValue()
6037 VclPtr
< ProgressBar
> pProgressBar
= GetAs
< ProgressBar
>();
6038 if ( !pProgressBar
)
6045 // check min and max
6046 if (m_nValueMin
< m_nValueMax
)
6048 nValMin
= m_nValueMin
;
6049 nValMax
= m_nValueMax
;
6053 nValMin
= m_nValueMax
;
6054 nValMax
= m_nValueMin
;
6058 if (m_nValue
< nValMin
)
6062 else if (m_nValue
> nValMax
)
6071 // calculate percent
6073 if (nValMin
!= nValMax
)
6075 nPercent
= 100 * (nVal
- nValMin
) / (nValMax
- nValMin
);
6082 // set progressbar value
6083 pProgressBar
->SetValue( static_cast<sal_uInt16
>(nPercent
) );
6086 // css::awt::XProgressBar
6087 void VCLXProgressBar::setForegroundColor( sal_Int32 nColor
)
6089 SolarMutexGuard aGuard
;
6091 VclPtr
<vcl::Window
> pWindow
= GetWindow();
6094 pWindow
->SetControlForeground( Color(ColorTransparency
, nColor
) );
6098 void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor
)
6100 SolarMutexGuard aGuard
;
6102 VclPtr
<vcl::Window
> pWindow
= GetWindow();
6105 Color
aColor( ColorTransparency
, nColor
);
6106 pWindow
->SetBackground( aColor
);
6107 pWindow
->SetControlBackground( aColor
);
6108 pWindow
->Invalidate();
6112 void VCLXProgressBar::setValue( sal_Int32 nValue
)
6114 SolarMutexGuard aGuard
;
6120 void VCLXProgressBar::setRange( sal_Int32 nMin
, sal_Int32 nMax
)
6122 SolarMutexGuard aGuard
;
6126 // take correct min and max
6132 // change min and max
6140 sal_Int32
VCLXProgressBar::getValue()
6142 SolarMutexGuard aGuard
;
6147 // css::awt::VclWindowPeer
6148 void VCLXProgressBar::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
6150 SolarMutexGuard aGuard
;
6152 VclPtr
< ProgressBar
> pProgressBar
= GetAs
< ProgressBar
>();
6153 if ( !pProgressBar
)
6156 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6157 switch ( nPropType
)
6159 case BASEPROPERTY_PROGRESSVALUE
:
6161 if ( Value
>>= m_nValue
)
6165 case BASEPROPERTY_PROGRESSVALUE_MIN
:
6167 if ( Value
>>= m_nValueMin
)
6171 case BASEPROPERTY_PROGRESSVALUE_MAX
:
6173 if ( Value
>>= m_nValueMax
)
6177 case BASEPROPERTY_FILLCOLOR
:
6179 VclPtr
<vcl::Window
> pWindow
= GetWindow();
6182 bool bVoid
= Value
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
;
6186 pWindow
->SetControlForeground();
6191 if ( Value
>>= nColor
)
6192 pWindow
->SetControlForeground( nColor
);
6198 VCLXWindow::setProperty( PropertyName
, Value
);
6203 css::uno::Any
VCLXProgressBar::getProperty( const OUString
& PropertyName
)
6205 SolarMutexGuard aGuard
;
6207 css::uno::Any aProp
;
6208 VclPtr
< ProgressBar
> pProgressBar
= GetAs
< ProgressBar
>();
6211 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6212 switch ( nPropType
)
6214 case BASEPROPERTY_PROGRESSVALUE
:
6219 case BASEPROPERTY_PROGRESSVALUE_MIN
:
6221 aProp
<<= m_nValueMin
;
6224 case BASEPROPERTY_PROGRESSVALUE_MAX
:
6226 aProp
<<= m_nValueMax
;
6230 aProp
= VCLXWindow::getProperty( PropertyName
);
6237 void VCLXProgressBar::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
6239 PushPropertyIds( rIds
,
6240 BASEPROPERTY_PROGRESSVALUE
,
6241 BASEPROPERTY_PROGRESSVALUE_MIN
,
6242 BASEPROPERTY_PROGRESSVALUE_MAX
,
6243 BASEPROPERTY_FILLCOLOR
,
6245 VCLXWindow::ImplGetPropertyIds( rIds
, true );
6248 VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
6252 VCLXFileControl::~VCLXFileControl()
6254 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
6256 pControl
->GetEdit().SetModifyHdl( Link
<Edit
&,void>() );
6261 void lcl_setWinBits( vcl::Window
* _pWindow
, WinBits _nBits
, bool _bSet
)
6263 WinBits nStyle
= _pWindow
->GetStyle();
6268 _pWindow
->SetStyle( nStyle
);
6272 void SAL_CALL
VCLXFileControl::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
6274 SolarMutexGuard aGuard
;
6276 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
6280 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6281 switch ( nPropType
)
6283 case BASEPROPERTY_HIDEINACTIVESELECTION
:
6286 OSL_VERIFY( Value
>>= bValue
);
6288 lcl_setWinBits( pControl
, WB_NOHIDESELECTION
, !bValue
);
6289 lcl_setWinBits( &pControl
->GetEdit(), WB_NOHIDESELECTION
, !bValue
);
6294 VCLXWindow::setProperty( PropertyName
, Value
);
6299 void VCLXFileControl::SetWindow( const VclPtr
< vcl::Window
> &pWindow
)
6301 VclPtr
< FileControl
> pPrevFileControl
= GetAsDynamic
< FileControl
>();
6302 if ( pPrevFileControl
)
6303 pPrevFileControl
->SetEditModifyHdl( Link
<Edit
&,void>() );
6305 FileControl
* pNewFileControl
= dynamic_cast<FileControl
*>( pWindow
.get() );
6306 if ( pNewFileControl
)
6307 pNewFileControl
->SetEditModifyHdl( LINK( this, VCLXFileControl
, ModifyHdl
) );
6309 VCLXWindow::SetWindow( pWindow
);
6312 void VCLXFileControl::addTextListener( const css::uno::Reference
< css::awt::XTextListener
> & l
)
6314 maTextListeners
.addInterface( l
);
6317 void VCLXFileControl::removeTextListener( const css::uno::Reference
< css::awt::XTextListener
> & l
)
6319 maTextListeners
.removeInterface( l
);
6322 void VCLXFileControl::setText( const OUString
& aText
)
6324 SolarMutexGuard aGuard
;
6326 VclPtr
<vcl::Window
> pWindow
= GetWindow();
6329 pWindow
->SetText( aText
);
6331 // also in Java a textChanged is triggered, not in VCL.
6332 // css::awt::Toolkit should be JAVA-compliant...
6337 void VCLXFileControl::insertText( const css::awt::Selection
& rSel
, const OUString
& aText
)
6339 SolarMutexGuard aGuard
;
6341 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6344 pFileControl
->GetEdit().SetSelection( Selection( rSel
.Min
, rSel
.Max
) );
6345 pFileControl
->GetEdit().ReplaceSelected( aText
);
6349 OUString
VCLXFileControl::getText()
6351 SolarMutexGuard aGuard
;
6354 VclPtr
<vcl::Window
> pWindow
= GetWindow();
6356 aText
= pWindow
->GetText();
6360 OUString
VCLXFileControl::getSelectedText()
6362 SolarMutexGuard aGuard
;
6365 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6367 aText
= pFileControl
->GetEdit().GetSelected();
6372 void VCLXFileControl::setSelection( const css::awt::Selection
& aSelection
)
6374 SolarMutexGuard aGuard
;
6376 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6378 pFileControl
->GetEdit().SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
6381 css::awt::Selection
VCLXFileControl::getSelection()
6383 SolarMutexGuard aGuard
;
6385 css::awt::Selection aSel
;
6386 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6389 aSel
.Min
= pFileControl
->GetEdit().GetSelection().Min();
6390 aSel
.Max
= pFileControl
->GetEdit().GetSelection().Max();
6395 sal_Bool
VCLXFileControl::isEditable()
6397 SolarMutexGuard aGuard
;
6399 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6400 return pFileControl
&& !pFileControl
->GetEdit().IsReadOnly() && pFileControl
->GetEdit().IsEnabled();
6403 void VCLXFileControl::setEditable( sal_Bool bEditable
)
6405 SolarMutexGuard aGuard
;
6407 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6409 pFileControl
->GetEdit().SetReadOnly( !bEditable
);
6412 void VCLXFileControl::setMaxTextLen( sal_Int16 nLen
)
6414 SolarMutexGuard aGuard
;
6416 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6418 pFileControl
->GetEdit().SetMaxTextLen( nLen
);
6421 sal_Int16
VCLXFileControl::getMaxTextLen()
6423 SolarMutexGuard aGuard
;
6425 VclPtr
< FileControl
> pFileControl
= GetAs
< FileControl
>();
6426 return pFileControl
? pFileControl
->GetEdit().GetMaxTextLen() : 0;
6430 IMPL_LINK_NOARG(VCLXFileControl
, ModifyHdl
, Edit
&, void)
6435 void VCLXFileControl::ModifyHdl()
6437 css::awt::TextEvent aEvent
;
6438 aEvent
.Source
= getXWeak();
6439 maTextListeners
.textChanged( aEvent
);
6442 css::awt::Size
VCLXFileControl::getMinimumSize()
6444 SolarMutexGuard aGuard
;
6447 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
6450 Size aTmpSize
= pControl
->GetEdit().CalcMinimumSize();
6451 aTmpSize
.AdjustWidth(pControl
->GetButton().CalcMinimumSize().Width() );
6452 aSz
= AWTSize(pControl
->CalcWindowSize( aTmpSize
));
6457 css::awt::Size
VCLXFileControl::getPreferredSize()
6459 css::awt::Size aSz
= getMinimumSize();
6464 css::awt::Size
VCLXFileControl::calcAdjustedSize( const css::awt::Size
& rNewSize
)
6466 SolarMutexGuard aGuard
;
6468 css::awt::Size aSz
=rNewSize
;
6469 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
6472 css::awt::Size aMinSz
= getMinimumSize();
6473 if ( aSz
.Height
!= aMinSz
.Height
)
6474 aSz
.Height
= aMinSz
.Height
;
6479 css::awt::Size
VCLXFileControl::getMinimumSize( sal_Int16 nCols
, sal_Int16
)
6481 SolarMutexGuard aGuard
;
6484 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
6487 aSz
= AWTSize(pControl
->GetEdit().CalcSize( nCols
));
6488 aSz
.Width
+= pControl
->GetButton().CalcMinimumSize().Width();
6493 void VCLXFileControl::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
)
6495 SolarMutexGuard aGuard
;
6499 VclPtr
< FileControl
> pControl
= GetAs
< FileControl
>();
6501 nCols
= pControl
->GetEdit().GetMaxVisChars();
6504 void VCLXFileControl::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
6506 PushPropertyIds( rIds
,
6507 // FIXME: elide duplication ?
6508 BASEPROPERTY_HIDEINACTIVESELECTION
,
6510 VCLXWindow::ImplGetPropertyIds( rIds
, true );
6513 SVTXFormattedField::SVTXFormattedField()
6514 :bIsStandardSupplier(true)
6515 ,nKeyToSetDelayed(-1)
6519 SVTXFormattedField::~SVTXFormattedField()
6523 void SVTXFormattedField::SetWindow( const VclPtr
< vcl::Window
> &_pWindow
)
6525 VCLXSpinField::SetWindow(_pWindow
);
6526 if (GetAs
< FormattedField
>())
6527 GetAs
< FormattedField
>()->GetFormatter().SetAutoColor(true);
6530 void SVTXFormattedField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
6532 SolarMutexGuard aGuard
;
6534 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6537 Formatter
& rFormatter
= pField
->GetFormatter();
6538 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6541 case BASEPROPERTY_ENFORCE_FORMAT
:
6543 bool bEnable( true );
6544 if ( Value
>>= bEnable
)
6545 rFormatter
.EnableNotANumber( !bEnable
);
6549 case BASEPROPERTY_EFFECTIVE_MIN
:
6550 case BASEPROPERTY_VALUEMIN_DOUBLE
:
6554 case BASEPROPERTY_EFFECTIVE_MAX
:
6555 case BASEPROPERTY_VALUEMAX_DOUBLE
:
6559 case BASEPROPERTY_EFFECTIVE_DEFAULT
:
6560 SetDefaultValue(Value
);
6563 case BASEPROPERTY_TREATASNUMBER
:
6567 SetTreatAsNumber(b
);
6571 case BASEPROPERTY_FORMATSSUPPLIER
:
6572 if (!Value
.hasValue())
6573 setFormatsSupplier(css::uno::Reference
< css::util::XNumberFormatsSupplier
> (nullptr));
6576 css::uno::Reference
< css::util::XNumberFormatsSupplier
> xNFS
;
6577 if ( Value
>>= xNFS
)
6578 setFormatsSupplier(xNFS
);
6581 case BASEPROPERTY_FORMATKEY
:
6582 if (!Value
.hasValue())
6592 case BASEPROPERTY_EFFECTIVE_VALUE
:
6593 case BASEPROPERTY_VALUE_DOUBLE
:
6595 const css::uno::TypeClass rTC
= Value
.getValueType().getTypeClass();
6596 if (rTC
!= css::uno::TypeClass_STRING
)
6598 if (rTC
!= css::uno::TypeClass_DOUBLE
)
6600 if (Value
.hasValue())
6602 // try if it is something convertible
6603 sal_Int32 nValue
= 0;
6604 if (!(Value
>>= nValue
))
6605 throw css::lang::IllegalArgumentException();
6606 SetValue(css::uno::Any(static_cast<double>(nValue
)));
6613 case BASEPROPERTY_VALUESTEP_DOUBLE
:
6617 rFormatter
.SetSpinSize( d
);
6622 rFormatter
.SetSpinSize( n
);
6626 case BASEPROPERTY_DECIMALACCURACY
:
6630 rFormatter
.SetDecimalDigits( static_cast<sal_uInt16
>(n
) );
6633 case BASEPROPERTY_NUMSHOWTHOUSANDSEP
:
6637 rFormatter
.SetThousandsSep( b
);
6642 VCLXSpinField::setProperty( PropertyName
, Value
);
6645 if (BASEPROPERTY_TEXTCOLOR
== nPropType
)
6646 { // after setting a new text color, think again about the AutoColor flag of the control
6647 // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com
6648 rFormatter
.SetAutoColor(!Value
.hasValue());
6652 VCLXSpinField::setProperty( PropertyName
, Value
);
6655 css::uno::Any
SVTXFormattedField::getProperty( const OUString
& PropertyName
)
6657 SolarMutexGuard aGuard
;
6659 css::uno::Any aReturn
;
6661 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6664 Formatter
& rFormatter
= pField
->GetFormatter();
6665 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
6668 case BASEPROPERTY_EFFECTIVE_MIN
:
6669 case BASEPROPERTY_VALUEMIN_DOUBLE
:
6670 aReturn
= GetMinValue();
6673 case BASEPROPERTY_EFFECTIVE_MAX
:
6674 case BASEPROPERTY_VALUEMAX_DOUBLE
:
6675 aReturn
= GetMaxValue();
6678 case BASEPROPERTY_EFFECTIVE_DEFAULT
:
6679 aReturn
= GetDefaultValue();
6682 case BASEPROPERTY_TREATASNUMBER
:
6683 aReturn
<<= GetTreatAsNumber();
6686 case BASEPROPERTY_EFFECTIVE_VALUE
:
6687 case BASEPROPERTY_VALUE_DOUBLE
:
6688 aReturn
= GetValue();
6691 case BASEPROPERTY_VALUESTEP_DOUBLE
:
6692 aReturn
<<= rFormatter
.GetSpinSize();
6695 case BASEPROPERTY_DECIMALACCURACY
:
6696 aReturn
<<= rFormatter
.GetDecimalDigits();
6699 case BASEPROPERTY_FORMATSSUPPLIER
:
6701 if (!bIsStandardSupplier
)
6703 css::uno::Reference
< css::util::XNumberFormatsSupplier
> xSupplier
= m_xCurrentSupplier
;
6704 aReturn
<<= xSupplier
;
6709 case BASEPROPERTY_FORMATKEY
:
6711 if (!bIsStandardSupplier
)
6712 aReturn
<<= getFormatKey();
6717 aReturn
= VCLXSpinField::getProperty(PropertyName
);
6723 css::uno::Any
SVTXFormattedField::convertEffectiveValue(const css::uno::Any
& rValue
) const
6725 css::uno::Any aReturn
;
6727 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6731 Formatter
& rFieldFormatter
= pField
->GetFormatter();
6732 switch (rValue
.getValueType().getTypeClass())
6734 case css::uno::TypeClass_DOUBLE
:
6735 if (rFieldFormatter
.TreatingAsNumber())
6743 SvNumberFormatter
* pFormatter
= rFieldFormatter
.GetFormatter();
6745 pFormatter
= rFieldFormatter
.StandardFormatter();
6746 // should never fail
6751 OUString sConverted
;
6752 pFormatter
->GetOutputString(d
, 0, sConverted
, &pDum
);
6753 aReturn
<<= sConverted
;
6756 case css::uno::TypeClass_STRING
:
6760 if (rFieldFormatter
.TreatingAsNumber())
6762 SvNumberFormatter
* pFormatter
= rFieldFormatter
.GetFormatter();
6764 pFormatter
= rFieldFormatter
.StandardFormatter();
6767 sal_uInt32
nTestFormat(0);
6768 if (!pFormatter
->IsNumberFormat(aStr
, nTestFormat
, dVal
))
6783 void SVTXFormattedField::SetMinValue(const css::uno::Any
& rValue
)
6785 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6789 Formatter
& rFormatter
= pField
->GetFormatter();
6790 switch (rValue
.getValueType().getTypeClass())
6793 case css::uno::TypeClass_DOUBLE
:
6797 rFormatter
.SetMinValue(d
);
6801 DBG_ASSERT(rValue
.getValueType().getTypeClass() == css::uno::TypeClass_VOID
, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
6802 if ( rValue
.getValueType().getTypeClass() != css::uno::TypeClass_VOID
)
6805 throw css::lang::IllegalArgumentException();
6807 rFormatter
.ClearMinValue();
6812 css::uno::Any
SVTXFormattedField::GetMinValue() const
6814 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6816 return css::uno::Any();
6817 Formatter
& rFormatter
= pField
->GetFormatter();
6818 if (!rFormatter
.HasMinValue())
6819 return css::uno::Any();
6821 css::uno::Any aReturn
;
6822 aReturn
<<= rFormatter
.GetMinValue();
6826 void SVTXFormattedField::SetMaxValue(const css::uno::Any
& rValue
)
6828 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6832 Formatter
& rFormatter
= pField
->GetFormatter();
6833 switch (rValue
.getValueType().getTypeClass())
6835 case css::uno::TypeClass_DOUBLE
:
6839 rFormatter
.SetMaxValue(d
);
6843 if (rValue
.getValueType().getTypeClass() != css::uno::TypeClass_VOID
)
6846 throw css::lang::IllegalArgumentException();
6848 rFormatter
.ClearMaxValue();
6853 css::uno::Any
SVTXFormattedField::GetMaxValue() const
6855 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6857 return css::uno::Any();
6858 Formatter
& rFormatter
= pField
->GetFormatter();
6859 if (!rFormatter
.HasMaxValue())
6860 return css::uno::Any();
6862 css::uno::Any aReturn
;
6863 aReturn
<<= rFormatter
.GetMaxValue();
6867 void SVTXFormattedField::SetDefaultValue(const css::uno::Any
& rValue
)
6869 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6873 css::uno::Any aConverted
= convertEffectiveValue(rValue
);
6875 Formatter
& rFormatter
= pField
->GetFormatter();
6876 switch (aConverted
.getValueType().getTypeClass())
6878 case css::uno::TypeClass_DOUBLE
:
6882 rFormatter
.SetDefaultValue(d
);
6885 case css::uno::TypeClass_STRING
:
6888 aConverted
>>= aStr
;
6889 rFormatter
.SetDefaultText( aStr
);
6893 rFormatter
.EnableEmptyField(true);
6894 // only void accepted
6899 css::uno::Any
SVTXFormattedField::GetDefaultValue() const
6901 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6903 return css::uno::Any();
6904 Formatter
& rFormatter
= pField
->GetFormatter();
6905 if (rFormatter
.IsEmptyFieldEnabled())
6906 return css::uno::Any();
6908 css::uno::Any aReturn
;
6909 if (rFormatter
.TreatingAsNumber())
6910 aReturn
<<= rFormatter
.GetDefaultValue();
6912 aReturn
<<= rFormatter
.GetDefaultText();
6916 bool SVTXFormattedField::GetTreatAsNumber() const
6918 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6920 return pField
->GetFormatter().TreatingAsNumber();
6925 void SVTXFormattedField::SetTreatAsNumber(bool bSet
)
6927 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6929 pField
->GetFormatter().TreatAsNumber(bSet
);
6932 css::uno::Any
SVTXFormattedField::GetValue() const
6934 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6936 return css::uno::Any();
6938 Formatter
& rFormatter
= pField
->GetFormatter();
6939 css::uno::Any aReturn
;
6940 if (!rFormatter
.TreatingAsNumber())
6942 OUString sText
= rFormatter
.GetTextValue();
6947 if (!pField
->GetText().isEmpty()) // empty is returned as void by default
6948 aReturn
<<= rFormatter
.GetValue();
6954 void SVTXFormattedField::SetValue(const css::uno::Any
& rValue
)
6956 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6960 if (!rValue
.hasValue())
6962 pField
->SetText("");
6966 Formatter
& rFormatter
= pField
->GetFormatter();
6967 if (rValue
.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE
)
6971 rFormatter
.SetValue(d
);
6975 DBG_ASSERT(rValue
.getValueType().getTypeClass() == css::uno::TypeClass_STRING
, "SVTXFormattedField::SetValue : invalid argument !");
6979 if (!rFormatter
.TreatingAsNumber())
6980 rFormatter
.SetTextFormatted(sText
);
6982 rFormatter
.SetTextValue(sText
);
6985 // NotifyTextListeners();
6988 void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference
< css::util::XNumberFormatsSupplier
> & xSupplier
)
6990 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
6992 rtl::Reference
<SvNumberFormatsSupplierObj
> pNew
;
6993 if (!xSupplier
.is())
6997 Formatter
& rFormatter
= pField
->GetFormatter();
6998 pNew
= new SvNumberFormatsSupplierObj(rFormatter
.StandardFormatter());
6999 bIsStandardSupplier
= true;
7004 pNew
= comphelper::getFromUnoTunnel
<SvNumberFormatsSupplierObj
>(xSupplier
);
7005 bIsStandardSupplier
= false;
7009 return; // TODO : how to process ?
7011 m_xCurrentSupplier
= pNew
;
7015 // save the actual value
7016 css::uno::Any aCurrent
= GetValue();
7017 Formatter
& rFormatter
= pField
->GetFormatter();
7018 rFormatter
.SetFormatter(m_xCurrentSupplier
->GetNumberFormatter(), false);
7019 if (nKeyToSetDelayed
!= -1)
7021 rFormatter
.SetFormatKey(nKeyToSetDelayed
);
7022 nKeyToSetDelayed
= -1;
7025 NotifyTextListeners();
7028 sal_Int32
SVTXFormattedField::getFormatKey() const
7030 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7031 return pField
? pField
->GetFormatter().GetFormatKey() : 0;
7034 void SVTXFormattedField::setFormatKey(sal_Int32 nKey
)
7036 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7040 Formatter
& rFormatter
= pField
->GetFormatter();
7041 if (rFormatter
.GetFormatter())
7042 rFormatter
.SetFormatKey(nKey
);
7045 // probably I am in a block, in which first the key and next the formatter will be set,
7046 // initially this happens quite certain, as the properties are set in alphabetic sequence,
7047 // and the FormatsSupplier is processed before the FormatKey
7048 nKeyToSetDelayed
= nKey
;
7050 NotifyTextListeners();
7053 void SVTXFormattedField::NotifyTextListeners()
7055 if ( GetTextListeners().getLength() )
7057 css::awt::TextEvent aEvent
;
7058 aEvent
.Source
= getXWeak();
7059 GetTextListeners().textChanged( aEvent
);
7063 void SVTXFormattedField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
7065 PushPropertyIds( rIds
,
7066 // FIXME: elide duplication ?
7067 BASEPROPERTY_EFFECTIVE_MIN
,
7068 BASEPROPERTY_VALUEMIN_DOUBLE
,
7069 BASEPROPERTY_EFFECTIVE_MAX
,
7070 BASEPROPERTY_VALUEMAX_DOUBLE
,
7071 BASEPROPERTY_EFFECTIVE_DEFAULT
,
7072 BASEPROPERTY_TREATASNUMBER
,
7073 BASEPROPERTY_EFFECTIVE_VALUE
,
7074 BASEPROPERTY_VALUE_DOUBLE
,
7075 BASEPROPERTY_VALUESTEP_DOUBLE
,
7076 BASEPROPERTY_DECIMALACCURACY
,
7077 BASEPROPERTY_FORMATSSUPPLIER
,
7078 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
7079 BASEPROPERTY_FORMATKEY
,
7080 BASEPROPERTY_TREATASNUMBER
,
7081 BASEPROPERTY_ENFORCE_FORMAT
,
7083 VCLXWindow::ImplGetPropertyIds( rIds
, true );
7084 VCLXSpinField::ImplGetPropertyIds( rIds
);
7087 SVTXCurrencyField::SVTXCurrencyField()
7091 SVTXCurrencyField::~SVTXCurrencyField()
7095 void SVTXCurrencyField::setValue( double Value
)
7097 SolarMutexGuard aGuard
;
7099 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7101 pField
->GetFormatter().SetValue( Value
);
7104 double SVTXCurrencyField::getValue()
7106 SolarMutexGuard aGuard
;
7108 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7109 return pField
? pField
->GetFormatter().GetValue() : 0;
7112 void SVTXCurrencyField::setMin( double Value
)
7114 SolarMutexGuard aGuard
;
7116 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7118 pField
->GetFormatter().SetMinValue( Value
);
7121 double SVTXCurrencyField::getMin()
7123 SolarMutexGuard aGuard
;
7125 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7126 return pField
? pField
->GetFormatter().GetMinValue() : 0;
7129 void SVTXCurrencyField::setMax( double Value
)
7131 SolarMutexGuard aGuard
;
7133 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7135 pField
->GetFormatter().SetMaxValue( Value
);
7138 double SVTXCurrencyField::getMax()
7140 SolarMutexGuard aGuard
;
7142 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7143 return pField
? pField
->GetFormatter().GetMaxValue() : 0;
7146 void SVTXCurrencyField::setFirst( double Value
)
7148 SolarMutexGuard aGuard
;
7150 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7152 pField
->GetFormatter().SetSpinFirst( Value
);
7155 double SVTXCurrencyField::getFirst()
7157 SolarMutexGuard aGuard
;
7159 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7160 return pField
? pField
->GetFormatter().GetSpinFirst() : 0;
7163 void SVTXCurrencyField::setLast( double Value
)
7165 SolarMutexGuard aGuard
;
7167 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7169 pField
->GetFormatter().SetSpinLast( Value
);
7172 double SVTXCurrencyField::getLast()
7174 SolarMutexGuard aGuard
;
7176 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7177 return pField
? pField
->GetFormatter().GetSpinLast() : 0;
7180 void SVTXCurrencyField::setSpinSize( double Value
)
7182 SolarMutexGuard aGuard
;
7184 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7186 pField
->GetFormatter().SetSpinSize( Value
);
7189 double SVTXCurrencyField::getSpinSize()
7191 SolarMutexGuard aGuard
;
7193 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7194 return pField
? pField
->GetFormatter().GetSpinSize() : 0;
7197 void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value
)
7199 SolarMutexGuard aGuard
;
7201 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7203 pField
->GetFormatter().SetDecimalDigits( Value
);
7206 sal_Int16
SVTXCurrencyField::getDecimalDigits()
7208 SolarMutexGuard aGuard
;
7210 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7211 return pField
? pField
->GetFormatter().GetDecimalDigits() : 0;
7214 void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict
)
7216 SolarMutexGuard aGuard
;
7218 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7220 pField
->GetFormatter().SetStrictFormat( bStrict
);
7223 sal_Bool
SVTXCurrencyField::isStrictFormat()
7225 SolarMutexGuard aGuard
;
7227 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7228 return pField
&& pField
->GetFormatter().IsStrictFormat();
7231 void SVTXCurrencyField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
7233 SolarMutexGuard aGuard
;
7235 VclPtr
< DoubleCurrencyField
> pField
= GetAs
< DoubleCurrencyField
>();
7238 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
7241 case BASEPROPERTY_CURRENCYSYMBOL
:
7245 pField
->setCurrencySymbol( aStr
);
7248 case BASEPROPERTY_CURSYM_POSITION
:
7252 pField
->setPrependCurrSym(b
);
7257 SVTXFormattedField::setProperty(PropertyName
, Value
);
7261 SVTXFormattedField::setProperty(PropertyName
, Value
);
7264 css::uno::Any
SVTXCurrencyField::getProperty( const OUString
& PropertyName
)
7266 SolarMutexGuard aGuard
;
7268 css::uno::Any aReturn
;
7270 VclPtr
< DoubleCurrencyField
> pField
= GetAs
< DoubleCurrencyField
>();
7273 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
7276 case BASEPROPERTY_CURRENCYSYMBOL
:
7278 aReturn
<<= pField
->getCurrencySymbol();
7281 case BASEPROPERTY_CURSYM_POSITION
:
7283 aReturn
<<= pField
->getPrependCurrSym();
7287 return SVTXFormattedField::getProperty(PropertyName
);
7290 return SVTXFormattedField::getProperty(PropertyName
);
7293 void SVTXCurrencyField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
7295 PushPropertyIds( rIds
,
7297 BASEPROPERTY_BACKGROUNDCOLOR
,
7298 BASEPROPERTY_BORDER
,
7299 BASEPROPERTY_BORDERCOLOR
,
7300 BASEPROPERTY_CURRENCYSYMBOL
,
7301 BASEPROPERTY_CURSYM_POSITION
,
7302 BASEPROPERTY_DECIMALACCURACY
,
7303 BASEPROPERTY_DEFAULTCONTROL
,
7304 BASEPROPERTY_ENABLED
,
7305 BASEPROPERTY_ENABLEVISIBLE
,
7306 BASEPROPERTY_FONTDESCRIPTOR
,
7307 BASEPROPERTY_HELPTEXT
,
7308 BASEPROPERTY_HELPURL
,
7309 BASEPROPERTY_NUMSHOWTHOUSANDSEP
,
7310 BASEPROPERTY_PRINTABLE
,
7311 BASEPROPERTY_READONLY
,
7312 BASEPROPERTY_REPEAT
,
7313 BASEPROPERTY_REPEAT_DELAY
,
7315 BASEPROPERTY_STRICTFORMAT
,
7316 BASEPROPERTY_TABSTOP
,
7317 BASEPROPERTY_VALUEMAX_DOUBLE
,
7318 BASEPROPERTY_VALUEMIN_DOUBLE
,
7319 BASEPROPERTY_VALUESTEP_DOUBLE
,
7320 BASEPROPERTY_VALUE_DOUBLE
,
7321 BASEPROPERTY_ENFORCE_FORMAT
,
7322 BASEPROPERTY_HIDEINACTIVESELECTION
,
7323 BASEPROPERTY_VERTICALALIGN
,
7324 BASEPROPERTY_WRITING_MODE
,
7325 BASEPROPERTY_CONTEXT_WRITING_MODE
,
7326 BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
,
7327 BASEPROPERTY_HIGHLIGHT_COLOR
,
7328 BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
,
7330 VCLXWindow::ImplGetPropertyIds( rIds
);
7333 SVTXNumericField::SVTXNumericField()
7337 SVTXNumericField::~SVTXNumericField()
7342 css::uno::Reference
<accessibility::XAccessibleContext
> SVTXNumericField::CreateAccessibleContext()
7344 return getAccessibleFactory().createAccessibleContext(this);
7348 void SVTXNumericField::setValue( double Value
)
7350 SolarMutexGuard aGuard
;
7352 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7354 pField
->GetFormatter().SetValue( Value
);
7357 double SVTXNumericField::getValue()
7359 SolarMutexGuard aGuard
;
7361 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7362 return pField
? pField
->GetFormatter().GetValue() : 0;
7365 void SVTXNumericField::setMin( double Value
)
7367 SolarMutexGuard aGuard
;
7369 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7371 pField
->GetFormatter().SetMinValue( Value
);
7374 double SVTXNumericField::getMin()
7376 SolarMutexGuard aGuard
;
7378 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7379 return pField
? pField
->GetFormatter().GetMinValue() : 0;
7382 void SVTXNumericField::setMax( double Value
)
7384 SolarMutexGuard aGuard
;
7386 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7388 pField
->GetFormatter().SetMaxValue( Value
);
7391 double SVTXNumericField::getMax()
7393 SolarMutexGuard aGuard
;
7395 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7396 return pField
? pField
->GetFormatter().GetMaxValue() : 0;
7399 void SVTXNumericField::setFirst( double Value
)
7401 SolarMutexGuard aGuard
;
7403 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7405 pField
->GetFormatter().SetSpinFirst( Value
);
7408 double SVTXNumericField::getFirst()
7410 SolarMutexGuard aGuard
;
7412 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7413 return pField
? pField
->GetFormatter().GetSpinFirst() : 0;
7416 void SVTXNumericField::setLast( double Value
)
7418 SolarMutexGuard aGuard
;
7420 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7422 pField
->GetFormatter().SetSpinLast( Value
);
7425 double SVTXNumericField::getLast()
7427 SolarMutexGuard aGuard
;
7429 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7430 return pField
? pField
->GetFormatter().GetSpinLast() : 0;
7433 void SVTXNumericField::setSpinSize( double Value
)
7435 SolarMutexGuard aGuard
;
7437 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7439 pField
->GetFormatter().SetSpinSize( Value
);
7442 double SVTXNumericField::getSpinSize()
7444 SolarMutexGuard aGuard
;
7446 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7447 return pField
? pField
->GetFormatter().GetSpinSize() : 0;
7450 void SVTXNumericField::setDecimalDigits( sal_Int16 Value
)
7452 SolarMutexGuard aGuard
;
7454 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7456 pField
->GetFormatter().SetDecimalDigits( Value
);
7459 sal_Int16
SVTXNumericField::getDecimalDigits()
7461 SolarMutexGuard aGuard
;
7463 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7464 return pField
? pField
->GetFormatter().GetDecimalDigits() : 0;
7467 void SVTXNumericField::setStrictFormat( sal_Bool bStrict
)
7469 SolarMutexGuard aGuard
;
7471 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7473 pField
->GetFormatter().SetStrictFormat( bStrict
);
7476 sal_Bool
SVTXNumericField::isStrictFormat()
7478 SolarMutexGuard aGuard
;
7480 VclPtr
<FormattedField
> pField
= GetAs
< FormattedField
>();
7481 return pField
&& pField
->GetFormatter().IsStrictFormat();
7484 void SVTXNumericField::GetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
7486 SVTXFormattedField::ImplGetPropertyIds( rIds
);
7489 SVTXDateField::SVTXDateField()
7493 SVTXDateField::~SVTXDateField()
7497 void SAL_CALL
SVTXDateField::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
7499 VCLXDateField::setProperty( PropertyName
, Value
);
7501 // some properties need to be forwarded to the sub edit, too
7503 VclPtr
< Edit
> pSubEdit
= GetWindow() ? GetAs
<Edit
>()->GetSubEdit() : nullptr;
7507 switch ( GetPropertyId( PropertyName
) )
7509 case BASEPROPERTY_TEXTLINECOLOR
:
7510 if ( !Value
.hasValue() )
7511 pSubEdit
->SetTextLineColor();
7515 if ( Value
>>= nColor
)
7516 pSubEdit
->SetTextLineColor( nColor
);
7522 void SVTXDateField::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
7524 PushPropertyIds( rIds
,
7525 BASEPROPERTY_TEXTLINECOLOR
,
7527 VCLXDateField::ImplGetPropertyIds( rIds
);
7530 VCLXMultiLineEdit::VCLXMultiLineEdit()
7531 :maTextListeners( *this )
7532 ,meLineEndType( LINEEND_LF
) // default behavior before introducing this property: LF (unix-like)
7536 VCLXMultiLineEdit::~VCLXMultiLineEdit()
7540 void VCLXMultiLineEdit::addTextListener( const css::uno::Reference
< css::awt::XTextListener
> & l
)
7542 maTextListeners
.addInterface( l
);
7545 void VCLXMultiLineEdit::removeTextListener( const css::uno::Reference
< css::awt::XTextListener
> & l
)
7547 maTextListeners
.removeInterface( l
);
7550 void VCLXMultiLineEdit::setText( const OUString
& aText
)
7552 SolarMutexGuard aGuard
;
7554 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7557 pEdit
->SetText( aText
);
7559 // #107218# Call same listeners like VCL would do after user interaction
7560 SetSynthesizingVCLEvent( true );
7561 pEdit
->SetModifyFlag();
7563 SetSynthesizingVCLEvent( false );
7567 void VCLXMultiLineEdit::insertText( const css::awt::Selection
& rSel
, const OUString
& aText
)
7569 SolarMutexGuard aGuard
;
7571 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7574 setSelection( rSel
);
7575 pEdit
->ReplaceSelected( aText
);
7579 OUString
VCLXMultiLineEdit::getText()
7581 SolarMutexGuard aGuard
;
7584 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7586 aText
= pEdit
->GetText( meLineEndType
);
7590 OUString
VCLXMultiLineEdit::getSelectedText()
7592 SolarMutexGuard aGuard
;
7595 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7596 if ( pMultiLineEdit
)
7597 aText
= pMultiLineEdit
->GetSelected( meLineEndType
);
7602 void VCLXMultiLineEdit::setSelection( const css::awt::Selection
& aSelection
)
7604 SolarMutexGuard aGuard
;
7606 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7607 if ( pMultiLineEdit
)
7609 pMultiLineEdit
->SetSelection( Selection( aSelection
.Min
, aSelection
.Max
) );
7613 css::awt::Selection
VCLXMultiLineEdit::getSelection()
7615 SolarMutexGuard aGuard
;
7617 css::awt::Selection aSel
;
7618 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7619 if ( pMultiLineEdit
)
7621 aSel
.Min
= pMultiLineEdit
->GetSelection().Min();
7622 aSel
.Max
= pMultiLineEdit
->GetSelection().Max();
7627 sal_Bool
VCLXMultiLineEdit::isEditable()
7629 SolarMutexGuard aGuard
;
7631 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7632 return pMultiLineEdit
&& !pMultiLineEdit
->IsReadOnly() && pMultiLineEdit
->IsEnabled();
7635 void VCLXMultiLineEdit::setEditable( sal_Bool bEditable
)
7637 SolarMutexGuard aGuard
;
7639 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7640 if ( pMultiLineEdit
)
7641 pMultiLineEdit
->SetReadOnly( !bEditable
);
7644 void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen
)
7646 SolarMutexGuard aGuard
;
7648 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7649 if ( pMultiLineEdit
)
7650 pMultiLineEdit
->SetMaxTextLen( nLen
);
7653 sal_Int16
VCLXMultiLineEdit::getMaxTextLen()
7655 SolarMutexGuard aGuard
;
7657 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7658 return pMultiLineEdit
? static_cast<sal_Int16
>(pMultiLineEdit
->GetMaxTextLen()) : sal_Int16(0);
7661 OUString
VCLXMultiLineEdit::getTextLines()
7663 SolarMutexGuard aGuard
;
7666 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7668 aText
= pEdit
->GetTextLines( meLineEndType
);
7672 css::awt::Size
VCLXMultiLineEdit::getMinimumSize()
7674 SolarMutexGuard aGuard
;
7677 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7679 aSz
= AWTSize(pEdit
->CalcMinimumSize());
7683 css::awt::Size
VCLXMultiLineEdit::getPreferredSize()
7685 return getMinimumSize();
7688 css::awt::Size
VCLXMultiLineEdit::calcAdjustedSize( const css::awt::Size
& rNewSize
)
7690 SolarMutexGuard aGuard
;
7692 css::awt::Size aSz
= rNewSize
;
7693 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7695 aSz
= AWTSize(pEdit
->CalcAdjustedSize( VCLSize(rNewSize
)));
7699 css::awt::Size
VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols
, sal_Int16 nLines
)
7701 SolarMutexGuard aGuard
;
7704 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7706 aSz
= AWTSize(pEdit
->CalcBlockSize( nCols
, nLines
));
7710 void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16
& nCols
, sal_Int16
& nLines
)
7712 SolarMutexGuard aGuard
;
7715 VclPtr
< MultiLineEdit
> pEdit
= GetAs
< MultiLineEdit
>();
7719 pEdit
->GetMaxVisColumnsAndLines( nC
, nL
);
7725 void VCLXMultiLineEdit::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
7727 switch ( rVclWindowEvent
.GetId() )
7729 case VclEventId::EditModify
:
7731 if ( maTextListeners
.getLength() )
7733 css::awt::TextEvent aEvent
;
7734 aEvent
.Source
= getXWeak();
7735 maTextListeners
.textChanged( aEvent
);
7741 VCLXWindow::ProcessWindowEvent( rVclWindowEvent
);
7747 void VCLXMultiLineEdit::setProperty( const OUString
& PropertyName
, const css::uno::Any
& Value
)
7749 SolarMutexGuard aGuard
;
7751 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7752 if ( !pMultiLineEdit
)
7755 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
7756 switch ( nPropType
)
7758 case BASEPROPERTY_LINE_END_FORMAT
:
7760 sal_Int16 nLineEndType
= css::awt::LineEndFormat::LINE_FEED
;
7761 OSL_VERIFY( Value
>>= nLineEndType
);
7762 switch ( nLineEndType
)
7764 case css::awt::LineEndFormat::CARRIAGE_RETURN
: meLineEndType
= LINEEND_CR
; break;
7765 case css::awt::LineEndFormat::LINE_FEED
: meLineEndType
= LINEEND_LF
; break;
7766 case css::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
: meLineEndType
= LINEEND_CRLF
; break;
7767 default: OSL_FAIL( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break;
7772 case BASEPROPERTY_READONLY
:
7776 pMultiLineEdit
->SetReadOnly( b
);
7779 case BASEPROPERTY_MAXTEXTLEN
:
7781 sal_Int16 n
= sal_Int16();
7783 pMultiLineEdit
->SetMaxTextLen( n
);
7786 case BASEPROPERTY_HIDEINACTIVESELECTION
:
7791 pMultiLineEdit
->EnableFocusSelectionHide( b
);
7792 lcl_setWinBits( pMultiLineEdit
, WB_NOHIDESELECTION
, !b
);
7798 VCLXWindow::setProperty( PropertyName
, Value
);
7803 css::uno::Any
VCLXMultiLineEdit::getProperty( const OUString
& PropertyName
)
7805 SolarMutexGuard aGuard
;
7807 css::uno::Any aProp
;
7808 VclPtr
< MultiLineEdit
> pMultiLineEdit
= GetAs
< MultiLineEdit
>();
7809 if ( pMultiLineEdit
)
7811 sal_uInt16 nPropType
= GetPropertyId( PropertyName
);
7812 switch ( nPropType
)
7814 case BASEPROPERTY_LINE_END_FORMAT
:
7816 sal_Int16 nLineEndType
= css::awt::LineEndFormat::LINE_FEED
;
7817 switch ( meLineEndType
)
7819 case LINEEND_CR
: nLineEndType
= css::awt::LineEndFormat::CARRIAGE_RETURN
; break;
7820 case LINEEND_LF
: nLineEndType
= css::awt::LineEndFormat::LINE_FEED
; break;
7821 case LINEEND_CRLF
: nLineEndType
= css::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
; break;
7822 default: OSL_FAIL( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break;
7824 aProp
<<= nLineEndType
;
7828 case BASEPROPERTY_READONLY
:
7830 aProp
<<= pMultiLineEdit
->IsReadOnly();
7833 case BASEPROPERTY_MAXTEXTLEN
:
7835 aProp
<<= static_cast<sal_Int16
>(pMultiLineEdit
->GetMaxTextLen());
7840 aProp
= VCLXWindow::getProperty( PropertyName
);
7847 void SAL_CALL
VCLXMultiLineEdit::setFocus( )
7849 SolarMutexGuard aGuard
;
7851 // don't grab the focus if we already have it. Reason is that the only thing which the edit
7852 // does is forwarding the focus to its text window. This text window then does a "select all".
7853 // So if the text window already has the focus, and we give the focus to the multi line
7854 // edit, then all which happens is that everything is selected.
7856 if ( GetWindow() && !GetWindow()->HasChildPathFocus() )
7857 GetWindow()->GrabFocus();
7860 void VCLXMultiLineEdit::ImplGetPropertyIds( std::vector
< sal_uInt16
> &rIds
)
7862 PushPropertyIds( rIds
,
7863 // FIXME: elide duplication ?
7864 BASEPROPERTY_LINE_END_FORMAT
,
7865 BASEPROPERTY_READONLY
,
7866 BASEPROPERTY_MAXTEXTLEN
,
7867 BASEPROPERTY_HIDEINACTIVESELECTION
,
7869 VCLXWindow::ImplGetPropertyIds( rIds
, true );
7872 css::uno::Reference
<css::accessibility::XAccessibleContext
> VCLXMultiLineEdit::CreateAccessibleContext()
7874 return getAccessibleFactory().createAccessibleContext(this);
7877 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */