Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.rgw.oowrapper
Class OOText

java.lang.Object
  extended by ch.rgw.oowrapper.OOText
All Implemented Interfaces:
ITextPlugin

public class OOText
extends java.lang.Object
implements ITextPlugin


Nested Class Summary
 
Nested classes/interfaces inherited from interface ch.elexis.text.ITextPlugin
ITextPlugin.ICallback, ITextPlugin.PageFormat
 
Field Summary
static java.lang.String MIMETYPE_OO2
           
 
Fields inherited from interface ch.elexis.text.ITextPlugin
ENTRY_TYPE_TABLE, ENTRY_TYPE_TEXT, FIRST_ROW_IS_HEADER, GRID_VISIBLE
 
Constructor Summary
OOText()
           
 
Method Summary
 boolean clear()
          clear the document
 Composite createContainer(Composite parent, ITextPlugin.ICallback handler)
          Create and return an SWT Coomposite that holds the editor
 boolean createEmptyDocument()
          Create an empty document inside the container
 void dispose()
          Text component is disposed.
 boolean findOrReplace(java.lang.String pattern, ReplaceCallback cb)
          Find a pattern (regular expression) in the document, and call ReplaceCallback with each match.
 ITextPlugin.PageFormat getFormat()
          Return format of the page
 java.lang.String getMimeType()
          Default Mimettype of the documents that this implementation creates
 boolean insertTable(java.lang.String marke, int properties, java.lang.String[][] values, int[] columnSizes)
          Eine Tabelle einfügen.
 java.lang.Object insertText(java.lang.Object pos, java.lang.String text, int adjust)
          Insert text at the position described by the implemetation specific cursor
 java.lang.Object insertText(java.lang.String marke, java.lang.String text, int adjust)
          Insert text at a position specified by a regular expression
 java.lang.Object insertTextAt(int x, int y, int w, int h, java.lang.String text, int adjust)
          Position text into a rectangular area.
 java.lang.Object insertTextAt(int x, int y, int w, int h, java.lang.String text, int adjust, int verticalAdjust)
           
 boolean isDirectOutput()
          does the plugin want to output the document immediately after creating
 boolean loadFromByteArray(byte[] bs, boolean asTemplate)
          create a document from a byte array.
 boolean loadFromStream(java.io.InputStream is, boolean asTemplate)
          create a document from an InputStream that vontains the contents in the specific formar of the text component.
 boolean print(java.lang.String printer, java.lang.String tray, boolean waitUntilFinished)
          Print the document
 void setFocus()
          The text component receives the focus
 boolean setFont(java.lang.String name, int style, float size)
          Set font for all following operations (until the next call to setFont)
 void setFormat(ITextPlugin.PageFormat f)
          Set Format of the page
 void setInitializationData(IConfigurationElement config, java.lang.String propertyName, java.lang.Object data)
           
 void setSaveOnFocusLost(boolean bSave)
          Save contents on focus lost
 boolean setStyle(int style)
          Set style for all following operations (until the next call to setFont or setStyle)
 void showMenu(boolean b)
          Show or hide the component specific menu bar
 void showToolbar(boolean b)
          Show or hide the component specific toolbar
 byte[] storeToByteArray()
          Store the document into the byte array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIMETYPE_OO2

public static final java.lang.String MIMETYPE_OO2
See Also:
Constant Field Values
Constructor Detail

OOText

public OOText()
Method Detail

createContainer

public Composite createContainer(Composite parent,
                                 ITextPlugin.ICallback handler)
Description copied from interface: ITextPlugin
Create and return an SWT Coomposite that holds the editor

Specified by:
createContainer in interface ITextPlugin
Parameters:
parent - parent component
handler - Handler for saving the document
Returns:

setFocus

public void setFocus()
Description copied from interface: ITextPlugin
The text component receives the focus

Specified by:
setFocus in interface ITextPlugin

dispose

public void dispose()
Description copied from interface: ITextPlugin
Text component is disposed. All ressources must be freed

Specified by:
dispose in interface ITextPlugin

showMenu

public void showMenu(boolean b)
Description copied from interface: ITextPlugin
Show or hide the component specific menu bar

Specified by:
showMenu in interface ITextPlugin
Parameters:
b - true: show

showToolbar

public void showToolbar(boolean b)
Description copied from interface: ITextPlugin
Show or hide the component specific toolbar

Specified by:
showToolbar in interface ITextPlugin

createEmptyDocument

public boolean createEmptyDocument()
Description copied from interface: ITextPlugin
Create an empty document inside the container

Specified by:
createEmptyDocument in interface ITextPlugin
Returns:

loadFromByteArray

public boolean loadFromByteArray(byte[] bs,
                                 boolean asTemplate)
Description copied from interface: ITextPlugin
create a document from a byte array. The array contains the document in the (arbitrary) specific format of the text component. Prefarably, but not necessarily OpenDocumentFormat (odf)

Specified by:
loadFromByteArray in interface ITextPlugin
Parameters:
bs - the byte array with the document in a fotmat the compnent can interpret
asTemplate - tru if the byte array is a template.
Returns:
true on success

findOrReplace

public boolean findOrReplace(java.lang.String pattern,
                             ReplaceCallback cb)
Description copied from interface: ITextPlugin
Find a pattern (regular expression) in the document, and call ReplaceCallback with each match. Replace the found pattern with the replacment String received from ReplaceCallback.

Specified by:
findOrReplace in interface ITextPlugin
Parameters:
pattern - a regular expression
cb - a ReplaceCallback or null if no Replacement should be performed
Returns:
true if pattern was found at least once

