xref: /trunk/main/chart2/source/model/inc/Diagram.hxx (revision de7b3f82)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART_DIAGRAM_HXX
24 #define CHART_DIAGRAM_HXX
25 
26 #include "OPropertySet.hxx"
27 #include "MutexContainer.hxx"
28 #include <cppuhelper/implbase8.hxx>
29 #include <comphelper/uno3.hxx>
30 #include <com/sun/star/beans/PropertyValue.hpp>
31 #include <com/sun/star/chart2/data/XDataSource.hpp>
32 #include <com/sun/star/chart2/XDiagram.hpp>
33 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
34 #include <com/sun/star/chart2/XTitled.hpp>
35 #include <com/sun/star/chart/X3DDefaultSetter.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <com/sun/star/util/XCloneable.hpp>
39 #include <com/sun/star/util/XModifyBroadcaster.hpp>
40 #include <com/sun/star/util/XModifyListener.hpp>
41 
42 #include "ServiceMacros.hxx"
43 
44 #include <map>
45 #include <vector>
46 
47 namespace chart
48 {
49 
50 namespace impl
51 {
52 typedef ::cppu::WeakImplHelper8<
53     ::com::sun::star::chart2::XDiagram,
54     ::com::sun::star::lang::XServiceInfo,
55     ::com::sun::star::chart2::XCoordinateSystemContainer,
56     ::com::sun::star::chart2::XTitled,
57     ::com::sun::star::chart::X3DDefaultSetter,
58     ::com::sun::star::util::XModifyBroadcaster,
59     ::com::sun::star::util::XModifyListener,
60     ::com::sun::star::util::XCloneable >
61     Diagram_Base;
62 }
63 
64 class Diagram :
65     public MutexContainer,
66     public impl::Diagram_Base,
67     public ::property::OPropertySet
68 {
69 public:
70 	Diagram( ::com::sun::star::uno::Reference<
71              ::com::sun::star::uno::XComponentContext > const & xContext );
72 	virtual ~Diagram();
73 
74     /// establish methods for factory instatiation
75     APPHELPER_SERVICE_FACTORY_HELPER( Diagram )
76 
77     /// XServiceInfo declarations
78     APPHELPER_XSERVICEINFO_DECL()
79 
80     /// merge XInterface implementations
81  	DECLARE_XINTERFACE()
82     /// merge XTypeProvider implementations
83  	DECLARE_XTYPEPROVIDER()
84 
85 protected:
86     explicit Diagram( const Diagram & rOther );
87 
88     // ____ OPropertySet ____
89     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
90         throw(::com::sun::star::beans::UnknownPropertyException);
91 
92     // ____ OPropertySet ____
93 	virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
94 
95     // ____ XPropertySet ____
96     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
97         getPropertySetInfo()
98         throw (::com::sun::star::uno::RuntimeException);
99 
100     // ____ XFastPropertySet ____
101 	virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
102 		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);
103 
104     /// make original interface function visible again
105     using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
106 
107 	virtual void SAL_CALL getFastPropertyValue(
108 		::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
109 
110 // 	virtual sal_Bool SAL_CALL convertFastPropertyValue
111 //         ( ::com::sun::star::uno::Any & rConvertedValue,
112 //           ::com::sun::star::uno::Any & rOldValue,
113 //           sal_Int32 nHandle,
114 //           const ::com::sun::star::uno::Any& rValue )
115 // 		throw (::com::sun::star::lang::IllegalArgumentException);
116 
117     // ____ XDiagram ____
118     virtual ::com::sun::star::uno::Reference<
119         ::com::sun::star::beans::XPropertySet > SAL_CALL getWall()
120         throw (::com::sun::star::uno::RuntimeException);
121     virtual ::com::sun::star::uno::Reference<
122         ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor()
123         throw (::com::sun::star::uno::RuntimeException);
124     virtual ::com::sun::star::uno::Reference<
125         ::com::sun::star::chart2::XLegend > SAL_CALL getLegend()
126         throw (::com::sun::star::uno::RuntimeException);
127     virtual void SAL_CALL setLegend( const ::com::sun::star::uno::Reference<
128                                      ::com::sun::star::chart2::XLegend >& xLegend )
129         throw (::com::sun::star::uno::RuntimeException);
130     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > SAL_CALL getDefaultColorScheme()
131         throw (::com::sun::star::uno::RuntimeException);
132     virtual void SAL_CALL setDefaultColorScheme(
133         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme >& xColorScheme )
134         throw (::com::sun::star::uno::RuntimeException);
135     virtual void SAL_CALL setDiagramData(
136         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource,
137         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
138             throw (::com::sun::star::uno::RuntimeException);
139 
140     // ____ XCoordinateSystemContainer ____
141     virtual void SAL_CALL addCoordinateSystem(
142         const ::com::sun::star::uno::Reference<
143             ::com::sun::star::chart2::XCoordinateSystem >& aCoordSys )
144         throw (::com::sun::star::lang::IllegalArgumentException,
145                ::com::sun::star::uno::RuntimeException);
146     virtual void SAL_CALL removeCoordinateSystem(
147         const ::com::sun::star::uno::Reference<
148             ::com::sun::star::chart2::XCoordinateSystem >& aCoordSys )
149         throw (::com::sun::star::container::NoSuchElementException,
150                ::com::sun::star::uno::RuntimeException);
151     virtual ::com::sun::star::uno::Sequence<
152         ::com::sun::star::uno::Reference<
153         ::com::sun::star::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems()
154         throw (::com::sun::star::uno::RuntimeException);
155     virtual void SAL_CALL setCoordinateSystems(
156         const ::com::sun::star::uno::Sequence<
157             ::com::sun::star::uno::Reference<
158                 ::com::sun::star::chart2::XCoordinateSystem > >& aCoordinateSystems )
159         throw (::com::sun::star::lang::IllegalArgumentException,
160                ::com::sun::star::uno::RuntimeException);
161 
162     // ____ XTitled ____
163     virtual ::com::sun::star::uno::Reference<
164         ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject()
165         throw (::com::sun::star::uno::RuntimeException);
166     virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference<
167                                           ::com::sun::star::chart2::XTitle >& Title )
168         throw (::com::sun::star::uno::RuntimeException);
169 
170     // ____ X3DDefaultSetter ____
171     virtual void SAL_CALL set3DSettingsToDefault() throw (::com::sun::star::uno::RuntimeException);
172     virtual void SAL_CALL setDefaultRotation() throw (::com::sun::star::uno::RuntimeException);
173     virtual void SAL_CALL setDefaultIllumination() throw (::com::sun::star::uno::RuntimeException);
174 
175     // ____ XCloneable ____
176     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
177         throw (::com::sun::star::uno::RuntimeException);
178 
179     // ____ XModifyBroadcaster ____
180     virtual void SAL_CALL addModifyListener(
181         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
182         throw (::com::sun::star::uno::RuntimeException);
183     virtual void SAL_CALL removeModifyListener(
184         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
185         throw (::com::sun::star::uno::RuntimeException);
186 
187     // ____ XModifyListener ____
188     virtual void SAL_CALL modified(
189         const ::com::sun::star::lang::EventObject& aEvent )
190         throw (::com::sun::star::uno::RuntimeException);
191 
192     // ____ XEventListener (base of XModifyListener) ____
193     virtual void SAL_CALL disposing(
194         const ::com::sun::star::lang::EventObject& Source )
195         throw (::com::sun::star::uno::RuntimeException);
196 
197     // ____ OPropertySet ____
198     virtual void firePropertyChangeEvent();
199 	using OPropertySet::disposing;
200 
201     void fireModifyEvent();
202 
203 private:
204      ::com::sun::star::uno::Reference<
205          ::com::sun::star::uno::XComponentContext >                m_xContext;
206 
207     typedef
208         ::std::vector< ::com::sun::star::uno::Reference<
209             ::com::sun::star::chart2::XCoordinateSystem > >
210         tCoordinateSystemContainerType;
211 
212     tCoordinateSystemContainerType m_aCoordSystems;
213 
214     ::com::sun::star::uno::Reference<
215         ::com::sun::star::beans::XPropertySet >
216                         m_xWall;
217 
218     ::com::sun::star::uno::Reference<
219         ::com::sun::star::beans::XPropertySet >
220                         m_xFloor;
221 
222     ::com::sun::star::uno::Reference<
223         ::com::sun::star::chart2::XTitle >
224                         m_xTitle;
225 
226     ::com::sun::star::uno::Reference<
227         ::com::sun::star::chart2::XLegend >
228                         m_xLegend;
229 
230     ::com::sun::star::uno::Reference<
231         ::com::sun::star::chart2::XColorScheme >
232                         m_xColorScheme;
233 
234     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
235 };
236 
237 } //  namespace chart
238 
239 // CHART_DIAGRAM_HXX
240 #endif
241