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_DATASERIESPOINTWRAPPER_HXX 24 #define CHART_DATASERIESPOINTWRAPPER_HXX 25 26 #include "ServiceMacros.hxx" 27 #include "WrappedPropertySet.hxx" 28 #include "ReferenceSizePropertyProvider.hxx" 29 #include <cppuhelper/implbase4.hxx> 30 #include <comphelper/uno3.hxx> 31 #include <cppuhelper/interfacecontainer.hxx> 32 #include <com/sun/star/chart2/XDataSeries.hpp> 33 #include <com/sun/star/frame/XModel.hpp> 34 #include <com/sun/star/lang/XComponent.hpp> 35 #include <com/sun/star/lang/XEventListener.hpp> 36 #include <com/sun/star/lang/XInitialization.hpp> 37 #include <com/sun/star/lang/XServiceInfo.hpp> 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 40 #include <boost/shared_ptr.hpp> 41 42 namespace chart 43 { 44 45 namespace wrapper 46 { 47 48 class Chart2ModelContact; 49 50 class DataSeriesPointWrapper : public ::cppu::ImplInheritanceHelper4< 51 WrappedPropertySet 52 , com::sun::star::lang::XServiceInfo 53 , com::sun::star::lang::XInitialization 54 , com::sun::star::lang::XComponent 55 , com::sun::star::lang::XEventListener 56 > 57 , public ReferenceSizePropertyProvider 58 59 { 60 public: 61 enum eType 62 { 63 DATA_SERIES, 64 DATA_POINT 65 }; 66 67 //this constructor needs an initialize call afterwards 68 DataSeriesPointWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 69 70 DataSeriesPointWrapper( eType eType 71 , sal_Int32 nSeriesIndexInNewAPI 72 , sal_Int32 nPointIndex //ignored for series 73 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 74 75 virtual ~DataSeriesPointWrapper(); 76 77 bool isSupportingAreaProperties(); 78 bool isLinesForbidden(); 79 80 /// XServiceInfo declarations 81 APPHELPER_XSERVICEINFO_DECL() 82 83 // ___lang::XInitialization___ 84 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ); 85 86 //ReferenceSizePropertyProvider 87 virtual void updateReferenceSize(); 88 virtual ::com::sun::star::uno::Any getReferenceSize(); 89 virtual ::com::sun::star::awt::Size getCurrentSizeForReference(); 90 91 protected: 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 // ____ XEventListener ____ 100 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ); 101 102 protected: 103 // ____ WrappedPropertySet ____ 104 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence(); 105 virtual const std::vector< WrappedProperty* > createWrappedProperties(); 106 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 107 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ); 108 virtual ::com::sun::star::uno::Reference< 109 ::com::sun::star::beans::XPropertySet > getInnerPropertySet(); 110 111 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ); 112 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ); 113 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ); 114 115 //own methods 116 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > getDataSeries(); 117 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataPointProperties(); 118 119 private: 120 121 void SAL_CALL getStatisticsPropertyValue 122 ( ::com::sun::star::uno::Any& rValue, 123 sal_Int32 nHandle ) const; 124 125 void SAL_CALL setStatisticsPropertyValue_NoBroadcast( 126 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ); 127 128 // ---------------------------------------- 129 130 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 131 ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; 132 133 eType m_eType; 134 sal_Int32 m_nSeriesIndexInNewAPI; 135 sal_Int32 m_nPointIndex; 136 137 sal_Bool m_bLinesAllowed; 138 139 //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface 140 //because a big change in the chartmodel may leed to an dataseriespointer that's not connected to the model anymore 141 //with the indizes instead we are can aleays get the new dataseries 142 ::com::sun::star::uno::Reference< 143 ::com::sun::star::chart2::XDataSeries > m_xDataSeries; 144 }; 145 146 } // namespace wrapper 147 } // namespace chart 148 149 // CHART_DATASERIESPOINTWRAPPER_HXX 150 #endif 151