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_CHARTTYPE_HXX 24 #define CHART_CHARTTYPE_HXX 25 26 #include "MutexContainer.hxx" 27 #include "OPropertySet.hxx" 28 #include <cppuhelper/implbase5.hxx> 29 #include <comphelper/uno3.hxx> 30 #include "ServiceMacros.hxx" 31 #include "ModifyListenerHelper.hxx" 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <com/sun/star/chart2/XChartType.hpp> 34 #include <com/sun/star/uno/XComponentContext.hpp> 35 #include <com/sun/star/chart2/XDataSeriesContainer.hpp> 36 #include <com/sun/star/util/XCloneable.hpp> 37 38 #include <vector> 39 40 namespace chart 41 { 42 43 namespace impl 44 { 45 typedef ::cppu::WeakImplHelper5< 46 ::com::sun::star::chart2::XChartType, 47 ::com::sun::star::chart2::XDataSeriesContainer, 48 ::com::sun::star::util::XCloneable, 49 ::com::sun::star::util::XModifyBroadcaster, 50 ::com::sun::star::util::XModifyListener > 51 ChartType_Base; 52 } 53 54 class ChartType : 55 public MutexContainer, 56 public impl::ChartType_Base, 57 public ::property::OPropertySet 58 { 59 public: 60 explicit ChartType( 61 ::com::sun::star::uno::Reference< 62 ::com::sun::star::uno::XComponentContext > const & xContext ); 63 virtual ~ChartType(); 64 65 protected: 66 explicit ChartType( const ChartType & rOther ); 67 68 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > 69 GetComponentContext() const; 70 71 // ____ XChartType ____ 72 // still abstract ! implement ! 73 virtual ::rtl::OUString SAL_CALL getChartType() 74 throw (::com::sun::star::uno::RuntimeException) = 0; 75 virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL 76 createCoordinateSystem( ::sal_Int32 DimensionCount ) 77 throw (::com::sun::star::lang::IllegalArgumentException, 78 ::com::sun::star::uno::RuntimeException); 79 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 80 getSupportedMandatoryRoles() 81 throw (::com::sun::star::uno::RuntimeException); 82 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 83 getSupportedOptionalRoles() 84 throw (::com::sun::star::uno::RuntimeException); 85 virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel() 86 throw (::com::sun::star::uno::RuntimeException); 87 88 // ____ XDataSeriesContainer ____ 89 virtual void SAL_CALL addDataSeries( 90 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& aDataSeries ) 91 throw (::com::sun::star::lang::IllegalArgumentException, 92 ::com::sun::star::uno::RuntimeException); 93 virtual void SAL_CALL removeDataSeries( 94 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& aDataSeries ) 95 throw (::com::sun::star::container::NoSuchElementException, 96 ::com::sun::star::uno::RuntimeException); 97 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > SAL_CALL getDataSeries() 98 throw (::com::sun::star::uno::RuntimeException); 99 virtual void SAL_CALL setDataSeries( 100 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aDataSeries ) 101 throw (::com::sun::star::lang::IllegalArgumentException, 102 ::com::sun::star::uno::RuntimeException); 103 104 // ____ XModifyBroadcaster ____ 105 virtual void SAL_CALL addModifyListener( 106 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 107 throw (::com::sun::star::uno::RuntimeException); 108 virtual void SAL_CALL removeModifyListener( 109 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 110 throw (::com::sun::star::uno::RuntimeException); 111 112 // ____ XModifyListener ____ 113 virtual void SAL_CALL modified( 114 const ::com::sun::star::lang::EventObject& aEvent ) 115 throw (::com::sun::star::uno::RuntimeException); 116 117 // ____ XEventListener (base of XModifyListener) ____ 118 virtual void SAL_CALL disposing( 119 const ::com::sun::star::lang::EventObject& Source ) 120 throw (::com::sun::star::uno::RuntimeException); 121 122 void fireModifyEvent(); 123 124 // ____ OPropertySet ____ 125 virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const 126 throw(::com::sun::star::beans::UnknownPropertyException); 127 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 128 129 virtual void firePropertyChangeEvent(); 130 using OPropertySet::disposing; 131 132 // ____ XPropertySet ____ 133 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 134 getPropertySetInfo() 135 throw (::com::sun::star::uno::RuntimeException); 136 137 // virtual sal_Bool SAL_CALL convertFastPropertyValue 138 // ( ::com::sun::star::uno::Any & rConvertedValue, 139 // ::com::sun::star::uno::Any & rOldValue, 140 // sal_Int32 nHandle, 141 // const ::com::sun::star::uno::Any& rValue ) 142 // throw (::com::sun::star::lang::IllegalArgumentException); 143 144 /// merge XInterface implementations 145 DECLARE_XINTERFACE() 146 /// merge XTypeProvider implementations 147 DECLARE_XTYPEPROVIDER() 148 149 // not implemented 150 // ____ XCloneable ____ 151 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 152 // throw (::com::sun::star::uno::RuntimeException); 153 154 protected: 155 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; 156 157 private: 158 void impl_addDataSeriesWithoutNotification( 159 const ::com::sun::star::uno::Reference< 160 ::com::sun::star::chart2::XDataSeries >& aDataSeries ); 161 162 private: 163 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > 164 m_xContext; 165 166 typedef 167 ::std::vector< ::com::sun::star::uno::Reference< 168 ::com::sun::star::chart2::XDataSeries > > 169 tDataSeriesContainerType; 170 171 tDataSeriesContainerType m_aDataSeries; 172 173 bool m_bNotifyChanges; 174 }; 175 176 } // namespace chart 177 178 // CHART_CHARTTYPE_HXX 179 #endif 180