de.init.uno.text
Class MarkupService

java.lang.Object
  extended by de.init.uno.text.MarkupService

public class MarkupService
extends java.lang.Object

Service class to manage bookmarks

Author:
m.kandora

Method Summary
static com.sun.star.text.XTextCursor createCursorByBookmark(com.sun.star.lang.XComponent xComponent, java.lang.String name)
          Return cursor location of the bookmark specified by nameBookmark.
static com.sun.star.text.XTextRange fetchSelection(com.sun.star.uno.XComponentContext context, com.sun.star.frame.XFrame frame)
          fetch first selection,
 IitsTagElement findBookmark(com.sun.star.uno.XComponentContext context, com.sun.star.frame.XFrame frame)
          returns the innermost bookmark from a selection as an ItsTagElement or an empty ItsTagElement, if no bookmark can be found
 java.lang.String[] getBookmarkNames(com.sun.star.text.XTextDocument document)
          Returns all available bookmarks in the provided document
static MarkupService getMarkupService()
          Returns a singleton instance of the MarkupService
 int getSelectionBegin(com.sun.star.text.XTextCursor xtc)
           
 void insertBookmark(com.sun.star.uno.XComponentContext xContext, com.sun.star.frame.XFrame xframe, boolean update, ItsAttributes.DataCategories datacategory, IitsTagElement element)
          Inserts a Bookmark
 void removeBookmark(com.sun.star.uno.XComponentContext xContext, com.sun.star.frame.XFrame frame, java.lang.String id)
          Removes the boomark from uno context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMarkupService

public static MarkupService getMarkupService()
Returns a singleton instance of the MarkupService

Returns:

insertBookmark

public void insertBookmark(com.sun.star.uno.XComponentContext xContext,
                           com.sun.star.frame.XFrame xframe,
                           boolean update,
                           ItsAttributes.DataCategories datacategory,
                           IitsTagElement element)
                    throws java.lang.Exception
Inserts a Bookmark

Parameters:
comp -
xframe -
update -
Throws:
java.lang.Exception

removeBookmark

public void removeBookmark(com.sun.star.uno.XComponentContext xContext,
                           com.sun.star.frame.XFrame frame,
                           java.lang.String id)
Removes the boomark from uno context

Parameters:
xContext -
frame -
id -

createCursorByBookmark

public static com.sun.star.text.XTextCursor createCursorByBookmark(com.sun.star.lang.XComponent xComponent,
                                                                   java.lang.String name)
Return cursor location of the bookmark specified by nameBookmark. Throws IllegalArgumentException if the nameBookmark is not known.

Parameters:
xComponent - text component where the bookmark is retrieved from
name - name of the bookmark.
Returns:
cursor location

fetchSelection

public static com.sun.star.text.XTextRange fetchSelection(com.sun.star.uno.XComponentContext context,
                                                          com.sun.star.frame.XFrame frame)
                                                   throws com.sun.star.lang.IndexOutOfBoundsException,
                                                          com.sun.star.lang.WrappedTargetException
fetch first selection,

Parameters:
context -
frame -
Returns:
Throws:
com.sun.star.lang.IndexOutOfBoundsException
com.sun.star.lang.WrappedTargetException

findBookmark

public IitsTagElement findBookmark(com.sun.star.uno.XComponentContext context,
                                   com.sun.star.frame.XFrame frame)
returns the innermost bookmark from a selection as an ItsTagElement or an empty ItsTagElement, if no bookmark can be found

Parameters:
context - the application context
frame - the frame
Returns:
bookmark as IitsTagElement (wether empty or not)

getBookmarkNames

public java.lang.String[] getBookmarkNames(com.sun.star.text.XTextDocument document)
Returns all available bookmarks in the provided document

Parameters:
document -
Returns:
an array of all bookmark names

getSelectionBegin

public int getSelectionBegin(com.sun.star.text.XTextCursor xtc)
Parameters:
xtc -
Returns: