TableTableElement.java

/**
 * **********************************************************************
 *
 * <p>DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
 *
 * <p>Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved.
 *
 * <p>Use is subject to license terms.
 *
 * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0. You can also obtain a copy of the License at
 * http://odftoolkit.org/docs/license.txt
 *
 * <p>Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied.
 *
 * <p>See the License for the specific language governing permissions and limitations under the
 * License.
 *
 * <p>**********************************************************************
 */

/*
 * This file is automatically generated.
 * Don't edit manually.
 */
package org.odftoolkit.odfdom.dom.element.table;

import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.odftoolkit.odfdom.dom.DefaultElementVisitor;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.dom.attribute.table.TableIsSubTableAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableNameAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TablePrintAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TablePrintRangesAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableProtectedAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableProtectionKeyAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableProtectionKeyDigestAlgorithmAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableStyleNameAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableTemplateNameAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableUseBandingColumnsStylesAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableUseBandingRowsStylesAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableUseFirstColumnStylesAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableUseFirstRowStylesAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableUseLastColumnStylesAttribute;
import org.odftoolkit.odfdom.dom.attribute.table.TableUseLastRowStylesAttribute;
import org.odftoolkit.odfdom.dom.attribute.xml.XmlIdAttribute;
import org.odftoolkit.odfdom.dom.element.OdfStylableElement;
import org.odftoolkit.odfdom.dom.element.office.OfficeDdeSourceElement;
import org.odftoolkit.odfdom.dom.element.office.OfficeFormsElement;
import org.odftoolkit.odfdom.dom.element.text.TextSoftPageBreakElement;
import org.odftoolkit.odfdom.dom.style.OdfStyleFamily;
import org.odftoolkit.odfdom.pkg.ElementVisitor;
import org.odftoolkit.odfdom.pkg.OdfFileDom;
import org.odftoolkit.odfdom.pkg.OdfName;

/** DOM implementation of OpenDocument element {@odf.element table:table}. */
public class TableTableElement extends OdfStylableElement {

  public static final OdfName ELEMENT_NAME = OdfName.newName(OdfDocumentNamespace.TABLE, "table");

  /**
   * Create the instance of <code>TableTableElement</code>
   *
   * @param ownerDoc The type is <code>OdfFileDom</code>
   */
  public TableTableElement(OdfFileDom ownerDoc) {
    super(
        ownerDoc,
        ELEMENT_NAME,
        OdfStyleFamily.Table,
        OdfName.newName(OdfDocumentNamespace.TABLE, "style-name"));
  }

