/** Constructs a property set wrapper with the passed UNO property set. */ explicit PropertySet( const css::uno::Reference< css::beans::XPropertySet >& rxPropSet )
{ set( rxPropSet ); }
/** Constructs a property set wrapper after querying the XPropertySet interface. */ template< typename Type > explicit PropertySet( const Type& rObject ) { set( rObject ); }
/** Sets the passed UNO property set and releases the old UNO property set. */ void set( const css::uno::Reference< css::beans::XPropertySet >& rxPropSet );
/** Queries the passed object (interface or any) for an XPropertySet and releases the old UNO property set. */ template< typename Type > void set( const Type& rObject )
{ set( css::uno::Reference< css::beans::XPropertySet >( rObject, css::uno::UNO_QUERY ) ); }
/** Returns true, if the contained XPropertySet interface is valid. */ bool is() const { return mxPropSet.is(); }
/** Returns true, if the specified property is supported by the property set. */ bool hasProperty( sal_Int32 nPropId ) const;
// Get properties ---------------------------------------------------------
/** Gets the specified property from the property set.
@return the property value, or an empty Any, if the property is missing. */
css::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
/** Gets the specified property from the property set.
@return true, if the passed variable could be filled with the property value. */ template< typename Type > bool getProperty( Type& orValue, sal_Int32 nPropId ) const
{ return getAnyProperty( nPropId ) >>= orValue; }
/** Gets the specified boolean property from the property set.
@return true = property contains true; false = property contains false or error occurred. */ bool getBoolProperty( sal_Int32 nPropId ) const
{ bool bValue = false; return getProperty( bValue, nPropId ) && bValue; } // Set properties ---------------------------------------------------------
/** Puts the passed any into the property set. */ bool setAnyProperty( sal_Int32 nPropId, const css::uno::Any& rValue );
/** Puts the passed value into the property set. */ template< typename Type > bool setProperty( sal_Int32 nPropId, const Type& rValue )
{ return setAnyProperty( nPropId, css::uno::Any( rValue ) ); } bool setProperty( sal_Int32 nPropId, ::Color rValue )
{ return setAnyProperty( nPropId, css::uno::Any( rValue ) ); }
/** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface. @paramrPropNamesThepropertynames.MUSTbeorderedalphabetically.
@param rValues The related property values. */ void setProperties( const css::uno::Sequence< OUString >& rPropNames, const css::uno::Sequence< css::uno::Any >& rValues );
/** Puts the passed property map into the property set. Tries to use the XMultiPropertySet interface.
@param rPropertyMap The property map. */ void setProperties( const PropertyMap& rPropertyMap );
#ifdef DBG_UTIL void dump(); #endif
private: /** Gets the specified property from the property set.
@return true, if the any could be filled with the property value. */ bool implGetPropertyValue( css::uno::Any& orValue, const OUString& rPropName ) const;
/** Puts the passed any into the property set. */ bool implSetPropertyValue( const OUString& rPropName, const css::uno::Any& rValue );
private:
css::uno::Reference< css::beans::XPropertySet >
mxPropSet; ///< The mandatory property set interface.
css::uno::Reference< css::beans::XMultiPropertySet >
mxMultiPropSet; ///< The optional multi property set interface.
css::uno::Reference< css::beans::XPropertySetInfo >
mxPropSetInfo; ///< Property information.
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.