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 throw(::com::sun::star::beans::UnknownPropertyException); 73 74 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 75 76 // ____ XPropertySet ____ 77 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 78 getPropertySetInfo() 79 throw (::com::sun::star::uno::RuntimeException); 80 81 /// merge XInterface implementations 82 DECLARE_XINTERFACE() 83 /// merge XTypeProvider implementations 84 DECLARE_XTYPEPROVIDER() 85 86 protected: 87 // ____ XCoordinateSystem ____ 88 virtual ::sal_Int32 SAL_CALL getDimension() 89 throw (::com::sun::star::uno::RuntimeException); 90 // not implemented 91 // virtual ::rtl::OUString SAL_CALL getCoordinateSystemType() 92 // throw (::com::sun::star::uno::RuntimeException); 93 // not implemented 94 // virtual ::rtl::OUString SAL_CALL getViewServiceName() 95 // throw (::com::sun::star::uno::RuntimeException); 96 virtual void SAL_CALL setAxisByDimension( 97 ::sal_Int32 nDimension, 98 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis, 99 ::sal_Int32 nIndex ) 100 throw (::com::sun::star::lang::IndexOutOfBoundsException, 101 ::com::sun::star::uno::RuntimeException); 102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > SAL_CALL getAxisByDimension( 103 ::sal_Int32 nDimension, ::sal_Int32 nIndex ) 104 throw (::com::sun::star::lang::IndexOutOfBoundsException, 105 ::com::sun::star::uno::RuntimeException); 106 virtual ::sal_Int32 SAL_CALL getMaximumAxisIndexByDimension( ::sal_Int32 nDimension ) 107 throw (::com::sun::star::lang::IndexOutOfBoundsException, 108 ::com::sun::star::uno::RuntimeException); 109 110 // ____ XChartTypeContainer ____ 111 virtual void SAL_CALL addChartType( 112 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& aChartType ) 113 throw (::com::sun::star::lang::IllegalArgumentException, 114 ::com::sun::star::uno::RuntimeException); 115 virtual void SAL_CALL removeChartType( 116 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& aChartType ) 117 throw (::com::sun::star::container::NoSuchElementException, 118 ::com::sun::star::uno::RuntimeException); 119 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > SAL_CALL getChartTypes() 120 throw (::com::sun::star::uno::RuntimeException); 121 virtual void SAL_CALL setChartTypes( 122 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > >& aChartTypes ) 123 throw (::com::sun::star::lang::IllegalArgumentException, 124 ::com::sun::star::uno::RuntimeException); 125 126 // ____ XCloneable ____ 127 // not implemented 128 // virtual ::com::sun::star::uno::Reference< 129 // ::com::sun::star::util::XCloneable > SAL_CALL createClone() 130 // throw (::com::sun::star::uno::RuntimeException); 131 132 // ____ XServiceInfo ____ 133 // not implemented 134 // virtual ::rtl::OUString SAL_CALL getImplementationName() 135 // throw (::com::sun::star::uno::RuntimeException); 136 // virtual ::sal_Bool SAL_CALL supportsService( 137 // const ::rtl::OUString& ServiceName ) 138 // throw (::com::sun::star::uno::RuntimeException); 139 // virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 140 // throw (::com::sun::star::uno::RuntimeException); 141 142 // ____ XModifyBroadcaster ____ 143 virtual void SAL_CALL addModifyListener( 144 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 145 throw (::com::sun::star::uno::RuntimeException); 146 virtual void SAL_CALL removeModifyListener( 147 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 148 throw (::com::sun::star::uno::RuntimeException); 149 150 // ____ XModifyListener ____ 151 virtual void SAL_CALL modified( 152 const ::com::sun::star::lang::EventObject& aEvent ) 153 throw (::com::sun::star::uno::RuntimeException); 154 155 // ____ XEventListener (base of XModifyListener) ____ 156 virtual void SAL_CALL disposing( 157 const ::com::sun::star::lang::EventObject& Source ) 158 throw (::com::sun::star::uno::RuntimeException); 159 160 // ____ OPropertySet ____ 161 virtual void firePropertyChangeEvent(); 162 using OPropertySet::disposing; 163 164 void fireModifyEvent(); 165 166 protected: 167 ::com::sun::star::uno::Reference< 168 ::com::sun::star::uno::XComponentContext > m_xContext; 169 170 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; 171 172 private: 173 sal_Int32 m_nDimensionCount; 174 typedef ::std::vector< ::std::vector< ::com::sun::star::uno::Reference< 175 ::com::sun::star::chart2::XAxis > > > tAxisVecVecType; 176 tAxisVecVecType m_aAllAxis; //outer sequence is the dimension; inner sequence is the axis index that indicates main or secondary axis 177 ::com::sun::star::uno::Sequence< 178 ::com::sun::star::uno::Any > m_aOrigin; 179 ::std::vector< ::com::sun::star::uno::Reference< 180 ::com::sun::star::chart2::XChartType > > m_aChartTypes; 181 }; 182 183 } // namespace chart 184 185 // CHART_COORDINATESYSTEM_HXX 186 #endif 187