Examples of EscherContainerRecord


Examples of org.apache.poi.ddf.EscherContainerRecord

     * </p>
     */
    public void onCreate(){
        //initialize drawing group id
        EscherDggRecord dgg = getSlideShow().getDocumentRecord().getPPDrawingGroup().getEscherDggRecord();
        EscherContainerRecord dgContainer = (EscherContainerRecord)getSheetContainer().getPPDrawing().getEscherRecords()[0];
        EscherDgRecord dg = (EscherDgRecord) Shape.getEscherChild(dgContainer, EscherDgRecord.RECORD_ID);
        int dgId = dgg.getMaxDrawingGroupId() + 1;
        dg.setOptions((short)(dgId << 4));
        dgg.setDrawingsSaved(dgg.getDrawingsSaved() + 1);
        dgg.setMaxDrawingGroupId(dgId);

        for (Iterator it = dgContainer.getChildContainers().iterator(); it.hasNext(); ) {
            EscherContainerRecord c = (EscherContainerRecord)it.next();
            EscherSpRecord spr = null;
            switch(c.getRecordId()){
                case EscherContainerRecord.SPGR_CONTAINER:
                    EscherContainerRecord dc = (EscherContainerRecord)c.getChild(0);
                    spr = dc.getChildById(EscherSpRecord.RECORD_ID);
                    break;
                case EscherContainerRecord.SP_CONTAINER:
                    spr = c.getChildById(EscherSpRecord.RECORD_ID);
                    break;
            }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

    }
   
    // The top level container ought to have
    //  the DgRecord and the container of one container
    //  per shape group (patriach overall first)
    EscherContainerRecord topContainer = getEscherContainer();
    if(topContainer == null) {
      return;
    }
    topContainer = (EscherContainerRecord)
      topContainer.getChildContainers().get(0);
   
    List tcc = topContainer.getChildContainers();
    if(tcc.size() == 0) {
      throw new IllegalStateException("No child escher containers at the point that should hold the patriach data, and one container per top level shape!");
    }
   
    // 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
    for(int i=1; i<tcc.size(); i++) {
      EscherContainerRecord shapeContainer =
        (EscherContainerRecord)tcc.get(i);
      //System.err.println("\n\n*****\n\n");
      //System.err.println(shapeContainer);
     
      // Could be a group, or a base object
      if(shapeContainer.getChildRecords().size() == 1 &&
          shapeContainer.getChildContainers().size() == 1) {
        // Group
        HSSFShapeGroup group =
          new HSSFShapeGroup(null, new HSSFClientAnchor());
        patriarch.getChildren().add(group);
       
        EscherContainerRecord groupContainer =
          (EscherContainerRecord)shapeContainer.getChild(0);
        convertRecordsToUserModel(groupContainer, group);
      } else if(shapeContainer.hasChildOfType((short)0xF00D)) {
        // TextBox
        HSSFTextbox box =
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

      tailRec.clear();
      clearEscherRecords();
      if ( patriarch.getChildren().size() != 0 )
      {
        convertPatriarch( patriarch );
        EscherContainerRecord dgContainer = (EscherContainerRecord) getEscherRecord( 0 );
        EscherContainerRecord spgrContainer = null;
        Iterator<EscherRecord> iter = dgContainer.getChildIterator();
        while (iter.hasNext()) {
          EscherRecord child = iter.next();
          if (child.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
            spgrContainer = (EscherContainerRecord) child;
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

  }

  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)
      sp.setFlags( EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR );
    else
      sp.setFlags( EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_CHILD );
    opt.setRecordId( EscherOptRecord.RECORD_ID );
    opt.setOptions( (short) 0x0023 );
    opt.addEscherProperty( new EscherBoolProperty( EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004 ) );
    opt.addEscherProperty( new EscherBoolProperty( EscherProperties.GROUPSHAPE__PRINT, 0x00080000 ) );

    anchor = ConvertAnchor.createAnchor( shape.getAnchor() );
//    clientAnchor.setCol1( ( (HSSFClientAnchor) shape.getAnchor() ).getCol1() );
//    clientAnchor.setRow1( (short) ( (HSSFClientAnchor) shape.getAnchor() ).getRow1() );
//    clientAnchor.setDx1( (short) shape.getAnchor().getDx1() );
//    clientAnchor.setDy1( (short) shape.getAnchor().getDy1() );
//    clientAnchor.setCol2( ( (HSSFClientAnchor) shape.getAnchor() ).getCol2() );
//    clientAnchor.setRow2( (short) ( (HSSFClientAnchor) shape.getAnchor() ).getRow2() );
//    clientAnchor.setDx2( (short) shape.getAnchor().getDx2() );
//    clientAnchor.setDy2( (short) shape.getAnchor().getDy2() );
    clientData.setRecordId( EscherClientDataRecord.RECORD_ID );
    clientData.setOptions( (short) 0x0000 );

    spgrContainer.addChildRecord( spContainer );
    spContainer.addChildRecord( spgr );
    spContainer.addChildRecord( sp );
    spContainer.addChildRecord( opt );
    spContainer.addChildRecord( anchor );
    spContainer.addChildRecord( clientData );

    ObjRecord obj = new ObjRecord();
    CommonObjectDataSubRecord cmo = new CommonObjectDataSubRecord();
    cmo.setObjectType( CommonObjectDataSubRecord.OBJECT_TYPE_GROUP );
    cmo.setObjectId( shapeId );
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

    throw new IllegalArgumentException( "Can not find client data record" );
  }

  private void convertPatriarch( HSSFPatriarch patriarch )
  {
    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 );

    dgContainer.addChildRecord( dg );
    dgContainer.addChildRecord( spgrContainer );
    spgrContainer.addChildRecord( spContainer1 );
    spContainer1.addChildRecord( spgr );
    spContainer1.addChildRecord( sp1 );

    addEscherRecord( dgContainer );
  }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

    }

    // The top level container ought to have
    //  the DgRecord and the container of one container
    //  per shape group (patriach overall first)
    EscherContainerRecord topContainer = getEscherContainer();
    if(topContainer == null) {
      return;
    }
    topContainer = topContainer.getChildContainers().get(0);

    List tcc = topContainer.getChildContainers();
    if(tcc.size() == 0) {
      throw new IllegalStateException("No child escher containers at the point that should hold the patriach data, and one container per top level shape!");
    }

    // 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;
      }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

  private static void convertRecordsToUserModelRecursive(List tcc, HSSFShapeContainer container, HSSFShape parent) {
    // Now process the containers for each group
    //  and objects
    for(int i=1; i<tcc.size(); i++) {
      EscherContainerRecord shapeContainer = (EscherContainerRecord)tcc.get(i);

      // Could be a group, or a base object
      if (shapeContainer.getRecordId() == EscherContainerRecord.SPGR_CONTAINER)
      {
        // Group
        final int shapeChildren = shapeContainer.getChildRecords().size();
        if (shapeChildren > 0)
        {
          HSSFShapeGroup group = new HSSFShapeGroup( parent, new HSSFClientAnchor() );
          addToParentOrContainer(group, container, parent);

          EscherContainerRecord groupContainer = (EscherContainerRecord) shapeContainer.getChild( 0 );
          convertRecordsToUserModel( groupContainer, group );
         
          if (shapeChildren>1){
            convertRecordsToUserModelRecursive(shapeContainer.getChildRecords(), container, group);
          }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

      tailRec.clear();
      clearEscherRecords();
      if ( patriarch.getChildren().size() != 0 )
      {
        convertPatriarch( patriarch );
        EscherContainerRecord dgContainer = (EscherContainerRecord) getEscherRecord( 0 );
        EscherContainerRecord spgrContainer = null;
        Iterator<EscherRecord> iter = dgContainer.getChildIterator();
        while (iter.hasNext()) {
          EscherRecord child = iter.next();
          if (child.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
            spgrContainer = (EscherContainerRecord) child;
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

  }

  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)
      sp.setFlags( EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR );
    else
      sp.setFlags( EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_CHILD );
    opt.setRecordId( EscherOptRecord.RECORD_ID );
    opt.setOptions( (short) 0x0023 );
    opt.addEscherProperty( new EscherBoolProperty( EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004 ) );
    opt.addEscherProperty( new EscherBoolProperty( EscherProperties.GROUPSHAPE__PRINT, 0x00080000 ) );

    anchor = ConvertAnchor.createAnchor( shape.getAnchor() );
//    clientAnchor.setCol1( ( (HSSFClientAnchor) shape.getAnchor() ).getCol1() );
//    clientAnchor.setRow1( (short) ( (HSSFClientAnchor) shape.getAnchor() ).getRow1() );
//    clientAnchor.setDx1( (short) shape.getAnchor().getDx1() );
//    clientAnchor.setDy1( (short) shape.getAnchor().getDy1() );
//    clientAnchor.setCol2( ( (HSSFClientAnchor) shape.getAnchor() ).getCol2() );
//    clientAnchor.setRow2( (short) ( (HSSFClientAnchor) shape.getAnchor() ).getRow2() );
//    clientAnchor.setDx2( (short) shape.getAnchor().getDx2() );
//    clientAnchor.setDy2( (short) shape.getAnchor().getDy2() );
    clientData.setRecordId( EscherClientDataRecord.RECORD_ID );
    clientData.setOptions( (short) 0x0000 );

    spgrContainer.addChildRecord( spContainer );
    spContainer.addChildRecord( spgr );
    spContainer.addChildRecord( sp );
    spContainer.addChildRecord( opt );
    spContainer.addChildRecord( anchor );
    spContainer.addChildRecord( clientData );

    ObjRecord obj = new ObjRecord();
    CommonObjectDataSubRecord cmo = new CommonObjectDataSubRecord();
    cmo.setObjectType( CommonObjectDataSubRecord.OBJECT_TYPE_GROUP );
    cmo.setObjectId( shapeId );
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

    throw new IllegalArgumentException( "Can not find client data record" );
  }

  private void convertPatriarch( HSSFPatriarch patriarch )
  {
    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 );

    dgContainer.addChildRecord( dg );
    dgContainer.addChildRecord( spgrContainer );
    spgrContainer.addChildRecord( spContainer1 );
    spContainer1.addChildRecord( spgr );
    spContainer1.addChildRecord( sp1 );

    addEscherRecord( dgContainer );
  }
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.