1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_chart2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "UpDownBarWrapper.hxx" 32*cdf0e10cSrcweir #include "macros.hxx" 33*cdf0e10cSrcweir #include "Chart2ModelContact.hxx" 34*cdf0e10cSrcweir #include "DiagramHelper.hxx" 35*cdf0e10cSrcweir #include "servicenames_charttypes.hxx" 36*cdf0e10cSrcweir #include "ContainerHelper.hxx" 37*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartType.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeriesContainer.hpp> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "LineProperties.hxx" 41*cdf0e10cSrcweir #include "FillProperties.hxx" 42*cdf0e10cSrcweir // #include "NamedProperties.hxx" 43*cdf0e10cSrcweir #include "UserDefinedProperties.hxx" 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir using namespace ::com::sun::star; 46*cdf0e10cSrcweir using namespace ::com::sun::star::chart2; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir using ::com::sun::star::beans::Property; 49*cdf0e10cSrcweir using ::osl::MutexGuard; 50*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 51*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 52*cdf0e10cSrcweir using ::com::sun::star::uno::Any; 53*cdf0e10cSrcweir using ::rtl::OUString; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir namespace 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir static const OUString lcl_aServiceName( 58*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartArea" )); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir struct StaticUpDownBarWrapperPropertyArray_Initializer 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir Sequence< Property >* operator()() 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); 65*cdf0e10cSrcweir return &aPropSeq; 66*cdf0e10cSrcweir } 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir private: 69*cdf0e10cSrcweir Sequence< Property > lcl_GetPropertySequence() 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir ::std::vector< ::com::sun::star::beans::Property > aProperties; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir ::chart::LineProperties::AddPropertiesToVector( aProperties ); 74*cdf0e10cSrcweir ::chart::FillProperties::AddPropertiesToVector( aProperties ); 75*cdf0e10cSrcweir //::chart::NamedProperties::AddPropertiesToVector( aProperties ); 76*cdf0e10cSrcweir ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir ::std::sort( aProperties.begin(), aProperties.end(), 79*cdf0e10cSrcweir ::chart::PropertyNameLess() ); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir return ::chart::ContainerHelper::ContainerToSequence( aProperties ); 82*cdf0e10cSrcweir } 83*cdf0e10cSrcweir }; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir struct StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer > 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir }; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir struct StaticUpDownBarWrapperInfoHelper_Initializer 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir ::cppu::OPropertyArrayHelper* operator()() 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() ); 94*cdf0e10cSrcweir return &aPropHelper; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir }; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer > 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir }; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir struct StaticUpDownBarWrapperInfo_Initializer 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo >* operator()() 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( 107*cdf0e10cSrcweir ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) ); 108*cdf0e10cSrcweir return &xPropertySetInfo; 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir }; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer > 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir }; 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir struct StaticUpDownBarWrapperDefaults_Initializer 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir ::chart::tPropertyValueMap* operator()() 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir static ::chart::tPropertyValueMap aStaticDefaults; 121*cdf0e10cSrcweir lcl_AddDefaultsToMap( aStaticDefaults ); 122*cdf0e10cSrcweir return &aStaticDefaults; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir private: 125*cdf0e10cSrcweir void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir ::chart::LineProperties::AddDefaultsToMap( rOutMap ); 128*cdf0e10cSrcweir ::chart::FillProperties::AddDefaultsToMap( rOutMap ); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir }; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer > 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir }; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir } // anonymous namespace 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir // -------------------------------------------------------------------------------- 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir namespace chart 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir namespace wrapper 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir UpDownBarWrapper::UpDownBarWrapper( 146*cdf0e10cSrcweir bool bUp, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 147*cdf0e10cSrcweir : m_spChart2ModelContact( spChart2ModelContact ) 148*cdf0e10cSrcweir , m_aEventListenerContainer( m_aMutex ) 149*cdf0e10cSrcweir , m_aPropertySetName( bUp ? C2U("WhiteDay") : C2U("BlackDay") ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir UpDownBarWrapper::~UpDownBarWrapper() 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir // ____ XComponent ____ 158*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::dispose() 159*cdf0e10cSrcweir throw (uno::RuntimeException) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); 162*cdf0e10cSrcweir m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::addEventListener( 166*cdf0e10cSrcweir const Reference< lang::XEventListener >& xListener ) 167*cdf0e10cSrcweir throw (uno::RuntimeException) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir m_aEventListenerContainer.addInterface( xListener ); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::removeEventListener( 173*cdf0e10cSrcweir const Reference< lang::XEventListener >& aListener ) 174*cdf0e10cSrcweir throw (uno::RuntimeException) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir m_aEventListenerContainer.removeInterface( aListener ); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& UpDownBarWrapper::getInfoHelper() 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir return *StaticUpDownBarWrapperInfoHelper::get(); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir //XPropertySet 185*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo() 186*cdf0e10cSrcweir throw (uno::RuntimeException) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir return *StaticUpDownBarWrapperInfo::get(); 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) 191*cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir Reference< beans::XPropertySet > xPropSet(0); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir Sequence< Reference< chart2::XChartType > > aTypes( 196*cdf0e10cSrcweir ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) ); 197*cdf0e10cSrcweir for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir Reference< chart2::XChartType > xType( aTypes[nN] ); 200*cdf0e10cSrcweir if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY ); 203*cdf0e10cSrcweir if(xTypeProps.is()) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir if(xPropSet.is()) 210*cdf0e10cSrcweir xPropSet->setPropertyValue( rPropertyName, rValue ); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName ) 213*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir Any aRet; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir Reference< beans::XPropertySet > xPropSet(0); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir Sequence< Reference< chart2::XChartType > > aTypes( 220*cdf0e10cSrcweir ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) ); 221*cdf0e10cSrcweir for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir Reference< chart2::XChartType > xType( aTypes[nN] ); 224*cdf0e10cSrcweir if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY ); 227*cdf0e10cSrcweir if(xTypeProps.is()) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir if(xPropSet.is()) 234*cdf0e10cSrcweir aRet = xPropSet->getPropertyValue( rPropertyName ); 235*cdf0e10cSrcweir return aRet; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) 239*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) 244*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) 249*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) 254*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir //XMultiPropertySet 260*cdf0e10cSrcweir //getPropertySetInfo() already declared in XPropertySet 261*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq ) 262*cdf0e10cSrcweir throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir bool bUnknownProperty = false; 265*cdf0e10cSrcweir sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() ); 266*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<nMinCount; nN++) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 269*cdf0e10cSrcweir try 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir this->setPropertyValue( aPropertyName, rValueSeq[nN] ); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir catch( beans::UnknownPropertyException& ex ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 276*cdf0e10cSrcweir bUnknownProperty = true; 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir //todo: store unknown properties elsewhere 280*cdf0e10cSrcweir // if( bUnknownProperty ) 281*cdf0e10cSrcweir // throw beans::UnknownPropertyException(); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 284*cdf0e10cSrcweir throw (uno::RuntimeException) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir Sequence< Any > aRetSeq; 287*cdf0e10cSrcweir if( rNameSeq.getLength() ) 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir aRetSeq.realloc( rNameSeq.getLength() ); 290*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 293*cdf0e10cSrcweir aRetSeq[nN] = this->getPropertyValue( aPropertyName ); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir return aRetSeq; 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::addPropertiesChangeListener( const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ ) 299*cdf0e10cSrcweir throw (uno::RuntimeException) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ ) 304*cdf0e10cSrcweir throw (uno::RuntimeException) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::firePropertiesChangeEvent( const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ ) 309*cdf0e10cSrcweir throw (uno::RuntimeException) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir //XPropertyState 315*cdf0e10cSrcweir beans::PropertyState SAL_CALL UpDownBarWrapper::getPropertyState( const ::rtl::OUString& rPropertyName ) 316*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir uno::Any aDefault( this->getPropertyDefault( rPropertyName ) ); 319*cdf0e10cSrcweir uno::Any aValue( this->getPropertyValue( rPropertyName ) ); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir if( aDefault == aValue ) 322*cdf0e10cSrcweir return beans::PropertyState_DEFAULT_VALUE; 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir return beans::PropertyState_DIRECT_VALUE; 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir uno::Sequence< beans::PropertyState > SAL_CALL UpDownBarWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 327*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir Sequence< beans::PropertyState > aRetSeq; 330*cdf0e10cSrcweir if( rNameSeq.getLength() ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir aRetSeq.realloc( rNameSeq.getLength() ); 333*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 336*cdf0e10cSrcweir aRetSeq[nN] = this->getPropertyState( aPropertyName ); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir return aRetSeq; 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName ) 342*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) ); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName ) 348*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get(); 351*cdf0e10cSrcweir tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) ); 352*cdf0e10cSrcweir if( aFound == rStaticDefaults.end() ) 353*cdf0e10cSrcweir return uno::Any(); 354*cdf0e10cSrcweir return (*aFound).second; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir //XMultiPropertyStates 358*cdf0e10cSrcweir //getPropertyStates() already declared in XPropertyState 359*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( ) 360*cdf0e10cSrcweir throw (uno::RuntimeException) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get(); 363*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); 366*cdf0e10cSrcweir this->setPropertyToDefault( aPropertyName ); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir void SAL_CALL UpDownBarWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 370*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 375*cdf0e10cSrcweir this->setPropertyToDefault( aPropertyName ); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 379*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir Sequence< Any > aRetSeq; 382*cdf0e10cSrcweir if( rNameSeq.getLength() ) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir aRetSeq.realloc( rNameSeq.getLength() ); 385*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 388*cdf0e10cSrcweir aRetSeq[nN] = this->getPropertyDefault( aPropertyName ); 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir return aRetSeq; 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir // ================================================================================ 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir Sequence< OUString > UpDownBarWrapper::getSupportedServiceNames_Static() 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir Sequence< OUString > aServices( 4 ); 400*cdf0e10cSrcweir aServices[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartArea" ); 401*cdf0e10cSrcweir aServices[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" ); 402*cdf0e10cSrcweir aServices[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.FillProperties" ); 403*cdf0e10cSrcweir aServices[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir return aServices; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static 409*cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( UpDownBarWrapper, lcl_aServiceName ); 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir } // namespace wrapper 412*cdf0e10cSrcweir } // namespace chart 413