xref: /trunk/main/chart2/source/model/inc/Diagram.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 #ifndef CHART_DIAGRAM_HXX
28 #define CHART_DIAGRAM_HXX
29 
30 #include "OPropertySet.hxx"
31 #include "MutexContainer.hxx"
32 #include <cppuhelper/implbase8.hxx>
33 #include <comphelper/uno3.hxx>
34 #include <com/sun/star/beans/PropertyValue.hpp>
35 #include <com/sun/star/chart2/data/XDataSource.hpp>
36 #include <com/sun/star/chart2/XDiagram.hpp>
37 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
38 #include <com/sun/star/chart2/XTitled.hpp>
39 #include <com/sun/star/chart/X3DDefaultSetter.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/uno/XComponentContext.hpp>
42 #include <com/sun/star/util/XCloneable.hpp>
43 #include <com/sun/star/util/XModifyBroadcaster.hpp>
44 #include <com/sun/star/util/XModifyListener.hpp>
45 
46 #include "ServiceMacros.hxx"
47 
48 #include <map>
49 #include <vector>
50 
51 namespace chart
52 {
53 
54 namespace impl
55 {
56 typedef ::cppu::WeakImplHelper8<
57     ::com::sun::star::chart2::XDiagram,
58     ::com::sun::star::lang::XServiceInfo,
59     ::com::sun::star::chart2::XCoordinateSystemContainer,
60     ::com::sun::star::chart2::XTitled,
61     ::com::sun::star::chart::X3DDefaultSetter,
62     ::com::sun::star::util::XModifyBroadcaster,
63     ::com::sun::star::util::XModifyListener,
64     ::com::sun::star::util::XCloneable >
65     Diagram_Base;
66 }
67 
68 class Diagram :
69     public MutexContainer,
70     public impl::Diagram_Base,
71     public ::property::OPropertySet
72 {
73 public:
74 	Diagram( ::com::sun::star::uno::Reference<
75              ::com::sun::star::uno::XComponentContext > const & xContext );
76 	virtual ~Diagram();
77 
78     /// establish methods for factory instatiation
79     APPHELPER_SERVICE_FACTORY_HELPER( Diagram )
80 
81     /// XServiceInfo declarations
82     APPHELPER_XSERVICEINFO_DECL()
83 
84     /// merge XInterface implementations
85  	DECLARE_XINTERFACE()
86     /// merge XTypeProvider implementations
87  	DECLARE_XTYPEPROVIDER()
88 
89 protected:
90     explicit Diagram( const Diagram & rOther );
91 
92     // ____ OPropertySet ____
93     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
94         throw(::com::sun::star::beans::UnknownPropertyException);
95 
96     // ____ OPropertySet ____
97 	virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
98 
99     // ____ XPropertySet ____
100     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
101         getPropertySetInfo()
102         throw (::com::sun::star::uno::RuntimeException);
103 
104     // ____ XFastPropertySet ____
105 	virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
106 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
107 
108     /// make original interface function visible again
109     using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
110 
111 	virtual void SAL_CALL getFastPropertyValue(
112 		::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
113 
114 // 	virtual sal_Bool SAL_CALL convertFastPropertyValue
115 //         ( ::com::sun::star::uno::Any & rConvertedValue,
116 //           ::com::sun::star::uno::Any & rOldValue,
117 //           sal_Int32 nHandle,
118 //           const ::com::sun::star::uno::Any& rValue )
119 // 		throw (::com::sun::star::lang::IllegalArgumentException);
120 
121     // ____ XDiagram ____
122     virtual ::com::sun::star::uno::Reference<
123         ::com::sun::star::beans::XPropertySet > SAL_CALL getWall()
124         throw (::com::sun::star::uno::RuntimeException);
125     virtual ::com::sun::star::uno::Reference<
126         ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor()
127         throw (::com::sun::star::uno::RuntimeException);
128     virtual ::com::sun::star::uno::Reference<
129         ::com::sun::star::chart2::XLegend > SAL_CALL getLegend()
130         throw (::com::sun::star::uno::RuntimeException);
131     virtual void SAL_CALL setLegend( const ::com::sun::star::uno::Reference<
132                                      ::com::sun::star::chart2::XLegend >& xLegend )
133         throw (::com::sun::star::uno::RuntimeException);
134     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > SAL_CALL getDefaultColorScheme()
135         throw (::com::sun::star::uno::RuntimeException);
136     virtual void SAL_CALL setDefaultColorScheme(
137         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme >& xColorScheme )
138         throw (::com::sun::star::uno::RuntimeException);
139     virtual void SAL_CALL setDiagramData(
140         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource,
141         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
142             throw (::com::sun::star::uno::RuntimeException);
143 
144     // ____ XCoordinateSystemContainer ____
145     virtual void SAL_CALL addCoordinateSystem(
146         const ::com::sun::star::uno::Reference<
147             ::com::sun::star::chart2::XCoordinateSystem >& aCoordSys )
148         throw (::com::sun::star::lang::IllegalArgumentException,
149                ::com::sun::star::uno::RuntimeException);
150     virtual void SAL_CALL removeCoordinateSystem(
151         const ::com::sun::star::uno::Reference<
152             ::com::sun::star::chart2::XCoordinateSystem >& aCoordSys )
153         throw (::com::sun::star::container::NoSuchElementException,
154                ::com::sun::star::uno::RuntimeException);
155     virtual ::com::sun::star::uno::Sequence<
156         ::com::sun::star::uno::Reference<
157         ::com::sun::star::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems()
158         throw (::com::sun::star::uno::RuntimeException);
159     virtual void SAL_CALL setCoordinateSystems(
160         const ::com::sun::star::uno::Sequence<
161             ::com::sun::star::uno::Reference<
162                 ::com::sun::star::chart2::XCoordinateSystem > >& aCoordinateSystems )
163         throw (::com::sun::star::lang::IllegalArgumentException,
164                ::com::sun::star::uno::RuntimeException);
165 
166     // ____ XTitled ____
167     virtual ::com::sun::star::uno::Reference<
168         ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject()
169         throw (::com::sun::star::uno::RuntimeException);
170     virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference<
171                                           ::com::sun::star::chart2::XTitle >& Title )
172         throw (::com::sun::star::uno::RuntimeException);
173 
174     // ____ X3DDefaultSetter ____
175     virtual void SAL_CALL set3DSettingsToDefault() throw (::com::sun::star::uno::RuntimeException);
176     virtual void SAL_CALL setDefaultRotation() throw (::com::sun::star::uno::RuntimeException);
177     virtual void SAL_CALL setDefaultIllumination() throw (::com::sun::star::uno::RuntimeException);
178 
179     // ____ XCloneable ____
180     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
181         throw (::com::sun::star::uno::RuntimeException);
182 
183     // ____ XModifyBroadcaster ____
184     virtual void SAL_CALL addModifyListener(
185         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
186         throw (::com::sun::star::uno::RuntimeException);
187     virtual void SAL_CALL removeModifyListener(
188         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
189         throw (::com::sun::star::uno::RuntimeException);
190 
191     // ____ XModifyListener ____
192     virtual void SAL_CALL modified(
193         const ::com::sun::star::lang::EventObject& aEvent )
194         throw (::com::sun::star::uno::RuntimeException);
195 
196     // ____ XEventListener (base of XModifyListener) ____
197     virtual void SAL_CALL disposing(
198         const ::com::sun::star::lang::EventObject& Source )
199         throw (::com::sun::star::uno::RuntimeException);
200 
201     // ____ OPropertySet ____
202     virtual void firePropertyChangeEvent();
203 	using OPropertySet::disposing;
204 
205     void fireModifyEvent();
206 
207 private:
208      ::com::sun::star::uno::Reference<
209          ::com::sun::star::uno::XComponentContext >                m_xContext;
210 
211     typedef
212         ::std::vector< ::com::sun::star::uno::Reference<
213             ::com::sun::star::chart2::XCoordinateSystem > >
214         tCoordinateSystemContainerType;
215 
216     tCoordinateSystemContainerType m_aCoordSystems;
217 
218     ::com::sun::star::uno::Reference<
219         ::com::sun::star::beans::XPropertySet >
220                         m_xWall;
221 
222     ::com::sun::star::uno::Reference<
223         ::com::sun::star::beans::XPropertySet >
224                         m_xFloor;
225 
226     ::com::sun::star::uno::Reference<
227         ::com::sun::star::chart2::XTitle >
228                         m_xTitle;
229 
230     ::com::sun::star::uno::Reference<
231         ::com::sun::star::chart2::XLegend >
232                         m_xLegend;
233 
234     ::com::sun::star::uno::Reference<
235         ::com::sun::star::chart2::XColorScheme >
236                         m_xColorScheme;
237 
238     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
239 };
240 
241 } //  namespace chart
242 
243 // CHART_DIAGRAM_HXX
244 #endif
245