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() = 0; 74 virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL 75 createCoordinateSystem( ::sal_Int32 DimensionCount ); 76 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 77 getSupportedMandatoryRoles(); 78 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 79 getSupportedOptionalRoles(); 80 virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel(); 81 82 // ____ XDataSeriesContainer ____ 83 virtual void SAL_CALL addDataSeries( 84 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& aDataSeries ); 85 virtual void SAL_CALL removeDataSeries( 86 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& aDataSeries ); 87 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > SAL_CALL getDataSeries(); 88 virtual void SAL_CALL setDataSeries( 89 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aDataSeries ); 90 91 // ____ XModifyBroadcaster ____ 92 virtual void SAL_CALL addModifyListener( 93 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ); 94 virtual void SAL_CALL removeModifyListener( 95 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ); 96 97 // ____ XModifyListener ____ 98 virtual void SAL_CALL modified( 99 const ::com::sun::star::lang::EventObject& aEvent ); 100 101 // ____ XEventListener (base of XModifyListener) ____ 102 virtual void SAL_CALL disposing( 103 const ::com::sun::star::lang::EventObject& Source ); 104 105 void fireModifyEvent(); 106 107 // ____ OPropertySet ____ 108 virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const; 109 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 110 111 virtual void firePropertyChangeEvent(); 112 using OPropertySet::disposing; 113 114 // ____ XPropertySet ____ 115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 116 getPropertySetInfo(); 117 118 // virtual sal_Bool SAL_CALL convertFastPropertyValue 119 // ( ::com::sun::star::uno::Any & rConvertedValue, 120 // ::com::sun::star::uno::Any & rOldValue, 121 // sal_Int32 nHandle, 122 // const ::com::sun::star::uno::Any& rValue ) 123 // throw (::com::sun::star::lang::IllegalArgumentException); 124 125 /// merge XInterface implementations 126 DECLARE_XINTERFACE() 127 /// merge XTypeProvider implementations 128 DECLARE_XTYPEPROVIDER() 129 130 // not implemented 131 // ____ XCloneable ____ 132 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 133 // throw (::com::sun::star::uno::RuntimeException); 134 135 protected: 136 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; 137 138 private: 139 void impl_addDataSeriesWithoutNotification( 140 const ::com::sun::star::uno::Reference< 141 ::com::sun::star::chart2::XDataSeries >& aDataSeries ); 142 143 private: 144 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > 145 m_xContext; 146 147 typedef 148 ::std::vector< ::com::sun::star::uno::Reference< 149 ::com::sun::star::chart2::XDataSeries > > 150 tDataSeriesContainerType; 151 152 tDataSeriesContainerType m_aDataSeries; 153 154 bool m_bNotifyChanges; 155 }; 156 157 } // namespace chart 158 159 // CHART_CHARTTYPE_HXX 160 #endif 161