Examples of DrawFrameElement


Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

    // how to test?
    fcell.removeContent();
    Assert.assertEquals(0, fcell.mCellElement.getChildNodes().getLength());

    fcell.setDisplayText("hello");
    DrawFrameElement drawEle = new DrawFrameElement(odsdoc.getContentDom());
    DrawImageElement imageEle = drawEle.newDrawImageElement();
    fcell.mCellElement.appendChild(drawEle);

    Assert.assertEquals(2, fcell.mCellElement.getChildNodes().getLength());

    fcell.removeTextContent();
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   * Create child element {@odf.element draw:frame}.
   *
   * @return the element {@odf.element draw:frame}
   */
  public DrawFrameElement newDrawFrameElement() {
    DrawFrameElement drawFrame = ((OdfFileDom) this.ownerDocument).newOdfElement(DrawFrameElement.class);
    this.appendChild(drawFrame);
    return drawFrame;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   * Create child element {@odf.element draw:frame}.
   *
   * @return the element {@odf.element draw:frame}
   */
  public DrawFrameElement newDrawFrameElement() {
    DrawFrameElement drawFrame = ((OdfFileDom) this.ownerDocument).newOdfElement(DrawFrameElement.class);
    this.appendChild(drawFrame);
    return drawFrame;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   * Create child element {@odf.element draw:frame}.
   *
   * @return the element {@odf.element draw:frame}
   */
  public DrawFrameElement newDrawFrameElement() {
    DrawFrameElement drawFrame = ((OdfFileDom) this.ownerDocument).newOdfElement(DrawFrameElement.class);
    this.appendChild(drawFrame);
    return drawFrame;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   * Create child element {@odf.element draw:frame}.
   *
   * @return the element {@odf.element draw:frame}
   */
  public DrawFrameElement newDrawFrameElement() {
    DrawFrameElement drawFrame = ((OdfFileDom) this.ownerDocument).newOdfElement(DrawFrameElement.class);
    this.appendChild(drawFrame);
    return drawFrame;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   * Create child element {@odf.element draw:frame}.
   *
   * @return the element {@odf.element draw:frame}
   */
  public DrawFrameElement newDrawFrameElement() {
    DrawFrameElement drawFrame = ((OdfFileDom) this.ownerDocument).newOdfElement(DrawFrameElement.class);
    this.appendChild(drawFrame);
    return drawFrame;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   */
  public BufferedImage getBufferedImage() {
    try {
      TextPElement pElement = OdfElement.findFirstChildNode(TextPElement.class, mCellElement);
      if (pElement != null) {
        DrawFrameElement drawFrame = OdfElement.findFirstChildNode(DrawFrameElement.class, pElement);
        if (drawFrame != null) {
          DrawImageElement imageElement = OdfElement.findFirstChildNode(DrawImageElement.class, drawFrame);
          if (imageElement != null) {
            String packagePath = imageElement.getXlinkHrefAttribute();
            OdfFileDom dom = (OdfFileDom) mCellElement.getOwnerDocument();
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

   */
  public Image getImage() {
    try {
      TextPElement pElement = OdfElement.findFirstChildNode(TextPElement.class, mCellElement);
      if (pElement != null) {
        DrawFrameElement drawFrame = OdfElement.findFirstChildNode(DrawFrameElement.class, pElement);
        if (drawFrame != null) {
          DrawImageElement imageElement = OdfElement.findFirstChildNode(DrawImageElement.class, drawFrame);
          return Image.getInstanceof(imageElement);
        }
      } else {
        DrawFrameElement drawFrame = OdfElement.findFirstChildNode(DrawFrameElement.class, mCellElement);
        if (drawFrame != null) {
          DrawImageElement imageElement = OdfElement.findFirstChildNode(DrawImageElement.class, drawFrame);
          return Image.getInstanceof(imageElement);
        }
      }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

      } catch (Exception e1) {
        Logger.getLogger(OdfPresentationDocument.class.getName()).log(Level.SEVERE, null, e1);
      }
      page.setPresentationPresentationPageLayoutNameAttribute(layoutName);

      DrawFrameElement frame1 = page.newDrawFrameElement();
      frame1.setProperty(StyleGraphicPropertiesElement.StyleShadow, "true");
      frame1.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame1.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame1.setPresentationStyleNameAttribute(frame1.getStyleName());

      frame1.setDrawLayerAttribute("layout");
      frame1.setSvgHeightAttribute("3.006cm");
      frame1.setSvgWidthAttribute("24.299cm");
      frame1.setSvgXAttribute("1.35cm");
      frame1.setSvgYAttribute("0.717cm");
      frame1.setPresentationClassAttribute(PresentationClassAttribute.Value.TITLE.toString());
      frame1.setPresentationPlaceholderAttribute(true);
      frame1.newDrawTextBoxElement();
    } else if (slideLayout.toString().equals(OdfSlide.SlideLayout.TITLE_OUTLINE.toString())) {
      layoutName = makeUniqueName();
      try {
        styles = super.getStylesDom().getOfficeStyles();
        if (styles == null) {
          styles = super.getStylesDom().newOdfElement(OdfOfficeStyles.class);
        }
        StylePresentationPageLayoutElement layout = styles.newStylePresentationPageLayoutElement(layoutName);
        layout.newPresentationPlaceholderElement("title", "2.058cm", "1.743cm", "23.91cm", "3.507cm");
        layout.newPresentationPlaceholderElement("outline", "2.058cm", "1.743cm", "23.91cm", "3.507cm");

      } catch (Exception e1) {
        Logger.getLogger(OdfPresentationDocument.class.getName()).log(Level.SEVERE, null, e1);
      }
      page.setPresentationPresentationPageLayoutNameAttribute(layoutName);


      DrawFrameElement frame1 = page.newDrawFrameElement();
      frame1.setProperty(StyleGraphicPropertiesElement.StyleShadow, "true");
      frame1.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame1.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame1.setPresentationStyleNameAttribute(frame1.getStyleName());

      frame1.setDrawLayerAttribute("layout");
      frame1.setSvgHeightAttribute("3.006cm");
      frame1.setSvgWidthAttribute("24.299cm");
      frame1.setSvgXAttribute("1.35cm");
      frame1.setSvgYAttribute("0.717cm");
      frame1.setPresentationClassAttribute(PresentationClassAttribute.Value.TITLE.toString());
      frame1.setPresentationPlaceholderAttribute(true);
      frame1.newDrawTextBoxElement();
      DrawFrameElement frame2 = page.newDrawFrameElement();

      frame2.setProperty(StyleGraphicPropertiesElement.FillColor, "#ffffff");
      frame2.setProperty(StyleGraphicPropertiesElement.MinHeight, "13.114");
      frame2.setPresentationStyleNameAttribute(frame2.getStyleName());

      frame2.setDrawLayerAttribute("layout");
      frame2.setSvgHeightAttribute("11.629cm");
      frame2.setSvgWidthAttribute("24.199cm");
      frame2.setSvgXAttribute("1.35cm");
      frame2.setSvgYAttribute("4.337cm");
      frame2.setPresentationClassAttribute(PresentationClassAttribute.Value.OUTLINE.toString());
      frame2.setPresentationPlaceholderAttribute(true);
      frame2.newDrawTextBoxElement();
    } else if (slideLayout.toString().equals(OdfSlide.SlideLayout.TITLE_PLUS_TEXT.toString())) {
      layoutName = makeUniqueName();
      try {
        styles = super.getStylesDom().getOfficeStyles();
        if (styles == null) {
          styles = super.getStylesDom().newOdfElement(OdfOfficeStyles.class);
        }
        StylePresentationPageLayoutElement layout = styles.newStylePresentationPageLayoutElement(layoutName);
        layout.newPresentationPlaceholderElement("title", "2.058cm", "1.743cm", "23.91cm", "1.743cm");
        layout.newPresentationPlaceholderElement("subtitle", "2.058cm", "5.838cm", "23.91cm", "13.23cm");

      } catch (Exception e1) {
        Logger.getLogger(OdfPresentationDocument.class.getName()).log(Level.SEVERE, null, e1);
      }
      page.setPresentationPresentationPageLayoutNameAttribute(layoutName);

      DrawFrameElement frame1 = page.newDrawFrameElement();
      frame1.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame1.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame1.setPresentationStyleNameAttribute(frame1.getStyleName());

      frame1.setDrawLayerAttribute("layout");
      frame1.setSvgHeightAttribute("3.006cm");
      frame1.setSvgWidthAttribute("24.299cm");
      frame1.setSvgXAttribute("1.35cm");
      frame1.setSvgYAttribute("0.717cm");
      frame1.setPresentationClassAttribute(PresentationClassAttribute.Value.TITLE.toString());
      frame1.setPresentationPlaceholderAttribute(true);
      frame1.newDrawTextBoxElement();
      DrawFrameElement frame2 = page.newDrawFrameElement();
      frame2.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame2.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame2.setPresentationStyleNameAttribute(frame2.getStyleName());

      frame2.setDrawLayerAttribute("layout");
      frame2.setSvgHeightAttribute("11.88cm");
      frame2.setSvgWidthAttribute("24.299cm");
      frame2.setSvgXAttribute("1.35cm");
      frame2.setSvgYAttribute("4.712cm");
      frame2.setPresentationClassAttribute(PresentationClassAttribute.Value.SUBTITLE.toString());
      frame2.setPresentationPlaceholderAttribute(true);
      frame2.newDrawTextBoxElement();

    } else if (slideLayout.toString().equals(OdfSlide.SlideLayout.TITLE_PLUS_2_TEXT_BLOCK.toString())) {

      layoutName = makeUniqueName();
      try {
        styles = super.getStylesDom().getOfficeStyles();
        if (styles == null) {
          styles = super.getStylesDom().newOdfElement(OdfOfficeStyles.class);
        }
        StylePresentationPageLayoutElement layout = styles.newStylePresentationPageLayoutElement(layoutName);
        layout.newPresentationPlaceholderElement("outline", "2.058cm", "1.743cm", "23.91cm", "1.743cm");
        layout.newPresentationPlaceholderElement("outline", "1.35cm", "4.212cm", "11.857cm", "11.629cm");
        layout.newPresentationPlaceholderElement("outline", "4.212cm", "13.8cm", "11.857cm", "11.629cm");

      } catch (Exception e1) {
        Logger.getLogger(OdfPresentationDocument.class.getName()).log(Level.SEVERE, null, e1);
      }

      DrawFrameElement frame1 = page.newDrawFrameElement();
      frame1.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame1.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame1.setPresentationStyleNameAttribute(frame1.getStyleName());

      frame1.setDrawLayerAttribute("layout");
      frame1.setSvgHeightAttribute("3.006cm");
      frame1.setSvgWidthAttribute("24.299cm");
      frame1.setSvgXAttribute("1.35cm");
      frame1.setSvgYAttribute("0.717cm");
      frame1.setPresentationClassAttribute(PresentationClassAttribute.Value.TITLE.toString());
      frame1.setPresentationPlaceholderAttribute(true);
      frame1.newDrawTextBoxElement();
      DrawFrameElement frame2 = page.newDrawFrameElement();
      frame2.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame2.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame2.setPresentationStyleNameAttribute(frame2.getStyleName());

      frame2.setDrawLayerAttribute("layout");
      frame2.setSvgHeightAttribute("11.629cm");
      frame2.setSvgWidthAttribute("11.857cm");
      frame2.setSvgXAttribute("1.35cm");
      frame2.setSvgYAttribute("4.212cm");
      frame2.setPresentationClassAttribute(PresentationClassAttribute.Value.OUTLINE.toString());
      frame2.setPresentationPlaceholderAttribute(true);
      frame2.newDrawTextBoxElement();
      DrawFrameElement frame3 = page.newDrawFrameElement();
      frame3.setProperty(StyleGraphicPropertiesElement.AutoGrowHeight, "true");
      frame3.setProperty(StyleGraphicPropertiesElement.MinHeight, "3.507");
      frame3.setPresentationStyleNameAttribute(frame3.getStyleName());

      frame3.setDrawLayerAttribute("layout");
      frame3.setSvgHeightAttribute("11.62cm");
      frame3.setSvgWidthAttribute("11.857cm");
      frame3.setSvgXAttribute("13.8cm");
      frame3.setSvgYAttribute("4.212cm");
      frame3.setPresentationClassAttribute(PresentationClassAttribute.Value.OUTLINE.toString());
      frame3.setPresentationPlaceholderAttribute(true);
      frame3.newDrawTextBoxElement();

      page.setPresentationPresentationPageLayoutNameAttribute(layoutName);

    }
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement

      OdfDocument doc = OdfDocument.loadDocument(TEST_FILE_FOLDER + New_File);
      OdfFileDom contentDom = doc.getContentDom();

      XPath xpath = contentDom.getXPath();
      DrawFrameElement frame = contentDom.newOdfElement(DrawFrameElement.class);
      frame.setSvgHeightAttribute("3in");
      frame.setSvgWidthAttribute("7in");
      DrawImageElement image = contentDom.newOdfElement(DrawImageElement.class);
      image.setXlinkHrefAttribute("Pictures/myHoliday.jpg");
      frame.appendChild(image);

      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      para.appendChild(frame);
      doc.save(TEST_FILE_FOLDER + New_File);
      doc.close();

      //Test if the image has been inserted
      doc = OdfDocument.loadDocument(TEST_FILE_FOLDER + New_File);
      contentDom = doc.getContentDom();
      DrawFrameElement frameobj = (DrawFrameElement) xpath.evaluate("//text:p[1]/draw:frame", contentDom, XPathConstants.NODE);
      Assert.assertEquals("3in", frameobj.getSvgHeightAttribute());
      Assert.assertEquals("7in", frameobj.getSvgWidthAttribute());
      DrawImageElement imageobj = (DrawImageElement) frameobj.getFirstChild();
      Assert.assertEquals("Pictures/myHoliday.jpg", imageobj.getXlinkHrefAttribute());
    } catch (Exception e) {
      Logger.getLogger(NoTempFileTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
    }
  }
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.