Class CollabTextDocument
- java.lang.Object
-
- org.odftoolkit.odfdom.changes.CollabTextDocument
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class CollabTextDocument extends Object implements Closeable
This collaboration document embraces an ODF document ad
-
-
Constructor Summary
Constructors Constructor Description CollabTextDocument(InputStream inputStream)
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.CollabTextDocument(InputStream inputStream, Map<Long,byte[]> resourceManager, Map<String,Object> configuration)
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.CollabTextDocument(InputStream documentStream, Map<String,Object> configuration)
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
applyChanges(String operationString)
Applies the (known) operations to upon the latest state of the ODF text documentint
applyChanges(org.json.JSONObject operations)
Applies the (known) operations to upon the latest state of the ODF text documentvoid
close()
Close the OdfPackage and release all temporary created data.int
countAppliedChanges()
long
getContentSize()
OdfTextDocument
getDocument()
Returns the OdfTextDocument encapsulating the DOM vieworg.json.JSONObject
getDocumentAsChanges()
Receives the (known) operations of the ODF text documentint
getMaxSheetCount()
int
getMaxTableCellCount()
int
getMaxTableColumnsCount()
int
getMaxTableRowsCount()
OdfFileDom
getOwnerDocument()
OdfPackage
getPackage()
Returns the OdfPackageMap<Long,byte[]>
getResourceMap()
Receives the a map with new resources for the Documentstatic CollabTextDocument
newTextCollabDocument()
Creates a new ODT document from the default template
-
-
-
Constructor Detail
-
CollabTextDocument
public CollabTextDocument(InputStream inputStream) throws Exception
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequential) read access needed by CollabTextDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
- Parameters:
inputStream
- - the InputStream of the ODF text document.- Throws:
Exception
-
CollabTextDocument
public CollabTextDocument(InputStream documentStream, Map<String,Object> configuration) throws Exception
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequential) read access needed by CollabTextDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
- Parameters:
configuration
- - key/value pairs of user given run-time settings (configuration)documentStream
- - the InputStream of the ODF text document.- Throws:
Exception
-
CollabTextDocument
public CollabTextDocument(InputStream inputStream, Map<Long,byte[]> resourceManager, Map<String,Object> configuration) throws Exception
Creates an CollabTextDocument from the OpenDocument provided by a resource Stream.Since an InputStream does not provide the arbitrary (non sequential) read access needed by CollabTextDocument, the InputStream is cached. This usually takes more time compared to the other createInternalDocument methods. An advantage of caching is that there are no problems overwriting an input file.
- Parameters:
inputStream
- - the InputStream of the ODF text document.resourceManager
- - the bytes of new resources can be accessed by an ID.configuration
- - key/value pairs of user given run-time settings (configuration)- Throws:
Exception
- document could not be opened
-
-
Method Detail
-
getOwnerDocument
public OdfFileDom getOwnerDocument() throws SAXException, IOException
- Throws:
SAXException
IOException
-
newTextCollabDocument
public static CollabTextDocument newTextCollabDocument() throws Exception
Creates a new ODT document from the default template- Returns:
- new CollabTextDocument
- Throws:
Exception
-
getDocumentAsChanges
public org.json.JSONObject getDocumentAsChanges() throws SAXException, org.json.JSONException, IOException
Receives the (known) operations of the ODF text document- Returns:
- the operations as JSON
- Throws:
SAXException
org.json.JSONException
IOException
-
applyChanges
public int applyChanges(String operationString) throws Exception
Applies the (known) operations to upon the latest state of the ODF text document- Parameters:
operationString
- ODF operations as String JSONObject with "changes" as key for operations- Returns:
- the number of operations being accepted
- Throws:
Exception
-
applyChanges
public int applyChanges(org.json.JSONObject operations) throws Exception
Applies the (known) operations to upon the latest state of the ODF text document- Parameters:
operations
- ODF operations as JSONArray within an JSONObject with OPK_OPERATIONS key fromOperationConstants
.- Returns:
- the number of operations being accepted
- Throws:
Exception
-
getContentSize
public long getContentSize()
-
getDocument
public OdfTextDocument getDocument()
Returns the OdfTextDocument encapsulating the DOM view- Returns:
- ODF document - currently only Te
-
getPackage
public OdfPackage getPackage()
Returns the OdfPackage- Returns:
- ODF Package
-
close
public void close()
Close the OdfPackage and release all temporary created data. After execution of this method, this class is no longer usable. Do this as the last action to free resources. Closing an already closed document has no effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
countAppliedChanges
public int countAppliedChanges()
- Returns:
- number of correct applied operations
-
getMaxTableColumnsCount
public int getMaxTableColumnsCount()
-
getMaxTableRowsCount
public int getMaxTableRowsCount()
-
getMaxTableCellCount
public int getMaxTableCellCount()
-
getMaxSheetCount
public int getMaxSheetCount()
-
-