1*de7b3f82SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*de7b3f82SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*de7b3f82SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*de7b3f82SAndrew Rist * distributed with this work for additional information 6*de7b3f82SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*de7b3f82SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*de7b3f82SAndrew Rist * "License"); you may not use this file except in compliance 9*de7b3f82SAndrew Rist * with the License. You may obtain a copy of the License at 10*de7b3f82SAndrew Rist * 11*de7b3f82SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*de7b3f82SAndrew Rist * 13*de7b3f82SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*de7b3f82SAndrew Rist * software distributed under the License is distributed on an 15*de7b3f82SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*de7b3f82SAndrew Rist * KIND, either express or implied. See the License for the 17*de7b3f82SAndrew Rist * specific language governing permissions and limitations 18*de7b3f82SAndrew Rist * under the License. 19*de7b3f82SAndrew Rist * 20*de7b3f82SAndrew Rist *************************************************************/ 21*de7b3f82SAndrew Rist 22*de7b3f82SAndrew Rist 23cdf0e10cSrcweir #ifndef CHART_CHARTDATAWRAPPER_HXX 24cdf0e10cSrcweir #define CHART_CHARTDATAWRAPPER_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "ServiceMacros.hxx" 27cdf0e10cSrcweir #include "MutexContainer.hxx" 28cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 29cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 30cdf0e10cSrcweir #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> 31cdf0e10cSrcweir #include <com/sun/star/chart/XDateCategories.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 34cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp> 35cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace chart 40cdf0e10cSrcweir { 41cdf0e10cSrcweir namespace wrapper 42cdf0e10cSrcweir { 43cdf0e10cSrcweir 44cdf0e10cSrcweir class Chart2ModelContact; 45cdf0e10cSrcweir struct lcl_Operator; 46cdf0e10cSrcweir 47cdf0e10cSrcweir class ChartDataWrapper : public MutexContainer, public 48cdf0e10cSrcweir ::cppu::WeakImplHelper5< 49cdf0e10cSrcweir com::sun::star::chart2::XAnyDescriptionAccess, 50cdf0e10cSrcweir com::sun::star::chart::XDateCategories, 51cdf0e10cSrcweir com::sun::star::lang::XServiceInfo, 52cdf0e10cSrcweir com::sun::star::lang::XEventListener, 53cdf0e10cSrcweir com::sun::star::lang::XComponent > 54cdf0e10cSrcweir { 55cdf0e10cSrcweir public: 56cdf0e10cSrcweir ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 57cdf0e10cSrcweir ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact 58cdf0e10cSrcweir , const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData >& xNewData ); 59cdf0e10cSrcweir virtual ~ChartDataWrapper(); 60cdf0e10cSrcweir 61cdf0e10cSrcweir /// XServiceInfo declarations 62cdf0e10cSrcweir APPHELPER_XSERVICEINFO_DECL() 63cdf0e10cSrcweir 64cdf0e10cSrcweir protected: 65cdf0e10cSrcweir // ____ XDateCategories ____ 66cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException); 67cdf0e10cSrcweir virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir 69cdf0e10cSrcweir // ____ XAnyDescriptionAccess ____ 70cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL 71cdf0e10cSrcweir getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir virtual void SAL_CALL setAnyRowDescriptions( 73cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 74cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions ) 75cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 76cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL 77cdf0e10cSrcweir getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir virtual void SAL_CALL setAnyColumnDescriptions( 79cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 80cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions ) 81cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 82cdf0e10cSrcweir 83cdf0e10cSrcweir // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____ 84cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL 85cdf0e10cSrcweir getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir virtual void SAL_CALL setComplexRowDescriptions( 87cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 88cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) 89cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 90cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL 91cdf0e10cSrcweir getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir virtual void SAL_CALL setComplexColumnDescriptions( 93cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 94cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions ) 95cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // ____ XChartDataArray (base of XComplexDescriptionAccess) ____ 98cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 99cdf0e10cSrcweir ::com::sun::star::uno::Sequence< 100cdf0e10cSrcweir double > > SAL_CALL getData() 101cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< 103cdf0e10cSrcweir ::com::sun::star::uno::Sequence< 104cdf0e10cSrcweir double > >& aData ) 105cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 107cdf0e10cSrcweir ::rtl::OUString > SAL_CALL getRowDescriptions() 108cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< 110cdf0e10cSrcweir ::rtl::OUString >& aRowDescriptions ) 111cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 113cdf0e10cSrcweir ::rtl::OUString > SAL_CALL getColumnDescriptions() 114cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< 116cdf0e10cSrcweir ::rtl::OUString >& aColumnDescriptions ) 117cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // ____ XChartData (base of XChartDataArray) ____ 120cdf0e10cSrcweir virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference< 121cdf0e10cSrcweir ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) 122cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference< 124cdf0e10cSrcweir ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) 125cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 126cdf0e10cSrcweir virtual double SAL_CALL getNotANumber() 127cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 128cdf0e10cSrcweir virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) 129cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 130cdf0e10cSrcweir 131cdf0e10cSrcweir // ____ XComponent ____ 132cdf0e10cSrcweir virtual void SAL_CALL dispose() 133cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 134cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< 135cdf0e10cSrcweir ::com::sun::star::lang::XEventListener >& xListener ) 136cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 137cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< 138cdf0e10cSrcweir ::com::sun::star::lang::XEventListener >& aListener ) 139cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 140cdf0e10cSrcweir 141cdf0e10cSrcweir // ____ XEventListener ____ 142cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 143cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir void fireChartDataChangeEvent( ::com::sun::star::chart::ChartDataChangeEvent& aEvent ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir private: //methods 149cdf0e10cSrcweir void switchToInternalDataProvider(); 150cdf0e10cSrcweir void initDataAccess(); 151cdf0e10cSrcweir void applyData( lcl_Operator& rDataOperator ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir private: //member 154cdf0e10cSrcweir ::com::sun::star::uno::Reference< 155cdf0e10cSrcweir ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess; 156cdf0e10cSrcweir 157cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 158cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; 159cdf0e10cSrcweir }; 160cdf0e10cSrcweir 161cdf0e10cSrcweir } // namespace wrapper 162cdf0e10cSrcweir } // namespace chart 163cdf0e10cSrcweir 164cdf0e10cSrcweir // CHART_CHARTDATAWRAPPER_HXX 165cdf0e10cSrcweir #endif 166