Package org.odftoolkit.odfdom.changes
Class JsonOperationProducer
java.lang.Object
org.odftoolkit.odfdom.changes.JsonOperationProducer
ToDo: Is it more flexible to build a different queue for OperationQueue and create an JSON
exporter? Can a JSONArray / JSONObject be initialized with an existing queue?
- Author:
- svante.schubertATgmail.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(String componentType, List<Integer> start, Map<String, Object> formattingProperties, String context) void
void
addDocumentData
(org.json.JSONObject componentProps) void
addDocumentProperties
(OdfStylesDom stylesDom, Integer defaultTabStopWidth, org.json.JSONObject defaultPageStyles) void
addExceededTable
(List<Integer> start, int columns, int rows, List<Integer> tableGrid, String context) void
addField
(List<Integer> start, String fieldType, String fieldContent, Map<String, Object> fieldAttributes, String context) void
addFontData
(String fontName, String[] altNames, String family, String familyGeneric, String pitch, String panose1) void
addHeaderFooter
(String contextName, PageArea pageArea, org.json.JSONObject attrs) Adding a default footer style operationvoid
void
addListStyle
(TextListStyleElement listStyle) After checking if the given list style was not declared before as operation call.void
addListStyle
(OdfSchemaDocument doc, Map<String, TextListStyleElement> autoListStyles, String styleId) Creates the operation to insert a list style.org.json.JSONObject
addPageProperties
(OdfStylesDom stylesDom) trigger pageStyle operations, only the "standard" page style will be returnedvoid
void
void
addStyleSheet
(String styleId, String familyID, String displayName, Map<String, Object> componentProps, String parentStyle, String nextStyleId, Integer outlineLevel, boolean isDefaultStyle, boolean isHidden, String custom) * addStylesheet name: 'addStylesheet' type: "table" styleId: The identifier of this stylesheet (unique for the corresponding type).void
addTable
(List<Integer> start, Map<String, Object> hardFormatations, List<Integer> tableGrid, String tableName, String context) void
static void
calculateCrops
(OdfElement image, String href, org.json.JSONObject imageProps) LO/AO does not interpret clipping as in FO/CSS http://www.w3.org/TR/CSS2/visufx.html#propdef-clip Instead the clip values measure the distance from each border to the start of the viewed area.void
void
formatColumns
(List<Integer> start, Map<String, Object> formattingProperties, Integer firstColumn, Integer lastColumn, String context) void
formatRows
(List<Integer> start, Map<String, Object> formattingProperties, Integer firstRow, Integer lastRow, Integer previousRowRepeated, String context) int
Used for repeated elements, repeats a set of operationsorg.json.JSONObject
getHardStyles
(OdfStylableElement styleElement) Maps the styles of the given stylable ODF element to operations.static String
getListStyle
(ArrayDeque<ParagraphListProperties> listStyleStack, TextParagraphElementBase p) ODF List Style inheritance will be resolved: The paragraph/heading's list style reference from its closest text:list or text:list-item ancestor is taken.void
mergeCells
(List<Integer> position, int columns, int rows) triggerDefaultStyleOp
(OdfStyleFamily styleFamily, OdfStyleBase style) Tests first if the default style was already added to the document, than triggers a addStylesheet operationtriggerStyleHierarchyOps
(OdfOfficeStyles officeStyles, OdfStyleFamily styleFamily, OdfStyleBase style)
-
Constructor Details
-
JsonOperationProducer
public JsonOperationProducer()
-
-
Method Details
-
getDocumentOperations
public org.json.JSONObject getDocumentOperations() -
getCurrentOperationIndex
public int getCurrentOperationIndex()Used for repeated elements, repeats a set of operations -
add
-
addAnnotation
-
addRange
-
formatColumns
public void formatColumns(List<Integer> start, Map<String, Object> formattingProperties, Integer firstColumn, Integer lastColumn, String context) - Parameters:
start
- : An array, that contains the number of that paragraph, before which the new paragraph shall be inserted. Has the last paragraph the number 2, so causes para=3, that the new paragraph will be inserted at the end. para=4 is not allowed in this case.
-
formatRows
public void formatRows(List<Integer> start, Map<String, Object> formattingProperties, Integer firstRow, Integer lastRow, Integer previousRowRepeated, String context) - Parameters:
start
- : An array, that contains the number of that paragraph, before which the new paragraph shall be inserted. Has the last paragraph the number 2, so causes para=3, that the new paragraph will be inserted at the end. para=4 is not allowed in this case.
-
mergeCells
-
addText
- Parameters:
text
- : text to be inserted into the specified paragraph at the specified positionstart
- : an array that contains the position, where the new text shall be inserted.
-
format
-
addImage
-
addShape
-
addTable
-
addExceededTable
-
addField
-
addStyleSheet
public void addStyleSheet(String styleId, String familyID, String displayName, Map<String, Object> componentProps, String parentStyle, String nextStyleId, Integer outlineLevel, boolean isDefaultStyle, boolean isHidden, String custom) * addStylesheet name: 'addStylesheet' type: "table" styleId: The identifier of this stylesheet (unique for the corresponding type). stylename: The readable name of this style sheet. attrs: JSONObject, contains formatting attributes as nested JSON objects, keyed by attribute family, as well as other properties specific to a family. Must support the attributes of the main attribute family, may support attributes of other families. See chapter "Style Sheet Properties" below for a list of supported values. parent: (string, optional) The identifier of the parent style sheet that derives formatting attributes to this style sheet (default: no parent). hidden: (boolean, optional) Whether the style sheet is hidden in the user interface (default: false). uipriority: (integer, optional) The priority of the style sheet used to order style sheet in the user interface. The lower the value the higher the priority (default: 0). default: (boolean, optional) Whether this style sheet is the default style sheet of the family. Only one style sheet per family can be the default style sheet (default: false). pooldefault: (boolean, optional) Whether this style sheet is the pool default style sheet. (default: false). OOXML may have on the table default style properties for table Object { type: table properties } '' row Object { type: row properties } '' cell Object { type: cell properties } '' paragraph Object { type: paragraph properties } '' character Object { type: character properties } We need to split this table style into an additional row and cell style and addChild it as parent for those. -
addFontData
-
addDocumentData
public void addDocumentData(org.json.JSONObject componentProps) - Parameters:
componentProps
- is a JSONObject that has the family ID as key (e.g 'page') and the properties as JSON object as value
-
getListStyle
public static String getListStyle(ArrayDeque<ParagraphListProperties> listStyleStack, TextParagraphElementBase p) ODF List Style inheritance will be resolved:- The paragraph/heading's list style reference from its closest text:list or text:list-item ancestor is taken. text:list uses the attribute
-
getHardStyles
Maps the styles of the given stylable ODF element to operations. In case the ODF element uses automatic styles, all styles will be returned as property map. In case the ODF element uses template styles, an operation for each style is being triggered, which not have been triggered by now.- Returns:
- the mapped automatic style grouped by property set
-
addListStyle
public void addListStyle(OdfSchemaDocument doc, Map<String, TextListStyleElement> autoListStyles, String styleId) Creates the operation to insert a list style. All template list styles should be already set during initialization. -
addListStyle
After checking if the given list style was not declared before as operation call. A new list style will be mapped to an operation.The <text:list-style> element has the following attributes: style:display-name, style:name and text:consecutive-numbering.
-
triggerStyleHierarchyOps
public Integer triggerStyleHierarchyOps(OdfOfficeStyles officeStyles, OdfStyleFamily styleFamily, OdfStyleBase style) -
triggerDefaultStyleOp
Tests first if the default style was already added to the document, than triggers a addStylesheet operation -
addPageProperties
trigger pageStyle operations, only the "standard" page style will be returned -
addDocumentProperties
public void addDocumentProperties(OdfStylesDom stylesDom, Integer defaultTabStopWidth, org.json.JSONObject defaultPageStyles) -
calculateCrops
LO/AO does not interpret clipping as in FO/CSS http://www.w3.org/TR/CSS2/visufx.html#propdef-clip Instead the clip values measure the distance from each border to the start of the viewed area. The clip vales are taking measure from the original size, which is not part of the OFD XML, therefore the image have to be loaded for receiving the size.
-