现在的位置: 首页 > 综合 > 正文

openoffice–Slot Processing

2013年12月23日 ⁄ 综合 ⁄ 共 4471字 ⁄ 字号 评论关闭
文章目录

 

In former (Pre-UNO) time the slots where not only used for command dispatching but also for the implementation of our Basic API (up to StarOffice 5.2), so the slot arrays where "real" interfaces. There are a lot residues of the in the sdi files (see below), but they aren't used anymore.

The use case explains why there are two different kinds of slots, property slots and method slots, and the difference between them can be spotted easily from the definition of a slot in the sdi file. Here are two examples, the first one describing a method slot and the second one describing a property slot:

  1. SfxVoidItem About SID_ABOUT
  2. ()
  3. [
  4. /* flags: */
  5. AutoUpdate = FALSE,
  6. Cachable = Cachable,
  7. FastCall = FALSE,
  8. HasCoreId = FALSE,
  9. HasDialog = TRUE,
  10. ReadyOnlyDoc = TRUE,
  11. Toggle = FALSE,
  12. Container = FALSE,
  13. RecordAbsolute = FALSE,
  14. RecordPerSet;
  15. Synchron;
  16.  
  17. /* config */
  18. AccelConfig = TRUE,
  19. MenuConfig = TRUE,
  20. StatusBarConfig = FALSE,
  21. ToolBoxConfig = TRUE,
  22. GroupId = GID_APPLICATION;
  23. ]
  24.  
  25. SfxBoolItem DesignerDialog SID_STYLE_DESIGNER
  26.  
  27. [
  28. /* flags: */
  29. AutoUpdate = TRUE,
  30. Cachable = Cachable,
  31. FastCall = TRUE,
  32. HasCoreId = FALSE,
  33. HasDialog = FALSE,
  34. ReadyOnlyDoc = FALSE,
  35. Toggle = FALSE,
  36. Container = FALSE,
  37. RecordAbsolute = FALSE,
  38. RecordPerSet;
  39. Synchron;
  40.  
  41. Readyonly = FALSE,
  42.  
  43. /* config */
  44. AccelConfig = TRUE,
  45. MenuConfig = TRUE,
  46. StatusBarConfig = FALSE,
  47. ToolBoxConfig = TRUE,
  48. GroupId = GID_FORMAT;
  49. ]

Each slot is a block in rectangular bracket filled with attributes that is preceded by two lines that identify the slot and define its nature. The exact meaning of all the attributes is explained below, the most notable difference is seen in the second line of each block: the paranthesis of the "About" slot classify it as a method while the other one (without paranthesis) is a property. As explained above, this classification goes back to the old Basic API but besides that it's important for the implementation of macro recording that is also based on the Dispatch API (and for SFX component it's implemented using slots). "Method" and "property" slots are recorded differently.
The name in the middle of each first line of a block was used as the name of the property or method in the Basic API and today this name is the internal command name that is matched to any ".uno:xxx" CommandURLs of the Dispatch API. As an example, the slot named "Undo" is assigned to the ".uno:Undo" command. This matching requires that the internal command names have to be unique in the complete module. This uniqueness is verified by the svidl compiler that breaks in case if name clashes in a module.
The last part of each first line is the so called SlotID that in former times was the real identifier (not as today the internal command name) and it was also used inside the GUI element configuration files where today CommandURLs are used. So this SlotID had to be unique for the module at least, currently it's even globally unique but at least theoretically it is now obsolete. Inside the slot processing only the textual representation of the SlotID is relevant , not its numerical value.
Property slots have a type specified by the first part of the first line. The same data in a method slot specifies the return value of the associated method. Method slots also can gave parameters (non empty paranthesis) and a return value that could be used in the old Basic API of StarOffice, but also in internal methods of the SfxDispatcher. Strictly speaking the latter is still possible but we try to get rid of this. Here are two examples for slots with arguments, with and without return value: 

Attribute Meaning
Cachable (Volatile) Slot status is cached, sending a new status to controllers need an Invalidate() call that forces SFX to fetch a new status. Volatile slots are not cached and SFX permanently asks for status information based on a timer.
AutoUpdate TRUE: After execution of the slot SFX automatically fetches the new status, no Invalidate() call necessary
FastCall TRUE: SFX doesn't check "enable" status before executing a slot
Toggle Execute without parameters automatically toggles the current status. Works for property slots with boolean or enum type.
HasCoreId Obsolete
HasDialog Obsolete
ReadOnlyDoc FALSE: SFX automatically disables this slot if the document is read only
Container TRUE: in case of OLE inplace editing this slot is automatically disabled by SFX if the component is the object.
FALSE: in case of OLE inplace editing this slot is automatically disabled by SFX if the component is the container.
RecordAbsolute Obsolete
RecordPerSet (RecordPerItem, NoRecord) See explanation for Recording.
Synchron (Asynchron) Asynchron: SFX execute the slot by posting a user event instead of directly calling the execute function of the slot
Readonly Obsolete
AccelConfig Slot may be offered in the configuration dialog for keyboard shortcuts
MenuConfig Slot may be offered in the configuration dialog for menus
StatusBarConfig Slot may be offered in the configuration dialog for status bar
ToolboxConfig Slot may be offered in the configuration dialog for toolbars
GroupId Assign the slot to a function group in the configuration dialogs (module is free to define categories)
ImageRotation Toolbar images are rotated in case of writing direction from right to left
ImageReflection Toolbar images are rotated in case of vertical text orientation

 

抱歉!评论已关闭.