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