org.jopendocument.dom
Class OOXML

java.lang.Object
  extended by org.jopendocument.dom.OOXML
All Implemented Interfaces:
Comparable<OOXML>

public abstract class OOXML
extends Object
implements Comparable<OOXML>

Various bits of OpenDocument XML.

Author:
Sylvain CUAZ
See Also:
get(XMLFormatVersion)

Field Summary
static String LAST_FOR_UNKNOWN_PROP
          If this system property is set to true then get(XMLFormatVersion) will never return null, allowing to support unknown versions.
 
Method Summary
abstract  boolean canValidate()
           
 int compareTo(OOXML o)
          Compare the date the specification was published.
abstract  org.jdom.Element createFormattingProperties(String family)
           
protected  List encodeRT_L(String content, Map<String,String> styles)
           
 org.jdom.Element encodeRT(String content, Map<String,String> styles)
          Convert rich text (with [] tags) into XML.
 org.jdom.Element encodeWS(org.jdom.Element elem)
           
 org.jdom.Element encodeWS(String s)
          Encode a String to OO XML.
 void encodeWS(org.jdom.Text t)
           
 List<org.jdom.Content> encodeWSasList(String s)
           
static OOXML get(org.jdom.Element root)
           
static OOXML get(XMLFormatVersion version)
          Returns the instance that match the requested version.
static OOXML get(XMLFormatVersion version, boolean lastForUnknown)
           
 BigDecimal[] getCoordinates(org.jdom.Element elem, LengthUnit unit)
          Return the coordinates of the top-left and bottom-right of the passed shape.
 BigDecimal[] getCoordinates(org.jdom.Element elem, LengthUnit unit, boolean horizontal, boolean vertical)
          Return the coordinates of the top-left and bottom-right of the passed shape.
 String getDateString()
          The date the specification was published.
static OOXML getDefault()
           
abstract  String getEventListener()
           
abstract  String[] getFontDecls()
          Return the names of font face declarations.
 XMLFormatVersion getFormatVersion()
           
abstract  String getFrameQName()
           
static OOXML getLast()
           
static OOXML getLast(XMLVersion version)
           
 org.jdom.Element getLineBreak()
           
abstract  String getOfficeEventListeners()
          The name of the element where event listeners are defined.
abstract  String getOfficeScript()
          The name of the elements where scripts are defined.
abstract  String getOfficeScripts()
          Return the top-level script element in the content.
abstract  org.jdom.Element getTab()
           
abstract  Validator getValidator(org.jdom.Document doc)
          Verify that the passed document is a valid OpenOffice.org 1 or ODF document.
 XMLVersion getVersion()
           
static void setDefault(OOXML ns)
           
static List<OOXML> values()
          Return all known instances in the order they were published.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_FOR_UNKNOWN_PROP

public static final String LAST_FOR_UNKNOWN_PROP
If this system property is set to true then get(XMLFormatVersion) will never return null, allowing to support unknown versions.

Method Detail

get

public static OOXML get(XMLFormatVersion version)
Returns the instance that match the requested version.

Parameters:
version - the version.
Returns:
the corresponding instance, null for unsupported versions.
See Also:
LAST_FOR_UNKNOWN_PROP

get

public static OOXML get(XMLFormatVersion version,
                        boolean lastForUnknown)

get

public static OOXML get(org.jdom.Element root)

values

public static final List<OOXML> values()
Return all known instances in the order they were published.

Returns:
all known instances ordered.
See Also:
compareTo(OOXML)

getLast

public static final OOXML getLast()

getLast

public static final OOXML getLast(XMLVersion version)

setDefault

public static void setDefault(OOXML ns)

getDefault

public static OOXML getDefault()

getDateString

public final String getDateString()
The date the specification was published.

Returns:
the date in "yyyyMMdd" format.

compareTo

public int compareTo(OOXML o)
Compare the date the specification was published.

Specified by:
compareTo in interface Comparable<OOXML>
Parameters:
o - the object to be compared.
See Also:
getDateString()

getVersion

public final XMLVersion getVersion()

getFormatVersion

public final XMLFormatVersion getFormatVersion()

canValidate

public abstract boolean canValidate()

getValidator

public abstract Validator getValidator(org.jdom.Document doc)
Verify that the passed document is a valid OpenOffice.org 1 or ODF document.

Parameters:
doc - the xml to test.
Returns:
a validator on doc.

getFontDecls

public abstract String[] getFontDecls()
Return the names of font face declarations.

Returns:
at index 0 the name of the container element, at 1 the qualified name of its children.

getOfficeScripts

public abstract String getOfficeScripts()
Return the top-level script element in the content.

Returns:
the top-level script element name.

getOfficeScript

public abstract String getOfficeScript()
The name of the elements where scripts are defined.

Returns:
the name of the children of getOfficeScripts() defining scripts.

getOfficeEventListeners

public abstract String getOfficeEventListeners()
The name of the element where event listeners are defined.

Returns:
the name of the child of getOfficeScripts() defining event listeners.

getEventListener

public abstract String getEventListener()

getLineBreak

public final org.jdom.Element getLineBreak()

getTab

public abstract org.jdom.Element getTab()

getFrameQName

public abstract String getFrameQName()

createFormattingProperties

public abstract org.jdom.Element createFormattingProperties(String family)

encodeRT_L

protected final List encodeRT_L(String content,
                                Map<String,String> styles)

encodeRT

public final org.jdom.Element encodeRT(String content,
                                       Map<String,String> styles)
Convert rich text (with [] tags) into XML.

Parameters:
content - the string to convert, eg "texte [b]gras[/b]".
styles - the mapping from tagname (eg "b") to the name of the character style (eg "Gras").
Returns:
the corresponding element.

encodeWS

public final org.jdom.Element encodeWS(String s)
Encode a String to OO XML. Handles substition of whitespaces to their OO equivalent.

Parameters:
s - a plain ole String, eg "term\tdefinition".
Returns:
an Element suitable to be inserted in an OO XML document, eg
     <text:span>term<text:tab-stop/>definition</text:span>
 
.

encodeWSasList

public final List<org.jdom.Content> encodeWSasList(String s)

encodeWS

public final void encodeWS(org.jdom.Text t)

encodeWS

public final org.jdom.Element encodeWS(org.jdom.Element elem)

getCoordinates

public final BigDecimal[] getCoordinates(org.jdom.Element elem,
                                         LengthUnit unit)
Return the coordinates of the top-left and bottom-right of the passed shape.

Parameters:
elem - an XML element.
unit - the unit of the returned numbers.
Returns:
an array of 4 numbers, null if elem is not a shape, numbers themselves are never null.

getCoordinates

public final BigDecimal[] getCoordinates(org.jdom.Element elem,
                                         LengthUnit unit,
                                         boolean horizontal,
                                         boolean vertical)
Return the coordinates of the top-left and bottom-right of the passed shape.

Parameters:
elem - an XML element.
unit - the unit of the returned numbers.
horizontal - true if the x coordinates should be computed, false meaning items 0 and 2 of the result are null.
vertical - true if the y coordinates should be computed, false meaning items 1 and 3 of the result are null.
Returns:
an array of 4 numbers, null if elem is not a shape, numbers themselves are only null if requested with horizontal or vertical.


Copyright © 2010 jOpenDocument All Rights Reserved.