Package org.odftoolkit.odfdom.dom

Examples of org.odftoolkit.odfdom.dom.OdfContentDom


    boolean duplicated = false;
    try {
      // try if the font has been defined.
      Document mDocument = ((Document) ((OdfFileDom) mElement.getOwnerDocument()).getDocument());
      // find <office:font-face-decls> in content dom
      OdfContentDom contentDom = mDocument.getContentDom();
      OfficeFontFaceDeclsElement fontfaceDecls = OdfElement.findFirstChildNode(OfficeFontFaceDeclsElement.class,
          contentDom.getRootElement());
      if (fontfaceDecls == null) {
        // find <office:font-face-decls> in style dom
        OdfStylesDom styleDom = mDocument.getStylesDom();
        fontfaceDecls = OdfElement.findFirstChildNode(OfficeFontFaceDeclsElement.class, styleDom
            .getRootElement());
        if (fontfaceDecls == null)
          fontfaceDecls = contentDom.getRootElement().newOfficeFontFaceDeclsElement();
      }

      NodeList list = fontfaceDecls.getElementsByTagName("style:font-face");
      for (int i = 0; i < list.getLength(); i++) {
        StyleFontFaceElement node = (StyleFontFaceElement) list.item(i);
View Full Code Here


  public Section appendSection(String name) {
    TextSectionElement newSectionEle = null;
    try {
      Document doc = (Document) ((OdfFileDom) footerEle
          .getOwnerDocument()).getDocument();
      OdfContentDom contentDocument = doc.getContentDom();
      OdfOfficeAutomaticStyles styles = contentDocument
          .getAutomaticStyles();
      OdfStyle style = styles.newStyle(OdfStyleFamily.Section);
      StyleSectionPropertiesElement sProperties = style
          .newStyleSectionPropertiesElement();
      sProperties.setTextDontBalanceTextColumnsAttribute(false);
View Full Code Here

   *
   * @param doc
   *            the Document which this BulletDecorator will be used on.
   */
  public BulletDecorator(Document doc) {
    OdfContentDom contentDocument;
    try {
      contentDocument = doc.getContentDom();
      styles = contentDocument.getAutomaticStyles();
      OdfOfficeStyles documentStyles = doc.getDocumentStyles();
      listStyle = styles.getListStyle(DEFAULT_NAME);
      // create bullet style
      if (listStyle == null) {
        listStyle = styles.newListStyle();
View Full Code Here

  public Section appendSection(String name) {
    TextSectionElement newSectionEle = null;
    try {
      Document doc = (Document) ((OdfFileDom) headerEle
          .getOwnerDocument()).getDocument();
      OdfContentDom contentDocument = doc.getContentDom();
      OdfOfficeAutomaticStyles styles = contentDocument
          .getAutomaticStyles();
      OdfStyle style = styles.newStyle(OdfStyleFamily.Section);
      StyleSectionPropertiesElement sProperties = style
          .newStyleSectionPropertiesElement();
      sProperties.setTextDontBalanceTextColumnsAttribute(false);
View Full Code Here

      super(doc);
      sdoc = (TextDocument) doc;
    }

    protected DrawFrameElement getChartFrame() throws Exception {
      OdfContentDom contentDom2 = sdoc.getContentDom();
      DrawFrameElement drawFrame = contentDom2.newOdfElement(DrawFrameElement.class);
      TextPElement lastPara = sdoc.getContentRoot().newTextPElement();
      lastPara.appendChild(drawFrame);
      drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      return drawFrame;
    }
View Full Code Here

   * @since 0.6
   */
  public Table appendSheet(Table refTable, String name) {
    TableTableElement refTableElement = refTable.getOdfElement();
    try {
      OdfContentDom contentDom = getContentDom();
      TableTableElement newTableEle = (TableTableElement) (refTableElement.cloneNode(true));
      // not in a same document
      if (refTableElement.getOwnerDocument() != contentDom) {
        Document ownerDocument = refTable.getOwnerDocument();
        copyLinkedRefInBatch(newTableEle, ownerDocument);
View Full Code Here

      while ((child != null) && (count <= before)) {
        if (child instanceof TableTableElement) {
          if (count == before) {
            TableTableElement refTableElement = refTable.getOdfElement();
            try {
              OdfContentDom contentDom = getContentDom();
              TableTableElement newTableEle = (TableTableElement) (refTableElement.cloneNode(true));
              //foreign node not in a same document
              if (refTableElement.getOwnerDocument() != contentDom) {
                Document ownerDocument = refTable.getOwnerDocument();
                copyLinkedRefInBatch(newTableEle, ownerDocument);
View Full Code Here

      super(doc);
      sdoc = (PresentationDocument) doc;
    }

    protected DrawFrameElement getChartFrame() throws Exception {
      OdfContentDom contentDom2 = sdoc.getContentDom();
      DrawFrameElement drawFrame = contentDom2.newOdfElement(DrawFrameElement.class);
      DrawPageElement lastPage = (DrawPageElement) contentDom2.getXPath().evaluate("//draw:page[last()]",
          contentDom2, XPathConstants.NODE);
      lastPage.appendChild(drawFrame);
      drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PAGE.toString());
      return drawFrame;
    }
View Full Code Here

      super(doc);
      sdoc = (SpreadsheetDocument) doc;
    }

    protected DrawFrameElement getChartFrame() throws Exception {
      OdfContentDom contentDom2 = sdoc.getContentDom();
      DrawFrameElement drawFrame = contentDom2.newOdfElement(DrawFrameElement.class);
      TableTableCellElement lastCell = (TableTableCellElement) contentDom2.getXPath().evaluate(
          "//table:table-cell[last()]", contentDom2, XPathConstants.NODE);
      lastCell.appendChild(drawFrame);
      drawFrame.removeAttribute("text:anchor-type");
      this.drawFrame = drawFrame;
      return drawFrame;
View Full Code Here

   * @return Returns the internal package path of the image, which was created
   *         based on the given URI.
   * */
  public String newImage(URI imageUri) {
    try {
      OdfContentDom contentDom = this.getContentDom();
      OdfDrawFrame drawFrame = contentDom.newOdfElement(OdfDrawFrame.class);
      XPath xpath = contentDom.getXPath();
      if (this instanceof SpreadsheetDocument) {
        TableTableCellElement lastCell = (TableTableCellElement) xpath.evaluate("//table:table-cell[last()]", contentDom, XPathConstants.NODE);
        lastCell.appendChild(drawFrame);
        drawFrame.removeAttribute("text:anchor-type");

View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.OdfContentDom

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.