Name

StructEditor — StructEditor is interface to the main edit view of the document.

Synopsis

class StructEditor (UiItemSernaApi::UiItem) :
  # construct/copy/destruct
  __init__(SernaApiBase *, DocumentPlugin *)
  __init__(const StructEditor &)
  StructEditor& operator=(const StructEditor &)
  __del__()

  # public member functions

  GroveEditor groveEditor() const
  bool executeAndUpdate(const Command &) 
  bool setCursorBySrcPos(const GrovePos &, const GroveNode &, bool = false) 
  GrovePos toResultPos(const GrovePos &, const GroveNode &, bool = true) const
  GrovePos getCheckedPos() const
  bool getSelection(GrovePos &, GrovePos &, bool = true) 
  void setSelection(const GrovePos &, const GrovePos &, 
                    const GrovePos & = GrovePos()) 
  None resetSelection() 
  Grove sourceGrove() const
  Grove foGrove() const
  GrovePos getSrcPos() const
  GrovePos getFoPos() const
  SString generateId(const SString & = SString()) const
  None setElementPositionWatcher(SimpleWatcher *) 
  None setSelectionWatcher(SimpleWatcher *) 
  None setDoubleClickWatcher(SimpleWatcher *) 
  None setTripleClickWatcher(SimpleWatcher *) 
  GroveStripInfo stripInfo() const
  XsltEngine xsltEngine() const
  CatalogManager catalogManager() const
  bool canInsertElement(const SString &, const SString & = SString(""), 
                        const GrovePos & = GrovePos()) 
  XmlValidatorProvider validatorProvider() const
  None setRep(SernaApiBase *) 

  # public static functions

  GroveNode getOrigin(const GroveNode &) 

Description

Gives access to the XML grove, cursor and command execution.

StructEditor construct/copy/destruct

  1. __init__(SernaApiBase * , DocumentPlugin * dp)


  2. __init__(const StructEditor & )


  3. StructEditor& operator=(const StructEditor & )


  4. __del__()


StructEditor public member functions

  1. GroveEditor groveEditor() const

    Returns GroveEditor instance.Needed for operations on xml nodes (insert Element, Text ...).


  2. bool executeAndUpdate(const Command & command)

    Execute Command, add it to undo/redo stack, validate, update view and set cursor. command must be either a command returned by the GroveEditor, or be a GroveBatchCommand.


  3. bool setCursorBySrcPos(const GrovePos & srcPos, const GroveNode & foHint,                        bool isTop = false)

    Set cursor by position in the source (document) grove. if isTop is true, view will be scrolled so cursor appears on top of the page. FoHint is optional pointer to the closest node in the FO tree; attempt will be made to set cursor as close as possible to the foHint. This is necessary because XSLT may produce multiple results in the FO tree for the same source, and foHint helps to determine which to choose.


  4. GrovePos toResultPos(const GrovePos & srcPos, const GroveNode & foHint,                      bool diffuse = true) const

    Convert position in the source grove to the position in the result grove. FoHint is optional pointer to the closest node in the FO tree; attempt will be made to compute position closest to the foHint (if specified).


  5. GrovePos getCheckedPos() const

    Obtain current source position. Returns null pos if position cannot be obtained, or if changes are prohibited in this position (eg this content is a part of internal entity declaration of external subset).


  6. bool getSelection(GrovePos & from, GrovePos & to, bool mustBeEditable = true)

    Returns boundaries of current selection, if any (as a pair of document-ordered positions in the source grove). Parameter mustBeEditable means that content in these positions must be editable (this is may be not so for read-only operations such as Copy).


  7. void setSelection(const GrovePos & from, const GrovePos & to,                   const GrovePos & foHint = GrovePos())

    Set the selection in the source tree between the positions from and to. If the optional foHint argument is passed, then the visual selection will appear in the place which is possibly closest to the foHint.


  8. None resetSelection()

    Reset active selection (this does not affect the document).


  9. Grove sourceGrove() const

    Returns reference to the source grove.


  10. Grove foGrove() const

    Returns reference to the FO grove.


  11. GrovePos getSrcPos() const

    Returns current cursor position in the source tree (unchecked).


  12. GrovePos getFoPos() const

    Returns current cursor position in the FO tree (unchecked).


  13. SString generateId(const SString & idFormat = SString()) const

    Generate unique element ID. This ID is guaranteed to be unique in the current document and all its XIncluded fragments. Optional parameter idFormat specifies desired ID format string (it is described in more detail in Serna Custom Content documentation)


  14. None setElementPositionWatcher(SimpleWatcher * )

    Set this watcher if you are interested in tracking current (cursor) position changes.


  15. None setSelectionWatcher(SimpleWatcher * )

    Set this watcher if you want to track selection changes.


  16. None setDoubleClickWatcher(SimpleWatcher * )

    Set this watcher if you want to track double clicks.


  17. None setTripleClickWatcher(SimpleWatcher * )

    Set this watcher if you want to track double clicks.


  18. GroveStripInfo stripInfo() const

    Information about stripped and preserved spaces, line feeds and so on.


  19. XsltEngine xsltEngine() const

    Access to the XSLT engine for the current document.


  20. CatalogManager catalogManager() const

    Get the catalog manager.


  21. bool canInsertElement(const SString & elemName,                       const SString & ns = SString(""),                       const GrovePos & gpos = GrovePos())

    Returns TRUE of given element can be inserted at the position specified by grovePos. If grovePos is not specified, current cursor position is used.


  22. XmlValidatorProvider validatorProvider() const

    Returns XML validator provider for the current document instance.


  23. None setRep(SernaApiBase * )


StructEditor public static functions

  1. GroveNode getOrigin(const GroveNode & foNode)

    Obtain (source) origin of the node in the FO tree. Note that origin may be NULL e.g. for generated text (<xsl:text>).