[Libreoffice] Location of SfxPoolItem.Type() method

David Tardon dtardon at redhat.com
Sun Nov 21 00:59:04 PST 2010


On Sun, Nov 21, 2010 at 12:21:08AM +1100, Mattias Johnsson wrote:
> Hello all,
> 
> I've been trying to fix a bug in the search and replace code, and
> after a bit of hacking have discovered that in findattr.cxx there's a
> function
> 
> int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
> {
> ...
>     return rItem1 == rItem2;
> }
> 
> In the bugged case this returns true, and in the correctly functioning
> case it returns false. I'm trying to figure out exactly how rItem1 and
> rItem2 differ in the correct case to help me find out what's wrong in
> the bugged case.
> 
> If I'm understanding things correctly, and I may not be, since the
> search and replace code is quite convoluted, in this case these
> SfxPoolItems are lists of attributes that one can search and replace
> for; in this case I'm searching for a specific font size and replacing
> it with another.
> 
> The overloaded comparison operator is defined as
> 
> int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
> {
>     DBG_CHKTHIS(SfxPoolItem, 0);
>     return rCmp.Type() == Type();
> }
> 
> but for the life of me I can't find out where the Type() method is defined.
> 
> Does anyone have any pointers?
> 

The SfxPoolItem::operator== is virtual, so you may actually need to look
at the definition in some derived class.

set print object on
p rItem1
p rItem2

in gdb in the CmpAttr func will tell you the real classes of the items.
Or, alternatively, you can step into the operator.

D.


More information about the LibreOffice mailing list