Initial import
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@5 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
75e32b1e8f
commit
b0b66fcae9
252 changed files with 49000 additions and 0 deletions
146
source/java/writer2latex/office/BibMark.java
Normal file
146
source/java/writer2latex/office/BibMark.java
Normal file
|
@ -0,0 +1,146 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* BibMark.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-22)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import writer2latex.util.*;
|
||||
//import writer2latex.office.*;
|
||||
|
||||
/**
|
||||
* <p>This class represents a single bibliography-mark.</p>
|
||||
*/
|
||||
public final class BibMark {
|
||||
// Available fields
|
||||
public static final int ADDRESS = 0;
|
||||
public static final int ANNOTE = 1;
|
||||
public static final int AUTHOR = 2;
|
||||
public static final int BOOKTITLE = 3;
|
||||
public static final int CHAPTER = 4;
|
||||
// public static final int CROSSREF = 5; // BibTeX, missing in OOo
|
||||
public static final int EDITION = 6;
|
||||
public static final int EDITOR = 7;
|
||||
public static final int HOWPUBLISHED = 8;
|
||||
public static final int INSTITUTION = 9;
|
||||
public static final int JOURNAL = 10;
|
||||
// public static final int KEY = 11; // BibTeX, missing in OOo
|
||||
public static final int MONTH = 12;
|
||||
public static final int NOTE = 13;
|
||||
public static final int NUMBER = 14;
|
||||
public static final int ORGANIZATIONS = 15; // BibTeX: organization
|
||||
public static final int PAGES = 16;
|
||||
public static final int PUBLISHER = 17;
|
||||
public static final int SCHOOL = 18;
|
||||
public static final int SERIES = 19;
|
||||
public static final int TITLE = 20 ;
|
||||
public static final int REPORT_TYPE = 21; // BibTeX: report
|
||||
public static final int VOLUME = 22;
|
||||
public static final int YEAR = 23;
|
||||
// remaining fields are not standard in BibTeX
|
||||
public static final int URL = 24;
|
||||
public static final int CUSTOM1 = 25;
|
||||
public static final int CUSTOM2 = 26;
|
||||
public static final int CUSTOM3 = 27;
|
||||
public static final int CUSTOM4 = 28;
|
||||
public static final int CUSTOM5 = 29;
|
||||
public static final int ISBN = 30;
|
||||
public static final int FIELD_COUNT = 31;
|
||||
|
||||
|
||||
// Private data
|
||||
private String sIdentifier;
|
||||
private String sEntryType;
|
||||
private String[] fields = new String[FIELD_COUNT];
|
||||
|
||||
/**
|
||||
* <p>Create a new BibMark from scratch.</p>
|
||||
*/
|
||||
public BibMark(String sIdentifier, String sEntryType) {
|
||||
this.sIdentifier = sIdentifier;
|
||||
this.sEntryType = sEntryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Create a new BibMark from a text:bibliography-mark node.</p>
|
||||
*/
|
||||
public BibMark(Node node) {
|
||||
sIdentifier = Misc.getAttribute(node,XMLString.TEXT_IDENTIFIER);
|
||||
sEntryType = Misc.getAttribute(node,XMLString.TEXT_BIBLIOGRAPHY_TYPE);
|
||||
if (sEntryType==null) { // bug in OOo 1.0!
|
||||
sEntryType = Misc.getAttribute(node,XMLString.TEXT_BIBILIOGRAPHIC_TYPE);
|
||||
}
|
||||
fields[ADDRESS] = Misc.getAttribute(node,XMLString.TEXT_ADDRESS);
|
||||
fields[ANNOTE] = Misc.getAttribute(node,XMLString.TEXT_ANNOTE);
|
||||
fields[AUTHOR] = Misc.getAttribute(node,XMLString.TEXT_AUTHOR);
|
||||
fields[BOOKTITLE] = Misc.getAttribute(node,XMLString.TEXT_BOOKTITLE);
|
||||
fields[CHAPTER] = Misc.getAttribute(node,XMLString.TEXT_CHAPTER);
|
||||
fields[EDITION] = Misc.getAttribute(node,XMLString.TEXT_EDITION);
|
||||
fields[EDITOR] = Misc.getAttribute(node,XMLString.TEXT_EDITOR);
|
||||
fields[HOWPUBLISHED] = Misc.getAttribute(node,XMLString.TEXT_HOWPUBLISHED);
|
||||
fields[INSTITUTION] = Misc.getAttribute(node,XMLString.TEXT_INSTITUTION);
|
||||
fields[JOURNAL] = Misc.getAttribute(node,XMLString.TEXT_JOURNAL);
|
||||
fields[MONTH] = Misc.getAttribute(node,XMLString.TEXT_MONTH);
|
||||
fields[NOTE] = Misc.getAttribute(node,XMLString.TEXT_NOTE);
|
||||
fields[NUMBER] = Misc.getAttribute(node,XMLString.TEXT_NUMBER);
|
||||
fields[ORGANIZATIONS] = Misc.getAttribute(node,XMLString.TEXT_ORGANIZATIONS);
|
||||
fields[PAGES] = Misc.getAttribute(node,XMLString.TEXT_PAGES);
|
||||
fields[PUBLISHER] = Misc.getAttribute(node,XMLString.TEXT_PUBLISHER);
|
||||
fields[SCHOOL] = Misc.getAttribute(node,XMLString.TEXT_SCHOOL);
|
||||
fields[SERIES] = Misc.getAttribute(node,XMLString.TEXT_SERIES);
|
||||
fields[TITLE] = Misc.getAttribute(node,XMLString.TEXT_TITLE);
|
||||
fields[REPORT_TYPE] = Misc.getAttribute(node,XMLString.TEXT_REPORT_TYPE);
|
||||
fields[VOLUME] = Misc.getAttribute(node,XMLString.TEXT_VOLUME);
|
||||
fields[YEAR] = Misc.getAttribute(node,XMLString.TEXT_YEAR);
|
||||
fields[URL] = Misc.getAttribute(node,XMLString.TEXT_URL);
|
||||
fields[CUSTOM1] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM1);
|
||||
fields[CUSTOM2] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM2);
|
||||
fields[CUSTOM3] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM3);
|
||||
fields[CUSTOM4] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM4);
|
||||
fields[CUSTOM5] = Misc.getAttribute(node,XMLString.TEXT_CUSTOM5);
|
||||
fields[ISBN] = Misc.getAttribute(node,XMLString.TEXT_ISBN);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the identifier.</p>
|
||||
*/
|
||||
public String getIdentifier() { return sIdentifier; }
|
||||
|
||||
/**
|
||||
* <p>Get the entry type.</p>
|
||||
*/
|
||||
public String getEntryType() { return sEntryType; }
|
||||
|
||||
/**
|
||||
* <p>Set a specific field.</p>
|
||||
*/
|
||||
public void setField(int nField,String sValue) { fields[nField] = sValue; }
|
||||
|
||||
/**
|
||||
* <p>Return a specific field.</p>
|
||||
*/
|
||||
public String getField(int nField) { return fields[nField]; }
|
||||
}
|
40
source/java/writer2latex/office/CellView.java
Normal file
40
source/java/writer2latex/office/CellView.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* CellView.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-09-07)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* This class represent a cell in a table view</p>
|
||||
*/
|
||||
public class CellView {
|
||||
public Element cell = null;
|
||||
public int nRowSpan = 1;
|
||||
public int nColSpan = 1;
|
||||
public int nOriginalRow = -1;
|
||||
public int nOriginalCol = -1;
|
||||
}
|
151
source/java/writer2latex/office/ControlReader.java
Normal file
151
source/java/writer2latex/office/ControlReader.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ControlReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-23)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
//import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> This class reads a form control in an OOo document (a form:control
|
||||
* node). A control always has an owner form.
|
||||
* Properties and events are ignored.</p>
|
||||
*/
|
||||
public class ControlReader {
|
||||
|
||||
private FormReader ownerForm; // a control always belongs to a form
|
||||
private String sId; // a control is identified by id
|
||||
private Element control; // the control element
|
||||
private Element controlType; // the type specific child element
|
||||
private Vector items = new Vector(); // the options/items of a list/combobox
|
||||
|
||||
/** <p>The constructor reads the content of a control element</p>
|
||||
* The representation in OpenDocument differs slightly from OOo 1.x.
|
||||
|
||||
* @param control a DOM element, which must be control node
|
||||
*/
|
||||
public ControlReader(Element control, FormReader ownerForm) {
|
||||
this.ownerForm = ownerForm;
|
||||
this.control = control;
|
||||
sId = control.getAttribute(XMLString.FORM_ID);
|
||||
// Read the control type specific info
|
||||
if (control.getTagName().equals(XMLString.FORM_CONTROL)) { // old format
|
||||
controlType = Misc.getFirstChildElement(control);
|
||||
}
|
||||
else { // oasos
|
||||
controlType = control;
|
||||
}
|
||||
if (controlType!=null) { // must always be the case!
|
||||
// Collect options/items
|
||||
Node child = controlType.getFirstChild();
|
||||
while (child!=null) {
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE && (
|
||||
child.getNodeName().equals(XMLString.FORM_OPTION) ||
|
||||
child.getNodeName().equals(XMLString.FORM_ITEM))) {
|
||||
items.add(child);
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>A control in OOo is identified by id (<code>form:control-id</code>
|
||||
* attribute. The id is accessed by this method.</p>
|
||||
* @return the id of the control
|
||||
*/
|
||||
public String getId() { return sId; }
|
||||
|
||||
/** <p>A control in OOo belongs to a form.</p>
|
||||
* @return the form containing this control
|
||||
*/
|
||||
public FormReader getOwnerForm() { return ownerForm; }
|
||||
|
||||
/** <p>Get an attribute of the control. If the attribute does not exist,
|
||||
* this method returns <code>null</code>.
|
||||
* @param sName the name of the attribute
|
||||
* @return the value of the attribute, or <code>null</code>
|
||||
*/
|
||||
public String getAttribute(String sName) {
|
||||
return control.hasAttribute(sName) ? control.getAttribute(sName) : null;
|
||||
}
|
||||
|
||||
/** <p>The type of the control is identified by a name, eg. form:submit</p>
|
||||
* @return the type of this control
|
||||
*/
|
||||
public String getControlType() { return controlType.getTagName(); }
|
||||
|
||||
/** <p>Get an attribute specific to this type of control.
|
||||
* If the attribute does not exist, this method returns <code>null</code>.
|
||||
* @param sName the name of the attribute
|
||||
* @return the value of the attribute, or <code>null</code>
|
||||
*/
|
||||
public String getTypeAttribute(String sName) {
|
||||
return controlType!=null && controlType.hasAttribute(sName) ?
|
||||
controlType.getAttribute(sName) : null;
|
||||
}
|
||||
|
||||
/** <p>Return the number of options/items in this control.
|
||||
* Only listbox (options) and combobox (items) controls can have these,
|
||||
* for other controls this will return 0.
|
||||
* @return the number of options/items
|
||||
*/
|
||||
public int getItemCount() { return items.size(); }
|
||||
|
||||
/** <p>Get an attribute of an option/item.
|
||||
* If the index and/or the attribute does not exist, this method returns
|
||||
* <code>null</code>.
|
||||
* @param nIndex the index of the option/item
|
||||
* @param sName the name of the attribute
|
||||
* @return the value of the attribute, or <code>null</code>
|
||||
*/
|
||||
public String getItemAttribute(int nIndex, String sName) {
|
||||
if (0<=nIndex && nIndex<=items.size()) {
|
||||
return ((Element)items.get(nIndex)).hasAttribute(sName) ?
|
||||
((Element)items.get(nIndex)).getAttribute(sName) : null;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>Get the value of an option/item.
|
||||
* If the index does not exist, this method returns
|
||||
* <code>null</code>.
|
||||
* @param nIndex the index of the option/item
|
||||
* @return the value of the option/item, or <code>null</code>
|
||||
*/
|
||||
public String getItemValue(int nIndex) {
|
||||
if (0<=nIndex && nIndex<=items.size()) {
|
||||
return Misc.getPCDATA((Element)items.get(nIndex));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
61
source/java/writer2latex/office/FontDeclaration.java
Normal file
61
source/java/writer2latex/office/FontDeclaration.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* FontDeclaration.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2005 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.5 (2005-10-10)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/** <p> Class representing a font declaration in OOo</p>
|
||||
*/
|
||||
public class FontDeclaration extends OfficeStyle {
|
||||
private PropertySet properties = new PropertySet();
|
||||
|
||||
private String sFontFamily = null;
|
||||
private String sFontFamilyGeneric = null;
|
||||
private String sFontPitch = null;
|
||||
|
||||
public void loadStyleFromDOM(Node node) {
|
||||
super.loadStyleFromDOM(node);
|
||||
properties.loadFromDOM(node);
|
||||
sFontFamily = properties.getProperty(XMLString.FO_FONT_FAMILY);
|
||||
if (sFontFamily==null) { // oasis
|
||||
sFontFamily = properties.getProperty(XMLString.SVG_FONT_FAMILY);
|
||||
}
|
||||
sFontFamilyGeneric = properties.getProperty(XMLString.STYLE_FONT_FAMILY_GENERIC);
|
||||
sFontPitch = properties.getProperty(XMLString.STYLE_FONT_PITCH);
|
||||
}
|
||||
|
||||
public String getProperty(String sProperty){
|
||||
return properties.getProperty(sProperty);
|
||||
}
|
||||
|
||||
public String getFontFamily() { return sFontFamily; }
|
||||
|
||||
public String getFontFamilyGeneric() { return sFontFamilyGeneric; }
|
||||
|
||||
public String getFontPitch() { return sFontPitch; }
|
||||
|
||||
}
|
79
source/java/writer2latex/office/FormReader.java
Normal file
79
source/java/writer2latex/office/FormReader.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* FormReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
// Version 1.0 (2008-11-22)
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
//import java.util.Hashtable;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> This class reads a form in an OOo document (a form:form node)</p>
|
||||
* Note: Subforms, properties and events are ignored.
|
||||
*/
|
||||
public class FormReader {
|
||||
|
||||
//private FormsReader forms; // the global collection of all forms
|
||||
private String sName; // a form is identified by name
|
||||
private Element form; // the form element
|
||||
|
||||
/** <p>The constructor reads the content of a <code>form:form</code> element</p>
|
||||
* @param form a DOM element, which must be <code>form:form</code> node
|
||||
*/
|
||||
public FormReader(Element form, FormsReader forms) {
|
||||
//this.forms = forms;
|
||||
this.form = form;
|
||||
sName = form.getAttribute(XMLString.FORM_NAME);
|
||||
// Collect all controls contained in this form
|
||||
Node child = form.getFirstChild();
|
||||
while (child!=null) {
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE) {
|
||||
String sId = Misc.getAttribute((Element)child,XMLString.FORM_ID);
|
||||
if (sId!=null) {
|
||||
ControlReader control = new ControlReader((Element) child, this);
|
||||
forms.addControl(control);
|
||||
}
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>A form in OOo is identified by name (<code>form:name</code>
|
||||
* attribute. The name is accessed by this method.</p>
|
||||
* @return the name of the form
|
||||
*/
|
||||
public String getName() { return sName; }
|
||||
|
||||
/** <p>Get an attribute of the form. If the attribute does not exist,
|
||||
* this method returns <code>null</code>.
|
||||
* @param sName the name of the attribute
|
||||
* @return the value of the attribute, or <code>null</code>
|
||||
*/
|
||||
public String getAttribute(String sName) {
|
||||
return form.hasAttribute(sName) ? form.getAttribute(sName) : null;
|
||||
}
|
||||
|
||||
}
|
114
source/java/writer2latex/office/FormsReader.java
Normal file
114
source/java/writer2latex/office/FormsReader.java
Normal file
|
@ -0,0 +1,114 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* FormsReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-23)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/** <p> This class reads the collection of all forms in an OOo document
|
||||
* (the <code>office:forms</code> element).</p>
|
||||
* <p>An OOo document may contain any number of forms; these are declared
|
||||
* within this element. In OOo, unlike eg. html, the form declaration is
|
||||
* separated from the presentation. This element contains the
|
||||
* <em>declaration</em>. The <em>presentation</em> is given by inclusion of
|
||||
* <code>draw:control</code> elements in the document flow. These refer to form
|
||||
* controls by id.</p>
|
||||
* <p>Note: A form is identified by a unique name, a control is
|
||||
* identified by a (globally) unique id.</p>
|
||||
*/
|
||||
public class FormsReader {
|
||||
|
||||
private Element formsElement; // The office:forms element
|
||||
private Hashtable forms = new Hashtable(); // all forms, indexed by name
|
||||
private Hashtable controls = new Hashtable(); // all controls, indexed by id
|
||||
|
||||
/** <p>Read the content of an <code>office:forms</code> element</p>
|
||||
* @param formsElement a DOM element, which must be <code>office:forms</code> node
|
||||
*/
|
||||
public void read(Element formsElement) {
|
||||
this.formsElement = formsElement;
|
||||
// Collect all forms
|
||||
Node child = formsElement.getFirstChild();
|
||||
while (child!=null) {
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE &&
|
||||
child.getNodeName().equals(XMLString.FORM_FORM)) {
|
||||
FormReader form = new FormReader((Element) child, this);
|
||||
forms.put(form.getName(),form);
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>Get an attribute of the forms. If the attribute does not exist,
|
||||
* this method returns <code>null</code>.
|
||||
* @param sName the name of the attribute
|
||||
* @return the value of the attribute, or <code>null</code>
|
||||
*/
|
||||
public String getAttribute(String sName) {
|
||||
return formsElement.hasAttribute(sName) ? formsElement.getAttribute(sName) : null;
|
||||
}
|
||||
|
||||
/** <p>Get a <code>Iterator</code> over all forms.</p>
|
||||
* @return a <code>Iterator</code> over all forms
|
||||
*/
|
||||
public Iterator getFormsIterator() {
|
||||
return forms.values().iterator();
|
||||
}
|
||||
|
||||
/** <p>Get a form by name</p>
|
||||
* @param sName the <code>form:name</code> of the form
|
||||
* @return the form as a <code>FormReader</code> object
|
||||
*/
|
||||
public FormReader getForm(String sName) {
|
||||
return (FormReader) forms.get(sName);
|
||||
}
|
||||
|
||||
/** <p>Get a <code>Iterator</code> over all controls.</p>
|
||||
* @return a <code>Iterator</code> over all controls
|
||||
*/
|
||||
public Iterator getControlsIterator() {
|
||||
return controls.values().iterator();
|
||||
}
|
||||
|
||||
/** <p>Get a control by id</p>
|
||||
* @param sId the <code>form:control-id</code> of the control
|
||||
* @return the control as a <code>ControlReader</code> object
|
||||
*/
|
||||
public ControlReader getControl(String sId) {
|
||||
return (ControlReader) controls.get(sId);
|
||||
}
|
||||
|
||||
/** <p>Add a control</p>
|
||||
* @param control a <code>ControlReader</code> representing the control
|
||||
*/
|
||||
protected void addControl(ControlReader control) {
|
||||
controls.put(control.getId(),control);
|
||||
}
|
||||
|
||||
}
|
194
source/java/writer2latex/office/ImageLoader.java
Normal file
194
source/java/writer2latex/office/ImageLoader.java
Normal file
|
@ -0,0 +1,194 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ImageLoader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-22)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.io.ByteArrayOutputStream;
|
||||
//import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import writer2latex.api.GraphicConverter;
|
||||
import writer2latex.util.Base64;
|
||||
import writer2latex.util.Misc;
|
||||
import writer2latex.xmerge.BinaryGraphicsDocument;
|
||||
import writer2latex.xmerge.EmbeddedObject;
|
||||
import writer2latex.xmerge.EmbeddedBinaryObject;
|
||||
import writer2latex.xmerge.OfficeDocument;
|
||||
|
||||
//import writer2latex.util.*;
|
||||
|
||||
/**
|
||||
* <p>This class extracts images from an OOo file.
|
||||
* The images are returned as BinaryGraphicsDocument.</p>
|
||||
*/
|
||||
public final class ImageLoader {
|
||||
// The Office document to load images from
|
||||
private OfficeDocument oooDoc;
|
||||
|
||||
// Data for file name generation
|
||||
private String sOutFileName;
|
||||
private boolean bUseSubdir = false;
|
||||
private int nImageCount = 0;
|
||||
|
||||
// should EPS be extracted from SVM?
|
||||
private boolean bExtractEPS;
|
||||
|
||||
// Data for image conversion
|
||||
private GraphicConverter gcv = null;
|
||||
private boolean bAcceptOtherFormats = true;
|
||||
private String sDefaultFormat = null;
|
||||
private String sDefaultVectorFormat = null;
|
||||
private HashSet acceptedFormats = new HashSet();
|
||||
|
||||
public ImageLoader(OfficeDocument oooDoc, String sOutFileName, boolean bExtractEPS) {
|
||||
this.oooDoc = oooDoc;
|
||||
this.sOutFileName = sOutFileName;
|
||||
this.bExtractEPS = bExtractEPS;
|
||||
}
|
||||
|
||||
public void setOutFileName(String sOutFileName) { this.sOutFileName = sOutFileName; }
|
||||
|
||||
public void setUseSubdir(boolean bUseSubdir) { this.bUseSubdir = bUseSubdir; }
|
||||
|
||||
public void setAcceptOtherFormats(boolean b) { bAcceptOtherFormats = b; }
|
||||
|
||||
public void setDefaultFormat(String sMime) {
|
||||
addAcceptedFormat(sMime);
|
||||
sDefaultFormat = sMime;
|
||||
}
|
||||
|
||||
public void setDefaultVectorFormat(String sMime) {
|
||||
addAcceptedFormat(sMime);
|
||||
sDefaultVectorFormat = sMime;
|
||||
}
|
||||
|
||||
public void addAcceptedFormat(String sMime) { acceptedFormats.add(sMime); }
|
||||
|
||||
private boolean isAcceptedFormat(String sMime) { return acceptedFormats.contains(sMime); }
|
||||
|
||||
public void setGraphicConverter(GraphicConverter gcv) { this.gcv = gcv; }
|
||||
|
||||
public BinaryGraphicsDocument getImage(Node node) {
|
||||
// node must be a draw:image element.
|
||||
// variables to hold data about the image:
|
||||
String sMIME = null;
|
||||
String sExt = null;
|
||||
byte[] blob = null;
|
||||
|
||||
String sHref = Misc.getAttribute(node,XMLString.XLINK_HREF);
|
||||
if (sHref==null || sHref.length()==0) {
|
||||
// Image must be contained in an office:binary-element as base64:
|
||||
Node obd = Misc.getChildByTagName(node,XMLString.OFFICE_BINARY_DATA);
|
||||
if (obd!=null) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
NodeList nl = obd.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i=0; i<nLen; i++) {
|
||||
if (nl.item(i).getNodeType()==Node.TEXT_NODE) {
|
||||
buf.append(nl.item(i).getNodeValue());
|
||||
}
|
||||
}
|
||||
blob = Base64.decode(buf.toString());
|
||||
sMIME = MIMETypes.getMagicMIMEType(blob);
|
||||
sExt = MIMETypes.getFileExtension(sMIME);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Image may be embedded in package:
|
||||
if (sHref.startsWith("#")) { sHref = sHref.substring(1); }
|
||||
if (sHref.startsWith("./")) { sHref = sHref.substring(2); }
|
||||
EmbeddedObject obj = oooDoc.getEmbeddedObject(sHref);
|
||||
if (obj!=null && obj instanceof EmbeddedBinaryObject) {
|
||||
EmbeddedBinaryObject object = (EmbeddedBinaryObject) obj;
|
||||
blob = object.getBinaryData();
|
||||
sMIME = object.getType();
|
||||
sExt = MIMETypes.getFileExtension(sMIME);
|
||||
}
|
||||
else {
|
||||
// This is a linked image
|
||||
// TODO: Perhaps we should download the image from the url in sHref?
|
||||
// Alternatively BinaryGraphicsDocument should be extended to
|
||||
// handle external graphics.
|
||||
}
|
||||
}
|
||||
|
||||
if (blob==null) { return null; }
|
||||
|
||||
// Assign a name (without extension)
|
||||
String sName = sOutFileName+"-img"+(++nImageCount);
|
||||
if (bUseSubdir) { sName = sOutFileName + "-img/" + sName; }
|
||||
|
||||
BinaryGraphicsDocument bgd = null;
|
||||
|
||||
if (bExtractEPS && MIMETypes.SVM.equals(MIMETypes.getMagicMIMEType(blob))) {
|
||||
// Look for postscript:
|
||||
int[] offlen = new int[2];
|
||||
if (SVMReader.readSVM(blob,offlen)) {
|
||||
bgd = new BinaryGraphicsDocument(sName,
|
||||
MIMETypes.EPS_EXT,MIMETypes.EPS);
|
||||
bgd.read(blob,offlen[0],offlen[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (bgd==null) {
|
||||
// If we have a converter AND a default format AND this image
|
||||
// is not in an accepted format AND the converter knows how to
|
||||
// convert it - try to convert...
|
||||
if (gcv!=null && !isAcceptedFormat(sMIME) && sDefaultFormat!=null) {
|
||||
String sTargetMIME = null;
|
||||
|
||||
if (MIMETypes.isVectorFormat(sMIME) && sDefaultVectorFormat!=null &&
|
||||
gcv.supportsConversion(sMIME,sDefaultVectorFormat,false,false)) {
|
||||
sTargetMIME = sDefaultVectorFormat;
|
||||
}
|
||||
else if (gcv.supportsConversion(sMIME,sDefaultFormat,false,false)) {
|
||||
sTargetMIME = sDefaultFormat;
|
||||
}
|
||||
|
||||
if (sTargetMIME!=null) {
|
||||
byte[] newBlob = gcv.convert(blob,sMIME,sTargetMIME);
|
||||
if (newBlob!=null) {
|
||||
// Conversion succesful - create new data
|
||||
blob = newBlob;
|
||||
sMIME = sTargetMIME;
|
||||
sExt = MIMETypes.getFileExtension(sMIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isAcceptedFormat(sMIME) || bAcceptOtherFormats) {
|
||||
bgd = new BinaryGraphicsDocument(sName,sExt,sMIME);
|
||||
bgd.read(blob);
|
||||
}
|
||||
}
|
||||
|
||||
return bgd;
|
||||
}
|
||||
}
|
97
source/java/writer2latex/office/IndexMark.java
Normal file
97
source/java/writer2latex/office/IndexMark.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* IndexMark.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-22)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import writer2latex.util.*;
|
||||
|
||||
/**
|
||||
* <p>This class contains static methods to read an index-mark.</p>
|
||||
*/
|
||||
public final class IndexMark {
|
||||
|
||||
// Node must be text:*-mark or text:*-mark-start
|
||||
public final static String getIndexValue(Node node) {
|
||||
if (!node.getNodeName().endsWith("start")) {
|
||||
return Misc.getAttribute(node,XMLString.TEXT_STRING_VALUE);
|
||||
}
|
||||
else {
|
||||
return collectMark(node);
|
||||
}
|
||||
}
|
||||
|
||||
// Node must be text:*-mark or text:*-mark-start
|
||||
public final static String getKey1(Node node) {
|
||||
return Misc.getAttribute(node,XMLString.TEXT_KEY1);
|
||||
}
|
||||
|
||||
// Node must be text:*-mark or text:*-mark-start
|
||||
public final static String getKey2(Node node) {
|
||||
return Misc.getAttribute(node,XMLString.TEXT_KEY2);
|
||||
}
|
||||
|
||||
// Collect a mark
|
||||
private final static Node getRightNode(Node node) {
|
||||
Node nextNode;
|
||||
do {nextNode = node.getNextSibling();
|
||||
if (nextNode!=null) { return nextNode; }
|
||||
node = node.getParentNode();
|
||||
} while (node!=null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private final static String collectMark(Node node) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
String sId = Misc.getAttribute(node,XMLString.TEXT_ID);
|
||||
node = getRightNode(node);
|
||||
while (node!=null) {
|
||||
if (node.getNodeType()==Node.TEXT_NODE) {
|
||||
buf.append(node.getNodeValue());
|
||||
node = getRightNode(node);
|
||||
}
|
||||
else if (node.getNodeType()==Node.ELEMENT_NODE) {
|
||||
boolean bReady = false;
|
||||
//String sNodeName = node.getNodeName();
|
||||
if (sId.equals(Misc.getAttribute(node,XMLString.TEXT_ID))) {
|
||||
node = null; // found the end mark
|
||||
bReady = true;
|
||||
}
|
||||
else if (OfficeReader.isTextElement(node) &&
|
||||
!OfficeReader.isNoteElement(node)) {
|
||||
if (node.hasChildNodes()) {
|
||||
node = node.getFirstChild(); bReady=true;
|
||||
}
|
||||
}
|
||||
if (!bReady) { node=getRightNode(node); };
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
126
source/java/writer2latex/office/ListCounter.java
Normal file
126
source/java/writer2latex/office/ListCounter.java
Normal file
|
@ -0,0 +1,126 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ListCounter.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2005 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2007-10-17)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import writer2latex.util.*;
|
||||
|
||||
/**
|
||||
* <p>This class produces labels for OOo lists/outlines (for xhtml
|
||||
* and text, which cannot produce them on their own).</p>
|
||||
*
|
||||
*/
|
||||
public class ListCounter {
|
||||
private int nCounter[] = new int[11];
|
||||
private String sNumFormat[] = new String[11];
|
||||
private ListStyle style;
|
||||
private int nLevel=1; // current level
|
||||
|
||||
public ListCounter() {
|
||||
// Create a dummy counter
|
||||
this.style = null;
|
||||
for (int i=1; i<=10; i++) {
|
||||
sNumFormat[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public ListCounter(ListStyle style) {
|
||||
this();
|
||||
if (style!=null) {
|
||||
this.style = style;
|
||||
for (int i=1; i<=10; i++) {
|
||||
sNumFormat[i] = style.getLevelProperty(i,XMLString.STYLE_NUM_FORMAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ListCounter step(int nLevel) {
|
||||
// Make sure no higher levels are zero
|
||||
// This means that unlike eg. LaTeX, step(1).step(3) does not create
|
||||
// the value 1.0.1 but rather 1.1.1
|
||||
for (int i=1; i<nLevel; i++) {
|
||||
if (nCounter[i]==0) { nCounter[i]=1; }
|
||||
}
|
||||
// Then step this level
|
||||
nCounter[nLevel]++;
|
||||
// Finally clear lower levels
|
||||
if (nLevel<10) { restart(nLevel+1); }
|
||||
this.nLevel = nLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ListCounter restart(int nLevel) {
|
||||
restart(nLevel,0);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ListCounter restart(int nLevel, int nValue) {
|
||||
nCounter[nLevel] = nValue;
|
||||
for (int i=nLevel+1; i<=10; i++) {
|
||||
nCounter[i] = 0;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getValue(int nLevel) {
|
||||
return nCounter[nLevel];
|
||||
}
|
||||
|
||||
public int[] getValues() {
|
||||
int[] nCounterSnapshot = new int[11];
|
||||
System.arraycopy(nCounter,0,nCounterSnapshot,0,11);
|
||||
return nCounterSnapshot;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
if (sNumFormat[nLevel]==null) return "";
|
||||
int nLevels = Misc.getPosInteger(style.getLevelProperty(nLevel,
|
||||
XMLString.TEXT_DISPLAY_LEVELS),1);
|
||||
String sPrefix = style.getLevelProperty(nLevel,XMLString.STYLE_NUM_PREFIX);
|
||||
String sSuffix = style.getLevelProperty(nLevel,XMLString.STYLE_NUM_SUFFIX);
|
||||
String sLabel="";
|
||||
if (sPrefix!=null) { sLabel+=sPrefix; }
|
||||
for (int j=nLevel-nLevels+1; j<nLevel; j++) {
|
||||
sLabel+=formatNumber(nCounter[j],sNumFormat[j],true)+".";
|
||||
}
|
||||
// TODO: Lettersync
|
||||
sLabel+=formatNumber(nCounter[nLevel],sNumFormat[nLevel],true);
|
||||
if (sSuffix!=null) { sLabel+=sSuffix; }
|
||||
return sLabel;
|
||||
}
|
||||
|
||||
// Utility method to generate number
|
||||
private String formatNumber(int number,String sStyle,boolean bLetterSync) {
|
||||
if ("a".equals(sStyle)) { return Misc.int2alph(number,bLetterSync); }
|
||||
else if ("A".equals(sStyle)) { return Misc.int2Alph(number,bLetterSync); }
|
||||
else if ("i".equals(sStyle)) { return Misc.int2roman(number); }
|
||||
else if ("I".equals(sStyle)) { return Misc.int2Roman(number); }
|
||||
else if ("1".equals(sStyle)) { return Misc.int2arabic(number); }
|
||||
else return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
128
source/java/writer2latex/office/ListStyle.java
Normal file
128
source/java/writer2latex/office/ListStyle.java
Normal file
|
@ -0,0 +1,128 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ListStyle.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.4 (2004-02-16)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> Class representing a list style (including outline numbering) in OOo Writer</p>
|
||||
*/
|
||||
public class ListStyle extends OfficeStyle {
|
||||
// the file format doesn't specify a maximum nesting level, but OOo
|
||||
// currently supports 10
|
||||
private static final int MAX_LEVEL = 10;
|
||||
private PropertySet[] level;
|
||||
private PropertySet[] levelStyle;
|
||||
|
||||
public ListStyle() {
|
||||
level = new PropertySet[MAX_LEVEL+1];
|
||||
levelStyle = new PropertySet[MAX_LEVEL+1];
|
||||
for (int i=1; i<=MAX_LEVEL; i++) {
|
||||
level[i] = new PropertySet();
|
||||
levelStyle[i] = new PropertySet();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLevelType(int i) {
|
||||
if (i>=1 && i<=MAX_LEVEL) {
|
||||
return level[i].getName();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNumber(int i) {
|
||||
return XMLString.TEXT_LIST_LEVEL_STYLE_NUMBER.equals(level[i].getName());
|
||||
}
|
||||
|
||||
public boolean isBullet(int i) {
|
||||
return XMLString.TEXT_LIST_LEVEL_STYLE_BULLET.equals(level[i].getName());
|
||||
}
|
||||
|
||||
public boolean isImage(int i) {
|
||||
return XMLString.TEXT_LIST_LEVEL_STYLE_IMAGE.equals(level[i].getName());
|
||||
}
|
||||
|
||||
public String getLevelProperty(int i, String sName) {
|
||||
if (i>=1 && i<=MAX_LEVEL) {
|
||||
return level[i].getProperty(sName);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getLevelStyleProperty(int i, String sName) {
|
||||
if (i>=1 && i<=MAX_LEVEL) {
|
||||
return levelStyle[i].getProperty(sName);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void loadStyleFromDOM(Node node) {
|
||||
super.loadStyleFromDOM(node);
|
||||
// Collect level information from child elements:
|
||||
if (node.hasChildNodes()){
|
||||
NodeList nl = node.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++ ) {
|
||||
Node child=nl.item(i);
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE){
|
||||
String sLevel = Misc.getAttribute(child,XMLString.TEXT_LEVEL);
|
||||
if (sLevel!=null) {
|
||||
int nLevel = Misc.getPosInteger(sLevel,1);
|
||||
if (nLevel>=1 && nLevel<=MAX_LEVEL) {
|
||||
level[nLevel].loadFromDOM(child);
|
||||
// Also include style:properties
|
||||
if (child.hasChildNodes()){
|
||||
NodeList nl2 = child.getChildNodes();
|
||||
int nLen2 = nl2.getLength();
|
||||
for (int i2 = 0; i2 < nLen2; i2++ ) {
|
||||
Node child2=nl2.item(i2);
|
||||
if (child2.getNodeType()==Node.ELEMENT_NODE){
|
||||
if (child2.getNodeName().equals(XMLString.STYLE_PROPERTIES)) {
|
||||
levelStyle[nLevel].loadFromDOM(child2);
|
||||
}
|
||||
if (child2.getNodeName().equals(XMLString.STYLE_LIST_LEVEL_PROPERTIES)) { // oasis
|
||||
levelStyle[nLevel].loadFromDOM(child2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
135
source/java/writer2latex/office/LoftReader.java
Normal file
135
source/java/writer2latex/office/LoftReader.java
Normal file
|
@ -0,0 +1,135 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* LoftReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-22)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
//import java.util.Hashtable;
|
||||
//import java.util.Set;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
//import org.w3c.dom.Node;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* <p>The class reads a <code>text:illustration-index</code> or
|
||||
* <code>text:table-index</code> element.</p>
|
||||
*/
|
||||
public class LoftReader {
|
||||
|
||||
private Element loftSource = null;
|
||||
private Element indexBody = null;
|
||||
|
||||
private String sName = null; // (section) name for this lof/lot
|
||||
private String sStyleName = null; // section style name
|
||||
|
||||
private boolean bUseCaption = true;
|
||||
private String sCaptionSequenceName = null;
|
||||
private boolean bIsByChapter = false; // default is document
|
||||
|
||||
private Element indexTitleTemplate = null;
|
||||
private Element loftEntryTemplate = null;
|
||||
|
||||
private boolean bIsTableIndex;
|
||||
|
||||
|
||||
/** <p>Initialize the LoftReader with a illustration/table index node
|
||||
* @param onode a <code>text:*-index</code>
|
||||
*/
|
||||
public LoftReader(Element onode) {
|
||||
bIsTableIndex = onode.getTagName().equals(XMLString.TEXT_TABLE_INDEX);
|
||||
|
||||
sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
|
||||
sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
|
||||
|
||||
loftSource = bIsTableIndex ?
|
||||
Misc.getChildByTagName(onode,XMLString.TEXT_TABLE_INDEX_SOURCE) :
|
||||
Misc.getChildByTagName(onode,XMLString.TEXT_ILLUSTRATION_INDEX_SOURCE);
|
||||
|
||||
indexBody = Misc.getChildByTagName(onode,XMLString.TEXT_INDEX_BODY);
|
||||
|
||||
if (loftSource!=null) {
|
||||
bUseCaption = !"false".equals(loftSource.getAttribute(XMLString.TEXT_USE_CAPTION));
|
||||
sCaptionSequenceName = loftSource.getAttribute(XMLString.TEXT_CAPTION_SEQUENCE_NAME);
|
||||
bIsByChapter = "chapter".equals(loftSource.getAttribute(XMLString.TEXT_INDEX_SCOPE));
|
||||
|
||||
indexTitleTemplate = Misc.getChildByTagName(loftSource,XMLString.TEXT_INDEX_TITLE_TEMPLATE);
|
||||
loftEntryTemplate = bIsTableIndex ?
|
||||
Misc.getChildByTagName(loftSource,XMLString.TEXT_TABLE_INDEX_ENTRY_TEMPLATE) :
|
||||
Misc.getChildByTagName(loftSource,XMLString.TEXT_ILLUSTRATION_INDEX_ENTRY_TEMPLATE);
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>Get the (section) name for this loft </p>
|
||||
* @return the name of the loft
|
||||
*/
|
||||
public String getName() { return sName; }
|
||||
|
||||
/** <p>Get the (section) style name for this loft </p>
|
||||
* @return name of the section style to use for this loft
|
||||
*/
|
||||
public String getStyleName() { return sStyleName; }
|
||||
|
||||
/** <p>Is this a table index or a figure index? </p>
|
||||
* @return true if it's a table index
|
||||
*/
|
||||
public boolean isTableIndex() { return bIsTableIndex; }
|
||||
|
||||
/** <p>Is this loft by chapter? </p>
|
||||
* @return true if the scope is a chapter only
|
||||
*/
|
||||
public boolean isByChapter() { return bIsByChapter; }
|
||||
|
||||
/** <p>Is this loft generated by captions? (otherwise: by object names)</p>
|
||||
* @return true if we use captions
|
||||
*/
|
||||
public boolean useCaption() { return bUseCaption; }
|
||||
|
||||
/** <p>Get the sequence name to use for the caption</p>
|
||||
* @return the name of the caption
|
||||
*/
|
||||
public String getCaptionSequenceName() { return sCaptionSequenceName; }
|
||||
|
||||
/** <p>Get the index title template for this loft</p>
|
||||
* @return the <code>text:index-title-template</code> element, or null
|
||||
*/
|
||||
public Element getIndexTitleTemplate() { return indexTitleTemplate; }
|
||||
|
||||
/** <p>Get the entry template for this loft at a specific level</p>
|
||||
* @param nLevel the outline level
|
||||
* @return the <code>text:table-of-content-entry-template</code> element, or null
|
||||
*/
|
||||
public Element getLoftEntryTemplate(int nLevel) {
|
||||
return loftEntryTemplate;
|
||||
}
|
||||
|
||||
/** <p>Return the generated content of this loft, if available</p>
|
||||
* @return the <code>text:index-body</code> element
|
||||
*/
|
||||
public Element getIndexBody() { return indexBody; }
|
||||
|
||||
|
||||
}
|
159
source/java/writer2latex/office/MIMETypes.java
Normal file
159
source/java/writer2latex/office/MIMETypes.java
Normal file
|
@ -0,0 +1,159 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* MIMETypes.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-24)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
/* Some helpers to handle the MIME types used by OOo
|
||||
*/
|
||||
|
||||
public final class MIMETypes extends writer2latex.api.MIMETypes {
|
||||
// OOo MIME types, taken from
|
||||
// http://framework.openoffice.org/documentation/mimetypes/mimetypes.html
|
||||
public static final String WRITER="application/vnd.sun.xml.writer";
|
||||
public static final String CALC="application/vnd.sun.xml.calc";
|
||||
public static final String IMPRESS="application/vnd.sun.xml.impress";
|
||||
public static final String DRAW="application/vnd.sun.xml.draw";
|
||||
public static final String CHART="application/vnd.sun.xml.chart";
|
||||
public static final String MATH="application/vnd.sun.xml.math";
|
||||
// OpenDocument MIME types (from spec)
|
||||
public static final String ODT="application/vnd.oasis.opendocument.text";
|
||||
public static final String ODS="application/vnd.oasis.opendocument.spreadsheet";
|
||||
public static final String ODP="application/vnd.oasis.opendocument.presentation";
|
||||
public static final String ODF="application/vnd.oasis.opendocument.formula";
|
||||
|
||||
// zip
|
||||
public static final String ZIP="application/zip";
|
||||
|
||||
// Magic signatures for some binary files
|
||||
public static final byte[] PNG_SIG = { (byte) 0x89, 0x50, 0x4e, 0x47 }; // .PNG
|
||||
public static final byte[] JPEG_SIG = { (byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xe0 };
|
||||
public static final byte[] GIF87_SIG = { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }; // GIF87a
|
||||
public static final byte[] GIF89_SIG = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // GIF89a
|
||||
public static final byte[] TIFF_SIG = { 0x49, 0x49, 0x2A }; // II*
|
||||
public static final byte[] BMP_SIG = { 0x42, 0x4d }; // BM
|
||||
public static final byte[] WMF_SIG = { (byte) 0xd7, (byte) 0xcd, (byte) 0xc6, (byte) 0x9a };
|
||||
public static final byte[] WMF30_SIG = { 1, 0, 9, 0 }; // Old WMF format, not reliable - see below
|
||||
public static final byte[] EPS_SIG = { 0x25, 0x21 }; // %!
|
||||
public static final byte[] SVM_SIG = { 0x56, 0x43, 0x4c, 0x4d, 0x54, 0x46 }; // VCLMTF
|
||||
public static final byte[] ZIP_SIG = { 0x50, 0x4b, 0x03, 0x04 }; // PK..
|
||||
|
||||
|
||||
// Preferred file extensions for some files
|
||||
public static final String LATEX_EXT = ".tex";
|
||||
public static final String BIBTEX_EXT = ".bib";
|
||||
public static final String XHTML_EXT = ".html";
|
||||
public static final String XHTML_MATHML_EXT = ".xhtml";
|
||||
public static final String XHTML_MATHML_XSL_EXT = ".xml";
|
||||
public static final String PNG_EXT = ".png";
|
||||
public static final String JPEG_EXT = ".jpg"; // this is the default in graphicx.sty
|
||||
public static final String GIF_EXT = ".gif";
|
||||
public static final String TIFF_EXT = ".tif";
|
||||
public static final String BMP_EXT = ".bmp";
|
||||
public static final String WMF_EXT = ".wmf";
|
||||
public static final String EPS_EXT = ".eps";
|
||||
public static final String SVM_EXT = ".svm";
|
||||
public static final String PDF_EXT = ".pdf";
|
||||
|
||||
private static final boolean isType(byte[] blob, byte[] sig) {
|
||||
int n = sig.length;
|
||||
for (int i=0; i<n; i++) {
|
||||
if (blob[i]!=sig[i]) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final String getMagicMIMEType(byte[] blob) {
|
||||
if (isType(blob,PNG_SIG)) { return PNG; }
|
||||
if (isType(blob,JPEG_SIG)) { return JPEG; }
|
||||
if (isType(blob,GIF87_SIG)) { return GIF; }
|
||||
if (isType(blob,GIF89_SIG)) { return GIF; }
|
||||
if (isType(blob,TIFF_SIG)) { return TIFF; }
|
||||
if (isType(blob,BMP_SIG)) { return BMP; }
|
||||
if (isType(blob,WMF_SIG)) { return WMF; }
|
||||
if (isType(blob,WMF30_SIG)) { return WMF; } // do not trust this..
|
||||
if (isType(blob,EPS_SIG)) { return EPS; }
|
||||
if (isType(blob,SVM_SIG)) { return SVM; }
|
||||
if (isType(blob,ZIP_SIG)) { return ZIP; }
|
||||
return "";
|
||||
}
|
||||
|
||||
public static final String getFileExtension(String sMIME) {
|
||||
if (PNG.equals(sMIME)) { return PNG_EXT; }
|
||||
if (JPEG.equals(sMIME)) { return JPEG_EXT; }
|
||||
if (GIF.equals(sMIME)) { return GIF_EXT; }
|
||||
if (TIFF.equals(sMIME)) { return TIFF_EXT; }
|
||||
if (BMP.equals(sMIME)) { return BMP_EXT; }
|
||||
if (WMF.equals(sMIME)) { return WMF_EXT; }
|
||||
if (EPS.equals(sMIME)) { return EPS_EXT; }
|
||||
if (SVM.equals(sMIME)) { return SVM_EXT; }
|
||||
if (PDF.equals(sMIME)) { return PDF_EXT; }
|
||||
if (LATEX.equals(sMIME)) { return LATEX_EXT; }
|
||||
if (BIBTEX.equals(sMIME)) { return BIBTEX_EXT; }
|
||||
if (XHTML.equals(sMIME)) { return XHTML_EXT; }
|
||||
if (XHTML_MATHML.equals(sMIME)) { return XHTML_MATHML_EXT; }
|
||||
if (XHTML_MATHML_XSL.equals(sMIME)) { return XHTML_MATHML_XSL_EXT; }
|
||||
return "";
|
||||
}
|
||||
|
||||
public static boolean isVectorFormat(String sMIME) {
|
||||
return WMF.equals(sMIME) || EPS.equals(sMIME) || SVM.equals(sMIME) || PDF.equals(sMIME);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Notes on old WMF format:
|
||||
Found on math type objects: 1 0 - 9 0 - 0 3 - 90 1 - 0 0
|
||||
|
||||
Explanation from http://wvware.sourceforge.net/caolan/ora-wmf.html :
|
||||
The standard Windows metafile header is 18 bytes in length and is structured as follows:
|
||||
|
||||
typedef struct _WindowsMetaHeader
|
||||
{
|
||||
WORD FileType; Type of metafile (0=memory, 1=disk)
|
||||
WORD HeaderSize; Size of header in WORDS (always 9)
|
||||
WORD Version; Version of Microsoft Windows used
|
||||
DWORD FileSize; Total size of the metafile in WORDs
|
||||
WORD NumOfObjects; Number of objects in the file
|
||||
DWORD MaxRecordSize; The size of largest record in WORDs
|
||||
WORD NumOfParams; Not Used (always 0)
|
||||
} WMFHEAD;
|
||||
|
||||
FileType contains a value which indicates the location of the metafile data. A value of 0 indicates that the metafile is stored in memory, while a 1 indicates that it is stored on disk.
|
||||
|
||||
HeaderSize contains the size of the metafile header in 16-bit WORDs. This value is always 9.
|
||||
|
||||
Version stores the version number of Microsoft Windows that created the metafile. This value is always read in hexadecimal format. For example, in a metafile created by Windows 3.0 and 3.1, this item would have the value 0x0300.
|
||||
|
||||
FileSize specifies the total size of the metafile in 16-bit WORDs.
|
||||
|
||||
NumOfObjects specifies the number of objects that are in the metafile.
|
||||
|
||||
MaxRecordSize specifies the size of the largest record in the metafile in WORDs.
|
||||
|
||||
NumOfParams is not used and is set to a value of 0.
|
||||
|
||||
*/
|
66
source/java/writer2latex/office/MasterPage.java
Normal file
66
source/java/writer2latex/office/MasterPage.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* MasterPage.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2005 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.5 (2005-10-10)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> Class representing a master page in OOo Writer </p> */
|
||||
public class MasterPage extends OfficeStyle {
|
||||
private PropertySet properties = new PropertySet();
|
||||
private Node header = null;
|
||||
private Node headerLeft = null;
|
||||
private Node footer = null;
|
||||
private Node footerLeft = null;
|
||||
|
||||
public String getProperty(String sPropName) {
|
||||
return properties.getProperty(sPropName);
|
||||
}
|
||||
|
||||
public String getPageLayoutName() {
|
||||
String sName = properties.getProperty(XMLString.STYLE_PAGE_MASTER_NAME);
|
||||
if (sName==null) { // try oasis format
|
||||
sName = properties.getProperty(XMLString.STYLE_PAGE_LAYOUT_NAME);
|
||||
}
|
||||
return sName;
|
||||
}
|
||||
|
||||
public Node getHeader() { return header; }
|
||||
public Node getHeaderLeft() { return headerLeft; }
|
||||
public Node getFooter() { return footer; }
|
||||
public Node getFooterLeft() { return footerLeft; }
|
||||
|
||||
public void loadStyleFromDOM(Node node) {
|
||||
super.loadStyleFromDOM(node);
|
||||
properties.loadFromDOM(node);
|
||||
header = Misc.getChildByTagName(node,XMLString.STYLE_HEADER);
|
||||
headerLeft = Misc.getChildByTagName(node,XMLString.STYLE_HEADER_LEFT);
|
||||
footer = Misc.getChildByTagName(node,XMLString.STYLE_FOOTER);
|
||||
footerLeft = Misc.getChildByTagName(node,XMLString.STYLE_FOOTER_LEFT);
|
||||
}
|
||||
|
||||
}
|
169
source/java/writer2latex/office/MetaData.java
Normal file
169
source/java/writer2latex/office/MetaData.java
Normal file
|
@ -0,0 +1,169 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* MetaData.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-23)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import writer2latex.util.*;
|
||||
//import writer2latex.office.*;
|
||||
|
||||
import writer2latex.xmerge.OfficeDocument;
|
||||
|
||||
/**
|
||||
* <p>This class represents the metadata of an OOo Writer document.</p>
|
||||
*/
|
||||
public class MetaData {
|
||||
// Dublin Core
|
||||
private String sTitle = "";
|
||||
private String sCreator = "";
|
||||
private String sInitialCreator = "";
|
||||
private String sDate = "";
|
||||
private String sDescription = "";
|
||||
private String sLanguage = "";
|
||||
private String sSubject = "";
|
||||
// Keywords
|
||||
private String sKeywords = "";
|
||||
|
||||
/** <p>Construct a new instance from an OOo Writer document.</p>
|
||||
* @param oooDoc is the OOo document
|
||||
*/
|
||||
public MetaData(OfficeDocument oooDoc) {
|
||||
// get the DOM (either package or flat)
|
||||
Document dom = oooDoc.getMetaDOM();
|
||||
if (dom==null) { dom = oooDoc.getContentDOM(); }
|
||||
|
||||
// get the office:meta element
|
||||
NodeList list = dom.getElementsByTagName(XMLString.OFFICE_META);
|
||||
if (list.getLength() == 0) { return; } // oops, no metadata - fails silently
|
||||
Node meta = list.item(0);
|
||||
if (!meta.hasChildNodes()) { return; }
|
||||
|
||||
// traverse the metadata
|
||||
CSVList keywords = new CSVList(", ");
|
||||
list = meta.getChildNodes();
|
||||
int nLen = list.getLength();
|
||||
for (int i=0; i<nLen; i++) {
|
||||
Node child = list.item(i);
|
||||
String sName = child.getNodeName();
|
||||
if (XMLString.DC_TITLE.equals(sName)) {
|
||||
sTitle = getContent(child);
|
||||
}
|
||||
if (XMLString.DC_CREATOR.equals(sName)) {
|
||||
sCreator = getContent(child);
|
||||
}
|
||||
if (XMLString.DC_DATE.equals(sName)) {
|
||||
sDate = getContent(child);
|
||||
}
|
||||
if (XMLString.DC_DESCRIPTION.equals(sName)) {
|
||||
sDescription = getContent(child);
|
||||
}
|
||||
if (XMLString.DC_LANGUAGE.equals(sName)) {
|
||||
sLanguage = getContent(child);
|
||||
}
|
||||
if (XMLString.DC_SUBJECT.equals(sName)) {
|
||||
sSubject = getContent(child);
|
||||
}
|
||||
if (XMLString.META_INITIAL_CREATOR.equals(sName)) {
|
||||
sInitialCreator = getContent(child);
|
||||
}
|
||||
if (XMLString.META_KEYWORD.equals(sName)) { // oasis
|
||||
keywords.addValue(getContent(child));
|
||||
}
|
||||
if (XMLString.META_KEYWORDS.equals(sName)) {
|
||||
// Old format: Keywords are contained within meta:keywords
|
||||
if (child.hasChildNodes()) {
|
||||
// traverse the keywords
|
||||
NodeList keywordList = child.getChildNodes();
|
||||
int nWordCount = keywordList.getLength();
|
||||
for (int j=0; j<nWordCount; j++) {
|
||||
Node grandchild = keywordList.item(j);
|
||||
if (XMLString.META_KEYWORD.equals(grandchild.getNodeName())){
|
||||
keywords.addValue(getContent(grandchild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sKeywords = keywords.toString();
|
||||
}
|
||||
|
||||
/** <p> Get the title of this document (may be null)</p>
|
||||
* @return the title of the document
|
||||
*/
|
||||
public String getTitle() { return sTitle; }
|
||||
|
||||
/** <p> Get the creator of this document (may be null)</p>
|
||||
* @return the creator of the document (or the initial creator if none is specified)
|
||||
*/
|
||||
public String getCreator() { return sCreator==null ? sInitialCreator : sCreator; }
|
||||
|
||||
/** <p> Get the initial creator of this document (may be null)</p>
|
||||
* @return the initial creator of the document
|
||||
*/
|
||||
public String getInitialCreator() { return sInitialCreator; }
|
||||
|
||||
/** <p> Get the date of this document (may be null)</p>
|
||||
* @return the date of the document
|
||||
*/
|
||||
public String getDate() { return sDate; }
|
||||
|
||||
/** <p> Get the description of this document (may be null)</p>
|
||||
* @return the description of the document
|
||||
*/
|
||||
public String getDescription() { return sDescription; }
|
||||
|
||||
/** <p> Get the language of this document (may be null)</p>
|
||||
* @return the language of the document
|
||||
*/
|
||||
public String getLanguage() { return sLanguage; }
|
||||
|
||||
/** <p> Get the subject of this document (may be null)</p>
|
||||
* @return the subject of the document
|
||||
*/
|
||||
public String getSubject() { return sSubject; }
|
||||
|
||||
/** <p> Get the keywords of this document as a comma separated list (may be null)</p>
|
||||
* @return the keywords of the document
|
||||
*/
|
||||
public String getKeywords() { return sKeywords; }
|
||||
|
||||
private String getContent(Node node) {
|
||||
if (!node.hasChildNodes()) { return null; }
|
||||
String s="";
|
||||
NodeList list = node.getChildNodes();
|
||||
int nLen = list.getLength();
|
||||
for (int i=0; i<nLen; i++) {
|
||||
if (list.item(i).getNodeType()==Node.TEXT_NODE) {
|
||||
s+= list.item(i).getNodeValue();
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
1149
source/java/writer2latex/office/OfficeReader.java
Normal file
1149
source/java/writer2latex/office/OfficeReader.java
Normal file
File diff suppressed because it is too large
Load diff
66
source/java/writer2latex/office/OfficeStyle.java
Normal file
66
source/java/writer2latex/office/OfficeStyle.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* OfficeStyle.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2006 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.5 (2006-11-23)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> Abstract class representing a style in OOo </p> */
|
||||
public abstract class OfficeStyle {
|
||||
// These attributes are defined by OfficeStyleFamily upon collection of styles
|
||||
protected String sName;
|
||||
protected OfficeStyleFamily family;
|
||||
protected boolean bAutomatic;
|
||||
|
||||
private String sDisplayName;
|
||||
private String sParentName;
|
||||
private String sListStyleName;
|
||||
private String sMasterPageName;
|
||||
|
||||
public String getName() { return sName; }
|
||||
|
||||
public OfficeStyleFamily getFamily() { return family; }
|
||||
|
||||
public boolean isAutomatic() { return bAutomatic; }
|
||||
|
||||
public String getDisplayName() { return sDisplayName; }
|
||||
|
||||
public String getParentName() { return sParentName; }
|
||||
|
||||
public String getListStyleName() { return sListStyleName; }
|
||||
|
||||
public String getMasterPageName() { return sMasterPageName; }
|
||||
|
||||
public void loadStyleFromDOM(Node node){
|
||||
sDisplayName = Misc.getAttribute(node,XMLString.STYLE_DISPLAY_NAME);
|
||||
if (sDisplayName==null) { sDisplayName = sName; }
|
||||
sParentName = Misc.getAttribute(node,XMLString.STYLE_PARENT_STYLE_NAME);
|
||||
sListStyleName = Misc.getAttribute(node,XMLString.STYLE_LIST_STYLE_NAME);
|
||||
sMasterPageName = Misc.getAttribute(node,XMLString.STYLE_MASTER_PAGE_NAME);
|
||||
}
|
||||
|
||||
}
|
137
source/java/writer2latex/office/OfficeStyleFamily.java
Normal file
137
source/java/writer2latex/office/OfficeStyleFamily.java
Normal file
|
@ -0,0 +1,137 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* OfficeStyleFamily.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-23)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Enumeration;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** Container class representing a style family in OOo */
|
||||
public class OfficeStyleFamily {
|
||||
private Hashtable styles = new Hashtable();
|
||||
private Class styleClass;
|
||||
|
||||
private Hashtable displayNames = new Hashtable();
|
||||
|
||||
private OfficeStyle defaultStyle = null;
|
||||
|
||||
/** Create a new OfficeStyleFamily based on a class
|
||||
* @param styleClass the subclass of OfficeStyle used to represent styles
|
||||
* in this family
|
||||
*/
|
||||
public OfficeStyleFamily(Class styleClass) {
|
||||
this.styleClass = styleClass;
|
||||
}
|
||||
|
||||
/** Define the default style for this family, ie. an unnamed style providing
|
||||
* defaults for some style properties. This style cannot be found using
|
||||
* getStyle or getStyleByDisplayName.
|
||||
* @param style the new default style
|
||||
*/
|
||||
public void setDefaultStyle(OfficeStyle style) {
|
||||
defaultStyle = style;
|
||||
}
|
||||
|
||||
/** Get the default style for this family
|
||||
* @return the default style, or null if none is defined
|
||||
*/
|
||||
public OfficeStyle getDefaultStyle() {
|
||||
return defaultStyle;
|
||||
}
|
||||
|
||||
/** Get a style by name
|
||||
* @param sName the name of the style
|
||||
* @return the style, or null if such a style does not exist
|
||||
*/
|
||||
public OfficeStyle getStyle(String sName) {
|
||||
if (sName==null) { return null; }
|
||||
else { return (OfficeStyle) styles.get(sName); }
|
||||
}
|
||||
|
||||
/** Get a style by display name. Automatic styles does not have a display
|
||||
* name, so only common styles can be retrieved with this method
|
||||
* @param sDisplayName the display name of the style
|
||||
* @return the style, or null if such a style does not exist
|
||||
*/
|
||||
public OfficeStyle getStyleByDisplayName(String sDisplayName) {
|
||||
if (sDisplayName==null) { return null; }
|
||||
else { return getStyle((String) displayNames.get(sDisplayName)); }
|
||||
}
|
||||
|
||||
/** Get the display name for the style with the specified name.
|
||||
* If this is an automatic style, the parent style is used
|
||||
* @param sName the style name
|
||||
* @return the display name, or null if the style does not exist
|
||||
*/
|
||||
public String getDisplayName(String sName) {
|
||||
OfficeStyle style = getStyle(sName);
|
||||
if (style==null) { return null; }
|
||||
if (style.isAutomatic()) {
|
||||
style = getStyle(style.getParentName());
|
||||
if (style==null) { return null; }
|
||||
}
|
||||
return style.getDisplayName();
|
||||
}
|
||||
|
||||
/** Get all named styles in the family (ie. excluding the default style)
|
||||
* @return an enumeration of all styles represented by OfficeStyle objects
|
||||
*/
|
||||
public Enumeration getStylesEnumeration(){
|
||||
return styles.elements();
|
||||
}
|
||||
|
||||
/** Load a style from a DOM representation
|
||||
* @param node the style:... node representing the style
|
||||
* @param bAutomatic if true, the style is an automatic style
|
||||
*/
|
||||
public void loadStyleFromDOM(Node node, boolean bAutomatic) {
|
||||
String sName = Misc.getAttribute(node,XMLString.STYLE_NAME);
|
||||
if (sName!=null) {
|
||||
try {
|
||||
OfficeStyle style = (OfficeStyle) styleClass.newInstance();
|
||||
style.sName=sName;
|
||||
style.family=this;
|
||||
style.bAutomatic=bAutomatic;
|
||||
style.loadStyleFromDOM(node);
|
||||
styles.put(sName,style);
|
||||
if (!bAutomatic) {
|
||||
// Create backlink from display name to name
|
||||
displayNames.put(style.getDisplayName(),sName);
|
||||
}
|
||||
}
|
||||
catch (InstantiationException e) {
|
||||
// Will not happen if a proper class is passed in the constructor
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
// Should also not happen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
13
source/java/writer2latex/office/Package.html
Normal file
13
source/java/writer2latex/office/Package.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>The package writer2latex.office</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>A collection of classes that reads ODF files.</p>
|
||||
<p>In general the DOM tree is used directly, but these classes provides a more
|
||||
convenient interface to specific parts of the document.</p>
|
||||
</body>
|
||||
</html>
|
91
source/java/writer2latex/office/PageLayout.java
Normal file
91
source/java/writer2latex/office/PageLayout.java
Normal file
|
@ -0,0 +1,91 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* PageLayout.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2007 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.5 (2007-03-17)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> Class representing a page master in OOo Writer. This is represented
|
||||
* like other styles + a separate style for header and footer</p>
|
||||
*/
|
||||
public class PageLayout extends StyleWithProperties {
|
||||
private String sPageUsage = null;
|
||||
|
||||
private boolean bHasHeaderStyle = false;
|
||||
private PropertySet headerStyle = new PropertySet();
|
||||
|
||||
private boolean bHasFooterStyle = false;
|
||||
private PropertySet footerStyle = new PropertySet();
|
||||
|
||||
|
||||
public String getPageUsage() {
|
||||
return sPageUsage;
|
||||
}
|
||||
|
||||
public boolean hasHeaderStyle() { return bHasHeaderStyle; }
|
||||
|
||||
public String getHeaderProperty(String sPropName) {
|
||||
return headerStyle.getProperty(sPropName);
|
||||
}
|
||||
|
||||
public boolean hasFooterStyle() { return bHasFooterStyle; }
|
||||
|
||||
public String getFooterProperty(String sPropName) {
|
||||
return footerStyle.getProperty(sPropName);
|
||||
}
|
||||
|
||||
public void loadStyleFromDOM(Node node) {
|
||||
super.loadStyleFromDOM(node);
|
||||
sPageUsage = Misc.getAttribute(node,XMLString.STYLE_PAGE_USAGE);
|
||||
|
||||
Node hsNode = Misc.getChildByTagName(node,XMLString.STYLE_HEADER_STYLE);
|
||||
if (hsNode!=null) {
|
||||
Node hsProperties = Misc.getChildByTagName(hsNode,XMLString.STYLE_PROPERTIES);
|
||||
if (hsProperties==null) { // oasis:
|
||||
hsProperties = Misc.getChildByTagName(hsNode,XMLString.STYLE_HEADER_FOOTER_PROPERTIES);
|
||||
}
|
||||
if (hsProperties!=null) {
|
||||
bHasHeaderStyle = true;
|
||||
headerStyle.loadFromDOM(hsProperties);
|
||||
}
|
||||
}
|
||||
|
||||
Node fsNode = Misc.getChildByTagName(node,XMLString.STYLE_FOOTER_STYLE);
|
||||
if (fsNode!=null) {
|
||||
Node fsProperties = Misc.getChildByTagName(fsNode,XMLString.STYLE_PROPERTIES);
|
||||
if (fsProperties==null) { // oasis:
|
||||
fsProperties = Misc.getChildByTagName(fsNode,XMLString.STYLE_HEADER_FOOTER_PROPERTIES);
|
||||
}
|
||||
if (fsProperties!=null) {
|
||||
bHasFooterStyle = true;
|
||||
footerStyle.loadFromDOM(fsProperties);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
98
source/java/writer2latex/office/PropertySet.java
Normal file
98
source/java/writer2latex/office/PropertySet.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* PropertySet.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2007 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.5 (2007-03-17)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
/** <p> Class representing a set of style properties in OOo (actually this
|
||||
is simply the set of attributes of an element). </p>
|
||||
*/
|
||||
public class PropertySet {
|
||||
private Hashtable properties = new Hashtable();
|
||||
private String sName;
|
||||
|
||||
public PropertySet() {
|
||||
properties = new Hashtable();
|
||||
sName="";
|
||||
}
|
||||
|
||||
public String getProperty(String sPropName) {
|
||||
if (sPropName!=null) {
|
||||
String sValue = (String) properties.get(sPropName);
|
||||
if (sValue!=null && sValue.endsWith("inch")) {
|
||||
// Cut of inch to in
|
||||
return sValue.substring(0,sValue.length()-2);
|
||||
}
|
||||
else {
|
||||
return sValue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() { return sName; }
|
||||
|
||||
public void loadFromDOM(Node node) {
|
||||
sName = node.getNodeName();
|
||||
// read the attributes of the node, if any
|
||||
if (node!=null) {
|
||||
NamedNodeMap attrNodes = node.getAttributes();
|
||||
if (attrNodes!=null) {
|
||||
int nLen = attrNodes.getLength();
|
||||
for (int i=0; i<nLen; i++){
|
||||
Node attr = attrNodes.item(i);
|
||||
properties.put(attr.getNodeName(),attr.getNodeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsProperty(String sProperty) {
|
||||
return sProperty!=null && properties.containsKey(sProperty);
|
||||
}
|
||||
|
||||
public void setProperty(String sProperty, String sValue){
|
||||
properties.put(sProperty,sValue);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String s="";
|
||||
Enumeration keys = properties.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String sKey = (String) keys.nextElement();
|
||||
String sValue = (String) properties.get(sKey);
|
||||
s += sKey+"="+sValue+" ";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
232
source/java/writer2latex/office/SVMReader.java
Normal file
232
source/java/writer2latex/office/SVMReader.java
Normal file
|
@ -0,0 +1,232 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* SVMReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2004 by Urban Widmark
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 0.4 (2004-02-26)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
/** This class contains a static method to extract EPS data from an SVM file */
|
||||
public final class SVMReader {
|
||||
|
||||
/* Notes on SVM file format:
|
||||
|
||||
Relevant OO 1.1.0 Source Files include:
|
||||
tools/source/stream/vcompat.cxx
|
||||
vcl/source/gdi/gdimtf.cxx
|
||||
vcl/inc/gdimtf.hxx
|
||||
vcl/source/gdi/metaact.cxx
|
||||
vcl/inc/metaact.hxx
|
||||
vcl/source/gdi/mapmod.cxx
|
||||
vcl/inc/mapmod.hxx
|
||||
tools/source/generic/fract.cxx
|
||||
tools/inc/fract.hxx
|
||||
tools/source/generic/gen.cxx
|
||||
tools/inc/gen.hxx
|
||||
|
||||
VersionCompat (6 bytes)
|
||||
version - 2 bytes
|
||||
totalsize - 4 bytes
|
||||
|
||||
Point (Pair) (8 bytes)
|
||||
X - 4 bytes (long)
|
||||
Y - 4 bytes (long)
|
||||
|
||||
Fraction (8 bytes)
|
||||
nNumerator - 4 bytes (long)
|
||||
nDenominator - 4 bytes (long)
|
||||
|
||||
MapMode (6 + 2 + 8 + 8 + 8 + 1 = 33 bytes)
|
||||
VersionCompat
|
||||
meUnit - UINT16
|
||||
maOrigin - Point
|
||||
maScaleX - Fraction
|
||||
maScaleY - Fraction
|
||||
mbSimple - BOOL (1 byte)
|
||||
|
||||
Size (Pair) (8 bytes)
|
||||
width - 4 bytes (long)
|
||||
height - 4 bytes (long)
|
||||
|
||||
GfxLink (16 or 57 bytes)
|
||||
VersionCompat
|
||||
nType - 2 bytes
|
||||
nSize - 4 bytes
|
||||
nUserId - 4 bytes
|
||||
aSize - Size (version >=2)
|
||||
aMapMode - MapMode (version >=2)
|
||||
|
||||
MetaEPSAction
|
||||
VersionCompat
|
||||
maGfxLink - GfxLink
|
||||
data[maGfxLink.nSize] - bytes
|
||||
maPoint - Point
|
||||
maSize - Size
|
||||
maSubst - GDIMetaFile (alternative image?)
|
||||
|
||||
SVM file
|
||||
"VCLMTF"
|
||||
Compat - VersionCompat
|
||||
nStmCompressMode - UINT32
|
||||
aPrefMapMode - MapMode
|
||||
aPrefSize - Size
|
||||
count - UINT32
|
||||
action[count] - MetaAction
|
||||
|
||||
|
||||
Example header from an EPS image included in a Writer document:
|
||||
00000000: 5643 4c4d 5446 0100 3100 0000 0000 0000 VCLMTF..1.......
|
||||
00000010: 0100 1b00 0000 0800 0000 0000 0000 0000 ................
|
||||
00000020: 0100 0000 0100 0000 0100 0000 0100 0000 ................
|
||||
00000030: 0169 0100 00fd 0000 0001 0000 008f 0001 .i..............
|
||||
00000040: 0096 3200 0002 0033 0000 0001 003f 3000 ..2....3.....?0.
|
||||
00000050: 0000 0000 0000 0000 0000 0000 0001 001b ................
|
||||
00000060: 0000 000a 0000 0000 0000 0000 0001 0000 ................
|
||||
00000070: 0001 0000 0001 0000 0001 0000 0001 2521 ..............%!
|
||||
|
||||
5643 4c4d 5446 "VCLMTF" 0
|
||||
|
||||
0100 version 6
|
||||
3100 0000 totalsize
|
||||
|
||||
0000 0000 compress 12
|
||||
|
||||
0100 aPrefMapMode.version 16
|
||||
1b00 0000 aPrefMapMode.totalsize
|
||||
0800 aPrefMapMode.meUnit
|
||||
0000 0000 aPrefMapMode.maOrigin
|
||||
0000 0000
|
||||
0100 0000 aPrefMapMode.maScaleX
|
||||
0100 0000
|
||||
0100 0000 aPrefMapMode.maScaleY
|
||||
0100 0000
|
||||
01 aPrefMapMode.mbSimple
|
||||
|
||||
6901 0000 aPrefSize 49
|
||||
fd00 0000
|
||||
|
||||
0100 0000 nCount 57
|
||||
|
||||
8f00 type == META_EPS_ACTION 61
|
||||
|
||||
0100 version
|
||||
9632 0000 totalsize
|
||||
|
||||
0200 version
|
||||
3300 0000 totalsize
|
||||
|
||||
0100 nType
|
||||
3f30 0000 nSize 75
|
||||
0000 0000 nUserId
|
||||
|
||||
0000 0000 aSize
|
||||
0000 0000
|
||||
|
||||
0100
|
||||
1b00 0000
|
||||
0a00
|
||||
|
||||
0000 0000
|
||||
0000 0000
|
||||
0100 0000
|
||||
0100 0000
|
||||
0100 0000
|
||||
0100 0000
|
||||
01
|
||||
|
||||
Beginning of EPS data:
|
||||
|
||||
2521
|
||||
|
||||
Note that maPoint/maSize/maSubst are all after the EPS file.
|
||||
|
||||
*/
|
||||
|
||||
/** Determine if this SVM contains an EPS document and retrieve start and
|
||||
* end positions if so.
|
||||
*
|
||||
* @param blob byte array containing SVM file
|
||||
* @param offlen integer array to retrieve the offset into the SVM file
|
||||
* (offlen[0]) and the length (offlen[1]) of the EPS
|
||||
* document. If the method returns false, the array
|
||||
* will be unchanged.
|
||||
*
|
||||
* @return returns true if the SVM contains an EPS document
|
||||
*/
|
||||
public static final boolean readSVM(byte[] blob, int[] offlen) {
|
||||
int pos = 57;
|
||||
int nCount = getInt(blob, pos);
|
||||
pos += 4;
|
||||
|
||||
for (int i=0; i<nCount; i++) {
|
||||
int type = getShort(blob, pos);
|
||||
pos += 2;
|
||||
|
||||
// We only understand META_EPS_ACTION
|
||||
if (type != 143)
|
||||
return false;
|
||||
|
||||
pos += 6;
|
||||
int version = getShort(blob, pos);
|
||||
pos += 6; // version + totalsize
|
||||
pos += 2; // nType
|
||||
|
||||
// This is the size of the EPS data.
|
||||
int size = getInt(blob, pos);
|
||||
pos += 8;
|
||||
|
||||
if (version >= 2)
|
||||
pos += 41;
|
||||
|
||||
for (int j=0; j<MIMETypes.EPS_SIG.length; j++)
|
||||
if (MIMETypes.EPS_SIG[j] != blob[pos + j])
|
||||
return false;
|
||||
|
||||
offlen[0] = pos;
|
||||
offlen[1] = size;
|
||||
|
||||
// For now we only understand files where the EPS entry is
|
||||
// the first MetaAction
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int getInt(byte[] blob, int pos)
|
||||
{
|
||||
return
|
||||
((blob[pos+0] & 0xff) << 0) +
|
||||
((blob[pos+1] & 0xff) << 8) +
|
||||
((blob[pos+2] & 0xff) << 16) +
|
||||
((blob[pos+3] & 0xff) << 24);
|
||||
}
|
||||
|
||||
private static int getShort(byte[] blob, int pos)
|
||||
{
|
||||
return
|
||||
((blob[pos+0] & 0xff) << 0) +
|
||||
((blob[pos+1] & 0xff) << 8);
|
||||
}
|
||||
|
||||
}
|
298
source/java/writer2latex/office/StyleWithProperties.java
Normal file
298
source/java/writer2latex/office/StyleWithProperties.java
Normal file
|
@ -0,0 +1,298 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* StyleWithProperties.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-22)
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
//import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
//import org.w3c.dom.NamedNodeMap;
|
||||
//import java.util.Hashtable;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/** <p> Class representing a style in OOo which contains a style:properties
|
||||
* element </p>
|
||||
*/
|
||||
public class StyleWithProperties extends OfficeStyle {
|
||||
private final static int OLDPROPS = 0;
|
||||
private final static int TEXT = 1;
|
||||
private final static int PAR = 2;
|
||||
private final static int SECTION = 3;
|
||||
private final static int TABLE = 4;
|
||||
private final static int COLUMN = 5;
|
||||
private final static int ROW = 6;
|
||||
private final static int CELL = 7;
|
||||
private final static int GRAPHIC = 8;
|
||||
private final static int PAGE = 9;
|
||||
//private final static int DRAWPAGE = 10;
|
||||
private final static int COUNT = 10;
|
||||
|
||||
private PropertySet[] properties = new PropertySet[COUNT];
|
||||
private boolean bIsOldProps = false;
|
||||
|
||||
private PropertySet backgroundImageProperties = new PropertySet();
|
||||
|
||||
private int nColCount = 0;
|
||||
|
||||
private boolean bHasFootnoteSep = false;
|
||||
private PropertySet footnoteSep = new PropertySet();
|
||||
|
||||
|
||||
public StyleWithProperties() {
|
||||
for (int i=0; i<COUNT; i++) {
|
||||
properties[i] = new PropertySet();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadStyleFromDOM(Node node) {
|
||||
super.loadStyleFromDOM(node);
|
||||
// read the properties of the style, if any
|
||||
Node child = node.getFirstChild();
|
||||
while (child!=null) {
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (XMLString.STYLE_PROPERTIES.equals(sName)) {
|
||||
bIsOldProps = true; // style:properties identifies old format
|
||||
loadPropertiesFromDOM(OLDPROPS,child);
|
||||
}
|
||||
else if (XMLString.STYLE_TEXT_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(TEXT,child);
|
||||
}
|
||||
else if (XMLString.STYLE_PARAGRAPH_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(PAR,child);
|
||||
}
|
||||
else if (XMLString.STYLE_SECTION_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(SECTION,child);
|
||||
}
|
||||
else if (XMLString.STYLE_TABLE_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(TABLE,child);
|
||||
}
|
||||
else if (XMLString.STYLE_TABLE_COLUMN_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(COLUMN,child);
|
||||
}
|
||||
else if (XMLString.STYLE_TABLE_ROW_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(ROW,child);
|
||||
}
|
||||
else if (XMLString.STYLE_TABLE_CELL_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(CELL,child);
|
||||
}
|
||||
else if (XMLString.STYLE_GRAPHIC_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(GRAPHIC,child);
|
||||
}
|
||||
else if (XMLString.STYLE_PAGE_LAYOUT_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(PAGE,child);
|
||||
}
|
||||
else if (XMLString.STYLE_DRAWING_PAGE_PROPERTIES.equals(sName)) {
|
||||
loadPropertiesFromDOM(PAGE,child);
|
||||
}
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadPropertiesFromDOM(int nIndex,Node node) {
|
||||
properties[nIndex].loadFromDOM(node);
|
||||
// Several property sets may contain these complex properties, but only one per style:
|
||||
Node child = node.getFirstChild();
|
||||
while (child!=null) {
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (XMLString.STYLE_BACKGROUND_IMAGE.equals(sName)) {
|
||||
backgroundImageProperties.loadFromDOM(child);
|
||||
}
|
||||
else if (XMLString.STYLE_COLUMNS.equals(sName)) {
|
||||
nColCount = Misc.getPosInteger(Misc.getAttribute(child,
|
||||
XMLString.FO_COLUMN_COUNT),1);
|
||||
// TODO: read individual columns
|
||||
}
|
||||
else if (XMLString.STYLE_FOOTNOTE_SEP.equals(sName)) {
|
||||
bHasFootnoteSep = true;
|
||||
footnoteSep.loadFromDOM(child);
|
||||
}
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getProperty(int nIndex, String sName, boolean bInherit) {
|
||||
int nRealIndex = bIsOldProps ? OLDPROPS : nIndex;
|
||||
if (properties[nRealIndex].containsProperty(sName)) {
|
||||
String sValue = properties[nRealIndex].getProperty(sName);
|
||||
return Misc.truncateLength(sValue);
|
||||
}
|
||||
else if (bInherit && getParentName()!=null) {
|
||||
StyleWithProperties parentStyle = (StyleWithProperties) family.getStyle(getParentName());
|
||||
if (parentStyle!=null) {
|
||||
return parentStyle.getProperty(nIndex,sName,bInherit);
|
||||
}
|
||||
}
|
||||
return null; // no value
|
||||
}
|
||||
|
||||
public String getTextProperty(String sName, boolean bInherit) {
|
||||
return getProperty(TEXT,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getParProperty(String sName, boolean bInherit) {
|
||||
return getProperty(PAR,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getSectionProperty(String sName, boolean bInherit) {
|
||||
return getProperty(SECTION,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getTableProperty(String sName, boolean bInherit) {
|
||||
return getProperty(TABLE,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getColumnProperty(String sName, boolean bInherit) {
|
||||
return getProperty(COLUMN,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getRowProperty(String sName, boolean bInherit) {
|
||||
return getProperty(ROW,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getCellProperty(String sName, boolean bInherit) {
|
||||
return getProperty(CELL,sName,bInherit);
|
||||
}
|
||||
|
||||
public String getGraphicProperty(String sName, boolean bInherit) {
|
||||
return getProperty(GRAPHIC,sName,bInherit);
|
||||
}
|
||||
|
||||
// TODO: Remove this method
|
||||
public String getProperty(String sProperty, boolean bInherit){
|
||||
String sValue;
|
||||
for (int i=0; i<COUNT; i++) {
|
||||
sValue = getProperty(i,sProperty,bInherit);
|
||||
if (sValue!=null) { return sValue; }
|
||||
}
|
||||
return null; // no value
|
||||
}
|
||||
|
||||
// TODO: Remove this method
|
||||
public String getProperty(String sProperty){
|
||||
return getProperty(sProperty,true);
|
||||
}
|
||||
|
||||
protected String getAbsoluteProperty(int nIndex, String sProperty){
|
||||
int nRealIndex = bIsOldProps ? OLDPROPS : nIndex;
|
||||
if (properties[nRealIndex].containsProperty(sProperty)){
|
||||
String sValue=(String) properties[nRealIndex].getProperty(sProperty);
|
||||
if (sValue.endsWith("%")) {
|
||||
StyleWithProperties parentStyle
|
||||
= (StyleWithProperties) family.getStyle(getParentName());
|
||||
if (parentStyle!=null) {
|
||||
String sParentValue = parentStyle.getAbsoluteProperty(nIndex,sProperty);
|
||||
if (sParentValue!=null) { return Misc.multiply(sValue,sParentValue); }
|
||||
}
|
||||
else if (getFamily()!=null && getFamily().getDefaultStyle()!=null) {
|
||||
StyleWithProperties style = (StyleWithProperties) getFamily().getDefaultStyle();
|
||||
String sDefaultValue=(String) style.getProperty(nIndex,sProperty,false);
|
||||
if (sValue !=null) { return Misc.multiply(sValue,sDefaultValue); }
|
||||
}
|
||||
}
|
||||
else {
|
||||
return Misc.truncateLength(sValue);
|
||||
}
|
||||
}
|
||||
else if (getParentName()!=null){
|
||||
StyleWithProperties parentStyle
|
||||
= (StyleWithProperties) family.getStyle(getParentName());
|
||||
if (parentStyle!=null) {
|
||||
return parentStyle.getAbsoluteProperty(nIndex,sProperty);
|
||||
}
|
||||
}
|
||||
else if (getFamily()!=null && getFamily().getDefaultStyle()!=null) {
|
||||
StyleWithProperties style = (StyleWithProperties) getFamily().getDefaultStyle();
|
||||
String sValue=(String) style.getProperty(nIndex,sProperty,false);
|
||||
if (sValue !=null) { return sValue; }
|
||||
}
|
||||
// no value!
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getAbsoluteTextProperty(String sName) {
|
||||
return getAbsoluteProperty(TEXT,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteParProperty(String sName) {
|
||||
return getAbsoluteProperty(PAR,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteSectionProperty(String sName) {
|
||||
return getAbsoluteProperty(SECTION,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteTableProperty(String sName) {
|
||||
return getAbsoluteProperty(TABLE,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteColumnProperty(String sName) {
|
||||
return getAbsoluteProperty(COLUMN,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteRowProperty(String sName) {
|
||||
return getAbsoluteProperty(ROW,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteCellProperty(String sName) {
|
||||
return getAbsoluteProperty(CELL,sName);
|
||||
}
|
||||
|
||||
public String getAbsoluteGraphicProperty(String sName) {
|
||||
return getAbsoluteProperty(GRAPHIC,sName);
|
||||
}
|
||||
|
||||
// TODO: Remove this method
|
||||
public String getAbsoluteProperty(String sProperty){
|
||||
String sValue;
|
||||
for (int i=0; i<COUNT; i++) {
|
||||
sValue = getAbsoluteProperty(i,sProperty);
|
||||
if (sValue!=null) { return sValue; }
|
||||
}
|
||||
return null; // no value
|
||||
}
|
||||
|
||||
// Get a length property that defaults to 0cm
|
||||
public String getAbsoluteLength(String sProperty) {
|
||||
String s = getAbsoluteProperty(sProperty);
|
||||
if (s==null) { return "0cm"; }
|
||||
else { return s; }
|
||||
}
|
||||
|
||||
public String getBackgroundImageProperty(String sName) {
|
||||
return backgroundImageProperties.getProperty(sName);
|
||||
}
|
||||
|
||||
public int getColCount() { return nColCount; }
|
||||
|
||||
public boolean hasFootnoteSep() { return bHasFootnoteSep; }
|
||||
|
||||
public String getFootnoteProperty(String sPropName) {
|
||||
return footnoteSep.getProperty(sPropName);
|
||||
}
|
||||
|
||||
}
|
66
source/java/writer2latex/office/TableLine.java
Normal file
66
source/java/writer2latex/office/TableLine.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* TableLine.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-09-04)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* <p> This class represents the properties of a row or column in a table</p>
|
||||
*/
|
||||
public class TableLine {
|
||||
private String sStyleName;
|
||||
private String sVisibility;
|
||||
private String sDefaultCellStyleName;
|
||||
private boolean bDisplay;
|
||||
private boolean bHeader;
|
||||
|
||||
public TableLine(Node node, boolean bHeader, boolean bDisplay) {
|
||||
// Node must be table:table-column or table:table-row
|
||||
sStyleName = Misc.getAttribute(node,XMLString.TABLE_STYLE_NAME);
|
||||
sVisibility = Misc.getAttribute(node,XMLString.TABLE_VISIBILITY);
|
||||
if (sVisibility==null) { sVisibility = "visible"; }
|
||||
sDefaultCellStyleName = Misc.getAttribute(node,XMLString.TABLE_DEFAULT_CELL_STYLE_NAME);
|
||||
this.bDisplay = bDisplay;
|
||||
this.bHeader = bHeader;
|
||||
}
|
||||
|
||||
public String getStyleName() { return sStyleName; }
|
||||
|
||||
public String getVisibility() { return sVisibility; }
|
||||
|
||||
public boolean isCollapse() { return "collapse".equals(sVisibility); }
|
||||
|
||||
public boolean isFilter() { return "filter".equals(sVisibility); }
|
||||
|
||||
public String getDefaultCellStyleName() { return sDefaultCellStyleName; }
|
||||
|
||||
public boolean isDisplay() { return bDisplay; }
|
||||
|
||||
public boolean isHeader() { return bHeader; }
|
||||
|
||||
}
|
122
source/java/writer2latex/office/TableRange.java
Normal file
122
source/java/writer2latex/office/TableRange.java
Normal file
|
@ -0,0 +1,122 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* TableRange.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-09-07)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
/**
|
||||
* This class represent a table range within a table. A table range is defined
|
||||
* as a rectangular area (such as a print range), possibly excluding filtered
|
||||
* and hidden rows. A <code>TableView</code> can be derived from a table range,
|
||||
* providing read access to the range.
|
||||
*/
|
||||
public class TableRange {
|
||||
private TableReader reader;
|
||||
|
||||
private int nFirstRow;
|
||||
private int nLastRow;
|
||||
private int nFirstCol;
|
||||
private int nLastCol;
|
||||
private boolean bIncludeHidden;
|
||||
private boolean bIncludeFiltered;
|
||||
|
||||
public TableRange(TableReader reader) {
|
||||
this.reader = reader;
|
||||
|
||||
// The initial view is the complete table
|
||||
nFirstRow = 0;
|
||||
nLastRow = reader.getRowCount()-1;
|
||||
nFirstCol = 0;
|
||||
nLastCol = reader.getColCount()-1;
|
||||
bIncludeHidden = true;
|
||||
bIncludeFiltered = true;
|
||||
}
|
||||
|
||||
public void setFirstRow(int nRow) {
|
||||
// Adjust to a valid value (in 0..nLastRow)
|
||||
if (nRow<0) { nFirstRow = 0; }
|
||||
else if (nRow>nLastRow) { nFirstRow = nLastRow; }
|
||||
else { nFirstRow = nRow; }
|
||||
}
|
||||
|
||||
public int getFirstRow() {
|
||||
return nFirstRow;
|
||||
}
|
||||
|
||||
public void setLastRow(int nRow) {
|
||||
// Adjust to a valid value (in nFirstRow..(nRowCount-1))
|
||||
if (nRow<nFirstRow) { nLastRow = nFirstRow; }
|
||||
else if (nRow>=reader.getRowCount()) { nLastRow = reader.getRowCount()-1; }
|
||||
else { nLastRow = nRow; }
|
||||
}
|
||||
|
||||
public int getLastRow() {
|
||||
return nLastRow;
|
||||
}
|
||||
|
||||
public void setFirstCol(int nCol) {
|
||||
// Adjust to a valid value (in 0..nLastCol)
|
||||
if (nCol<0) { nFirstCol = 0; }
|
||||
else if (nCol>nLastCol) { nFirstCol = nLastCol; }
|
||||
else { nFirstCol = nCol; }
|
||||
}
|
||||
|
||||
public int getFirstCol() {
|
||||
return nFirstCol;
|
||||
}
|
||||
|
||||
public void setLastCol(int nCol) {
|
||||
// Adjust to a valid value (in nFirstCol..(nColCount-1))
|
||||
if (nCol<nFirstCol) { nLastCol = nFirstCol; }
|
||||
else if (nCol>=reader.getColCount()) { nLastCol = reader.getColCount()-1; }
|
||||
else { nLastCol = nCol; }
|
||||
}
|
||||
|
||||
public int getLastCol() {
|
||||
return nLastCol;
|
||||
}
|
||||
|
||||
public void setIncludeHidden(boolean b) {
|
||||
bIncludeHidden = b;
|
||||
}
|
||||
|
||||
public boolean includeHidden() {
|
||||
return bIncludeHidden;
|
||||
}
|
||||
|
||||
public void setIncludeFiltered(boolean b) {
|
||||
bIncludeFiltered = b;
|
||||
}
|
||||
|
||||
public boolean includeFiltered() {
|
||||
return bIncludeFiltered;
|
||||
}
|
||||
|
||||
public TableView createTableView() {
|
||||
return new TableView(reader, this);
|
||||
}
|
||||
|
||||
|
||||
}
|
131
source/java/writer2latex/office/TableRangeParser.java
Normal file
131
source/java/writer2latex/office/TableRangeParser.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* TableRangeParser.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2009 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2009-02-16)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
import writer2latex.util.SimpleInputBuffer;
|
||||
|
||||
/**
|
||||
* This class parses a space separated list of table ranges. A table range is of the form
|
||||
* <sheet name>.<column><row>:<sheet name>.<column><row>
|
||||
* where the sheet name is quoted (single quotes) if it contains spaces
|
||||
* the column is one or two uppercase letters (A-Z)
|
||||
* the row is an integer.
|
||||
* The sheet name is currently ignored, and so are any syntax errors
|
||||
*/
|
||||
public class TableRangeParser {
|
||||
private SimpleInputBuffer inbuf;
|
||||
|
||||
public TableRangeParser(String s) {
|
||||
inbuf = new SimpleInputBuffer(s);
|
||||
inbuf.skipSpaces();
|
||||
}
|
||||
|
||||
public boolean hasMoreRanges() {
|
||||
return !inbuf.atEnd();
|
||||
}
|
||||
|
||||
// returns { first col, first row, last col, last row }
|
||||
public int[] getRange() {
|
||||
if (!inbuf.atEnd()) {
|
||||
int[] nFirst = parseAddress();
|
||||
parseCharacter(':');
|
||||
int[] nLast = parseAddress();
|
||||
int[] nResult = { nFirst[0], nFirst[1], nLast[0], nLast[1] };
|
||||
return nResult;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void parseCharacter(char c) {
|
||||
// ignore the character if it's missing
|
||||
if (inbuf.peekChar()==c) { inbuf.getChar(); }
|
||||
inbuf.skipSpaces();
|
||||
}
|
||||
|
||||
// returns { col, row }
|
||||
private int[] parseAddress() {
|
||||
parseSheetName();
|
||||
parseCharacter('.');
|
||||
int[] nResult = new int[2];
|
||||
nResult[0] = parseColumn();
|
||||
nResult[1] = parseRow();
|
||||
inbuf.skipSpaces();
|
||||
return nResult;
|
||||
}
|
||||
|
||||
private void parseSheetName() {
|
||||
if (inbuf.peekChar()=='.') {
|
||||
// The sheet name may be omitted
|
||||
}
|
||||
else if (inbuf.peekChar()=='\'') {
|
||||
// The sheet name must be quoted if it contains space, dots or apostrophes
|
||||
inbuf.getChar(); // skip leading '
|
||||
while (!inbuf.atEnd() && inbuf.peekChar()!='\'') {
|
||||
inbuf.getChar();
|
||||
if (inbuf.peekChar()=='\'' && inbuf.peekFollowingChar()=='\'') {
|
||||
// Escaped '
|
||||
inbuf.getChar(); inbuf.getChar();
|
||||
}
|
||||
}
|
||||
inbuf.getChar(); // skip trailing '
|
||||
}
|
||||
else {
|
||||
// Unquoted sheet name, ends with dot
|
||||
while (!inbuf.atEnd() && inbuf.peekChar()!='.') {
|
||||
inbuf.getChar();
|
||||
}
|
||||
}
|
||||
inbuf.skipSpaces();
|
||||
}
|
||||
|
||||
// Return column number, starting with 0
|
||||
private int parseColumn() {
|
||||
if (inbuf.peekChar()>='A' && inbuf.peekChar()<='Z') {
|
||||
int nFirst = inbuf.getChar()-65;
|
||||
if (inbuf.peekChar()>='A' && inbuf.peekChar()<='Z') {
|
||||
int nSecond = inbuf.getChar()-65;
|
||||
return 26*(nFirst+1)+nSecond;
|
||||
}
|
||||
else {
|
||||
return nFirst;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0; // syntax error
|
||||
}
|
||||
}
|
||||
|
||||
// Return row number, starting with 0
|
||||
private int parseRow() {
|
||||
return Misc.getPosInteger(inbuf.getInteger(),1)-1;
|
||||
}
|
||||
|
||||
|
||||
}
|
395
source/java/writer2latex/office/TableReader.java
Normal file
395
source/java/writer2latex/office/TableReader.java
Normal file
|
@ -0,0 +1,395 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* TableReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
// Version 1.0 (2008-11-22)
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* <p> This class reads a table from a table:table or table:sub-table element
|
||||
* and presents it as an n by m grid. In addition it gives access to the
|
||||
* absolute and relative widths of tables, columns and cells.</p>
|
||||
*/
|
||||
public class TableReader {
|
||||
//private OfficeReader ofr;
|
||||
private Element tableNode;
|
||||
private LinkedList cols = new LinkedList();
|
||||
private LinkedList rows = new LinkedList();
|
||||
private LinkedList cells = new LinkedList();
|
||||
private int nMaxCols = 1; // real number of columns (count to last non-empty)
|
||||
private int nMaxRows = 1; // real number of rows (count to last non-empty)
|
||||
private String[] sColWidth;
|
||||
private String[] sRelColWidth;
|
||||
private String sTableWidth;
|
||||
private String sRelTableWidth;
|
||||
private Vector printRanges;
|
||||
|
||||
/**
|
||||
* <p> The constructor reads a table from a table:table or table:sub-table
|
||||
* node.</p>
|
||||
* @param ofr the OfficeReader object to get style information from
|
||||
* @param tableNode the table node
|
||||
*/
|
||||
public TableReader(OfficeReader ofr, Element tableNode) {
|
||||
//this.ofr = ofr;
|
||||
this.tableNode = tableNode;
|
||||
if (!tableNode.hasChildNodes()) { return; } // empty table!
|
||||
NodeList nl = tableNode.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++) {
|
||||
Node child = nl.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (sName.equals(XMLString.TABLE_TABLE_COLUMN)) {
|
||||
readTableColumn(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_COLUMNS)) {
|
||||
readTableColumns(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_COLUMN_GROUP)) {
|
||||
readTableColumnGroup(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_HEADER_COLUMNS)) {
|
||||
readTableHeaderColumns(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_ROW)) {
|
||||
readTableRow(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_ROWS)) {
|
||||
readTableRows(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_ROW_GROUP)) {
|
||||
readTableRowGroup(child,false,false);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_HEADER_ROWS)) {
|
||||
readTableHeaderRows(child,false,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read table width from style
|
||||
StyleWithProperties tableStyle = ofr.getTableStyle(getTableStyleName());
|
||||
if (tableStyle!=null) {
|
||||
sTableWidth = tableStyle.getProperty(XMLString.STYLE_WIDTH);
|
||||
sRelTableWidth = tableStyle.getProperty(XMLString.STYLE_REL_WIDTH);
|
||||
}
|
||||
|
||||
// Determine column widths
|
||||
int nCols = cols.size();
|
||||
sColWidth = new String[nCols];
|
||||
sRelColWidth = new String[nCols];
|
||||
int[] nRelColWidth = new int[nCols];
|
||||
boolean bHasRelWidth=true; // set to false if some columns does not have a relative width set
|
||||
int nColSum = 0;
|
||||
for (int nCol=0; nCol<nCols; nCol++) {
|
||||
StyleWithProperties style = ofr.getColumnStyle(((TableLine) cols.get(nCol)).getStyleName());
|
||||
if (style!=null) {
|
||||
sColWidth[nCol] = style.getProperty(XMLString.STYLE_COLUMN_WIDTH);
|
||||
String s = style.getProperty(XMLString.STYLE_REL_COLUMN_WIDTH);
|
||||
if (s!=null && s.endsWith("*")) {
|
||||
nRelColWidth[nCol] = Misc.getPosInteger(s.substring(0,s.length()-1),1);
|
||||
}
|
||||
}
|
||||
if (sColWidth[nCol]==null) { sColWidth[nCol] = "2cm"; } // emergency, should not happen
|
||||
if (nRelColWidth[nCol]==0) { bHasRelWidth = false; }
|
||||
nColSum += nRelColWidth[nCol];
|
||||
}
|
||||
for (int nCol=0; nCol<nCols; nCol++) {
|
||||
if (bHasRelWidth) {
|
||||
sRelColWidth[nCol] = (100.0F*nRelColWidth[nCol]/nColSum)+"%";
|
||||
}
|
||||
else {
|
||||
sRelColWidth[nCol] = (100.0F/nCols)+"%";
|
||||
}
|
||||
}
|
||||
|
||||
// Now determine the actual number of rows and columns
|
||||
// (Calc exports a lot of empty rows at columns bottom/right)
|
||||
int nRows = cells.size();
|
||||
for (int nRow=0; nRow<nRows; nRow++) {
|
||||
LinkedList row = (LinkedList) cells.get(nRow);
|
||||
nCols = row.size();
|
||||
int nMaxCol = 0;
|
||||
int nMaxRow = 0;
|
||||
for (int nCol=0; nCol<nCols; nCol++) {
|
||||
Element cell = (Element) row.get(nCol);
|
||||
if (cell.hasChildNodes()) {
|
||||
nMaxRow = nRow + Misc.getPosInteger(cell.getAttribute(
|
||||
XMLString.TABLE_NUMBER_ROWS_SPANNED),1);
|
||||
if (nMaxRow>nMaxRows) { nMaxRows = nMaxRow; }
|
||||
nMaxCol = nCol + Misc.getPosInteger(cell.getAttribute(
|
||||
XMLString.TABLE_NUMBER_COLUMNS_SPANNED),1);
|
||||
if (nMaxCol>nMaxCols) { nMaxCols = nMaxCol; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally get the print ranges, if any
|
||||
printRanges = new Vector();
|
||||
if (!"false".equals(tableNode.getAttribute(XMLString.TABLE_PRINT))) {
|
||||
TableRangeParser parser = new TableRangeParser(tableNode.getAttribute(XMLString.TABLE_PRINT_RANGES));
|
||||
while (parser.hasMoreRanges()) {
|
||||
int[] nRange = parser.getRange();
|
||||
TableRange range = new TableRange(this);
|
||||
range.setFirstCol(nRange[0]);
|
||||
range.setFirstRow(nRange[1]);
|
||||
range.setLastCol(nRange[2]);
|
||||
range.setLastRow(nRange[3]);
|
||||
printRanges.add(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readTableColumn(Node node, boolean bHeader, boolean bDisplay) {
|
||||
int nRepeat = Misc.getPosInteger(Misc.getAttribute(node,
|
||||
XMLString.TABLE_NUMBER_COLUMNS_REPEATED),1);
|
||||
while (nRepeat-->0) {
|
||||
cols.add(new TableLine(node,bHeader,bDisplay));
|
||||
}
|
||||
}
|
||||
|
||||
private void readTableColumns(Node node, boolean bHeader, boolean bDisplay) {
|
||||
if (!node.hasChildNodes()) { return; } // no columns here!
|
||||
NodeList nl = node.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++) {
|
||||
Node child = nl.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (sName.equals(XMLString.TABLE_TABLE_COLUMN)) {
|
||||
readTableColumn(child,bHeader,bDisplay);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_COLUMN_GROUP)) {
|
||||
readTableColumnGroup(child,bHeader,bDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readTableColumnGroup(Node node, boolean bHeader, boolean bDisplay) {
|
||||
bDisplay = !"false".equals(Misc.getAttribute(node,XMLString.TABLE_DISPLAY));
|
||||
if (!node.hasChildNodes()) { return; } // no columns here!
|
||||
NodeList nl = node.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++) {
|
||||
Node child = nl.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (sName.equals(XMLString.TABLE_TABLE_HEADER_COLUMNS)) {
|
||||
readTableHeaderColumns(child,bHeader,bDisplay);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_COLUMN)) {
|
||||
readTableColumn(child,bHeader,bDisplay);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_COLUMN_GROUP)) {
|
||||
readTableColumnGroup(child,bHeader,bDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readTableHeaderColumns(Node node, boolean bHeader, boolean bDisplay) {
|
||||
readTableColumns(node,true,bDisplay);
|
||||
}
|
||||
|
||||
private void readTableRow(Node node, boolean bHeader, boolean bDisplay) {
|
||||
int nRepeat = Misc.getPosInteger(Misc.getAttribute(node,
|
||||
XMLString.TABLE_NUMBER_ROWS_REPEATED),1);
|
||||
while (nRepeat-->0) {
|
||||
rows.add(new TableLine(node,bHeader,bDisplay));
|
||||
|
||||
// Read the cells in the row
|
||||
LinkedList row = new LinkedList();
|
||||
if (node.hasChildNodes()) {
|
||||
NodeList nl = node.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++) {
|
||||
Node child = nl.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element cell = (Element) child;
|
||||
String sName = cell.getTagName();
|
||||
if (sName.equals(XMLString.TABLE_TABLE_CELL)) {
|
||||
int nColRepeat = Misc.getPosInteger(cell.getAttribute(
|
||||
XMLString.TABLE_NUMBER_COLUMNS_REPEATED),1);
|
||||
while (nColRepeat-->0) { row.add(cell); }
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_COVERED_TABLE_CELL)) {
|
||||
int nColRepeat = Misc.getPosInteger(cell.getAttribute(
|
||||
XMLString.TABLE_NUMBER_COLUMNS_REPEATED),1);
|
||||
while (nColRepeat-->0) { row.add(cell); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cells.add(row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void readTableRows(Node node, boolean bHeader, boolean bDisplay) {
|
||||
if (!node.hasChildNodes()) { return; } // no rows here!
|
||||
NodeList nl = node.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++) {
|
||||
Node child = nl.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (sName.equals(XMLString.TABLE_TABLE_ROW)) {
|
||||
readTableRow(child,bHeader,bDisplay);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_ROW_GROUP)) {
|
||||
readTableRowGroup(child,bHeader,bDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readTableRowGroup(Node node, boolean bHeader, boolean bDisplay) {
|
||||
bDisplay = !"false".equals(Misc.getAttribute(node,XMLString.TABLE_DISPLAY));
|
||||
if (!node.hasChildNodes()) { return; } // no rows here!
|
||||
NodeList nl = node.getChildNodes();
|
||||
int nLen = nl.getLength();
|
||||
for (int i = 0; i < nLen; i++) {
|
||||
Node child = nl.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
String sName = child.getNodeName();
|
||||
if (sName.equals(XMLString.TABLE_TABLE_HEADER_ROWS)) {
|
||||
readTableHeaderRows(child,bHeader,bDisplay);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_ROW)) {
|
||||
readTableRow(child,bHeader,bDisplay);
|
||||
}
|
||||
else if (sName.equals(XMLString.TABLE_TABLE_ROW_GROUP)) {
|
||||
readTableRowGroup(child,bHeader,bDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSubTable() {
|
||||
return XMLString.TABLE_SUB_TABLE.equals(tableNode.getTagName()) || // old
|
||||
"true".equals(Misc.getAttribute(tableNode,XMLString.TABLE_IS_SUB_TABLE)); // oasis
|
||||
}
|
||||
|
||||
private void readTableHeaderRows(Node node, boolean bHeader, boolean bDisplay) {
|
||||
readTableRows(node,true,bDisplay);
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableNode.getAttribute(XMLString.TABLE_NAME);
|
||||
}
|
||||
|
||||
public String getTableStyleName() {
|
||||
return tableNode.getAttribute(XMLString.TABLE_STYLE_NAME);
|
||||
}
|
||||
|
||||
public String getTableWidth() { return sTableWidth; }
|
||||
|
||||
public String getRelTableWidth() { return sRelTableWidth; }
|
||||
|
||||
public int getRowCount() { return rows.size(); }
|
||||
|
||||
public int getMaxRowCount() { return nMaxRows; }
|
||||
|
||||
public int getFirstBodyRow() {
|
||||
int nRows = rows.size();
|
||||
for (int nRow=0; nRow<nRows; nRow++) {
|
||||
if (!getRow(nRow).isHeader()) {
|
||||
return nRow;
|
||||
}
|
||||
}
|
||||
return nRows; // no body rows!
|
||||
}
|
||||
|
||||
public int getColCount() { return cols.size(); }
|
||||
|
||||
public int getMaxColCount() { return nMaxCols; }
|
||||
|
||||
public String getColumnWidth(int nCol) {
|
||||
return 0<=nCol && nCol<=cols.size() ? sColWidth[nCol] : null;
|
||||
}
|
||||
|
||||
public String getRelColumnWidth(int nCol) {
|
||||
return 0<=nCol && nCol<=cols.size() ? sRelColWidth[nCol] : null;
|
||||
}
|
||||
|
||||
public Element getCell(int nRow, int nCol) {
|
||||
if (nRow<0 || nRow>=cells.size()) { return null; }
|
||||
LinkedList row = (LinkedList) cells.get(nRow);
|
||||
if (nCol<0 || nCol>=row.size()) { return null; }
|
||||
return (Element) row.get(nCol);
|
||||
}
|
||||
|
||||
public String getCellStyleName(int nRow, int nCol) {
|
||||
Element cell = (Element) getCell(nRow,nCol);
|
||||
if (cell==null) { return null; }
|
||||
String s = cell.getAttribute(XMLString.TABLE_STYLE_NAME); // try the cell
|
||||
if (s!=null && s.length()>0) { return s; }
|
||||
s = getRow(nRow).getDefaultCellStyleName(); // try row default
|
||||
if (s!=null && s.length()>0) { return s; }
|
||||
s = getCol(nCol).getDefaultCellStyleName(); // try column default
|
||||
return s;
|
||||
}
|
||||
|
||||
public String getCellWidth(int nRow, int nCol) {
|
||||
Element cell = (Element) getCell(nRow,nCol);
|
||||
if (cell==null) { return null; }
|
||||
int nCols = Misc.getPosInteger(cell.getAttribute(XMLString.TABLE_NUMBER_COLUMNS_SPANNED),1);
|
||||
String sWidth = sColWidth[nCol];
|
||||
for (int i=nCol+1; i<nCol+nCols; i++) {
|
||||
sWidth = Misc.add(sWidth,sColWidth[i]);
|
||||
}
|
||||
return sWidth;
|
||||
}
|
||||
|
||||
public TableLine getRow(int nRow) {
|
||||
if (nRow<0 || nRow>=rows.size()) { return null; }
|
||||
return (TableLine) rows.get(nRow);
|
||||
}
|
||||
|
||||
public TableLine getCol(int nCol) {
|
||||
if (nCol<0 || nCol>=cols.size()) { return null; }
|
||||
return (TableLine) cols.get(nCol);
|
||||
}
|
||||
|
||||
public int getPrintRangeCount() { return printRanges.size(); }
|
||||
|
||||
public TableRange getPrintRange(int nIndex) {
|
||||
if (0<=nIndex && nIndex<printRanges.size()) {
|
||||
return (TableRange) printRanges.get(nIndex);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
196
source/java/writer2latex/office/TableView.java
Normal file
196
source/java/writer2latex/office/TableView.java
Normal file
|
@ -0,0 +1,196 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* TableView.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-09-07)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* This class represents a view of a <code>TableRange</code>. A view provides
|
||||
* read access to the range using a simple grid model.
|
||||
*/
|
||||
public class TableView {
|
||||
|
||||
private TableReader reader;
|
||||
private TableRange range;
|
||||
|
||||
// The size of the view (visible part of the range)
|
||||
private int nRowCount;
|
||||
private int nColCount;
|
||||
|
||||
// Map view row/col index to original index
|
||||
private int[] nRowMap;
|
||||
private int[] nColMap;
|
||||
|
||||
// The cells in the view
|
||||
private CellView[][] cells;
|
||||
|
||||
public TableView(TableReader reader, TableRange range) {
|
||||
this.reader = reader;
|
||||
this.range = range;
|
||||
|
||||
// Count visible rows & cols in this range
|
||||
nRowCount = 0;
|
||||
for (int nRow=range.getFirstRow(); nRow<=range.getLastRow(); nRow++) {
|
||||
if (isVisibleRow(nRow)) { nRowCount++; }
|
||||
}
|
||||
nColCount = 0;
|
||||
for (int nCol=range.getFirstCol(); nCol<=range.getLastCol(); nCol++) {
|
||||
if (isVisibleCol(nCol)) { nColCount++; }
|
||||
}
|
||||
|
||||
// Fill the row & col maps
|
||||
nRowMap = new int[nRowCount];
|
||||
int nRealRow = range.getFirstRow();
|
||||
for (int nRow=0; nRow<nRowCount; nRow++) {
|
||||
// Skip invisible rows
|
||||
while (!isVisibleRow(nRealRow)) { nRealRow++; }
|
||||
nRowMap[nRow] = nRealRow++;
|
||||
}
|
||||
nColMap = new int[nColCount];
|
||||
int nRealCol = range.getFirstCol();
|
||||
for (int nCol=0; nCol<nColCount; nCol++) {
|
||||
// Skip invisible cols
|
||||
while (!isVisibleCol(nRealCol)) { nRealCol++; }
|
||||
nColMap[nCol] = nRealCol++;
|
||||
}
|
||||
|
||||
// Initialize the cell views
|
||||
cells = new CellView[nRowCount][nColCount];
|
||||
for (int nRow=0; nRow<nRowCount; nRow++) {
|
||||
for (int nCol=0; nCol<nColCount; nCol++) {
|
||||
cells[nRow][nCol] = new CellView();
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the cell views
|
||||
// (must start in the upper left corner of the original table)
|
||||
int nViewRow = 0;
|
||||
for (int nRow=0; nRow<=range.getLastRow(); nRow++) {
|
||||
if (nViewRow<nRowCount && nRowMap[nViewRow]<nRow) { nViewRow++; }
|
||||
int nViewCol = 0;
|
||||
for (int nCol=0; nCol<=range.getLastCol(); nCol++) {
|
||||
if (nViewCol<nColCount && nColMap[nViewCol]<nCol) { nViewCol++; }
|
||||
Element cell = reader.getCell(nRow,nCol);
|
||||
if (Misc.isElement(cell,XMLString.TABLE_TABLE_CELL)) {
|
||||
int nRowSpan = Misc.getPosInteger(cell.getAttribute(XMLString.TABLE_NUMBER_ROWS_SPANNED),1);
|
||||
int nColSpan = Misc.getPosInteger(cell.getAttribute(XMLString.TABLE_NUMBER_COLUMNS_SPANNED),1);
|
||||
// Test if (parts of) the cell belongs the view
|
||||
if (nViewRow<nRowCount && nRowMap[nViewRow]<nRow+nRowSpan &&
|
||||
nViewCol<nColCount && nColMap[nViewCol]<nCol+nColSpan) {
|
||||
cells[nViewRow][nViewCol].cell=cell;
|
||||
cells[nViewRow][nViewCol].nOriginalRow=nRow;
|
||||
cells[nViewRow][nViewCol].nOriginalCol=nCol;
|
||||
// Calculate rowspan in view
|
||||
int i=nViewRow+1;
|
||||
while (i<nRowCount && nRowMap[i]<nRow+nRowSpan) { i++; }
|
||||
cells[nViewRow][nViewCol].nRowSpan = i-nViewRow;
|
||||
// Calculate colspan in view
|
||||
int j=nViewCol+1;
|
||||
while (j<nColCount && nColMap[j]<nCol+nColSpan) { j++; }
|
||||
cells[nViewRow][nViewCol].nColSpan = j-nViewCol;
|
||||
}
|
||||
}
|
||||
if (Misc.isElement(cell,XMLString.TABLE_COVERED_TABLE_CELL)) {
|
||||
// Don't overwrite, the position may be occupied with a relocated cell
|
||||
if (cells[nViewRow][nViewCol].cell==null) {
|
||||
cells[nViewRow][nViewCol].cell=cell;
|
||||
cells[nViewRow][nViewCol].nOriginalRow=nRow;
|
||||
cells[nViewRow][nViewCol].nOriginalCol=nCol;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getRelTableWidth() { return reader.getRelTableWidth(); }
|
||||
|
||||
public int getRowCount() { return nRowCount; }
|
||||
|
||||
public int getColCount() { return nColCount; }
|
||||
|
||||
public String getColumnWidth(int nCol) {
|
||||
return 0<=nCol && nCol<=nColCount ? reader.getColumnWidth(nColMap[nCol]) : null;
|
||||
}
|
||||
|
||||
// TODO: Recalculate - the sum should be 100% even in a view!!
|
||||
public String getRelColumnWidth(int nCol) {
|
||||
return 0<=nCol && nCol<=nColCount ? reader.getRelColumnWidth(nColMap[nCol]) : null;
|
||||
}
|
||||
|
||||
public TableLine getRow(int nRow) {
|
||||
return 0<=nRow && nRow<nRowCount ? reader.getRow(nRowMap[nRow]) : null;
|
||||
}
|
||||
|
||||
public TableLine getCol(int nCol) {
|
||||
return 0<=nCol && nCol<nColCount ? reader.getCol(nColMap[nCol]) : null;
|
||||
}
|
||||
|
||||
public Element getCell(int nRow, int nCol) {
|
||||
return 0<=nRow && nRow<nRowCount && 0<=nCol && nCol<nColCount ?
|
||||
cells[nRow][nCol].cell : null;
|
||||
}
|
||||
|
||||
public int getRowSpan(int nRow, int nCol) {
|
||||
return 0<=nRow && nRow<nRowCount && 0<=nCol && nCol<nColCount ?
|
||||
cells[nRow][nCol].nRowSpan : 1;
|
||||
}
|
||||
|
||||
public int getColSpan(int nRow, int nCol) {
|
||||
return 0<=nRow && nRow<nRowCount && 0<=nCol && nCol<nColCount ?
|
||||
cells[nRow][nCol].nColSpan : 1;
|
||||
}
|
||||
|
||||
public String getCellStyleName(int nRow, int nCol) {
|
||||
return 0<=nRow && nRow<nRowCount && 0<=nCol && nCol<nColCount ?
|
||||
reader.getCellStyleName(cells[nRow][nCol].nOriginalRow, cells[nRow][nCol].nOriginalCol) : null;
|
||||
}
|
||||
|
||||
// TODO: Not correct, see TableReader
|
||||
public String getCellWidth(int nRow, int nCol) {
|
||||
return 0<=nRow && nRow<nRowCount && 0<=nCol && nCol<nColCount ?
|
||||
reader.getCellWidth(cells[nRow][nCol].nOriginalRow, cells[nRow][nCol].nOriginalCol) : null;
|
||||
}
|
||||
|
||||
// Helper method: Is this row visible in this view?
|
||||
private boolean isVisibleRow(int nRow) {
|
||||
return nRow>=range.getFirstRow() && nRow<=range.getLastRow() &&
|
||||
(range.includeHidden() || !reader.getRow(nRow).isCollapse()) &&
|
||||
(range.includeFiltered() || !reader.getRow(nRow).isFilter());
|
||||
}
|
||||
|
||||
// Helper method: Is this column visible in this view?
|
||||
private boolean isVisibleCol(int nCol) {
|
||||
return nCol>=range.getFirstCol() && nCol<=range.getLastCol() &&
|
||||
(range.includeHidden() || !reader.getCol(nCol).isCollapse()) &&
|
||||
(range.includeFiltered() || !reader.getCol(nCol).isFilter());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
187
source/java/writer2latex/office/TocReader.java
Normal file
187
source/java/writer2latex/office/TocReader.java
Normal file
|
@ -0,0 +1,187 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* TocReader.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-22)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Set;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import writer2latex.util.Misc;
|
||||
|
||||
/**
|
||||
* <p>The class reads a <code>text:table-of-content</code> element.</p>
|
||||
*/
|
||||
public class TocReader {
|
||||
|
||||
Element tocSource = null;
|
||||
Element indexBody = null;
|
||||
|
||||
String sName=null; // (section) name for this toc
|
||||
String sStyleName=null; // section style name
|
||||
|
||||
int nOutlineLevel = 10; // max level to include
|
||||
boolean bUseOutlineLevel = true; // use headings
|
||||
boolean bUseIndexSourceStyles = false; // use additional styles
|
||||
boolean bUseIndexMarks = true; // use toc marks
|
||||
boolean bIsByChapter = false; // default is document
|
||||
|
||||
Element indexTitleTemplate = null;
|
||||
Element[] tocEntryTemplate = new Element[11];
|
||||
Hashtable indexSourceStyles = new Hashtable();
|
||||
|
||||
|
||||
|
||||
/** <p>Initialize the TocReader with a table of content node.
|
||||
* @param onode a <code>text:table-of-content</code>
|
||||
*/
|
||||
public TocReader(Element onode) {
|
||||
sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
|
||||
sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
|
||||
|
||||
Element tocSource = Misc.getChildByTagName(onode,XMLString.TEXT_TABLE_OF_CONTENT_SOURCE);
|
||||
//Element indexBody = Misc.getChildByTagName(onode,XMLString.TEXT_INDEX_BODY);
|
||||
|
||||
if (tocSource!=null) {
|
||||
nOutlineLevel = Misc.getPosInteger(tocSource.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1);
|
||||
bUseOutlineLevel = !"false".equals(tocSource.getAttribute(XMLString.TEXT_USE_OUTLINE_LEVEL));
|
||||
bUseIndexSourceStyles = "true".equals(tocSource.getAttribute(XMLString.TEXT_USE_INDEX_SOURCE_STYLES));
|
||||
bUseIndexMarks = !"false".equals(tocSource.getAttribute(XMLString.TEXT_USE_INDEX_MARKS));
|
||||
bIsByChapter = "chapter".equals(tocSource.getAttribute(XMLString.TEXT_INDEX_SCOPE));
|
||||
|
||||
// traverse the source to collect templates
|
||||
Node child = tocSource.getFirstChild();
|
||||
while (child!=null) {
|
||||
if (child.getNodeType()==Node.ELEMENT_NODE) {
|
||||
Element elm = (Element) child;
|
||||
if (XMLString.TEXT_INDEX_TITLE_TEMPLATE.equals(elm.getTagName())) {
|
||||
indexTitleTemplate = elm;
|
||||
}
|
||||
if (XMLString.TEXT_TABLE_OF_CONTENT_ENTRY_TEMPLATE.equals(elm.getTagName())) {
|
||||
int nLevel = Misc.getPosInteger(elm.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1);
|
||||
if (1<=nLevel && nLevel<=10) { tocEntryTemplate[nLevel] = elm; }
|
||||
}
|
||||
if (XMLString.TEXT_INDEX_SOURCE_STYLES.equals(elm.getTagName())) {
|
||||
int nLevel = Misc.getPosInteger(elm.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1);
|
||||
if (1<=nLevel && nLevel<=10) {
|
||||
// traverse to collect index source styles for this level
|
||||
Node child1 = elm.getFirstChild();
|
||||
while (child1!=null) {
|
||||
if (child1.getNodeType()==Node.ELEMENT_NODE) {
|
||||
Element elm1 = (Element) child1;
|
||||
if (XMLString.TEXT_INDEX_SOURCE_STYLE.equals(elm1.getTagName())) {
|
||||
String sIndexSourceStyle = Misc.getAttribute(elm1,XMLString.TEXT_STYLE_NAME);
|
||||
if (sIndexSourceStyle!=null) {
|
||||
indexSourceStyles.put(sIndexSourceStyle,new Integer(nLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
child1 = child1.getNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>Get the (section) name for this toc </p>
|
||||
* @return the name of the toc
|
||||
*/
|
||||
public String getName() { return sName; }
|
||||
|
||||
/** <p>Get the (section) style name for this toc </p>
|
||||
* @return name of the section style to use for this toc
|
||||
*/
|
||||
public String getStyleName() { return sStyleName; }
|
||||
|
||||
/** <p>Get max outline level for this toc </p>
|
||||
* @return max outline level
|
||||
*/
|
||||
public int getOutlineLevel() { return nOutlineLevel; }
|
||||
|
||||
/** <p>Do we use outline (headings) in this toc? </p>
|
||||
* @return true if headings should be used
|
||||
*/
|
||||
public boolean useOutlineLevel() { return bUseOutlineLevel; }
|
||||
|
||||
/** <p>Do we use additional styles in this toc? </p>
|
||||
* @return true if additional styles should be used
|
||||
*/
|
||||
public boolean useIndexSourceStyles() { return bUseIndexSourceStyles; }
|
||||
|
||||
/** <p>Do we use toc marks in this toc? </p>
|
||||
* @return true if toc marks should be used
|
||||
*/
|
||||
public boolean useIndexMarks() { return bUseIndexMarks; }
|
||||
|
||||
/** <p>Is this toc by chapter? </p>
|
||||
* @return true if the scope is a chapter only
|
||||
*/
|
||||
public boolean isByChapter() { return bIsByChapter; }
|
||||
|
||||
/** <p>Get the index title template for this toc</p>
|
||||
* @return the <code>text:index-title-template</code> element, or null
|
||||
*/
|
||||
public Element getIndexTitleTemplate() { return indexTitleTemplate; }
|
||||
|
||||
/** <p>Get the entry template for this toc at a specific level</p>
|
||||
* @param nLevel the outline level
|
||||
* @return the <code>text:table-of-content-entry-template</code> element, or null
|
||||
*/
|
||||
public Element getTocEntryTemplate(int nLevel) {
|
||||
if (1<=nLevel && nLevel<=10) { return tocEntryTemplate[nLevel]; }
|
||||
else { return null; }
|
||||
}
|
||||
|
||||
/** <p>Get a set view of all index source styles</p>
|
||||
* @return a set of all index source style names
|
||||
*/
|
||||
public Set getIndexSourceStyles() { return indexSourceStyles.keySet(); }
|
||||
|
||||
/** <p>Get the level associated with a specific index source style</p>
|
||||
* @param sStyleName the style name of the index source style
|
||||
* @return the level or -1 if the style is not used in this toc
|
||||
*/
|
||||
public int getIndexSourceStyleLevel(String sStyleName) {
|
||||
if (indexSourceStyles.containsKey(sStyleName)) {
|
||||
return ((Integer) indexSourceStyles.get(sStyleName)).intValue();
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/** <p>Return the generated content of this toc, if available</p>
|
||||
* @return the <code>text:index-body</code> element
|
||||
*/
|
||||
public Element getIndexBody() { return indexBody; }
|
||||
|
||||
|
||||
}
|
447
source/java/writer2latex/office/XMLString.java
Normal file
447
source/java/writer2latex/office/XMLString.java
Normal file
|
@ -0,0 +1,447 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* XMLString.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-11-10)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.office;
|
||||
|
||||
/* XML strings (tags and attributes) in the OOo XML namespaces
|
||||
* typosafe but not typesafe :-)
|
||||
*/
|
||||
|
||||
public class XMLString {
|
||||
// draw namespace - elements
|
||||
public static final String DRAW_="draw:";
|
||||
public static final String DRAW_PAGE="draw:page";
|
||||
public static final String DRAW_A="draw:a";
|
||||
public static final String DRAW_FRAME="draw:frame"; // oasis
|
||||
public static final String DRAW_IMAGE="draw:image";
|
||||
public static final String DRAW_OBJECT="draw:object";
|
||||
public static final String DRAW_OBJECT_OLE="draw:object-ole";
|
||||
public static final String DRAW_TEXT_BOX="draw:text-box";
|
||||
public static final String DRAW_G="draw:g";
|
||||
public static final String DRAW_CONTROL="draw:control";
|
||||
// draw namespace - attributes
|
||||
public static final String DRAW_NAME="draw:name";
|
||||
public static final String DRAW_STYLE_NAME="draw:style-name";
|
||||
public static final String DRAW_TEXT_STYLE_NAME="draw:text-style-name";
|
||||
public static final String DRAW_MASTER_PAGE_NAME="draw:master-page-name";
|
||||
public static final String DRAW_FILL_COLOR="draw:fill-color";
|
||||
|
||||
// dc namespace - elements
|
||||
public static final String DC_CREATOR="dc:creator";
|
||||
public static final String DC_DATE="dc:date";
|
||||
public static final String DC_DESCRIPTION="dc:description";
|
||||
public static final String DC_LANGUAGE="dc:language";
|
||||
public static final String DC_SUBJECT="dc:subject";
|
||||
public static final String DC_TITLE="dc:title";
|
||||
|
||||
// meta namespace - elements
|
||||
public static final String META_INITIAL_CREATOR="meta:initial-creator";
|
||||
public static final String META_KEYWORDS="meta:keywords";
|
||||
public static final String META_KEYWORD="meta:keyword";
|
||||
|
||||
// manifest namespace
|
||||
public static final String MANIFEST_FILE_ENTRY="manifest:file-entry";
|
||||
public static final String MANIFEST_MEDIA_TYPE="manifest:media-type";
|
||||
public static final String MANIFEST_FULL_PATH="manifest:full-path";
|
||||
|
||||
// office namespace - elements
|
||||
public static final String OFFICE_DOCUMENT_CONTENT="office:document-content";
|
||||
public static final String OFFICE_MASTER_STYLES="office:master-styles";
|
||||
public static final String OFFICE_STYLES="office:styles";
|
||||
public static final String OFFICE_AUTOMATIC_STYLES="office:automatic-styles";
|
||||
public static final String OFFICE_FONT_DECLS="office:font-decls";
|
||||
public static final String OFFICE_FONT_FACE_DECLS="office:font-face-decls"; // oasis
|
||||
public static final String OFFICE_BODY="office:body";
|
||||
public static final String OFFICE_TEXT="office:text"; // oasis
|
||||
public static final String OFFICE_SPREADSHEET="office:spreadsheet"; // oasis
|
||||
public static final String OFFICE_PRESENTATION="office:presentation"; // oasis
|
||||
public static final String OFFICE_FORMS="office:forms";
|
||||
public static final String OFFICE_ANNOTATION="office:annotation";
|
||||
public static final String OFFICE_BINARY_DATA="office:binary-data";
|
||||
public static final String OFFICE_META="office:meta";
|
||||
// office namespace - attributes
|
||||
public static final String OFFICE_TARGET_FRAME_NAME="office:target-frame-name";
|
||||
public static final String OFFICE_NAME="office:name";
|
||||
public static final String OFFICE_VALUE_TYPE="office:value-type"; // oasis
|
||||
|
||||
// form namespace - elements
|
||||
public static final String FORM_FORM="form:form";
|
||||
public static final String FORM_CONTROL="form:control";
|
||||
public static final String FORM_TEXT="form:text";
|
||||
public static final String FORM_PASSWORD="form:password";
|
||||
public static final String FORM_FILE="form:file";
|
||||
public static final String FORM_IMAGE="form:image";
|
||||
public static final String FORM_HIDDEN="form:hidden";
|
||||
public static final String FORM_CHECKBOX="form:checkbox";
|
||||
public static final String FORM_RADIO="form:radio";
|
||||
public static final String FORM_BUTTON="form:button";
|
||||
public static final String FORM_FIXED_TEXT="form:fixed-text";
|
||||
public static final String FORM_TEXTAREA="form:textarea";
|
||||
public static final String FORM_LISTBOX="form:listbox";
|
||||
public static final String FORM_COMBOBOX="form:combobox";
|
||||
public static final String FORM_ITEM="form:item";
|
||||
public static final String FORM_OPTION="form:option";
|
||||
// form namespace - attributes
|
||||
public static final String FORM_NAME="form:name";
|
||||
public static final String FORM_ID="form:id";
|
||||
public static final String FORM_METHOD="form:method";
|
||||
public static final String FORM_TYPE="form:type";
|
||||
public static final String FORM_BUTTON_TYPE="form:button-type";
|
||||
public static final String FORM_DISABLED="form:disabled";
|
||||
public static final String FORM_READONLY="form:readonly";
|
||||
public static final String FORM_DEFAULT_VALUE="form:default-value";
|
||||
public static final String FORM_VALUE="form:value";
|
||||
public static final String FORM_TAB_INDEX="form:tab-index";
|
||||
public static final String FORM_TITLE="form:title";
|
||||
public static final String FORM_MAX_LENGTH="form:max-length";
|
||||
public static final String FORM_MULTIPLE="form:multiple";
|
||||
public static final String FORM_SELECTED="form:selected";
|
||||
public static final String FORM_LABEL="form:label";
|
||||
public static final String FORM_SIZE="form:size";
|
||||
|
||||
// presentation namespace - attributes
|
||||
public static final String PRESENTATION_CLASS="presentation:class";
|
||||
public static final String PRESENTATION_STYLE_NAME="presentation:style-name";
|
||||
|
||||
// style namespace - elements
|
||||
public static final String STYLE_PAGE_MASTER="style:page-master";
|
||||
public static final String STYLE_PAGE_LAYOUT="style:page-layout"; // oasis
|
||||
public static final String STYLE_MASTER_PAGE="style:master-page";
|
||||
public static final String STYLE_FONT_DECL="style:font-decl";
|
||||
public static final String STYLE_FONT_FACE="style:font-face"; // oasis
|
||||
public static final String STYLE_STYLE="style:style";
|
||||
public static final String STYLE_DEFAULT_STYLE="style:default-style";
|
||||
public static final String STYLE_PROPERTIES="style:properties";
|
||||
public static final String STYLE_TEXT_PROPERTIES="style:text-properties"; // oasis
|
||||
public static final String STYLE_PARAGRAPH_PROPERTIES="style:paragraph-properties"; // oasis
|
||||
public static final String STYLE_SECTION_PROPERTIES="style:section-properties"; // oasis
|
||||
public static final String STYLE_TABLE_PROPERTIES="style:table-properties"; // oasis
|
||||
public static final String STYLE_TABLE_ROW_PROPERTIES="style:table-row-properties"; // oasis
|
||||
public static final String STYLE_TABLE_COLUMN_PROPERTIES="style:table-column-properties"; // oasis
|
||||
public static final String STYLE_TABLE_CELL_PROPERTIES="style:table-cell-properties"; // oasis
|
||||
public static final String STYLE_GRAPHIC_PROPERTIES="style:graphic-properties"; // oasis
|
||||
public static final String STYLE_PAGE_LAYOUT_PROPERTIES="style:page-layout-properties"; // oasis
|
||||
public static final String STYLE_DRAWING_PAGE_PROPERTIES="style:drawing-page-properties"; // oasis
|
||||
public static final String STYLE_HEADER_FOOTER_PROPERTIES="style:header-footer-properties"; // oasis
|
||||
public static final String STYLE_BACKGROUND_IMAGE="style:background-image";
|
||||
public static final String STYLE_COLUMNS="style:columns";
|
||||
public static final String STYLE_HEADER="style:header";
|
||||
public static final String STYLE_HEADER_LEFT="style:header-left";
|
||||
public static final String STYLE_FOOTER="style:footer";
|
||||
public static final String STYLE_FOOTER_LEFT="style:footer-left";
|
||||
public static final String STYLE_FOOTNOTE_SEP="style:footnote-sep";
|
||||
public static final String STYLE_HEADER_STYLE="style:header-style";
|
||||
public static final String STYLE_FOOTER_STYLE="style:footer-style";
|
||||
// style namespace - attributes
|
||||
public static final String STYLE_NEXT_STYLE_NAME="style:next-style-name";
|
||||
public static final String STYLE_DISPLAY_NAME="style:display-name";
|
||||
public static final String STYLE_PAGE_MASTER_NAME="style:page-master-name";
|
||||
public static final String STYLE_PAGE_LAYOUT_NAME="style:page-layout-name"; // oasis
|
||||
public static final String STYLE_MASTER_PAGE_NAME="style:master-page-name";
|
||||
public static final String STYLE_PAGE_USAGE="style:page-usage";
|
||||
public static final String STYLE_PAGE_NUMBER="style:page-number";
|
||||
public static final String STYLE_FONT_FAMILY_COMPLEX="style:font-family-complex";
|
||||
public static final String STYLE_FONT_NAME="style:font-name";
|
||||
public static final String STYLE_FONT_NAME_COMPLEX="style:font-name-complex";
|
||||
public static final String STYLE_FONT_PITCH="style:font-pitch";
|
||||
public static final String STYLE_FONT_FAMILY_GENERIC="style:font-family-generic";
|
||||
public static final String STYLE_TEXT_BACKGROUND_COLOR="style:text-background-color";
|
||||
public static final String STYLE_USE_WINDOW_FONT_COLOR="style:use-window-font-color";
|
||||
public static final String STYLE_TEXT_CROSSING_OUT="style:text-crossing-out";
|
||||
public static final String STYLE_TEXT_UNDERLINE="style:text-underline";
|
||||
public static final String STYLE_TEXT_BLINKING="style:text-blinking";
|
||||
public static final String STYLE_TEXT_LINE_THROUGH_STYLE="style:text-line-through-style"; // oasis
|
||||
public static final String STYLE_TEXT_UNDERLINE_STYLE="style:text-underline-style"; // oasis
|
||||
public static final String STYLE_AUTO_TEXT_INDENT="style:auto-text-indent";
|
||||
public static final String STYLE_TEXT_ALIGN_SOURCE="style:text-align-source";
|
||||
public static final String STYLE_NAME="style:name";
|
||||
public static final String STYLE_PARENT_STYLE_NAME="style:parent-style-name";
|
||||
public static final String STYLE_FAMILY="style:family";
|
||||
public static final String STYLE_TEXT_POSITION="style:text-position";
|
||||
public static final String STYLE_LIST_STYLE_NAME="style:list-style-name";
|
||||
public static final String STYLE_LIST_LEVEL_PROPERTIES="style:list-level-properties";
|
||||
public static final String STYLE_NUM_PREFIX="style:num-prefix";
|
||||
public static final String STYLE_NUM_SUFFIX="style:num-suffix";
|
||||
public static final String STYLE_NUM_FORMAT="style:num-format";
|
||||
public static final String STYLE_VERTICAL_ALIGN="style:vertical-align";
|
||||
public static final String STYLE_MAY_BREAK_BETWEEN_ROWS="style:may-break-between-rows";
|
||||
public static final String STYLE_HORIZONTAL_POS="style:horizontal-pos";
|
||||
public static final String STYLE_WRAP="style:wrap";
|
||||
public static final String STYLE_COLUMN_WIDTH="style:column-width";
|
||||
public static final String STYLE_REL_COLUMN_WIDTH="style:rel-column-width";
|
||||
public static final String STYLE_ROW_HEIGHT="style:row-height";
|
||||
public static final String STYLE_MIN_ROW_HEIGHT="style:min-row-height";
|
||||
public static final String STYLE_FIRST_PAGE_NUMBER="style:first-page-number";
|
||||
public static final String STYLE_DISTANCE_BEFORE_SEP="style:distance-before-sep";
|
||||
public static final String STYLE_DISTANCE_AFTER_SEP="style:distance-after-sep";
|
||||
public static final String STYLE_WIDTH="style:width";
|
||||
public static final String STYLE_REL_WIDTH="style:rel-width";
|
||||
public static final String STYLE_COLOR="style:color";
|
||||
public static final String STYLE_WRITING_MODE="style:writing-mode";
|
||||
public static final String STYLE_REPEAT="style:repeat";
|
||||
public static final String STYLE_POSITION="style:position";
|
||||
public static final String STYLE_ADJUSTMENT="style:adjustment";
|
||||
|
||||
// table namespace - elements
|
||||
public static final String TABLE_="table:";
|
||||
public static final String TABLE_TABLE="table:table";
|
||||
public static final String TABLE_SUB_TABLE="table:sub-table";
|
||||
public static final String TABLE_SHAPES="table:shapes";
|
||||
public static final String TABLE_TABLE_COLUMN="table:table-column";
|
||||
public static final String TABLE_TABLE_COLUMNS="table:table-columns";
|
||||
public static final String TABLE_TABLE_COLUMN_GROUP="table:table-column-group";
|
||||
public static final String TABLE_TABLE_HEADER_COLUMNS="table:table-header-columns";
|
||||
public static final String TABLE_TABLE_ROW="table:table-row";
|
||||
public static final String TABLE_TABLE_ROWS="table:table-rows";
|
||||
public static final String TABLE_TABLE_ROW_GROUP="table:table-row-group";
|
||||
public static final String TABLE_TABLE_HEADER_ROWS="table:table-header-rows";
|
||||
public static final String TABLE_TABLE_CELL="table:table-cell";
|
||||
public static final String TABLE_COVERED_TABLE_CELL="table:covered-table-cell";
|
||||
// table namespace - attributes
|
||||
public static final String TABLE_NAME="table:name";
|
||||
public static final String TABLE_IS_SUB_TABLE="table:is-sub-table"; // oasis
|
||||
public static final String TABLE_STYLE_NAME="table:style-name";
|
||||
public static final String TABLE_VISIBILITY="table:visibility";
|
||||
public static final String TABLE_DISPLAY="table:display";
|
||||
public static final String TABLE_DEFAULT_CELL_STYLE_NAME="table:default-cell-style-name";
|
||||
public static final String TABLE_VALUE_TYPE="table:value-type";
|
||||
public static final String TABLE_NUMBER_COLUMNS_REPEATED="table:number-columns-repeated";
|
||||
public static final String TABLE_NUMBER_ROWS_REPEATED="table:number-rows-repeated";
|
||||
public static final String TABLE_NUMBER_ROWS_SPANNED="table:number-rows-spanned";
|
||||
public static final String TABLE_NUMBER_COLUMNS_SPANNED="table:number-columns-spanned";
|
||||
public static final String TABLE_ALIGN="table:align";
|
||||
public static final String TABLE_PRINT="table:print";
|
||||
public static final String TABLE_PRINT_RANGES="table:print-ranges";
|
||||
|
||||
// text namespace - elements (declarations)
|
||||
public static final String TEXT_="text:";
|
||||
public static final String TEXT_FOOTNOTES_CONFIGURATION="text:footnotes-configuration";
|
||||
public static final String TEXT_ENDNOTES_CONFIGURATION="text:endnotes-configuration";
|
||||
public static final String TEXT_NOTES_CONFIGURATION="text:notes-configuration"; // oasis
|
||||
public static final String TEXT_SECTION_SOURCE="text:section-source";
|
||||
public static final String TEXT_SEQUENCE_DECLS="text:sequence-decls";
|
||||
public static final String TEXT_SEQUENCE_DECL="text:sequence-decl";
|
||||
public static final String TEXT_OUTLINE_STYLE="text:outline-style";
|
||||
public static final String TEXT_LIST_STYLE="text:list-style";
|
||||
public static final String TEXT_LIST_LEVEL_STYLE_NUMBER="text:list-level-style-number";
|
||||
public static final String TEXT_LIST_LEVEL_STYLE_BULLET="text:list-level-style-bullet";
|
||||
public static final String TEXT_LIST_LEVEL_STYLE_IMAGE="text:list-level-style-image";
|
||||
// text namespace - elements (block text)
|
||||
public static final String TEXT_SECTION="text:section";
|
||||
public static final String TEXT_P="text:p";
|
||||
public static final String TEXT_H="text:h";
|
||||
public static final String TEXT_LIST="text:list"; // oasis
|
||||
public static final String TEXT_ORDERED_LIST="text:ordered-list";
|
||||
public static final String TEXT_UNORDERED_LIST="text:unordered-list";
|
||||
public static final String TEXT_LIST_ITEM="text:list-item";
|
||||
public static final String TEXT_LIST_HEADER="text:list-header";
|
||||
public static final String TEXT_ALPHABETICAL_INDEX="text:alphabetical-index";
|
||||
public static final String TEXT_ALPHABETICAL_INDEX_SOURCE="text:alphabetical-index-source";
|
||||
public static final String TEXT_ALPHABETICAL_INDEX_ENTRY_TEMPLATE="text:alphabetical-index-entry-template";
|
||||
public static final String TEXT_TABLE_OF_CONTENT="text:table-of-content";
|
||||
public static final String TEXT_TABLE_OF_CONTENT_SOURCE="text:table-of-content-source";
|
||||
public static final String TEXT_TABLE_OF_CONTENT_ENTRY_TEMPLATE="text:table-of-content-entry-template";
|
||||
public static final String TEXT_INDEX_SOURCE_STYLES="text:index-source-styles";
|
||||
public static final String TEXT_INDEX_SOURCE_STYLE="text:index-source-style";
|
||||
public static final String TEXT_ILLUSTRATION_INDEX="text:illustration-index";
|
||||
public static final String TEXT_ILLUSTRATION_INDEX_SOURCE="text:illustration-index-source";
|
||||
public static final String TEXT_ILLUSTRATION_INDEX_ENTRY_TEMPLATE="text:illustration-index-entry-template";
|
||||
public static final String TEXT_TABLE_INDEX="text:table-index";
|
||||
public static final String TEXT_TABLE_INDEX_SOURCE="text:table-index-source";
|
||||
public static final String TEXT_TABLE_INDEX_ENTRY_TEMPLATE="text:table-index-entry-template";
|
||||
public static final String TEXT_OBJECT_INDEX="text:object-index";
|
||||
public static final String TEXT_USER_INDEX="text:user-index";
|
||||
public static final String TEXT_BIBLIOGRAPHY="text:bibliography";
|
||||
public static final String TEXT_INDEX_TITLE_TEMPLATE="text:index-title-template";
|
||||
public static final String TEXT_INDEX_BODY="text:index-body";
|
||||
public static final String TEXT_INDEX_TITLE="text:index-title";
|
||||
public static final String TEXT_INDEX_SOURCE="text:index-source";
|
||||
// text namespace - elements (inline text)
|
||||
public static final String TEXT_SPAN="text:span";
|
||||
public static final String TEXT_FOOTNOTE="text:footnote";
|
||||
public static final String TEXT_ENDNOTE="text:endnote";
|
||||
public static final String TEXT_NOTE="text:note"; // oasis
|
||||
public static final String TEXT_FOOTNOTE_CITATION="text:footnote-citation";
|
||||
public static final String TEXT_FOOTNOTE_BODY="text:footnote-body";
|
||||
public static final String TEXT_ENDNOTE_CITATION="text:endnote-citation";
|
||||
public static final String TEXT_ENDNOTE_BODY="text:endnote-body";
|
||||
public static final String TEXT_NOTE_CITATION="text:note-citation"; // oasis
|
||||
public static final String TEXT_NOTE_BODY="text:note-body"; // oasis
|
||||
public static final String TEXT_S="text:s";
|
||||
public static final String TEXT_TAB_STOP="text:tab-stop";
|
||||
public static final String TEXT_TAB="text:tab"; // oasis
|
||||
public static final String TEXT_A="text:a";
|
||||
public static final String TEXT_LINE_BREAK="text:line-break";
|
||||
public static final String TEXT_PAGE_NUMBER="text:page-number";
|
||||
public static final String TEXT_PAGE_COUNT="text:page-count";
|
||||
public static final String TEXT_CHAPTER="text:chapter";
|
||||
public static final String TEXT_SEQUENCE="text:sequence";
|
||||
public static final String TEXT_SEQUENCE_REF="text:sequence-ref";
|
||||
public static final String TEXT_BIBLIOGRAPHY_MARK="text:bibliography-mark";
|
||||
public static final String TEXT_ALPHABETICAL_INDEX_MARK="text:alphabetical-index-mark";
|
||||
public static final String TEXT_ALPHABETICAL_INDEX_MARK_START="text:alphabetical-index-mark-start";
|
||||
public static final String TEXT_ALPHABETICAL_INDEX_MARK_END="text:alphabetical-index-mark-end";
|
||||
public static final String TEXT_TOC_MARK="text:toc-mark";
|
||||
public static final String TEXT_TOC_MARK_START="text:toc-mark-start";
|
||||
public static final String TEXT_TOC_MARK_END="text:toc-mark-end";
|
||||
public static final String TEXT_REFERENCE_MARK="text:reference-mark";
|
||||
public static final String TEXT_REFERENCE_MARK_START="text:reference-mark-start";
|
||||
public static final String TEXT_REFERENCE_REF="text:reference-ref";
|
||||
public static final String TEXT_BOOKMARK="text:bookmark";
|
||||
public static final String TEXT_BOOKMARK_START="text:bookmark-start";
|
||||
public static final String TEXT_BOOKMARK_REF="text:bookmark-ref";
|
||||
public static final String TEXT_FOOTNOTE_REF="text:footnote-ref";
|
||||
public static final String TEXT_ENDNOTE_REF="text:endnote-ref";
|
||||
public static final String TEXT_NOTE_REF="text:note-ref"; // oasis
|
||||
// text namespace - attributes
|
||||
public static final String TEXT_USE_OUTLINE_LEVEL="text:use-outline-level";
|
||||
public static final String TEXT_USE_INDEX_SOURCE_STYLES="text:use-index-source-styles";
|
||||
public static final String TEXT_USE_INDEX_MARKS="text:use-index-marks";
|
||||
public static final String TEXT_INDEX_SCOPE="text:index-scope";
|
||||
public static final String TEXT_OUTLINE_LEVEL="text:outline-level";
|
||||
public static final String TEXT_IS_LIST_HEADER="text:is-list-header";
|
||||
public static final String TEXT_USE_CAPTION="text:use-caption";
|
||||
public static final String TEXT_CAPTION_SEQUENCE_NAME="text:caption-sequence-name";
|
||||
public static final String TEXT_STRING_VALUE="text:string-value";
|
||||
public static final String TEXT_KEY1="text:key1";
|
||||
public static final String TEXT_KEY2="text:key2";
|
||||
public static final String TEXT_LEVEL="text:level";
|
||||
public static final String TEXT_SPACE_BEFORE="text:space-before";
|
||||
public static final String TEXT_MIN_LABEL_WIDTH="text:min-label-width";
|
||||
public static final String TEXT_MIN_LABEL_DISTANCE="text:min-label-distance";
|
||||
public static final String TEXT_STYLE_NAME="text:style-name";
|
||||
public static final String TEXT_VISITED_STYLE_NAME="text:visited-style-name";
|
||||
public static final String TEXT_DISPLAY_LEVELS="text:display-levels";
|
||||
public static final String TEXT_CONTINUE_NUMBERING="text:continue-numbering";
|
||||
public static final String TEXT_C="text:c";
|
||||
public static final String TEXT_ID="text:id";
|
||||
public static final String TEXT_LABEL="text:label";
|
||||
public static final String TEXT_NAME="text:name";
|
||||
public static final String TEXT_REFERENCE_FORMAT="text:reference-format";
|
||||
public static final String TEXT_REF_NAME="text:ref-name";
|
||||
public static final String TEXT_FORMULA="text:formula";
|
||||
public static final String TEXT_NOTE_CLASS="text:note-class";
|
||||
public static final String TEXT_CITATION_BODY_STYLE_NAME="text:citation-body-style-name";
|
||||
public static final String TEXT_CITATION_STYLE_NAME="text:citation-style-name";
|
||||
public static final String TEXT_DEFAULT_STYLE_NAME="text:default-style-name";
|
||||
public static final String TEXT_START_VALUE="text:start-value";
|
||||
public static final String TEXT_START_NUMBERING_AT="text:start-numbering-at";
|
||||
public static final String TEXT_RESTART_NUMBERING="text:restart-numbering";
|
||||
public static final String TEXT_ANCHOR_TYPE="text:anchor-type";
|
||||
public static final String TEXT_BULLET_CHAR="text:bullet-char";
|
||||
public static final String TEXT_DISPLAY="text:display";
|
||||
public static final String TEXT_DISPLAY_OUTLINE_LEVEL="text:display-outline-level";
|
||||
public static final String TEXT_SEPARATION_CHARACTER="text:separation-character";
|
||||
|
||||
public static final String TEXT_IDENTIFIER="text:identifier";
|
||||
public static final String TEXT_BIBLIOGRAPHY_TYPE="text:bibliography-type";
|
||||
public static final String TEXT_BIBILIOGRAPHIC_TYPE="text:bibiliographic-type"; // bug in OOo 1.0
|
||||
public static final String TEXT_ADDRESS="text:address";
|
||||
public static final String TEXT_ANNOTE="text:annote";
|
||||
public static final String TEXT_AUTHOR="text:author";
|
||||
public static final String TEXT_BOOKTITLE="text:booktitle";
|
||||
//public static final String TEXT_CHAPTER="text:chapter";
|
||||
public static final String TEXT_EDITION="text:edition";
|
||||
public static final String TEXT_EDITOR="text:editor";
|
||||
public static final String TEXT_HOWPUBLISHED="text:howpublished";
|
||||
public static final String TEXT_INSTITUTION="text:institution";
|
||||
public static final String TEXT_JOURNAL="text:journal";
|
||||
public static final String TEXT_MONTH="text:month";
|
||||
// public static final String TEXT_NOTE="text:note"; defined above as an element name
|
||||
public static final String TEXT_NUMBER="text:number";
|
||||
public static final String TEXT_ORGANIZATIONS="text:organizations";
|
||||
public static final String TEXT_PAGES="text:pages";
|
||||
public static final String TEXT_PUBLISHER="text:publisher";
|
||||
public static final String TEXT_SCHOOL="text:school";
|
||||
public static final String TEXT_SERIES="text:series";
|
||||
public static final String TEXT_TITLE="text:title";
|
||||
public static final String TEXT_REPORT_TYPE="text:report-type";
|
||||
public static final String TEXT_VOLUME="text:volume";
|
||||
public static final String TEXT_YEAR="text:year";
|
||||
public static final String TEXT_URL="text:url";
|
||||
public static final String TEXT_CUSTOM1="text:custom1";
|
||||
public static final String TEXT_CUSTOM2="text:custom2";
|
||||
public static final String TEXT_CUSTOM3="text:custom3";
|
||||
public static final String TEXT_CUSTOM4="text:custom4";
|
||||
public static final String TEXT_CUSTOM5="text:custom5";
|
||||
public static final String TEXT_ISBN="text:isbn";
|
||||
|
||||
// fo namespace
|
||||
public static final String FO_LANGUAGE="fo:language";
|
||||
public static final String FO_COUNTRY="fo:country";
|
||||
public static final String FO_TEXT_SHADOW="fo:text-shadow";
|
||||
public static final String FO_COLOR="fo:color";
|
||||
public static final String FO_BACKGROUND_COLOR="fo:background-color";
|
||||
public static final String FO_TEXT_TRANSFORM="fo:text-transform";
|
||||
public static final String FO_FONT_FAMILY="fo:font-family";
|
||||
public static final String FO_FONT_SIZE="fo:font-size";
|
||||
public static final String FO_FONT_WEIGHT="fo:font-weight";
|
||||
public static final String FO_FONT_VARIANT="fo:font-variant";
|
||||
public static final String FO_FONT_STYLE="fo:font-style";
|
||||
public static final String FO_LETTER_SPACING="fo:letter-spacing";
|
||||
public static final String FO_VERTICAL_ALIGN="fo:vertical-align";
|
||||
public static final String FO_TEXT_ALIGN="fo:text-align";
|
||||
public static final String FO_TEXT_ALIGN_LAST="fo:text-align-last";
|
||||
public static final String FO_BREAK_BEFORE="fo:break-before";
|
||||
public static final String FO_BREAK_AFTER="fo:break-after";
|
||||
public static final String FO_MARGIN_LEFT="fo:margin-left";
|
||||
public static final String FO_MARGIN_RIGHT="fo:margin-right";
|
||||
public static final String FO_MARGIN_TOP="fo:margin-top";
|
||||
public static final String FO_MARGIN_BOTTOM="fo:margin-bottom";
|
||||
public static final String FO_PAGE_WIDTH="fo:page-width";
|
||||
public static final String FO_PAGE_HEIGHT="fo:page-height";
|
||||
public static final String FO_MIN_HEIGHT="fo:min-height";
|
||||
public static final String FO_BORDER="fo:border";
|
||||
public static final String FO_BORDER_LEFT="fo:border-left";
|
||||
public static final String FO_BORDER_RIGHT="fo:border-right";
|
||||
public static final String FO_BORDER_TOP="fo:border-top";
|
||||
public static final String FO_BORDER_BOTTOM="fo:border-bottom";
|
||||
public static final String FO_PADDING="fo:padding";
|
||||
public static final String FO_PADDING_LEFT="fo:padding-left";
|
||||
public static final String FO_PADDING_RIGHT="fo:padding-right";
|
||||
public static final String FO_PADDING_TOP="fo:padding-top";
|
||||
public static final String FO_PADDING_BOTTOM="fo:padding-bottom";
|
||||
public static final String FO_LINE_HEIGHT="fo:line-height";
|
||||
public static final String FO_TEXT_INDENT="fo:text-indent";
|
||||
public static final String FO_WRAP_OPTION="fo:wrap-option";
|
||||
public static final String FO_COLUMN_COUNT="fo:column-count";
|
||||
|
||||
// svg namespace
|
||||
public static final String SVG_DESC="svg:desc";
|
||||
|
||||
public static final String SVG_FONT_FAMILY="svg:font-family"; // oasis (font declarations only)
|
||||
public static final String SVG_X="svg:x";
|
||||
public static final String SVG_Y="svg:y";
|
||||
public static final String SVG_HEIGHT="svg:height";
|
||||
public static final String SVG_WIDTH="svg:width";
|
||||
// xlink namespace
|
||||
public static final String XLINK_HREF="xlink:href";
|
||||
// math namespace
|
||||
public static final String MATH_MATH="math:math";
|
||||
public static final String MATH_SEMANTICS="math:semantics";
|
||||
public static final String MATH_ANNOTATION="math:annotation";
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue