LibreOffice Module oox (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
oox::PropertySet Class Reference

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

#include <propertyset.hxx>

Public Member Functions

 PropertySet ()
 
 PropertySet (const css::uno::Reference< css::beans::XPropertySet > &rxPropSet)
 Constructs a property set wrapper with the passed UNO property set. More...
 
template<typename Type >
 PropertySet (const Type &rObject)
 Constructs a property set wrapper after querying the XPropertySet interface. More...
 
void set (const css::uno::Reference< css::beans::XPropertySet > &rxPropSet)
 Sets the passed UNO property set and releases the old UNO property set. More...
 
template<typename Type >
void set (const Type &rObject)
 Queries the passed object (interface or any) for an XPropertySet and releases the old UNO property set. More...
 
bool is () const
 Returns true, if the contained XPropertySet interface is valid. More...
 
bool hasProperty (sal_Int32 nPropId) const
 Returns true, if the specified property is supported by the property set. More...
 
css::uno::Any getAnyProperty (sal_Int32 nPropId) const
 Gets the specified property from the property set. More...
 
template<typename Type >
bool getProperty (Type &orValue, sal_Int32 nPropId) const
 Gets the specified property from the property set. More...
 
bool getBoolProperty (sal_Int32 nPropId) const
 Gets the specified boolean property from the property set. More...
 
bool setAnyProperty (sal_Int32 nPropId, const css::uno::Any &rValue)
 Puts the passed any into the property set. More...
 
template<typename Type >
bool setProperty (sal_Int32 nPropId, const Type &rValue)
 Puts the passed value into the property set. More...
 
bool setProperty (sal_Int32 nPropId, ::Color rValue)
 
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...
 
void setProperties (const PropertyMap &rPropertyMap)
 Puts the passed property map into the property set. More...
 
void dump ()
 

Private Member Functions

bool implGetPropertyValue (css::uno::Any &orValue, const OUString &rPropName) const
 Gets the specified property from the property set. More...
 
bool implSetPropertyValue (const OUString &rPropName, const css::uno::Any &rValue)
 Puts the passed any into the property set. More...
 

Private Attributes

css::uno::Reference< css::beans::XPropertySetmxPropSet
 The mandatory property set interface. More...
 
css::uno::Reference< css::beans::XMultiPropertySet > mxMultiPropSet
 The optional multi property set interface. More...
 
css::uno::Reference< css::beans::XPropertySetInfo > mxPropSetInfo
 Property information. 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 com.sun.star.beans.XPropertySet interface then). The reference to the property set will be kept as long as the instance of this class is alive.

The functions setProperties() tries to handle all passed values at once, using the com.sun.star.beans.XMultiPropertySet interface. If the implementation does not support the XMultiPropertySet interface, all properties are handled separately in a loop.

Definition at line 57 of file propertyset.hxx.

Constructor & Destructor Documentation

◆ PropertySet() [1/3]

oox::PropertySet::PropertySet ( )
inline

Definition at line 60 of file propertyset.hxx.

◆ PropertySet() [2/3]

oox::PropertySet::PropertySet ( const css::uno::Reference< css::beans::XPropertySet > &  rxPropSet)
inlineexplicit

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

Definition at line 63 of file propertyset.hxx.

References set().

◆ PropertySet() [3/3]

template<typename Type >
oox::PropertySet::PropertySet ( const Type rObject)
inlineexplicit

Constructs a property set wrapper after querying the XPropertySet interface.

Definition at line 69 of file propertyset.hxx.

References set().

Member Function Documentation

◆ dump()

void oox::PropertySet::dump ( )

Definition at line 142 of file propertyset.cxx.

References oox::PropertyMap::dump(), and mxPropSet.

Referenced by oox::drawingml::TextParagraphProperties::dump().

◆ getAnyProperty()

Any oox::PropertySet::getAnyProperty ( sal_Int32  nPropId) const

Gets the specified property from the property set.

Returns
the property value, or an empty Any, if the property is missing.

Definition at line 62 of file propertyset.cxx.

References Any, oox::PropertyMap::getPropertyName(), and implGetPropertyValue().

Referenced by VbaExport::getLibraryContainer(), oox::ole::VbaProject::getLibraryContainer(), and oox::drawingml::pushToGrabBag().

◆ getBoolProperty()

bool oox::PropertySet::getBoolProperty ( sal_Int32  nPropId) const
inline

