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_DATAPOINT_HXX 24 #define CHART_DATAPOINT_HXX 25 26 #include <osl/mutex.hxx> 27 #include <cppuhelper/implbase5.hxx> 28 #include <cppuhelper/weakref.hxx> 29 #include <comphelper/uno3.hxx> 30 #include <com/sun/star/container/XChild.hpp> 31 #include <com/sun/star/util/XCloneable.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 34 #include "OPropertySet.hxx" 35 #include "MutexContainer.hxx" 36 #include "ModifyListenerHelper.hxx" 37 #include "ServiceMacros.hxx" 38 39 //for auto_ptr 40 #include <memory> 41 42 namespace chart 43 { 44 45 namespace impl 46 { 47 typedef ::cppu::WeakImplHelper5< 48 ::com::sun::star::container::XChild, 49 ::com::sun::star::util::XCloneable, 50 ::com::sun::star::util::XModifyBroadcaster, 51 ::com::sun::star::util::XModifyListener, 52 ::com::sun::star::lang::XServiceInfo > 53 DataPoint_Base; 54 } 55 56 class DataPoint : 57 public MutexContainer, 58 public impl::DataPoint_Base, 59 public ::property::OPropertySet 60 { 61 public: 62 DataPoint( const ::com::sun::star::uno::Reference< 63 ::com::sun::star::beans::XPropertySet > & rParentProperties ); 64 virtual ~DataPoint(); 65 66 /// merge XInterface implementations 67 DECLARE_XINTERFACE() 68 /// XServiceInfo declarations 69 APPHELPER_XSERVICEINFO_DECL() 70 71 protected: 72 explicit DataPoint( const DataPoint & rOther ); 73 74 // ____ OPropertySet ____ 75 virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const 76 throw(::com::sun::star::beans::UnknownPropertyException); 77 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 78 virtual void SAL_CALL setFastPropertyValue_NoBroadcast 79 ( sal_Int32 nHandle, 80 const ::com::sun::star::uno::Any& rValue ) 81 throw (::com::sun::star::uno::Exception); 82 83 // ____ XPropertySet ____ 84 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 85 getPropertySetInfo() 86 throw (::com::sun::star::uno::RuntimeException); 87 88 // ____ XCloneable ____ 89 // Note: m_xParentProperties are not cloned! 90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 91 throw (::com::sun::star::uno::RuntimeException); 92 93 // ____ XChild ____ 94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent() 95 throw (::com::sun::star::uno::RuntimeException); 96 virtual void SAL_CALL setParent( 97 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) 98 throw (::com::sun::star::lang::NoSupportException, 99 ::com::sun::star::uno::RuntimeException); 100 101 // ____ XModifyBroadcaster ____ 102 virtual void SAL_CALL addModifyListener( 103 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 104 throw (::com::sun::star::uno::RuntimeException); 105 virtual void SAL_CALL removeModifyListener( 106 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 107 throw (::com::sun::star::uno::RuntimeException); 108 109 // ____ XModifyListener ____ 110 virtual void SAL_CALL modified( 111 const ::com::sun::star::lang::EventObject& aEvent ) 112 throw (::com::sun::star::uno::RuntimeException); 113 114 // ____ XEventListener (base of XModifyListener) ____ 115 virtual void SAL_CALL disposing( 116 const ::com::sun::star::lang::EventObject& Source ) 117 throw (::com::sun::star::uno::RuntimeException); 118 119 // ____ OPropertySet ____ 120 virtual void firePropertyChangeEvent(); 121 using OPropertySet::disposing; 122 123 void fireModifyEvent(); 124 125 private: 126 ::com::sun::star::uno::WeakReference< 127 ::com::sun::star::beans::XPropertySet > m_xParentProperties; 128 129 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; 130 bool m_bNoParentPropAllowed; 131 }; 132 133 } // namespace chart 134 135 // CHART_DATAPOINT_HXX 136 #endif 137