1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #pragma once 20 21 #include <MutexContainer.hxx> 22 #include <OPropertySet.hxx> 23 #include <cppuhelper/implbase.hxx> 24 #include <comphelper/uno3.hxx> 25 #include <com/sun/star/lang/XServiceInfo.hpp> 26 #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp> 27 #include <com/sun/star/util/XCloneable.hpp> 28 #include <com/sun/star/util/XModifyBroadcaster.hpp> 29 #include <com/sun/star/util/XModifyListener.hpp> 30 31 namespace chart 32 { 33 34 namespace impl 35 { 36 typedef ::cppu::WeakImplHelper< 37 css::chart2::XDataPointCustomLabelField, // inherits from XFormattedString2 38 css::lang::XServiceInfo, 39 css::util::XCloneable, 40 css::util::XModifyBroadcaster, 41 css::util::XModifyListener > 42 FormattedString_Base; 43 } 44 45 class FormattedString final : 46 public MutexContainer, 47 public impl::FormattedString_Base, 48 public ::property::OPropertySet 49 { 50 public: 51 explicit FormattedString(); 52 virtual ~FormattedString() override; 53 54 /// declare XServiceInfo methods 55 virtual OUString SAL_CALL getImplementationName() override; 56 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; 57 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; 58 59 /// merge XInterface implementations 60 DECLARE_XINTERFACE() 61 /// merge XTypeProvider implementations DECLARE_XTYPEPROVIDER()62 DECLARE_XTYPEPROVIDER() 63 64 virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) override 65 { ::property::OPropertySet::setPropertyValue(p1, p2); } getPropertyValue(const OUString & p1)66 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) override 67 { return ::property::OPropertySet::getPropertyValue(p1); } addPropertyChangeListener(const OUString & p1,const css::uno::Reference<css::beans::XPropertyChangeListener> & p2)68 virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) override 69 { ::property::OPropertySet::addPropertyChangeListener(p1, p2); } removePropertyChangeListener(const OUString & p1,const css::uno::Reference<css::beans::XPropertyChangeListener> & p2)70 virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) override 71 { ::property::OPropertySet::removePropertyChangeListener(p1, p2); } addVetoableChangeListener(const OUString & p1,const css::uno::Reference<css::beans::XVetoableChangeListener> & p2)72 virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override 73 { ::property::OPropertySet::addVetoableChangeListener(p1, p2); } removeVetoableChangeListener(const OUString & p1,const css::uno::Reference<css::beans::XVetoableChangeListener> & p2)74 virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override 75 { ::property::OPropertySet::removeVetoableChangeListener(p1, p2); } 76 77 private: 78 explicit FormattedString( const FormattedString & rOther ); 79 80 // ____ XFormattedString ____ 81 virtual OUString SAL_CALL getString() override; 82 virtual void SAL_CALL setString( const OUString& String ) override; 83 84 // ____ XDataPointCustomLabelField ____ 85 virtual css::chart2::DataPointCustomLabelFieldType SAL_CALL getFieldType() override; 86 virtual void SAL_CALL 87 setFieldType( const css::chart2::DataPointCustomLabelFieldType FieldType ) override; 88 virtual OUString SAL_CALL getGuid() override; 89 void SAL_CALL setGuid( const OUString& guid ) override; 90 91 // ____ OPropertySet ____ 92 virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override; 93 94 // ____ OPropertySet ____ 95 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; 96 97 // ____ XPropertySet ____ 98 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL 99 getPropertySetInfo() override; 100 101 // ____ XCloneable ____ 102 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; 103 104 // ____ XModifyBroadcaster ____ 105 virtual void SAL_CALL addModifyListener( 106 const css::uno::Reference< css::util::XModifyListener >& aListener ) override; 107 virtual void SAL_CALL removeModifyListener( 108 const css::uno::Reference< css::util::XModifyListener >& aListener ) override; 109 110 // ____ XModifyListener ____ 111 virtual void SAL_CALL modified( 112 const css::lang::EventObject& aEvent ) override; 113 114 // ____ XEventListener (base of XModifyListener) ____ 115 virtual void SAL_CALL disposing( 116 const css::lang::EventObject& Source ) override; 117 118 // ____ OPropertySet ____ 119 virtual void firePropertyChangeEvent() override; 120 using OPropertySet::disposing; 121 122 void fireModifyEvent(); 123 124 // ____ XFormattedString ____ 125 OUString m_aString; 126 127 // ____ XDataPointCustomLabelField ____ 128 css::chart2::DataPointCustomLabelFieldType m_aType; 129 OUString m_aGuid; 130 131 css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder; 132 }; 133 134 } // namespace chart 135 136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 137