storeToByteArray

public byte[] storeToByteArray()
Description copied from interface: ITextPlugin
Store the document into the byte array. The format can be any component specific type. The only requiremend is, that loadFromByteArray() must be able to recreate the document out of this byte array identically.

Specified by:
storeToByteArray in interface ITextPlugin
Returns:
a Byte Array with the contents of the document.

clear

public boolean clear()
Description copied from interface: ITextPlugin
clear the document

Specified by:
clear in interface ITextPlugin
Returns:

loadFromStream

public boolean loadFromStream(java.io.InputStream is,
                              boolean asTemplate)
Description copied from interface: ITextPlugin
create a document from an InputStream that vontains the contents in the specific formar of the text component.

Specified by:
loadFromStream in interface ITextPlugin
Returns:
true on success

setInitializationData

public void setInitializationData(IConfigurationElement config,
                                  java.lang.String propertyName,
                                  java.lang.Object data)
                           throws CoreException
Throws:
CoreException

print

public boolean print(java.lang.String printer,
                     java.lang.String tray,
                     boolean waitUntilFinished)
Description copied from interface: ITextPlugin
Print the document

Specified by:
print in interface ITextPlugin
Parameters:
printer - Name of the Printers or null (then to default printer)
tray - Name of the tray or null (then tray as defined y the driver or the template)
waitUntilFinished - if true: return after the printJob ist finished
Returns:
true on success

insertTable

public boolean insertTable(java.lang.String marke,
                           int properties,
                           java.lang.String[][] values,
                           int[] columnSizes)
Eine Tabelle einfügen.

Specified by:
insertTable in interface ITextPlugin
Parameters:
properties - Eigenschafen der Tabelle, mit | verknüpft
marke - Ein Text als Platzhalter innerhalb des Texts. Die Tabelle wird anstelle
columnSizes - ein Array mit der relativen Breite der Spalten (muss zusammen 100 ergeben) dieses Platzhalters gesetzt
values - Inhalt der Tabelle
Returns:
true bei erfolg

getFormat

public ITextPlugin.PageFormat getFormat()
Description copied from interface: ITextPlugin
Return format of the page

Specified by:
getFormat in interface ITextPlugin

setFormat

public void setFormat(ITextPlugin.PageFormat f)
Description copied from interface: ITextPlugin
Set Format of the page

Specified by:
setFormat in interface ITextPlugin

insertTextAt

public java.lang.Object insertTextAt(int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String text,
                                     int adjust)
Description copied from interface: ITextPlugin
Position text into a rectangular area.

Specified by:
insertTextAt in interface ITextPlugin
Parameters:
x - ,y,w,h position and size of the rectangle relative to the page bounds. Measured as millimeters. The effective position and size must match the given values at +- 2mm.
text - the text to insert, which can contain '\n' that must be honored.
adjust - SWT.LEFT, SWT.RIGHT, SWT.CENTER
Returns:
an implementation specific cursor that allows a later insert at the same position (mit insertText(Object,text,adjust)

insertTextAt

public java.lang.Object insertTextAt(int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String text,
                                     int adjust,
                                     int verticalAdjust)

insertText

public java.lang.Object insertText(java.lang.String marke,
                                   java.lang.String text,
                                   int adjust)
Description copied from interface: ITextPlugin
Insert text at a position specified by a regular expression

Specified by:
insertText in interface ITextPlugin
Parameters:
marke - regular expression, that describes the insertion point. Only the first match will be used, and the inserted Text will replace the found string.
adjust - SWT.LEFT oder SWT.RIGHT
Returns:
An implementation specific cursor thar allows a later insert after that position

insertText

public java.lang.Object insertText(java.lang.Object pos,
                                   java.lang.String text,
                                   int adjust)
Description copied from interface: ITextPlugin
Insert text at the position described by the implemetation specific cursor

Specified by:
insertText in interface ITextPlugin
Parameters:
pos - an implementation specific cursor
adjust - SWT.LEFT, SWT.CENTER, SWT.RIGHT
Returns:
a cursor that can be used for a subsequent insert.

setFont

public boolean setFont(java.lang.String name,
                       int style,
                       float size)
Description copied from interface: ITextPlugin
Set font for all following operations (until the next call to setFont)

Specified by:
setFont in interface ITextPlugin
Parameters:
name - name of the font
style - SWT.MIN, SWT.NORMAL, SWT.BOLD (thin, normal or bold)
size - font height in Pt
Returns:
false on error. True on success, what might mean however, that not the specified font but a similar font was set.

setStyle

public boolean setStyle(int style)
Description copied from interface: ITextPlugin
Set style for all following operations (until the next call to setFont or setStyle)

Specified by:
setStyle in interface ITextPlugin
Parameters:
style - SWT.MIN, SWT.NORMAL, SWT.BOLD (thin, normal or bold)
Returns:
false on error. True on success

getMimeType

public java.lang.String getMimeType()
Description copied from interface: ITextPlugin
Default Mimettype of the documents that this implementation creates

Specified by:
getMimeType in interface ITextPlugin

setSaveOnFocusLost

public void setSaveOnFocusLost(boolean bSave)
Description copied from interface: ITextPlugin
Save contents on focus lost

Specified by:
setSaveOnFocusLost in interface ITextPlugin
Parameters:
bSave - true: yes, else no.

isDirectOutput

public boolean isDirectOutput()
Description copied from interface: ITextPlugin
does the plugin want to output the document immediately after creating

Specified by:
isDirectOutput in interface ITextPlugin
Returns:
true if output should start immerdiately, false if the user triggers output manually

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis