Package org.odftoolkit.odfdom.pkg

Examples of org.odftoolkit.odfdom.pkg.OdfElement


    /**
     * Register the selection item
     * @param item  the selection item
     */
    static public void registerItem(Selection item) {
      OdfElement element = item.getElement();
      if (repository.containsKey(element)) {
        Vector<Selection> selections = repository.get(element);
        int i = 0;
        while (i < selections.size()) {
          if (selections.get(i).getIndex() > item.getIndex()) {
View Full Code Here


     * Refresh the selections in repository after a item is cut.
     * @param cutItem  the cut item
     */
    synchronized static public void refreshAfterCut(Selection cutItem) {
      //travase the whole sub tree
      OdfElement element = cutItem.getElement();
      if (repository.containsKey(element)) {
        Vector<Selection> selections = repository.get(element);
        for (int i = 0; i < selections.size(); i++) {
          if (selections.get(i).getIndex() > cutItem.getIndex()) {
            selections.get(i).refreshAfterFrontalDelete(cutItem);
View Full Code Here

     * @param item  the pasted item
     * @param positionItem  the position item
     */
    synchronized static public void refreshAfterPasteAtFrontOf(Selection item, Selection positionItem) {
      //travase the whole sub tree
      OdfElement element = positionItem.getElement();
      if (repository.containsKey(element)) {
        Vector<Selection> selections = repository.get(element);
        for (int i = 0; i < selections.size(); i++) {
          if (selections.get(i).getIndex() >= positionItem.getIndex()) {
            selections.get(i).refreshAfterFrontalInsert(item);
View Full Code Here

     * Refresh the selections in repository after a pastedAtEndOf operation is called.
     * @param item  the pasted item
     * @param positionItem  the position item
     */
    synchronized static public void refreshAfterPasteAtEndOf(Selection item, Selection positionItem) {
      OdfElement element = positionItem.getElement();
      int positionIndex;

      if (positionItem instanceof TextSelection) {
        positionIndex = positionItem.getIndex() + ((TextSelection) positionItem).getText().length();
      } else {
View Full Code Here

   * @param search
   * @param rootNode
   */
  private void matchLines(TextNavigation search, Node rootNode) {
    //NodeList list = doc.getContentDom().getElementsByTagName("text:p");
    OdfElement match = (OdfElement) search.getNextMatchElement(rootNode);
    Assert.assertNotNull(match);
    Assert.assertEquals("Task2.delete next paragraph", TextExtractor.getText(match));

    match = (OdfElement) search.getNextMatchElement(match);
    Assert.assertNotNull(match);
View Full Code Here

  //////////////////////////////////////// private methods ///////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
  private TableContentValidationElement getContentValidationEle() throws Exception {
    Document ownerDocument = getOwnerDocument();
    OdfElement contentRootElement = ownerDocument.getContentRoot();
    TableContentValidationsElement validations = OdfElement.findFirstChildNode(
        TableContentValidationsElement.class, contentRootElement);
    if (validations == null) {
      validations = (TableContentValidationsElement) OdfXMLFactory.newOdfElement(ownerDocument
          .getContentDom(), OdfName.newName(OdfDocumentNamespace.TABLE, "content-validations"));
      contentRootElement.insertBefore(validations, contentRootElement.getFirstChild());
    }
    String validationName = getOdfElement().getTableContentValidationNameAttribute();
    TableContentValidationElement validationElement = null;
    if (validationName != null) {
      Node child = validations.getFirstChild();
View Full Code Here

  public Column appendColumn() {
    List<Column> columnList = getColumnList();
    int columnCount = columnList.size();

    TableTableColumnElement newColumn;
    OdfElement positonElement = getRowElementByIndex(0);
    if (positonElement.getParentNode() instanceof TableTableHeaderRowsElement) {
      positonElement = (OdfElement) positonElement.getParentNode();
    }

    // Moved before column elements inserted
    // insert cells firstly
    // Or else, wrong column number will be gotten in updateCellRepository,
View Full Code Here

      mIsSpreadsheet = false;
    }
  }

  private static Document getOwnerDocument(TableContainer tableContainer) {
    OdfElement containerElement = tableContainer.getTableContainerElement();
    OdfFileDom ownerDocument = (OdfFileDom) containerElement.getOwnerDocument();
    return (Document) ownerDocument.getDocument();
  }
View Full Code Here

  }

  private static TableTableElement createTable(TableContainer container, int numRows, int numCols,
      int headerRowNumber, int headerColumnNumber, double marginLeft, double marginRight) throws Exception {
    Document document = getOwnerDocument(container);
    OdfElement containerElement = container.getTableContainerElement();
    OdfFileDom dom = (OdfFileDom) containerElement.getOwnerDocument();
    double tableWidth = getTableWidth(container, marginLeft, marginRight);

    boolean isTextDocument = document instanceof TextDocument;

    // check arguments
View Full Code Here

   * @return the default value as <code>String</code> dependent of its element name
   *         return <code>null</code> if the default value does not exist
   */
  @Override
  public String getDefault() {
    OdfElement parentElement = (OdfElement)getOwnerElement();
    String defaultValue = null;
    if (parentElement != null) {
      defaultValue=DEFAULT_VALUE;
    }
    return defaultValue;
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.pkg.OdfElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.