Kaydet (Commit) 5d8474ba authored tarafından Noel Grandin's avatar Noel Grandin

convert PropertyOrigin to scoped enum

Change-Id: I26c9929be8aad02030722508334e66f5028ffb37
üst dc1f1cde
......@@ -146,7 +146,7 @@ OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper(
OPropertyArrayAggregationHelper::PropertyOrigin OPropertyArrayAggregationHelper::classifyProperty( const OUString& _rName )
{
PropertyOrigin eOrigin = UNKNOWN_PROPERTY;
PropertyOrigin eOrigin = PropertyOrigin::Unknown;
// look up the name
const Property* pPropertyDescriptor = lcl_findPropertyByName( m_aProperties, _rName );
if ( pPropertyDescriptor )
......@@ -156,7 +156,7 @@ OPropertyArrayAggregationHelper::PropertyOrigin OPropertyArrayAggregationHelper:
OSL_ENSURE( m_aPropertyAccessors.end() != aPos, "OPropertyArrayAggregationHelper::classifyProperty: should have this handle in my map!" );
if ( m_aPropertyAccessors.end() != aPos )
{
eOrigin = aPos->second.bAggregate ? AGGREGATE_PROPERTY : DELEGATOR_PROPERTY;
eOrigin = aPos->second.bAggregate ? PropertyOrigin::Aggregate : PropertyOrigin::Delegator;
}
}
return eOrigin;
......@@ -660,12 +660,12 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames )
{
OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( *pNames );
if ( OPropertyArrayAggregationHelper::UNKNOWN_PROPERTY == ePropOrg )
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Unknown == ePropOrg )
throw WrappedTargetException( OUString(), static_cast< XMultiPropertySet* >( this ), makeAny( UnknownPropertyException( ) ) );
// due to a flaw in the API design, this method is not allowed to throw an UnknownPropertyException
// so we wrap it into a WrappedTargetException
if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == ePropOrg )
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == ePropOrg )
++nAggCount;
}
......@@ -705,7 +705,7 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues )
{
if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == rPH.classifyProperty( *pNames ) )
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( *pNames ) )
{
*pAggNames++ = *pNames;
*pAggValues++ = *pValues;
......
......@@ -156,11 +156,11 @@ public:
bool getPropertyByHandle( sal_Int32 _nHandle, css::beans::Property& _rProperty ) const;
enum PropertyOrigin
enum class PropertyOrigin
{
AGGREGATE_PROPERTY,
DELEGATOR_PROPERTY,
UNKNOWN_PROPERTY
Aggregate,
Delegator,
Unknown
};
/** prefer this one over the XPropertySetInfo of the aggregate!
......
......@@ -208,20 +208,20 @@ cppu::IPropertyArrayHelper& OShape::getInfoHelper()
void SAL_CALL OShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
getInfoHelper();
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY )
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate )
m_aProps.aComponent.m_xProperty->setPropertyValue( aPropertyName,aValue);
// can be in both
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY )
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator )
ShapePropertySet::setPropertyValue( aPropertyName, aValue );
}
uno::Any SAL_CALL OShape::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
getInfoHelper();
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY )
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate )
return m_aProps.aComponent.m_xProperty->getPropertyValue( PropertyName);
// can be in both
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY )
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator )
return ShapePropertySet::getPropertyValue( PropertyName);
return uno::Any();
}
......@@ -229,40 +229,40 @@ uno::Any SAL_CALL OShape::getPropertyValue( const OUString& PropertyName ) throw
void SAL_CALL OShape::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
getInfoHelper();
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || aPropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || aPropertyName.isEmpty() )
m_aProps.aComponent.m_xProperty->addPropertyChangeListener( aPropertyName, xListener);
// can be in both
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || aPropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || aPropertyName.isEmpty() )
ShapePropertySet::addPropertyChangeListener( aPropertyName, xListener );
}
void SAL_CALL OShape::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
getInfoHelper();
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || aPropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || aPropertyName.isEmpty() )
m_aProps.aComponent.m_xProperty->removePropertyChangeListener( aPropertyName, aListener );
// can be in both
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || aPropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || aPropertyName.isEmpty() )
ShapePropertySet::removePropertyChangeListener( aPropertyName, aListener );
}
void SAL_CALL OShape::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
getInfoHelper();
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || PropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || PropertyName.isEmpty() )
m_aProps.aComponent.m_xProperty->addVetoableChangeListener( PropertyName, aListener );
// can be in both
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || PropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || PropertyName.isEmpty() )
ShapePropertySet::addVetoableChangeListener( PropertyName, aListener );
}
void SAL_CALL OShape::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
getInfoHelper();
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || PropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || PropertyName.isEmpty() )
m_aProps.aComponent.m_xProperty->removeVetoableChangeListener( PropertyName, aListener );
// can be in both
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || PropertyName.isEmpty() )
if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || PropertyName.isEmpty() )
ShapePropertySet::removeVetoableChangeListener( PropertyName, aListener );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment