LibreOffice Module canvas (master) 1
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
canvas::PropertySetHelper Class Reference

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< CallbacksMapType
 
typedef std::vector< MapType::MapEntryInputMap
 

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< MapTypempMap
 
InputMap maMapEntries
 

Detailed Description

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.

Member Typedef Documentation

◆ GetterType

typedef std::function<css::uno::Any ()> canvas::PropertySetHelper::GetterType

Definition at line 54 of file propertysethelper.hxx.

◆ InputMap

Definition at line 62 of file propertysethelper.hxx.

◆ MapType

Definition at line 61 of file propertysethelper.hxx.

◆ SetterType

typedef std::function<void (const css::uno::Any&)> canvas::PropertySetHelper::SetterType

Definition at line 55 of file propertysethelper.hxx.

Constructor & Destructor Documentation

◆ PropertySetHelper()

canvas::PropertySetHelper::PropertySetHelper ( )

Create helper with zero properties.

Definition at line 60 of file propertysethelper.cxx.

Member Function Documentation

◆ addProperties()

void canvas::PropertySetHelper::addProperties ( const InputMap rMap)

Add given properties to helper.

Parameters
rMapVector 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().

◆ addPropertyChangeListener()

void canvas::PropertySetHelper::addPropertyChangeListener ( const OUString &  aPropertyName,
const css::uno::Reference< css::beans::XPropertyChangeListener > &  xListener 
)

◆ addVetoableChangeListener()

void canvas::PropertySetHelper::addVetoableChangeListener ( const OUString &  aPropertyName,
const css::uno::Reference< css::beans::XVetoableChangeListener > &  xListener 
)

◆ getPropertySetInfo()

uno::Reference< beans::XPropertySetInfo > canvas::PropertySetHelper::getPropertySetInfo ( ) const

◆ getPropertyValue()

uno::Any canvas::PropertySetHelper::getPropertyValue ( const OUString &  PropertyName) const

◆ initProperties()

void canvas::PropertySetHelper::initProperties ( InputMap &&  rMap)

Init helper with new name/value map.

Parameters
rMapVector 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().

◆ isPropertyName()

bool canvas::PropertySetHelper::isPropertyName ( const OUString &  aPropertyName) const

Checks whether the given string corresponds to a valid property name.

Returns
true, if the given name maps to a known property.

Definition at line 89 of file propertysethelper.cxx.

References mpMap.

◆ setPropertyValue()

void canvas::PropertySetHelper::setPropertyValue ( const OUString &  aPropertyName,
const css::uno::Any &  aValue 
)

Member Data Documentation

◆ maMapEntries

InputMap canvas::PropertySetHelper::maMapEntries
private

Definition at line 132 of file propertysethelper.hxx.

Referenced by addProperties(), and initProperties().

◆ mpMap

std::unique_ptr<MapType> canvas::PropertySetHelper::mpMap
private

Definition at line 131 of file propertysethelper.hxx.

Referenced by getPropertyValue(), initProperties(), and isPropertyName().


The documentation for this class was generated from the following files: