using ::com::sun::star::lang::DisposedException; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; using ::com::sun::star::uno::Any; using ::com::sun::star::beans::PropertyExistException; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::uno::Reference; using ::com::sun::star::beans::XMultiPropertySet; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Exception; using ::com::sun::star::beans::NotRemoveableException; using ::com::sun::star::beans::UnknownPropertyException;
// check name sanity
::comphelper::OPropertyArrayAggregationHelper& aPropInfo( impl_ts_getArrayHelper() ); if ( aPropInfo.hasPropertyByName( _rName ) ) throw PropertyExistException( _rName, m_rContext.getPropertiesInterface() );
// normalize the REMOVABLE attribute - the FormComponent service // requires that all dynamic properties are REMOVABLE
_nAttributes |= PropertyAttribute::REMOVABLE;
// register the property, and invalidate our property meta data
m_aDynamicProperties.addProperty( _rName, nHandle, _nAttributes, _rInitialValue );
impl_nts_invalidatePropertySetInfo();
}
// XMultiPropertySet::setPropertyValues expects its arguments to be sorted by name // while XPropertyAccess::setPropertyValues doesn't. So first of all, sort.
Sequence< PropertyValue > aSortedProps( _rProps );
::std::sort( aSortedProps.getArray(), aSortedProps.getArray() + nPropertyValues, PropertyValueLessByName() );
// also, XPropertyAccess::setPropertyValues is expected to throw an UnknownPropertyException // for unsupported properties, while XMultiPropertySet::setPropertyValues is expected to ignore // those. So, check for unsupported properties first.
::comphelper::OPropertyArrayAggregationHelper& rArrayHelper( impl_ts_getArrayHelper() ); for ( const PropertyValue* pProperties = aSortedProps.getConstArray();
pProperties != aSortedProps.getConstArray() + nPropertyValues;
++pProperties
)
{ if ( !rArrayHelper.hasPropertyByName( pProperties->Name ) ) throw UnknownPropertyException( pProperties->Name, m_rContext.getPropertiesInterface() );
}
// Now finally split into a Name and a Value sequence, and forward to // XMultiPropertySet::setPropertyValues
Sequence< OUString > aNames( nPropertyValues );
::std::transform( aSortedProps.getConstArray(), aSortedProps.getConstArray() + nPropertyValues,
aNames.getArray(), SelectNameOfPropertyValue() );
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.