LCOV - code coverage report
Current view: top level - toolkit/source/controls - unocontrols.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1658 2325 71.3 %
Date: 2014-04-11 Functions: 372 511 72.8 %
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 <com/sun/star/awt/XTextArea.hpp>
      21             : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      22             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      23             : #include <com/sun/star/awt/PosSize.hpp>
      24             : #include <com/sun/star/awt/VisualEffect.hpp>
      25             : #include <com/sun/star/awt/LineEndFormat.hpp>
      26             : #include <com/sun/star/graphic/GraphicProvider.hpp>
      27             : #include <com/sun/star/graphic/XGraphicProvider.hpp>
      28             : #include <com/sun/star/graphic/GraphicObject.hpp>
      29             : #include <com/sun/star/util/Date.hpp>
      30             : #include <com/sun/star/awt/ImageScaleMode.hpp>
      31             : 
      32             : 
      33             : #include <toolkit/controls/formattedcontrol.hxx>
      34             : #include <toolkit/controls/roadmapcontrol.hxx>
      35             : #include <toolkit/controls/unocontrols.hxx>
      36             : #include <toolkit/controls/stdtabcontroller.hxx>
      37             : #include <toolkit/helper/property.hxx>
      38             : #include <toolkit/helper/unopropertyarrayhelper.hxx>
      39             : #include <toolkit/helper/servicenames.hxx>
      40             : #include <toolkit/helper/macros.hxx>
      41             : #include <toolkit/helper/imagealign.hxx>
      42             : 
      43             : // for introspection
      44             : #include <toolkit/awt/vclxwindows.hxx>
      45             : #include <cppuhelper/typeprovider.hxx>
      46             : #include <comphelper/processfactory.hxx>
      47             : #include <vcl/wrkwin.hxx>
      48             : #include <vcl/svapp.hxx>
      49             : #include <vcl/edit.hxx>
      50             : #include <vcl/button.hxx>
      51             : #include <vcl/group.hxx>
      52             : #include <vcl/fixed.hxx>
      53             : #include <vcl/lstbox.hxx>
      54             : #include <vcl/combobox.hxx>
      55             : #include <tools/debug.hxx>
      56             : #include <tools/diagnose_ex.h>
      57             : #include <tools/date.hxx>
      58             : #include <tools/time.hxx>
      59             : 
      60             : #include <algorithm>
      61             : #include <functional>
      62             : 
      63             : using namespace css;
      64             : using namespace css::awt;
      65             : using namespace css::lang;
      66             : using namespace css::uno;
      67             : using ::com::sun::star::graphic::XGraphic;
      68             : using ::com::sun::star::uno::Reference;
      69             : using namespace ::toolkit;
      70             : 
      71             : #define IMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \
      72             :     OUString SAL_CALL ImplName::getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) { return OUString( "stardiv.Toolkit." #ImplName ); } \
      73             :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL ImplName::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) \
      74             :                             { \
      75             :                                 ::com::sun::star::uno::Sequence< OUString > aNames = BaseClass::getSupportedServiceNames( ); \
      76             :                                 aNames.realloc( aNames.getLength() + 1 ); \
      77             :                                 aNames[ aNames.getLength() - 1 ] = OUString::createFromAscii( ServiceName ); \
      78             :                                 return aNames; \
      79             :                             } \
      80             : 
      81             : 
      82             : uno::Reference< graphic::XGraphic >
      83           2 : ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& xOutGraphicObj, const OUString& _rURL )
      84             : {
      85           2 :     if ( _rURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
      86             :     {
      87             :         // graphic manager uniqueid
      88           0 :         OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
      89           0 :         xOutGraphicObj = graphic::GraphicObject::createWithId( ::comphelper::getProcessComponentContext(), sID );
      90             :     }
      91             :     else // linked
      92           2 :         xOutGraphicObj = NULL; // release the GraphicObject
      93             : 
      94           2 :     return ImageHelper::getGraphicFromURL_nothrow( _rURL );
      95             : }
      96             : 
      97             : ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
      98          28 : ImageHelper::getGraphicFromURL_nothrow( const OUString& _rURL )
      99             : {
     100          28 :     uno::Reference< graphic::XGraphic > xGraphic;
     101          28 :     if ( _rURL.isEmpty() )
     102           0 :         return xGraphic;
     103             : 
     104             :     try
     105             :     {
     106          28 :         uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     107          56 :         uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) );
     108          56 :         uno::Sequence< beans::PropertyValue > aMediaProperties(1);
     109          28 :         aMediaProperties[0].Name = "URL";
     110          28 :         aMediaProperties[0].Value <<= _rURL;
     111          56 :         xGraphic = xProvider->queryGraphic( aMediaProperties );
     112             :     }
     113           0 :     catch (const Exception&)
     114             :     {
     115             :         DBG_UNHANDLED_EXCEPTION();
     116             :     }
     117             : 
     118          28 :     return xGraphic;
     119             : }
     120             : 
     121             : //  class UnoControlEditModel
     122             : 
     123          12 : UnoControlEditModel::UnoControlEditModel( const Reference< XComponentContext >& rxContext )
     124          12 :     :UnoControlModel( rxContext )
     125             : {
     126          12 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXEdit );
     127          12 : }
     128             : 
     129           1 : OUString UnoControlEditModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     130             : {
     131           1 :     return OUString::createFromAscii( szServiceName_UnoControlEditModel );
     132             : }
     133             : 
     134         521 : uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     135             : {
     136         521 :     uno::Any aReturn;
     137             : 
     138         521 :     switch ( nPropId )
     139             :     {
     140             :     case BASEPROPERTY_LINE_END_FORMAT:
     141          17 :         aReturn <<= (sal_Int16)awt::LineEndFormat::LINE_FEED;   // LF
     142          17 :         break;
     143             :     case BASEPROPERTY_DEFAULTCONTROL:
     144          15 :         aReturn <<= OUString::createFromAscii( szServiceName_UnoControlEdit );
     145          15 :         break;
     146             :     default:
     147         489 :         aReturn = UnoControlModel::ImplGetDefaultValue( nPropId );
     148         489 :         break;
     149             :     }
     150         521 :     return aReturn;
     151             : }
     152             : 
     153        1999 : ::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper()
     154             : {
     155             :     static UnoPropertyArrayHelper* pHelper = NULL;
     156        1999 :     if ( !pHelper )
     157             :     {
     158           4 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
     159           4 :         pHelper = new UnoPropertyArrayHelper( aIDs );
     160             :     }
     161        1999 :     return *pHelper;
     162             : }
     163             : 
     164             : // beans::XMultiPropertySet
     165          63 : uno::Reference< beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     166             : {
     167          63 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     168          63 :     return xInfo;
     169             : }
     170             : 
     171             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     172           7 : stardiv_Toolkit_UnoControlEditModel_get_implementation(
     173             :     css::uno::XComponentContext *context,
     174             :     css::uno::Sequence<css::uno::Any> const &)
     175             : {
     176           7 :     return cppu::acquire(new UnoControlEditModel(context));
     177             : }
     178             : 
     179             : 
     180             : //  class UnoEditControl
     181             : 
     182         126 : UnoEditControl::UnoEditControl()
     183             :     :UnoControlBase()
     184             :     ,maTextListeners( *this )
     185             :     ,mnMaxTextLen( 0 )
     186             :     ,mbSetTextInPeer( false )
     187             :     ,mbSetMaxTextLenInPeer( false )
     188         126 :     ,mbHasTextProperty( false )
     189             : {
     190         126 :     maComponentInfos.nWidth = 100;
     191         126 :     maComponentInfos.nHeight = 12;
     192         126 :     mnMaxTextLen = 0;
     193         126 :     mbSetMaxTextLenInPeer = false;
     194         126 : }
     195             : 
     196        5780 : uno::Any SAL_CALL UnoEditControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
     197             : {
     198        5780 :     uno::Any aReturn = UnoControlBase::queryAggregation( rType );
     199        5780 :     if ( !aReturn.hasValue() )
     200         392 :         aReturn = UnoEditControl_Base::queryInterface( rType );
     201        5780 :     return aReturn;
     202             : }
     203             : 
     204        5066 : uno::Any SAL_CALL UnoEditControl::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
     205             : {
     206        5066 :     return UnoControlBase::queryInterface( rType );
     207             : }
     208             : 
     209        8061 : void SAL_CALL UnoEditControl::acquire(  ) throw ()
     210             : {
     211        8061 :     UnoControlBase::acquire();
     212        8061 : }
     213             : 
     214        8016 : void SAL_CALL UnoEditControl::release(  ) throw ()
     215             : {
     216        8016 :     UnoControlBase::release();
     217        8016 : }
     218             : 
     219          21 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoEditControl, UnoControlBase, UnoEditControl_Base )
     220             : 
     221          65 : OUString UnoEditControl::GetComponentServiceName()
     222             : {
     223             :     // by default, we want a simple edit field
     224          65 :     OUString sName( "Edit" );
     225             : 
     226             :     // but maybe we are to display multi-line text?
     227         130 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) );
     228          65 :     bool b = bool();
     229          65 :     if ( ( aVal >>= b ) && b )
     230          11 :         sName = "MultiLineEdit";
     231             : 
     232         130 :     return sName;
     233             : }
     234             : 
     235         258 : sal_Bool SAL_CALL UnoEditControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) throw ( uno::RuntimeException, std::exception )
     236             : {
     237         258 :     bool bReturn = UnoControlBase::setModel( _rModel );
     238         258 :     mbHasTextProperty = ImplHasProperty( BASEPROPERTY_TEXT );
     239         258 :     return bReturn;
     240             : }
     241             : 
     242       20590 : void UnoEditControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal )
     243             : {
     244       20590 :     bool bDone = false;
     245       20590 :     if ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT )
     246             :     {
     247             :         // #96986# use setText(), or text listener will not be called.
     248         297 :         uno::Reference < awt::XTextComponent > xTextComponent( getPeer(), uno::UNO_QUERY );
     249         297 :         if ( xTextComponent.is() )
     250             :         {
     251         273 :             OUString sText;
     252         273 :             rVal >>= sText;
     253         273 :             ImplCheckLocalize( sText );
     254         273 :             xTextComponent->setText( sText );
     255         273 :             bDone = true;
     256         297 :         }
     257             :     }
     258             : 
     259       20590 :     if ( !bDone )
     260       20317 :         UnoControlBase::ImplSetPeerProperty( rPropName, rVal );
     261       20590 : }
     262             : 
     263         110 : void UnoEditControl::dispose() throw(uno::RuntimeException, std::exception)
     264             : {
     265         110 :     lang::EventObject aEvt( *this );
     266         110 :     maTextListeners.disposeAndClear( aEvt );
     267         110 :     UnoControl::dispose();
     268         110 : }
     269             : 
     270         192 : void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
     271             : {
     272         192 :     UnoControl::createPeer( rxToolkit, rParentPeer );
     273             : 
     274         192 :     uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     275         192 :     if ( xText.is() )
     276             :     {
     277         192 :     xText->addTextListener( this );
     278             : 
     279         192 :     if ( mbSetMaxTextLenInPeer )
     280           0 :         xText->setMaxTextLen( mnMaxTextLen );
     281         192 :     if ( mbSetTextInPeer )
     282           0 :         xText->setText( maText );
     283         192 :     }
     284         192 : }
     285             : 
     286           0 : void UnoEditControl::textChanged(const awt::TextEvent& e) throw(uno::RuntimeException, std::exception)
     287             : {
     288           0 :     uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     289             : 
     290           0 :     if ( mbHasTextProperty )
     291             :     {
     292           0 :         uno::Any aAny;
     293           0 :         aAny <<= xText->getText();
     294           0 :         ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, false );
     295             :     }
     296             :     else
     297             :     {
     298           0 :         maText = xText->getText();
     299             :     }
     300             : 
     301           0 :     if ( maTextListeners.getLength() )
     302           0 :         maTextListeners.textChanged( e );
     303           0 : }
     304             : 
     305          32 : void UnoEditControl::addTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException, std::exception)
     306             : {
     307          32 :     maTextListeners.addInterface( l );
     308          32 : }
     309             : 
     310          15 : void UnoEditControl::removeTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException, std::exception)
     311             : {
     312          15 :     maTextListeners.removeInterface( l );
     313          15 : }
     314             : 
     315         137 : void UnoEditControl::setText( const OUString& aText ) throw(uno::RuntimeException, std::exception)
     316             : {
     317         137 :     if ( mbHasTextProperty )
     318             :     {
     319         101 :         uno::Any aAny;
     320         101 :         aAny <<= aText;
     321         101 :         ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, true );
     322             :     }
     323             :     else
     324             :     {
     325          36 :         maText = aText;
     326          36 :         mbSetTextInPeer = true;
     327          36 :             uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     328          36 :         if ( xText.is() )
     329          36 :             xText->setText( maText );
     330             :         }
     331             : 
     332             :     // Setting the property to the VCLXWindow doesn't call textChanged
     333         137 :     if ( maTextListeners.getLength() )
     334             :     {
     335         137 :         awt::TextEvent aEvent;
     336         137 :         aEvent.Source = *this;
     337         137 :         maTextListeners.textChanged( aEvent );
     338             :     }
     339         137 : }
     340             : 
     341             : namespace
     342             : {
     343          15 :     static void lcl_normalize( awt::Selection& _rSel )
     344             :     {
     345          15 :         if ( _rSel.Min > _rSel.Max )
     346           0 :             ::std::swap( _rSel.Min, _rSel.Max );
     347          15 :     }
     348             : }
     349             : 
     350          15 : void UnoEditControl::insertText( const awt::Selection& rSel, const OUString& rNewText ) throw(uno::RuntimeException, std::exception)
     351             : {
     352             :     // normalize the selection - OUString::replaceAt has a strange behaviour if the min is greater than the max
     353          15 :     awt::Selection aSelection( rSel );
     354          15 :     lcl_normalize( aSelection );
     355             : 
     356             :     // preserve the selection resp. cursor position
     357          15 :     awt::Selection aNewSelection( getSelection() );
     358             : #ifdef ALSO_PRESERVE_COMPLETE_SELECTION
     359             :         // (not sure - looks uglier ...)
     360             :     sal_Int32 nDeletedCharacters = ( aSelection.Max - aSelection.Min ) - rNewText.getLength();
     361             :     if ( aNewSelection.Min > aSelection.Min )
     362             :         aNewSelection.Min -= nDeletedCharacters;
     363             :     if ( aNewSelection.Max > aSelection.Max )
     364             :         aNewSelection.Max -= nDeletedCharacters;
     365             : #else
     366          15 :     aNewSelection.Max = ::std::min( aNewSelection.Min, aNewSelection.Max ) + rNewText.getLength();
     367          15 :     aNewSelection.Min = aNewSelection.Max;
     368             : #endif
     369             : 
     370          15 :     OUString aOldText = getText();
     371          30 :     OUString  aNewText = aOldText.replaceAt( aSelection.Min, aSelection.Max - aSelection.Min, rNewText );
     372          15 :     setText( aNewText );
     373             : 
     374          30 :     setSelection( aNewSelection );
     375          15 : }
     376             : 
     377          94 : OUString UnoEditControl::getText() throw(uno::RuntimeException, std::exception)
     378             : {
     379          94 :     OUString aText = maText;
     380             : 
     381          94 :     if ( mbHasTextProperty )
     382          70 :         aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
     383             :     else
     384             :     {
     385          24 :         uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     386          24 :         if ( xText.is() )
     387          24 :             aText = xText->getText();
     388             :     }
     389             : 
     390          94 :     return aText;
     391             : }
     392             : 
     393          15 : OUString UnoEditControl::getSelectedText( void ) throw(uno::RuntimeException, std::exception)
     394             : {
     395          15 :     OUString sSelected;
     396          30 :         uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     397          15 :     if ( xText.is() )
     398          15 :         sSelected = xText->getSelectedText();
     399             : 
     400          30 :     return sSelected;
     401             : }
     402             : 
     403          60 : void UnoEditControl::setSelection( const awt::Selection& aSelection ) throw(uno::RuntimeException, std::exception)
     404             : {
     405          60 :         uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     406          60 :     if ( xText.is() )
     407          60 :         xText->setSelection( aSelection );
     408          60 : }
     409             : 
     410          45 : awt::Selection UnoEditControl::getSelection( void ) throw(uno::RuntimeException, std::exception)
     411             : {
     412          45 :     awt::Selection aSel;
     413          45 :         uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     414          45 :     if ( xText.is() )
     415          45 :         aSel = xText->getSelection();
     416          45 :     return aSel;
     417             : }
     418             : 
     419          30 : sal_Bool UnoEditControl::isEditable( void ) throw(uno::RuntimeException, std::exception)
     420             : {
     421          30 :     return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY );
     422             : }
     423             : 
     424          30 : void UnoEditControl::setEditable( sal_Bool bEditable ) throw(uno::RuntimeException, std::exception)
     425             : {
     426          30 :     uno::Any aAny;
     427          30 :     aAny <<= !bEditable;
     428          30 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), aAny, true );
     429          30 : }
     430             : 
     431          45 : sal_Int16 UnoEditControl::getMaxTextLen() throw(uno::RuntimeException, std::exception)
     432             : {
     433          45 :     sal_Int16 nMaxLen = mnMaxTextLen;
     434             : 
     435          45 :     if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN ) )
     436          21 :         nMaxLen = ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN );
     437             : 
     438          45 :     return nMaxLen;
     439             : }
     440             : 
     441          30 : void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(uno::RuntimeException, std::exception)
     442             : {
     443          30 :     if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN) )
     444             :     {
     445          14 :         uno::Any aAny;
     446          14 :         aAny <<= (sal_Int16)nLen;
     447          14 :         ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), aAny, true );
     448             :     }
     449             :     else
     450             :     {
     451          16 :         mnMaxTextLen = nLen;
     452          16 :         mbSetMaxTextLenInPeer = true;
     453          16 :             uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
     454          16 :         if ( xText.is() )
     455          16 :             xText->setMaxTextLen( mnMaxTextLen );
     456             :     }
     457          30 : }
     458             : 
     459          15 : awt::Size UnoEditControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
     460             : {
     461          15 :     return Impl_getMinimumSize();
     462             : }
     463             : 
     464          16 : awt::Size UnoEditControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
     465             : {
     466          16 :     return Impl_getPreferredSize();
     467             : }
     468             : 
     469          15 : awt::Size UnoEditControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
     470             : {
     471          15 :     return Impl_calcAdjustedSize( rNewSize );
     472             : }
     473             : 
     474          16 : awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException, std::exception)
     475             : {
     476          16 :     return Impl_getMinimumSize( nCols, nLines );
     477             : }
     478             : 
     479          15 : void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException, std::exception)
     480             : {
     481          15 :     Impl_getColumnsAndLines( nCols, nLines );
     482          15 : }
     483             : 
     484           1 : OUString UnoEditControl::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
     485             : {
     486           1 :     return OUString( "stardiv.Toolkit.UnoEditControl" );
     487             : }
     488             : 
     489           0 : uno::Sequence< OUString > UnoEditControl::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
     490             : {
     491           0 :     uno::Sequence< OUString > aNames = UnoControlBase::getSupportedServiceNames( );
     492           0 :     aNames.realloc( aNames.getLength() + 1 );
     493           0 :     aNames[ aNames.getLength() - 1 ] = OUString::createFromAscii( szServiceName2_UnoControlEdit );
     494           0 :     return aNames;
     495             : }
     496             : 
     497             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     498           2 : stardiv_Toolkit_UnoEditControl_get_implementation(
     499             :     css::uno::XComponentContext *,
     500             :     css::uno::Sequence<css::uno::Any> const &)
     501             : {
     502           2 :     return cppu::acquire(new UnoEditControl());
     503             : }
     504             : 
     505             : 
     506             : //  class UnoControlFileControlModel
     507             : 
     508           7 : UnoControlFileControlModel::UnoControlFileControlModel( const Reference< XComponentContext >& rxContext )
     509           7 :     :UnoControlModel( rxContext )
     510             : {
     511           7 :     ImplRegisterProperty( BASEPROPERTY_ALIGN );
     512           7 :     ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
     513           7 :     ImplRegisterProperty( BASEPROPERTY_BORDER );
     514           7 :     ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
     515           7 :     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
     516           7 :     ImplRegisterProperty( BASEPROPERTY_ENABLED );
     517           7 :     ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
     518           7 :     ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
     519           7 :     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
     520           7 :     ImplRegisterProperty( BASEPROPERTY_HELPURL );
     521           7 :     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
     522           7 :     ImplRegisterProperty( BASEPROPERTY_READONLY );
     523           7 :     ImplRegisterProperty( BASEPROPERTY_TABSTOP );
     524           7 :     ImplRegisterProperty( BASEPROPERTY_TEXT );
     525           7 :     ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
     526           7 :     ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
     527           7 :     ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
     528           7 :     ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
     529           7 : }
     530             : 
     531           1 : OUString UnoControlFileControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
     532             : {
     533           1 :     return OUString::createFromAscii( szServiceName_UnoControlFileControlModel );
     534             : }
     535             : 
     536         175 : uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     537             : {
     538         175 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
     539             :     {
     540           8 :         uno::Any aAny;
     541           8 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlFileControl );
     542           8 :         return aAny;
     543             :     }
     544         167 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
     545             : }
     546             : 
     547         847 : ::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper()
     548             : {
     549             :     static UnoPropertyArrayHelper* pHelper = NULL;
     550         847 :     if ( !pHelper )
     551             :     {
     552           1 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
     553           1 :         pHelper = new UnoPropertyArrayHelper( aIDs );
     554             :     }
     555         847 :     return *pHelper;
     556             : }
     557             : 
     558             : // beans::XMultiPropertySet
     559          41 : uno::Reference< beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     560             : {
     561          41 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     562          41 :     return xInfo;
     563             : }
     564             : 
     565             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     566           6 : stardiv_Toolkit_UnoControlFileControlModel_get_implementation(
     567             :     css::uno::XComponentContext *context,
     568             :     css::uno::Sequence<css::uno::Any> const &)
     569             : {
     570           6 :     return cppu::acquire(new UnoControlFileControlModel(context));
     571             : }
     572             : 
     573             : 
     574             : //  class UnoFileControl
     575             : 
     576           0 : UnoFileControl::UnoFileControl()
     577           0 :     :UnoEditControl()
     578             : {
     579           0 : }
     580             : 
     581           0 : OUString UnoFileControl::GetComponentServiceName()
     582             : {
     583           0 :     return OUString("filecontrol");
     584             : }
     585             : 
     586             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     587           0 : stardiv_Toolkit_UnoFileControl_get_implementation(
     588             :     css::uno::XComponentContext *,
     589             :     css::uno::Sequence<css::uno::Any> const &)
     590             : {
     591           0 :     return cppu::acquire(new UnoFileControl());
     592             : }
     593             : 
     594             : 
     595             : //  class GraphicControlModel
     596             : 
     597        3367 : uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     598             : {
     599        3367 :     if ( nPropId == BASEPROPERTY_GRAPHIC )
     600         132 :         return uno::makeAny( uno::Reference< graphic::XGraphic >() );
     601             : 
     602        3235 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
     603             : }
     604             : 
     605        1663 : void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception)
     606             : {
     607        1663 :     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
     608             : 
     609             :     // - ImageAlign and ImagePosition need to correspond to each other
     610             :     // - Graphic and ImageURL need to correspond to each other
     611             :     try
     612             :     {
     613        1663 :         switch ( nHandle )
     614             :         {
     615             :         case BASEPROPERTY_IMAGEURL:
     616          24 :             if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
     617             :             {
     618          24 :                 mbAdjustingGraphic = true;
     619          24 :                 OUString sImageURL;
     620          24 :                 OSL_VERIFY( rValue >>= sImageURL );
     621          24 :                 setDependentFastPropertyValue( BASEPROPERTY_GRAPHIC, uno::makeAny( ImageHelper::getGraphicFromURL_nothrow( sImageURL ) ) );
     622          24 :                 mbAdjustingGraphic = false;
     623             :             }
     624          24 :             break;
     625             : 
     626             :         case BASEPROPERTY_GRAPHIC:
     627           0 :             if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
     628             :             {
     629           0 :                 mbAdjustingGraphic = true;
     630           0 :                 setDependentFastPropertyValue( BASEPROPERTY_IMAGEURL, uno::makeAny( OUString() ) );
     631           0 :                 mbAdjustingGraphic = false;
     632             :             }
     633           0 :             break;
     634             : 
     635             :         case BASEPROPERTY_IMAGEALIGN:
     636           8 :             if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEPOSITION ) )
     637             :             {
     638           6 :                 mbAdjustingImagePosition = true;
     639           6 :                 sal_Int16 nUNOValue = 0;
     640           6 :                 OSL_VERIFY( rValue >>= nUNOValue );
     641           6 :                 setDependentFastPropertyValue( BASEPROPERTY_IMAGEPOSITION, uno::makeAny( getExtendedImagePosition( nUNOValue ) ) );
     642           6 :                 mbAdjustingImagePosition = false;
     643             :             }
     644           8 :             break;
     645             :         case BASEPROPERTY_IMAGEPOSITION:
     646         134 :             if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEALIGN ) )
     647             :             {
     648          89 :                 mbAdjustingImagePosition = true;
     649          89 :                 sal_Int16 nUNOValue = 0;
     650          89 :                 OSL_VERIFY( rValue >>= nUNOValue );
     651          89 :                 setDependentFastPropertyValue( BASEPROPERTY_IMAGEALIGN, uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
     652          89 :                 mbAdjustingImagePosition = false;
     653             :             }
     654         134 :             break;
     655             :         }
     656             :     }
     657           0 :     catch( const ::com::sun::star::uno::Exception& )
     658             :     {
     659             :         OSL_FAIL( "GraphicControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" );
     660             :         DBG_UNHANDLED_EXCEPTION();
     661           0 :         mbAdjustingImagePosition = false;
     662             :     }
     663        1663 : }
     664             : 
     665             : 
     666             : //  class UnoControlButtonModel
     667             : 
     668          59 : UnoControlButtonModel::UnoControlButtonModel( const Reference< XComponentContext >& rxContext )
     669          59 :     :GraphicControlModel( rxContext )
     670             : {
     671          59 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXButton );
     672             : 
     673          59 :     osl_atomic_increment( &m_refCount );
     674             :     {
     675          59 :         setFastPropertyValue_NoBroadcast( BASEPROPERTY_IMAGEPOSITION, ImplGetDefaultValue( BASEPROPERTY_IMAGEPOSITION ) );
     676             :         // this ensures that our ImagePosition is consistent with our ImageAlign property (since both
     677             :         // defaults are not per se consistent), since both are coupled in setFastPropertyValue_NoBroadcast
     678             :     }
     679          59 :     osl_atomic_decrement( &m_refCount );
     680          59 : }
     681             : 
     682           1 : OUString UnoControlButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
     683             : {
     684           1 :     return OUString::createFromAscii( szServiceName_UnoControlButtonModel );
     685             : }
     686             : 
     687        1937 : uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     688             : {
     689        1937 :     switch ( nPropId )
     690             :     {
     691             :     case BASEPROPERTY_DEFAULTCONTROL:
     692          60 :         return uno::makeAny( OUString::createFromAscii( szServiceName_UnoControlButton ) );
     693             :     case BASEPROPERTY_TOGGLE:
     694          60 :         return uno::makeAny( false );
     695             :     case BASEPROPERTY_ALIGN:
     696          61 :         return uno::makeAny( (sal_Int16)PROPERTY_ALIGN_CENTER );
     697             :     case BASEPROPERTY_FOCUSONCLICK:
     698          61 :         return uno::makeAny( true );
     699             :     }
     700             : 
     701        1695 :     return GraphicControlModel::ImplGetDefaultValue( nPropId );
     702             : }
     703             : 
     704        5238 : ::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper()
     705             : {
     706             :     static UnoPropertyArrayHelper* pHelper = NULL;
     707        5238 :     if ( !pHelper )
     708             :     {
     709          12 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
     710          12 :         pHelper = new UnoPropertyArrayHelper( aIDs );
     711             :     }
     712        5238 :     return *pHelper;
     713             : }
     714             : 
     715             : // beans::XMultiPropertySet
     716          64 : uno::Reference< beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     717             : {
     718          64 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     719          64 :     return xInfo;
     720             : }
     721             : 
     722             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     723          53 : stardiv_Toolkit_UnoControlButtonModel_get_implementation(
     724             :     css::uno::XComponentContext *context,
     725             :     css::uno::Sequence<css::uno::Any> const &)
     726             : {
     727          53 :     return cppu::acquire(new UnoControlButtonModel(context));
     728             : }
     729             : 
     730             : 
     731             : //  class UnoButtonControl
     732             : 
     733         137 : UnoButtonControl::UnoButtonControl()
     734             :     :UnoButtonControl_Base()
     735             :     ,maActionListeners( *this )
     736         137 :     ,maItemListeners( *this )
     737             : {
     738         137 :     maComponentInfos.nWidth = 50;
     739         137 :     maComponentInfos.nHeight = 14;
     740         137 : }
     741             : 
     742          52 : OUString UnoButtonControl::GetComponentServiceName()
     743             : {
     744          52 :     OUString aName( "pushbutton" );
     745         104 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_PUSHBUTTONTYPE ) );
     746          52 :     sal_Int16 n = sal_Int16();
     747          52 :     if ( ( aVal >>= n ) && n )
     748             :     {
     749             :         // Use PushButtonType later when available...
     750           0 :         switch ( n )
     751             :         {
     752           0 :             case 1 /*PushButtonType::OK*/:      aName = "okbutton";
     753           0 :                                                 break;
     754           0 :             case 2 /*PushButtonType::CANCEL*/:  aName = "cancelbutton";
     755           0 :                                                 break;
     756           0 :             case 3 /*PushButtonType::HELP*/:    aName = "helpbutton";
     757           0 :                                                 break;
     758             :             default:
     759             :             {
     760             :                 OSL_FAIL( "Unknown Button Type!" );
     761             :             }
     762             :         }
     763             :     }
     764         104 :     return aName;
     765             : }
     766             : 
     767         198 : void UnoButtonControl::dispose() throw(uno::RuntimeException, std::exception)
     768             : {
     769         198 :     lang::EventObject aEvt;
     770         198 :     aEvt.Source = (::cppu::OWeakObject*)this;
     771         198 :     maActionListeners.disposeAndClear( aEvt );
     772         198 :     maItemListeners.disposeAndClear( aEvt );
     773         198 :     UnoControlBase::dispose();
     774         198 : }
     775             : 
     776          54 : void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
     777             : {
     778          54 :     UnoControlBase::createPeer( rxToolkit, rParentPeer );
     779             : 
     780          54 :     uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
     781          54 :     xButton->setActionCommand( maActionCommand );
     782          54 :     if ( maActionListeners.getLength() )
     783          49 :         xButton->addActionListener( &maActionListeners );
     784             : 
     785         108 :     uno::Reference< XToggleButton > xPushButton( getPeer(), uno::UNO_QUERY );
     786          54 :     if ( xPushButton.is() )
     787         108 :         xPushButton->addItemListener( this );
     788          54 : }
     789             : 
     790         131 : void UnoButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
     791             : {
     792         131 :     maActionListeners.addInterface( l );
     793         131 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
     794             :     {
     795           2 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
     796           2 :         xButton->addActionListener( &maActionListeners );
     797             :     }
     798         131 : }
     799             : 
     800           1 : void UnoButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
     801             : {
     802           1 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
     803             :     {
     804           1 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
     805           1 :         xButton->removeActionListener( &maActionListeners );
     806             :     }
     807           1 :     maActionListeners.removeInterface( l );
     808           1 : }
     809             : 
     810           2 : void UnoButtonControl::addItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
     811             : {
     812           2 :     maItemListeners.addInterface( l );
     813           2 : }
     814             : 
     815           1 : void UnoButtonControl::removeItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
     816             : {
     817           1 :     maItemListeners.removeInterface( l );
     818           1 : }
     819             : 
     820         347 : void SAL_CALL UnoButtonControl::disposing( const lang::EventObject& Source ) throw (uno::RuntimeException, std::exception)
     821             : {
     822         347 :     UnoControlBase::disposing( Source );
     823         347 : }
     824             : 
     825           0 : void SAL_CALL UnoButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw (uno::RuntimeException, std::exception)
     826             : {
     827             :     // forward to model
     828           0 :     uno::Any aAny;
     829           0 :     aAny <<= (sal_Int16)rEvent.Selected;
     830           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, false );
     831             : 
     832             :     // multiplex
     833           0 :     ItemEvent aEvent( rEvent );
     834           0 :     aEvent.Source = *this;
     835           0 :     maItemListeners.itemStateChanged( aEvent );
     836           0 : }
     837             : 
     838           2 : void UnoButtonControl::setLabel( const OUString&  rLabel ) throw(uno::RuntimeException, std::exception)
     839             : {
     840           2 :     uno::Any aAny;
     841           2 :     aAny <<= rLabel;
     842           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, true );
     843           2 : }
     844             : 
     845           2 : void UnoButtonControl::setActionCommand( const OUString& rCommand ) throw(uno::RuntimeException, std::exception)
     846             : {
     847           2 :     maActionCommand = rCommand;
     848           2 :     if ( getPeer().is() )
     849             :     {
     850           2 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
     851           2 :         xButton->setActionCommand( rCommand );
     852             :     }
     853           2 : }
     854             : 
     855           2 : awt::Size UnoButtonControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
     856             : {
     857           2 :     return Impl_getMinimumSize();
     858             : }
     859             : 
     860           3 : awt::Size UnoButtonControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
     861             : {
     862           3 :     return Impl_getPreferredSize();
     863             : }
     864             : 
     865           2 : awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
     866             : {
     867           2 :     return Impl_calcAdjustedSize( rNewSize );
     868             : }
     869             : 
     870             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     871         137 : stardiv_Toolkit_UnoButtonControl_get_implementation(
     872             :     css::uno::XComponentContext *,
     873             :     css::uno::Sequence<css::uno::Any> const &)
     874             : {
     875         137 :     return cppu::acquire(new UnoButtonControl());
     876             : }
     877             : 
     878             : 
     879             : //  class UnoControlImageControlModel
     880             : 
     881          24 : UnoControlImageControlModel::UnoControlImageControlModel( const Reference< XComponentContext >& rxContext )
     882             :     :GraphicControlModel( rxContext )
     883          24 :     ,mbAdjustingImageScaleMode( false )
     884             : {
     885          24 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXImageControl );
     886          24 : }
     887             : 
     888           1 : OUString UnoControlImageControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
     889             : {
     890           1 :     return OUString::createFromAscii( szServiceName_UnoControlImageControlModel );
     891             : }
     892             : 
     893         434 : uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     894             : {
     895         434 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
     896          27 :         return uno::makeAny( OUString::createFromAscii( szServiceName_UnoControlImageControl ) );
     897             : 
     898         407 :     if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE )
     899          27 :         return makeAny( awt::ImageScaleMode::ANISOTROPIC );
     900             : 
     901         380 :     return GraphicControlModel::ImplGetDefaultValue( nPropId );
     902             : }
     903             : 
     904        2484 : ::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper()
     905             : {
     906             :     static UnoPropertyArrayHelper* pHelper = NULL;
     907        2484 :     if ( !pHelper )
     908             :     {
     909           3 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
     910           3 :         pHelper = new UnoPropertyArrayHelper( aIDs );
     911             :     }
     912        2484 :     return *pHelper;
     913             : }
     914             : 
     915             : // beans::XMultiPropertySet
     916          38 : uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     917             : {
     918          38 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     919          38 :     return xInfo;
     920             : }
     921             : 
     922         306 : void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception, std::exception)
     923             : {
     924         306 :     GraphicControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
     925             : 
     926             :     // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible
     927             :     try
     928             :     {
     929         306 :         switch ( _nHandle )
     930             :         {
     931             :         case BASEPROPERTY_IMAGE_SCALE_MODE:
     932          44 :             if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_SCALEIMAGE ) )
     933             :             {
     934          22 :                 mbAdjustingImageScaleMode = true;
     935          22 :                 sal_Int16 nScaleMode( awt::ImageScaleMode::ANISOTROPIC );
     936          22 :                 OSL_VERIFY( _rValue >>= nScaleMode );
     937          22 :                 setDependentFastPropertyValue( BASEPROPERTY_SCALEIMAGE, uno::makeAny( nScaleMode != awt::ImageScaleMode::NONE ) );
     938          22 :                 mbAdjustingImageScaleMode = false;
     939             :             }
     940          44 :             break;
     941             :         case BASEPROPERTY_SCALEIMAGE:
     942          44 :             if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_IMAGE_SCALE_MODE ) )
     943             :             {
     944          22 :                 mbAdjustingImageScaleMode = true;
     945          22 :                 bool bScale = true;
     946          22 :                 OSL_VERIFY( _rValue >>= bScale );
     947          22 :                 setDependentFastPropertyValue( BASEPROPERTY_IMAGE_SCALE_MODE, uno::makeAny( bScale ? awt::ImageScaleMode::ANISOTROPIC : awt::ImageScaleMode::NONE ) );
     948          22 :                 mbAdjustingImageScaleMode = false;
     949             :             }
     950          44 :             break;
     951             :         }
     952             :     }
     953           0 :     catch( const Exception& )
     954             :     {
     955           0 :         mbAdjustingImageScaleMode = false;
     956           0 :         throw;
     957             :     }
     958         306 : }
     959             : 
     960             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     961          23 : stardiv_Toolkit_UnoControlImageControlModel_get_implementation(
     962             :     css::uno::XComponentContext *context,
     963             :     css::uno::Sequence<css::uno::Any> const &)
     964             : {
     965          23 :     return cppu::acquire(new UnoControlImageControlModel(context));
     966             : }
     967             : 
     968             : 
     969             : //  class UnoImageControlControl
     970             : 
     971          11 : UnoImageControlControl::UnoImageControlControl()
     972             :     :UnoImageControlControl_Base()
     973          11 :     ,maActionListeners( *this )
     974             : {
     975             :     // TODO: Where should I look for defaults?
     976          11 :     maComponentInfos.nWidth = 100;
     977          11 :     maComponentInfos.nHeight = 100;
     978          11 : }
     979             : 
     980          11 : OUString UnoImageControlControl::GetComponentServiceName()
     981             : {
     982          11 :     return OUString("fixedimage");
     983             : }
     984             : 
     985          12 : void UnoImageControlControl::dispose() throw(uno::RuntimeException, std::exception)
     986             : {
     987          12 :     lang::EventObject aEvt;
     988          12 :     aEvt.Source = (::cppu::OWeakObject*)this;
     989          12 :     maActionListeners.disposeAndClear( aEvt );
     990          12 :     UnoControl::dispose();
     991          12 : }
     992             : 
     993           2 : sal_Bool UnoImageControlControl::isTransparent() throw(uno::RuntimeException, std::exception)
     994             : {
     995           2 :     return sal_True;
     996             : }
     997             : 
     998           3 : awt::Size UnoImageControlControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
     999             : {
    1000           3 :     return Impl_getMinimumSize();
    1001             : }
    1002             : 
    1003           3 : awt::Size UnoImageControlControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
    1004             : {
    1005           3 :     return Impl_getPreferredSize();
    1006             : }
    1007             : 
    1008           3 : awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
    1009             : {
    1010           3 :     return Impl_calcAdjustedSize( rNewSize );
    1011             : }
    1012             : 
    1013             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1014          11 : stardiv_Toolkit_UnoImageControlControl_get_implementation(
    1015             :     css::uno::XComponentContext *,
    1016             :     css::uno::Sequence<css::uno::Any> const &)
    1017             : {
    1018          11 :     return cppu::acquire(new UnoImageControlControl());
    1019             : }
    1020             : 
    1021             : 
    1022             : //  class UnoControlRadioButtonModel
    1023             : 
    1024          25 : UnoControlRadioButtonModel::UnoControlRadioButtonModel( const Reference< XComponentContext >& rxContext )
    1025          25 :     :GraphicControlModel( rxContext )
    1026             : {
    1027          25 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXRadioButton );
    1028          25 : }
    1029             : 
    1030           1 : OUString UnoControlRadioButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    1031             : {
    1032           1 :     return OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel );
    1033             : }
    1034             : 
    1035         719 : uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    1036             : {
    1037         719 :     switch ( nPropId )
    1038             :     {
    1039             :     case BASEPROPERTY_DEFAULTCONTROL:
    1040          27 :         return uno::makeAny( OUString::createFromAscii( szServiceName_UnoControlRadioButton ) );
    1041             : 
    1042             :     case BASEPROPERTY_VISUALEFFECT:
    1043          28 :         return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
    1044             :     }
    1045             : 
    1046         664 :     return GraphicControlModel::ImplGetDefaultValue( nPropId );
    1047             : }
    1048             : 
    1049        5557 : ::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper()
    1050             : {
    1051             :     static UnoPropertyArrayHelper* pHelper = NULL;
    1052        5557 :     if ( !pHelper )
    1053             :     {
    1054           5 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    1055           5 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    1056             :     }
    1057        5557 :     return *pHelper;
    1058             : }
    1059             : 
    1060             : // beans::XMultiPropertySet
    1061          62 : uno::Reference< beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    1062             : {
    1063          62 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    1064          62 :     return xInfo;
    1065             : }
    1066             : 
    1067             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1068          24 : stardiv_Toolkit_UnoControlRadioButtonModel_get_implementation(
    1069             :     css::uno::XComponentContext *context,
    1070             :     css::uno::Sequence<css::uno::Any> const &)
    1071             : {
    1072          24 :     return cppu::acquire(new UnoControlRadioButtonModel(context));
    1073             : }
    1074             : 
    1075             : 
    1076             : //  class UnoRadioButtonControl
    1077             : 
    1078          17 : UnoRadioButtonControl::UnoRadioButtonControl()
    1079             :     :UnoRadioButtonControl_Base()
    1080             :     ,maItemListeners( *this )
    1081          17 :     ,maActionListeners( *this )
    1082             : {
    1083          17 :     maComponentInfos.nWidth = 100;
    1084          17 :     maComponentInfos.nHeight = 12;
    1085          17 : }
    1086             : 
    1087          19 : OUString UnoRadioButtonControl::GetComponentServiceName()
    1088             : {
    1089          19 :     return OUString("radiobutton");
    1090             : }
    1091             : 
    1092          16 : void UnoRadioButtonControl::dispose() throw(uno::RuntimeException, std::exception)
    1093             : {
    1094          16 :     lang::EventObject aEvt;
    1095          16 :     aEvt.Source = (::cppu::OWeakObject*)this;
    1096          16 :     maItemListeners.disposeAndClear( aEvt );
    1097          16 :     UnoControlBase::dispose();
    1098          16 : }
    1099             : 
    1100             : 
    1101           2 : sal_Bool UnoRadioButtonControl::isTransparent() throw(uno::RuntimeException, std::exception)
    1102             : {
    1103           2 :     return sal_True;
    1104             : }
    1105             : 
    1106          21 : void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    1107             : {
    1108          21 :     UnoControlBase::createPeer( rxToolkit, rParentPeer );
    1109             : 
    1110          21 :     uno::Reference < awt::XRadioButton >  xRadioButton( getPeer(), uno::UNO_QUERY );
    1111          21 :     xRadioButton->addItemListener( this );
    1112             : 
    1113          42 :     uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
    1114          21 :     xButton->setActionCommand( maActionCommand );
    1115          21 :     if ( maActionListeners.getLength() )
    1116           0 :         xButton->addActionListener( &maActionListeners );
    1117             : 
    1118             :     // as default, set the "AutoToggle" to true
    1119             :     // (it is set to false in VCLXToolkit::ImplCreateWindow because of #87254#, but we want to
    1120             :     // have it enabled by default because of 85071)
    1121          42 :     uno::Reference< awt::XVclWindowPeer >  xVclWindowPeer( getPeer(), uno::UNO_QUERY );
    1122          21 :     if ( xVclWindowPeer.is() )
    1123          42 :         xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), css::uno::Any(true) );
    1124          21 : }
    1125             : 
    1126           3 : void UnoRadioButtonControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    1127             : {
    1128           3 :     maItemListeners.addInterface( l );
    1129           3 : }
    1130             : 
    1131           0 : void UnoRadioButtonControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    1132             : {
    1133           0 :     maItemListeners.removeInterface( l );
    1134           0 : }
    1135             : 
    1136           1 : void UnoRadioButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    1137             : {
    1138           1 :     maActionListeners.addInterface( l );
    1139           1 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    1140             :     {
    1141           1 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
    1142           1 :         xButton->addActionListener( &maActionListeners );
    1143             :     }
    1144           1 : }
    1145             : 
    1146           0 : void UnoRadioButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    1147             : {
    1148           0 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    1149             :     {
    1150           0 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
    1151           0 :         xButton->removeActionListener( &maActionListeners );
    1152             :     }
    1153           0 :     maActionListeners.removeInterface( l );
    1154           0 : }
    1155             : 
    1156           2 : void UnoRadioButtonControl::setLabel( const OUString&  rLabel ) throw(uno::RuntimeException, std::exception)
    1157             : {
    1158           2 :     uno::Any aAny;
    1159           2 :     aAny <<= rLabel;
    1160           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, true );
    1161           2 : }
    1162             : 
    1163           0 : void UnoRadioButtonControl::setActionCommand( const OUString& rCommand ) throw(uno::RuntimeException, std::exception)
    1164             : {
    1165           0 :     maActionCommand = rCommand;
    1166           0 :     if ( getPeer().is() )
    1167             :     {
    1168           0 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
    1169           0 :         xButton->setActionCommand( rCommand );
    1170             :     }
    1171           0 : }
    1172             : 
    1173           2 : void UnoRadioButtonControl::setState( sal_Bool bOn ) throw(uno::RuntimeException, std::exception)
    1174             : {
    1175           2 :     sal_Int16 nState = bOn ? 1 : 0;
    1176           2 :     uno::Any aAny;
    1177           2 :     aAny <<= nState;
    1178           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, true );
    1179           2 : }
    1180             : 
    1181           4 : sal_Bool UnoRadioButtonControl::getState() throw(uno::RuntimeException, std::exception)
    1182             : {
    1183           4 :     sal_Int16 nState = 0;
    1184           4 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
    1185           4 :     aVal >>= nState;
    1186           4 :     return nState ? sal_True : sal_False;
    1187             : }
    1188             : 
    1189           0 : void UnoRadioButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException, std::exception)
    1190             : {
    1191           0 :     uno::Any aAny;
    1192           0 :     aAny <<= (sal_Int16)rEvent.Selected;
    1193           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, false );
    1194             : 
    1195             :     // compatibility:
    1196             :     // in OOo 1.0.x, when the user clicked a radio button in a group of buttons, this resulted
    1197             :     // in _one_ itemStateChanged call for exactly the radio button which's state changed from
    1198             :     // "0" to "1".
    1199             :     // Nowadays, since the listener handling changed a lot towards 1.1 (the VCLXWindow reacts on more
    1200             :     // basic events from the VCL-windows, not anymore on the Link-based events like in 1.0.x), this
    1201             :     // isn't the case anymore: For instance, this method here gets called for the radio button
    1202             :     // which is being implicitily _de_selected, too. This is pretty bad for compatibility.
    1203             :     // Thus, we suppress all events with a new state other than "1". This is unlogical, and weird, when looking
    1204             :     // from a pure API perspective, but it's _compatible_ with older product versions, and this is
    1205             :     // all which matters here.
    1206             :     // #i14703#
    1207           0 :     if ( 1 == rEvent.Selected )
    1208             :     {
    1209           0 :         if ( maItemListeners.getLength() )
    1210           0 :             maItemListeners.itemStateChanged( rEvent );
    1211           0 :     }
    1212             :         // note that speaking stricly, this is wrong: When in 1.0.x, the user would have de-selected
    1213             :         // a radio button _without_ selecing another one, this would have caused a notification.
    1214             :         // With the change done here, this today won't cause a notification anymore.
    1215             : 
    1216             :         // Fortunately, it's not possible for the user to de-select a radio button without selecting another on,
    1217             :         // at least not via the regular UI. It _would_ be possible via the Accessibility API, which
    1218             :         // counts as "user input", too. But in 1.0.x, there was no Accessibility API, so there is nothing
    1219             :         // to be inconsistent with.
    1220           0 : }
    1221             : 
    1222           2 : awt::Size UnoRadioButtonControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
    1223             : {
    1224           2 :     return Impl_getMinimumSize();
    1225             : }
    1226             : 
    1227           2 : awt::Size UnoRadioButtonControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
    1228             : {
    1229           2 :     return Impl_getPreferredSize();
    1230             : }
    1231             : 
    1232           2 : awt::Size UnoRadioButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
    1233             : {
    1234           2 :     return Impl_calcAdjustedSize( rNewSize );
    1235             : }
    1236             : 
    1237             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1238          17 : stardiv_Toolkit_UnoRadioButtonControl_get_implementation(
    1239             :     css::uno::XComponentContext *,
    1240             :     css::uno::Sequence<css::uno::Any> const &)
    1241             : {
    1242          17 :     return cppu::acquire(new UnoRadioButtonControl());
    1243             : }
    1244             : 
    1245             : 
    1246             : //  class UnoControlCheckBoxModel
    1247             : 
    1248          23 : UnoControlCheckBoxModel::UnoControlCheckBoxModel( const Reference< XComponentContext >& rxContext )
    1249          23 :     :GraphicControlModel( rxContext )
    1250             : {
    1251          23 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCheckBox );
    1252          23 : }
    1253             : 
    1254           1 : OUString UnoControlCheckBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    1255             : {
    1256           1 :     return OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel );
    1257             : }
    1258             : 
    1259         666 : uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    1260             : {
    1261         666 :     switch ( nPropId )
    1262             :     {
    1263             :     case BASEPROPERTY_DEFAULTCONTROL:
    1264          25 :         return uno::makeAny( OUString::createFromAscii( szServiceName_UnoControlCheckBox ) );
    1265             : 
    1266             :     case BASEPROPERTY_VISUALEFFECT:
    1267          26 :         return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
    1268             :     }
    1269             : 
    1270         615 :     return GraphicControlModel::ImplGetDefaultValue( nPropId );
    1271             : }
    1272             : 
    1273        5227 : ::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper()
    1274             : {
    1275             :     static UnoPropertyArrayHelper* pHelper = NULL;
    1276        5227 :     if ( !pHelper )
    1277             :     {
    1278           6 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    1279           6 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    1280             :     }
    1281        5227 :     return *pHelper;
    1282             : }
    1283             : 
    1284             : // beans::XMultiPropertySet
    1285          55 : uno::Reference< beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    1286             : {
    1287          55 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    1288          55 :     return xInfo;
    1289             : }
    1290             : 
    1291             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1292          20 : stardiv_Toolkit_UnoControlCheckBoxModel_get_implementation(
    1293             :     css::uno::XComponentContext *context,
    1294             :     css::uno::Sequence<css::uno::Any> const &)
    1295             : {
    1296          20 :     return cppu::acquire(new UnoControlCheckBoxModel(context));
    1297             : }
    1298             : 
    1299             : 
    1300             : //  class UnoCheckBoxControl
    1301             : 
    1302          18 : UnoCheckBoxControl::UnoCheckBoxControl()
    1303             :     :UnoCheckBoxControl_Base()
    1304          18 :     ,maItemListeners( *this ), maActionListeners( *this )
    1305             : {
    1306          18 :     maComponentInfos.nWidth = 100;
    1307          18 :     maComponentInfos.nHeight = 12;
    1308          18 : }
    1309             : 
    1310          19 : OUString UnoCheckBoxControl::GetComponentServiceName()
    1311             : {
    1312          19 :     return OUString("checkbox");
    1313             : }
    1314             : 
    1315          17 : void UnoCheckBoxControl::dispose() throw(uno::RuntimeException, std::exception)
    1316             : {
    1317          17 :     lang::EventObject aEvt;
    1318          17 :     aEvt.Source = (::cppu::OWeakObject*)this;
    1319          17 :     maItemListeners.disposeAndClear( aEvt );
    1320          17 :     UnoControlBase::dispose();
    1321          17 : }
    1322             : 
    1323           2 : sal_Bool UnoCheckBoxControl::isTransparent() throw(uno::RuntimeException, std::exception)
    1324             : {
    1325           2 :     return sal_True;
    1326             : }
    1327             : 
    1328          21 : void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    1329             : {
    1330          21 :     UnoControlBase::createPeer( rxToolkit, rParentPeer );
    1331             : 
    1332          21 :     uno::Reference < awt::XCheckBox >  xCheckBox( getPeer(), uno::UNO_QUERY );
    1333          21 :     xCheckBox->addItemListener( this );
    1334             : 
    1335          42 :     uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
    1336          21 :     xButton->setActionCommand( maActionCommand );
    1337          21 :     if ( maActionListeners.getLength() )
    1338          21 :         xButton->addActionListener( &maActionListeners );
    1339          21 : }
    1340             : 
    1341           5 : void UnoCheckBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    1342             : {
    1343           5 :     maItemListeners.addInterface( l );
    1344           5 : }
    1345             : 
    1346           2 : void UnoCheckBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    1347             : {
    1348           2 :     maItemListeners.removeInterface( l );
    1349           2 : }
    1350             : 
    1351           1 : void UnoCheckBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    1352             : {
    1353           1 :     maActionListeners.addInterface( l );
    1354           1 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    1355             :     {
    1356           1 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
    1357           1 :         xButton->addActionListener( &maActionListeners );
    1358             :     }
    1359           1 : }
    1360             : 
    1361           0 : void UnoCheckBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    1362             : {
    1363           0 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    1364             :     {
    1365           0 :         uno::Reference < awt::XButton >  xButton( getPeer(), uno::UNO_QUERY );
    1366           0 :         xButton->removeActionListener( &maActionListeners );
    1367             :     }
    1368           0 :     maActionListeners.removeInterface( l );
    1369           0 : }
    1370             : 
    1371           0 : void UnoCheckBoxControl::setActionCommand( const OUString& rCommand ) throw(uno::RuntimeException, std::exception)
    1372             : {
    1373           0 :     maActionCommand = rCommand;
    1374           0 :     if ( getPeer().is() )
    1375             :     {
    1376           0 :         uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
    1377           0 :         xButton->setActionCommand( rCommand );
    1378             :     }
    1379           0 : }
    1380             : 
    1381             : 
    1382           2 : void UnoCheckBoxControl::setLabel( const OUString&  rLabel ) throw(uno::RuntimeException, std::exception)
    1383             : {
    1384           2 :     uno::Any aAny;
    1385           2 :     aAny <<= rLabel;
    1386           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, true );
    1387           2 : }
    1388             : 
    1389           2 : void UnoCheckBoxControl::setState( short n ) throw(uno::RuntimeException, std::exception)
    1390             : {
    1391           2 :     uno::Any aAny;
    1392           2 :     aAny <<= (sal_Int16)n;
    1393           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, true );
    1394           2 : }
    1395             : 
    1396           4 : short UnoCheckBoxControl::getState() throw(uno::RuntimeException, std::exception)
    1397             : {
    1398           4 :     short nState = 0;
    1399           4 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
    1400           4 :     aVal >>= nState;
    1401           4 :     return nState;
    1402             : }
    1403             : 
    1404           2 : void UnoCheckBoxControl::enableTriState( sal_Bool b ) throw(uno::RuntimeException, std::exception)
    1405             : {
    1406           2 :     uno::Any aAny;
    1407           2 :     aAny <<= b;
    1408           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), aAny, true );
    1409           2 : }
    1410             : 
    1411           0 : void UnoCheckBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException, std::exception)
    1412             : {
    1413           0 :     uno::Any aAny;
    1414           0 :     aAny <<= (sal_Int16)rEvent.Selected;
    1415           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, false );
    1416             : 
    1417           0 :     if ( maItemListeners.getLength() )
    1418           0 :         maItemListeners.itemStateChanged( rEvent );
    1419           0 : }
    1420             : 
    1421           2 : awt::Size UnoCheckBoxControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
    1422             : {
    1423           2 :     return Impl_getMinimumSize();
    1424             : }
    1425             : 
    1426           2 : awt::Size UnoCheckBoxControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
    1427             : {
    1428           2 :     return Impl_getPreferredSize();
    1429             : }
    1430             : 
    1431           2 : awt::Size UnoCheckBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
    1432             : {
    1433           2 :     return Impl_calcAdjustedSize( rNewSize );
    1434             : }
    1435             : 
    1436             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1437          18 : stardiv_Toolkit_UnoCheckBoxControl_get_implementation(
    1438             :     css::uno::XComponentContext *,
    1439             :     css::uno::Sequence<css::uno::Any> const &)
    1440             : {
    1441          18 :     return cppu::acquire(new UnoCheckBoxControl());
    1442             : }
    1443             : 
    1444             : 
    1445             : //  class UnoControlFixedHyperlinkModel
    1446             : 
    1447           0 : UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel( const Reference< XComponentContext >& rxContext )
    1448           0 :     :UnoControlModel( rxContext )
    1449             : {
    1450           0 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedHyperlink );
    1451           0 : }
    1452             : 
    1453           0 : OUString UnoControlFixedHyperlinkModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    1454             : {
    1455           0 :     return OUString::createFromAscii( szServiceName_UnoControlFixedHyperlinkModel );
    1456             : }
    1457             : 
    1458           0 : uno::Any UnoControlFixedHyperlinkModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    1459             : {
    1460           0 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    1461             :     {
    1462           0 :         uno::Any aAny;
    1463           0 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlFixedHyperlink );
    1464           0 :         return aAny;
    1465             :     }
    1466           0 :     else if ( nPropId == BASEPROPERTY_BORDER )
    1467             :     {
    1468           0 :         uno::Any aAny;
    1469           0 :         aAny <<= (sal_Int16)0;
    1470           0 :         return aAny;
    1471             :     }
    1472           0 :     else if ( nPropId == BASEPROPERTY_URL )
    1473             :     {
    1474           0 :         uno::Any aAny;
    1475           0 :         aAny <<= OUString();
    1476           0 :         return aAny;
    1477             :     }
    1478             : 
    1479           0 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    1480             : }
    1481             : 
    1482           0 : ::cppu::IPropertyArrayHelper& UnoControlFixedHyperlinkModel::getInfoHelper()
    1483             : {
    1484             :     static UnoPropertyArrayHelper* pHelper = NULL;
    1485           0 :     if ( !pHelper )
    1486             :     {
    1487           0 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    1488           0 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    1489             :     }
    1490           0 :     return *pHelper;
    1491             : }
    1492             : 
    1493             : // beans::XMultiPropertySet
    1494           0 : uno::Reference< beans::XPropertySetInfo > UnoControlFixedHyperlinkModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    1495             : {
    1496           0 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    1497           0 :     return xInfo;
    1498             : }
    1499             : 
    1500             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1501           0 : stardiv_Toolkit_UnoControlFixedHyperlinkModel_get_implementation(
    1502             :     css::uno::XComponentContext *context,
    1503             :     css::uno::Sequence<css::uno::Any> const &)
    1504             : {
    1505           0 :     return cppu::acquire(new UnoControlFixedHyperlinkModel(context));
    1506             : }
    1507             : 
    1508             : 
    1509             : //  class UnoFixedHyperlinkControl
    1510             : 
    1511           0 : UnoFixedHyperlinkControl::UnoFixedHyperlinkControl()
    1512             :     :UnoControlBase()
    1513           0 :     ,maActionListeners( *this )
    1514             : {
    1515           0 :     maComponentInfos.nWidth = 100;
    1516           0 :     maComponentInfos.nHeight = 12;
    1517           0 : }
    1518             : 
    1519           0 : OUString UnoFixedHyperlinkControl::GetComponentServiceName()
    1520             : {
    1521           0 :     return OUString("fixedhyperlink");
    1522             : }
    1523             : 
    1524             : // uno::XInterface
    1525           0 : uno::Any UnoFixedHyperlinkControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    1526             : {
    1527             :     uno::Any aRet = ::cppu::queryInterface( rType,
    1528             :                                         (static_cast< awt::XFixedHyperlink* >(this)),
    1529           0 :                                         (static_cast< awt::XLayoutConstrains* >(this)) );
    1530           0 :     return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
    1531             : }
    1532             : 
    1533             : // lang::XTypeProvider
    1534           0 : IMPL_XTYPEPROVIDER_START( UnoFixedHyperlinkControl )
    1535           0 :     getCppuType( ( uno::Reference< awt::XFixedHyperlink>* ) NULL ),
    1536           0 :     getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
    1537             :     UnoControlBase::getTypes()
    1538           0 : IMPL_XTYPEPROVIDER_END
    1539             : 
    1540           0 : sal_Bool UnoFixedHyperlinkControl::isTransparent() throw(uno::RuntimeException, std::exception)
    1541             : {
    1542           0 :     return sal_True;
    1543             : }
    1544             : 
    1545           0 : void UnoFixedHyperlinkControl::setText( const OUString& Text ) throw(uno::RuntimeException, std::exception)
    1546             : {
    1547           0 :     uno::Any aAny;
    1548           0 :     aAny <<= Text;
    1549           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, true );
    1550           0 : }
    1551             : 
    1552           0 : OUString UnoFixedHyperlinkControl::getText() throw(uno::RuntimeException, std::exception)
    1553             : {
    1554           0 :     return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
    1555             : }
    1556             : 
    1557           0 : void UnoFixedHyperlinkControl::setURL( const OUString& URL ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1558             : {
    1559           0 :     uno::Any aAny;
    1560           0 :     aAny <<= URL;
    1561           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_URL ), aAny, true );
    1562           0 : }
    1563             : 
    1564           0 : OUString UnoFixedHyperlinkControl::getURL(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    1565             : {
    1566           0 :     return ImplGetPropertyValue_UString( BASEPROPERTY_URL );
    1567             : }
    1568             : 
    1569           0 : void UnoFixedHyperlinkControl::setAlignment( short nAlign ) throw(uno::RuntimeException, std::exception)
    1570             : {
    1571           0 :     uno::Any aAny;
    1572           0 :     aAny <<= (sal_Int16)nAlign;
    1573           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, true );
    1574           0 : }
    1575             : 
    1576           0 : short UnoFixedHyperlinkControl::getAlignment() throw(uno::RuntimeException, std::exception)
    1577             : {
    1578           0 :     short nAlign = 0;
    1579           0 :     if ( mxModel.is() )
    1580             :     {
    1581           0 :         uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
    1582           0 :         aVal >>= nAlign;
    1583             :     }
    1584           0 :     return nAlign;
    1585             : }
    1586             : 
    1587           0 : awt::Size UnoFixedHyperlinkControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
    1588             : {
    1589           0 :     return Impl_getMinimumSize();
    1590             : }
    1591             : 
    1592           0 : awt::Size UnoFixedHyperlinkControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
    1593             : {
    1594           0 :     return Impl_getPreferredSize();
    1595             : }
    1596             : 
    1597           0 : awt::Size UnoFixedHyperlinkControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
    1598             : {
    1599           0 :     return Impl_calcAdjustedSize( rNewSize );
    1600             : }
    1601             : 
    1602           0 : void UnoFixedHyperlinkControl::dispose() throw(uno::RuntimeException, std::exception)
    1603             : {
    1604           0 :     lang::EventObject aEvt;
    1605           0 :     aEvt.Source = (::cppu::OWeakObject*)this;
    1606           0 :     maActionListeners.disposeAndClear( aEvt );
    1607           0 :     UnoControlBase::dispose();
    1608           0 : }
    1609             : 
    1610           0 : void UnoFixedHyperlinkControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    1611             : {
    1612           0 :     UnoControlBase::createPeer( rxToolkit, rParentPeer );
    1613             : 
    1614           0 :     uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
    1615           0 :     if ( maActionListeners.getLength() )
    1616           0 :         xFixedHyperlink->addActionListener( &maActionListeners );
    1617           0 : }
    1618             : 
    1619           0 : void UnoFixedHyperlinkControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    1620             : {
    1621           0 :     maActionListeners.addInterface( l );
    1622           0 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    1623             :     {
    1624           0 :         uno::Reference < awt::XFixedHyperlink >  xFixedHyperlink( getPeer(), uno::UNO_QUERY );
    1625           0 :         xFixedHyperlink->addActionListener( &maActionListeners );
    1626             :     }
    1627           0 : }
    1628             : 
    1629           0 : void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    1630             : {
    1631           0 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    1632             :     {
    1633           0 :         uno::Reference < awt::XFixedHyperlink >  xFixedHyperlink( getPeer(), uno::UNO_QUERY );
    1634           0 :         xFixedHyperlink->removeActionListener( &maActionListeners );
    1635             :     }
    1636           0 :     maActionListeners.removeInterface( l );
    1637           0 : }
    1638             : 
    1639             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1640           0 : stardiv_Toolkit_UnoFixedHyperlinkControl_get_implementation(
    1641             :     css::uno::XComponentContext *,
    1642             :     css::uno::Sequence<css::uno::Any> const &)
    1643             : {
    1644           0 :     return cppu::acquire(new UnoFixedHyperlinkControl());
    1645             : }
    1646             : 
    1647             : 
    1648             : //  class UnoControlFixedTextModel
    1649             : 
    1650          79 : UnoControlFixedTextModel::UnoControlFixedTextModel( const Reference< XComponentContext >& rxContext )
    1651          79 :     :UnoControlModel( rxContext )
    1652             : {
    1653          79 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText );
    1654          79 : }
    1655             : 
    1656           1 : OUString UnoControlFixedTextModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    1657             : {
    1658           1 :     return OUString::createFromAscii( szServiceName_UnoControlFixedTextModel );
    1659             : }
    1660             : 
    1661        1863 : uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    1662             : {
    1663        1863 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    1664             :     {
    1665          81 :         uno::Any aAny;
    1666          81 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlFixedText );
    1667          81 :         return aAny;
    1668             :     }
    1669        1782 :     else if ( nPropId == BASEPROPERTY_BORDER )
    1670             :     {
    1671          81 :         uno::Any aAny;
    1672          81 :         aAny <<= (sal_Int16)0;
    1673          81 :         return aAny;
    1674             :     }
    1675             : 
    1676        1701 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    1677             : }
    1678             : 
    1679        3870 : ::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper()
    1680             : {
    1681             :     static UnoPropertyArrayHelper* pHelper = NULL;
    1682        3870 :     if ( !pHelper )
    1683             :     {
    1684           3 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    1685           3 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    1686             :     }
    1687        3870 :     return *pHelper;
    1688             : }
    1689             : 
    1690             : // beans::XMultiPropertySet
    1691          96 : uno::Reference< beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    1692             : {
    1693          96 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    1694          96 :     return xInfo;
    1695             : }
    1696             : 
    1697             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1698          79 : stardiv_Toolkit_UnoControlFixedTextModel_get_implementation(
    1699             :     css::uno::XComponentContext *context,
    1700             :     css::uno::Sequence<css::uno::Any> const &)
    1701             : {
    1702          79 :     return cppu::acquire(new UnoControlFixedTextModel(context));
    1703             : }
    1704             : 
    1705             : 
    1706             : //  class UnoFixedTextControl
    1707             : 
    1708          12 : UnoFixedTextControl::UnoFixedTextControl()
    1709          12 :     :UnoControlBase()
    1710             : {
    1711          12 :     maComponentInfos.nWidth = 100;
    1712          12 :     maComponentInfos.nHeight = 12;
    1713          12 : }
    1714             : 
    1715           2 : OUString UnoFixedTextControl::GetComponentServiceName()
    1716             : {
    1717           2 :     return OUString("fixedtext");
    1718             : }
    1719             : 
    1720             : // uno::XInterface
    1721          86 : uno::Any UnoFixedTextControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    1722             : {
    1723             :     uno::Any aRet = ::cppu::queryInterface( rType,
    1724             :                                         (static_cast< awt::XFixedText* >(this)),
    1725          86 :                                         (static_cast< awt::XLayoutConstrains* >(this)) );
    1726          86 :     return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
    1727             : }
    1728             : 
    1729             : // lang::XTypeProvider
    1730           0 : IMPL_XTYPEPROVIDER_START( UnoFixedTextControl )
    1731           0 :     getCppuType( ( uno::Reference< awt::XFixedText>* ) NULL ),
    1732           0 :     getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
    1733             :     UnoControlBase::getTypes()
    1734           0 : IMPL_XTYPEPROVIDER_END
    1735             : 
    1736           1 : sal_Bool UnoFixedTextControl::isTransparent() throw(uno::RuntimeException, std::exception)
    1737             : {
    1738           1 :     return sal_True;
    1739             : }
    1740             : 
    1741           2 : void UnoFixedTextControl::setText( const OUString& Text ) throw(uno::RuntimeException, std::exception)
    1742             : {
    1743           2 :     uno::Any aAny;
    1744           2 :     aAny <<= Text;
    1745           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, true );
    1746           2 : }
    1747             : 
    1748           2 : OUString UnoFixedTextControl::getText() throw(uno::RuntimeException, std::exception)
    1749             : {
    1750           2 :     return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
    1751             : }
    1752             : 
    1753           1 : void UnoFixedTextControl::setAlignment( short nAlign ) throw(uno::RuntimeException, std::exception)
    1754             : {
    1755           1 :     uno::Any aAny;
    1756           1 :     aAny <<= (sal_Int16)nAlign;
    1757           1 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, true );
    1758           1 : }
    1759             : 
    1760           2 : short UnoFixedTextControl::getAlignment() throw(uno::RuntimeException, std::exception)
    1761             : {
    1762           2 :     short nAlign = 0;
    1763           2 :     if ( mxModel.is() )
    1764             :     {
    1765           2 :         uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
    1766           2 :         aVal >>= nAlign;
    1767             :     }
    1768           2 :     return nAlign;
    1769             : }
    1770             : 
    1771           1 : awt::Size UnoFixedTextControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
    1772             : {
    1773           1 :     return Impl_getMinimumSize();
    1774             : }
    1775             : 
    1776           1 : awt::Size UnoFixedTextControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
    1777             : {
    1778           1 :     return Impl_getPreferredSize();
    1779             : }
    1780             : 
    1781           1 : awt::Size UnoFixedTextControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
    1782             : {
    1783           1 :     return Impl_calcAdjustedSize( rNewSize );
    1784             : }
    1785             : 
    1786             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1787          12 : stardiv_Toolkit_UnoFixedTextControl_get_implementation(
    1788             :     css::uno::XComponentContext *,
    1789             :     css::uno::Sequence<css::uno::Any> const &)
    1790             : {
    1791          12 :     return cppu::acquire(new UnoFixedTextControl());
    1792             : }
    1793             : 
    1794             : 
    1795             : //  class UnoControlGroupBoxModel
    1796             : 
    1797          19 : UnoControlGroupBoxModel::UnoControlGroupBoxModel( const Reference< XComponentContext >& rxContext )
    1798          19 :     :UnoControlModel( rxContext )
    1799             : {
    1800          19 :     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
    1801          19 :     ImplRegisterProperty( BASEPROPERTY_ENABLED );
    1802          19 :     ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
    1803          19 :     ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
    1804          19 :     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
    1805          19 :     ImplRegisterProperty( BASEPROPERTY_HELPURL );
    1806          19 :     ImplRegisterProperty( BASEPROPERTY_LABEL );
    1807          19 :     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
    1808          19 :     ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
    1809          19 :     ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
    1810          19 : }
    1811             : 
    1812           1 : OUString UnoControlGroupBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    1813             : {
    1814           1 :     return OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel );
    1815             : }
    1816             : 
    1817         296 : uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    1818             : {
    1819         296 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    1820             :     {
    1821          21 :         uno::Any aAny;
    1822          21 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlGroupBox );
    1823          21 :         return aAny;
    1824             :     }
    1825         275 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    1826             : }
    1827             : 
    1828        3335 : ::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper()
    1829             : {
    1830             :     static UnoPropertyArrayHelper* pHelper = NULL;
    1831        3335 :     if ( !pHelper )
    1832             :     {
    1833           5 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    1834           5 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    1835             :     }
    1836        3335 :     return *pHelper;
    1837             : }
    1838             : 
    1839             : // beans::XMultiPropertySet
    1840          48 : uno::Reference< beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    1841             : {
    1842          48 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    1843          48 :     return xInfo;
    1844             : }
    1845             : 
    1846             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1847          18 : stardiv_Toolkit_UnoControlGroupBoxModel_get_implementation(
    1848             :     css::uno::XComponentContext *context,
    1849             :     css::uno::Sequence<css::uno::Any> const &)
    1850             : {
    1851          18 :     return cppu::acquire(new UnoControlGroupBoxModel(context));
    1852             : }
    1853             : 
    1854             : 
    1855             : //  class UnoGroupBoxControl
    1856             : 
    1857          13 : UnoGroupBoxControl::UnoGroupBoxControl()
    1858          13 :     :UnoControlBase()
    1859             : {
    1860          13 :     maComponentInfos.nWidth = 100;
    1861          13 :     maComponentInfos.nHeight = 100;
    1862          13 : }
    1863             : 
    1864          13 : OUString UnoGroupBoxControl::GetComponentServiceName()
    1865             : {
    1866          13 :     return OUString("groupbox");
    1867             : }
    1868             : 
    1869           2 : sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException, std::exception)
    1870             : {
    1871           2 :     return sal_True;
    1872             : }
    1873             : 
    1874             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    1875          13 : stardiv_Toolkit_UnoGroupBoxControl_get_implementation(
    1876             :     css::uno::XComponentContext *,
    1877             :     css::uno::Sequence<css::uno::Any> const &)
    1878             : {
    1879          13 :     return cppu::acquire(new UnoGroupBoxControl());
    1880             : }
    1881             : 
    1882             : 
    1883             : // = UnoControlListBoxModel_Data
    1884             : 
    1885         612 : struct ListItem
    1886             : {
    1887             :     OUString ItemText;
    1888             :     OUString ItemImageURL;
    1889             :     Any             ItemData;
    1890             : 
    1891         124 :     ListItem()
    1892             :         :ItemText()
    1893             :         ,ItemImageURL()
    1894         124 :         ,ItemData()
    1895             :     {
    1896         124 :     }
    1897             : 
    1898         124 :     ListItem( const OUString& i_rItemText )
    1899             :         :ItemText( i_rItemText )
    1900             :         ,ItemImageURL()
    1901         124 :         ,ItemData()
    1902             :     {
    1903         124 :     }
    1904             : };
    1905             : 
    1906             : typedef beans::Pair< OUString, OUString > UnoListItem;
    1907             : 
    1908             : struct StripItemData : public ::std::unary_function< ListItem, UnoListItem >
    1909             : {
    1910         112 :     UnoListItem operator()( const ListItem& i_rItem )
    1911             :     {
    1912         112 :         return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL );
    1913             :     }
    1914             : };
    1915             : 
    1916          33 : struct UnoControlListBoxModel_Data
    1917             : {
    1918          39 :     UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl )
    1919             :         :m_bSettingLegacyProperty( false )
    1920             :         ,m_rAntiImpl( i_rAntiImpl )
    1921          39 :         ,m_aListItems()
    1922             :     {
    1923          39 :     }
    1924             : 
    1925           0 :     sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); }
    1926             : 
    1927           0 :     const ListItem& getItem( const sal_Int32 i_nIndex ) const
    1928             :     {
    1929           0 :         if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
    1930           0 :             throw IndexOutOfBoundsException( OUString(), m_rAntiImpl );
    1931           0 :         return m_aListItems[ i_nIndex ];
    1932             :     }
    1933             : 
    1934           0 :     ListItem& getItem( const sal_Int32 i_nIndex )
    1935             :     {
    1936           0 :         return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) );
    1937             :     }
    1938             : 
    1939           0 :     ListItem& insertItem( const sal_Int32 i_nIndex )
    1940             :     {
    1941           0 :         if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) )
    1942           0 :             throw IndexOutOfBoundsException( OUString(), m_rAntiImpl );
    1943           0 :         return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() );
    1944             :     }
    1945             : 
    1946          79 :     Sequence< UnoListItem > getAllItems() const
    1947             :     {
    1948          79 :         Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) );
    1949          79 :         ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() );
    1950          79 :         return aItems;
    1951             :     }
    1952             : 
    1953           4 :     void copyItems( const UnoControlListBoxModel_Data& i_copySource )
    1954             :     {
    1955           4 :         m_aListItems = i_copySource.m_aListItems;
    1956           4 :     }
    1957             : 
    1958          57 :     void    setAllItems( const ::std::vector< ListItem >& i_rItems )
    1959             :     {
    1960          57 :         m_aListItems = i_rItems;
    1961          57 :     }
    1962             : 
    1963           0 :     void    removeItem( const sal_Int32 i_nIndex )
    1964             :     {
    1965           0 :         if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
    1966           0 :             throw IndexOutOfBoundsException( OUString(), m_rAntiImpl );
    1967           0 :         m_aListItems.erase( m_aListItems.begin() + i_nIndex );
    1968           0 :     }
    1969             : 
    1970           0 :     void removeAllItems()
    1971             :     {
    1972           0 :         ::std::vector< ListItem > aEmpty;
    1973           0 :         m_aListItems.swap( aEmpty );
    1974           0 :     }
    1975             : 
    1976             : public:
    1977             :     bool                        m_bSettingLegacyProperty;
    1978             : 
    1979             : private:
    1980             :     UnoControlListBoxModel&     m_rAntiImpl;
    1981             :     ::std::vector< ListItem >   m_aListItems;
    1982             : };
    1983             : 
    1984             : 
    1985             : // = UnoControlListBoxModel
    1986             : 
    1987             : 
    1988          35 : UnoControlListBoxModel::UnoControlListBoxModel( const Reference< XComponentContext >& rxContext, ConstructorMode const i_mode )
    1989             :     :UnoControlListBoxModel_Base( rxContext )
    1990          35 :     ,m_pData( new UnoControlListBoxModel_Data( *this ) )
    1991          70 :     ,m_aItemListListeners( GetMutex() )
    1992             : {
    1993          35 :     if ( i_mode == ConstructDefault )
    1994             :     {
    1995          14 :         UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
    1996             :     }
    1997          35 : }
    1998             : 
    1999           4 : UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
    2000             :     :UnoControlListBoxModel_Base( i_rSource )
    2001           4 :     ,m_pData( new UnoControlListBoxModel_Data( *this ) )
    2002           8 :     ,m_aItemListListeners( GetMutex() )
    2003             : {
    2004           4 :     m_pData->copyItems( *i_rSource.m_pData );
    2005           4 : }
    2006          46 : UnoControlListBoxModel::~UnoControlListBoxModel()
    2007             : {
    2008          46 : }
    2009          96 : IMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
    2010             : 
    2011           1 : OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    2012             : {
    2013           1 :     return OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
    2014             : }
    2015             : 
    2016             : 
    2017         464 : uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    2018             : {
    2019         464 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    2020             :     {
    2021          16 :         uno::Any aAny;
    2022          16 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlListBox );
    2023          16 :         return aAny;
    2024             :     }
    2025         448 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    2026             : }
    2027             : 
    2028             : 
    2029        6080 : ::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
    2030             : {
    2031             :     static UnoPropertyArrayHelper* pHelper = NULL;
    2032        6080 :     if ( !pHelper )
    2033             :     {
    2034           4 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    2035           4 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    2036             :     }
    2037        6080 :     return *pHelper;
    2038             : }
    2039             : 
    2040             : 
    2041             : // beans::XMultiPropertySet
    2042          75 : uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    2043             : {
    2044          75 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    2045          75 :     return xInfo;
    2046             : }
    2047             : 
    2048             : 
    2049             : namespace
    2050             : {
    2051             :     struct CreateListItem : public ::std::unary_function< OUString, ListItem >
    2052             :     {
    2053         124 :         ListItem operator()( const OUString& i_rItemText )
    2054             :         {
    2055         124 :             return ListItem( i_rItemText );
    2056             :         }
    2057             :     };
    2058             : }
    2059             : 
    2060             : 
    2061         581 : void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception, std::exception)
    2062             : {
    2063         581 :     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
    2064             : 
    2065         581 :     if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
    2066             :     {
    2067             :         // reset selection
    2068          26 :         uno::Sequence<sal_Int16> aSeq;
    2069          52 :         uno::Any aAny;
    2070          26 :         aAny <<= aSeq;
    2071          26 :         setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, aAny );
    2072             : 
    2073          26 :         if ( !m_pData->m_bSettingLegacyProperty )
    2074             :         {
    2075             :             // synchronize the legacy StringItemList property with our list items
    2076          26 :             Sequence< OUString > aStringItemList;
    2077          52 :             Any aPropValue;
    2078          26 :             getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
    2079          26 :             OSL_VERIFY( aPropValue >>= aStringItemList );
    2080             : 
    2081          52 :             ::std::vector< ListItem > aItems( aStringItemList.getLength() );
    2082             :             ::std::transform(
    2083             :                 aStringItemList.getConstArray(),
    2084          26 :                 aStringItemList.getConstArray() + aStringItemList.getLength(),
    2085             :                 aItems.begin(),
    2086             :                 CreateListItem()
    2087          52 :             );
    2088          26 :             m_pData->setAllItems( aItems );
    2089             : 
    2090             :             // since an XItemListListener does not have a "all items modified" or some such method,
    2091             :             // we simulate this by notifying removal of all items, followed by insertion of all new
    2092             :             // items
    2093          52 :             lang::EventObject aEvent;
    2094          26 :             aEvent.Source = *this;
    2095          52 :             m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
    2096             :             // TODO: OPropertySetHelper calls into this method with the mutex locked ...
    2097             :             // which is wrong for the above notifications ...
    2098          26 :         }
    2099             :     }
    2100         581 : }
    2101             : 
    2102             : 
    2103         180 : void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
    2104             :     uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
    2105             : {
    2106             :     // dependencies we know:
    2107             :     // BASEPROPERTY_STRINGITEMLIST->BASEPROPERTY_SELECTEDITEMS
    2108         180 :     ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_STRINGITEMLIST, BASEPROPERTY_SELECTEDITEMS );
    2109             : 
    2110         180 :     UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
    2111         180 : }
    2112             : 
    2113             : 
    2114           0 : ::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException, std::exception)
    2115             : {
    2116           0 :     ::osl::MutexGuard aGuard( GetMutex() );
    2117           0 :     return m_pData->getItemCount();
    2118             : }
    2119             : 
    2120             : 
    2121           0 : void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const OUString& i_rItemText, const OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2122             : {
    2123           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2124             :     // SYNCHRONIZED ----->
    2125           0 :     ListItem& rItem( m_pData->insertItem( i_nPosition ) );
    2126           0 :     rItem.ItemText = i_rItemText;
    2127           0 :     rItem.ItemImageURL = i_rItemImageURL;
    2128             : 
    2129           0 :     impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
    2130             :     // <----- SYNCHRONIZED
    2131           0 : }
    2132             : 
    2133             : 
    2134           0 : void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2135             : {
    2136           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2137             :     // SYNCHRONIZED ----->
    2138           0 :     ListItem& rItem( m_pData->insertItem( i_nPosition ) );
    2139           0 :     rItem.ItemText = i_rItemText;
    2140             : 
    2141           0 :     impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< OUString >(), aGuard );
    2142             :     // <----- SYNCHRONIZED
    2143           0 : }
    2144             : 
    2145             : 
    2146           0 : void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2147             : {
    2148           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2149             :     // SYNCHRONIZED ----->
    2150           0 :     ListItem& rItem( m_pData->insertItem( i_nPosition ) );
    2151           0 :     rItem.ItemImageURL = i_rItemImageURL;
    2152             : 
    2153           0 :     impl_handleInsert( i_nPosition, ::boost::optional< OUString >(), i_rItemImageURL, aGuard );
    2154             :     // <----- SYNCHRONIZED
    2155           0 : }
    2156             : 
    2157             : 
    2158           0 : void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2159             : {
    2160           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2161             :     // SYNCHRONIZED ----->
    2162           0 :     m_pData->removeItem( i_nPosition );
    2163             : 
    2164           0 :     impl_handleRemove( i_nPosition, aGuard );
    2165             :     // <----- SYNCHRONIZED
    2166           0 : }
    2167             : 
    2168             : 
    2169           0 : void SAL_CALL UnoControlListBoxModel::removeAllItems(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    2170             : {
    2171           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2172             :     // SYNCHRONIZED ----->
    2173           0 :     m_pData->removeAllItems();
    2174             : 
    2175           0 :     impl_handleRemove( -1, aGuard );
    2176             :     // <----- SYNCHRONIZED
    2177           0 : }
    2178             : 
    2179             : 
    2180           0 : void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2181             : {
    2182           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2183             :     // SYNCHRONIZED ----->
    2184           0 :     ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2185           0 :     rItem.ItemText = i_rItemText;
    2186             : 
    2187           0 :     impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< OUString >(), aGuard );
    2188             :     // <----- SYNCHRONIZED
    2189           0 : }
    2190             : 
    2191             : 
    2192           0 : void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2193             : {
    2194           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2195             :     // SYNCHRONIZED ----->
    2196           0 :     ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2197           0 :     rItem.ItemImageURL = i_rItemImageURL;
    2198             : 
    2199           0 :     impl_handleModify( i_nPosition, ::boost::optional< OUString >(), i_rItemImageURL, aGuard );
    2200             :     // <----- SYNCHRONIZED
    2201           0 : }
    2202             : 
    2203             : 
    2204           0 : void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const OUString& i_rItemText, const OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2205             : {
    2206           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2207             :     // SYNCHRONIZED ----->
    2208           0 :     ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2209           0 :     rItem.ItemText = i_rItemText;
    2210           0 :     rItem.ItemImageURL = i_rItemImageURL;
    2211             : 
    2212           0 :     impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
    2213             :     // <----- SYNCHRONIZED
    2214           0 : }
    2215             : 
    2216             : 
    2217           0 : void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2218             : {
    2219           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2220           0 :     ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2221           0 :     rItem.ItemData = i_rDataValue;
    2222           0 : }
    2223             : 
    2224             : 
    2225           0 : OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2226             : {
    2227           0 :     ::osl::MutexGuard aGuard( GetMutex() );
    2228           0 :     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2229           0 :     return rItem.ItemText;
    2230             : }
    2231             : 
    2232             : 
    2233           0 : OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2234             : {
    2235           0 :     ::osl::MutexGuard aGuard( GetMutex() );
    2236           0 :     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2237           0 :     return rItem.ItemImageURL;
    2238             : }
    2239             : 
    2240             : 
    2241           0 : beans::Pair< OUString, OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2242             : {
    2243           0 :     ::osl::MutexGuard aGuard( GetMutex() );
    2244           0 :     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2245           0 :     return beans::Pair< OUString, OUString >( rItem.ItemText, rItem.ItemImageURL );
    2246             : }
    2247             : 
    2248             : 
    2249           0 : Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
    2250             : {
    2251           0 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    2252           0 :     const ListItem& rItem( m_pData->getItem( i_nPosition ) );
    2253           0 :     return rItem.ItemData;
    2254             : }
    2255             : 
    2256             : 
    2257          79 : Sequence< beans::Pair< OUString, OUString > > SAL_CALL UnoControlListBoxModel::getAllItems(  ) throw (RuntimeException, std::exception)
    2258             : {
    2259          79 :     ::osl::MutexGuard aGuard( GetMutex() );
    2260          79 :     return m_pData->getAllItems();
    2261             : }
    2262             : 
    2263             : 
    2264          21 : void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException, std::exception)
    2265             : {
    2266          21 :     if ( i_Listener.is() )
    2267          21 :         m_aItemListListeners.addInterface( i_Listener );
    2268          21 : }
    2269             : 
    2270             : 
    2271           4 : void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException, std::exception)
    2272             : {
    2273           4 :     if ( i_Listener.is() )
    2274           4 :         m_aItemListListeners.removeInterface( i_Listener );
    2275           4 : }
    2276             : 
    2277             : 
    2278           0 : void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< OUString >& o_rStringItems ) const
    2279             : {
    2280           0 :     Sequence< OUString > aStringItemList;
    2281           0 :     Any aPropValue;
    2282           0 :     getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
    2283           0 :     OSL_VERIFY( aPropValue >>= aStringItemList );
    2284             : 
    2285           0 :     o_rStringItems.resize( size_t( aStringItemList.getLength() ) );
    2286             :     ::std::copy(
    2287             :         aStringItemList.getConstArray(),
    2288           0 :         aStringItemList.getConstArray() + aStringItemList.getLength(),
    2289             :         o_rStringItems.begin()
    2290           0 :     );
    2291           0 : }
    2292             : 
    2293             : 
    2294           0 : void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< OUString >& i_rStringItems )
    2295             : {
    2296           0 :     Sequence< OUString > aStringItems( i_rStringItems.size() );
    2297             :     ::std::copy(
    2298             :         i_rStringItems.begin(),
    2299             :         i_rStringItems.end(),
    2300             :         aStringItems.getArray()
    2301           0 :     );
    2302           0 :     m_pData->m_bSettingLegacyProperty = true;
    2303             :     try
    2304             :     {
    2305           0 :         setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) );
    2306             :     }
    2307           0 :     catch( const Exception& )
    2308             :     {
    2309           0 :         m_pData->m_bSettingLegacyProperty = false;
    2310           0 :         throw;
    2311             :     }
    2312           0 :     m_pData->m_bSettingLegacyProperty = false;
    2313           0 : }
    2314             : 
    2315             : 
    2316           0 : void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< OUString >& i_rItemText,
    2317             :         const ::boost::optional< OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
    2318             : {
    2319             :     // SYNCHRONIZED ----->
    2320             :     // sync with legacy StringItemList property
    2321           0 :     ::std::vector< OUString > aStringItems;
    2322           0 :     impl_getStringItemList( aStringItems );
    2323             :     OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" );
    2324           0 :     if ( size_t( i_nItemPosition ) <= aStringItems.size() )
    2325             :     {
    2326           0 :         const OUString sItemText( !!i_rItemText ? *i_rItemText : OUString() );
    2327           0 :         aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText );
    2328             :     }
    2329             : 
    2330           0 :     i_rClearBeforeNotify.clear();
    2331             :     // <----- SYNCHRONIZED
    2332           0 :     impl_setStringItemList_nolck( aStringItems );
    2333             : 
    2334             :     // notify ItemListListeners
    2335           0 :     impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted );
    2336           0 : }
    2337             : 
    2338             : 
    2339           0 : void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
    2340             : {
    2341             :     // SYNCHRONIZED ----->
    2342           0 :     const bool bAllItems = ( i_nItemPosition < 0 );
    2343             :     // sync with legacy StringItemList property
    2344           0 :     ::std::vector< OUString > aStringItems;
    2345           0 :     impl_getStringItemList( aStringItems );
    2346           0 :     if ( !bAllItems )
    2347             :     {
    2348             :         OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" );
    2349           0 :         if ( size_t( i_nItemPosition ) < aStringItems.size() )
    2350             :         {
    2351           0 :             aStringItems.erase( aStringItems.begin() + i_nItemPosition );
    2352             :         }
    2353             :     }
    2354             :     else
    2355             :     {
    2356           0 :         aStringItems.resize(0);
    2357             :     }
    2358             : 
    2359           0 :     i_rClearBeforeNotify.clear();
    2360             :     // <----- SYNCHRONIZED
    2361           0 :     impl_setStringItemList_nolck( aStringItems );
    2362             : 
    2363             :     // notify ItemListListeners
    2364           0 :     if ( bAllItems )
    2365             :     {
    2366           0 :         EventObject aEvent( *this );
    2367           0 :         m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent );
    2368             :     }
    2369             :     else
    2370             :     {
    2371             :         impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< OUString >(), ::boost::optional< OUString >(),
    2372           0 :             &XItemListListener::listItemRemoved );
    2373           0 :     }
    2374           0 : }
    2375             : 
    2376             : 
    2377           0 : void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< OUString >& i_rItemText,
    2378             :         const ::boost::optional< OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
    2379             : {
    2380             :     // SYNCHRONIZED ----->
    2381           0 :     if ( !!i_rItemText )
    2382             :     {
    2383             :         // sync with legacy StringItemList property
    2384           0 :         ::std::vector< OUString > aStringItems;
    2385           0 :         impl_getStringItemList( aStringItems );
    2386             :         OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" );
    2387           0 :         if ( size_t( i_nItemPosition ) < aStringItems.size() )
    2388             :         {
    2389           0 :             aStringItems[ i_nItemPosition] = *i_rItemText;
    2390             :         }
    2391             : 
    2392           0 :         i_rClearBeforeNotify.clear();
    2393             :         // <----- SYNCHRONIZED
    2394           0 :         impl_setStringItemList_nolck( aStringItems );
    2395             :     }
    2396             :     else
    2397             :     {
    2398           0 :         i_rClearBeforeNotify.clear();
    2399             :         // <----- SYNCHRONIZED
    2400             :     }
    2401             : 
    2402             :     // notify ItemListListeners
    2403           0 :     impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified );
    2404           0 : }
    2405             : 
    2406             : 
    2407           0 : void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< OUString >& i_rItemText,
    2408             :     const ::boost::optional< OUString >& i_rItemImageURL,
    2409             :     void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) )
    2410             : {
    2411           0 :     ItemListEvent aEvent;
    2412           0 :     aEvent.Source = *this;
    2413           0 :     aEvent.ItemPosition = i_nItemPosition;
    2414           0 :     if ( !!i_rItemText )
    2415             :     {
    2416           0 :         aEvent.ItemText.IsPresent = sal_True;
    2417           0 :         aEvent.ItemText.Value = *i_rItemText;
    2418             :     }
    2419           0 :     if ( !!i_rItemImageURL )
    2420             :     {
    2421           0 :         aEvent.ItemImageURL.IsPresent = sal_True;
    2422           0 :         aEvent.ItemImageURL.Value = *i_rItemImageURL;
    2423             :     }
    2424             : 
    2425           0 :     m_aItemListListeners.notifyEach( NotificationMethod, aEvent );
    2426           0 : }
    2427             : 
    2428             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    2429          13 : stardiv_Toolkit_UnoControlListBoxModel_get_implementation(
    2430             :     css::uno::XComponentContext *context,
    2431             :     css::uno::Sequence<css::uno::Any> const &)
    2432             : {
    2433          13 :     return cppu::acquire(new UnoControlListBoxModel(context));
    2434             : }
    2435             : 
    2436             : 
    2437             : //  class UnoListBoxControl
    2438             : 
    2439          18 : UnoListBoxControl::UnoListBoxControl()
    2440             :     :UnoListBoxControl_Base()
    2441             :     ,maActionListeners( *this )
    2442          18 :     ,maItemListeners( *this )
    2443             : {
    2444          18 :     maComponentInfos.nWidth = 100;
    2445          18 :     maComponentInfos.nHeight = 12;
    2446          18 : }
    2447             : 
    2448          20 : OUString UnoListBoxControl::GetComponentServiceName()
    2449             : {
    2450          20 :     return OUString("listbox");
    2451             : }
    2452           0 : IMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
    2453             : 
    2454           7 : void UnoListBoxControl::dispose() throw(uno::RuntimeException, std::exception)
    2455             : {
    2456           7 :     lang::EventObject aEvt;
    2457           7 :     aEvt.Source = (::cppu::OWeakObject*)this;
    2458           7 :     maActionListeners.disposeAndClear( aEvt );
    2459           7 :     maItemListeners.disposeAndClear( aEvt );
    2460           7 :     UnoControl::dispose();
    2461           7 : }
    2462             : 
    2463           0 : void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
    2464             : {
    2465           0 :     if ( getPeer().is() )
    2466             :     {
    2467           0 :         uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
    2468             :         DBG_ASSERT( xListBox.is(), "XListBox?" );
    2469             : 
    2470           0 :         uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos();
    2471           0 :         uno::Any aAny;
    2472           0 :         aAny <<= aSeq;
    2473           0 :         ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny, false );
    2474             :     }
    2475           0 : }
    2476             : 
    2477          20 : void UnoListBoxControl::updateFromModel()
    2478             : {
    2479          20 :     UnoControlBase::updateFromModel();
    2480             : 
    2481          20 :     Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
    2482          40 :     ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
    2483             : 
    2484          40 :     EventObject aEvent( getModel() );
    2485          20 :     xItemListListener->itemListChanged( aEvent );
    2486             : 
    2487             :     // notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
    2488             :     // already did this, our peer(s) can only legitimately set the selection after they have the string
    2489             :     // item list, which we just notified with the itemListChanged call.
    2490          40 :     const OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
    2491          40 :     ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
    2492             : }
    2493             : 
    2494        1801 : void UnoListBoxControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal )
    2495             : {
    2496        1801 :     if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
    2497             :         // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
    2498             :         // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
    2499             :         // will be forwarded to the peer, which will update itself accordingly.
    2500        1859 :         return;
    2501             : 
    2502        1743 :     UnoControl::ImplSetPeerProperty( rPropName, rVal );
    2503             : }
    2504             : 
    2505          20 : void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    2506             : {
    2507          20 :     UnoControl::createPeer( rxToolkit, rParentPeer );
    2508             : 
    2509          20 :     uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2510          20 :     xListBox->addItemListener( this );
    2511             : 
    2512          20 :     if ( maActionListeners.getLength() )
    2513           0 :         xListBox->addActionListener( &maActionListeners );
    2514          20 : }
    2515             : 
    2516           1 : void UnoListBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    2517             : {
    2518           1 :     maActionListeners.addInterface( l );
    2519           1 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    2520             :     {
    2521           1 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2522           1 :         xListBox->addActionListener( &maActionListeners );
    2523             :     }
    2524           1 : }
    2525             : 
    2526           0 : void UnoListBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    2527             : {
    2528           0 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    2529             :     {
    2530           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2531           0 :         xListBox->removeActionListener( &maActionListeners );
    2532             :     }
    2533           0 :     maActionListeners.removeInterface( l );
    2534           0 : }
    2535             : 
    2536          18 : void UnoListBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    2537             : {
    2538          18 :     maItemListeners.addInterface( l );
    2539          18 : }
    2540             : 
    2541           0 : void UnoListBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    2542             : {
    2543           0 :     maItemListeners.removeInterface( l );
    2544           0 : }
    2545             : 
    2546           0 : void UnoListBoxControl::addItem( const OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException, std::exception)
    2547             : {
    2548           0 :     uno::Sequence< OUString> aSeq( 1 );
    2549           0 :     aSeq.getArray()[0] = aItem;
    2550           0 :     addItems( aSeq, nPos );
    2551           0 : }
    2552             : 
    2553           0 : void UnoListBoxControl::addItems( const uno::Sequence< OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException, std::exception)
    2554             : {
    2555           0 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    2556           0 :     uno::Sequence< OUString> aSeq;
    2557           0 :     aVal >>= aSeq;
    2558           0 :     sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
    2559           0 :     sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
    2560           0 :     sal_uInt16 nNewLen = nOldLen + nNewItems;
    2561             : 
    2562           0 :     uno::Sequence< OUString> aNewSeq( nNewLen );
    2563           0 :     OUString* pNewData = aNewSeq.getArray();
    2564           0 :     OUString* pOldData = aSeq.getArray();
    2565             : 
    2566           0 :     if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
    2567           0 :         nPos = (sal_uInt16) nOldLen;
    2568             : 
    2569             :     sal_uInt16 n;
    2570             :     // Items vor der Einfuege-Position
    2571           0 :     for ( n = 0; n < nPos; n++ )
    2572           0 :         pNewData[n] = pOldData[n];
    2573             : 
    2574             :     // Neue Items
    2575           0 :     for ( n = 0; n < nNewItems; n++ )
    2576           0 :         pNewData[nPos+n] = aItems.getConstArray()[n];
    2577             : 
    2578             :     // Rest der alten Items
    2579           0 :     for ( n = nPos; n < nOldLen; n++ )
    2580           0 :         pNewData[nNewItems+n] = pOldData[n];
    2581             : 
    2582           0 :     uno::Any aAny;
    2583           0 :     aAny <<= aNewSeq;
    2584           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, true );
    2585           0 : }
    2586             : 
    2587           0 : void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException, std::exception)
    2588             : {
    2589           0 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    2590           0 :     uno::Sequence< OUString> aSeq;
    2591           0 :     aVal >>= aSeq;
    2592           0 :     sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
    2593           0 :     if ( nOldLen && ( nPos < nOldLen ) )
    2594             :     {
    2595           0 :         if ( nCount > ( nOldLen-nPos ) )
    2596           0 :             nCount = nOldLen-nPos;
    2597             : 
    2598           0 :         sal_uInt16 nNewLen = nOldLen - nCount;
    2599             : 
    2600           0 :         uno::Sequence< OUString> aNewSeq( nNewLen );
    2601           0 :         OUString* pNewData = aNewSeq.getArray();
    2602           0 :         OUString* pOldData = aSeq.getArray();
    2603             : 
    2604             :         sal_uInt16 n;
    2605             :         // Items vor der Entfern-Position
    2606           0 :         for ( n = 0; n < nPos; n++ )
    2607           0 :             pNewData[n] = pOldData[n];
    2608             : 
    2609             :         // Rest der Items
    2610           0 :         for ( n = nPos; n < (nOldLen-nCount); n++ )
    2611           0 :             pNewData[n] = pOldData[n+nCount];
    2612             : 
    2613           0 :         uno::Any aAny;
    2614           0 :         aAny <<= aNewSeq;
    2615           0 :         ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, true );
    2616           0 :     }
    2617           0 : }
    2618             : 
    2619           0 : sal_Int16 UnoListBoxControl::getItemCount() throw(uno::RuntimeException, std::exception)
    2620             : {
    2621           0 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    2622           0 :     uno::Sequence< OUString> aSeq;
    2623           0 :     aVal >>= aSeq;
    2624           0 :     return (sal_Int16)aSeq.getLength();
    2625             : }
    2626             : 
    2627           0 : OUString UnoListBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException, std::exception)
    2628             : {
    2629           0 :     OUString aItem;
    2630           0 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    2631           0 :     uno::Sequence< OUString> aSeq;
    2632           0 :     aVal >>= aSeq;
    2633           0 :     if ( nPos < aSeq.getLength() )
    2634           0 :         aItem = aSeq.getConstArray()[nPos];
    2635           0 :     return aItem;
    2636             : }
    2637             : 
    2638           0 : uno::Sequence< OUString> UnoListBoxControl::getItems() throw(uno::RuntimeException, std::exception)
    2639             : {
    2640           0 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    2641           0 :     uno::Sequence< OUString> aSeq;
    2642           0 :     aVal >>= aSeq;
    2643           0 :     return aSeq;
    2644             : }
    2645             : 
    2646           0 : sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(uno::RuntimeException, std::exception)
    2647             : {
    2648           0 :     sal_Int16 n = -1;
    2649           0 :     if ( getPeer().is() )
    2650             :     {
    2651           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2652           0 :         n = xListBox->getSelectedItemPos();
    2653             :     }
    2654           0 :     return n;
    2655             : }
    2656             : 
    2657           0 : uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::RuntimeException, std::exception)
    2658             : {
    2659           0 :     uno::Sequence<sal_Int16> aSeq;
    2660           0 :     if ( getPeer().is() )
    2661             :     {
    2662           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2663           0 :         aSeq = xListBox->getSelectedItemsPos();
    2664             :     }
    2665           0 :     return aSeq;
    2666             : }
    2667             : 
    2668           0 : OUString UnoListBoxControl::getSelectedItem() throw(uno::RuntimeException, std::exception)
    2669             : {
    2670           0 :     OUString aItem;
    2671           0 :     if ( getPeer().is() )
    2672             :     {
    2673           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2674           0 :         aItem = xListBox->getSelectedItem();
    2675             :     }
    2676           0 :     return aItem;
    2677             : }
    2678             : 
    2679           0 : uno::Sequence< OUString> UnoListBoxControl::getSelectedItems() throw(uno::RuntimeException, std::exception)
    2680             : {
    2681           0 :     uno::Sequence< OUString> aSeq;
    2682           0 :     if ( getPeer().is() )
    2683             :     {
    2684           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2685           0 :         aSeq = xListBox->getSelectedItems();
    2686             :     }
    2687           0 :     return aSeq;
    2688             : }
    2689             : 
    2690           0 : void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(uno::RuntimeException, std::exception)
    2691             : {
    2692           0 :     if ( getPeer().is() )
    2693             :     {
    2694           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2695           0 :         xListBox->selectItemPos( nPos, bSelect );
    2696             :     }
    2697           0 :     ImplUpdateSelectedItemsProperty();
    2698           0 : }
    2699             : 
    2700           0 : void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(uno::RuntimeException, std::exception)
    2701             : {
    2702           0 :     if ( getPeer().is() )
    2703             :     {
    2704           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2705           0 :         xListBox->selectItemsPos( aPositions, bSelect );
    2706             :     }
    2707           0 :     ImplUpdateSelectedItemsProperty();
    2708           0 : }
    2709             : 
    2710           0 : void UnoListBoxControl::selectItem( const OUString& aItem, sal_Bool bSelect ) throw(uno::RuntimeException, std::exception)
    2711             : {
    2712           0 :     if ( getPeer().is() )
    2713             :     {
    2714           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2715           0 :         xListBox->selectItem( aItem, bSelect );
    2716             :     }
    2717           0 :     ImplUpdateSelectedItemsProperty();
    2718           0 : }
    2719             : 
    2720           0 : void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(uno::RuntimeException, std::exception)
    2721             : {
    2722           0 :     if ( getPeer().is() )
    2723             :     {
    2724           0 :         uno::Reference < awt::XListBox >  xListBox( getPeer(), uno::UNO_QUERY );
    2725           0 :         xListBox->makeVisible( nEntry );
    2726             :     }
    2727           0 : }
    2728             : 
    2729           0 : void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException, std::exception)
    2730             : {
    2731           0 :     uno::Any aAny;
    2732           0 :     aAny <<= (sal_Int16)nLines;
    2733           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, true );
    2734           0 : }
    2735             : 
    2736           0 : sal_Int16 UnoListBoxControl::getDropDownLineCount() throw(uno::RuntimeException, std::exception)
    2737             : {
    2738           0 :     return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
    2739             : }
    2740             : 
    2741           0 : sal_Bool UnoListBoxControl::isMutipleMode() throw(uno::RuntimeException, std::exception)
    2742             : {
    2743           0 :     return ImplGetPropertyValue_BOOL( BASEPROPERTY_MULTISELECTION );
    2744             : }
    2745             : 
    2746           0 : void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) throw(uno::RuntimeException, std::exception)
    2747             : {
    2748           0 :     uno::Any aAny;
    2749           0 :     aAny <<= bMulti;
    2750           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), aAny, true );
    2751           0 : }
    2752             : 
    2753           0 : void UnoListBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException, std::exception)
    2754             : {
    2755           0 :     ImplUpdateSelectedItemsProperty();
    2756           0 :     if ( maItemListeners.getLength() )
    2757             :     {
    2758             :         try
    2759             :         {
    2760           0 :             maItemListeners.itemStateChanged( rEvent );
    2761             :         }
    2762           0 :         catch( const Exception& e )
    2763             :         {
    2764             : #if OSL_DEBUG_LEVEL == 0
    2765             :             (void) e; // suppress warning
    2766             : #else
    2767             :             OString sMessage( "UnoListBoxControl::itemStateChanged: caught an exception:\n" );
    2768             :             sMessage += OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
    2769             :             OSL_FAIL( sMessage.getStr() );
    2770             : #endif
    2771             :         }
    2772             :     }
    2773           0 : }
    2774             : 
    2775           0 : awt::Size UnoListBoxControl::getMinimumSize(  ) throw(uno::RuntimeException, std::exception)
    2776             : {
    2777           0 :     return Impl_getMinimumSize();
    2778             : }
    2779             : 
    2780           0 : awt::Size UnoListBoxControl::getPreferredSize(  ) throw(uno::RuntimeException, std::exception)
    2781             : {
    2782           0 :     return Impl_getPreferredSize();
    2783             : }
    2784             : 
    2785           0 : awt::Size UnoListBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException, std::exception)
    2786             : {
    2787           0 :     return Impl_calcAdjustedSize( rNewSize );
    2788             : }
    2789             : 
    2790           0 : awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException, std::exception)
    2791             : {
    2792           0 :     return Impl_getMinimumSize( nCols, nLines );
    2793             : }
    2794             : 
    2795           0 : void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException, std::exception)
    2796             : {
    2797           0 :     Impl_getColumnsAndLines( nCols, nLines );
    2798           0 : }
    2799             : 
    2800          14 : sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException, std::exception )
    2801             : {
    2802          14 :     ::osl::MutexGuard aGuard( GetMutex() );
    2803             : 
    2804          28 :     const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
    2805             :     OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" );
    2806          28 :     const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
    2807             :     OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" );
    2808             : 
    2809          14 :     if ( !UnoListBoxControl_Base::setModel( i_rModel ) )
    2810           7 :         return sal_False;
    2811             : 
    2812           7 :     if ( xOldItems.is() )
    2813           0 :         xOldItems->removeItemListListener( this );
    2814           7 :     if ( xNewItems.is() )
    2815           7 :         xNewItems->addItemListListener( this );
    2816             : 
    2817          21 :     return sal_True;
    2818             : }
    2819             : 
    2820           0 : void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException, std::exception)
    2821             : {
    2822           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    2823             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" );
    2824           0 :     if ( xPeerListener.is() )
    2825           0 :         xPeerListener->listItemInserted( i_rEvent );
    2826           0 : }
    2827             : 
    2828           0 : void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException, std::exception)
    2829             : {
    2830           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    2831             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" );
    2832           0 :     if ( xPeerListener.is() )
    2833           0 :         xPeerListener->listItemRemoved( i_rEvent );
    2834           0 : }
    2835             : 
    2836           0 : void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException, std::exception)
    2837             : {
    2838           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    2839             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" );
    2840           0 :     if ( xPeerListener.is() )
    2841           0 :         xPeerListener->listItemModified( i_rEvent );
    2842           0 : }
    2843             : 
    2844           0 : void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException, std::exception)
    2845             : {
    2846           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    2847             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" );
    2848           0 :     if ( xPeerListener.is() )
    2849           0 :         xPeerListener->allItemsRemoved( i_rEvent );
    2850           0 : }
    2851             : 
    2852          19 : void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException, std::exception)
    2853             : {
    2854          19 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    2855             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" );
    2856          19 :     if ( xPeerListener.is() )
    2857          19 :         xPeerListener->itemListChanged( i_rEvent );
    2858          19 : }
    2859             : 
    2860             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    2861          18 : stardiv_Toolkit_UnoListBoxControl_get_implementation(
    2862             :     css::uno::XComponentContext *,
    2863             :     css::uno::Sequence<css::uno::Any> const &)
    2864             : {
    2865          18 :     return cppu::acquire(new UnoListBoxControl());
    2866             : }
    2867             : 
    2868             : 
    2869             : //  class UnoControlComboBoxModel
    2870             : 
    2871          21 : UnoControlComboBoxModel::UnoControlComboBoxModel( const Reference< XComponentContext >& rxContext )
    2872          21 :     :UnoControlListBoxModel( rxContext, ConstructWithoutProperties )
    2873             : {
    2874          21 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox );
    2875          21 : }
    2876             : 
    2877          26 : IMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel )
    2878             : 
    2879          93 : uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    2880             : {
    2881          93 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    2882          93 :     return xInfo;
    2883             : }
    2884             : 
    2885        6249 : ::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper()
    2886             : {
    2887             :     static UnoPropertyArrayHelper* pHelper = NULL;
    2888        6249 :     if ( !pHelper )
    2889             :     {
    2890           7 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    2891           7 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    2892             :     }
    2893        6249 :     return *pHelper;
    2894             : }
    2895             : 
    2896             : 
    2897           1 : OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    2898             : {
    2899           1 :     return OUString::createFromAscii( szServiceName_UnoControlComboBoxModel );
    2900             : }
    2901         635 : void SAL_CALL UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception, std::exception)
    2902             : {
    2903         635 :     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
    2904             : 
    2905         635 :     if ( nHandle == BASEPROPERTY_STRINGITEMLIST && !m_pData->m_bSettingLegacyProperty)
    2906             :     {
    2907             :         // synchronize the legacy StringItemList property with our list items
    2908          31 :         Sequence< OUString > aStringItemList;
    2909          62 :         Any aPropValue;
    2910          31 :         getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
    2911          31 :         OSL_VERIFY( aPropValue >>= aStringItemList );
    2912             : 
    2913          62 :         ::std::vector< ListItem > aItems( aStringItemList.getLength() );
    2914             :         ::std::transform(
    2915             :             aStringItemList.getConstArray(),
    2916          31 :             aStringItemList.getConstArray() + aStringItemList.getLength(),
    2917             :             aItems.begin(),
    2918             :             CreateListItem()
    2919          62 :         );
    2920          31 :         m_pData->setAllItems( aItems );
    2921             : 
    2922             :         // since an XItemListListener does not have a "all items modified" or some such method,
    2923             :         // we simulate this by notifying removal of all items, followed by insertion of all new
    2924             :         // items
    2925          62 :         lang::EventObject aEvent;
    2926          31 :         aEvent.Source = *this;
    2927          62 :         m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
    2928             :         // TODO: OPropertySetHelper calls into this method with the mutex locked ...
    2929             :         // which is wrong for the above notifications ...
    2930             :     }
    2931         635 : }
    2932             : 
    2933         663 : uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    2934             : {
    2935         663 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    2936             :     {
    2937          23 :         uno::Any aAny;
    2938          23 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlComboBox );
    2939          23 :         return aAny;
    2940             :     }
    2941         640 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    2942             : }
    2943             : 
    2944             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    2945          20 : stardiv_Toolkit_UnoControlComboBoxModel_get_implementation(
    2946             :     css::uno::XComponentContext *context,
    2947             :     css::uno::Sequence<css::uno::Any> const &)
    2948             : {
    2949          20 :     return cppu::acquire(new UnoControlComboBoxModel(context));
    2950             : }
    2951             : 
    2952             : 
    2953             : //  class UnoComboBoxControl
    2954             : 
    2955          17 : UnoComboBoxControl::UnoComboBoxControl()
    2956             :     :UnoEditControl()
    2957             :     ,maActionListeners( *this )
    2958          17 :     ,maItemListeners( *this )
    2959             : {
    2960          17 :     maComponentInfos.nWidth = 100;
    2961          17 :     maComponentInfos.nHeight = 12;
    2962          17 : }
    2963           1 : IMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox )
    2964             : 
    2965          23 : OUString UnoComboBoxControl::GetComponentServiceName()
    2966             : {
    2967          23 :     return OUString("combobox");
    2968             : }
    2969             : 
    2970          16 : void UnoComboBoxControl::dispose() throw(uno::RuntimeException, std::exception)
    2971             : {
    2972          16 :     lang::EventObject aEvt;
    2973          16 :     aEvt.Source = (::cppu::OWeakObject*)this;
    2974          16 :     maActionListeners.disposeAndClear( aEvt );
    2975          16 :     maItemListeners.disposeAndClear( aEvt );
    2976          16 :     UnoControl::dispose();
    2977          16 : }
    2978         799 : uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    2979             : {
    2980             :     uno::Any aRet = ::cppu::queryInterface( rType,
    2981         799 :                                         (static_cast< awt::XComboBox* >(this)) );
    2982         799 :     if ( !aRet.hasValue() )
    2983             :     {
    2984        1590 :         aRet = ::cppu::queryInterface( rType,
    2985         795 :                                         (static_cast< awt::XItemListener* >(this)) );
    2986         795 :         if ( !aRet.hasValue() )
    2987             :         {
    2988        1590 :             aRet = ::cppu::queryInterface( rType,
    2989         795 :                                             (static_cast< awt::XItemListListener* >(this)) );
    2990             :         }
    2991             :     }
    2992         799 :     return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
    2993             : }
    2994             : // lang::XTypeProvider
    2995          25 : IMPL_XTYPEPROVIDER_START( UnoComboBoxControl )
    2996           1 :     getCppuType( ( uno::Reference< awt::XComboBox>* ) NULL ),
    2997           1 :     getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
    2998           1 :     getCppuType( ( uno::Reference< awt::XItemListListener>* ) NULL ),
    2999             :     UnoEditControl::getTypes()
    3000           2 : IMPL_XTYPEPROVIDER_END
    3001             : 
    3002          23 : void UnoComboBoxControl::updateFromModel()
    3003             : {
    3004          23 :     UnoEditControl::updateFromModel();
    3005             : 
    3006          23 :     Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
    3007          46 :     ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoComboBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
    3008             : 
    3009          46 :     EventObject aEvent( getModel() );
    3010          46 :     xItemListListener->itemListChanged( aEvent );
    3011             : }
    3012        1901 : void UnoComboBoxControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal )
    3013             : {
    3014        1901 :     if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
    3015             :         // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
    3016             :         // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
    3017             :         // will be forwarded to the peer, which will update itself accordingly.
    3018        1958 :         return;
    3019             : 
    3020        1844 :     UnoEditControl::ImplSetPeerProperty( rPropName, rVal );
    3021             : }
    3022          25 : void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    3023             : {
    3024          25 :     UnoEditControl::createPeer( rxToolkit, rParentPeer );
    3025             : 
    3026          25 :     uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
    3027          25 :     if ( maActionListeners.getLength() )
    3028           0 :         xComboBox->addActionListener( &maActionListeners );
    3029          25 :     if ( maItemListeners.getLength() )
    3030           0 :         xComboBox->addItemListener( &maItemListeners );
    3031          25 : }
    3032             : 
    3033           3 : void UnoComboBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    3034             : {
    3035           3 :     maActionListeners.addInterface( l );
    3036           3 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    3037             :     {
    3038           3 :         uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
    3039           3 :         xComboBox->addActionListener( &maActionListeners );
    3040             :     }
    3041           3 : }
    3042             : 
    3043           0 : void UnoComboBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException, std::exception)
    3044             : {
    3045           0 :     if( getPeer().is() && maActionListeners.getLength() == 1 )
    3046             :     {
    3047           0 :         uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
    3048           0 :         xComboBox->removeActionListener( &maActionListeners );
    3049             :     }
    3050           0 :     maActionListeners.removeInterface( l );
    3051           0 : }
    3052             : 
    3053           3 : void UnoComboBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    3054             : {
    3055           3 :     maItemListeners.addInterface( l );
    3056           3 :     if( getPeer().is() && maItemListeners.getLength() == 1 )
    3057             :     {
    3058           3 :         uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
    3059           3 :         xComboBox->addItemListener( &maItemListeners );
    3060             :     }
    3061           3 : }
    3062             : 
    3063           0 : void UnoComboBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException, std::exception)
    3064             : {
    3065           0 :     if( getPeer().is() && maItemListeners.getLength() == 1 )
    3066             :     {
    3067             :         // This call is prettier than creating a Ref and calling query
    3068           0 :         uno::Reference < awt::XComboBox >  xComboBox( getPeer(), uno::UNO_QUERY );
    3069           0 :         xComboBox->removeItemListener( &maItemListeners );
    3070             :     }
    3071           0 :     maItemListeners.removeInterface( l );
    3072           0 : }
    3073           0 : void UnoComboBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException, std::exception)
    3074             : {
    3075           0 :     if ( maItemListeners.getLength() )
    3076             :     {
    3077             :         try
    3078             :         {
    3079           0 :             maItemListeners.itemStateChanged( rEvent );
    3080             :         }
    3081           0 :         catch( const Exception& e )
    3082             :         {
    3083             : #if OSL_DEBUG_LEVEL == 0
    3084             :             (void) e; // suppress warning
    3085             : #else
    3086             :             OString sMessage( "UnoComboBoxControl::itemStateChanged: caught an exception:\n" );
    3087             :             sMessage += OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
    3088             :             OSL_FAIL( sMessage.getStr() );
    3089             : #endif
    3090             :         }
    3091             :     }
    3092           0 : }
    3093          30 : sal_Bool SAL_CALL UnoComboBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException, std::exception )
    3094             : {
    3095          30 :     ::osl::MutexGuard aGuard( GetMutex() );
    3096             : 
    3097          60 :     const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
    3098             :     OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoComboBoxControl::setModel: illegal old model!" );
    3099          60 :     const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
    3100             :     OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoComboBoxControl::setModel: illegal new model!" );
    3101             : 
    3102          30 :     if ( !UnoEditControl::setModel( i_rModel ) )
    3103          16 :         return sal_False;
    3104             : 
    3105          14 :     if ( xOldItems.is() )
    3106           4 :         xOldItems->removeItemListListener( this );
    3107          14 :     if ( xNewItems.is() )
    3108          14 :         xNewItems->addItemListListener( this );
    3109             : 
    3110          44 :     return sal_True;
    3111             : }
    3112             : 
    3113           0 : void SAL_CALL UnoComboBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException, std::exception)
    3114             : {
    3115           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    3116             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemInserted: invalid peer!" );
    3117           0 :     if ( xPeerListener.is() )
    3118           0 :         xPeerListener->listItemInserted( i_rEvent );
    3119           0 : }
    3120             : 
    3121           0 : void SAL_CALL UnoComboBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException, std::exception)
    3122             : {
    3123           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    3124             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemRemoved: invalid peer!" );
    3125           0 :     if ( xPeerListener.is() )
    3126           0 :         xPeerListener->listItemRemoved( i_rEvent );
    3127           0 : }
    3128             : 
    3129           0 : void SAL_CALL UnoComboBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException, std::exception)
    3130             : {
    3131           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    3132             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemModified: invalid peer!" );
    3133           0 :     if ( xPeerListener.is() )
    3134           0 :         xPeerListener->listItemModified( i_rEvent );
    3135           0 : }
    3136             : 
    3137           0 : void SAL_CALL UnoComboBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException, std::exception)
    3138             : {
    3139           0 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    3140             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::allItemsRemoved: invalid peer!" );
    3141           0 :     if ( xPeerListener.is() )
    3142           0 :         xPeerListener->allItemsRemoved( i_rEvent );
    3143           0 : }
    3144             : 
    3145          17 : void SAL_CALL UnoComboBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException, std::exception)
    3146             : {
    3147          17 :     const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
    3148             :     OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::itemListChanged: invalid peer!" );
    3149          17 :     if ( xPeerListener.is() )
    3150          17 :         xPeerListener->itemListChanged( i_rEvent );
    3151          17 : }
    3152             : 
    3153           2 : void UnoComboBoxControl::addItem( const OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException, std::exception)
    3154             : {
    3155           2 :     uno::Sequence< OUString> aSeq( 1 );
    3156           2 :     aSeq.getArray()[0] = aItem;
    3157           2 :     addItems( aSeq, nPos );
    3158           2 : }
    3159             : 
    3160           4 : void UnoComboBoxControl::addItems( const uno::Sequence< OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException, std::exception)
    3161             : {
    3162           4 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    3163           8 :     uno::Sequence< OUString> aSeq;
    3164           4 :     aVal >>= aSeq;
    3165           4 :     sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
    3166           4 :     sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
    3167           4 :     sal_uInt16 nNewLen = nOldLen + nNewItems;
    3168             : 
    3169           8 :     uno::Sequence< OUString> aNewSeq( nNewLen );
    3170           4 :     OUString* pNewData = aNewSeq.getArray();
    3171           4 :     const OUString* pOldData = aSeq.getConstArray();
    3172             : 
    3173           4 :     if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
    3174           0 :         nPos = (sal_uInt16) nOldLen;
    3175             : 
    3176             :     sal_uInt16 n;
    3177             :     // items before the insert position
    3178           6 :     for ( n = 0; n < nPos; n++ )
    3179           2 :         pNewData[n] = pOldData[n];
    3180             : 
    3181             :     // New items
    3182          10 :     for ( n = 0; n < nNewItems; n++ )
    3183           6 :         pNewData[nPos+n] = aItems.getConstArray()[n];
    3184             : 
    3185             :     // remainder of old items
    3186           4 :     for ( n = nPos; n < nOldLen; n++ )
    3187           0 :         pNewData[nNewItems+n] = pOldData[n];
    3188             : 
    3189           8 :     uno::Any aAny;
    3190           4 :     aAny <<= aNewSeq;
    3191           8 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, true );
    3192           4 : }
    3193             : 
    3194           2 : void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException, std::exception)
    3195             : {
    3196           2 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    3197           4 :     uno::Sequence< OUString> aSeq;
    3198           2 :     aVal >>= aSeq;
    3199           2 :     sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
    3200           2 :     if ( nOldLen && ( nPos < nOldLen ) )
    3201             :     {
    3202           2 :         if ( nCount > ( nOldLen-nPos ) )
    3203           0 :             nCount = nOldLen-nPos;
    3204             : 
    3205           2 :         sal_uInt16 nNewLen = nOldLen - nCount;
    3206             : 
    3207           2 :         uno::Sequence< OUString> aNewSeq( nNewLen );
    3208           2 :         OUString* pNewData = aNewSeq.getArray();
    3209           2 :         OUString* pOldData = aSeq.getArray();
    3210             : 
    3211             :         sal_uInt16 n;
    3212             :         // items before the deletion position
    3213           2 :         for ( n = 0; n < nPos; n++ )
    3214           0 :             pNewData[n] = pOldData[n];
    3215             : 
    3216             :         // remainder of old items
    3217           2 :         for ( n = nPos; n < (nOldLen-nCount); n++ )
    3218           0 :             pNewData[n] = pOldData[n+nCount];
    3219             : 
    3220           4 :         uno::Any aAny;
    3221           2 :         aAny <<= aNewSeq;
    3222           4 :         ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, true );
    3223           2 :     }
    3224           2 : }
    3225             : 
    3226          12 : sal_Int16 UnoComboBoxControl::getItemCount() throw(uno::RuntimeException, std::exception)
    3227             : {
    3228          12 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    3229          24 :     uno::Sequence< OUString> aSeq;
    3230          12 :     aVal >>= aSeq;
    3231          24 :     return (sal_Int16)aSeq.getLength();
    3232             : }
    3233             : 
    3234           2 : OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException, std::exception)
    3235             : {
    3236           2 :     OUString aItem;
    3237           4 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    3238           4 :     uno::Sequence< OUString> aSeq;
    3239           2 :     aVal >>= aSeq;
    3240           2 :     if ( nPos < aSeq.getLength() )
    3241           2 :         aItem = aSeq.getConstArray()[nPos];
    3242           4 :     return aItem;
    3243             : }
    3244             : 
    3245           2 : uno::Sequence< OUString> UnoComboBoxControl::getItems() throw(uno::RuntimeException, std::exception)
    3246             : {
    3247           2 :     uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
    3248           2 :     uno::Sequence< OUString> aSeq;
    3249           2 :     aVal >>= aSeq;
    3250           2 :     return aSeq;
    3251             : }
    3252             : 
    3253           2 : void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException, std::exception)
    3254             : {
    3255           2 :     uno::Any aAny;
    3256           2 :     aAny <<= nLines;
    3257           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, true );
    3258           2 : }
    3259             : 
    3260           4 : sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(uno::RuntimeException, std::exception)
    3261             : {
    3262           4 :     return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
    3263             : }
    3264             : 
    3265             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    3266          17 : stardiv_Toolkit_UnoComboBoxControl_get_implementation(
    3267             :     css::uno::XComponentContext *,
    3268             :     css::uno::Sequence<css::uno::Any> const &)
    3269             : {
    3270          17 :     return cppu::acquire(new UnoComboBoxControl());
    3271             : }
    3272             : 
    3273             : 
    3274             : //  UnoSpinFieldControl
    3275             : 
    3276          49 : UnoSpinFieldControl::UnoSpinFieldControl()
    3277             :     :UnoEditControl()
    3278          49 :     ,maSpinListeners( *this )
    3279             : {
    3280          49 :     mbRepeat = false;
    3281          49 : }
    3282             : 
    3283             : // uno::XInterface
    3284        3328 : uno::Any UnoSpinFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    3285             : {
    3286             :     uno::Any aRet = ::cppu::queryInterface( rType,
    3287        3328 :                                         (static_cast< awt::XSpinField* >(this)) );
    3288        3328 :     return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
    3289             : }
    3290             : 
    3291             : // lang::XTypeProvider
    3292           0 : IMPL_XTYPEPROVIDER_START( UnoSpinFieldControl )
    3293           0 :     getCppuType( ( uno::Reference< awt::XSpinField>* ) NULL ),
    3294             :     UnoEditControl::getTypes()
    3295           0 : IMPL_XTYPEPROVIDER_END
    3296             : 
    3297         100 : void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    3298             : {
    3299         100 :     UnoEditControl::createPeer( rxToolkit, rParentPeer );
    3300             : 
    3301         100 :     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3302         100 :     xField->enableRepeat( mbRepeat );
    3303         100 :     if ( maSpinListeners.getLength() )
    3304           0 :         xField->addSpinListener( &maSpinListeners );
    3305         100 : }
    3306             : 
    3307             :     // ::com::sun::star::awt::XSpinField
    3308          11 : void UnoSpinFieldControl::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    3309             : {
    3310          11 :     maSpinListeners.addInterface( l );
    3311          11 :     if( getPeer().is() && maSpinListeners.getLength() == 1 )
    3312             :     {
    3313          11 :         uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3314          11 :         xField->addSpinListener( &maSpinListeners );
    3315             :     }
    3316          11 : }
    3317             : 
    3318          11 : void UnoSpinFieldControl::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    3319             : {
    3320          11 :     if( getPeer().is() && maSpinListeners.getLength() == 1 )
    3321             :     {
    3322          11 :         uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3323          11 :         xField->removeSpinListener( &maSpinListeners );
    3324             :     }
    3325          11 :     maSpinListeners.removeInterface( l );
    3326          11 : }
    3327             : 
    3328          22 : void UnoSpinFieldControl::up() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3329             : {
    3330          22 :     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3331          22 :     if ( xField.is() )
    3332          22 :         xField->up();
    3333          22 : }
    3334             : 
    3335          11 : void UnoSpinFieldControl::down() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3336             : {
    3337          11 :     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3338          11 :     if ( xField.is() )
    3339          11 :         xField->down();
    3340          11 : }
    3341             : 
    3342          11 : void UnoSpinFieldControl::first() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3343             : {
    3344          11 :     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3345          11 :     if ( xField.is() )
    3346          11 :         xField->first();
    3347          11 : }
    3348             : 
    3349          11 : void UnoSpinFieldControl::last() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3350             : {
    3351          11 :     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3352          11 :     if ( xField.is() )
    3353          11 :         xField->last();
    3354          11 : }
    3355             : 
    3356          22 : void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    3357             : {
    3358          22 :     mbRepeat = bRepeat;
    3359             : 
    3360          22 :     uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
    3361          22 :     if ( xField.is() )
    3362          22 :         xField->enableRepeat( bRepeat );
    3363          22 : }
    3364             : 
    3365             : 
    3366             : //  class UnoControlDateFieldModel
    3367             : 
    3368          31 : UnoControlDateFieldModel::UnoControlDateFieldModel( const Reference< XComponentContext >& rxContext )
    3369          31 :     :UnoControlModel( rxContext )
    3370             : {
    3371          31 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXDateField );
    3372          31 : }
    3373             : 
    3374           1 : OUString UnoControlDateFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3375             : {
    3376           1 :     return OUString::createFromAscii( szServiceName_UnoControlDateFieldModel );
    3377             : }
    3378             : 
    3379        1157 : uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    3380             : {
    3381        1157 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    3382             :     {
    3383          34 :         uno::Any aAny;
    3384          34 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlDateField );
    3385          34 :         return aAny;
    3386             :     }
    3387        1123 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    3388             : }
    3389             : 
    3390             : 
    3391        7704 : ::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper()
    3392             : {
    3393             :     static UnoPropertyArrayHelper* pHelper = NULL;
    3394        7704 :     if ( !pHelper )
    3395             :     {
    3396           6 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    3397           6 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    3398             :     }
    3399        7704 :     return *pHelper;
    3400             : }
    3401             : 
    3402             : // beans::XMultiPropertySet
    3403         121 : uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    3404             : {
    3405         121 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    3406         121 :     return xInfo;
    3407             : }
    3408             : 
    3409             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    3410          30 : stardiv_Toolkit_UnoControlDateFieldModel_get_implementation(
    3411             :     css::uno::XComponentContext *context,
    3412             :     css::uno::Sequence<css::uno::Any> const &)
    3413             : {
    3414          30 :     return cppu::acquire(new UnoControlDateFieldModel(context));
    3415             : }
    3416             : 
    3417             : 
    3418             : //  class UnoDateFieldControl
    3419             : 
    3420          20 : UnoDateFieldControl::UnoDateFieldControl()
    3421          20 :     :UnoSpinFieldControl()
    3422             : {
    3423          20 :     mnFirst = util::Date( 1, 1, 1900 );
    3424          20 :     mnLast = util::Date( 31, 12, 2200 );
    3425          20 :     mbLongFormat = TRISTATE_INDET;
    3426          20 : }
    3427             : 
    3428          28 : OUString UnoDateFieldControl::GetComponentServiceName()
    3429             : {
    3430          28 :     return OUString("datefield");
    3431             : }
    3432             : 
    3433             : // uno::XInterface
    3434         725 : uno::Any UnoDateFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    3435             : {
    3436             :     uno::Any aRet = ::cppu::queryInterface( rType,
    3437         725 :                                         (static_cast< awt::XDateField* >(this)) );
    3438         725 :     return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
    3439             : }
    3440             : 
    3441             : // lang::XTypeProvider
    3442           0 : IMPL_XTYPEPROVIDER_START( UnoDateFieldControl )
    3443           0 :     getCppuType( ( uno::Reference< awt::XDateField>* ) NULL ),
    3444             :     UnoSpinFieldControl::getTypes()
    3445           0 : IMPL_XTYPEPROVIDER_END
    3446             : 
    3447          30 : void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    3448             : {
    3449          30 :     UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
    3450             : 
    3451          30 :     uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
    3452          30 :     xField->setFirst( mnFirst );
    3453          30 :     xField->setLast( mnLast );
    3454          30 :     if ( mbLongFormat != TRISTATE_INDET )
    3455           2 :         xField->setLongFormat( mbLongFormat );
    3456          30 : }
    3457             : 
    3458             : 
    3459          26 : void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException, std::exception)
    3460             : {
    3461          26 :     uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
    3462             : 
    3463             :     // also change the text property (#i25106#)
    3464          26 :     if ( xPeer.is() )
    3465             :     {
    3466          26 :         OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
    3467          26 :         ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), false );
    3468             :     }
    3469             : 
    3470             :     // re-calc the Date property
    3471          52 :     uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
    3472          52 :     uno::Any aValue;
    3473          26 :     if ( xField->isEmpty() )
    3474             :     {
    3475             :         // the field says it's empty
    3476           4 :         bool bEnforceFormat = true;
    3477           4 :         if ( xPeer.is() )
    3478           4 :             xPeer->getProperty( GetPropertyName( BASEPROPERTY_ENFORCE_FORMAT ) ) >>= bEnforceFormat;
    3479           4 :         if ( !bEnforceFormat )
    3480             :         {
    3481             :             // and it also says that it is currently accepting invalid inputs, without
    3482             :             // forcing it to a valid date
    3483           0 :             uno::Reference< awt::XTextComponent > xText( xPeer, uno::UNO_QUERY );
    3484           0 :             if ( xText.is() && xText->getText().getLength() )
    3485             :                 // and in real, the text of the peer is *not* empty
    3486             :                 // -> simulate an invalid date, which is different from "no date"
    3487           0 :                 aValue <<= util::Date();
    3488             :         }
    3489             :     }
    3490             :     else
    3491          22 :         aValue <<= xField->getDate();
    3492             : 
    3493          26 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, false );
    3494             : 
    3495             :     // multiplex the event
    3496          26 :     if ( GetTextListeners().getLength() )
    3497          52 :         GetTextListeners().textChanged( e );
    3498          26 : }
    3499             : 
    3500           2 : void UnoDateFieldControl::setDate( const util::Date& Date ) throw(uno::RuntimeException, std::exception)
    3501             : {
    3502           2 :     uno::Any aAny;
    3503           2 :     aAny <<= Date;
    3504           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, true );
    3505           2 : }
    3506             : 
    3507           4 : util::Date UnoDateFieldControl::getDate() throw(uno::RuntimeException, std::exception)
    3508             : {
    3509           4 :     return ImplGetPropertyValue_Date( BASEPROPERTY_DATE );
    3510             : }
    3511             : 
    3512           2 : void UnoDateFieldControl::setMin( const util::Date& Date ) throw(uno::RuntimeException, std::exception)
    3513             : {
    3514           2 :     uno::Any aAny;
    3515           2 :     aAny <<= Date;
    3516           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, true );
    3517           2 : }
    3518             : 
    3519           4 : util::Date UnoDateFieldControl::getMin() throw(uno::RuntimeException, std::exception)
    3520             : {
    3521           4 :     return ImplGetPropertyValue_Date( BASEPROPERTY_DATEMIN );
    3522             : }
    3523             : 
    3524           2 : void UnoDateFieldControl::setMax( const util::Date& Date ) throw(uno::RuntimeException, std::exception)
    3525             : {
    3526           2 :     uno::Any aAny;
    3527           2 :     aAny <<= Date;
    3528           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, true );
    3529           2 : }
    3530             : 
    3531           4 : util::Date UnoDateFieldControl::getMax() throw(uno::RuntimeException, std::exception)
    3532             : {
    3533           4 :     return ImplGetPropertyValue_Date( BASEPROPERTY_DATEMAX );
    3534             : }
    3535             : 
    3536           2 : void UnoDateFieldControl::setFirst( const util::Date& Date ) throw(uno::RuntimeException, std::exception)
    3537             : {
    3538           2 :     mnFirst = Date;
    3539           2 :     if ( getPeer().is() )
    3540             :     {
    3541           2 :         uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
    3542           2 :         xField->setFirst( Date );
    3543             :     }
    3544           2 : }
    3545             : 
    3546           4 : util::Date UnoDateFieldControl::getFirst() throw(uno::RuntimeException, std::exception)
    3547             : {
    3548           4 :     return mnFirst;
    3549             : }
    3550             : 
    3551           2 : void UnoDateFieldControl::setLast( const util::Date& Date ) throw(uno::RuntimeException, std::exception)
    3552             : {
    3553           2 :     mnLast = Date;
    3554           2 :     if ( getPeer().is() )
    3555             :     {
    3556           2 :         uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
    3557           2 :         xField->setLast( Date );
    3558             :     }
    3559           2 : }
    3560             : 
    3561           4 : util::Date UnoDateFieldControl::getLast() throw(uno::RuntimeException, std::exception)
    3562             : {
    3563           4 :     return mnLast;
    3564             : }
    3565             : 
    3566           2 : void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(uno::RuntimeException, std::exception)
    3567             : {
    3568           2 :     mbLongFormat = bLong ? TRISTATE_TRUE : TRISTATE_FALSE;
    3569           2 :     if ( getPeer().is() )
    3570             :     {
    3571           2 :         uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
    3572           2 :         xField->setLongFormat( bLong );
    3573             :     }
    3574           2 : }
    3575             : 
    3576           4 : sal_Bool UnoDateFieldControl::isLongFormat() throw(uno::RuntimeException, std::exception)
    3577             : {
    3578           4 :     return mbLongFormat == TRISTATE_TRUE;
    3579             : }
    3580             : 
    3581           2 : void UnoDateFieldControl::setEmpty() throw(uno::RuntimeException, std::exception)
    3582             : {
    3583           2 :     if ( getPeer().is() )
    3584             :     {
    3585           2 :         uno::Reference < awt::XDateField >  xField( getPeer(), uno::UNO_QUERY );
    3586           2 :         xField->setEmpty();
    3587             :     }
    3588           2 : }
    3589             : 
    3590           2 : sal_Bool UnoDateFieldControl::isEmpty() throw(uno::RuntimeException, std::exception)
    3591             : {
    3592           2 :     bool bEmpty = false;
    3593           2 :     if ( getPeer().is() )
    3594             :     {
    3595           2 :         uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
    3596           2 :         bEmpty = xField->isEmpty();
    3597             :     }
    3598           2 :     return bEmpty;
    3599             : }
    3600             : 
    3601           2 : void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException, std::exception)
    3602             : {
    3603           2 :     uno::Any aAny;
    3604           2 :     aAny <<= bStrict;
    3605           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, true );
    3606           2 : }
    3607             : 
    3608           4 : sal_Bool UnoDateFieldControl::isStrictFormat() throw(uno::RuntimeException, std::exception)
    3609             : {
    3610           4 :     return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
    3611             : }
    3612             : 
    3613             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    3614          20 : stardiv_Toolkit_UnoDateFieldControl_get_implementation(
    3615             :     css::uno::XComponentContext *,
    3616             :     css::uno::Sequence<css::uno::Any> const &)
    3617             : {
    3618          20 :     return cppu::acquire(new UnoDateFieldControl());
    3619             : }
    3620             : 
    3621             : 
    3622             : //  class UnoControlTimeFieldModel
    3623             : 
    3624          14 : UnoControlTimeFieldModel::UnoControlTimeFieldModel( const Reference< XComponentContext >& rxContext )
    3625          14 :     :UnoControlModel( rxContext )
    3626             : {
    3627          14 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXTimeField );
    3628          14 : }
    3629             : 
    3630           1 : OUString UnoControlTimeFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3631             : {
    3632           1 :     return OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel );
    3633             : }
    3634             : 
    3635         514 : uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    3636             : {
    3637         514 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    3638             :     {
    3639          16 :         uno::Any aAny;
    3640          16 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlTimeField );
    3641          16 :         return aAny;
    3642             :     }
    3643         498 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    3644             : }
    3645             : 
    3646             : 
    3647        5958 : ::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper()
    3648             : {
    3649             :     static UnoPropertyArrayHelper* pHelper = NULL;
    3650        5958 :     if ( !pHelper )
    3651             :     {
    3652           3 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    3653           3 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    3654             :     }
    3655        5958 :     return *pHelper;
    3656             : }
    3657             : 
    3658             : // beans::XMultiPropertySet
    3659          81 : uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    3660             : {
    3661          81 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    3662          81 :     return xInfo;
    3663             : }
    3664             : 
    3665             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    3666          13 : stardiv_Toolkit_UnoControlTimeFieldModel_get_implementation(
    3667             :     css::uno::XComponentContext *context,
    3668             :     css::uno::Sequence<css::uno::Any> const &)
    3669             : {
    3670          13 :     return cppu::acquire(new UnoControlTimeFieldModel(context));
    3671             : }
    3672             : 
    3673             : 
    3674             : //  class UnoTimeFieldControl
    3675             : 
    3676           7 : UnoTimeFieldControl::UnoTimeFieldControl()
    3677           7 :     :UnoSpinFieldControl()
    3678             : {
    3679           7 :     mnFirst = util::Time( 0, 0, 0, 0, false );
    3680           7 :     mnLast = util::Time( 999999999, 59, 59, 23, false );
    3681           7 : }
    3682             : 
    3683          17 : OUString UnoTimeFieldControl::GetComponentServiceName()
    3684             : {
    3685          17 :     return OUString("timefield");
    3686             : }
    3687             : 
    3688             : // uno::XInterface
    3689         772 : uno::Any UnoTimeFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    3690             : {
    3691             :     uno::Any aRet = ::cppu::queryInterface( rType,
    3692         772 :                                         (static_cast< awt::XTimeField* >(this)) );
    3693         772 :     return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
    3694             : }
    3695             : 
    3696             : // lang::XTypeProvider
    3697           0 : IMPL_XTYPEPROVIDER_START( UnoTimeFieldControl )
    3698           0 :     getCppuType( ( uno::Reference< awt::XTimeField>* ) NULL ),
    3699             :     UnoSpinFieldControl::getTypes()
    3700           0 : IMPL_XTYPEPROVIDER_END
    3701             : 
    3702          19 : void UnoTimeFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    3703             : {
    3704          19 :     UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
    3705             : 
    3706          19 :     uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
    3707          19 :     xField->setFirst( mnFirst );
    3708          19 :     xField->setLast( mnLast );
    3709          19 : }
    3710             : 
    3711          20 : void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException, std::exception)
    3712             : {
    3713             :     // also change the text property (#i25106#)
    3714          20 :     uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
    3715          40 :     OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
    3716          20 :     ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), false );
    3717             : 
    3718             :     // re-calc the Time property
    3719          40 :     uno::Reference < awt::XTimeField >  xField( getPeer(), uno::UNO_QUERY );
    3720          40 :     uno::Any aValue;
    3721          20 :     if ( !xField->isEmpty() )
    3722          18 :         aValue <<= xField->getTime();
    3723          20 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, false );
    3724             : 
    3725             :     // multiplex the event
    3726          20 :     if ( GetTextListeners().getLength() )
    3727          40 :         GetTextListeners().textChanged( e );
    3728          20 : }
    3729             : 
    3730           2 : void UnoTimeFieldControl::setTime( const util::Time& Time ) throw(uno::RuntimeException, std::exception)
    3731             : {
    3732           2 :     uno::Any aAny;
    3733           2 :     aAny <<= Time;
    3734           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, true );
    3735           2 : }
    3736             : 
    3737           4 : util::Time UnoTimeFieldControl::getTime() throw(uno::RuntimeException, std::exception)
    3738             : {
    3739           4 :     return ImplGetPropertyValue_Time( BASEPROPERTY_TIME );
    3740             : }
    3741             : 
    3742           2 : void UnoTimeFieldControl::setMin( const util::Time& Time ) throw(uno::RuntimeException, std::exception)
    3743             : {
    3744           2 :     uno::Any aAny;
    3745           2 :     aAny <<= Time;
    3746           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, true );
    3747           2 : }
    3748             : 
    3749           4 : util::Time UnoTimeFieldControl::getMin() throw(uno::RuntimeException, std::exception)
    3750             : {
    3751           4 :     return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMIN );
    3752             : }
    3753             : 
    3754           2 : void UnoTimeFieldControl::setMax( const util::Time& Time ) throw(uno::RuntimeException, std::exception)
    3755             : {
    3756           2 :     uno::Any aAny;
    3757           2 :     aAny <<= Time;
    3758           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, true );
    3759           2 : }
    3760             : 
    3761           4 : util::Time UnoTimeFieldControl::getMax() throw(uno::RuntimeException, std::exception)
    3762             : {
    3763           4 :     return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMAX );
    3764             : }
    3765             : 
    3766           2 : void UnoTimeFieldControl::setFirst( const util::Time& Time ) throw(uno::RuntimeException, std::exception)
    3767             : {
    3768           2 :     mnFirst = Time;
    3769           2 :     if ( getPeer().is() )
    3770             :     {
    3771           2 :         uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
    3772           2 :         xField->setFirst( mnFirst );
    3773             :     }
    3774           2 : }
    3775             : 
    3776           4 : util::Time UnoTimeFieldControl::getFirst() throw(uno::RuntimeException, std::exception)
    3777             : {
    3778           4 :     return mnFirst;
    3779             : }
    3780             : 
    3781           2 : void UnoTimeFieldControl::setLast( const util::Time& Time ) throw(uno::RuntimeException, std::exception)
    3782             : {
    3783           2 :     mnLast = Time;
    3784           2 :     if ( getPeer().is() )
    3785             :     {
    3786           2 :         uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
    3787           2 :         xField->setFirst( mnLast );
    3788             :     }
    3789           2 : }
    3790             : 
    3791           4 : util::Time UnoTimeFieldControl::getLast() throw(uno::RuntimeException, std::exception)
    3792             : {
    3793           4 :     return mnLast;
    3794             : }
    3795             : 
    3796           2 : void UnoTimeFieldControl::setEmpty() throw(uno::RuntimeException, std::exception)
    3797             : {
    3798           2 :     if ( getPeer().is() )
    3799             :     {
    3800           2 :         uno::Reference < awt::XTimeField >  xField( getPeer(), uno::UNO_QUERY );
    3801           2 :         xField->setEmpty();
    3802             :     }
    3803           2 : }
    3804             : 
    3805           2 : sal_Bool UnoTimeFieldControl::isEmpty() throw(uno::RuntimeException, std::exception)
    3806             : {
    3807           2 :     bool bEmpty = false;
    3808           2 :     if ( getPeer().is() )
    3809             :     {
    3810           2 :         uno::Reference < awt::XTimeField >  xField( getPeer(), uno::UNO_QUERY );
    3811           2 :         bEmpty = xField->isEmpty();
    3812             :     }
    3813           2 :     return bEmpty;
    3814             : }
    3815             : 
    3816           2 : void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException, std::exception)
    3817             : {
    3818           2 :     uno::Any aAny;
    3819           2 :     aAny <<= bStrict;
    3820           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, true );
    3821           2 : }
    3822             : 
    3823           4 : sal_Bool UnoTimeFieldControl::isStrictFormat() throw(uno::RuntimeException, std::exception)
    3824             : {
    3825           4 :     return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
    3826             : }
    3827             : 
    3828             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    3829           7 : stardiv_Toolkit_UnoTimeFieldControl_get_implementation(
    3830             :     css::uno::XComponentContext *,
    3831             :     css::uno::Sequence<css::uno::Any> const &)
    3832             : {
    3833           7 :     return cppu::acquire(new UnoTimeFieldControl());
    3834             : }
    3835             : 
    3836             : 
    3837             : //  class UnoControlNumericFieldModel
    3838             : 
    3839          14 : UnoControlNumericFieldModel::UnoControlNumericFieldModel( const Reference< XComponentContext >& rxContext )
    3840          14 :     :UnoControlModel( rxContext )
    3841             : {
    3842          14 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXNumericField );
    3843          14 : }
    3844             : 
    3845           1 : OUString UnoControlNumericFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    3846             : {
    3847           1 :     return OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel );
    3848             : }
    3849             : 
    3850         530 : uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    3851             : {
    3852         530 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    3853             :     {
    3854          16 :         uno::Any aAny;
    3855          16 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlNumericField );
    3856          16 :         return aAny;
    3857             :     }
    3858         514 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    3859             : }
    3860             : 
    3861             : 
    3862        6171 : ::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper()
    3863             : {
    3864             :     static UnoPropertyArrayHelper* pHelper = NULL;
    3865        6171 :     if ( !pHelper )
    3866             :     {
    3867           3 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    3868           3 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    3869             :     }
    3870        6171 :     return *pHelper;
    3871             : }
    3872             : 
    3873             : // beans::XMultiPropertySet
    3874          82 : uno::Reference< beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    3875             : {
    3876          82 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    3877          82 :     return xInfo;
    3878             : }
    3879             : 
    3880             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    3881          13 : stardiv_Toolkit_UnoControlNumericFieldModel_get_implementation(
    3882             :     css::uno::XComponentContext *context,
    3883             :     css::uno::Sequence<css::uno::Any> const &)
    3884             : {
    3885          13 :     return cppu::acquire(new UnoControlNumericFieldModel(context));
    3886             : }
    3887             : 
    3888             : 
    3889             : //  class UnoNumericFieldControl
    3890             : 
    3891           7 : UnoNumericFieldControl::UnoNumericFieldControl()
    3892           7 :     :UnoSpinFieldControl()
    3893             : {
    3894           7 :     mnFirst = 0;
    3895           7 :     mnLast = 0x7FFFFFFF;
    3896           7 : }
    3897             : 
    3898          17 : OUString UnoNumericFieldControl::GetComponentServiceName()
    3899             : {
    3900          17 :     return OUString("numericfield");
    3901             : }
    3902             : 
    3903             : // uno::XInterface
    3904         596 : uno::Any UnoNumericFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    3905             : {
    3906             :     uno::Any aRet = ::cppu::queryInterface( rType,
    3907         596 :                                         (static_cast< awt::XNumericField* >(this)) );
    3908         596 :     return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
    3909             : }
    3910             : 
    3911             : // lang::XTypeProvider
    3912           0 : IMPL_XTYPEPROVIDER_START( UnoNumericFieldControl )
    3913           0 :     getCppuType( ( uno::Reference< awt::XNumericField>* ) NULL ),
    3914             :     UnoSpinFieldControl::getTypes()
    3915           0 : IMPL_XTYPEPROVIDER_END
    3916             : 
    3917          19 : void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    3918             : {
    3919          19 :     UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
    3920             : 
    3921          19 :     uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
    3922          19 :     xField->setFirst( mnFirst );
    3923          19 :     xField->setLast( mnLast );
    3924          19 : }
    3925             : 
    3926             : 
    3927         106 : void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException, std::exception)
    3928             : {
    3929         106 :     uno::Reference < awt::XNumericField >  xField( getPeer(), uno::UNO_QUERY );
    3930         212 :     uno::Any aAny;
    3931         106 :     aAny <<= xField->getValue();
    3932         106 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, false );
    3933             : 
    3934         106 :     if ( GetTextListeners().getLength() )
    3935         212 :         GetTextListeners().textChanged( e );
    3936         106 : }
    3937             : 
    3938           2 : void UnoNumericFieldControl::setValue( double Value ) throw(uno::RuntimeException, std::exception)
    3939             : {
    3940           2 :     uno::Any aAny;
    3941           2 :     aAny <<= Value;
    3942           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, true );
    3943           2 : }
    3944             : 
    3945           4 : double UnoNumericFieldControl::getValue() throw(uno::RuntimeException, std::exception)
    3946             : {
    3947           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
    3948             : }
    3949             : 
    3950           2 : void UnoNumericFieldControl::setMin( double Value ) throw(uno::RuntimeException, std::exception)
    3951             : {
    3952           2 :     uno::Any aAny;
    3953           2 :     aAny <<= Value;
    3954           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, true );
    3955           2 : }
    3956             : 
    3957           4 : double UnoNumericFieldControl::getMin() throw(uno::RuntimeException, std::exception)
    3958             : {
    3959           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
    3960             : }
    3961             : 
    3962           2 : void UnoNumericFieldControl::setMax( double Value ) throw(uno::RuntimeException, std::exception)
    3963             : {
    3964           2 :     uno::Any aAny;
    3965           2 :     aAny <<= Value;
    3966           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, true );
    3967           2 : }
    3968             : 
    3969           4 : double UnoNumericFieldControl::getMax() throw(uno::RuntimeException, std::exception)
    3970             : {
    3971           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
    3972             : }
    3973             : 
    3974           2 : void UnoNumericFieldControl::setFirst( double Value ) throw(uno::RuntimeException, std::exception)
    3975             : {
    3976           2 :     mnFirst = Value;
    3977           2 :     if ( getPeer().is() )
    3978             :     {
    3979           2 :         uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
    3980           2 :         xField->setFirst( mnFirst );
    3981             :     }
    3982           2 : }
    3983             : 
    3984           4 : double UnoNumericFieldControl::getFirst() throw(uno::RuntimeException, std::exception)
    3985             : {
    3986           4 :     return mnFirst;
    3987             : }
    3988             : 
    3989           2 : void UnoNumericFieldControl::setLast( double Value ) throw(uno::RuntimeException, std::exception)
    3990             : {
    3991           2 :     mnLast = Value;
    3992           2 :     if ( getPeer().is() )
    3993             :     {
    3994           2 :         uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
    3995           2 :         xField->setLast( mnLast );
    3996             :     }
    3997           2 : }
    3998             : 
    3999           4 : double UnoNumericFieldControl::getLast() throw(uno::RuntimeException, std::exception)
    4000             : {
    4001           4 :     return mnLast;
    4002             : }
    4003             : 
    4004           2 : void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException, std::exception)
    4005             : {
    4006           2 :     uno::Any aAny;
    4007           2 :     aAny <<= bStrict;
    4008           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, true );
    4009           2 : }
    4010             : 
    4011           4 : sal_Bool UnoNumericFieldControl::isStrictFormat() throw(uno::RuntimeException, std::exception)
    4012             : {
    4013           4 :     return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
    4014             : }
    4015             : 
    4016           2 : void UnoNumericFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException, std::exception)
    4017             : {
    4018           2 :     uno::Any aAny;
    4019           2 :     aAny <<= Digits;
    4020           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, true );
    4021           2 : }
    4022             : 
    4023           4 : double UnoNumericFieldControl::getSpinSize() throw(uno::RuntimeException, std::exception)
    4024             : {
    4025           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
    4026             : }
    4027             : 
    4028           2 : void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException, std::exception)
    4029             : {
    4030           2 :     uno::Any aAny;
    4031           2 :     aAny <<= Digits;
    4032           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, true );
    4033           2 : }
    4034             : 
    4035           4 : sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(uno::RuntimeException, std::exception)
    4036             : {
    4037           4 :     return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
    4038             : }
    4039             : 
    4040             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4041           7 : stardiv_Toolkit_UnoNumericFieldControl_get_implementation(
    4042             :     css::uno::XComponentContext *,
    4043             :     css::uno::Sequence<css::uno::Any> const &)
    4044             : {
    4045           7 :     return cppu::acquire(new UnoNumericFieldControl());
    4046             : }
    4047             : 
    4048             : 
    4049             : //  class UnoControlCurrencyFieldModel
    4050             : 
    4051          13 : UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel( const Reference< XComponentContext >& rxContext )
    4052          13 :     :UnoControlModel( rxContext )
    4053             : {
    4054          13 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCurrencyField );
    4055          13 : }
    4056             : 
    4057           1 : OUString UnoControlCurrencyFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    4058             : {
    4059           1 :     return OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel );
    4060             : }
    4061             : 
    4062         527 : uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    4063             : {
    4064         527 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    4065             :     {
    4066          15 :         uno::Any aAny;
    4067          15 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlCurrencyField );
    4068          15 :         return aAny;
    4069             :     }
    4070         512 :     if ( nPropId == BASEPROPERTY_CURSYM_POSITION )
    4071             :     {
    4072          15 :         uno::Any aAny;
    4073          15 :         aAny <<= false;
    4074          15 :         return aAny;
    4075             :     }
    4076             : 
    4077         497 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    4078             : }
    4079             : 
    4080        6960 : ::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper()
    4081             : {
    4082             :     static UnoPropertyArrayHelper* pHelper = NULL;
    4083        6960 :     if ( !pHelper )
    4084             :     {
    4085           3 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    4086           3 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    4087             :     }
    4088        6960 :     return *pHelper;
    4089             : }
    4090             : 
    4091             : // beans::XMultiPropertySet
    4092          86 : uno::Reference< beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    4093             : {
    4094          86 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    4095          86 :     return xInfo;
    4096             : }
    4097             : 
    4098             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4099          12 : stardiv_Toolkit_UnoControlCurrencyFieldModel_get_implementation(
    4100             :     css::uno::XComponentContext *context,
    4101             :     css::uno::Sequence<css::uno::Any> const &)
    4102             : {
    4103          12 :     return cppu::acquire(new UnoControlCurrencyFieldModel(context));
    4104             : }
    4105             : 
    4106             : 
    4107             : //  class UnoCurrencyFieldControl
    4108             : 
    4109           7 : UnoCurrencyFieldControl::UnoCurrencyFieldControl()
    4110           7 :     :UnoSpinFieldControl()
    4111             : {
    4112           7 :     mnFirst = 0;
    4113           7 :     mnLast = 0x7FFFFFFF;
    4114           7 : }
    4115             : 
    4116          18 : OUString UnoCurrencyFieldControl::GetComponentServiceName()
    4117             : {
    4118          18 :     return OUString("longcurrencyfield");
    4119             : }
    4120             : 
    4121             : // uno::XInterface
    4122         759 : uno::Any UnoCurrencyFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    4123             : {
    4124             :     uno::Any aRet = ::cppu::queryInterface( rType,
    4125         759 :                                         (static_cast< awt::XCurrencyField* >(this)) );
    4126         759 :     return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
    4127             : }
    4128             : 
    4129             : // lang::XTypeProvider
    4130           0 : IMPL_XTYPEPROVIDER_START( UnoCurrencyFieldControl )
    4131           0 :     getCppuType( ( uno::Reference< awt::XCurrencyField>* ) NULL ),
    4132             :     UnoSpinFieldControl::getTypes()
    4133           0 : IMPL_XTYPEPROVIDER_END
    4134             : 
    4135          20 : void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException, std::exception)
    4136             : {
    4137          20 :     UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
    4138             : 
    4139          20 :     uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
    4140          20 :     xField->setFirst( mnFirst );
    4141          20 :     xField->setLast( mnLast );
    4142          20 : }
    4143             : 
    4144          90 : void UnoCurrencyFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException, std::exception)
    4145             : {
    4146          90 :     uno::Reference < awt::XCurrencyField >  xField( getPeer(), uno::UNO_QUERY );
    4147         180 :     uno::Any aAny;
    4148          90 :     aAny <<= xField->getValue();
    4149          90 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, false );
    4150             : 
    4151          90 :     if ( GetTextListeners().getLength() )
    4152         180 :         GetTextListeners().textChanged( e );
    4153          90 : }
    4154             : 
    4155           2 : void UnoCurrencyFieldControl::setValue( double Value ) throw(uno::RuntimeException, std::exception)
    4156             : {
    4157           2 :     uno::Any aAny;
    4158           2 :     aAny <<= Value;
    4159           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, true );
    4160           2 : }
    4161             : 
    4162           4 : double UnoCurrencyFieldControl::getValue() throw(uno::RuntimeException, std::exception)
    4163             : {
    4164           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
    4165             : }
    4166             : 
    4167           2 : void UnoCurrencyFieldControl::setMin( double Value ) throw(uno::RuntimeException, std::exception)
    4168             : {
    4169           2 :     uno::Any aAny;
    4170           2 :     aAny <<= Value;
    4171           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, true );
    4172           2 : }
    4173             : 
    4174           4 : double UnoCurrencyFieldControl::getMin() throw(uno::RuntimeException, std::exception)
    4175             : {
    4176           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
    4177             : }
    4178             : 
    4179           2 : void UnoCurrencyFieldControl::setMax( double Value ) throw(uno::RuntimeException, std::exception)
    4180             : {
    4181           2 :     uno::Any aAny;
    4182           2 :     aAny <<= Value;
    4183           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, true );
    4184           2 : }
    4185             : 
    4186           4 : double UnoCurrencyFieldControl::getMax() throw(uno::RuntimeException, std::exception)
    4187             : {
    4188           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
    4189             : }
    4190             : 
    4191           2 : void UnoCurrencyFieldControl::setFirst( double Value ) throw(uno::RuntimeException, std::exception)
    4192             : {
    4193           2 :     mnFirst = Value;
    4194           2 :     if ( getPeer().is() )
    4195             :     {
    4196           2 :         uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
    4197           2 :         xField->setFirst( mnFirst );
    4198             :     }
    4199           2 : }
    4200             : 
    4201           4 : double UnoCurrencyFieldControl::getFirst() throw(uno::RuntimeException, std::exception)
    4202             : {
    4203           4 :     return mnFirst;
    4204             : }
    4205             : 
    4206           2 : void UnoCurrencyFieldControl::setLast( double Value ) throw(uno::RuntimeException, std::exception)
    4207             : {
    4208           2 :     mnLast = Value;
    4209           2 :     if ( getPeer().is() )
    4210             :     {
    4211           2 :         uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
    4212           2 :         xField->setLast( mnLast );
    4213             :     }
    4214           2 : }
    4215             : 
    4216           4 : double UnoCurrencyFieldControl::getLast() throw(uno::RuntimeException, std::exception)
    4217             : {
    4218           4 :     return mnLast;
    4219             : }
    4220             : 
    4221           2 : void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException, std::exception)
    4222             : {
    4223           2 :     uno::Any aAny;
    4224           2 :     aAny <<= bStrict;
    4225           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, true );
    4226           2 : }
    4227             : 
    4228           4 : sal_Bool UnoCurrencyFieldControl::isStrictFormat() throw(uno::RuntimeException, std::exception)
    4229             : {
    4230           4 :     return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
    4231             : }
    4232             : 
    4233           2 : void UnoCurrencyFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException, std::exception)
    4234             : {
    4235           2 :     uno::Any aAny;
    4236           2 :     aAny <<= Digits;
    4237           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, true );
    4238           2 : }
    4239             : 
    4240           4 : double UnoCurrencyFieldControl::getSpinSize() throw(uno::RuntimeException, std::exception)
    4241             : {
    4242           4 :     return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
    4243             : }
    4244             : 
    4245           2 : void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException, std::exception)
    4246             : {
    4247           2 :     uno::Any aAny;
    4248           2 :     aAny <<= Digits;
    4249           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, true );
    4250           2 : }
    4251             : 
    4252           4 : sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(uno::RuntimeException, std::exception)
    4253             : {
    4254           4 :     return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
    4255             : }
    4256             : 
    4257             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4258           7 : stardiv_Toolkit_UnoCurrencyFieldControl_get_implementation(
    4259             :     css::uno::XComponentContext *,
    4260             :     css::uno::Sequence<css::uno::Any> const &)
    4261             : {
    4262           7 :     return cppu::acquire(new UnoCurrencyFieldControl());
    4263             : }
    4264             : 
    4265             : 
    4266             : //  class UnoControlPatternFieldModel
    4267             : 
    4268          13 : UnoControlPatternFieldModel::UnoControlPatternFieldModel( const Reference< XComponentContext >& rxContext )
    4269          13 :     :UnoControlModel( rxContext )
    4270             : {
    4271          13 :     UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXPatternField );
    4272          13 : }
    4273             : 
    4274           1 : OUString UnoControlPatternFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
    4275             : {
    4276           1 :     return OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel );
    4277             : }
    4278             : 
    4279         407 : uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    4280             : {
    4281         407 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    4282             :     {
    4283          15 :         uno::Any aAny;
    4284          15 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlPatternField );
    4285          15 :         return aAny;
    4286             :     }
    4287         392 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    4288             : }
    4289             : 
    4290        5205 : ::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper()
    4291             : {
    4292             :     static UnoPropertyArrayHelper* pHelper = NULL;
    4293        5205 :     if ( !pHelper )
    4294             :     {
    4295           3 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    4296           3 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    4297             :     }
    4298        5205 :     return *pHelper;
    4299             : }
    4300             : 
    4301             : // beans::XMultiPropertySet
    4302          69 : uno::Reference< beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    4303             : {
    4304          69 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    4305          69 :     return xInfo;
    4306             : }
    4307             : 
    4308             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4309          12 : stardiv_Toolkit_UnoControlPatternFieldModel_get_implementation(
    4310             :     css::uno::XComponentContext *context,
    4311             :     css::uno::Sequence<css::uno::Any> const &)
    4312             : {
    4313          12 :     return cppu::acquire(new UnoControlPatternFieldModel(context));
    4314             : }
    4315             : 
    4316             : 
    4317             : //  class UnoPatternFieldControl
    4318             : 
    4319           7 : UnoPatternFieldControl::UnoPatternFieldControl()
    4320           7 :     :UnoSpinFieldControl()
    4321             : {
    4322           7 : }
    4323             : 
    4324           8 : OUString UnoPatternFieldControl::GetComponentServiceName()
    4325             : {
    4326           8 :     return OUString("patternfield");
    4327             : }
    4328             : 
    4329         925 : void UnoPatternFieldControl::ImplSetPeerProperty( const OUString& rPropName, const uno::Any& rVal )
    4330             : {
    4331         925 :     sal_uInt16 nType = GetPropertyId( rPropName );
    4332         925 :     if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) )
    4333             :     {
    4334             :         // These masks cannot be set consecutively
    4335          80 :         OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
    4336         160 :         OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
    4337         160 :         OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
    4338             : 
    4339         160 :         uno::Reference < awt::XPatternField >  xPF( getPeer(), uno::UNO_QUERY );
    4340          80 :         if (xPF.is())
    4341             :         {
    4342             :             // same comment as in UnoControl::ImplSetPeerProperty - see there
    4343          80 :             OUString sText( Text );
    4344          80 :             ImplCheckLocalize( sText );
    4345          80 :             xPF->setString( sText );
    4346          80 :             xPF->setMasks( EditMask, LiteralMask );
    4347          80 :         }
    4348             :     }
    4349             :     else
    4350         845 :         UnoSpinFieldControl::ImplSetPeerProperty( rPropName, rVal );
    4351         925 : }
    4352             : 
    4353             : 
    4354             : // uno::XInterface
    4355         444 : uno::Any UnoPatternFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    4356             : {
    4357             :     uno::Any aRet = ::cppu::queryInterface( rType,
    4358         444 :                                         (static_cast< awt::XPatternField* >(this)) );
    4359         444 :     return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
    4360             : }
    4361             : 
    4362             : // lang::XTypeProvider
    4363           0 : IMPL_XTYPEPROVIDER_START( UnoPatternFieldControl )
    4364           0 :     getCppuType( ( uno::Reference< awt::XPatternField>* ) NULL ),
    4365             :     UnoSpinFieldControl::getTypes()
    4366           0 : IMPL_XTYPEPROVIDER_END
    4367             : 
    4368           2 : void UnoPatternFieldControl::setString( const OUString& rString ) throw(uno::RuntimeException, std::exception)
    4369             : {
    4370           2 :     setText( rString );
    4371           2 : }
    4372             : 
    4373           4 : OUString UnoPatternFieldControl::getString() throw(uno::RuntimeException, std::exception)
    4374             : {
    4375           4 :     return getText();
    4376             : }
    4377             : 
    4378           2 : void UnoPatternFieldControl::setMasks( const OUString& EditMask, const OUString& LiteralMask ) throw(uno::RuntimeException, std::exception)
    4379             : {
    4380           2 :     uno::Any aAny;
    4381           2 :     aAny <<= EditMask;
    4382           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), aAny, true );
    4383           2 :     aAny <<= LiteralMask;
    4384           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), aAny, true );
    4385           2 : }
    4386             : 
    4387           4 : void UnoPatternFieldControl::getMasks( OUString& EditMask, OUString& LiteralMask ) throw(uno::RuntimeException, std::exception)
    4388             : {
    4389           4 :     EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
    4390           4 :     LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
    4391           4 : }
    4392             : 
    4393           2 : void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException, std::exception)
    4394             : {
    4395           2 :     uno::Any aAny;
    4396           2 :     aAny <<= bStrict;
    4397           2 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, true );
    4398           2 : }
    4399             : 
    4400           4 : sal_Bool UnoPatternFieldControl::isStrictFormat() throw(uno::RuntimeException, std::exception)
    4401             : {
    4402           4 :     return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
    4403             : }
    4404             : 
    4405             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4406           7 : stardiv_Toolkit_UnoPatternFieldControl_get_implementation(
    4407             :     css::uno::XComponentContext *,
    4408             :     css::uno::Sequence<css::uno::Any> const &)
    4409             : {
    4410           7 :     return cppu::acquire(new UnoPatternFieldControl());
    4411             : }
    4412             : 
    4413             : 
    4414             : //  class UnoControlProgressBarModel
    4415             : 
    4416           4 : UnoControlProgressBarModel::UnoControlProgressBarModel( const Reference< XComponentContext >& rxContext )
    4417           4 :     :UnoControlModel( rxContext )
    4418             : {
    4419           4 :     ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
    4420           4 :     ImplRegisterProperty( BASEPROPERTY_BORDER );
    4421           4 :     ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
    4422           4 :     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
    4423           4 :     ImplRegisterProperty( BASEPROPERTY_ENABLED );
    4424           4 :     ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
    4425           4 :     ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
    4426           4 :     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
    4427           4 :     ImplRegisterProperty( BASEPROPERTY_HELPURL );
    4428           4 :     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
    4429           4 :     ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
    4430           4 :     ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
    4431           4 :     ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MIN );
    4432           4 : }
    4433             : 
    4434           1 : OUString UnoControlProgressBarModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    4435             : {
    4436           1 :     return OUString::createFromAscii( szServiceName_UnoControlProgressBarModel );
    4437             : }
    4438             : 
    4439          65 : uno::Any UnoControlProgressBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    4440             : {
    4441          65 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    4442             :     {
    4443           5 :         uno::Any aAny;
    4444           5 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlProgressBar );
    4445           5 :         return aAny;
    4446             :     }
    4447             : 
    4448          60 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    4449             : }
    4450             : 
    4451         372 : ::cppu::IPropertyArrayHelper& UnoControlProgressBarModel::getInfoHelper()
    4452             : {
    4453             :     static UnoPropertyArrayHelper* pHelper = NULL;
    4454         372 :     if ( !pHelper )
    4455             :     {
    4456           1 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    4457           1 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    4458             :     }
    4459         372 :     return *pHelper;
    4460             : }
    4461             : 
    4462             : // beans::XMultiPropertySet
    4463          14 : uno::Reference< beans::XPropertySetInfo > UnoControlProgressBarModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    4464             : {
    4465          14 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    4466          14 :     return xInfo;
    4467             : }
    4468             : 
    4469             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4470           3 : stardiv_Toolkit_UnoControlProgressBarModel_get_implementation(
    4471             :     css::uno::XComponentContext *context,
    4472             :     css::uno::Sequence<css::uno::Any> const &)
    4473             : {
    4474           3 :     return cppu::acquire(new UnoControlProgressBarModel(context));
    4475             : }
    4476             : 
    4477             : 
    4478             : //  class UnoProgressBarControl
    4479             : 
    4480           0 : UnoProgressBarControl::UnoProgressBarControl()
    4481           0 :     :UnoControlBase()
    4482             : {
    4483           0 : }
    4484             : 
    4485           0 : OUString UnoProgressBarControl::GetComponentServiceName()
    4486             : {
    4487           0 :     return OUString("ProgressBar");
    4488             : }
    4489             : 
    4490             : // uno::XInterface
    4491           0 : uno::Any UnoProgressBarControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
    4492             : {
    4493             :     uno::Any aRet = ::cppu::queryInterface( rType,
    4494           0 :                                         (static_cast< awt::XProgressBar* >(this)) );
    4495           0 :     return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
    4496             : }
    4497             : 
    4498             : // lang::XTypeProvider
    4499           0 : IMPL_XTYPEPROVIDER_START( UnoProgressBarControl )
    4500           0 :     getCppuType( ( uno::Reference< awt::XProgressBar>* ) NULL ),
    4501             :     UnoControlBase::getTypes()
    4502           0 : IMPL_XTYPEPROVIDER_END
    4503             : 
    4504             : // ::com::sun::star::awt::XProgressBar
    4505           0 : void UnoProgressBarControl::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    4506             : {
    4507           0 :     uno::Any aAny;
    4508           0 :     aAny <<= nColor;
    4509           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_FILLCOLOR ), aAny, true );
    4510           0 : }
    4511             : 
    4512           0 : void UnoProgressBarControl::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    4513             : {
    4514           0 :     uno::Any aAny;
    4515           0 :     aAny <<= nColor;
    4516           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BACKGROUNDCOLOR ), aAny, true );
    4517           0 : }
    4518             : 
    4519           0 : void UnoProgressBarControl::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    4520             : {
    4521           0 :     uno::Any aAny;
    4522           0 :     aAny <<= nValue;
    4523           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE ), aAny, true );
    4524           0 : }
    4525             : 
    4526           0 : void UnoProgressBarControl::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException, std::exception )
    4527             : {
    4528           0 :     uno::Any aMin;
    4529           0 :     uno::Any aMax;
    4530             : 
    4531           0 :     if ( nMin < nMax )
    4532             :     {
    4533             :         // take correct min and max
    4534           0 :         aMin <<= nMin;
    4535           0 :         aMax <<= nMax;
    4536             :     }
    4537             :     else
    4538             :     {
    4539             :         // change min and max
    4540           0 :         aMin <<= nMax;
    4541           0 :         aMax <<= nMin;
    4542             :     }
    4543             : 
    4544           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MIN ), aMin, true );
    4545           0 :     ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MAX ), aMax, true );
    4546           0 : }
    4547             : 
    4548           0 : sal_Int32 UnoProgressBarControl::getValue() throw(::com::sun::star::uno::RuntimeException, std::exception)
    4549             : {
    4550           0 :     return ImplGetPropertyValue_INT32( BASEPROPERTY_PROGRESSVALUE );
    4551             : }
    4552             : 
    4553             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4554           0 : stardiv_Toolkit_UnoProgressBarControl_get_implementation(
    4555             :     css::uno::XComponentContext *,
    4556             :     css::uno::Sequence<css::uno::Any> const &)
    4557             : {
    4558           0 :     return cppu::acquire(new UnoProgressBarControl());
    4559             : }
    4560             : 
    4561             : 
    4562             : //  class UnoControlFixedLineModel
    4563             : 
    4564           4 : UnoControlFixedLineModel::UnoControlFixedLineModel( const Reference< XComponentContext >& rxContext )
    4565           4 :     :UnoControlModel( rxContext )
    4566             : {
    4567           4 :     ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
    4568           4 :     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
    4569           4 :     ImplRegisterProperty( BASEPROPERTY_ENABLED );
    4570           4 :     ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
    4571           4 :     ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
    4572           4 :     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
    4573           4 :     ImplRegisterProperty( BASEPROPERTY_HELPURL );
    4574           4 :     ImplRegisterProperty( BASEPROPERTY_LABEL );
    4575           4 :     ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
    4576           4 :     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
    4577           4 : }
    4578             : 
    4579           1 : OUString UnoControlFixedLineModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
    4580             : {
    4581           1 :     return OUString::createFromAscii( szServiceName_UnoControlFixedLineModel );
    4582             : }
    4583             : 
    4584          70 : uno::Any UnoControlFixedLineModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
    4585             : {
    4586          70 :     if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
    4587             :     {
    4588           5 :         uno::Any aAny;
    4589           5 :         aAny <<= OUString::createFromAscii( szServiceName_UnoControlFixedLine );
    4590           5 :         return aAny;
    4591             :     }
    4592          65 :     return UnoControlModel::ImplGetDefaultValue( nPropId );
    4593             : }
    4594             : 
    4595         731 : ::cppu::IPropertyArrayHelper& UnoControlFixedLineModel::getInfoHelper()
    4596             : {
    4597             :     static UnoPropertyArrayHelper* pHelper = NULL;
    4598         731 :     if ( !pHelper )
    4599             :     {
    4600           1 :         uno::Sequence<sal_Int32>    aIDs = ImplGetPropertyIds();
    4601           1 :         pHelper = new UnoPropertyArrayHelper( aIDs );
    4602             :     }
    4603         731 :     return *pHelper;
    4604             : }
    4605             : 
    4606             : // beans::XMultiPropertySet
    4607          34 : uno::Reference< beans::XPropertySetInfo > UnoControlFixedLineModel::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
    4608             : {
    4609          34 :     static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
    4610          34 :     return xInfo;
    4611             : }
    4612             : 
    4613             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4614           3 : stardiv_Toolkit_UnoControlFixedLineModel_get_implementation(
    4615             :     css::uno::XComponentContext *context,
    4616             :     css::uno::Sequence<css::uno::Any> const &)
    4617             : {
    4618           3 :     return cppu::acquire(new UnoControlFixedLineModel(context));
    4619             : }
    4620             : 
    4621             : 
    4622             : //  class UnoFixedLineControl
    4623             : 
    4624           0 : UnoFixedLineControl::UnoFixedLineControl()
    4625           0 :     :UnoControlBase()
    4626             : {
    4627           0 :     maComponentInfos.nWidth = 100;      // ??
    4628           0 :     maComponentInfos.nHeight = 100;     // ??
    4629           0 : }
    4630             : 
    4631           0 : OUString UnoFixedLineControl::GetComponentServiceName()
    4632             : {
    4633           0 :     return OUString("FixedLine");
    4634             : }
    4635             : 
    4636           0 : sal_Bool UnoFixedLineControl::isTransparent() throw(uno::RuntimeException, std::exception)
    4637             : {
    4638           0 :     return sal_True;
    4639             : }
    4640             : 
    4641             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
    4642           0 : stardiv_Toolkit_UnoFixedLineControl_get_implementation(
    4643             :     css::uno::XComponentContext *,
    4644             :     css::uno::Sequence<css::uno::Any> const &)
    4645             : {
    4646           0 :     return cppu::acquire(new UnoFixedLineControl());
    4647             : }
    4648             : 
    4649             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10