LibreOffice Module canvas (master) 1
|
Really simplistic XPropertySet helper for properties. More...
#include <propertysethelper.hxx>
Classes | |
struct | Callbacks |
class | MakeMap |
Public Types | |
typedef std::function< css::uno::Any()> | GetterType |
typedef std::function< void(const css::uno::Any &)> | SetterType |
typedef tools::ValueMap< Callbacks > | MapType |
typedef std::vector< MapType::MapEntry > | InputMap |
Public Member Functions | |
PropertySetHelper () | |
Create helper with zero properties. More... | |
void | initProperties (InputMap &&rMap) |
Init helper with new name/value map. More... | |
void | addProperties (const InputMap &rMap) |
Add given properties to helper. More... | |
bool | isPropertyName (const OUString &aPropertyName) const |
Checks whether the given string corresponds to a valid property name. More... | |
css::uno::Reference< css::beans::XPropertySetInfo > | getPropertySetInfo () const |
void | setPropertyValue (const OUString &aPropertyName, const css::uno::Any &aValue) |
css::uno::Any | getPropertyValue (const OUString &PropertyName) const |
void | addPropertyChangeListener (const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) |
void | addVetoableChangeListener (const OUString &aPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) |
Private Attributes | |
std::unique_ptr< MapType > | mpMap |
InputMap | maMapEntries |
Really simplistic XPropertySet helper for properties.
This class provides easy access to properties, referenced via ASCII strings. The name/property modification callbacks pairs are passed into this class via a vector. Each time a property is set or queried, the corresponding getter or setter callback is called.
Use this class as a delegate for the corresponding XPropertySet methods, and take care of UNO XInterface and lock handling by yourself.
The core responsibility of this class is the name/value mapping for property sets.
Definition at line 51 of file propertysethelper.hxx.
typedef std::function<css::uno::Any ()> canvas::PropertySetHelper::GetterType |
Definition at line 54 of file propertysethelper.hxx.
typedef std::vector< MapType::MapEntry > canvas::PropertySetHelper::InputMap |
Definition at line 62 of file propertysethelper.hxx.
Definition at line 61 of file propertysethelper.hxx.
typedef std::function<void (const css::uno::Any&)> canvas::PropertySetHelper::SetterType |
Definition at line 55 of file propertysethelper.hxx.
canvas::PropertySetHelper::PropertySetHelper | ( | ) |
Create helper with zero properties.
Definition at line 60 of file propertysethelper.cxx.
void canvas::PropertySetHelper::addProperties | ( | const InputMap & | rMap | ) |
Add given properties to helper.
rMap | Vector of name/function pointers. Each name is offered as a property, and reading/writing to this property is passed on to the given function pointer. These name/function pairs are added to the already existing ones. |
Definition at line 79 of file propertysethelper.cxx.
References initProperties(), and maMapEntries.
Referenced by canvas::BufferedGraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >::BufferedGraphicDeviceBase().
void canvas::PropertySetHelper::addPropertyChangeListener | ( | const OUString & | aPropertyName, |
const css::uno::Reference< css::beans::XPropertyChangeListener > & | xListener | ||
) |
void canvas::PropertySetHelper::addVetoableChangeListener | ( | const OUString & | aPropertyName, |
const css::uno::Reference< css::beans::XVetoableChangeListener > & | xListener | ||
) |
uno::Reference< beans::XPropertySetInfo > canvas::PropertySetHelper::getPropertySetInfo | ( | ) | const |
Definition at line 99 of file propertysethelper.cxx.
Referenced by canvas::GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >::getPropertySetInfo().
uno::Any canvas::PropertySetHelper::getPropertyValue | ( | const OUString & | PropertyName | ) | const |
Definition at line 120 of file propertysethelper.cxx.
References aCallbacks, and mpMap.
Referenced by canvas::GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >::getPropertyValue().
void canvas::PropertySetHelper::initProperties | ( | InputMap && | rMap | ) |
Init helper with new name/value map.
rMap | Vector of name/function pointers. Each name is offered as a property, and reading/writing to this property is passed on to the given function pointer. |
Definition at line 64 of file propertysethelper.cxx.
References maMapEntries, and mpMap.
Referenced by addProperties(), and canvas::GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >::GraphicDeviceBase().
bool canvas::PropertySetHelper::isPropertyName | ( | const OUString & | aPropertyName | ) | const |
Checks whether the given string corresponds to a valid property name.
Definition at line 89 of file propertysethelper.cxx.
References mpMap.
void canvas::PropertySetHelper::setPropertyValue | ( | const OUString & | aPropertyName, |
const css::uno::Any & | aValue | ||
) |
References getPropertyValue().
Referenced by canvas::GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >::setPropertyValue().
|
private |
Definition at line 132 of file propertysethelper.hxx.
Referenced by addProperties(), and initProperties().
|
private |
Definition at line 131 of file propertysethelper.hxx.
Referenced by getPropertyValue(), initProperties(), and isPropertyName().