if ( aFind != m_aGroupArr.end() )
{ // group exists
aFind->second.RemoveComponent( _xSet );
// If the count of Group elements == 1 -> deactivate Group
sal_Int32 nCount = aFind->second.Count(); if ( nCount == 1 || nCount == 0 )
{
OActiveGroups::iterator aActiveFind = ::std::find(
m_aActiveGroupMap.begin(),
m_aActiveGroupMap.end(),
aFind
); if ( aActiveFind != m_aActiveGroupMap.end() )
{ // the group is active. Deactivate it if the remaining component // is *no* radio button if ( nCount == 0 || !isRadioButton( aFind->second.GetObject( 0 ) ) )
m_aActiveGroupMap.erase( aActiveFind );
}
}
}
// Deregister as PropertyChangeListener at Component
_xSet->removePropertyChangeListener( PROPERTY_NAME, this ); if (hasProperty(PROPERTY_GROUP_NAME, _xSet))
_xSet->removePropertyChangeListener( PROPERTY_GROUP_NAME, this ); if (hasProperty(PROPERTY_TABINDEX, _xSet))
_xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this );
}
// remove Component from group
OUString sGroupName; if (hasProperty( PROPERTY_GROUP_NAME, xSet ))
xSet->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName; if (evt.PropertyName == PROPERTY_NAME) { if (!sGroupName.isEmpty()) return; // group hasn't changed; ignore this name change. // no GroupName; use Name as GroupName
evt.OldValue >>= sGroupName;
} elseif (evt.PropertyName == PROPERTY_GROUP_NAME) {
evt.OldValue >>= sGroupName; if (sGroupName.isEmpty()) { // No prior GroupName; fallback to Name
xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
}
} else
sGroupName = GetGroupName( xSet );
// if we have at least 2 elements in the group, then this is an "active group" bool bActivateGroup = aFind->second.Count() == 2;
// Additionally, if the component is a radio button, then it's group becomes active, // too. With this, we ensure that in a container with n radio buttons which all are // in different groups the selection still works reliably (means that all radios can be // clicked independently) if ( aFind->second.Count() == 1 )
{ if ( isRadioButton( xSet ) )
bActivateGroup = true;
}
// Register as PropertyChangeListener at Component
xSet->addPropertyChangeListener( PROPERTY_NAME, this ); if (hasProperty(PROPERTY_GROUP_NAME, xSet))
xSet->addPropertyChangeListener( PROPERTY_GROUP_NAME, this );
// Not everyone needs to support Tabindex if (hasProperty(PROPERTY_TABINDEX, xSet))
xSet->addPropertyChangeListener( PROPERTY_TABINDEX, this );
}
void OGroupManager::RemoveElement( const Reference<XPropertySet>& xSet )
{ // Only ControlModels
Reference<XControlModel> xControl(xSet, UNO_QUERY); if (!xControl.is() ) return;
// Remove Component from Group
OUString sGroupName( GetGroupName( xSet ) );
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.