using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using ::osl::MutexGuard;
// needed for MS compiler using ::cppu::OBroadcastHelper; using ::cppu::OPropertySetHelper;
namespace property
{
OPropertySet::OPropertySet( ) :
OBroadcastHelper( m_aMutex ), // the following causes a warning; there seems to be no way to avoid it
OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
{
}
OPropertySet::OPropertySet( const OPropertySet & rOther ) :
OBroadcastHelper( m_aMutex ), // the following causes a warning; there seems to be no way to avoid it
OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
css::lang::XTypeProvider(),
css::beans::XPropertyState(),
css::beans::XMultiPropertyStates(),
css::style::XStyleSupplier(),
m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
{
MutexGuard aGuard( m_aMutex );
// property was not set -> try style
uno::Reference< beans::XFastPropertySet > xStylePropSet( m_xStyle, uno::UNO_QUERY ); if( xStylePropSet.is() )
{ #ifdef DBG_UTIL
{ // check if the handle of the style points to the same property // name as the handle in this property set
uno::Reference< beans::XPropertySet > xPropSet( xStylePropSet, uno::UNO_QUERY ); if( xPropSet.is())
{
uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); if( xInfo.is() )
{ // for some reason the virtual method getInfoHelper() is // not const
::cppu::IPropertyArrayHelper & rPH = const_cast< OPropertySet * >( this )->getInfoHelper();
// find the Property with Handle nHandle in Style
Sequence< beans::Property > aProps( xInfo->getProperties() );
sal_Int32 nI = aProps.getLength() - 1; while( ( nI >= 0 ) && nHandle != aProps[ nI ].Handle )
--nI;
if( nI >= 0 ) // => nHandle == aProps[nI].Handle
{ // check whether the handle in this property set is // the same as the one in the style
beans::Property aProp( rPH.getPropertyByName( aProps[ nI ].Name ) );
OSL_ENSURE( nHandle == aProp.Handle, "HandleCheck: Handles for same property differ!" );
if( nHandle == aProp.Handle )
{
OSL_ENSURE( aProp.Type == aProps[nI].Type, "HandleCheck: Types differ!" );
OSL_ENSURE( aProp.Attributes == aProps[nI].Attributes, "HandleCheck: Attributes differ!" );
}
} else
{
OSL_FAIL( "HandleCheck: Handle not found in Style" );
}
} else
OSL_FAIL( "HandleCheck: Invalid XPropertySetInfo returned" );
} else
OSL_FAIL( "HandleCheck: XPropertySet not supported" );
} #endif
rValue = xStylePropSet->getFastPropertyValue( nHandle );
} else
{ // there is no style (or the style does not support XFastPropertySet) // => take the default value try
{
GetDefaultValue( nHandle, rValue );
} catch( const beans::UnknownPropertyException& )
{
rValue.clear();
}
}
}
void OPropertySet::firePropertyChangeEvent()
{ // nothing in base class
}
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.