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 "CachedDataSequence.hxx" 32*cdf0e10cSrcweir #include "macros.hxx" 33*cdf0e10cSrcweir #include "PropertyHelper.hxx" 34*cdf0e10cSrcweir #include "ContainerHelper.hxx" 35*cdf0e10cSrcweir #include "CommonFunctors.hxx" 36*cdf0e10cSrcweir #include "ModifyListenerHelper.hxx" 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include <algorithm> 41*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 42*cdf0e10cSrcweir #include <rtl/math.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir using namespace ::com::sun::star; 45*cdf0e10cSrcweir using namespace ::chart::ContainerHelper; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 48*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 49*cdf0e10cSrcweir using ::com::sun::star::uno::Any; 50*cdf0e10cSrcweir using ::rtl::OUString; 51*cdf0e10cSrcweir using ::osl::MutexGuard; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir // necessary for MS compiler 54*cdf0e10cSrcweir using ::comphelper::OPropertyContainer; 55*cdf0e10cSrcweir using ::comphelper::OMutexAndBroadcastHelper; 56*cdf0e10cSrcweir using ::comphelper::OPropertyArrayUsageHelper; 57*cdf0e10cSrcweir using ::chart::impl::CachedDataSequence_Base; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir namespace 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir static const OUString lcl_aServiceName( 62*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.CachedDataSequence" )); 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir enum 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir // PROP_SOURCE_IDENTIFIER, 67*cdf0e10cSrcweir PROP_NUMBERFORMAT_KEY, 68*cdf0e10cSrcweir PROP_PROPOSED_ROLE 69*cdf0e10cSrcweir }; 70*cdf0e10cSrcweir } // anonymous namespace 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir // ____________________ 74*cdf0e10cSrcweir namespace chart 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir CachedDataSequence::CachedDataSequence() 78*cdf0e10cSrcweir : OPropertyContainer( GetBroadcastHelper()), 79*cdf0e10cSrcweir CachedDataSequence_Base( GetMutex()), 80*cdf0e10cSrcweir m_eCurrentDataType( NUMERICAL ), 81*cdf0e10cSrcweir m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir registerProperties(); 84*cdf0e10cSrcweir } 85*cdf0e10cSrcweir CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ ) 86*cdf0e10cSrcweir : OPropertyContainer( GetBroadcastHelper()), 87*cdf0e10cSrcweir CachedDataSequence_Base( GetMutex()), 88*cdf0e10cSrcweir m_eCurrentDataType( MIXED ), 89*cdf0e10cSrcweir m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder( )) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir registerProperties(); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir CachedDataSequence::CachedDataSequence( const OUString & rSingleText ) 95*cdf0e10cSrcweir : OPropertyContainer( GetBroadcastHelper()), 96*cdf0e10cSrcweir CachedDataSequence_Base( GetMutex()), 97*cdf0e10cSrcweir m_eCurrentDataType( TEXTUAL ), 98*cdf0e10cSrcweir m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir m_aTextualSequence.realloc(1); 101*cdf0e10cSrcweir m_aTextualSequence[0] = rSingleText; 102*cdf0e10cSrcweir registerProperties(); 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource ) 106*cdf0e10cSrcweir : OMutexAndBroadcastHelper(), 107*cdf0e10cSrcweir OPropertyContainer( GetBroadcastHelper()), 108*cdf0e10cSrcweir OPropertyArrayUsageHelper< CachedDataSequence >(), 109*cdf0e10cSrcweir CachedDataSequence_Base( GetMutex()), 110*cdf0e10cSrcweir m_nNumberFormatKey( rSource.m_nNumberFormatKey ), 111*cdf0e10cSrcweir m_sRole( rSource.m_sRole ), 112*cdf0e10cSrcweir m_eCurrentDataType( rSource.m_eCurrentDataType ), 113*cdf0e10cSrcweir m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir switch( m_eCurrentDataType ) 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir case TEXTUAL: 118*cdf0e10cSrcweir m_aTextualSequence = rSource.m_aTextualSequence; 119*cdf0e10cSrcweir break; 120*cdf0e10cSrcweir case NUMERICAL: 121*cdf0e10cSrcweir m_aNumericalSequence = rSource.m_aNumericalSequence; 122*cdf0e10cSrcweir break; 123*cdf0e10cSrcweir case MIXED: 124*cdf0e10cSrcweir m_aMixedSequence = rSource.m_aMixedSequence; 125*cdf0e10cSrcweir break; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir registerProperties(); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir CachedDataSequence::~CachedDataSequence() 132*cdf0e10cSrcweir {} 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir void CachedDataSequence::registerProperties() 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir registerProperty( C2U( "NumberFormatKey" ), 137*cdf0e10cSrcweir PROP_NUMBERFORMAT_KEY, 138*cdf0e10cSrcweir 0, // PropertyAttributes 139*cdf0e10cSrcweir & m_nNumberFormatKey, 140*cdf0e10cSrcweir ::getCppuType( & m_nNumberFormatKey ) ); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir registerProperty( C2U( "Role" ), 143*cdf0e10cSrcweir PROP_PROPOSED_ROLE, 144*cdf0e10cSrcweir 0, // PropertyAttributes 145*cdf0e10cSrcweir & m_sRole, 146*cdf0e10cSrcweir ::getCppuType( & m_sRole ) ); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir Sequence< double > CachedDataSequence::Impl_getNumericalData() const 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir if( m_eCurrentDataType == NUMERICAL ) 152*cdf0e10cSrcweir return m_aNumericalSequence; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_Int32 nSize = ( m_eCurrentDataType == TEXTUAL ) 155*cdf0e10cSrcweir ? m_aTextualSequence.getLength() 156*cdf0e10cSrcweir : m_aMixedSequence.getLength(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir Sequence< double > aResult( nSize ); 159*cdf0e10cSrcweir double * pResultArray = aResult.getArray(); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir if( m_eCurrentDataType == TEXTUAL ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir const OUString * pTextArray = m_aTextualSequence.getConstArray(); 164*cdf0e10cSrcweir ::std::transform( pTextArray, pTextArray + nSize, 165*cdf0e10cSrcweir pResultArray, 166*cdf0e10cSrcweir CommonFunctors::OUStringToDouble() ); 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir else 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir OSL_ASSERT( m_eCurrentDataType == MIXED ); 171*cdf0e10cSrcweir const Any * pMixedArray = m_aMixedSequence.getConstArray(); 172*cdf0e10cSrcweir ::std::transform( pMixedArray, pMixedArray + nSize, 173*cdf0e10cSrcweir pResultArray, 174*cdf0e10cSrcweir CommonFunctors::AnyToDouble() ); 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir return aResult; 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir Sequence< OUString > CachedDataSequence::Impl_getTextualData() const 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir if( m_eCurrentDataType == TEXTUAL ) 182*cdf0e10cSrcweir return m_aTextualSequence; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir sal_Int32 nSize = ( m_eCurrentDataType == NUMERICAL ) 185*cdf0e10cSrcweir ? m_aNumericalSequence.getLength() 186*cdf0e10cSrcweir : m_aMixedSequence.getLength(); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir Sequence< OUString > aResult( nSize ); 189*cdf0e10cSrcweir OUString * pResultArray = aResult.getArray(); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir if( m_eCurrentDataType == NUMERICAL ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir const double * pTextArray = m_aNumericalSequence.getConstArray(); 194*cdf0e10cSrcweir ::std::transform( pTextArray, pTextArray + nSize, 195*cdf0e10cSrcweir pResultArray, 196*cdf0e10cSrcweir CommonFunctors::DoubleToOUString() ); 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir else 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir OSL_ASSERT( m_eCurrentDataType == MIXED ); 201*cdf0e10cSrcweir const Any * pMixedArray = m_aMixedSequence.getConstArray(); 202*cdf0e10cSrcweir ::std::transform( pMixedArray, pMixedArray + nSize, 203*cdf0e10cSrcweir pResultArray, 204*cdf0e10cSrcweir CommonFunctors::AnyToString() ); 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir return aResult; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir Sequence< Any > CachedDataSequence::Impl_getMixedData() const 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir if( m_eCurrentDataType == MIXED ) 213*cdf0e10cSrcweir return m_aMixedSequence; 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir sal_Int32 nSize = ( m_eCurrentDataType == NUMERICAL ) 216*cdf0e10cSrcweir ? m_aNumericalSequence.getLength() 217*cdf0e10cSrcweir : m_aTextualSequence.getLength(); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir Sequence< Any > aResult( nSize ); 220*cdf0e10cSrcweir Any * pResultArray = aResult.getArray(); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir if( m_eCurrentDataType == NUMERICAL ) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir const double * pTextArray = m_aNumericalSequence.getConstArray(); 225*cdf0e10cSrcweir ::std::transform( pTextArray, pTextArray + nSize, 226*cdf0e10cSrcweir pResultArray, 227*cdf0e10cSrcweir CommonFunctors::makeAny< double >() ); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir else 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir OSL_ASSERT( m_eCurrentDataType == TEXTUAL ); 232*cdf0e10cSrcweir const OUString * pMixedArray = m_aTextualSequence.getConstArray(); 233*cdf0e10cSrcweir ::std::transform( pMixedArray, pMixedArray + nSize, 234*cdf0e10cSrcweir pResultArray, 235*cdf0e10cSrcweir CommonFunctors::makeAny< OUString >() ); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir return aResult; 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir // ================================================================================ 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir Sequence< OUString > CachedDataSequence::getSupportedServiceNames_Static() 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir Sequence< OUString > aServices( 4 ); 246*cdf0e10cSrcweir aServices[ 0 ] = lcl_aServiceName; 247*cdf0e10cSrcweir aServices[ 1 ] = C2U( "com.sun.star.chart2.data.DataSequence" ); 248*cdf0e10cSrcweir aServices[ 2 ] = C2U( "com.sun.star.chart2.data.NumericalDataSequence" ); 249*cdf0e10cSrcweir aServices[ 3 ] = C2U( "com.sun.star.chart2.data.TextualDataSequence" ); 250*cdf0e10cSrcweir return aServices; 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer ) 254*cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer ) 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir // ____ XPropertySet ____ 257*cdf0e10cSrcweir Reference< beans::XPropertySetInfo > SAL_CALL CachedDataSequence::getPropertySetInfo() 258*cdf0e10cSrcweir throw(uno::RuntimeException) 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir return Reference< beans::XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) ); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir // ____ ::comphelper::OPropertySetHelper ____ 264*cdf0e10cSrcweir // __________________________________________ 265*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& CachedDataSequence::getInfoHelper() 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir return *getArrayHelper(); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // ____ ::comphelper::OPropertyArrayHelper ____ 271*cdf0e10cSrcweir // ____________________________________________ 272*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* CachedDataSequence::createArrayHelper() const 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir Sequence< beans::Property > aProps; 275*cdf0e10cSrcweir // describes all properties which have been registered in the ctor 276*cdf0e10cSrcweir describeProperties( aProps ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper( aProps ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static 282*cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( CachedDataSequence, lcl_aServiceName ) 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // ================================================================================ 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir // ________ XNumericalDataSequence ________ 287*cdf0e10cSrcweir Sequence< double > SAL_CALL CachedDataSequence::getNumericalData() 288*cdf0e10cSrcweir throw (uno::RuntimeException) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir // /-- 291*cdf0e10cSrcweir MutexGuard aGuard( GetMutex() ); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir if( m_eCurrentDataType == NUMERICAL ) 294*cdf0e10cSrcweir return m_aNumericalSequence; 295*cdf0e10cSrcweir else 296*cdf0e10cSrcweir return Impl_getNumericalData(); 297*cdf0e10cSrcweir // \-- 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir // ________ XTextualDataSequence ________ 301*cdf0e10cSrcweir Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData() 302*cdf0e10cSrcweir throw (uno::RuntimeException) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir // /-- 305*cdf0e10cSrcweir MutexGuard aGuard( GetMutex() ); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir if( m_eCurrentDataType == TEXTUAL ) 308*cdf0e10cSrcweir return m_aTextualSequence; 309*cdf0e10cSrcweir else 310*cdf0e10cSrcweir return Impl_getTextualData(); 311*cdf0e10cSrcweir // \-- 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir // void SAL_CALL CachedDataSequence::setTextualData( const Sequence< OUString >& aData ) 315*cdf0e10cSrcweir // throw (uno::RuntimeException) 316*cdf0e10cSrcweir // { 317*cdf0e10cSrcweir // // /-- 318*cdf0e10cSrcweir // MutexGuard aGuard( GetMutex() ); 319*cdf0e10cSrcweir // Impl_setTextualData( aData ); 320*cdf0e10cSrcweir // // \-- 321*cdf0e10cSrcweir // } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir // ________ XDataSequence ________ 324*cdf0e10cSrcweir Sequence< Any > SAL_CALL CachedDataSequence::getData() 325*cdf0e10cSrcweir throw (uno::RuntimeException) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir // /-- 328*cdf0e10cSrcweir MutexGuard aGuard( GetMutex() ); 329*cdf0e10cSrcweir return Impl_getMixedData(); 330*cdf0e10cSrcweir // \-- 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir OUString SAL_CALL CachedDataSequence::getSourceRangeRepresentation() 334*cdf0e10cSrcweir throw (uno::RuntimeException) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir return m_sRole; 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir Sequence< OUString > SAL_CALL CachedDataSequence::generateLabel( chart2::data::LabelOrigin /*eLabelOrigin*/ ) 340*cdf0e10cSrcweir throw (uno::RuntimeException) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir // return empty label, as we have no range representaions to determine something useful 343*cdf0e10cSrcweir return Sequence< OUString >(); 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir ::sal_Int32 SAL_CALL CachedDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 /*nIndex*/ ) 347*cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, 348*cdf0e10cSrcweir uno::RuntimeException) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir return 0; 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir Reference< util::XCloneable > SAL_CALL CachedDataSequence::createClone() 354*cdf0e10cSrcweir throw (uno::RuntimeException) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir CachedDataSequence * pNewSeq = new CachedDataSequence( *this ); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir return Reference< util::XCloneable >( pNewSeq ); 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir void SAL_CALL CachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener ) 362*cdf0e10cSrcweir throw (uno::RuntimeException) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir try 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW ); 367*cdf0e10cSrcweir xBroadcaster->addModifyListener( aListener ); 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir catch( const uno::Exception & ex ) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir void SAL_CALL CachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener ) 376*cdf0e10cSrcweir throw (uno::RuntimeException) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir try 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW ); 381*cdf0e10cSrcweir xBroadcaster->removeModifyListener( aListener ); 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir catch( const uno::Exception & ex ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir // lang::XInitialization: 390*cdf0e10cSrcweir void SAL_CALL CachedDataSequence::initialize(const uno::Sequence< uno::Any > & _aArguments) throw (uno::RuntimeException, uno::Exception) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir ::comphelper::SequenceAsHashMap aMap(_aArguments); 393*cdf0e10cSrcweir m_aNumericalSequence = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSequence")),m_aNumericalSequence); 394*cdf0e10cSrcweir if ( m_aNumericalSequence.getLength() ) 395*cdf0e10cSrcweir m_eCurrentDataType = NUMERICAL; 396*cdf0e10cSrcweir else 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir m_aTextualSequence = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSequence")),m_aTextualSequence); 399*cdf0e10cSrcweir if ( m_aTextualSequence.getLength() ) 400*cdf0e10cSrcweir m_eCurrentDataType = TEXTUAL; 401*cdf0e10cSrcweir else 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir m_aMixedSequence = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSequence")),m_aMixedSequence); 404*cdf0e10cSrcweir if ( m_aMixedSequence.getLength() ) 405*cdf0e10cSrcweir m_eCurrentDataType = MIXED; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } // namespace chart 410