Zhu Lihua <zhulihua <at> redoffice.com> writes:

> 
> Hi all,
> 
> I read the following code in OOo source code(itempool.hxx):
> 
> #define SFX_WHICH_MAX 4999
> 
> static int    IsWhich(USHORT nId) {
>                                       return nId && nId <= SFX_WHICH_MAX; }
> static int    IsSlot(USHORT nId) {
>                                       return nId && nId > SFX_WHICH_MAX; }
> 
> I think: if nId > 4999, it's a "Slot". if nId <= 4999 and nId !=0 , it's a
"Which". 
> 
> What are the terms "slot" and "which" mean?
> Thank you!

A WhichId is the id by which items are stored in SfxItemSets and SfxItemPools.
You cannot have two items with the same WhichId in on SfxItemSet. However,
there are multiple uses for WhichIds: SfxSlotIds are only one and they are
required to start at 5000. In writer for example HintIds can also be used
as WhichIds. To make sure those do not collide, HintIds must be <5000.

SlotIds are used in the Sfx2 framework. see:

 
http://wiki.services.openoffice.org/wiki/Framework/Article/Implementation_of_the_Dispatch_API_In_SFX2

SlotIds are at least unique per Shell (*).

There are some fine differences in the way SfxItemSets/SfxPropertySets handle
ids <5000 and ids >=5000. For example, the Changed(..)-Callback in SfxItemSet
only gets called for WhichIds <5000. For more details, Im afraid you will have
to dig into the code.

Have Fun,

Bjoern


(*) I guess, they might even be unique OOo-wide, but Im not sure about that.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to