update emoji autocorrect entries from po-files
[LibreOffice.git] / include / svx / shapepropertynotifier.hxx
bloba12a991c536e837ceddb9a7a1a7e3cef2f6953e5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
21 #define INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
23 #include <svx/svxdllapi.h>
24 #include <svx/shapeproperty.hxx>
26 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
27 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
29 #include <memory>
31 namespace cppu
33 class OWeakObject;
37 namespace svx
42 //= IPropertyValueProvider
44 /** a provider for a property value
46 class SVX_DLLPUBLIC IPropertyValueProvider
48 public:
49 /** returns the name of the property which this provider is responsible for
51 virtual OUString getPropertyName() const = 0;
53 /** returns the current value of the property which the provider is responsible for
55 virtual void getCurrentValue( ::com::sun::star::uno::Any& _out_rValue ) const = 0;
57 virtual ~IPropertyValueProvider();
59 typedef std::shared_ptr< IPropertyValueProvider > PPropertyValueProvider;
62 //= PropertyValueProvider
64 /** default implementation of a IPropertyValueProvider
66 This default implementation queries the object which it is constructed with for the XPropertySet interface,
67 and calls the getPropertyValue method.
69 class SVX_DLLPUBLIC PropertyValueProvider :public IPropertyValueProvider
71 public:
72 PropertyValueProvider( ::cppu::OWeakObject& _rContext, const sal_Char* _pAsciiPropertyName )
73 :m_rContext( _rContext )
74 ,m_sPropertyName( OUString::createFromAscii( _pAsciiPropertyName ) )
78 virtual OUString getPropertyName() const SAL_OVERRIDE;
79 virtual void getCurrentValue( ::com::sun::star::uno::Any& _out_rValue ) const SAL_OVERRIDE;
81 protected:
82 ::cppu::OWeakObject& getContext() const { return m_rContext; }
83 PropertyValueProvider(const PropertyValueProvider&) SAL_DELETED_FUNCTION;
84 PropertyValueProvider& operator=(const PropertyValueProvider&) SAL_DELETED_FUNCTION;
86 private:
87 ::cppu::OWeakObject& m_rContext;
88 const OUString m_sPropertyName;
92 //= PropertyChangeNotifier
94 struct PropertyChangeNotifier_Data;
96 /** helper class for notifying XPropertyChangeListeners
98 The class is intended to be held as member of the class which does the property change broadcasting.
100 class SVX_DLLPUBLIC PropertyChangeNotifier
102 public:
103 /** constructs a notifier instance
105 @param _rOwner
106 the owner instance of the notifier. Will be used as css.lang.EventObject.Source when
107 notifying events.
109 PropertyChangeNotifier( ::cppu::OWeakObject& _rOwner, ::osl::Mutex& _rMutex );
110 ~PropertyChangeNotifier();
112 // listener maintanance
113 void addPropertyChangeListener( const OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener );
114 void removePropertyChangeListener( const OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener );
116 /** registers a IPropertyValueProvider
118 void registerProvider( const ShapeProperty _eProperty, const PPropertyValueProvider& _rProvider );
120 /** notifies changes in the given property to all registered listeners
122 If no property value provider for the given property ID is registered, this is worth an assertion in a
123 non-product build, and otherwise ignored.
125 void notifyPropertyChange( const ShapeProperty _eProperty ) const;
127 /** is called to dispose the instance
129 void disposing();
131 private:
132 PropertyChangeNotifier(const PropertyChangeNotifier&) SAL_DELETED_FUNCTION;
133 PropertyChangeNotifier& operator=(const PropertyChangeNotifier&) SAL_DELETED_FUNCTION;
135 std::unique_ptr< PropertyChangeNotifier_Data > m_xData;
142 #endif // INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */