1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef CHART_CHARTDATAWRAPPER_HXX
28 #define CHART_CHARTDATAWRAPPER_HXX
30 #include "ServiceMacros.hxx"
31 #include "MutexContainer.hxx"
32 #include <cppuhelper/implbase4.hxx>
33 #include <cppuhelper/interfacecontainer.hxx>
34 #include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/chart2/XChartDocument.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
40 #include <boost/shared_ptr.hpp>
47 class Chart2ModelContact
;
50 class ChartDataWrapper
: public MutexContainer
, public
51 ::cppu::WeakImplHelper4
<
52 com::sun::star::chart::XComplexDescriptionAccess
,
53 com::sun::star::lang::XServiceInfo
,
54 com::sun::star::lang::XEventListener
,
55 com::sun::star::lang::XComponent
>
58 ChartDataWrapper( ::boost::shared_ptr
< Chart2ModelContact
> spChart2ModelContact
);
59 ChartDataWrapper( ::boost::shared_ptr
< Chart2ModelContact
> spChart2ModelContact
60 , const ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XChartData
>& xNewData
);
61 virtual ~ChartDataWrapper();
63 /// XServiceInfo declarations
64 APPHELPER_XSERVICEINFO_DECL()
67 // ____ XComplexDescriptionAccess ____
68 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::rtl::OUString
> > SAL_CALL
69 getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
setComplexRowDescriptions(
71 const ::com::sun::star::uno::Sequence
<
72 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> >& aRowDescriptions
)
73 throw (::com::sun::star::uno::RuntimeException
);
74 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::rtl::OUString
> > SAL_CALL
75 getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException
);
76 virtual void SAL_CALL
setComplexColumnDescriptions(
77 const ::com::sun::star::uno::Sequence
<
78 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> >& aColumnDescriptions
)
79 throw (::com::sun::star::uno::RuntimeException
);
81 // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
82 virtual ::com::sun::star::uno::Sequence
<
83 ::com::sun::star::uno::Sequence
<
84 double > > SAL_CALL
getData()
85 throw (::com::sun::star::uno::RuntimeException
);
86 virtual void SAL_CALL
setData( const ::com::sun::star::uno::Sequence
<
87 ::com::sun::star::uno::Sequence
<
89 throw (::com::sun::star::uno::RuntimeException
);
90 virtual ::com::sun::star::uno::Sequence
<
91 ::rtl::OUString
> SAL_CALL
getRowDescriptions()
92 throw (::com::sun::star::uno::RuntimeException
);
93 virtual void SAL_CALL
setRowDescriptions( const ::com::sun::star::uno::Sequence
<
94 ::rtl::OUString
>& aRowDescriptions
)
95 throw (::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::uno::Sequence
<
97 ::rtl::OUString
> SAL_CALL
getColumnDescriptions()
98 throw (::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
setColumnDescriptions( const ::com::sun::star::uno::Sequence
<
100 ::rtl::OUString
>& aColumnDescriptions
)
101 throw (::com::sun::star::uno::RuntimeException
);
103 // ____ XChartData (base of XChartDataArray) ____
104 virtual void SAL_CALL
addChartDataChangeEventListener( const ::com::sun::star::uno::Reference
<
105 ::com::sun::star::chart::XChartDataChangeEventListener
>& aListener
)
106 throw (::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference
<
108 ::com::sun::star::chart::XChartDataChangeEventListener
>& aListener
)
109 throw (::com::sun::star::uno::RuntimeException
);
110 virtual double SAL_CALL
getNotANumber()
111 throw (::com::sun::star::uno::RuntimeException
);
112 virtual sal_Bool SAL_CALL
isNotANumber( double nNumber
)
113 throw (::com::sun::star::uno::RuntimeException
);
115 // ____ XComponent ____
116 virtual void SAL_CALL
dispose()
117 throw (::com::sun::star::uno::RuntimeException
);
118 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
<
119 ::com::sun::star::lang::XEventListener
>& xListener
)
120 throw (::com::sun::star::uno::RuntimeException
);
121 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
<
122 ::com::sun::star::lang::XEventListener
>& aListener
)
123 throw (::com::sun::star::uno::RuntimeException
);
125 // ____ XEventListener ____
126 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
127 throw (::com::sun::star::uno::RuntimeException
);
130 void fireChartDataChangeEvent( ::com::sun::star::chart::ChartDataChangeEvent
& aEvent
);
133 void switchToInternalDataProvider();
134 void initDataAccess();
135 void applyData( lcl_Operator
& rDataOperator
);
138 ::com::sun::star::uno::Reference
<
139 ::com::sun::star::chart::XComplexDescriptionAccess
> m_xDataAccess
;
141 ::boost::shared_ptr
< Chart2ModelContact
> m_spChart2ModelContact
;
142 ::cppu::OInterfaceContainerHelper m_aEventListenerContainer
;
145 } // namespace wrapper
148 // CHART_CHARTDATAWRAPPER_HXX