Name

DocumentPlugin — The base class for any Serna plugin.

Synopsis

class DocumentPlugin : public SernaApiBaseSernaApiBase,
                       public RefCountedWrappedObjectSernaApi::RefCountedWrappedObject
 {
public:
  // construct/copy/destruct
  DocumentPlugin(SernaApiBase *, SernaApiBase *);
  DocumentPlugin(long, long);
  DocumentPlugin(unsigned);
  ~DocumentPlugin();

  // public member functions

  SernaDoc sernaDoc() const;
  SString pluginName() const;
  PropertyNode pluginProperties() const;
  void buildPluginExecutors(bool = false) ;
  void registerExecutor(const SString &, PluginEventExecutorMaker = 0) ;
  void buildPluginInterface() ;
  void postInit() ;
  bool preClose() ;
  void aboutToSave() ;
  void newDocumentGrove() ;
  void beforeTransform() ;
  void executeUiEvent(const SString &, const UiAction &) ;
  UiItem makeUiItem(const SString &, const PropertyNode &) const;
  UiItem buildUiItem(const SString &) const;
  bool executeCommandEvent(const SString &) const;
  bool executeCommandEvent(const SString &, const PropertyNode &) const;
  bool executeCommandEvent(const SString &, const PropertyNode &, 
                           const PropertyNode &) const;
  PropertyNode getPropTree(const SString &) const;
  PropertyNode registerPropTree(const SString &, const SString & = SString()) ;

  // public static functions

  SString sernaVersion() ;
};

Description

DocumentPlugin construct/copy/destruct

  1. DocumentPlugin(SernaApiBase * sernaDoc, SernaApiBase * pluginProperties);


  2. DocumentPlugin(long , long );


  3. DocumentPlugin(unsigned long);


  4. ~DocumentPlugin();


DocumentPlugin public member functions

  1. SernaDoc sernaDoc() const;

    Returns pointer to the SernaDoc instance corresponding to the current document


  2. SString pluginName() const;

    Returns plugin name (taken from PLUGIN_NAME property).


  3. PropertyNode pluginProperties() const;

    Returns root of the property tree corresponding to the plugin data (section "data" in the .spd file)


  4. void buildPluginExecutors(bool autoRegister = false) ;

    Build all plugin executors from the plugin file description (taken from .spd file). If autoRegister is TRUE, then all UI actions described in ui/uiActions will be automatically registered for local execution (via executeUiEvent()).


  5. void registerExecutor(const SString & name, PluginEventExecutorMaker = 0) ;

    Registers maker-function for plugin UI executors.


  6. void buildPluginInterface() ;

    This function builds plugin interface from the plugin definition file. It is called automatically when document UI is being constructed or re-loaded by the Customizer. At this point document is not yet in the UI tree.


  7. void postInit() ;

    called after building the interface, only once (when document is opened). When postInit() is called, document is already in the UI tree.


  8. bool preClose() ;

    called on close operation, to check whether document can be closed (for example to check if there is no unsaved data)


  9. void aboutToSave() ;

    called just before document is saved.


  10. void newDocumentGrove() ;

    called when new document is created.


  11. void beforeTransform() ;

    called just before XSLT transform on main document


  12. void executeUiEvent(const SString & cmdEvent, const UiAction & ) ;

    Reimplement this to execute UI commands which was registered with null executor maker


  13. UiItem makeUiItem(const SString & name, const PropertyNode & properties) const;

    Create single UI item with specified properties.


  14. UiItem buildUiItem(const SString & itemName) const;

    Build UI item with specified name from the ui section of the plugin description file (.spd)


  15. bool executeCommandEvent(const SString & name) const;

    Event executors.


  16. bool executeCommandEvent(const SString & name, const PropertyNode & in) const;

    Event executors.


  17. bool executeCommandEvent(const SString & name, const PropertyNode & in,                          const PropertyNode & out) const;

    Event executors.


  18. PropertyNode getPropTree(const SString & suffix) const;

    Returns propery tree for the given plugin suffix.


  19. PropertyNode registerPropTree(const SString & suffix, const SString & propName = SString()) ;

    Creates and registers property tree for the given plugin suffix. Once property tree is registered, it will be automatically read (and saved, when possible) in suffix file on document close/save events.


DocumentPlugin public static functions

  1. SString sernaVersion() ;

    Returns version string of the Serna application, e.g. '3.6.0'.