Examples of OdfElement


Examples of org.odftoolkit.odfdom.pkg.OdfElement

      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

Examples of org.odftoolkit.odfdom.pkg.OdfElement

  }

  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

Examples of org.odftoolkit.odfdom.pkg.OdfElement

  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

Examples of org.odftoolkit.odfdom.pkg.OdfElement

      File file = new File(filePath);
      TextDocument tdocument = TextDocument.loadDocument(file);
      Assert.assertNotNull(tdocument);
     
      TableContainer tablecon = tdocument.getTableContainerImpl();
      OdfElement odfeleA = tablecon.getTableContainerElement();
      OdfElement odfeleB = tdocument.getTableContainerElement();
      Assert.assertEquals(odfeleA, odfeleB);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfElement

  @Test
  public void testTextSelectionContainerElement() {
    search = new TextNavigation("TextSelectionContainer", doc);
    if (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      OdfElement container = item.getContainerElement();
      Node childNode = container.getFirstChild();
      while (childNode != null) {
        String containerText = childNode.getTextContent();
        Assert.assertFalse(container.getTextContent().equals(containerText));
        childNode = childNode.getNextSibling();
      }
    } else {
      Assert.fail("Navigation search nothing.");
    }
    // test selected table cell content in draw:frame.
    search = new TextNavigation("Task", doc);
    if (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      OdfElement container = item.getContainerElement();
      Node childNode = container.getFirstChild();
      while (childNode != null) {
        String containerText = childNode.getTextContent();
        Assert.assertFalse(container.getTextContent().equals(containerText));
        childNode = childNode.getNextSibling();
      }
    } else {
      Assert.fail("Navigation search nothing.");
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfElement

     
      //save
      //doc.save(ResourceUtilities.getAbsolutePath(TEXT_FILE));
     
      //validate
      OdfElement parentElement = item.getContainerElement();
      Node node = parentElement.getFirstChild().getFirstChild().getNextSibling();
      TextAElement textAele = (TextAElement)node;
      System.out.println(textAele.getXlinkTypeAttribute());
      System.out.println(textAele.getXlinkHrefAttribute());
      Assert.assertEquals("simple", textAele.getXlinkTypeAttribute());
      Assert.assertEquals("http://www.IBM.com", textAele.getXlinkHrefAttribute());
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfElement

     * @param positionItem
     *            the position item
     */
    public synchronized static 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

Examples of org.odftoolkit.odfdom.pkg.OdfElement

     *            the pasted item
     * @param positionItem
     *            the position item
     */
    public synchronized static void refreshAfterPasteAtEndOf(Selection item, Selection positionItem) {
      OdfElement element = positionItem.getElement();
      int positionIndex;
      if (positionItem instanceof TextSelection) {
        positionIndex = positionItem.getIndex() + ((TextSelection) positionItem).getText().length();
      } else {
        positionIndex = positionItem.getIndex();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfElement

     *
     * @param item
     *            <code>Selection</code> item
     */
    public static void unregisterItem(Selection item) {
      OdfElement element = item.getElement();
      if (repository.containsKey(element)) {
        Vector<Selection> selections = repository.get(element);
        selections.remove(item);
      }
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfElement

    }
    return variableField;
  }

  public VariableField getVariableFieldByName(String name) {
    OdfElement containerElement = getVariableContainerElement();
    TextVariableDeclsElement simpleVariableElements = OdfElement.findFirstChildNode(TextVariableDeclsElement.class,
        containerElement);
    if (simpleVariableElements != null) {
      TextVariableDeclElement simpleVariableElement = (TextVariableDeclElement) simpleVariableElements
          .getFirstChild();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.