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 "MinMaxLineWrapper.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 #include <com/sun/star/drawing/LineJoint.hpp> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include "LineProperties.hxx" 42*cdf0e10cSrcweir #include "UserDefinedProperties.hxx" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir using namespace ::com::sun::star; 45*cdf0e10cSrcweir using namespace ::com::sun::star::chart2; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir using ::com::sun::star::beans::Property; 48*cdf0e10cSrcweir using ::osl::MutexGuard; 49*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 50*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 51*cdf0e10cSrcweir using ::com::sun::star::uno::Any; 52*cdf0e10cSrcweir using ::rtl::OUString; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir namespace 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir static const OUString lcl_aServiceName( 57*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" )); 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir struct StaticMinMaxLineWrapperDefaults_Initializer 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir ::chart::tPropertyValueMap* operator()() 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir static ::chart::tPropertyValueMap aStaticDefaults; 64*cdf0e10cSrcweir lcl_AddDefaultsToMap( aStaticDefaults ); 65*cdf0e10cSrcweir return &aStaticDefaults; 66*cdf0e10cSrcweir } 67*cdf0e10cSrcweir private: 68*cdf0e10cSrcweir void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir ::chart::LineProperties::AddDefaultsToMap( rOutMap ); 71*cdf0e10cSrcweir } 72*cdf0e10cSrcweir }; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer > 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir }; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir struct StaticMinMaxLineWrapperPropertyArray_Initializer 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir Sequence< Property >* operator()() 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); 83*cdf0e10cSrcweir return &aPropSeq; 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir private: 87*cdf0e10cSrcweir Sequence< Property > lcl_GetPropertySequence() 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir ::std::vector< ::com::sun::star::beans::Property > aProperties; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir ::chart::LineProperties::AddPropertiesToVector( aProperties ); 92*cdf0e10cSrcweir //::chart::NamedLineProperties::AddPropertiesToVector( aProperties ); 93*cdf0e10cSrcweir ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir ::std::sort( aProperties.begin(), aProperties.end(), 96*cdf0e10cSrcweir ::chart::PropertyNameLess() ); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir return ::chart::ContainerHelper::ContainerToSequence( aProperties ); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir }; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir struct StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer > 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir }; 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfoHelper_Initializer 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir ::cppu::OPropertyArrayHelper* operator()() 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() ); 111*cdf0e10cSrcweir return &aPropHelper; 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir }; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer > 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir }; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfo_Initializer 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo >* operator()() 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( 124*cdf0e10cSrcweir ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) ); 125*cdf0e10cSrcweir return &xPropertySetInfo; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir }; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer > 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir }; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir } // anonymous namespace 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir // -------------------------------------------------------------------------------- 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir namespace chart 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir namespace wrapper 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 143*cdf0e10cSrcweir : m_spChart2ModelContact( spChart2ModelContact ) 144*cdf0e10cSrcweir , m_aEventListenerContainer( m_aMutex ) 145*cdf0e10cSrcweir , m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE )) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir MinMaxLineWrapper::~MinMaxLineWrapper() 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir // ____ XComponent ____ 154*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::dispose() 155*cdf0e10cSrcweir throw (uno::RuntimeException) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); 158*cdf0e10cSrcweir m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addEventListener( 162*cdf0e10cSrcweir const Reference< lang::XEventListener >& xListener ) 163*cdf0e10cSrcweir throw (uno::RuntimeException) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir m_aEventListenerContainer.addInterface( xListener ); 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removeEventListener( 169*cdf0e10cSrcweir const Reference< lang::XEventListener >& aListener ) 170*cdf0e10cSrcweir throw (uno::RuntimeException) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir m_aEventListenerContainer.removeInterface( aListener ); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper() 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir return *StaticMinMaxLineWrapperInfoHelper::get(); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir //XPropertySet 181*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo() 182*cdf0e10cSrcweir throw (uno::RuntimeException) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir return *StaticMinMaxLineWrapperInfo::get(); 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) 188*cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir Reference< beans::XPropertySet > xPropSet(0); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 193*cdf0e10cSrcweir Sequence< Reference< chart2::XChartType > > aTypes( 194*cdf0e10cSrcweir ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); 195*cdf0e10cSrcweir for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir Reference< chart2::XChartType > xType( aTypes[nN] ); 198*cdf0e10cSrcweir if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY); 201*cdf0e10cSrcweir if( xSeriesContainer.is() ) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() ); 204*cdf0e10cSrcweir if(aSeriesSeq.getLength()) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY); 207*cdf0e10cSrcweir if(xPropSet.is()) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir if( rPropertyName.equals( C2U("LineColor")) ) 210*cdf0e10cSrcweir xPropSet->setPropertyValue( C2U("Color"), rValue ); 211*cdf0e10cSrcweir else if( rPropertyName.equals( C2U("LineTransparence")) ) 212*cdf0e10cSrcweir xPropSet->setPropertyValue( C2U("Transparency"), rValue ); 213*cdf0e10cSrcweir else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) ) 214*cdf0e10cSrcweir m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet ); 215*cdf0e10cSrcweir else 216*cdf0e10cSrcweir xPropSet->setPropertyValue( rPropertyName, rValue ); 217*cdf0e10cSrcweir return; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName ) 225*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir Any aRet; 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir Reference< beans::XPropertySet > xPropSet(0); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 232*cdf0e10cSrcweir Sequence< Reference< chart2::XChartType > > aTypes( 233*cdf0e10cSrcweir ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); 234*cdf0e10cSrcweir for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir Reference< chart2::XChartType > xType( aTypes[nN] ); 237*cdf0e10cSrcweir if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY); 240*cdf0e10cSrcweir if( xSeriesContainer.is() ) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() ); 243*cdf0e10cSrcweir if(aSeriesSeq.getLength()) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY); 246*cdf0e10cSrcweir break; 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir if(xPropSet.is()) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir if( rPropertyName.equals( C2U("LineColor")) ) 254*cdf0e10cSrcweir aRet = xPropSet->getPropertyValue( C2U("Color") ); 255*cdf0e10cSrcweir else if( rPropertyName.equals( C2U("LineTransparence")) ) 256*cdf0e10cSrcweir aRet = xPropSet->getPropertyValue( C2U("Transparency") ); 257*cdf0e10cSrcweir else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) ) 258*cdf0e10cSrcweir aRet = m_aWrappedLineJointProperty.getPropertyValue( xPropSet ); 259*cdf0e10cSrcweir else 260*cdf0e10cSrcweir aRet = xPropSet->getPropertyValue( rPropertyName ); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir return aRet; 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) 267*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) 272*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) 277*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) 282*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir //XMultiPropertySet 288*cdf0e10cSrcweir //getPropertySetInfo() already declared in XPropertySet 289*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq ) 290*cdf0e10cSrcweir throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir bool bUnknownProperty = false; 293*cdf0e10cSrcweir sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() ); 294*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<nMinCount; nN++) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 297*cdf0e10cSrcweir try 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir this->setPropertyValue( aPropertyName, rValueSeq[nN] ); 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir catch( beans::UnknownPropertyException& ex ) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 304*cdf0e10cSrcweir bUnknownProperty = true; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir //todo: store unknown properties elsewhere 308*cdf0e10cSrcweir // if( bUnknownProperty ) 309*cdf0e10cSrcweir // throw beans::UnknownPropertyException(); 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 312*cdf0e10cSrcweir throw (uno::RuntimeException) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir Sequence< Any > aRetSeq; 315*cdf0e10cSrcweir if( rNameSeq.getLength() ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir aRetSeq.realloc( rNameSeq.getLength() ); 318*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 321*cdf0e10cSrcweir aRetSeq[nN] = this->getPropertyValue( aPropertyName ); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir return aRetSeq; 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addPropertiesChangeListener( 327*cdf0e10cSrcweir const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, 328*cdf0e10cSrcweir const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ ) 329*cdf0e10cSrcweir throw (uno::RuntimeException) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removePropertiesChangeListener( 334*cdf0e10cSrcweir const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ ) 335*cdf0e10cSrcweir throw (uno::RuntimeException) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::firePropertiesChangeEvent( 340*cdf0e10cSrcweir const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, 341*cdf0e10cSrcweir const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ ) 342*cdf0e10cSrcweir throw (uno::RuntimeException) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir OSL_ENSURE(false,"not implemented"); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir //XPropertyState 348*cdf0e10cSrcweir beans::PropertyState SAL_CALL MinMaxLineWrapper::getPropertyState( const ::rtl::OUString& rPropertyName ) 349*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) ) 352*cdf0e10cSrcweir return beans::PropertyState_DEFAULT_VALUE; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir uno::Any aDefault( this->getPropertyDefault( rPropertyName ) ); 355*cdf0e10cSrcweir uno::Any aValue( this->getPropertyValue( rPropertyName ) ); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir if( aDefault == aValue ) 358*cdf0e10cSrcweir return beans::PropertyState_DEFAULT_VALUE; 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir return beans::PropertyState_DIRECT_VALUE; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 363*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir Sequence< beans::PropertyState > aRetSeq; 366*cdf0e10cSrcweir if( rNameSeq.getLength() ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir aRetSeq.realloc( rNameSeq.getLength() ); 369*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 372*cdf0e10cSrcweir aRetSeq[nN] = this->getPropertyState( aPropertyName ); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir return aRetSeq; 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName ) 378*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) ); 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName ) 384*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get(); 387*cdf0e10cSrcweir tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) ); 388*cdf0e10cSrcweir if( aFound == rStaticDefaults.end() ) 389*cdf0e10cSrcweir return uno::Any(); 390*cdf0e10cSrcweir return (*aFound).second; 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir //XMultiPropertyStates 394*cdf0e10cSrcweir //getPropertyStates() already declared in XPropertyState 395*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( ) 396*cdf0e10cSrcweir throw (uno::RuntimeException) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get(); 399*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); 402*cdf0e10cSrcweir this->setPropertyToDefault( aPropertyName ); 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 406*cdf0e10cSrcweir throw (beans::UnknownPropertyException, uno::RuntimeException) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 411*cdf0e10cSrcweir this->setPropertyToDefault( aPropertyName ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq ) 415*cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir Sequence< Any > aRetSeq; 418*cdf0e10cSrcweir if( rNameSeq.getLength() ) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir aRetSeq.realloc( rNameSeq.getLength() ); 421*cdf0e10cSrcweir for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir ::rtl::OUString aPropertyName( rNameSeq[nN] ); 424*cdf0e10cSrcweir aRetSeq[nN] = this->getPropertyDefault( aPropertyName ); 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir return aRetSeq; 428*cdf0e10cSrcweir } 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir // ================================================================================ 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir Sequence< OUString > MinMaxLineWrapper::getSupportedServiceNames_Static() 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir Sequence< OUString > aServices( 3 ); 436*cdf0e10cSrcweir aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLine" ); 437*cdf0e10cSrcweir aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" ); 438*cdf0e10cSrcweir aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" ); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir return aServices; 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static 444*cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( MinMaxLineWrapper, lcl_aServiceName ); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir } // namespace wrapper 447*cdf0e10cSrcweir } // namespace chart 448