Examples of DrawFrameElement


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

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

    fcell.setDisplayText("hello");
    DrawFrameElement drawEle = new DrawFrameElement(odsdoc.getContentDom());
    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

      OdfFileDom dom = odt.getContentDom();
      firstParagraph = (TextPElement) xpath.evaluate("//text:p[1]", dom, XPathConstants.NODE);
    */

    // insert a frame
    DrawFrameElement frame = firstParagraph.newDrawFrameElement();

    // insert an image: This is a class from the Document API
    OdfDrawImage image = (OdfDrawImage) frame.newDrawImageElement();
    image.newImage(new URI("./MySampleImage.png"));

    // Save file
    odt.save("ImageOut.odt");

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

      Chart chart = new Chart(chartEle, sName);
      chart.setChartTitle(title);
      chart.setChartType(ChartType.BAR);
      chart.setUseLegend(true);
      chart.setChartData(dataset);
      DrawFrameElement drawFrame = getChartFrame();
      drawFrame.setProperty(StyleGraphicPropertiesElement.OleDrawAspect, "1");
      drawFrame.setPresentationUserTransformedAttribute(true);
      drawFrame.removeAttributeNS(OdfDocumentNamespace.PRESENTATION.getUri(), "placeholder");
      if (rect != null) {
        drawFrame.setSvgXAttribute(new Integer(rect.x).toString());
        drawFrame.setSvgYAttribute(new Integer(rect.y).toString());
        drawFrame.setSvgWidthAttribute(new Integer(rect.width).toString());
        drawFrame.setSvgHeightAttribute(new Integer(rect.height).toString());
      }
      DrawObjectElement drawObject = OdfElement.findFirstChildNode(DrawObjectElement.class, drawFrame);
      if(drawObject == null){
        drawObject = drawFrame.newDrawObjectElement();
      }
      if (dataset.getCellRangeAddress() != null){
        drawObject.setDrawNotifyOnUpdateOfRangesAttribute(dataset.getCellRangeAddress().toString());
      }
      drawObject.setXlinkHrefAttribute(ROOT_STRING + sName);
View Full Code Here

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

      frameObjects = mDocument.getContentDom().getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(),
          "object");
      for (int i = 0; i < frameObjects.getLength(); i++) {
        DrawObjectElement object = (DrawObjectElement) frameObjects.item(i);
        if (object.getXlinkHrefAttribute().toString().endsWith(chartId)) {
          DrawFrameElement frame = (DrawFrameElement) object.getParentNode();
          frame.getParentNode().removeChild(frame);
        }
      }
    } catch (Exception ex) {
      Logger.getLogger(AbstractChartContainer.class.getName()).log(Level.SEVERE, null, ex);
    }
View Full Code Here

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

  public Frame getFrameByName(String name) {
    if (name == null)
      return null;

    OdfElement container = getFrameContainerElement();
    DrawFrameElement element = OdfElement.findFirstChildNode(DrawFrameElement.class, container);
    while (element != null) {
      if (name.equals(element.getDrawNameAttribute())) {
        Frame frame = Frame.getInstanceof(element);
        frame.mFrameContainer = this;
        return frame;
      }
      element = OdfElement.findNextChildNode(DrawFrameElement.class, element);
View Full Code Here

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

    Document doc = (Document) ((OdfFileDom) container.getOwnerDocument()).getDocument();
    if (!(doc instanceof PresentationDocument)) {
      return null;
    }
    ArrayList<Frame> al = new ArrayList<Frame>();
    DrawFrameElement element = OdfElement.findFirstChildNode(DrawFrameElement.class, container);
    while (element != null) {
      if (usage.toString().equals(element.getPresentationClassAttribute())) {
        Frame frame = Frame.getInstanceof(element);
        frame.mFrameContainer = this;
        al.add(frame);
      }
      element = OdfElement.findNextChildNode(DrawFrameElement.class, element);
View Full Code Here

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

    Image mImage;

    try {
      OdfElement parent = container.getFrameContainerElement();
      OdfFileDom ownerDom = (OdfFileDom) parent.getOwnerDocument();
      DrawFrameElement fElement = ownerDom.newOdfElement(DrawFrameElement.class);
      parent.appendChild(fElement);
      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,
          false);
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.