LCOV - code coverage report
Current view: top level - toolkit/source/awt - vclxwindows.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1339 3288 40.7 %
Date: 2014-04-11 Functions: 201 499 40.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10