LibreOffice Module svx (master) 1
shapepropertynotifier.hxx
Go to the documentation of this file.
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
20#ifndef INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
21#define INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
22
23#include <svx/svxdllapi.h>
25#include <rtl/ustring.hxx>
26#include <o3tl/enumarray.hxx>
27
28#include <memory>
29#include <unordered_map>
30
31namespace com::sun::star::beans { class XPropertyChangeListener; }
32namespace com::sun::star::uno { class Any; }
33namespace com::sun::star::uno { template <typename > class Reference; }
34namespace osl { class Mutex; }
35
36namespace cppu
37{
38 class OWeakObject;
39}
40
41
42namespace svx
43{
44
45 //= ShapeProperty
46
48 {
49 // generic (UNO) shape properties
51 Size,
52 // text doc shape properties
55 };
56
57 //= PropertyValueProvider
58
65 {
66 public:
67 PropertyValueProvider( ::cppu::OWeakObject& _rContext, OUString _aPropertyName )
68 :m_rContext( _rContext )
69 ,m_sPropertyName( std::move( _aPropertyName ) )
70 {
71 }
72 virtual ~PropertyValueProvider();
73
76 const OUString & getPropertyName() const;
79 virtual void getCurrentValue( css::uno::Any& _out_rValue ) const;
80
81 protected:
85
86 private:
88 const OUString m_sPropertyName;
89 };
90
91
97 {
98 public:
105 PropertyChangeNotifier( ::cppu::OWeakObject& _rOwner, ::osl::Mutex& _rMutex );
107
108 // listener maintenance
109 void addPropertyChangeListener( const OUString& _rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener );
110 void removePropertyChangeListener( const OUString& _rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener );
111
114 void registerProvider( const ShapePropertyProviderId _eProperty, std::unique_ptr<PropertyValueProvider> _rProvider );
115
121 void notifyPropertyChange( const ShapePropertyProviderId _eProperty ) const;
122
125 void disposing();
126
127 private:
130
134 };
135
136
137}
138
139
140#endif // INCLUDED_SVX_SHAPEPROPERTYNOTIFIER_HXX
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
helper class for notifying XPropertyChangeListeners
PropertyChangeNotifier(const PropertyChangeNotifier &)=delete
PropertyChangeNotifier & operator=(const PropertyChangeNotifier &)=delete
o3tl::enumarray< ShapePropertyProviderId, std::unique_ptr< PropertyValueProvider > > m_aProviders
comphelper::OMultiTypeInterfaceContainerHelperVar3< css::beans::XPropertyChangeListener, OUString > m_aPropertyChangeListeners
Default provider for a property value.
::cppu::OWeakObject & m_rContext
PropertyValueProvider & operator=(const PropertyValueProvider &)=delete
PropertyValueProvider(const PropertyValueProvider &)=delete
::cppu::OWeakObject & getContext() const
PropertyValueProvider(::cppu::OWeakObject &_rContext, OUString _aPropertyName)
Reference
OUString getPropertyName(sal_Int32 nPropertyType)
const Reference< XComponentContext > & m_rContext
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35