Gets the specified boolean property from the property set.

Returns
true = property contains true; false = property contains false or error occurred.

Definition at line 99 of file propertyset.hxx.

References getProperty().

Referenced by oox::drawingml::ChartExport::exportLegend(), and oox::drawingml::chart::LegendConverter::legendEntriesFormatting().

◆ getProperty()

template<typename Type >
bool oox::PropertySet::getProperty ( Type orValue,
sal_Int32  nPropId 
) const
inline

Gets the specified property from the property set.

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

Definition at line 94 of file propertyset.hxx.

Referenced by oox::ole::ControlConverter::bindToSources(), oox::drawingml::chart::UpDownBarsConverter::convertFromModel(), oox::drawingml::chart::AxisConverter::convertFromModel(), oox::drawingml::chart::DataLabelConverter::convertFromModel(), oox::ole::EmbeddedControl::convertFromProperties(), oox::ole::AxFontDataModel::convertFromProperties(), oox::ole::AxCommandButtonModel::convertFromProperties(), oox::ole::AxLabelModel::convertFromProperties(), oox::ole::AxMorphDataModelBase::convertFromProperties(), oox::ole::AxToggleButtonModel::convertFromProperties(), oox::ole::AxCheckBoxModel::convertFromProperties(), oox::ole::AxOptionButtonModel::convertFromProperties(), oox::ole::AxTextBoxModel::convertFromProperties(), oox::ole::AxNumericFieldModel::convertFromProperties(), oox::ole::AxListBoxModel::convertFromProperties(), oox::ole::AxComboBoxModel::convertFromProperties(), oox::ole::AxSpinButtonModel::convertFromProperties(), oox::ole::AxScrollBarModel::convertFromProperties(), oox::ole::ControlConverter::convertToAxBorder(), oox::ole::ControlConverter::convertToAxState(), oox::ole::ControlConverter::convertToAxVisualEffect(), oox::ole::ControlConverter::convertToMSColor(), oox::ole::ControlConverter::convertToMSOrientation(), oox::drawingml::ChartExport::exportLegend(), oox::GraphicHelper::getOriginalSize(), oox::ole::OleFormCtrlExportHelper::OleFormCtrlExportHelper(), and oox::drawingml::TextParagraphProperties::pushToPropSet().

◆ hasProperty()

bool oox::PropertySet::hasProperty ( sal_Int32  nPropId) const

Returns true, if the specified property is supported by the property set.

Definition at line 47 of file propertyset.cxx.

References Exception, oox::PropertyMap::getPropertyName(), and mxPropSetInfo.

Referenced by oox::vml::ShapeBase::convertAndInsert(), and oox::drawingml::pushToGrabBag().

◆ implGetPropertyValue()

bool oox::PropertySet::implGetPropertyValue ( css::uno::Any &  orValue,
const OUString &  rPropName 
) const
private

Gets the specified property from the property set.

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

Definition at line 111 of file propertyset.cxx.

References Exception, mxPropSet, and TOOLS_WARN_EXCEPTION.

Referenced by getAnyProperty().

◆ implSetPropertyValue()

bool oox::PropertySet::implSetPropertyValue ( const OUString &  rPropName,
const css::uno::Any &  rValue 
)
private

Puts the passed any into the property set.

Definition at line 126 of file propertyset.cxx.

References Exception, mxPropSet, and TOOLS_WARN_EXCEPTION.

Referenced by setAnyProperty().

◆ is()

bool oox::PropertySet::is ( ) const
inline

Returns true, if the contained XPropertySet interface is valid.

Definition at line 80 of file propertyset.hxx.

Referenced by oox::drawingml::chart::WallFloorConverter::convertFromModel().

◆ set() [1/2]

void oox::PropertySet::set ( const css::uno::Reference< css::beans::XPropertySet > &  rxPropSet)

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

Referenced by oox::drawingml::chart::WallFloorConverter::convertFromModel().

◆ set() [2/2]

template<typename Type >
void oox::PropertySet::set ( const Type rObject)
inline

Queries the passed object (interface or any) for an XPropertySet and releases the old UNO property set.

Definition at line 76 of file propertyset.hxx.

References set().

◆ setAnyProperty()

bool oox::PropertySet::setAnyProperty ( sal_Int32  nPropId,
const css::uno::Any &  rValue 
)

◆ setProperties() [1/2]

