Hi,

Thank you, Joost, Niklas and Bjoern.

It's still abit abstract for me. I know SlotIDs are constants defined
in .hrc files, e.g., sc.hrc. What about WhichIDs?
Could you please give me a simple example to illustrate the relationship
between "module", "item", "whichId" and "SlotId"?

>From Niklas' explanation, I sense each module have a range of WhichIDs.
What does "module" means here? Does it mean the application module? ie,
Writer, calc, impress and so on. "an ItemPool can define a Slot-ID for
each Which-ID. The same Slot-ID is then used for an item across the
modules", I can't understand the above explanation. Different module
have different WhichIDs. How can it use same SlotID? Does it define the
same SlotID for different WhichID in different modules?

I havn't finised reading the article Bjoern provided. Maybe I can get
more from the article.

Thank you again for the help. I just dig into the source code and know
very little about it now. Please don't feel boring.

Best regards,
Lihua

在 2009-08-05三的 09:30 +0000,Bjoern Michaelsen写道:
> 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]
> 
-- 
Lihua


北京红旗贰仟软件技术有限公司
Beijing Redflag 2000 Software Co., Ltd.
Building No.2, Block A, Huilongsen, 18 Xihuan Nanlu
Beijing Economic-Technological Development Area
Beijing - P.R.China

Tel:+86-10-51570010 ext.6141
http://www.RedOffice.com



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

Reply via email to