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 103 of file fapihelper.hxx.

Constructor & Destructor Documentation

◆ ScfPropertySet() [1/5]

ScfPropertySet::ScfPropertySet ( )
inlineexplicit

Definition at line 106 of file fapihelper.hxx.

◆ ScfPropertySet() [2/5]

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 108 of file fapihelper.hxx.

References Set().

◆ ScfPropertySet() [3/5]

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 111 of file fapihelper.hxx.

References Set().

◆ ~ScfPropertySet()

ScfPropertySet::~ScfPropertySet ( )

Definition at line 131 of file fapihelper.cxx.

References mxPropSet.

◆ ScfPropertySet() [4/5]

ScfPropertySet::ScfPropertySet ( ScfPropertySet const &  )
default

◆ ScfPropertySet() [5/5]

ScfPropertySet::ScfPropertySet ( ScfPropertySet &&  )
default

Member Function Documentation

◆ GetAnyProperty()

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

◆ GetApiPropertySet()

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

Returns the contained XPropertySet interface.

Definition at line 131 of file fapihelper.hxx.

References mxPropSet.

Referenced by XclExpChSerErrorBar::Convert().

◆ GetBoolProperty()

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

◆ GetColorProperty()

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 ColorTransparency, and GetProperty().

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

◆ GetProperties()

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

◆ GetProperty()

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

◆ GetServiceName()

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

◆ GetStringProperty()

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

◆ HasProperty()

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

◆ Is()

bool ScfPropertySet::Is ( ) const
inline

Returns true, if the contained XPropertySet interface is valid.

Definition at line 128 of file fapihelper.hxx.

References mxPropSet.

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

◆ operator=() [1/2]

ScfPropertySet & ScfPropertySet::operator= ( ScfPropertySet &&  )
default

◆ operator=() [2/2]

ScfPropertySet & ScfPropertySet::operator= ( ScfPropertySet const &  )
default

◆ Set() [1/2]

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

◆ Set() [2/2]

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 124 of file fapihelper.hxx.

References Set().

◆ SetAnyProperty()

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

◆ SetBoolProperty()

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

◆ SetColorProperty()

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

Puts the passed color into the property set.

Definition at line 186 of file fapihelper.hxx.

References SetProperty().

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

◆ SetProperties()

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, and mxPropSet.

Referenced by ScfPropSetHelper::WriteToPropertySet().

◆ SetProperty()

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

◆ SetStringProperty()

void ScfPropertySet::SetStringProperty ( const OUString &  rPropName,
const OUString &  rValue 
)
inline

Member Data Documentation

◆ mxMultiPropSet

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

The mandatory property set interface.

Definition at line 196 of file fapihelper.hxx.

Referenced by GetProperties(), and SetProperties().

◆ mxPropSet

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

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