Package org.docx4j.dml.diagram

Examples of org.docx4j.dml.diagram.CTPt


  public SmartArtDataHierarchy convert() {
   
    SmartArtDataHierarchy smartArtDataHierarchy
    = factory.createSmartArtDataHierarchy();

    CTPt docPt = ptList.getPt().get(0);
   
    if (docPt.getPrSet()!=null
        && docPt.getPrSet().getLoTypeId()!=null) {

      smartArtDataHierarchy.setLoTypeId(
          docPt.getPrSet().getLoTypeId() );     
    } else {
      log.error("Couldn't read @loTypeId");
    }
   
    org.opendope.SmartArt.dataHierarchy.List docList = factory.createList();
    // dgm:pt[@type="doc" and @modelId="0"]
    org.opendope.SmartArt.dataHierarchy.ListItem listItem = factory.createListItem();
    docList.getListItem().add(listItem);
   
    listItem.setId(docPt.getModelId());
    listItem.setDepth(0);
   
    processChildrenOf(docPt, listItem);
   
   
View Full Code Here


      thisListItem.setDepth(listItem.getDepth()+1);
     
      String modelId = thisListItem.getId();
     
      // Find the pt
      CTPt thisPoint = getPoint(modelId);
     
      // attach its text
      CTTextBody textBody = processText(thisListItem, thisPoint);
     
      if (textFormats.size()<thisListItem.getDepth() ) {
        // we don't have a template for this level yet,
        // so add this one as the template for this level
        if (textBody==null) {
          // Add an empty one
          textFormats.add(
              diagramFactory.createT(
                  dmlFactory.createCTTextBody()));
        } else {
          textFormats.add(
              diagramFactory.createT(textBody));
        }
       
      }
     
      // attach its image
      CTPt imgPt = getAssociatedPres(modelId, PRESNAME_FOR_IMAGE);
      if (imgPt!=null
          && imgPt.getSpPr()!=null
          && imgPt.getSpPr().getBlipFill()!=null
          && imgPt.getSpPr().getBlipFill().getBlip()!=null) {
       
        // Get the relId
        CTBlip blip = imgPt.getSpPr().getBlipFill().getBlip();       
        if (blip.getEmbed()!=null) {
         
          String relId = blip.getEmbed();
          //Relationship r = diagramDataPart.getRelationshipsPart().getRelationshipByID(relId);
          BinaryPartAbstractImage bpai = (BinaryPartAbstractImage)diagramDataPart.getRelationshipsPart().getPart(relId);

          // Add it
          Image image = factory.createSmartArtDataHierarchyImagesImage();
          image.setContentType(bpai.getContentType());
          image.setId(imgPt.getModelId());
         
          image.setValue(bpai.getBytes());
         
          images.getImage().add(image);
         
          // reference
          org.opendope.SmartArt.dataHierarchy.ImageRef imageRef = factory.createImageRef();
          imageRef.setContentRef(imgPt.getModelId());
          // Other attributes
          if (imgPt.getPrSet()!=null ) {
            CTElemPropSet props = imgPt.getPrSet();
            if (props.getCustLinFactNeighborX()!=null) {
              imageRef.setCustLinFactNeighborX(props.getCustLinFactNeighborX());
            }
            if (props.getCustLinFactNeighborY()!=null) {
              imageRef.setCustLinFactNeighborY(props.getCustLinFactNeighborY());
            }
            if (props.getCustScaleX()!=null) {
              imageRef.setCustScaleX(props.getCustScaleX());
            }
            if (props.getCustScaleY()!=null) {
              imageRef.setCustScaleY(props.getCustScaleY());
            }
          }
         
          thisListItem.setImageRef(imageRef);
         
        } else if  (blip.getLink()!=null) {
          // TODO
          // -check a linked image actually works in SmartArt.
          // -our export format could be extended to support linked images
          // -and/or we could fetch the image and embed it
         
        }
      }
     
      // attach its sibTrans text (if applicable)
      CTPt sibTrans = getPoint(thisListItem.getSibTransBody().getContentRef() );
      // Don't clutter up our export, if it doesn't contain content
      if (sibTrans.getT()!=null
          && sibTrans.getT().getP() !=null
          && sibTrans.getT().getP().get(0) !=null
          && sibTrans.getT().getP().get(0).getEGTextRun() !=null
          && !sibTrans.getT().getP().get(0).getEGTextRun().isEmpty() ) {
       
        IdentifiedText wrapper = factory.createSmartArtDataHierarchyTextsIdentifiedText();
        wrapper.setId(sibTrans.getModelId()); // = @sibTransContentRef
        wrapper.setT( sibTrans.getT() );
        texts.getIdentifiedText().add(wrapper);
      } else {
        // remove the reference
        thisListItem.setSibTransBody(null);
      }       
View Full Code Here

          @Override
          public List<Object> apply(Object o) {
           
            if (o instanceof CTPt) {
             
              CTPt pt = (CTPt)o;
             
             
              String from = pt.getModelId();
             
              // Everything goes invisible in Word 2007 if you map these
              // to an int (rather than a guid),
              // and images disappear (not shown as broken)
              if (pt.getType()!=null
                  && pt.getType().equals(STPtType.PRES)) {
                map.put(from, generateNiceGuid(index));
                index++;
                return null;
              }
             
View Full Code Here

          @Override
          public List<Object> apply(Object o) {
                       
            if (o instanceof CTPt) {
             
              CTPt pt = (CTPt)o;
                           
              pt.setModelId(
                  mapGet(map, pt.getModelId() ));
             
              if (pt.getPrSet()!=null) {
                CTElemPropSet pr = (CTElemPropSet)pt.getPrSet();
                if (pr.getPresAssocID()!=null) {
                  pr.setPresAssocID(
                      mapGet(map, pr.getPresAssocID() ));
                }
              }
             
              if (!pt.getCxnId().equals("0")) {
                pt.setCxnId(
                    mapGet(map, pt.getCxnId() ));
              }             
            }

            if (o instanceof CTCxn) {
             
View Full Code Here

TOP

Related Classes of org.docx4j.dml.diagram.CTPt

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.