Examples of OdfDrawFrame


Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame

      // an image consists always of a 'draw:image' and a 'draw:frame' parent

      // FUTURE USAGE: para.createDrawFrame().createDrawImage("/myweb.org/images/myHoliday.png", "/Pictures/myHoliday.png");
      //             Child access methods are still not part of the v0.6.x releases
      // CURRENT USAGE:
      OdfDrawFrame odfFrame = (OdfDrawFrame) OdfXMLFactory.newOdfElement(odfContent, DrawFrameElement.ELEMENT_NAME);
      para.appendChild(odfFrame);
      OdfDrawImage odfImage = (OdfDrawImage) OdfXMLFactory.newOdfElement(odfContent, OdfDrawImage.ELEMENT_NAME);
      odfFrame.appendChild(odfImage);
      odfImage.newImage(ResourceUtilities.getURI(TEST_PIC));

      OdfDrawImage odfImage2 = (OdfDrawImage) OdfXMLFactory.newOdfElement(odfContent, OdfDrawImage.ELEMENT_NAME);
      odfFrame.appendChild(odfImage2);
      //Deactivated as test fail, when test machine is not online (painful for offline work)
      //odfImage2.newImage(new URI("http://odftoolkit.org/attachments/wiki_images/odftoolkit/Table_fruits_diagramm.jpg"));
      odfDoc.save(ResourceUtilities.newTestOutputFile("odfdom-wiki-dom.odt"));

    } catch (Exception e) {
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame

      Assert.fail("Failed with " + ex.getClass().getName() + ": '" + ex.getMessage() + "'");
    }
  }

  private void addImageToDocument(OdfContentDom dom, TextPElement para) throws Exception {
    OdfDrawFrame drawFrame = new OdfDrawFrame(dom);
    drawFrame.setDrawNameAttribute("graphics1");
    drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
    drawFrame.setSvgWidthAttribute("4.233cm");
    drawFrame.setSvgHeightAttribute("4.233cm");
    drawFrame.setDrawZIndexAttribute(0);
    para.appendChild(drawFrame);

    OdfDrawImage image = new OdfDrawImage(dom);
    drawFrame.appendChild(image);
    image.newImage(ResourceUtilities.getURI(TEST_PIC));
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame

    drawFrame.appendChild(image);
    image.newImage(ResourceUtilities.getURI(TEST_PIC));
  }

  private void addFrameForEmbeddedDoc(OdfContentDom dom, TextPElement para, String path) throws Exception {
    OdfDrawFrame drawFrame = new OdfDrawFrame(dom);
    drawFrame.setDrawNameAttribute(path);
    drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
    drawFrame.setSvgXAttribute("0.834cm");
    drawFrame.setSvgYAttribute("2.919cm");
    drawFrame.setSvgWidthAttribute("13.257cm");
    drawFrame.setSvgHeightAttribute("11.375cm");
    drawFrame.setDrawZIndexAttribute(0);

    DrawObjectElement object = new DrawObjectElement(dom);
    object.setXlinkHrefAttribute("./" + path);
    object.setXlinkActuateAttribute("onLoad");
    object.setXlinkShowAttribute("embed");
    object.setXlinkTypeAttribute("simple");
    drawFrame.appendChild(object);
    para.appendChild(drawFrame);
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame

  @Test
  public void testPresentationClassAttribute() {
    try {
      OdfGraphicsDocument doc = OdfGraphicsDocument.newGraphicsDocument();
      OdfFileDom dom = doc.getContentDom();
      OdfDrawFrame f = new OdfDrawFrame(dom);

      f.setPresentationClassAttribute(PresentationClassAttribute.Value.GRAPHIC.toString());
      Logger.getLogger(DocumentCreationTest.class.getName()).info(f.getPresentationClassAttribute());
    } catch (Exception e) {
      Logger.getLogger(PresentationTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame

      OdfDocument odfdoc = OdfDocument.loadDocument(ResourceUtilities.getAbsolutePath("frame.odt"));
      NodeList lst = odfdoc.getContentDom().getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "frame");
      Assert.assertEquals(lst.getLength(), 1);
      Node node = lst.item(0);
      Assert.assertTrue(node instanceof OdfDrawFrame);
      OdfDrawFrame fe = (OdfDrawFrame) lst.item(0);

      Assert.assertEquals(fe.getProperty(StyleGraphicPropertiesElement.VerticalPos), "top");
    } catch (Exception e) {
      Logger.getLogger(FrameTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.draw.OdfDrawFrame

            getBookmarks().put("#" + ta.getAttribute("text:name"), a);
        } else if (e instanceof TextNoteElement) {// Is a footnote container
            addFootnote((TextNoteElement) e, dstElement);
            skipChildren = true;
        } else if (e instanceof OdfDrawFrame) {
            OdfDrawFrame dframe = (OdfDrawFrame) e;
        // if(!(dframe.getParentNode().getParentNode() instanceof DrawTextBoxElement)){
            // here can be captured resize options
            newElement = addImageBox(dframe, dstElement);
         //}
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.