SfxItemSet::HasItem method

Kohei Yoshida kohei.yoshida at suse.com
Mon Feb 6 11:49:03 PST 2012


Hi there,

I've just added a new method to SfxItemSet to provide an easy way to
check whether or not an item is already set, and if it's already set,
get that item.  Here is what I've added:

bool SfxItemSet::HasItem(sal_uInt16 nWhich, const SfxPoolItem*& rpItem) const
{
    return SFX_ITEM_SET == GetItemState(nWhich, true, &rpItem);
}

The old way is to call GetItemState() and check its return type to see
if it's SFX_ITEM_SET.  But IMO the new method is slightly simpler &
helps eliminate dozens of custom macros that basically provide the same
semantics as the new method.

Just FYI.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc



More information about the LibreOffice mailing list