1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef CHART_DATASERIESPOINTWRAPPER_HXX 28 #define CHART_DATASERIESPOINTWRAPPER_HXX 29 30 #include "ServiceMacros.hxx" 31 #include "WrappedPropertySet.hxx" 32 #include "ReferenceSizePropertyProvider.hxx" 33 #include <cppuhelper/implbase4.hxx> 34 #include <comphelper/uno3.hxx> 35 #include <cppuhelper/interfacecontainer.hxx> 36 #include <com/sun/star/chart2/XDataSeries.hpp> 37 #include <com/sun/star/frame/XModel.hpp> 38 #include <com/sun/star/lang/XComponent.hpp> 39 #include <com/sun/star/lang/XEventListener.hpp> 40 #include <com/sun/star/lang/XInitialization.hpp> 41 #include <com/sun/star/lang/XServiceInfo.hpp> 42 #include <com/sun/star/uno/XComponentContext.hpp> 43 44 #include <boost/shared_ptr.hpp> 45 46 namespace chart 47 { 48 49 namespace wrapper 50 { 51 52 class Chart2ModelContact; 53 54 class DataSeriesPointWrapper : public ::cppu::ImplInheritanceHelper4< 55 WrappedPropertySet 56 , com::sun::star::lang::XServiceInfo 57 , com::sun::star::lang::XInitialization 58 , com::sun::star::lang::XComponent 59 , com::sun::star::lang::XEventListener 60 > 61 , public ReferenceSizePropertyProvider 62 63 { 64 public: 65 enum eType 66 { 67 DATA_SERIES, 68 DATA_POINT 69 }; 70 71 //this constructor needs an initialize call afterwards 72 DataSeriesPointWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 73 74 DataSeriesPointWrapper( eType eType 75 , sal_Int32 nSeriesIndexInNewAPI 76 , sal_Int32 nPointIndex //ignored for series 77 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 78 79 virtual ~DataSeriesPointWrapper(); 80 81 bool isSupportingAreaProperties(); 82 bool isLinesForbidden(); 83 84 /// XServiceInfo declarations 85 APPHELPER_XSERVICEINFO_DECL() 86 87 // ___lang::XInitialization___ 88 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 89 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 90 91 //ReferenceSizePropertyProvider 92 virtual void updateReferenceSize(); 93 virtual ::com::sun::star::uno::Any getReferenceSize(); 94 virtual ::com::sun::star::awt::Size getCurrentSizeForReference(); 95 96 protected: 97 // ____ XComponent ____ 98 virtual void SAL_CALL dispose() 99 throw (::com::sun::star::uno::RuntimeException); 100 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< 101 ::com::sun::star::lang::XEventListener >& xListener ) 102 throw (::com::sun::star::uno::RuntimeException); 103 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< 104 ::com::sun::star::lang::XEventListener >& aListener ) 105 throw (::com::sun::star::uno::RuntimeException); 106 107 // ____ XEventListener ____ 108 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 109 throw (::com::sun::star::uno::RuntimeException); 110 111 protected: 112 // ____ WrappedPropertySet ____ 113 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence(); 114 virtual const std::vector< WrappedProperty* > createWrappedProperties(); 115 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 116 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 117 virtual ::com::sun::star::uno::Reference< 118 ::com::sun::star::beans::XPropertySet > getInnerPropertySet(); 119 120 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 121 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 122 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 123 124 //own methods 125 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > getDataSeries(); 126 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataPointProperties(); 127 128 private: 129 130 void SAL_CALL getStatisticsPropertyValue 131 ( ::com::sun::star::uno::Any& rValue, 132 sal_Int32 nHandle ) const; 133 134 void SAL_CALL setStatisticsPropertyValue_NoBroadcast( 135 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 136 throw (::com::sun::star::uno::Exception); 137 138 // ---------------------------------------- 139 140 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 141 ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; 142 143 eType m_eType; 144 sal_Int32 m_nSeriesIndexInNewAPI; 145 sal_Int32 m_nPointIndex; 146 147 sal_Bool m_bLinesAllowed; 148 149 //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface 150 //because a big change in the chartmodel may leed to an dataseriespointer thats not connected to the model anymore 151 //with the indizes instead we are can aleays get the new dataseries 152 ::com::sun::star::uno::Reference< 153 ::com::sun::star::chart2::XDataSeries > m_xDataSeries; 154 }; 155 156 } // namespace wrapper 157 } // namespace chart 158 159 // CHART_DATASERIESPOINTWRAPPER_HXX 160 #endif 161