xref: /trunk/main/chart2/source/model/inc/BaseCoordinateSystem.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_COORDINATESYSTEM_HXX
24 #define CHART_COORDINATESYSTEM_HXX
25 
26 #include "ServiceMacros.hxx"
27 #include "OPropertySet.hxx"
28 #include "MutexContainer.hxx"
29 #include <cppuhelper/implbase6.hxx>
30 #include <comphelper/uno3.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/uno/XComponentContext.hpp>
33 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
34 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
35 #include <com/sun/star/util/XCloneable.hpp>
36 #include <com/sun/star/util/XModifyBroadcaster.hpp>
37 #include <com/sun/star/util/XModifyListener.hpp>
38 
39 #include <vector>
40 
41 namespace chart
42 {
43 
44 namespace impl
45 {
46 typedef ::cppu::WeakImplHelper6
47     < ::com::sun::star::lang::XServiceInfo,
48       ::com::sun::star::chart2::XCoordinateSystem,
49       ::com::sun::star::chart2::XChartTypeContainer,
50       ::com::sun::star::util::XCloneable,
51       ::com::sun::star::util::XModifyBroadcaster,
52       ::com::sun::star::util::XModifyListener >
53     BaseCoordinateSystem_Base;
54 }
55 
56 class BaseCoordinateSystem :
57         public impl::BaseCoordinateSystem_Base,
58         public MutexContainer,
59         public ::property::OPropertySet
60 {
61 public:
62     BaseCoordinateSystem(
63         const ::com::sun::star::uno::Reference<
64             ::com::sun::star::uno::XComponentContext > & xContext,
65         sal_Int32 nDimensionCount = 2,
66         sal_Bool bSwapXAndYAxis = sal_False );
67     explicit BaseCoordinateSystem( const BaseCoordinateSystem & rSource );
68     virtual ~BaseCoordinateSystem();
69 
70     // ____ OPropertySet ____
71     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const;
72 
73     virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
74 
75     // ____ XPropertySet ____
76     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
77         getPropertySetInfo();
78 
79     /// merge XInterface implementations
80     DECLARE_XINTERFACE()
81     /// merge XTypeProvider implementations
82     DECLARE_XTYPEPROVIDER()
83 
84 protected:
85     // ____ XCoordinateSystem ____
86     virtual ::sal_Int32 SAL_CALL getDimension();
87     // not implemented
88 //     virtual ::rtl::OUString SAL_CALL getCoordinateSystemType()
89 //         throw (::com::sun::star::uno::RuntimeException);
90     // not implemented
91 //     virtual ::rtl::OUString SAL_CALL getViewServiceName()
92 //         throw (::com::sun::star::uno::RuntimeException);
93     virtual void SAL_CALL setAxisByDimension(
94         ::sal_Int32 nDimension,
95         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis,
96         ::sal_Int32 nIndex );
97     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > SAL_CALL getAxisByDimension(
98         ::sal_Int32 nDimension, ::sal_Int32 nIndex );
99     virtual ::sal_Int32 SAL_CALL getMaximumAxisIndexByDimension( ::sal_Int32 nDimension );
100 
101     // ____ XChartTypeContainer ____
102     virtual void SAL_CALL addChartType(
103         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& aChartType );
104     virtual void SAL_CALL removeChartType(
105         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& aChartType );
106     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > SAL_CALL getChartTypes();
107     virtual void SAL_CALL setChartTypes(
108         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > >& aChartTypes );
109 
110     // ____ XCloneable ____
111     // not implemented
112 //     virtual ::com::sun::star::uno::Reference<
113 //         ::com::sun::star::util::XCloneable > SAL_CALL createClone()
114 //         throw (::com::sun::star::uno::RuntimeException);
115 
116     // ____ XServiceInfo ____
117     // not implemented
118 //     virtual ::rtl::OUString SAL_CALL getImplementationName()
119 //         throw (::com::sun::star::uno::RuntimeException);
120 //     virtual ::sal_Bool SAL_CALL supportsService(
121 //         const ::rtl::OUString& ServiceName )
122 //         throw (::com::sun::star::uno::RuntimeException);
123 //     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
124 //         throw (::com::sun::star::uno::RuntimeException);
125 
126     // ____ XModifyBroadcaster ____
127     virtual void SAL_CALL addModifyListener(
128         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener );
129     virtual void SAL_CALL removeModifyListener(
130         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener );
131 
132     // ____ XModifyListener ____
133     virtual void SAL_CALL modified(
134         const ::com::sun::star::lang::EventObject& aEvent );
135 
136     // ____ XEventListener (base of XModifyListener) ____
137     virtual void SAL_CALL disposing(
138         const ::com::sun::star::lang::EventObject& Source );
139 
140     // ____ OPropertySet ____
141     virtual void firePropertyChangeEvent();
142     using OPropertySet::disposing;
143 
144     void fireModifyEvent();
145 
146 protected:
147     ::com::sun::star::uno::Reference<
148         ::com::sun::star::uno::XComponentContext >        m_xContext;
149 
150     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
151 
152 private:
153     sal_Int32                                             m_nDimensionCount;
154     typedef ::std::vector< ::std::vector< ::com::sun::star::uno::Reference<
155         ::com::sun::star::chart2::XAxis > > > tAxisVecVecType;
156     tAxisVecVecType m_aAllAxis; //outer sequence is the dimension; inner sequence is the axis index that indicates main or secondary axis
157     ::com::sun::star::uno::Sequence<
158             ::com::sun::star::uno::Any >                  m_aOrigin;
159     ::std::vector< ::com::sun::star::uno::Reference<
160         ::com::sun::star::chart2::XChartType > >          m_aChartTypes;
161 };
162 
163 } //  namespace chart
164 
165 // CHART_COORDINATESYSTEM_HXX
166 #endif
167