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