xref: /aoo41x/main/sc/inc/chart2uno.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_CHART2UNO_HXX
25cdf0e10cSrcweir #define SC_CHART2UNO_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "cellsuno.hxx"     // for XModifyListenerArr_Impl / ScLinkListener
28cdf0e10cSrcweir #include "rangelst.hxx"
29cdf0e10cSrcweir #include "externalrefmgr.hxx"
30cdf0e10cSrcweir #include "token.hxx"
31cdf0e10cSrcweir #include "chartlis.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <svl/lstner.hxx>
34cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp>
35cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataProvider.hpp>
36cdf0e10cSrcweir #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
37cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataSource.hpp>
38cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataSequence.hpp>
39cdf0e10cSrcweir #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
40cdf0e10cSrcweir #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
41cdf0e10cSrcweir #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
42cdf0e10cSrcweir #include <com/sun/star/chart2/data/DataSequenceRole.hpp>
43cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
45cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
46cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
47cdf0e10cSrcweir // #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
48cdf0e10cSrcweir // #include <com/sun/star/lang/XUnoTunnel.hpp>
49cdf0e10cSrcweir // #endif
50cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
51cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
52cdf0e10cSrcweir #include <cppuhelper/implbase6.hxx>
53cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx>
54cdf0e10cSrcweir #include <rtl/ustring.hxx>
55cdf0e10cSrcweir #include <svl/itemprop.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #include <hash_set>
58cdf0e10cSrcweir #include <list>
59cdf0e10cSrcweir #include <vector>
60cdf0e10cSrcweir #include <memory>
61cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #define USE_CHART2_EMPTYDATASEQUENCE 0
64cdf0e10cSrcweir 
65cdf0e10cSrcweir class ScDocument;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir // DataProvider ==============================================================
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class ScChart2DataProvider : public
70cdf0e10cSrcweir                 ::cppu::WeakImplHelper4<
71cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XDataProvider,
72cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XRangeXMLConversion,
73cdf0e10cSrcweir                     ::com::sun::star::beans::XPropertySet,
74cdf0e10cSrcweir                     ::com::sun::star::lang::XServiceInfo>,
75cdf0e10cSrcweir                 SfxListener
76cdf0e10cSrcweir {
77cdf0e10cSrcweir public:
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     explicit ScChart2DataProvider( ScDocument* pDoc );
80cdf0e10cSrcweir     virtual ~ScChart2DataProvider();
81cdf0e10cSrcweir     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     // XDataProvider ---------------------------------------------------------
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL createDataSourcePossible(
86cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
87cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
90cdf0e10cSrcweir         ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource(
91cdf0e10cSrcweir             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
92cdf0e10cSrcweir             throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
95cdf0e10cSrcweir         ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments(
96cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource )
97cdf0e10cSrcweir             throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(
100cdf0e10cSrcweir         const ::rtl::OUString& aRangeRepresentation )
101cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
104cdf0e10cSrcweir         ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
105cdf0e10cSrcweir             const ::rtl::OUString& aRangeRepresentation )
106cdf0e10cSrcweir             throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
109cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir /*    virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > SAL_CALL getNumberFormatsSupplier()
112cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);*/
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     // XRangeXMLConversion ---------------------------------------------------
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL convertRangeToXML( const ::rtl::OUString& sRangeRepresentation )
117cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL convertRangeFromXML( const ::rtl::OUString& sXMLRange )
120cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     // XPropertySet ----------------------------------------------------------
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
125cdf0e10cSrcweir         ::com::sun::star::beans::XPropertySetInfo> SAL_CALL
126cdf0e10cSrcweir         getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValue(
129cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
130cdf0e10cSrcweir             const ::com::sun::star::uno::Any& rValue)
131cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
132cdf0e10cSrcweir                 ::com::sun::star::beans::PropertyVetoException,
133cdf0e10cSrcweir                 ::com::sun::star::lang::IllegalArgumentException,
134cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
135cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
138cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName)
139cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
140cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
141cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     virtual void SAL_CALL addPropertyChangeListener(
144cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
145cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
146cdf0e10cSrcweir             ::com::sun::star::beans::XPropertyChangeListener>& xListener)
147cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
148cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
149cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     virtual void SAL_CALL removePropertyChangeListener(
152cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
153cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
154cdf0e10cSrcweir             ::com::sun::star::beans::XPropertyChangeListener>& rListener)
155cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
156cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
157cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     virtual void SAL_CALL addVetoableChangeListener(
160cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
161cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
162cdf0e10cSrcweir             ::com::sun::star::beans::XVetoableChangeListener>& rListener)
163cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
164cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
165cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     virtual void SAL_CALL removeVetoableChangeListener(
168cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
169cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
170cdf0e10cSrcweir             ::com::sun::star::beans::XVetoableChangeListener>& rListener)
171cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
172cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
173cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     // XServiceInfo ----------------------------------------------------------
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(
178cdf0e10cSrcweir             ::com::sun::star::uno::RuntimeException);
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
181cdf0e10cSrcweir             rServiceName) throw( ::com::sun::star::uno::RuntimeException);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
184cdf0e10cSrcweir         getSupportedServiceNames() throw(
185cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
186cdf0e10cSrcweir 
187cdf0e10cSrcweir private:
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     ScDocument*                 m_pDocument;
190cdf0e10cSrcweir     SfxItemPropertySet          m_aPropSet;
191cdf0e10cSrcweir     sal_Bool                    m_bIncludeHiddenCells;
192cdf0e10cSrcweir };
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 
195cdf0e10cSrcweir // DataSource ================================================================
196cdf0e10cSrcweir 
197cdf0e10cSrcweir class ScChart2DataSource : public
198cdf0e10cSrcweir                 ::cppu::WeakImplHelper2<
199cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XDataSource,
200cdf0e10cSrcweir                     ::com::sun::star::lang::XServiceInfo>,
201cdf0e10cSrcweir                 SfxListener
202cdf0e10cSrcweir {
203cdf0e10cSrcweir public:
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     explicit ScChart2DataSource( ScDocument* pDoc);
206cdf0e10cSrcweir     virtual ~ScChart2DataSource();
207cdf0e10cSrcweir     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     // XDataSource -----------------------------------------------------------
210cdf0e10cSrcweir 
211cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
212cdf0e10cSrcweir             ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL
213cdf0e10cSrcweir         getDataSequences() throw (::com::sun::star::uno::RuntimeException);
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     // XServiceInfo ----------------------------------------------------------
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(
218cdf0e10cSrcweir             ::com::sun::star::uno::RuntimeException);
219cdf0e10cSrcweir 
220cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
221cdf0e10cSrcweir             rServiceName) throw( ::com::sun::star::uno::RuntimeException);
222cdf0e10cSrcweir 
223cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
224cdf0e10cSrcweir         getSupportedServiceNames() throw(
225cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     // implementation
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     void AddLabeledSequence(const com::sun::star::uno::Reference < com::sun::star::chart2::data::XLabeledDataSequence >& xNew);
230cdf0e10cSrcweir 
231cdf0e10cSrcweir private:
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     ScDocument*                 m_pDocument;
234cdf0e10cSrcweir     typedef std::list < com::sun::star::uno::Reference< com::sun::star::chart2::data::XLabeledDataSequence > >  LabeledList;
235cdf0e10cSrcweir     LabeledList                 m_aLabeledSequences;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir };
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 
240cdf0e10cSrcweir // DataSequence ==============================================================
241cdf0e10cSrcweir 
242cdf0e10cSrcweir class ScChart2DataSequence : public
243cdf0e10cSrcweir                 ::cppu::WeakImplHelper7<
244cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XDataSequence,
245cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XTextualDataSequence,
246cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XNumericalDataSequence,
247cdf0e10cSrcweir                     ::com::sun::star::util::XCloneable,
248cdf0e10cSrcweir                     ::com::sun::star::util::XModifyBroadcaster,
249cdf0e10cSrcweir                     ::com::sun::star::beans::XPropertySet,
250cdf0e10cSrcweir //                     ::com::sun::star::lang::XUnoTunnel,
251cdf0e10cSrcweir                     ::com::sun::star::lang::XServiceInfo>,
252cdf0e10cSrcweir                 SfxListener
253cdf0e10cSrcweir {
254cdf0e10cSrcweir public:
255cdf0e10cSrcweir     explicit ScChart2DataSequence( ScDocument* pDoc,
256cdf0e10cSrcweir             const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP,
257cdf0e10cSrcweir             ::std::vector<ScSharedTokenRef>* pTokens, bool bIncludeHiddenCells );
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     virtual ~ScChart2DataSequence();
260cdf0e10cSrcweir     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir     // XDataSequence ---------------------------------------------------------
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
265cdf0e10cSrcweir         SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
266cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
267cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
268cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
269cdf0e10cSrcweir         SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin)
270cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
271cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
272cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
273cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     // XNumericalDataSequence --------------------------------------------------
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< double >
278cdf0e10cSrcweir         SAL_CALL getNumericalData(  ) throw (::com::sun::star::uno::RuntimeException);
279cdf0e10cSrcweir 
280cdf0e10cSrcweir     // XTextualDataSequence --------------------------------------------------
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
283cdf0e10cSrcweir         SAL_CALL getTextualData(  ) throw (::com::sun::star::uno::RuntimeException);
284cdf0e10cSrcweir 
285cdf0e10cSrcweir     // XPropertySet ----------------------------------------------------------
286cdf0e10cSrcweir 
287cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
288cdf0e10cSrcweir         ::com::sun::star::beans::XPropertySetInfo> SAL_CALL
289cdf0e10cSrcweir         getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException);
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValue(
292cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
293cdf0e10cSrcweir             const ::com::sun::star::uno::Any& rValue)
294cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
295cdf0e10cSrcweir                 ::com::sun::star::beans::PropertyVetoException,
296cdf0e10cSrcweir                 ::com::sun::star::lang::IllegalArgumentException,
297cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
298cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
301cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName)
302cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
303cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
304cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     virtual void SAL_CALL addPropertyChangeListener(
307cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
308cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
309cdf0e10cSrcweir             ::com::sun::star::beans::XPropertyChangeListener>& xListener)
310cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
311cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
312cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     virtual void SAL_CALL removePropertyChangeListener(
315cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
316cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
317cdf0e10cSrcweir             ::com::sun::star::beans::XPropertyChangeListener>& rListener)
318cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
319cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
320cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
321cdf0e10cSrcweir 
322cdf0e10cSrcweir     virtual void SAL_CALL addVetoableChangeListener(
323cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
324cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
325cdf0e10cSrcweir             ::com::sun::star::beans::XVetoableChangeListener>& rListener)
326cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
327cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
328cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     virtual void SAL_CALL removeVetoableChangeListener(
331cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
332cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
333cdf0e10cSrcweir             ::com::sun::star::beans::XVetoableChangeListener>& rListener)
334cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
335cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
336cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
337cdf0e10cSrcweir 
338cdf0e10cSrcweir     // XCloneable ------------------------------------------------------------
339cdf0e10cSrcweir 
340cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
341cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
342cdf0e10cSrcweir 
343cdf0e10cSrcweir     // XModifyBroadcaster ----------------------------------------------------
344cdf0e10cSrcweir 
345cdf0e10cSrcweir     virtual void SAL_CALL addModifyListener(
346cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
347cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
348cdf0e10cSrcweir     virtual void SAL_CALL removeModifyListener(
349cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
350cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
351cdf0e10cSrcweir 
352cdf0e10cSrcweir     // XServiceInfo ----------------------------------------------------------
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(
355cdf0e10cSrcweir             ::com::sun::star::uno::RuntimeException);
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
358cdf0e10cSrcweir             rServiceName) throw( ::com::sun::star::uno::RuntimeException);
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
361cdf0e10cSrcweir         getSupportedServiceNames() throw(
362cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
363cdf0e10cSrcweir 
364cdf0e10cSrcweir     // XUnoTunnel ------------------------------------------------------------
365cdf0e10cSrcweir 
366cdf0e10cSrcweir // 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
367cdf0e10cSrcweir // 									sal_Int8 >& aIdentifier )
368cdf0e10cSrcweir // 								throw(::com::sun::star::uno::RuntimeException);
369cdf0e10cSrcweir 
370cdf0e10cSrcweir // 	static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
371cdf0e10cSrcweir // 	static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference<
372cdf0e10cSrcweir // 									com::sun::star::uno::XInterface> xObj );
373cdf0e10cSrcweir 
374cdf0e10cSrcweir private:
375cdf0e10cSrcweir     void setDataChangedHint(bool b);
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     // Implementation --------------------------------------------------------
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     void    RefChanged();
380cdf0e10cSrcweir     DECL_LINK( ValueListenerHdl, SfxHint* );
381cdf0e10cSrcweir 
382cdf0e10cSrcweir private:
383cdf0e10cSrcweir     ScChart2DataSequence(); // disabled
384cdf0e10cSrcweir     ScChart2DataSequence(const ScChart2DataSequence& r); // disabled
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     class ExternalRefListener : public ScExternalRefManager::LinkListener
387cdf0e10cSrcweir     {
388cdf0e10cSrcweir     public:
389cdf0e10cSrcweir         ExternalRefListener(ScChart2DataSequence& rParent, ScDocument* pDoc);
390cdf0e10cSrcweir         virtual ~ExternalRefListener();
391cdf0e10cSrcweir         virtual void notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType);
392cdf0e10cSrcweir         void addFileId(sal_uInt16 nFileId);
393cdf0e10cSrcweir         void removeFileId(sal_uInt16 nFileId);
394cdf0e10cSrcweir         const ::std::hash_set<sal_uInt16>& getAllFileIds();
395cdf0e10cSrcweir 
396cdf0e10cSrcweir     private:
397cdf0e10cSrcweir         ExternalRefListener();
398cdf0e10cSrcweir         ExternalRefListener(const ExternalRefListener& r);
399cdf0e10cSrcweir 
400cdf0e10cSrcweir         ScChart2DataSequence&       mrParent;
401cdf0e10cSrcweir         ::std::hash_set<sal_uInt16> maFileIds;
402cdf0e10cSrcweir         ScDocument*                 mpDoc;
403cdf0e10cSrcweir     };
404cdf0e10cSrcweir 
405cdf0e10cSrcweir     /**
406cdf0e10cSrcweir      * Build an internal data array to cache the data ranges, and other
407cdf0e10cSrcweir      * information such as hidden values.
408cdf0e10cSrcweir      */
409cdf0e10cSrcweir     void BuildDataCache();
410cdf0e10cSrcweir 
411cdf0e10cSrcweir     void RebuildDataCache();
412cdf0e10cSrcweir 
413cdf0e10cSrcweir     sal_Int32 FillCacheFromExternalRef(const ScSharedTokenRef& pToken);
414cdf0e10cSrcweir 
415cdf0e10cSrcweir     void UpdateTokensFromRanges(const ScRangeList& rRanges);
416cdf0e10cSrcweir 
417cdf0e10cSrcweir     ExternalRefListener* GetExtRefListener();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir     void StopListeningToAllExternalRefs();
420cdf0e10cSrcweir 
421cdf0e10cSrcweir     void CopyData(const ScChart2DataSequence& r);
422cdf0e10cSrcweir 
423cdf0e10cSrcweir private:
424cdf0e10cSrcweir 
425cdf0e10cSrcweir     // data array
426cdf0e10cSrcweir     struct Item
427cdf0e10cSrcweir     {
428cdf0e10cSrcweir         double              mfValue;
429cdf0e10cSrcweir         ::rtl::OUString     maString;
430cdf0e10cSrcweir         bool                mbIsValue;
431cdf0e10cSrcweir         Item();
432cdf0e10cSrcweir     };
433cdf0e10cSrcweir 
434cdf0e10cSrcweir     class HiddenRangeListener : public ScChartHiddenRangeListener
435cdf0e10cSrcweir     {
436cdf0e10cSrcweir     public:
437cdf0e10cSrcweir         HiddenRangeListener(ScChart2DataSequence& rParent);
438cdf0e10cSrcweir         virtual ~HiddenRangeListener();
439cdf0e10cSrcweir 
440cdf0e10cSrcweir         virtual void notify();
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     private:
443cdf0e10cSrcweir         ScChart2DataSequence& mrParent;
444cdf0e10cSrcweir     };
445cdf0e10cSrcweir 
446cdf0e10cSrcweir     ::std::list<Item>           m_aDataArray;
447cdf0e10cSrcweir 
448cdf0e10cSrcweir     /**
449cdf0e10cSrcweir      * Cached data for getData.  We may also need to cache data for the
450cdf0e10cSrcweir      * numerical and textural data series if they turn out to be bottlenecks
451cdf0e10cSrcweir      * under certain scenarios.
452cdf0e10cSrcweir      */
453cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aMixedDataCache;
454cdf0e10cSrcweir 
455cdf0e10cSrcweir     ::com::sun::star::uno::Sequence<sal_Int32>  m_aHiddenValues;
456cdf0e10cSrcweir 
457cdf0e10cSrcweir     // properties
458cdf0e10cSrcweir     ::com::sun::star::chart2::data::DataSequenceRole  m_aRole;
459cdf0e10cSrcweir     sal_Bool                    m_bIncludeHiddenCells;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir     // internals
462cdf0e10cSrcweir     typedef ::std::auto_ptr< ::std::vector<ScSharedTokenRef> >  TokenListPtr;
463cdf0e10cSrcweir     typedef ::std::auto_ptr< ::std::vector<sal_uInt32> >        RangeIndexMapPtr;
464cdf0e10cSrcweir     typedef ::std::auto_ptr<ExternalRefListener>                ExtRefListenerPtr;
465cdf0e10cSrcweir 
466cdf0e10cSrcweir     sal_Int64                   m_nObjectId;
467cdf0e10cSrcweir     ScDocument*                 m_pDocument;
468cdf0e10cSrcweir     TokenListPtr                m_pTokens;
469cdf0e10cSrcweir     RangeIndexMapPtr            m_pRangeIndices;
470cdf0e10cSrcweir     ExtRefListenerPtr           m_pExtRefListener;
471cdf0e10cSrcweir     com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
472cdf0e10cSrcweir 	SfxItemPropertySet		    m_aPropSet;
473cdf0e10cSrcweir 
474cdf0e10cSrcweir     ::std::auto_ptr<HiddenRangeListener> m_pHiddenListener;
475cdf0e10cSrcweir     ScLinkListener*             m_pValueListener;
476cdf0e10cSrcweir     XModifyListenerArr_Impl     m_aValueListeners;
477cdf0e10cSrcweir 
478cdf0e10cSrcweir     bool                        m_bGotDataChangedHint;
479cdf0e10cSrcweir     bool                        m_bExtDataRebuildQueued;
480cdf0e10cSrcweir };
481cdf0e10cSrcweir 
482cdf0e10cSrcweir #if USE_CHART2_EMPTYDATASEQUENCE
483cdf0e10cSrcweir // DataSequence ==============================================================
484cdf0e10cSrcweir 
485cdf0e10cSrcweir class ScChart2EmptyDataSequence : public
486cdf0e10cSrcweir                 ::cppu::WeakImplHelper6<
487cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XDataSequence,
488cdf0e10cSrcweir                     ::com::sun::star::chart2::data::XTextualDataSequence,
489cdf0e10cSrcweir                     ::com::sun::star::util::XCloneable,
490cdf0e10cSrcweir                     ::com::sun::star::util::XModifyBroadcaster,
491cdf0e10cSrcweir                     ::com::sun::star::beans::XPropertySet,
492cdf0e10cSrcweir //                     ::com::sun::star::lang::XUnoTunnel,
493cdf0e10cSrcweir                     ::com::sun::star::lang::XServiceInfo>,
494cdf0e10cSrcweir                 SfxListener
495cdf0e10cSrcweir {
496cdf0e10cSrcweir public:
497cdf0e10cSrcweir 
498cdf0e10cSrcweir     explicit ScChart2EmptyDataSequence( ScDocument* pDoc,
499cdf0e10cSrcweir             const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP,
500cdf0e10cSrcweir             const ScRangeListRef& rRangeList, sal_Bool bColumn );
501cdf0e10cSrcweir     virtual ~ScChart2EmptyDataSequence();
502cdf0e10cSrcweir     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
503cdf0e10cSrcweir 
504cdf0e10cSrcweir     // XDataSequence ---------------------------------------------------------
505cdf0e10cSrcweir 
506cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
507cdf0e10cSrcweir         SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
508cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
509cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
510cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
511cdf0e10cSrcweir         SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin)
512cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
513cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
514cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
515cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
516cdf0e10cSrcweir 
517cdf0e10cSrcweir     // XTextualDataSequence --------------------------------------------------
518cdf0e10cSrcweir 
519cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
520cdf0e10cSrcweir         SAL_CALL getTextualData(  ) throw (::com::sun::star::uno::RuntimeException);
521cdf0e10cSrcweir 
522cdf0e10cSrcweir     // XPropertySet ----------------------------------------------------------
523cdf0e10cSrcweir 
524cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
525cdf0e10cSrcweir         ::com::sun::star::beans::XPropertySetInfo> SAL_CALL
526cdf0e10cSrcweir         getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException);
527cdf0e10cSrcweir 
528cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValue(
529cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
530cdf0e10cSrcweir             const ::com::sun::star::uno::Any& rValue)
531cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
532cdf0e10cSrcweir                 ::com::sun::star::beans::PropertyVetoException,
533cdf0e10cSrcweir                 ::com::sun::star::lang::IllegalArgumentException,
534cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
535cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
536cdf0e10cSrcweir 
537cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
538cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName)
539cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
540cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
541cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
542cdf0e10cSrcweir 
543cdf0e10cSrcweir     virtual void SAL_CALL addPropertyChangeListener(
544cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
545cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
546cdf0e10cSrcweir             ::com::sun::star::beans::XPropertyChangeListener>& xListener)
547cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
548cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
549cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
550cdf0e10cSrcweir 
551cdf0e10cSrcweir     virtual void SAL_CALL removePropertyChangeListener(
552cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
553cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
554cdf0e10cSrcweir             ::com::sun::star::beans::XPropertyChangeListener>& rListener)
555cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
556cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
557cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     virtual void SAL_CALL addVetoableChangeListener(
560cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
561cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
562cdf0e10cSrcweir             ::com::sun::star::beans::XVetoableChangeListener>& rListener)
563cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
564cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
565cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
566cdf0e10cSrcweir 
567cdf0e10cSrcweir     virtual void SAL_CALL removeVetoableChangeListener(
568cdf0e10cSrcweir             const ::rtl::OUString& rPropertyName,
569cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
570cdf0e10cSrcweir             ::com::sun::star::beans::XVetoableChangeListener>& rListener)
571cdf0e10cSrcweir         throw( ::com::sun::star::beans::UnknownPropertyException,
572cdf0e10cSrcweir                 ::com::sun::star::lang::WrappedTargetException,
573cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
574cdf0e10cSrcweir 
575cdf0e10cSrcweir     // XCloneable ------------------------------------------------------------
576cdf0e10cSrcweir 
577cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
578cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
579cdf0e10cSrcweir 
580cdf0e10cSrcweir     // XModifyBroadcaster ----------------------------------------------------
581cdf0e10cSrcweir 
582cdf0e10cSrcweir     virtual void SAL_CALL addModifyListener(
583cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
584cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
585cdf0e10cSrcweir     virtual void SAL_CALL removeModifyListener(
586cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
587cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
588cdf0e10cSrcweir 
589cdf0e10cSrcweir     // XServiceInfo ----------------------------------------------------------
590cdf0e10cSrcweir 
591cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(
592cdf0e10cSrcweir             ::com::sun::star::uno::RuntimeException);
593cdf0e10cSrcweir 
594cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
595cdf0e10cSrcweir             rServiceName) throw( ::com::sun::star::uno::RuntimeException);
596cdf0e10cSrcweir 
597cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
598cdf0e10cSrcweir         getSupportedServiceNames() throw(
599cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException);
600cdf0e10cSrcweir 
601cdf0e10cSrcweir     // XUnoTunnel ------------------------------------------------------------
602cdf0e10cSrcweir 
603cdf0e10cSrcweir // 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
604cdf0e10cSrcweir // 									sal_Int8 >& aIdentifier )
605cdf0e10cSrcweir // 								throw(::com::sun::star::uno::RuntimeException);
606cdf0e10cSrcweir 
607cdf0e10cSrcweir // 	static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
608cdf0e10cSrcweir // 	static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference<
609cdf0e10cSrcweir // 									com::sun::star::uno::XInterface> xObj );
610cdf0e10cSrcweir 
611cdf0e10cSrcweir     // Implementation --------------------------------------------------------
612cdf0e10cSrcweir 
GetRangeList()613cdf0e10cSrcweir     ScRangeListRef GetRangeList() { return m_xRanges; }
614cdf0e10cSrcweir 
615cdf0e10cSrcweir private:
616cdf0e10cSrcweir 
617cdf0e10cSrcweir     // properties
618cdf0e10cSrcweir     ::com::sun::star::chart2::data::DataSequenceRole  m_aRole;
619cdf0e10cSrcweir     sal_Bool                    m_bIncludeHiddenCells;
620cdf0e10cSrcweir     // internals
621cdf0e10cSrcweir     ScRangeListRef              m_xRanges;
622cdf0e10cSrcweir     ScDocument*                 m_pDocument;
623cdf0e10cSrcweir     com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
624cdf0e10cSrcweir 	SfxItemPropertySet		    m_aPropSet;
625cdf0e10cSrcweir     sal_Bool                    m_bColumn; // defines the orientation to create the right labels
626cdf0e10cSrcweir 
627cdf0e10cSrcweir };
628cdf0e10cSrcweir #endif
629cdf0e10cSrcweir 
630cdf0e10cSrcweir #endif // SC_CHART2UNO_HXX
631