Examples of OdfFileDom


Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

      mTextboxContainerImpl = new TextboxContainerImpl();
    return mTextboxContainerImpl;
  }

  static void appendTextElements(OdfElement ownerElement, String content, boolean isWhitespaceCollapsed) {
    OdfFileDom ownerDocument = (OdfFileDom) ownerElement.getOwnerDocument();
    if (isWhitespaceCollapsed) {
      int i = 0, length = content.length();
      String str = "";
      while (i < length) {
        char ch = content.charAt(i);
        if (ch == ' ') {
          int j = 1;
          i++;
          while ((i < length) && (content.charAt(i) == ' ')) {
            j++;
            i++;
          }
          if (j == 1) {
            str += ' ';
          } else {
            str += ' ';
            Text textnode = ownerDocument.createTextNode(str);
            ownerElement.appendChild(textnode);
            str = "";
            TextSElement spaceElement = ownerDocument.newOdfElement(TextSElement.class);
            ownerElement.appendChild(spaceElement);
            spaceElement.setTextCAttribute(j - 1);
          }
        } else if (ch == '\n') {
          if (str.length() > 0) {
            Text textnode = ownerDocument.createTextNode(str);
            ownerElement.appendChild(textnode);
            str = "";
          }
          TextLineBreakElement lineBreakElement = ownerDocument.newOdfElement(TextLineBreakElement.class);
          ownerElement.appendChild(lineBreakElement);
          i++;
        } else if (ch == '\t') {
          if (str.length() > 0) {
            Text textnode = ownerElement.getOwnerDocument().createTextNode(str);
            ownerElement.appendChild(textnode);
            str = "";
          }
          TextTabElement tabElement = ownerDocument.newOdfElement(TextTabElement.class);
          ownerElement.appendChild(tabElement);
          i++;
        } else if (ch == '\r') {
          i++;
        } else {
          str += ch;
          i++;
        }
      }
      if (str.length() > 0) {
        Text textnode = ownerDocument.createTextNode(str);
        ownerElement.appendChild(textnode);
      }
    } else {
      Text textnode = ownerDocument.createTextNode(content);
      ownerElement.appendChild(textnode);
    }
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

    }
    NodeList nodeList = headerEle.getElementsByTagName(TextPElement.ELEMENT_NAME.getQName());
    for (int i = 0; i < nodeList.getLength(); i++) {
      TextPElement textEle = (TextPElement) nodeList.item(i);
      String stylename = textEle.getStyleName();
      OdfFileDom dom = (OdfFileDom) headerEle.getOwnerDocument();
      OdfOfficeAutomaticStyles styles = null;
      if (dom instanceof OdfContentDom) {
        styles = ((OdfContentDom) dom).getAutomaticStyles();
      } else if (dom instanceof OdfStylesDom) {
        styles = ((OdfStylesDom) dom).getAutomaticStyles();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

    }
    return variableContainerImpl;
  }

  private void updateTableToNone(Table table) {
    OdfFileDom dom = (OdfFileDom) getTableContainerElement().getOwnerDocument();
    TableTableElement tableEle = table.getOdfElement();
    String stylename = tableEle.getStyleName();
    OdfOfficeAutomaticStyles styles = null;
    if (dom instanceof OdfContentDom) {
      styles = ((OdfContentDom) dom).getAutomaticStyles();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

    }
    NodeList nodeList = footerEle.getElementsByTagName(TextPElement.ELEMENT_NAME.getQName());
    for (int i = 0; i < nodeList.getLength(); i++) {
      TextPElement textEle = (TextPElement) nodeList.item(i);
      String stylename = textEle.getStyleName();
      OdfFileDom dom = (OdfFileDom) footerEle.getOwnerDocument();
      OdfOfficeAutomaticStyles styles = null;
      if (dom instanceof OdfContentDom) {
        styles = ((OdfContentDom) dom).getAutomaticStyles();
      } else if (dom instanceof OdfStylesDom) {
        styles = ((OdfStylesDom) dom).getAutomaticStyles();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

    }
    return variableContainerImpl;
  }

  private void updateTableToNone(Table table) {
    OdfFileDom dom = (OdfFileDom) getTableContainerElement().getOwnerDocument();
    TableTableElement tableEle = table.getOdfElement();
    String stylename = tableEle.getStyleName();
    OdfOfficeAutomaticStyles styles = null;
    if (dom instanceof OdfContentDom) {
      styles = ((OdfContentDom) dom).getAutomaticStyles();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

   *            the paragraph container that contains this paragraph.
   */
  public static Paragraph newParagraph(ParagraphContainer container) {
    Paragraph para = null;
    OdfElement parent = container.getParagraphContainerElement();
    OdfFileDom ownerDom = (OdfFileDom) parent.getOwnerDocument();
    TextPElement pEle = ownerDom.newOdfElement(TextPElement.class);
    parent.appendChild(pEle);
    para = new Paragraph(pEle);
    Component.registerComponent(para, pEle);

    return para;
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

   *            be used.
   * @since 0.6.5
   */
  public void addComment(String content, String creator) {
    // create annotation element.
    OdfFileDom dom = (OdfFileDom) getOdfElement().getOwnerDocument();
    OfficeAnnotationElement annotationElement = (OfficeAnnotationElement) OdfXMLFactory.newOdfElement(dom, OdfName
        .newName(OdfDocumentNamespace.OFFICE, "annotation"));
    getOdfElement().insertBefore(annotationElement, getOdfElement().getFirstChild());
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

   *            the paragraph container that contains this paragraph.
   */
  public static Paragraph newParagraph(ParagraphContainer container) {
    Paragraph para = null;
    OdfElement parent = container.getParagraphContainerElement();
    OdfFileDom ownerDom = (OdfFileDom) parent.getOwnerDocument();
    TextPElement pEle = ownerDom.newOdfElement(TextPElement.class);
    parent.appendChild(pEle);
    para = new Paragraph(pEle);
    Component.registerComponent(para, pEle);

    return para;
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

   *            be used.
   * @since 0.6.5
   */
  public void addComment(String content, String creator) {
    // create annotation element.
    OdfFileDom dom = (OdfFileDom) getOdfElement().getOwnerDocument();
    OfficeAnnotationElement annotationElement = (OfficeAnnotationElement) OdfXMLFactory.newOdfElement(dom, OdfName
        .newName(OdfDocumentNamespace.OFFICE, "annotation"));
    getOdfElement().insertBefore(annotationElement, getOdfElement().getFirstChild());
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom

    // loads the ODF document from the path
    Document odfDoc = Document.loadDocument(ResourceUtilities
        .getTestResourceAsStream("TestEmpty_OdfTextDocument.odt"));

    // get the ODF content as DOM tree representation
    OdfFileDom odfContent = odfDoc.getContentDom();

    // // W3C XPath initialization ''(JDK5 functionality)'' - XPath is
    // the path within the XML file
    // // (Find XPath examples here:
    // http://www.w3.org/TR/xpath#path-abbrev)
    XPath xpath2 = odfContent.getXPath();

    // receiving the first paragraph "//text:p[1]" ''(JDK5
    // functionality)''
    TextPElement para = (TextPElement) xpath2.evaluate("//text:p[1]", odfContent, XPathConstants.NODE);
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.