xref: /trunk/main/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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_DIAGRAMWRAPPER_HXX
24 #define CHART_DIAGRAMWRAPPER_HXX
25 
26 #include "WrappedPropertySet.hxx"
27 #include "ServiceMacros.hxx"
28 #include "DiagramHelper.hxx"
29 
30 #if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13)
31 #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13
32 #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13
33 #include "comphelper/implbase_var.hxx"
34 #endif
35 
36 #include <comphelper/uno3.hxx>
37 #include <cppuhelper/interfacecontainer.hxx>
38 #include <com/sun/star/chart2/XChartDocument.hpp>
39 #include <com/sun/star/chart2/XDiagram.hpp>
40 #include <com/sun/star/uno/XComponentContext.hpp>
41 #include <com/sun/star/chart/XDiagramPositioning.hpp>
42 #include <com/sun/star/chart2/XDiagramProvider.hpp>
43 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
44 #include <com/sun/star/chart2/XChartTypeManager.hpp>
45 #include <com/sun/star/chart/XDiagram.hpp>
46 #include <com/sun/star/chart/XAxisSupplier.hpp>
47 #include <com/sun/star/chart/XAxisZSupplier.hpp>
48 #include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
49 #include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
50 #include <com/sun/star/chart/XStatisticDisplay.hpp>
51 #include <com/sun/star/chart/X3DDisplay.hpp>
52 #include <com/sun/star/lang/XServiceInfo.hpp>
53 #include <com/sun/star/lang/XComponent.hpp>
54 #include <com/sun/star/lang/XEventListener.hpp>
55 #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
56 
57 #include <com/sun/star/chart/X3DDefaultSetter.hpp>
58 #include <boost/shared_ptr.hpp>
59 
60 namespace chart
61 {
62 namespace wrapper
63 {
64 
65 class Chart2ModelContact;
66 
67 class DiagramWrapper : public ::comphelper::ImplInheritanceHelper13<
68                       WrappedPropertySet
69                      , ::com::sun::star::chart::XDiagram
70                      , ::com::sun::star::chart::XAxisSupplier
71                      , ::com::sun::star::chart::XAxisZSupplier
72                      , ::com::sun::star::chart::XTwoAxisXSupplier   //  : XAxisXSupplier
73                      , ::com::sun::star::chart::XTwoAxisYSupplier   //  : XAxisYSupplier
74                      , ::com::sun::star::chart::XStatisticDisplay
75                      , ::com::sun::star::chart::X3DDisplay
76                      , ::com::sun::star::chart::X3DDefaultSetter
77                      , ::com::sun::star::lang::XServiceInfo
78                      , ::com::sun::star::lang::XComponent
79 //                      , ::com::sun::star::lang::XEventListener
80                      , ::com::sun::star::chart::XDiagramPositioning
81                      , ::com::sun::star::chart2::XDiagramProvider
82                      , ::com::sun::star::chart::XSecondAxisTitleSupplier
83                     >
84 {
85 public:
86     DiagramWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
87     virtual ~DiagramWrapper();
88 
89     /// XServiceInfo declarations
90     APPHELPER_XSERVICEINFO_DECL()
91 
92     // ____ XComponent ____
93     virtual void SAL_CALL dispose();
94     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
95                                             ::com::sun::star::lang::XEventListener >& xListener );
96     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
97                                                ::com::sun::star::lang::XEventListener >& aListener );
98 
99     // ____ XDiagram ____
100     virtual ::rtl::OUString SAL_CALL getDiagramType();
101     virtual ::com::sun::star::uno::Reference<
102         ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 nRow );
103     virtual ::com::sun::star::uno::Reference<
104         ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow );
105 
106     // ____ XShape (base of XDiagram) ____
107     virtual ::com::sun::star::awt::Point SAL_CALL getPosition();
108     virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition );
109     virtual ::com::sun::star::awt::Size SAL_CALL getSize();
110     virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize );
111 
112     // ____ XShapeDescriptor (base of XShape) ____
113     virtual ::rtl::OUString SAL_CALL getShapeType();
114 
115     // ____ XAxisSupplier ____
116     virtual ::com::sun::star::uno::Reference<
117         ::com::sun::star::chart::XAxis > SAL_CALL getAxis( sal_Int32 nDimensionIndex );
118     virtual ::com::sun::star::uno::Reference<
119         ::com::sun::star::chart::XAxis > SAL_CALL getSecondaryAxis( sal_Int32 nDimensionIndex );
120 
121     // ____ XAxisZSupplier ____
122     virtual ::com::sun::star::uno::Reference<
123         ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle();
124     virtual ::com::sun::star::uno::Reference<
125         ::com::sun::star::beans::XPropertySet > SAL_CALL getZMainGrid();
126     virtual ::com::sun::star::uno::Reference<
127         ::com::sun::star::beans::XPropertySet > SAL_CALL getZHelpGrid();
128     virtual ::com::sun::star::uno::Reference<
129         ::com::sun::star::beans::XPropertySet > SAL_CALL getZAxis();
130 
131     // ____ XTwoAxisXSupplier ____
132     virtual ::com::sun::star::uno::Reference<
133         ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryXAxis();
134 
135     // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
136     virtual ::com::sun::star::uno::Reference<
137         ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle();
138     virtual ::com::sun::star::uno::Reference<
139         ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis();
140     virtual ::com::sun::star::uno::Reference<
141         ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid();
142     virtual ::com::sun::star::uno::Reference<
143         ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid();
144 
145     // ____ XTwoAxisYSupplier ____
146     virtual ::com::sun::star::uno::Reference<
147         ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryYAxis();
148 
149     // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
150     virtual ::com::sun::star::uno::Reference<
151         ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle();
152     virtual ::com::sun::star::uno::Reference<
153         ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis();
154     virtual ::com::sun::star::uno::Reference<
155         ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid();
156     virtual ::com::sun::star::uno::Reference<
157         ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid();
158 
159    // ____ XSecondAxisTitleSupplier ____
160     virtual ::com::sun::star::uno::Reference<
161         ::com::sun::star::drawing::XShape > SAL_CALL getSecondXAxisTitle();
162     virtual ::com::sun::star::uno::Reference<
163         ::com::sun::star::drawing::XShape > SAL_CALL getSecondYAxisTitle();
164 
165     // ____ XStatisticDisplay ____
166     virtual ::com::sun::star::uno::Reference<
167         ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar();
168     virtual ::com::sun::star::uno::Reference<
169         ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar();
170     virtual ::com::sun::star::uno::Reference<
171         ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine();
172 
173     // ____ X3DDisplay ____
174     virtual ::com::sun::star::uno::Reference<
175         ::com::sun::star::beans::XPropertySet > SAL_CALL getWall();
176     virtual ::com::sun::star::uno::Reference<
177         ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor();
178 
179     // ____ X3DDefaultSetter ____
180     virtual void SAL_CALL set3DSettingsToDefault();
181     virtual void SAL_CALL setDefaultRotation();
182     virtual void SAL_CALL setDefaultIllumination();
183 
184 //     // ____ XEventListener ____
185 //     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
186 //         throw (::com::sun::star::uno::RuntimeException);
187 
188     // ____ XDiagramPositioning ____
189 
190     virtual void SAL_CALL setAutomaticDiagramPositioning(  );
191     virtual ::sal_Bool SAL_CALL isAutomaticDiagramPositioning(  );
192     virtual void SAL_CALL setDiagramPositionExcludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect );
193     virtual ::sal_Bool SAL_CALL isExcludingDiagramPositioning(  );
194     virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionExcludingAxes(  );
195     virtual void SAL_CALL setDiagramPositionIncludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect );
196     virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxes(  );
197     virtual void SAL_CALL setDiagramPositionIncludingAxesAndAxisTitles( const ::com::sun::star::awt::Rectangle& PositionRect );
198     virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxesAndAxisTitles(  );
199 
200     // ____ XDiagramProvider ____
201     virtual ::com::sun::star::uno::Reference<
202             ::com::sun::star::chart2::XDiagram > SAL_CALL getDiagram();
203     virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference<
204                                       ::com::sun::star::chart2::XDiagram >& xDiagram );
205 
206 protected:
207     // ____ WrappedPropertySet ____
208     virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
209     virtual const std::vector< WrappedProperty* > createWrappedProperties();
210     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
211 
212 private:
213     void updateFromModel();
214 
215     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
216     ::cppu::OInterfaceContainerHelper           m_aEventListenerContainer;
217 
218     ::com::sun::star::uno::Reference<
219         ::com::sun::star::chart::XAxis >        m_xXAxis;
220     ::com::sun::star::uno::Reference<
221         ::com::sun::star::chart::XAxis >        m_xYAxis;
222     ::com::sun::star::uno::Reference<
223         ::com::sun::star::chart::XAxis >        m_xZAxis;
224     ::com::sun::star::uno::Reference<
225         ::com::sun::star::chart::XAxis >        m_xSecondXAxis;
226     ::com::sun::star::uno::Reference<
227         ::com::sun::star::chart::XAxis >        m_xSecondYAxis;
228 
229     ::com::sun::star::uno::Reference<
230         ::com::sun::star::beans::XPropertySet > m_xWall;
231     ::com::sun::star::uno::Reference<
232         ::com::sun::star::beans::XPropertySet > m_xFloor;
233 
234     ::com::sun::star::uno::Reference<
235         ::com::sun::star::beans::XPropertySet > m_xMinMaxLineWrapper;
236     ::com::sun::star::uno::Reference<
237         ::com::sun::star::beans::XPropertySet > m_xUpBarWrapper;
238     ::com::sun::star::uno::Reference<
239         ::com::sun::star::beans::XPropertySet > m_xDownBarWrapper;
240 };
241 
242 } //  namespace wrapper
243 } //  namespace chart
244 
245 // CHART_DIAGRAMWRAPPER_HXX
246 #endif
247