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 #ifndef CHART_CHARTDATAWRAPPER_HXX
28*cdf0e10cSrcweir #define CHART_CHARTDATAWRAPPER_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "ServiceMacros.hxx"
31*cdf0e10cSrcweir #include "MutexContainer.hxx"
32*cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
33*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
34*cdf0e10cSrcweir #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/chart/XDateCategories.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir namespace chart
44*cdf0e10cSrcweir {
45*cdf0e10cSrcweir namespace wrapper
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir class Chart2ModelContact;
49*cdf0e10cSrcweir struct lcl_Operator;
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir class ChartDataWrapper : public MutexContainer, public
52*cdf0e10cSrcweir     ::cppu::WeakImplHelper5<
53*cdf0e10cSrcweir 	com::sun::star::chart2::XAnyDescriptionAccess,
54*cdf0e10cSrcweir     com::sun::star::chart::XDateCategories,
55*cdf0e10cSrcweir 	com::sun::star::lang::XServiceInfo,
56*cdf0e10cSrcweir 	com::sun::star::lang::XEventListener,
57*cdf0e10cSrcweir 	com::sun::star::lang::XComponent >
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir public:
60*cdf0e10cSrcweir     ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
61*cdf0e10cSrcweir     ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
62*cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData >& xNewData );
63*cdf0e10cSrcweir 	virtual ~ChartDataWrapper();
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     /// XServiceInfo declarations
66*cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir protected:
69*cdf0e10cSrcweir     // ____ XDateCategories ____
70*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException);
71*cdf0e10cSrcweir     virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException);
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     // ____ XAnyDescriptionAccess ____
74*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
75*cdf0e10cSrcweir         getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
76*cdf0e10cSrcweir     virtual void SAL_CALL setAnyRowDescriptions(
77*cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<
78*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions )
79*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
80*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
81*cdf0e10cSrcweir         getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
82*cdf0e10cSrcweir     virtual void SAL_CALL setAnyColumnDescriptions(
83*cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<
84*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions )
85*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
88*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
89*cdf0e10cSrcweir         getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
90*cdf0e10cSrcweir     virtual void SAL_CALL setComplexRowDescriptions(
91*cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<
92*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions )
93*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
94*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
95*cdf0e10cSrcweir         getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
96*cdf0e10cSrcweir     virtual void SAL_CALL setComplexColumnDescriptions(
97*cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<
98*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions )
99*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir     // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
102*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
103*cdf0e10cSrcweir         ::com::sun::star::uno::Sequence<
104*cdf0e10cSrcweir         double > > SAL_CALL getData()
105*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
106*cdf0e10cSrcweir     virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence<
107*cdf0e10cSrcweir                                    ::com::sun::star::uno::Sequence<
108*cdf0e10cSrcweir                                    double > >& aData )
109*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
110*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
111*cdf0e10cSrcweir         ::rtl::OUString > SAL_CALL getRowDescriptions()
112*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
113*cdf0e10cSrcweir     virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence<
114*cdf0e10cSrcweir                                               ::rtl::OUString >& aRowDescriptions )
115*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
116*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
117*cdf0e10cSrcweir         ::rtl::OUString > SAL_CALL getColumnDescriptions()
118*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
119*cdf0e10cSrcweir     virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence<
120*cdf0e10cSrcweir                                                  ::rtl::OUString >& aColumnDescriptions )
121*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // ____ XChartData (base of XChartDataArray) ____
124*cdf0e10cSrcweir     virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
125*cdf0e10cSrcweir                                                            ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
126*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
127*cdf0e10cSrcweir     virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
128*cdf0e10cSrcweir                                                               ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
129*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
130*cdf0e10cSrcweir     virtual double SAL_CALL getNotANumber()
131*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
132*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isNotANumber( double nNumber )
133*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     // ____ XComponent ____
136*cdf0e10cSrcweir     virtual void SAL_CALL dispose()
137*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
138*cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
139*cdf0e10cSrcweir                                             ::com::sun::star::lang::XEventListener >& xListener )
140*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
141*cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
142*cdf0e10cSrcweir                                                ::com::sun::star::lang::XEventListener >& aListener )
143*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     // ____ XEventListener ____
146*cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
147*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     void fireChartDataChangeEvent( ::com::sun::star::chart::ChartDataChangeEvent& aEvent );
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir private: //methods
153*cdf0e10cSrcweir     void switchToInternalDataProvider();
154*cdf0e10cSrcweir     void initDataAccess();
155*cdf0e10cSrcweir     void applyData( lcl_Operator& rDataOperator );
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir private: //member
158*cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
159*cdf0e10cSrcweir         ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
162*cdf0e10cSrcweir 	::cppu::OInterfaceContainerHelper           m_aEventListenerContainer;
163*cdf0e10cSrcweir };
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir } //  namespace wrapper
166*cdf0e10cSrcweir } //  namespace chart
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir // CHART_CHARTDATAWRAPPER_HXX
169*cdf0e10cSrcweir #endif
170