Examples of DrawFrameElement


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

   */
  public static Image newImage(Frame frame, URI uri) {
    Image mImage;

    try {
      DrawFrameElement fElement = (DrawFrameElement) frame.getDrawFrameElement();
      OdfFileDom ownerDom = (OdfFileDom) fElement.getOwnerDocument();
      DrawImageElement imageElement = fElement.newDrawImageElement();
      // set uri and copy resource
      String packagePath = insertImageResourceIntoPackage((OdfSchemaDocument) ownerDom.getDocument(), uri);
      packagePath = packagePath.replaceFirst(ownerDom.getDocument().getDocumentPath(), "");
      URI newURI = configureInsertedImage((OdfSchemaDocument) ownerDom.getDocument(), imageElement, packagePath,
          true);
View Full Code Here

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

    imageElement.setXlinkHrefAttribute(AnyURI.decodePath(uri.toString()));
    // Set mandatory attribute xlink:type
    imageElement.setXlinkTypeAttribute("simple");
    // A draw:image is always embedded in a draw:frame
    InputStream is = mOdfSchemaDoc.getPackage().getInputStream(packagePath);
    DrawFrameElement odfFrame = (DrawFrameElement) imageElement.getParentNode();
    Frame aFrame = Frame.getInstanceof(odfFrame);
    FrameRectangle oldRect = aFrame.getRectangle();
    if (oldRect.getLinearMeasure() != StyleTypeDefinitions.SupportedLinearMeasure.CM)
      oldRect.setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure.CM);
    if (odfFrame != null) {
      BufferedImage image = ImageIO.read(is);
      int height = image.getHeight(null);
      int width = image.getWidth(null);
      odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER));
      odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER));
      if (isResetSize) {
        FrameRectangle newRect = aFrame.getRectangle();
        newRect.setX(oldRect.getX()+(oldRect.getWidth()-newRect.getWidth())/2);
        newRect.setY(oldRect.getY()+(oldRect.getHeight()-newRect.getHeight())/2);
        aFrame.setRectangle(newRect);
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 void testNotCompressImages() throws Exception {
    //create test presentation
    OdfPresentationDocument odp = OdfPresentationDocument.newPresentationDocument();
    OfficePresentationElement officePresentation = odp.getContentRoot();
    DrawPageElement page = officePresentation.newDrawPageElement(null);
    DrawFrameElement frame = page.newDrawFrameElement();
    OdfDrawImage image = (OdfDrawImage) frame.newDrawImageElement();
    image.newImage(ResourceUtilities.getURI(IMAGE_TEST_FILE));
    odp.save(ResourceUtilities.newTestOutputFile(IMAGE_PRESENTATION));

    //test if the image is not compressed
    ZipInputStream zinput = new ZipInputStream(ResourceUtilities.getTestResourceAsStream(IMAGE_PRESENTATION));
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

   * Child element is new in Odf 1.2
   *
   * @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
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.