/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/* * By removing the GroupComp the insertion position has become invalid. * We do not to change it here, however, because it's passed on continuously * and ascending distinctively.
*/
} else
{
OSL_FAIL( "OGroup::RemoveComponent: Component not in Group" );
}
} else
{
OSL_FAIL( "OGroup::RemoveComponent: Component not in Group" );
}
}
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 ist noch experimentell.