Remove useless special handling of single-value ranges
... as they are treated by generic code just fine. A check added to guard against overflow (0xFFFF + 1 -> 0). Change-Id: Ibef85191eab82002981e12f83f313f3d122da74c Reviewed-on: https://gerrit.libreoffice.org/50163 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
b7e8ae27f8
commit
d4b4f5f1f4
1 changed files with 14 additions and 29 deletions
|
@ -994,41 +994,26 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl, Button*, void)
|
|||
{
|
||||
const sal_uInt16* pU = pTmpRanges + 1;
|
||||
|
||||
if ( *pTmpRanges == *pU )
|
||||
// Correct Range with multiple values
|
||||
sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU;
|
||||
DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" );
|
||||
|
||||
if ( nTmp > nTmpEnd )
|
||||
{
|
||||
// Range which two identical values -> only set one Item
|
||||
sal_uInt16 nWh = pPool->GetWhich( *pTmpRanges );
|
||||
// If really sorted wrongly, then set new
|
||||
std::swap(nTmp, nTmpEnd);
|
||||
}
|
||||
|
||||
while ( nTmp && nTmp <= nTmpEnd ) // guard against overflow
|
||||
{
|
||||
// Iterate over the Range and set the Items
|
||||
sal_uInt16 nWh = pPool->GetWhich( nTmp );
|
||||
m_pExampleSet->ClearItem( nWh );
|
||||
aTmpSet.ClearItem( nWh );
|
||||
// At the Outset of InvalidateItem,
|
||||
// so that the change takes effect
|
||||
m_pOutSet->InvalidateItem( nWh );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Correct Range with multiple values
|
||||
sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU;
|
||||
DBG_ASSERT( nTmp <= nTmpEnd, "Range is sorted the wrong way" );
|
||||
|
||||
if ( nTmp > nTmpEnd )
|
||||
{
|
||||
// If really sorted wrongly, then set new
|
||||
sal_uInt16 nTmp1 = nTmp;
|
||||
nTmp = nTmpEnd;
|
||||
nTmpEnd = nTmp1;
|
||||
}
|
||||
|
||||
while ( nTmp <= nTmpEnd )
|
||||
{
|
||||
// Iterate over the Range and set the Items
|
||||
sal_uInt16 nWh = pPool->GetWhich( nTmp );
|
||||
m_pExampleSet->ClearItem( nWh );
|
||||
aTmpSet.ClearItem( nWh );
|
||||
// At the Outset of InvalidateItem,
|
||||
// so that the change takes effect
|
||||
m_pOutSet->InvalidateItem( nWh );
|
||||
nTmp++;
|
||||
}
|
||||
nTmp++;
|
||||
}
|
||||
// Go to the next pair
|
||||
pTmpRanges += 2;
|
||||
|
|
Loading…
Reference in a new issue