void oox::PropertySet::setProperties ( const css::uno::Sequence< OUString > &  rPropNames,
const css::uno::Sequence< css::uno::Any > &  rValues 
)

◆ setProperties() [2/2]

void oox::PropertySet::setProperties ( const PropertyMap rPropertyMap)

Puts the passed property map into the property set.

Tries to use the XMultiPropertySet interface.

Parameters
rPropertyMapThe property map.

Definition at line 98 of file propertyset.cxx.

References aPropNames, oox::PropertyMap::empty(), oox::PropertyMap::fillSequences(), and setProperties().

◆ setProperty() [1/2]

bool oox::PropertySet::setProperty ( sal_Int32  nPropId,
::Color  rValue 
)
inline

Definition at line 110 of file propertyset.hxx.

◆ setProperty() [2/2]

template<typename Type >
bool oox::PropertySet::setProperty ( sal_Int32  nPropId,
const Type rValue 
)
inline

Puts the passed value into the property set.

Definition at line 108 of file propertyset.hxx.

Referenced by oox::drawingml::table::applyLineAttributes(), oox::vml::ShapeBase::convertAndInsert(), oox::drawingml::chart::TypeGroupConverter::convertBarGeometry(), oox::drawingml::chart::AxisDispUnitsConverter::convertFromModel(), oox::drawingml::chart::AxisConverter::convertFromModel(), oox::drawingml::chart::ErrorBarConverter::convertFromModel(), oox::drawingml::chart::TrendlineConverter::convertFromModel(), oox::drawingml::chart::DataLabelConverter::convertFromModel(), oox::drawingml::chart::DataLabelsConverter::convertFromModel(), oox::drawingml::chart::LegendConverter::convertFromModel(), oox::drawingml::chart::TypeGroupConverter::convertFromModel(), oox::drawingml::chart::View3DConverter::convertFromModel(), oox::drawingml::chart::ChartSpaceConverter::convertFromModel(), oox::drawingml::chart::DataTableConverter::convertFromModel(), oox::drawingml::chart::LayoutConverter::convertFromModel(), oox::drawingml::chart::TypeGroupConverter::convertLineSmooth(), oox::drawingml::chart::TypeGroupConverter::convertMarker(), oox::drawingml::chart::ObjectFormatter::convertNumberFormat(), oox::drawingml::chart::TypeGroupConverter::convertPieExplosion(), oox::drawingml::chart::TypeGroupConverter::convertPieRotation(), oox::drawingml::chart::ObjectFormatter::convertTextRotation(), oox::drawingml::chart::ObjectFormatter::convertTextWrap(), oox::ppt::SlidePersist::createBackground(), oox::drawingml::chart::TypeGroupConverter::createCoordinateSystem(), oox::drawingml::chart::DataSequenceConverter::createDataSequence(), oox::drawingml::chart::SeriesConverter::createDataSeries(), oox::vml::SimpleShape::createPictureObject(), oox::vml::SimpleShape::finalImplConvertAndInsert(), oox::vml::SimpleShape::implConvertAndInsert(), oox::vml::PolyLineShape::implConvertAndInsert(), oox::vml::BezierShape::implConvertAndInsert(), oox::drawingml::TextRun::insertAt(), oox::drawingml::chart::TypeGroupConverter::insertDataSeries(), oox::vml::lcl_SetAnchorType(), oox::vml::lcl_setSurround(), oox::drawingml::chart::LegendConverter::legendEntriesFormatting(), oox::core::XmlFilterBase::openFragmentStream(), oox::drawingml::TextParagraphProperties::pushToPropSet(), and oox::drawingml::CustomShapeProperties::pushToPropSet().

Member Data Documentation

◆ mxMultiPropSet

css::uno::Reference< css::beans::XMultiPropertySet > oox::PropertySet::mxMultiPropSet
private

The optional multi property set interface.

Definition at line 141 of file propertyset.hxx.

◆ mxPropSet

css::uno::Reference< css::beans::XPropertySet > oox::PropertySet::mxPropSet
private

The mandatory property set interface.

Definition at line 139 of file propertyset.hxx.

Referenced by dump(), implGetPropertyValue(), and implSetPropertyValue().

◆ mxPropSetInfo

css::uno::Reference< css::beans::XPropertySetInfo > oox::PropertySet::mxPropSetInfo
private

Property information.

Definition at line 143 of file propertyset.hxx.

Referenced by hasProperty().


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