LibreOffice Module sc (master)  1
Public Member Functions | Private Attributes | List of all members
ScfPropertySet Class Reference

A wrapper for a UNO property set. More...

#include <fapihelper.hxx>

Public Member Functions

 ScfPropertySet ()
 
 ScfPropertySet (const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
 Constructs a property set wrapper with the passed UNO property set. More...
 
template<typename InterfaceType >
 ScfPropertySet (const css::uno::Reference< InterfaceType > &xInterface)
 Constructs a property set wrapper after querying the XPropertySet interface. More...
 
 ~ScfPropertySet ()
 
 ScfPropertySet (ScfPropertySet const &)=default
 
 ScfPropertySet (ScfPropertySet &&)=default
 
ScfPropertySetoperator= (ScfPropertySet const &)=default
 
ScfPropertySetoperator= (ScfPropertySet &&)=default
 
void Set (css::uno::Reference< css::beans::XPropertySet > const &xPropSet)
 Sets the passed UNO property set and releases the old UNO property set. More...
 
template<typename InterfaceType >
void Set (css::uno::Reference< InterfaceType > xInterface)
 Queries the passed interface for an XPropertySet and releases the old UNO property set. More...
 
bool Is () const
 Returns true, if the contained XPropertySet interface is valid. More...
 
const css::uno::Reference< css::beans::XPropertySet > & GetApiPropertySet () const
 Returns the contained XPropertySet interface. More...
 
OUString GetServiceName () const
 Returns the service name provided via the XServiceName interface, or an empty string on error. More...
 
bool HasProperty (const OUString &rPropName) const
 Returns true, if the property set contains the specified property. More...
 
bool GetAnyProperty (css::uno::Any &rValue, const OUString &rPropName) const
 Gets the specified property from the property set. More...
 
template<typename Type >
bool GetProperty (Type &rValue, const OUString &rPropName) const
 Gets the specified property from the property set. More...
 
bool GetBoolProperty (const OUString &rPropName) const
 Gets the specified Boolean property from the property set. More...
 
OUString GetStringProperty (const OUString &rPropName) const
 Gets the specified Boolean property from the property set. More...
 
bool GetColorProperty (Color &rColor, const OUString &rPropName) const
 Gets the specified color property from the property set. More...
 
void GetProperties (css::uno::Sequence< css::uno::Any > &rValues, const css::uno::Sequence< OUString > &rPropNames) const
 Gets the specified properties from the property set. More...
 
void SetAnyProperty (const OUString &rPropName, const css::uno::Any &rValue)
 Puts the passed Any into the property set. More...
 
template<typename Type >
void SetProperty (const OUString &rPropName, const Type &rValue)
 Puts the passed value into the property set. More...
 
void SetBoolProperty (const OUString &rPropName, bool bValue)
 Puts the passed Boolean value into the property set. More...
 
void SetStringProperty (const OUString &rPropName, const OUString &rValue)
 Puts the passed string into the property set. More...
 
void SetColorProperty (const OUString &rPropName, const Color &rColor)
 Puts the passed color into the property set. More...
 
void SetProperties (const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
 Puts the passed properties into the property set. More...
 

Private Attributes

css::uno::Reference< css::beans::XPropertySetmxPropSet
 
css::uno::Reference< css::beans::XMultiPropertySet > mxMultiPropSet
 The mandatory property set interface. More...
 

Detailed Description

A wrapper for a UNO property set.

This class provides functions to silently get and set properties (without exceptions, without the need to check validity of the UNO property set).

An instance is constructed with the reference to a UNO property set or any other interface (the constructor will query for the XPropertySet interface then). The reference to the property set will be kept as long as the instance of this class is alive.

The functions GetProperties() and SetProperties() try to handle all passed values at once, using the XMultiPropertySet interface. If the implementation does not support the XMultiPropertySet interface, all properties are handled separately in a loop.

Definition at line 104 of file fapihelper.hxx.

Constructor & Destructor Documentation

ScfPropertySet::ScfPropertySet ( )
inlineexplicit

Definition at line 107 of file fapihelper.hxx.

ScfPropertySet::ScfPropertySet ( const css::uno::Reference< css::beans::XPropertySet > &  xPropSet)
inlineexplicit

Constructs a property set wrapper with the passed UNO property set.

Definition at line 109 of file fapihelper.hxx.

References Set().

template<typename InterfaceType >
ScfPropertySet::ScfPropertySet ( const css::uno::Reference< InterfaceType > &  xInterface)
inlineexplicit

Constructs a property set wrapper after querying the XPropertySet interface.

Definition at line 112 of file fapihelper.hxx.

References Set().

ScfPropertySet::~ScfPropertySet ( )

Definition at line 131 of file fapihelper.cxx.

References mxPropSet.

ScfPropertySet::ScfPropertySet ( ScfPropertySet const &  )
default
ScfPropertySet::ScfPropertySet ( ScfPropertySet &&  )
default

Member Function Documentation

bool ScfPropertySet::GetAnyProperty ( css::uno::Any &  rValue,
const OUString &  rPropName 
) const

Gets the specified property from the property set.

Returns
true, if the Any could be filled with the property value.

Definition at line 171 of file fapihelper.cxx.

References Exception, and mxPropSet.

Referenced by XclExpChLegend::Convert(), XclExpChText::ConvertTitle(), GetBoolProperty(), and GetProperty().

const css::uno::Reference< css::beans::XPropertySet >& ScfPropertySet::GetApiPropertySet ( ) const
inline

Returns the contained XPropertySet interface.

Definition at line 132 of file fapihelper.hxx.

References mxPropSet.

Referenced by XclExpChSerErrorBar::Convert().

bool ScfPropertySet::GetBoolProperty ( const OUString &  rPropName) const
bool ScfPropertySet::GetColorProperty ( Color rColor,
const OUString &  rPropName 
) const

Gets the specified color property from the property set.

Returns
true, if the passed color variable could be filled with the property value.

Definition at line 201 of file fapihelper.cxx.

References GetProperty().

Referenced by XclExpChMarkerFormat::Convert(), and XclExpChMarkerFormat::ConvertStockSymbol().

void ScfPropertySet::GetProperties ( css::uno::Sequence< css::uno::Any > &  rValues,
const css::uno::Sequence< OUString > &  rPropNames 
) const

Gets the specified properties from the property set.

Tries to use the XMultiPropertySet interface.

Parameters
rPropNamesThe property names. MUST be ordered alphabetically.
rValuesThe related property values.

Definition at line 209 of file fapihelper.cxx.

References Any, Exception, mxMultiPropSet, and mxPropSet.

Referenced by ScfPropSetHelper::ReadFromPropertySet().

template<typename Type >
bool ScfPropertySet::GetProperty ( Type rValue,
const OUString &  rPropName 
) const
inline
OUString ScfPropertySet::GetServiceName ( ) const

Returns the service name provided via the XServiceName interface, or an empty string on error.

Definition at line 150 of file fapihelper.cxx.

References ScfApiHelper::GetServiceName(), and mxPropSet.

Referenced by XclExpChSerTrendLine::Convert().

OUString ScfPropertySet::GetStringProperty ( const OUString &  rPropName) const

Gets the specified Boolean property from the property set.

Definition at line 194 of file fapihelper.cxx.

References GetProperty().

Referenced by XclExpChFrLabelProps::Convert().

bool ScfPropertySet::HasProperty ( const OUString &  rPropName) const

Returns true, if the property set contains the specified property.

Definition at line 157 of file fapihelper.cxx.

References Exception, and mxPropSet.

Referenced by XclExpChSeries::ConvertDataSeries().

bool ScfPropertySet::Is ( ) const
inline

Returns true, if the contained XPropertySet interface is valid.

Definition at line 129 of file fapihelper.hxx.

References mxPropSet.

Referenced by XclExpChDropBar::Convert(), XclExpChAxis::Convert(), and XclExpTbxControlObj::XclExpTbxControlObj().

ScfPropertySet& ScfPropertySet::operator= ( ScfPropertySet const &  )
default
ScfPropertySet& ScfPropertySet::operator= ( ScfPropertySet &&  )
default
void ScfPropertySet::Set ( css::uno::Reference< css::beans::XPropertySet > const &  xPropSet)

Sets the passed UNO property set and releases the old UNO property set.

Referenced by ScfPropertySet(), and Set().

template<typename InterfaceType >
void ScfPropertySet::Set ( css::uno::Reference< InterfaceType >  xInterface)
inline

Queries the passed interface for an XPropertySet and releases the old UNO property set.

Definition at line 125 of file fapihelper.hxx.

References Set().

void ScfPropertySet::SetAnyProperty ( const OUString &  rPropName,
const css::uno::Any &  rValue 
)

Puts the passed Any into the property set.

Definition at line 233 of file fapihelper.cxx.

References Exception, mxPropSet, and SAL_WARN.

Referenced by XclImpChSourceLink::ConvertNumFmt(), SetBoolProperty(), and SetProperty().

void ScfPropertySet::SetBoolProperty ( const OUString &  rPropName,
bool  bValue 
)
inline
void ScfPropertySet::SetColorProperty ( const OUString &  rPropName,
const Color rColor 
)
inline

Puts the passed color into the property set.

Definition at line 187 of file fapihelper.hxx.

References SetProperty().

Referenced by XclImpChChart3d::Convert(), and XclImpChMarkerFormat::ConvertColor().

void ScfPropertySet::SetProperties ( const css::uno::Sequence< OUString > &  rPropNames,
const css::uno::Sequence< css::uno::Any > &  rValues 
)

Puts the passed properties into the property set.

Tries to use the XMultiPropertySet interface.

Parameters
rPropNamesThe property names. MUST be ordered alphabetically.
rValuesThe related property values.

Definition at line 246 of file fapihelper.cxx.

References Any, Exception, mxMultiPropSet, mxPropSet, and pPropName.

Referenced by ScfPropSetHelper::WriteToPropertySet().

template<typename Type >
void ScfPropertySet::SetProperty ( const OUString &  rPropName,
const Type rValue 
)
inline
void ScfPropertySet::SetStringProperty ( const OUString &  rPropName,
const OUString &  rValue 
)
inline

Member Data Documentation

css::uno::Reference< css::beans::XMultiPropertySet > ScfPropertySet::mxMultiPropSet
private

The mandatory property set interface.

Definition at line 197 of file fapihelper.hxx.

Referenced by GetProperties(), and SetProperties().

css::uno::Reference< css::beans::XPropertySet > ScfPropertySet::mxPropSet
private

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