Examples of EscherSpgrRecord


Examples of org.apache.poi.ddf.EscherSpgrRecord

        clientAnchor.setFlag((short)(anchor.y*MASTER_DPI/POINT_DPI));
        clientAnchor.setCol1((short)(anchor.x*MASTER_DPI/POINT_DPI));
        clientAnchor.setDx1((short)((anchor.width + anchor.x)*MASTER_DPI/POINT_DPI));
        clientAnchor.setRow1((short)((anchor.height + anchor.y)*MASTER_DPI/POINT_DPI));

        EscherSpgrRecord spgr = (EscherSpgrRecord)getEscherChild(spContainer, EscherSpgrRecord.RECORD_ID);

        spgr.setRectX1(anchor.x*MASTER_DPI/POINT_DPI);
        spgr.setRectY1(anchor.y*MASTER_DPI/POINT_DPI);
        spgr.setRectX2((anchor.x + anchor.width)*MASTER_DPI/POINT_DPI);
        spgr.setRectY2((anchor.y + anchor.height)*MASTER_DPI/POINT_DPI);
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

     *
     * @param anchor the coordinate space of this group
     */
    public void setCoordinates(Rectangle2D anchor){
        EscherContainerRecord spContainer = (EscherContainerRecord)_escherContainer.getChild(0);
        EscherSpgrRecord spgr = (EscherSpgrRecord)getEscherChild(spContainer, EscherSpgrRecord.RECORD_ID);

        int x1 = (int)Math.round(anchor.getX()*MASTER_DPI/POINT_DPI);
        int y1 = (int)Math.round(anchor.getY()*MASTER_DPI/POINT_DPI);
        int x2 = (int)Math.round((anchor.getX() + anchor.getWidth())*MASTER_DPI/POINT_DPI);
        int y2 = (int)Math.round((anchor.getY() + anchor.getHeight())*MASTER_DPI/POINT_DPI);

        spgr.setRectX1(x1);
        spgr.setRectY1(y1);
        spgr.setRectX2(x2);
        spgr.setRectY2(y2);

    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

     *
     * @return the coordinate space of this group
     */
    public Rectangle2D getCoordinates(){
        EscherContainerRecord spContainer = (EscherContainerRecord)_escherContainer.getChild(0);
        EscherSpgrRecord spgr = (EscherSpgrRecord)getEscherChild(spContainer, EscherSpgrRecord.RECORD_ID);

        Rectangle2D.Float anchor = new Rectangle2D.Float();
        anchor.x = (float)spgr.getRectX1()*POINT_DPI/MASTER_DPI;
        anchor.y = (float)spgr.getRectY1()*POINT_DPI/MASTER_DPI;
        anchor.width = (float)(spgr.getRectX2() - spgr.getRectX1())*POINT_DPI/MASTER_DPI;
        anchor.height = (float)(spgr.getRectY2() - spgr.getRectY1())*POINT_DPI/MASTER_DPI;

        return anchor;
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

        //The group itself is a shape, and always appears as the first EscherSpContainer in the group container.
        EscherContainerRecord spcont = new EscherContainerRecord();
        spcont.setRecordId(EscherContainerRecord.SP_CONTAINER);
        spcont.setOptions((short)15);

        EscherSpgrRecord spg = new EscherSpgrRecord();
        spg.setOptions((short)1);
        spcont.addChildRecord(spg);

        EscherSpRecord sp = new EscherSpRecord();
        short type = (ShapeTypes.NotPrimitive << 4) + 2;
        sp.setOptions(type);
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

  {
    EscherContainerRecord dgContainer = new EscherContainerRecord();
    EscherDgRecord dg;
    EscherContainerRecord spgrContainer = new EscherContainerRecord();
    EscherContainerRecord spContainer1 = new EscherContainerRecord();
    EscherSpgrRecord spgr = new EscherSpgrRecord();
    EscherSpRecord sp1 = new EscherSpRecord();

    dgContainer.setRecordId( EscherContainerRecord.DG_CONTAINER );
    dgContainer.setOptions( (short) 0x000F );
    dg = drawingManager.createDgRecord();
    drawingGroupId = dg.getDrawingGroupId();
//    dg.setOptions( (short) ( drawingId << 4 ) );
//    dg.setNumShapes( getNumberOfShapes( patriarch ) );
//    dg.setLastMSOSPID( 0 );  // populated after all shape id's are assigned.
    spgrContainer.setRecordId( EscherContainerRecord.SPGR_CONTAINER );
    spgrContainer.setOptions( (short) 0x000F );
    spContainer1.setRecordId( EscherContainerRecord.SP_CONTAINER );
    spContainer1.setOptions( (short) 0x000F );
    spgr.setRecordId( EscherSpgrRecord.RECORD_ID );
    spgr.setOptions( (short) 0x0001 )// version
    spgr.setRectX1( patriarch.getX1() );
    spgr.setRectY1( patriarch.getY1() );
    spgr.setRectX2( patriarch.getX2() );
    spgr.setRectY2( patriarch.getY2() );
    sp1.setRecordId( EscherSpRecord.RECORD_ID );
    sp1.setOptions( (short) 0x0002 );
    sp1.setShapeId( drawingManager.allocateShapeId(dg.getDrawingGroupId()) );
    sp1.setFlags( EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_PATRIARCH );
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

    // First up, get the patriach position
    // This is in the first EscherSpgrRecord, in
    //  the first container, with a EscherSRecord too
    EscherContainerRecord patriachContainer =
      (EscherContainerRecord)tcc.get(0);
    EscherSpgrRecord spgr = null;
    for(Iterator<EscherRecord> it = patriachContainer.getChildIterator(); it.hasNext();) {
      EscherRecord r = it.next();
      if(r instanceof EscherSpgrRecord) {
        spgr = (EscherSpgrRecord)r;
        break;
      }
    }
    if(spgr != null) {
      patriarch.setCoordinates(
          spgr.getRectX1(), spgr.getRectY1(),
          spgr.getRectX2(), spgr.getRectY2()
      );
    }

    // Now process the containers for each group
    //  and objects
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

  private void convertRecordsToUserModel(EscherContainerRecord shapeContainer, Object model) {
    for(Iterator<EscherRecord> it = shapeContainer.getChildIterator(); it.hasNext();) {
      EscherRecord r = it.next();
      if(r instanceof EscherSpgrRecord) {
        // This may be overriden by a later EscherClientAnchorRecord
        EscherSpgrRecord spgr = (EscherSpgrRecord)r;

        if(model instanceof HSSFShapeGroup) {
          HSSFShapeGroup g = (HSSFShapeGroup)model;
          g.setCoordinates(
              spgr.getRectX1(), spgr.getRectY1(),
              spgr.getRectX2(), spgr.getRectY2()
          );
        } else {
          throw new IllegalStateException("Got top level anchor but not processing a group");
        }
      }
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

  private void convertGroup( HSSFShapeGroup shape, EscherContainerRecord escherParent, Map shapeToObj )
  {
    EscherContainerRecord spgrContainer = new EscherContainerRecord();
    EscherContainerRecord spContainer = new EscherContainerRecord();
    EscherSpgrRecord spgr = new EscherSpgrRecord();
    EscherSpRecord sp = new EscherSpRecord();
    EscherOptRecord opt = new EscherOptRecord();
    EscherRecord anchor;
    EscherClientDataRecord clientData = new EscherClientDataRecord();

    spgrContainer.setRecordId( EscherContainerRecord.SPGR_CONTAINER );
    spgrContainer.setOptions( (short) 0x000F );
    spContainer.setRecordId( EscherContainerRecord.SP_CONTAINER );
    spContainer.setOptions( (short) 0x000F );
    spgr.setRecordId( EscherSpgrRecord.RECORD_ID );
    spgr.setOptions( (short) 0x0001 );
    spgr.setRectX1( shape.getX1() );
    spgr.setRectY1( shape.getY1() );
    spgr.setRectX2( shape.getX2() );
    spgr.setRectY2( shape.getY2() );
    sp.setRecordId( EscherSpRecord.RECORD_ID );
    sp.setOptions( (short) 0x0002 );
    int shapeId = drawingManager.allocateShapeId(drawingGroupId);
    sp.setShapeId( shapeId );
    if (shape.getAnchor() instanceof HSSFClientAnchor)
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

     */
    private void buildBaseTree() {
        EscherContainerRecord dgContainer = new EscherContainerRecord();
        EscherContainerRecord spgrContainer = new EscherContainerRecord();
        EscherContainerRecord spContainer1 = new EscherContainerRecord();
        EscherSpgrRecord spgr = new EscherSpgrRecord();
        EscherSpRecord sp1 = new EscherSpRecord();
        dgContainer.setRecordId(EscherContainerRecord.DG_CONTAINER);
        dgContainer.setOptions((short) 0x000F);
        EscherDgRecord dg = new EscherDgRecord();
        dg.setRecordId(EscherDgRecord.RECORD_ID);
        short dgId = 1;
        dg.setOptions((short) (dgId << 4));
        dg.setNumShapes(0);
        dg.setLastMSOSPID(1024);
        spgrContainer.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
        spgrContainer.setOptions((short) 0x000F);
        spContainer1.setRecordId(EscherContainerRecord.SP_CONTAINER);
        spContainer1.setOptions((short) 0x000F);
        spgr.setRecordId(EscherSpgrRecord.RECORD_ID);
        spgr.setOptions((short) 0x0001);    // version
        spgr.setRectX1(0);
        spgr.setRectY1(0);
        spgr.setRectX2(1023);
        spgr.setRectY2(255);
        sp1.setRecordId(EscherSpRecord.RECORD_ID);

        sp1.setOptions((short) 0x0002);
        sp1.setVersion((short) 0x2);
        sp1.setShapeId(-1);
View Full Code Here

Examples of org.apache.poi.ddf.EscherSpgrRecord

    // First up, get the patriach position
    // This is in the first EscherSpgrRecord, in
    //  the first container, with a EscherSRecord too
    EscherContainerRecord patriachContainer =
      (EscherContainerRecord)tcc.get(0);
    EscherSpgrRecord spgr = null;
    for(Iterator<EscherRecord> it = patriachContainer.getChildIterator(); it.hasNext();) {
      EscherRecord r = it.next();
      if(r instanceof EscherSpgrRecord) {
        spgr = (EscherSpgrRecord)r;
        break;
      }
    }
    if(spgr != null) {
      patriarch.setCoordinates(
          spgr.getRectX1(), spgr.getRectY1(),
          spgr.getRectX2(), spgr.getRectY2()
      );
    }

    // Now process the containers for each group
    //  and objects
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.