  /**
   * Get the element name
   *
   * @return return <code>OdfName</code> the name of element {@odf.element table:table}.
   */
  public OdfName getOdfName() {
    return ELEMENT_NAME;
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableIsSubTableAttribute</code>
   * , See {@odf.attribute table:is-sub-table}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableIsSubTableAttribute() {
    TableIsSubTableAttribute attr =
        (TableIsSubTableAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "is-sub-table");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableIsSubTableAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableIsSubTableAttribute</code> , See
   * {@odf.attribute table:is-sub-table}
   *
   * @param tableIsSubTableValue The type is <code>Boolean</code>
   */
  public void setTableIsSubTableAttribute(Boolean tableIsSubTableValue) {
    TableIsSubTableAttribute attr = new TableIsSubTableAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableIsSubTableValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableNameAttribute</code> , See
   * {@odf.attribute table:name}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getTableNameAttribute() {
    TableNameAttribute attr =
        (TableNameAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "name");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return null;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableNameAttribute</code> , See
   * {@odf.attribute table:name}
   *
   * @param tableNameValue The type is <code>String</code>
   */
  public void setTableNameAttribute(String tableNameValue) {
    TableNameAttribute attr = new TableNameAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(tableNameValue);
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TablePrintAttribute</code> ,
   * See {@odf.attribute table:print}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTablePrintAttribute() {
    TablePrintAttribute attr =
        (TablePrintAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "print");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TablePrintAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TablePrintAttribute</code> , See
   * {@odf.attribute table:print}
   *
   * @param tablePrintValue The type is <code>Boolean</code>
   */
  public void setTablePrintAttribute(Boolean tablePrintValue) {
    TablePrintAttribute attr = new TablePrintAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tablePrintValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TablePrintRangesAttribute
   * </code> , See {@odf.attribute table:print-ranges}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getTablePrintRangesAttribute() {
    TablePrintRangesAttribute attr =
        (TablePrintRangesAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "print-ranges");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return null;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TablePrintRangesAttribute</code> , See
   * {@odf.attribute table:print-ranges}
   *
   * @param tablePrintRangesValue The type is <code>String</code>
   */
  public void setTablePrintRangesAttribute(String tablePrintRangesValue) {
    TablePrintRangesAttribute attr = new TablePrintRangesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(tablePrintRangesValue);
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableProtectedAttribute</code>
   * , See {@odf.attribute table:protected}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableProtectedAttribute() {
    TableProtectedAttribute attr =
        (TableProtectedAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "protected");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableProtectedAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableProtectedAttribute</code> , See
   * {@odf.attribute table:protected}
   *
   * @param tableProtectedValue The type is <code>Boolean</code>
   */
  public void setTableProtectedAttribute(Boolean tableProtectedValue) {
    TableProtectedAttribute attr = new TableProtectedAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableProtectedValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableProtectionKeyAttribute
   * </code> , See {@odf.attribute table:protection-key}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getTableProtectionKeyAttribute() {
    TableProtectionKeyAttribute attr =
        (TableProtectionKeyAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "protection-key");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return null;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableProtectionKeyAttribute</code> ,
   * See {@odf.attribute table:protection-key}
   *
   * @param tableProtectionKeyValue The type is <code>String</code>
   */
  public void setTableProtectionKeyAttribute(String tableProtectionKeyValue) {
    TableProtectionKeyAttribute attr =
        new TableProtectionKeyAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(tableProtectionKeyValue);
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>
   * TableProtectionKeyDigestAlgorithmAttribute</code> , See {@odf.attribute
   * table:protection-key-digest-algorithm}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getTableProtectionKeyDigestAlgorithmAttribute() {
    TableProtectionKeyDigestAlgorithmAttribute attr =
        (TableProtectionKeyDigestAlgorithmAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "protection-key-digest-algorithm");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return TableProtectionKeyDigestAlgorithmAttribute.DEFAULT_VALUE;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>
   * TableProtectionKeyDigestAlgorithmAttribute</code> , See {@odf.attribute
   * table:protection-key-digest-algorithm}
   *
   * @param tableProtectionKeyDigestAlgorithmValue The type is <code>String</code>
   */
  public void setTableProtectionKeyDigestAlgorithmAttribute(
      String tableProtectionKeyDigestAlgorithmValue) {
    TableProtectionKeyDigestAlgorithmAttribute attr =
        new TableProtectionKeyDigestAlgorithmAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(tableProtectionKeyDigestAlgorithmValue);
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableStyleNameAttribute</code>
   * , See {@odf.attribute table:style-name}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getTableStyleNameAttribute() {
    TableStyleNameAttribute attr =
        (TableStyleNameAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "style-name");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return null;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableStyleNameAttribute</code> , See
   * {@odf.attribute table:style-name}
   *
   * @param tableStyleNameValue The type is <code>String</code>
   */
  public void setTableStyleNameAttribute(String tableStyleNameValue) {
    TableStyleNameAttribute attr = new TableStyleNameAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(tableStyleNameValue);
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableTemplateNameAttribute
   * </code> , See {@odf.attribute table:template-name}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getTableTemplateNameAttribute() {
    TableTemplateNameAttribute attr =
        (TableTemplateNameAttribute) getOdfAttribute(OdfDocumentNamespace.TABLE, "template-name");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return null;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableTemplateNameAttribute</code> , See
   * {@odf.attribute table:template-name}
   *
   * @param tableTemplateNameValue The type is <code>String</code>
   */
  public void setTableTemplateNameAttribute(String tableTemplateNameValue) {
    TableTemplateNameAttribute attr =
        new TableTemplateNameAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(tableTemplateNameValue);
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>
   * TableUseBandingColumnsStylesAttribute</code> , See {@odf.attribute
   * table:use-banding-columns-styles}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableUseBandingColumnsStylesAttribute() {
    TableUseBandingColumnsStylesAttribute attr =
        (TableUseBandingColumnsStylesAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "use-banding-columns-styles");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableUseBandingColumnsStylesAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableUseBandingColumnsStylesAttribute
   * </code> , See {@odf.attribute table:use-banding-columns-styles}
   *
   * @param tableUseBandingColumnsStylesValue The type is <code>Boolean</code>
   */
  public void setTableUseBandingColumnsStylesAttribute(Boolean tableUseBandingColumnsStylesValue) {
    TableUseBandingColumnsStylesAttribute attr =
        new TableUseBandingColumnsStylesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableUseBandingColumnsStylesValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>
   * TableUseBandingRowsStylesAttribute</code> , See {@odf.attribute table:use-banding-rows-styles}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableUseBandingRowsStylesAttribute() {
    TableUseBandingRowsStylesAttribute attr =
        (TableUseBandingRowsStylesAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "use-banding-rows-styles");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableUseBandingRowsStylesAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableUseBandingRowsStylesAttribute
   * </code> , See {@odf.attribute table:use-banding-rows-styles}
   *
   * @param tableUseBandingRowsStylesValue The type is <code>Boolean</code>
   */
  public void setTableUseBandingRowsStylesAttribute(Boolean tableUseBandingRowsStylesValue) {
    TableUseBandingRowsStylesAttribute attr =
        new TableUseBandingRowsStylesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableUseBandingRowsStylesValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>
   * TableUseFirstColumnStylesAttribute</code> , See {@odf.attribute table:use-first-column-styles}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableUseFirstColumnStylesAttribute() {
    TableUseFirstColumnStylesAttribute attr =
        (TableUseFirstColumnStylesAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "use-first-column-styles");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableUseFirstColumnStylesAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableUseFirstColumnStylesAttribute
   * </code> , See {@odf.attribute table:use-first-column-styles}
   *
   * @param tableUseFirstColumnStylesValue The type is <code>Boolean</code>
   */
  public void setTableUseFirstColumnStylesAttribute(Boolean tableUseFirstColumnStylesValue) {
    TableUseFirstColumnStylesAttribute attr =
        new TableUseFirstColumnStylesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableUseFirstColumnStylesValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableUseFirstRowStylesAttribute
   * </code> , See {@odf.attribute table:use-first-row-styles}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableUseFirstRowStylesAttribute() {
    TableUseFirstRowStylesAttribute attr =
        (TableUseFirstRowStylesAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "use-first-row-styles");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableUseFirstRowStylesAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableUseFirstRowStylesAttribute</code>
   * , See {@odf.attribute table:use-first-row-styles}
   *
   * @param tableUseFirstRowStylesValue The type is <code>Boolean</code>
   */
  public void setTableUseFirstRowStylesAttribute(Boolean tableUseFirstRowStylesValue) {
    TableUseFirstRowStylesAttribute attr =
        new TableUseFirstRowStylesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableUseFirstRowStylesValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>
   * TableUseLastColumnStylesAttribute</code> , See {@odf.attribute table:use-last-column-styles}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableUseLastColumnStylesAttribute() {
    TableUseLastColumnStylesAttribute attr =
        (TableUseLastColumnStylesAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "use-last-column-styles");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableUseLastColumnStylesAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableUseLastColumnStylesAttribute
   * </code> , See {@odf.attribute table:use-last-column-styles}
   *
   * @param tableUseLastColumnStylesValue The type is <code>Boolean</code>
   */
  public void setTableUseLastColumnStylesAttribute(Boolean tableUseLastColumnStylesValue) {
    TableUseLastColumnStylesAttribute attr =
        new TableUseLastColumnStylesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableUseLastColumnStylesValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>TableUseLastRowStylesAttribute
   * </code> , See {@odf.attribute table:use-last-row-styles}
   *
   * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
   *     set and no default value defined.
   */
  public Boolean getTableUseLastRowStylesAttribute() {
    TableUseLastRowStylesAttribute attr =
        (TableUseLastRowStylesAttribute)
            getOdfAttribute(OdfDocumentNamespace.TABLE, "use-last-row-styles");
    if (attr != null) {
      return Boolean.valueOf(attr.booleanValue());
    }
    return Boolean.valueOf(TableUseLastRowStylesAttribute.DEFAULT_VALUE);
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>TableUseLastRowStylesAttribute</code> ,
   * See {@odf.attribute table:use-last-row-styles}
   *
   * @param tableUseLastRowStylesValue The type is <code>Boolean</code>
   */
  public void setTableUseLastRowStylesAttribute(Boolean tableUseLastRowStylesValue) {
    TableUseLastRowStylesAttribute attr =
        new TableUseLastRowStylesAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setBooleanValue(tableUseLastRowStylesValue.booleanValue());
  }

  /**
   * Receives the value of the ODFDOM attribute representation <code>XmlIdAttribute</code> , See
   * {@odf.attribute xml:id}
   *
   * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
   *     and no default value defined.
   */
  public String getXmlIdAttribute() {
    XmlIdAttribute attr = (XmlIdAttribute) getOdfAttribute(OdfDocumentNamespace.XML, "id");
    if (attr != null) {
      return String.valueOf(attr.getValue());
    }
    return null;
  }

  /**
   * Sets the value of ODFDOM attribute representation <code>XmlIdAttribute</code> , See
   * {@odf.attribute xml:id}
   *
   * @param xmlIdValue The type is <code>String</code>
   */
  public void setXmlIdAttribute(String xmlIdValue) {
    XmlIdAttribute attr = new XmlIdAttribute((OdfFileDom) this.ownerDocument);
    setOdfAttribute(attr);
    attr.setValue(xmlIdValue);
  }

  /**
   * Create child element {@odf.element office:dde-source}.
   *
   * @param officeDdeApplicationValue the <code>String</code> value of <code>
   *     OfficeDdeApplicationAttribute</code>, see {@odf.attribute office:dde-application} at
   *     specification
   * @param officeDdeItemValue the <code>String</code> value of <code>OfficeDdeItemAttribute</code>,
   *     see {@odf.attribute office:dde-item} at specification
   * @param officeDdeTopicValue the <code>String</code> value of <code>OfficeDdeTopicAttribute
   *     </code>, see {@odf.attribute office:dde-topic} at specification
   * @return the element {@odf.element office:dde-source}
   */
  public OfficeDdeSourceElement newOfficeDdeSourceElement(
      String officeDdeApplicationValue, String officeDdeItemValue, String officeDdeTopicValue) {
    OfficeDdeSourceElement officeDdeSource =
        ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeDdeSourceElement.class);
    officeDdeSource.setOfficeDdeApplicationAttribute(officeDdeApplicationValue);
    officeDdeSource.setOfficeDdeItemAttribute(officeDdeItemValue);
    officeDdeSource.setOfficeDdeTopicAttribute(officeDdeTopicValue);
    this.appendChild(officeDdeSource);
    return officeDdeSource;
  }

  /**
   * Create child element {@odf.element office:forms}.
   *
   * @return the element {@odf.element office:forms}
   */
  public OfficeFormsElement newOfficeFormsElement() {
    OfficeFormsElement officeForms =
        ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeFormsElement.class);
    this.appendChild(officeForms);
    return officeForms;
  }

  /**
   * Create child element {@odf.element table:desc}.
   *
   * <p>Child element is new in Odf 1.2
   *
   * @return the element {@odf.element table:desc}
   */
  public TableDescElement newTableDescElement() {
    TableDescElement tableDesc =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableDescElement.class);
    this.appendChild(tableDesc);
    return tableDesc;
  }

  /**
   * Create child element {@odf.element table:named-expressions}.
   *
   * <p>Child element is new in Odf 1.2
   *
   * @return the element {@odf.element table:named-expressions}
   */
  public TableNamedExpressionsElement newTableNamedExpressionsElement() {
    TableNamedExpressionsElement tableNamedExpressions =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableNamedExpressionsElement.class);
    this.appendChild(tableNamedExpressions);
    return tableNamedExpressions;
  }

  /**
   * Create child element {@odf.element table:scenario}.
   *
   * @param tableIsActiveValue the <code>Boolean</code> value of <code>TableIsActiveAttribute</code>
   *     , see {@odf.attribute table:is-active} at specification
   * @param tableScenarioRangesValue the <code>String</code> value of <code>
   *     TableScenarioRangesAttribute</code>, see {@odf.attribute table:scenario-ranges} at
   *     specification
   * @return the element {@odf.element table:scenario}
   */
  public TableScenarioElement newTableScenarioElement(
      boolean tableIsActiveValue, String tableScenarioRangesValue) {
    TableScenarioElement tableScenario =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableScenarioElement.class);
    tableScenario.setTableIsActiveAttribute(tableIsActiveValue);
    tableScenario.setTableScenarioRangesAttribute(tableScenarioRangesValue);
    this.appendChild(tableScenario);
    return tableScenario;
  }

  /**
   * Create child element {@odf.element table:shapes}.
   *
   * @return the element {@odf.element table:shapes}
   */
  public TableShapesElement newTableShapesElement() {
    TableShapesElement tableShapes =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableShapesElement.class);
    this.appendChild(tableShapes);
    return tableShapes;
  }

  /**
   * Create child element {@odf.element table:table-column}.
   *
   * @return the element {@odf.element table:table-column}
   */
  public TableTableColumnElement newTableTableColumnElement() {
    TableTableColumnElement tableTableColumn =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableColumnElement.class);
    this.appendChild(tableTableColumn);
    return tableTableColumn;
  }

  /**
   * Create child element {@odf.element table:table-column-group}.
   *
   * @return the element {@odf.element table:table-column-group}
   */
  public TableTableColumnGroupElement newTableTableColumnGroupElement() {
    TableTableColumnGroupElement tableTableColumnGroup =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableColumnGroupElement.class);
    this.appendChild(tableTableColumnGroup);
    return tableTableColumnGroup;
  }

  /**
   * Create child element {@odf.element table:table-columns}.
   *
   * @return the element {@odf.element table:table-columns}
   */
  public TableTableColumnsElement newTableTableColumnsElement() {
    TableTableColumnsElement tableTableColumns =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableColumnsElement.class);
    this.appendChild(tableTableColumns);
    return tableTableColumns;
  }

  /**
   * Create child element {@odf.element table:table-header-columns}.
   *
   * @return the element {@odf.element table:table-header-columns}
   */
  public TableTableHeaderColumnsElement newTableTableHeaderColumnsElement() {
    TableTableHeaderColumnsElement tableTableHeaderColumns =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableHeaderColumnsElement.class);
    this.appendChild(tableTableHeaderColumns);
    return tableTableHeaderColumns;
  }

  /**
   * Create child element {@odf.element table:table-header-rows}.
   *
   * @return the element {@odf.element table:table-header-rows}
   */
  public TableTableHeaderRowsElement newTableTableHeaderRowsElement() {
    TableTableHeaderRowsElement tableTableHeaderRows =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableHeaderRowsElement.class);
    this.appendChild(tableTableHeaderRows);
    return tableTableHeaderRows;
  }

  /**
   * Create child element {@odf.element table:table-row}.
   *
   * @return the element {@odf.element table:table-row}
   */
  public TableTableRowElement newTableTableRowElement() {
    TableTableRowElement tableTableRow =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableRowElement.class);
    this.appendChild(tableTableRow);
    return tableTableRow;
  }

  /**
   * Create child element {@odf.element table:table-row-group}.
   *
   * @return the element {@odf.element table:table-row-group}
   */
  public TableTableRowGroupElement newTableTableRowGroupElement() {
    TableTableRowGroupElement tableTableRowGroup =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableRowGroupElement.class);
    this.appendChild(tableTableRowGroup);
    return tableTableRowGroup;
  }

  /**
   * Create child element {@odf.element table:table-rows}.
   *
   * @return the element {@odf.element table:table-rows}
   */
  public TableTableRowsElement newTableTableRowsElement() {
    TableTableRowsElement tableTableRows =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableRowsElement.class);
    this.appendChild(tableTableRows);
    return tableTableRows;
  }

  /**
   * Create child element {@odf.element table:table-source}.
   *
   * @param xlinkHrefValue the <code>String</code> value of <code>XlinkHrefAttribute</code>, see
   *     {@odf.attribute xlink:href} at specification
   * @param xlinkTypeValue the <code>String</code> value of <code>XlinkTypeAttribute</code>, see
   *     {@odf.attribute xlink:type} at specification
   * @return the element {@odf.element table:table-source}
   */
  public TableTableSourceElement newTableTableSourceElement(
      String xlinkHrefValue, String xlinkTypeValue) {
    TableTableSourceElement tableTableSource =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTableSourceElement.class);
    tableTableSource.setXlinkHrefAttribute(xlinkHrefValue);
    tableTableSource.setXlinkTypeAttribute(xlinkTypeValue);
    this.appendChild(tableTableSource);
    return tableTableSource;
  }

  /**
   * Create child element {@odf.element table:title}.
   *
   * <p>Child element is new in Odf 1.2
   *
   * @return the element {@odf.element table:title}
   */
  public TableTitleElement newTableTitleElement() {
    TableTitleElement tableTitle =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TableTitleElement.class);
    this.appendChild(tableTitle);
    return tableTitle;
  }

  /**
   * Create child element {@odf.element text:soft-page-break}.
   *
   * @return the element {@odf.element text:soft-page-break}
   */
  public TextSoftPageBreakElement newTextSoftPageBreakElement() {
    TextSoftPageBreakElement textSoftPageBreak =
        ((OdfFileDom) this.ownerDocument).newOdfElement(TextSoftPageBreakElement.class);
    this.appendChild(textSoftPageBreak);
    return textSoftPageBreak;
  }

  @Override
  public void accept(ElementVisitor visitor) {
    if (visitor instanceof DefaultElementVisitor) {
      DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor;
      defaultVisitor.visit(this);
    } else {
      visitor.visit(this);
    }
  }

  @Override
  /**
   * If this element is the first - perhaps only - element of a logical group of XML elements. For
   * instance: table, paragraph
   */
  public boolean isComponentRoot() {
    return true;
  }
  /**
   * Caching the width of columns during insert/delete column as after an UNDO setAttributes is
   * called too early even before the column was undone
   */
  // WORK AROUND for "UNDO COLUMN WIDTH" problem (see JsonOperationConsumer for further changes)
  private List<JSONArray> mColumnWidthCache = null;
  /** OH PLEASE DELETE ME AFTER THE API WAS FIXED */
  public void pushTableGrid(JSONArray tableGrid) {
    if (mColumnWidthCache == null) {
      mColumnWidthCache = new ArrayList<JSONArray>();
    }
    mColumnWidthCache.add(tableGrid);
  }

  private JSONArray mTablePositionOfColumnChange;

  public void requireLaterWidthChange(JSONArray start) {
    mTablePositionOfColumnChange = start;
  }

  public boolean isWidthChangeRequired() {
    return mTablePositionOfColumnChange != null;
  }

  public void hasChangedWidth() {
    mTablePositionOfColumnChange = null;
  }

  public JSONArray getPosition() {
    return mTablePositionOfColumnChange;
  }

  /** OH PLEASE DELETE ME AFTER THE API WAS FIXED */
  public void pushTableGrid(List<Integer> columnWidths) {
    if (columnWidths != null && !columnWidths.isEmpty()) {
      this.pushTableGrid(new JSONArray(columnWidths));
    }
  }

  /** OH PLEASE DELETE ME AFTER THE API WAS FIXED */
  public JSONArray popTableGrid() {
    JSONArray previousColumnWidth = null;
    if (mColumnWidthCache != null && mColumnWidthCache.size() > 0) {
      previousColumnWidth = mColumnWidthCache.remove(mColumnWidthCache.size() - 1);
      mTablePositionOfColumnChange = null;
    }
    return previousColumnWidth;
  }

  /** OH PLEASE DELETE ME AFTER THE API WAS FIXED */
  public void replaceLastTableGrid(JSONArray tableGrid) {
    if (mColumnWidthCache == null) {
      mColumnWidthCache = new ArrayList<JSONArray>();
      mColumnWidthCache.add(tableGrid);
    } else if (mColumnWidthCache.size() > 0) {
      mColumnWidthCache.remove(mColumnWidthCache.size() - 1);
    }
    mColumnWidthCache.add(tableGrid);
  }
}