LCOV - code coverage report
Current view: top level - toolkit/source/controls - roadmapcontrol.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 75 283 26.5 %
Date: 2015-06-13 12:38:46 Functions: 15 48 31.2 %
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             : 
      21             : #include <toolkit/controls/roadmapcontrol.hxx>
      22             : #include <toolkit/helper/property.hxx>
      23             : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      24             : #include <com/sun/star/uno/XComponentContext.hpp>
      25             : #include <osl/diagnose.h>
      26             : 
      27             : #include "helper/unopropertyarrayhelper.hxx"
      28             : 
      29             : namespace toolkit
      30             : {
      31             : 
      32             : 
      33             :     using namespace ::com::sun::star::uno;
      34             :     using namespace ::com::sun::star::awt;
      35             :     using namespace ::com::sun::star::lang;
      36             :     using namespace ::com::sun::star::beans;
      37             :     using namespace ::com::sun::star::container;
      38             : 
      39             : 
      40             : //  helper
      41             : 
      42             : 
      43           0 : static void lcl_throwIllegalArgumentException( )
      44             : {   // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
      45           0 :     throw IllegalArgumentException();
      46             : }
      47             : 
      48           0 : static void lcl_throwIndexOutOfBoundsException( )
      49             : {   // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
      50           0 :     throw IndexOutOfBoundsException();
      51             : }
      52             : 
      53             : 
      54             :     // = UnoControlRoadmapModel
      55             : 
      56             : 
      57           1 :     UnoControlRoadmapModel::UnoControlRoadmapModel( const Reference< XComponentContext >& i_factory )
      58             :         :UnoControlRoadmapModel_Base( i_factory )
      59           1 :         ,maContainerListeners( *this )
      60             :     {
      61           1 :         ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
      62           1 :         ImplRegisterProperty( BASEPROPERTY_BORDER );
      63           1 :         ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
      64           1 :         ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
      65           1 :         ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
      66           1 :         ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
      67           1 :         ImplRegisterProperty( BASEPROPERTY_HELPURL );
      68           1 :         ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
      69           1 :         ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
      70           1 :         ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
      71           1 :         ImplRegisterProperty( BASEPROPERTY_COMPLETE );
      72           1 :         ImplRegisterProperty( BASEPROPERTY_ACTIVATED );
      73           1 :         ImplRegisterProperty( BASEPROPERTY_CURRENTITEMID );
      74           1 :         ImplRegisterProperty( BASEPROPERTY_TABSTOP );
      75           1 :         ImplRegisterProperty( BASEPROPERTY_TEXT );
      76           1 :     }
      77             : 
      78             : 
      79           0 :     OUString UnoControlRoadmapModel::getServiceName() throw(RuntimeException, std::exception)
      80             :     {
      81           0 :         return OUString::createFromAscii( szServiceName_UnoControlRoadmapModel );
      82             :     }
      83             : 
      84           1 :     OUString UnoControlRoadmapModel::getImplementationName()
      85             :         throw (css::uno::RuntimeException, std::exception)
      86             :     {
      87           1 :         return OUString("stardiv.Toolkit.UnoControlRoadmapModel");
      88             :     }
      89             : 
      90             :     css::uno::Sequence<OUString>
      91           1 :     UnoControlRoadmapModel::getSupportedServiceNames()
      92             :         throw (css::uno::RuntimeException, std::exception)
      93             :     {
      94           1 :         auto s(UnoControlRoadmapModel_Base::getSupportedServiceNames());
      95           1 :         s.realloc(s.getLength() + 2);
      96           1 :         s[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmapModel";
      97           1 :         s[s.getLength() - 1] = "stardiv.vcl.controlmodel.Roadmap";
      98           1 :         return s;
      99             :     }
     100             : 
     101          19 :     Any UnoControlRoadmapModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     102             :     {
     103          19 :         Any aReturn;
     104          19 :         switch (nPropId)
     105             :         {
     106             :                 case BASEPROPERTY_COMPLETE:
     107           1 :                     aReturn <<= true;
     108           1 :                     break;
     109             :                 case BASEPROPERTY_ACTIVATED:
     110           1 :                     aReturn <<= true;
     111           1 :                     break;
     112             :                 case BASEPROPERTY_CURRENTITEMID:
     113           1 :                     aReturn <<= (sal_Int16) -1;
     114           1 :                     break;
     115             :                 case BASEPROPERTY_TEXT:
     116           1 :                    break;
     117             :                 case BASEPROPERTY_BORDER:
     118           1 :                     aReturn <<= (sal_Int16) 2;              // No Border
     119           1 :                     break;
     120             :                 case BASEPROPERTY_DEFAULTCONTROL:
     121           1 :                     aReturn <<= OUString( OUString::createFromAscii( szServiceName_UnoControlRoadmap ) );
     122           1 :                     break;
     123          13 :             default : aReturn = UnoControlRoadmapModel_Base::ImplGetDefaultValue( nPropId ); break;
     124             :         }
     125             : 
     126          19 :         return aReturn;
     127             :     }
     128             : 
     129             : 
     130           0 :     Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstance(  ) throw (Exception, ::com::sun::star::uno::RuntimeException, std::exception)
     131             :     {
     132           0 :         ORoadmapEntry* pRoadmapItem = new ORoadmapEntry();
     133           0 :         Reference< XInterface > xNewRoadmapItem = static_cast<cppu::OWeakObject*>(pRoadmapItem);
     134           0 :         return xNewRoadmapItem;
     135             :     }
     136             : 
     137             : 
     138           0 :     Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstanceWithArguments( const Sequence< Any >& /*aArguments*/ ) throw (Exception, RuntimeException, std::exception)
     139             :     {
     140             :         // Todo: implementation of the arguments handling
     141           0 :         ORoadmapEntry* pRoadmapItem = new ORoadmapEntry();
     142           0 :         Reference< XInterface > xNewRoadmapItem = static_cast<cppu::OWeakObject*>(pRoadmapItem);
     143           0 :         return xNewRoadmapItem;
     144             :     }
     145             : 
     146             : 
     147           0 :  IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, UnoControlRoadmapModel_IBase )
     148             : 
     149             : 
     150             : 
     151           3 :     ::com::sun::star::uno::Any  SAL_CALL UnoControlRoadmapModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     152             :     {
     153           3 :         Any aRet = UnoControlRoadmapModel_Base::queryAggregation( rType );
     154           3 :         if ( !aRet.hasValue() )
     155           0 :             aRet = UnoControlRoadmapModel_IBase::queryInterface( rType );
     156           3 :          return aRet;
     157             :     }
     158             : 
     159             : 
     160             : 
     161           0 :     ::cppu::IPropertyArrayHelper& UnoControlRoadmapModel::getInfoHelper()
     162             :     {
     163             :         static UnoPropertyArrayHelper* pHelper = NULL;
     164           0 :         if ( !pHelper )
     165             :         {
     166           0 :             Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
     167           0 :             pHelper = new UnoPropertyArrayHelper( aIDs );
     168             :         }
     169           0 :         return *pHelper;
     170             :     }
     171             : 
     172             : 
     173             :     // beans::XMultiPropertySet
     174             : 
     175           0 :     Reference< XPropertySetInfo > UnoControlRoadmapModel::getPropertySetInfo(  ) throw(RuntimeException, std::exception)
     176             :     {
     177           0 :         static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     178           0 :         return xInfo;
     179             :     }
     180             : 
     181             : 
     182           0 :     sal_Int32 SAL_CALL UnoControlRoadmapModel::getCount() throw(RuntimeException, std::exception)
     183             :     {
     184           0 :         return maRoadmapItems.size();
     185             :     }
     186             : 
     187           0 :     Any SAL_CALL UnoControlRoadmapModel::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception )
     188             :     {
     189           0 :         if (( Index >= (sal_Int32)maRoadmapItems.size()) || (Index < 0))
     190           0 :             lcl_throwIndexOutOfBoundsException( );
     191           0 :         Any aAny;
     192           0 :         aAny = makeAny( maRoadmapItems.at( Index ));
     193           0 :         return aAny;
     194             :     }
     195             : 
     196             : 
     197             : 
     198           0 :     void UnoControlRoadmapModel::MakeRMItemValidation( sal_Int32 Index, Reference< XInterface > xRoadmapItem )
     199             :     {
     200           0 :         if ((Index > (sal_Int32)maRoadmapItems.size()) || ( Index < 0 ) )
     201           0 :             lcl_throwIndexOutOfBoundsException( );
     202           0 :         if ( !xRoadmapItem.is() )
     203           0 :             lcl_throwIllegalArgumentException();
     204           0 :         Reference< XServiceInfo > xServiceInfo( xRoadmapItem, UNO_QUERY );
     205           0 :         bool bIsRoadmapItem = xServiceInfo->supportsService("com.sun.star.awt.RoadmapItem");
     206           0 :         if ( !bIsRoadmapItem )
     207           0 :             lcl_throwIllegalArgumentException();
     208           0 :     }
     209             : 
     210             : 
     211           0 :     void UnoControlRoadmapModel::SetRMItemDefaultProperties( const sal_Int32 , Reference< XInterface > xRoadmapItem)
     212             :     {
     213           0 :         Any aAny;
     214           0 :         Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY );
     215           0 :         Reference< XPropertySet > xProps( xRoadmapItem, UNO_QUERY );
     216           0 :         if ( xProps.is() )
     217             :         {
     218           0 :             sal_Int32 LocID = 0;
     219           0 :             Any aValue = xPropertySet->getPropertyValue("ID");
     220           0 :             aValue >>= LocID;
     221           0 :             if (LocID < 0)              // index may not be smaller than zero
     222             :             {
     223           0 :                 aAny <<= GetUniqueID();
     224           0 :                 xPropertySet->setPropertyValue("ID", aAny );
     225           0 :             }
     226           0 :         }
     227           0 :     }
     228             : 
     229             : 
     230             : // The performance of this method could certainly be improved.
     231             : // As long as only vectors with up to 10 elements are
     232             : // involved it should be sufficient
     233           0 :        sal_Int32 UnoControlRoadmapModel::GetUniqueID()
     234             :       {
     235           0 :           Any aAny;
     236           0 :           bool bIncrement = true;
     237           0 :           sal_Int32 CurID = 0;
     238           0 :           sal_Int32 n_CurItemID = 0;
     239           0 :           Reference< XInterface > CurRoadmapItem;
     240           0 :           while ( bIncrement )
     241             :           {
     242           0 :               bIncrement = false;
     243           0 :               for ( RoadmapItemHolderList::iterator i = maRoadmapItems.begin(); i < maRoadmapItems.end(); ++i )
     244             :               {
     245           0 :                 CurRoadmapItem = *i;
     246           0 :                 Reference< XPropertySet > xPropertySet( CurRoadmapItem, UNO_QUERY );
     247           0 :                 aAny = xPropertySet->getPropertyValue("ID");
     248           0 :                 aAny >>= n_CurItemID;
     249           0 :                 if (n_CurItemID == CurID)
     250             :                 {
     251           0 :                     bIncrement = true;
     252           0 :                     CurID++;
     253           0 :                     break;
     254             :                 }
     255           0 :             }
     256             :         }
     257           0 :         return CurID;
     258             :     }
     259             : 
     260             : 
     261           0 :     ContainerEvent UnoControlRoadmapModel::GetContainerEvent(sal_Int32 Index, Reference< XInterface > xRoadmapItem)
     262             :     {
     263           0 :         ContainerEvent aEvent;
     264           0 :         aEvent.Source = *this;
     265           0 :         aEvent.Element <<= xRoadmapItem;
     266           0 :         aEvent.Accessor = makeAny(Index);
     267           0 :         return aEvent;
     268             :     }
     269             : 
     270             : 
     271           0 :     sal_Int16 UnoControlRoadmapModel::GetCurrentItemID( Reference< XPropertySet > xPropertySet )
     272             :     {
     273           0 :         Any aAny = xPropertySet->getPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ) );
     274           0 :         sal_Int16 n_CurrentItemID = 0;
     275           0 :         aAny >>= n_CurrentItemID;
     276           0 :         return n_CurrentItemID;
     277             :     }
     278             : 
     279             : 
     280           0 :     void SAL_CALL UnoControlRoadmapModel::insertByIndex( const sal_Int32 Index, const Any& _Element)
     281             :                                     throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception )
     282             :     {
     283           0 :         if ( ( Index >= ( (sal_Int32)maRoadmapItems.size() + 1 ) ) || (Index < 0))
     284           0 :             lcl_throwIndexOutOfBoundsException( );
     285           0 :         Reference< XInterface > xRoadmapItem;
     286           0 :         _Element >>= xRoadmapItem;
     287           0 :         MakeRMItemValidation( Index, xRoadmapItem);
     288           0 :         SetRMItemDefaultProperties( Index, xRoadmapItem );
     289           0 :         maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem);
     290           0 :         ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
     291           0 :         maContainerListeners.elementInserted( aEvent );
     292           0 :         Reference< XPropertySet > xPropertySet( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY );
     293           0 :         sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
     294           0 :         if ( Index <= n_CurrentItemID )
     295             :         {
     296           0 :             Any aAny;
     297           0 :             aAny <<= ( sal_Int16 ) ( n_CurrentItemID + 1 );
     298           0 :             xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
     299           0 :         }
     300           0 :     }
     301             : 
     302             : 
     303             : 
     304           0 :     void SAL_CALL UnoControlRoadmapModel::removeByIndex( sal_Int32 Index)
     305             :                                                 throw    (IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception )
     306             :     {
     307           0 :         if (( Index > (sal_Int32)maRoadmapItems.size()) || (Index < 0))
     308           0 :             lcl_throwIndexOutOfBoundsException( );
     309           0 :         Reference< XInterface > xRoadmapItem;
     310           0 :         maRoadmapItems.erase( maRoadmapItems.begin() + Index );
     311           0 :         ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
     312           0 :         maContainerListeners.elementRemoved( aEvent );
     313           0 :         Reference< XPropertySet > xPropertySet( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY );
     314           0 :         sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
     315           0 :         Any aAny;
     316           0 :         if ( Index <= n_CurrentItemID )
     317             :         {
     318           0 :             if ( n_CurrentItemID >= (sal_Int32)maRoadmapItems.size() )
     319             :             {
     320             :                 n_CurrentItemID = sal::static_int_cast< sal_Int16 >(
     321           0 :                     maRoadmapItems.size()-1);
     322           0 :                 if ( n_CurrentItemID < 0 )
     323           0 :                     return;
     324           0 :                 aAny <<= n_CurrentItemID;
     325             :             }
     326           0 :             else if (Index == n_CurrentItemID)
     327           0 :                 aAny <<= ( sal_Int16 ) -1;
     328           0 :             else if( Index < n_CurrentItemID)
     329           0 :                 aAny <<= ( sal_Int16 ) ( n_CurrentItemID - 1 );
     330           0 :             xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
     331           0 :         }
     332             :     }
     333             : 
     334             : 
     335           0 :     void SAL_CALL UnoControlRoadmapModel::replaceByIndex( const sal_Int32 Index, const Any& _Element)
     336             :                                 throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception )
     337             :     {
     338           0 :         Reference< XInterface > xRoadmapItem;
     339           0 :         _Element >>= xRoadmapItem;
     340           0 :         MakeRMItemValidation( Index, xRoadmapItem);
     341           0 :         SetRMItemDefaultProperties( Index, xRoadmapItem );
     342           0 :         maRoadmapItems.erase( maRoadmapItems.begin() + Index );
     343           0 :         maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem);        //push_back( xRoadmapItem );
     344           0 :         ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
     345           0 :         maContainerListeners.elementReplaced( aEvent );
     346           0 :     }
     347             : 
     348             : 
     349           0 :     Type SAL_CALL UnoControlRoadmapModel::getElementType() throw(RuntimeException, std::exception)
     350             :     {
     351           0 :         Type aType = cppu::UnoType<XPropertySet>::get();
     352           0 :         return aType;
     353             :     }
     354             : 
     355             : 
     356           0 :     sal_Bool SAL_CALL UnoControlRoadmapModel::hasElements() throw(RuntimeException, std::exception)
     357             :     {
     358           0 :         return !maRoadmapItems.empty();
     359             :     }
     360             : 
     361             : 
     362           0 :     void SAL_CALL UnoControlRoadmapModel::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     363             :     {
     364           0 :         maContainerListeners.addInterface( xListener );
     365           0 :     }
     366             : 
     367           0 :     void SAL_CALL UnoControlRoadmapModel::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     368             :     {
     369           0 :         maContainerListeners.removeInterface( xListener );
     370           0 :     }
     371             : 
     372             : 
     373             :     // = UnoRoadmapControl
     374             : 
     375             : 
     376           1 :     UnoRoadmapControl::UnoRoadmapControl()
     377             :         :UnoControlRoadmap_Base()
     378           1 :         ,maItemListeners( *this )
     379             :     {
     380           1 :     }
     381             : 
     382           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase )
     383          23 : IMPLEMENT_FORWARD_XINTERFACE2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase )
     384             : 
     385             : 
     386           1 : sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& _rModel) throw ( RuntimeException, std::exception )
     387             :     {
     388             : 
     389             : 
     390           1 :            Reference< XContainer > xC( getModel(), UNO_QUERY );
     391           1 :         if ( xC.is() )
     392           0 :             xC->removeContainerListener( this );
     393             : 
     394           1 :         bool bReturn = UnoControlBase::setModel( _rModel );
     395             : 
     396           1 :         xC.set(getModel(), css::uno::UNO_QUERY);
     397           1 :         if ( xC.is() )
     398           0 :             xC->addContainerListener( this );
     399             : 
     400           1 :         return bReturn;
     401             :     }
     402             : 
     403             : 
     404             : 
     405           0 :     OUString UnoRoadmapControl::GetComponentServiceName()
     406             :     {
     407           0 :         return OUString("Roadmap");
     408             :     }
     409             : 
     410             : 
     411             : 
     412           1 :     void UnoRoadmapControl::dispose() throw(RuntimeException, std::exception)
     413             :     {
     414           1 :         EventObject aEvt;
     415           1 :         aEvt.Source = static_cast<cppu::OWeakObject*>(this);
     416           1 :         maItemListeners.disposeAndClear( aEvt );
     417           1 :         UnoControl::dispose();
     418           1 :     }
     419             : 
     420             : 
     421             : 
     422           0 : void UnoRoadmapControl::elementInserted( const ContainerEvent& rEvent )throw(RuntimeException, std::exception)
     423             : {
     424           0 :     Reference< XInterface > xRoadmapItem;
     425           0 :     rEvent.Element >>= xRoadmapItem;
     426           0 :     Reference< XPropertySet > xRoadmapPropertySet( xRoadmapItem, UNO_QUERY );
     427           0 :     if ( xRoadmapPropertySet.is() )
     428           0 :         xRoadmapPropertySet->addPropertyChangeListener( OUString(), this );
     429             : 
     430           0 :     Reference< XContainerListener >  xPeer(getPeer(), UNO_QUERY);
     431           0 :     if ( xPeer.is() )
     432             :     {
     433           0 :         xPeer->elementInserted( rEvent );
     434           0 :         Reference < XPropertySet > xPropertySet( xPeer, UNO_QUERY );
     435           0 :         if ( xPropertySet.is() )
     436           0 :             xPropertySet->addPropertyChangeListener( OUString(), this );
     437           0 :     }
     438           0 : }
     439             : 
     440             : 
     441           0 : void UnoRoadmapControl::elementRemoved( const ContainerEvent& rEvent )throw(RuntimeException, std::exception)
     442             : {
     443           0 :     Reference< XContainerListener >  xPeer(getPeer(), UNO_QUERY);
     444           0 :     if ( xPeer.is() )
     445           0 :         xPeer->elementRemoved( rEvent );
     446           0 :     Reference< XInterface > xRoadmapItem;
     447           0 :     rEvent.Element >>= xRoadmapItem;
     448           0 :     Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY );
     449           0 :     if ( xPropertySet.is() )
     450           0 :         xPropertySet->removePropertyChangeListener( OUString(), this );
     451           0 : }
     452             : 
     453             : 
     454           0 : void UnoRoadmapControl::elementReplaced( const ContainerEvent& rEvent )throw(RuntimeException, std::exception)
     455             : {
     456           0 :     Reference< XContainerListener >  xPeer(getPeer(), UNO_QUERY);
     457           0 :     if ( xPeer.is() )
     458           0 :         xPeer->elementReplaced( rEvent );
     459           0 : }
     460             : 
     461             : 
     462           0 : void SAL_CALL UnoRoadmapControl::itemStateChanged( const ItemEvent& rEvent ) throw (RuntimeException, std::exception)
     463             : {
     464           0 :     sal_Int16 CurItemIndex = sal::static_int_cast< sal_Int16 >(rEvent.ItemId);
     465           0 :     Any aAny;
     466           0 :     aAny <<= CurItemIndex;
     467           0 :     Reference< XControlModel > xModel( getModel( ), UNO_QUERY );
     468           0 :     Reference< XPropertySet > xPropertySet( xModel, UNO_QUERY );
     469           0 :     xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
     470           0 :     if ( maItemListeners.getLength() )
     471           0 :         maItemListeners.itemStateChanged( rEvent );
     472           0 : }
     473             : 
     474             : 
     475           0 : void SAL_CALL UnoRoadmapControl::addItemListener( const Reference< XItemListener >& l ) throw (RuntimeException, std::exception)
     476             : {
     477           0 :     maItemListeners.addInterface( l );
     478           0 :     if( getPeer().is() && maItemListeners.getLength() == 1 )
     479             :     {
     480           0 :         Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY );
     481           0 :         xRoadmap->addItemListener( this );
     482             :     }
     483           0 : }
     484             : 
     485             : 
     486           0 : void SAL_CALL UnoRoadmapControl::removeItemListener( const Reference< XItemListener >& l ) throw (RuntimeException, std::exception)
     487             : {
     488           0 :     if( getPeer().is() && maItemListeners.getLength() == 1 )
     489             :     {
     490           0 :         Reference < XItemEventBroadcaster >  xRoadmap( getPeer(), UNO_QUERY );
     491           0 :         xRoadmap->removeItemListener( this );
     492             :     }
     493             : 
     494           0 :     maItemListeners.removeInterface( l );
     495           0 : }
     496             : 
     497             : 
     498           0 : void SAL_CALL UnoRoadmapControl::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException, std::exception)
     499             : {
     500           0 :     Reference< XPropertyChangeListener >  xPeer(getPeer(), UNO_QUERY);
     501           0 :     if ( xPeer.is() )
     502           0 :         xPeer->propertyChange( evt );
     503           0 : }
     504             : 
     505           1 : OUString UnoRoadmapControl::getImplementationName()
     506             :     throw (css::uno::RuntimeException, std::exception)
     507             : {
     508           1 :     return OUString("stardiv.Toolkit.UnoRoadmapControl");
     509             : }
     510             : 
     511           1 : css::uno::Sequence<OUString> UnoRoadmapControl::getSupportedServiceNames()
     512             :     throw (css::uno::RuntimeException, std::exception)
     513             : {
     514           1 :     auto s(UnoControlBase::getSupportedServiceNames());
     515           1 :     s.realloc(s.getLength() + 2);
     516           1 :     s[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmap";
     517           1 :     s[s.getLength() - 1] = "stardiv.vcl.control.Roadmap";
     518           1 :     return s;
     519             : }
     520             : 
     521             : }
     522             : 
     523             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     524           1 : stardiv_Toolkit_UnoControlRoadmapModel_get_implementation(
     525             :     css::uno::XComponentContext *context,
     526             :     css::uno::Sequence<css::uno::Any> const &)
     527             : {
     528           1 :     return cppu::acquire(new toolkit::UnoControlRoadmapModel(context));
     529             : }
     530             : 
     531             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     532           1 : stardiv_Toolkit_UnoRoadmapControl_get_implementation(
     533             :     css::uno::XComponentContext *,
     534             :     css::uno::Sequence<css::uno::Any> const &)
     535             : {
     536           1 :     return cppu::acquire(new toolkit::UnoRoadmapControl());
     537             : }
     538             : 
     539             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11