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