Examples of EscherContainerRecord


Examples of org.apache.poi.ddf.EscherContainerRecord

        for(Record r : records) {
            if(r instanceof DrawingGroupRecord) {
                DrawingGroupRecord dg = (DrawingGroupRecord)r;
                dg.processChildRecords();

                EscherContainerRecord cr =
                    dg.getEscherContainer();
                if(cr == null) {
                    continue;
                }

                EscherDggRecord dgg = null;
                EscherContainerRecord bStore = null;
                for(Iterator<EscherRecord> it = cr.getChildIterator(); it.hasNext();) {
                    EscherRecord er = it.next();
                    if(er instanceof EscherDggRecord) {
                        dgg = (EscherDggRecord)er;
                    } else if (er.getRecordId() == EscherContainerRecord.BSTORE_CONTAINER) {
                        bStore = (EscherContainerRecord) er;
                    }
                }

                if(dgg != null) {
                    drawingManager = new DrawingManager2(dgg);
                    if(bStore != null){
                        for(EscherRecord bs : bStore.getChildRecords()){
                            if(bs instanceof EscherBSERecord) escherBSERecords.add((EscherBSERecord)bs);
                        }
                    }
                    return drawingManager;
                }
            }
        }

        // Look for the DrawingGroup record
        int dgLoc = findFirstRecordLocBySid(DrawingGroupRecord.sid);

        // If there is one, does it have a EscherDggRecord?
        if(dgLoc != -1) {
            DrawingGroupRecord dg = (DrawingGroupRecord)records.get(dgLoc);
            EscherDggRecord dgg = null;
            EscherContainerRecord bStore = null;
            for(EscherRecord er : dg.getEscherRecords()) {
                if (er instanceof EscherDggRecord) {
                    dgg = (EscherDggRecord) er;
                } else if (er.getRecordId() == EscherContainerRecord.BSTORE_CONTAINER) {
                    bStore = (EscherContainerRecord) er;
                }
            }

            if(dgg != null) {
                drawingManager = new DrawingManager2(dgg);
                if(bStore != null){
                    for(EscherRecord bs : bStore.getChildRecords()){
                        if(bs instanceof EscherBSERecord) escherBSERecords.add((EscherBSERecord)bs);
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

     * Creates a primary drawing group record.  If it already
     *  exists then it's modified.
     */
    public void createDrawingGroup() {
        if (drawingManager == null) {
            EscherContainerRecord dggContainer = new EscherContainerRecord();
            EscherDggRecord dgg = new EscherDggRecord();
            EscherOptRecord opt = new EscherOptRecord();
            EscherSplitMenuColorsRecord splitMenuColors = new EscherSplitMenuColorsRecord();

            dggContainer.setRecordId((short) 0xF000);
            dggContainer.setOptions((short) 0x000F);
            dgg.setRecordId(EscherDggRecord.RECORD_ID);
            dgg.setOptions((short)0x0000);
            dgg.setShapeIdMax(1024);
            dgg.setNumShapesSaved(0);
            dgg.setDrawingsSaved(0);
            dgg.setFileIdClusters(new EscherDggRecord.FileIdCluster[] {} );
            drawingManager = new DrawingManager2(dgg);
            EscherContainerRecord bstoreContainer = null;
            if (escherBSERecords.size() > 0)
            {
                bstoreContainer = new EscherContainerRecord();
                bstoreContainer.setRecordId( EscherContainerRecord.BSTORE_CONTAINER );
                bstoreContainer.setOptions( (short) ( (escherBSERecords.size() << 4) | 0xF ) );
                for (EscherRecord escherRecord : escherBSERecords) {
                    bstoreContainer.addChildRecord( escherRecord );
                }
            }
            opt.setRecordId((short) 0xF00B);
            opt.setOptions((short) 0x0033);
            opt.addEscherProperty( new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 524296) );
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

        escherBSERecords.add( e );

        int dgLoc = findFirstRecordLocBySid(DrawingGroupRecord.sid);
        DrawingGroupRecord drawingGroup = (DrawingGroupRecord) getRecords().get( dgLoc );

        EscherContainerRecord dggContainer = (EscherContainerRecord) drawingGroup.getEscherRecord( 0 );
        EscherContainerRecord bstoreContainer;
        if (dggContainer.getChild( 1 ).getRecordId() == EscherContainerRecord.BSTORE_CONTAINER )
        {
            bstoreContainer = (EscherContainerRecord) dggContainer.getChild( 1 );
        }
        else
        {
            bstoreContainer = new EscherContainerRecord();
            bstoreContainer.setRecordId( EscherContainerRecord.BSTORE_CONTAINER );
            List<EscherRecord> childRecords = dggContainer.getChildRecords();
            childRecords.add(1, bstoreContainer);
            dggContainer.setChildRecords(childRecords);
        }
        bstoreContainer.setOptions( (short) ( (escherBSERecords.size() << 4) | 0xF ) );

        bstoreContainer.addChildRecord( e );

        return escherBSERecords.size();
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

        //check if the cloned sheet has drawings
        int aggLoc = sheet.aggregateDrawingRecords(drawingManager, false);
        if(aggLoc != -1) {
            EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
            EscherContainerRecord escherContainer = agg.getEscherContainer();
            if (escherContainer == null) {
                return;
            }

            EscherDggRecord dgg = drawingManager.getDgg();

            //register a new drawing group for the cloned sheet
            int dgId = drawingManager.findNewDrawingGroupId();
            dgg.addCluster( dgId, 0 );
            dgg.setDrawingsSaved(dgg.getDrawingsSaved() + 1);

            EscherDgRecord dg = null;
            for(Iterator<EscherRecord> it = escherContainer.getChildIterator(); it.hasNext();) {
                EscherRecord er = it.next();
                if(er instanceof EscherDgRecord) {
                    dg = (EscherDgRecord)er;
                    //update id of the drawing in the cloned sheet
                    dg.setOptions( (short) ( dgId << 4 ) );
                } else if (er instanceof EscherContainerRecord){
                    // iterate over shapes and re-generate shapeId
                    EscherContainerRecord cp = (EscherContainerRecord)er;
                    for(Iterator<EscherRecord> spIt = cp.getChildRecords().iterator(); spIt.hasNext();) {
                        EscherContainerRecord shapeContainer = (EscherContainerRecord)spIt.next();
                        for(EscherRecord shapeChildRecord : shapeContainer.getChildRecords()) {
                            int recordId = shapeChildRecord.getRecordId();
                            if (recordId == EscherSpRecord.RECORD_ID){
                                EscherSpRecord sp = (EscherSpRecord)shapeChildRecord;
                                int shapeId = drawingManager.allocateShapeId((short)dgId, dg);
                                //allocateShapeId increments the number of shapes. roll back to the previous value
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

      this.textboxWrappers = (EscherTextboxWrapper[]) textboxes.toArray(new EscherTextboxWrapper[textboxes.size()]);
    }
  }
  private EscherTextboxWrapper[] findInDgContainer(final EscherContainerRecord escherContainerF002) {
    final List<EscherTextboxWrapper> found = new LinkedList<EscherTextboxWrapper>();
    final EscherContainerRecord SpgrContainer = findFirstEscherContainerRecordOfType((short)0xf003, escherContainerF002);
    final EscherContainerRecord[] escherContainersF004 = findAllEscherContainerRecordOfType((short)0xf004, SpgrContainer);
    for (EscherContainerRecord spContainer : escherContainersF004) {
      StyleTextProp9Atom nineAtom = findInSpContainer(spContainer);
      EscherSpRecord sp = null;
      final EscherRecord escherContainerF00A = findFirstEscherRecordOfType((short)0xf00a, spContainer);
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

      }
    }
    return (EscherTextboxWrapper[]) found.toArray(new EscherTextboxWrapper[found.size()]);
  }
  private StyleTextProp9Atom findInSpContainer(final EscherContainerRecord spContainer) {
    final EscherContainerRecord escherContainerF011 = findFirstEscherContainerRecordOfType((short)0xf011, spContainer);
    if (null == escherContainerF011) { return null; }
    final EscherContainerRecord escherContainer1388 = findFirstEscherContainerRecordOfType((short)0x1388, escherContainerF011);
    if (null == escherContainer1388) { return null; }
    final EscherContainerRecord escherContainer138A = findFirstEscherContainerRecordOfType((short)0x138A, escherContainer1388);
    if (null == escherContainer138A) { return null; }
    int size = escherContainer138A.getChildRecords().size();
    if (2 != size) { return null; }
    final Record r0 = buildFromUnknownEscherRecord((UnknownEscherRecord) escherContainer138A.getChild(0));
    final Record r1 = buildFromUnknownEscherRecord((UnknownEscherRecord) escherContainer138A.getChild(1));
    if (!(r0 instanceof CString)) { return null; }
    if (!("___PPT9".equals(((CString) r0).getText()))) { return null; };
    if (!(r1 instanceof BinaryTagDataBlob )) { return null; }
    final BinaryTagDataBlob blob = (BinaryTagDataBlob) r1;
    if (1 != blob.getChildRecords().length) { return null; }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

  /**
   * Create the Escher records associated with a new PPDrawing
   */
  private void create(){
    EscherContainerRecord dgContainer = new EscherContainerRecord();
    dgContainer.setRecordId( EscherContainerRecord.DG_CONTAINER );
    dgContainer.setOptions((short)15);

    EscherDgRecord dg = new EscherDgRecord();
    dg.setOptions((short)16);
    dg.setNumShapes(1);
    dgContainer.addChildRecord(dg);

    EscherContainerRecord spgrContainer = new EscherContainerRecord();
    spgrContainer.setOptions((short)15);
    spgrContainer.setRecordId(EscherContainerRecord.SPGR_CONTAINER);

    EscherContainerRecord spContainer = new EscherContainerRecord();
    spContainer.setOptions((short)15);
    spContainer.setRecordId(EscherContainerRecord.SP_CONTAINER);

    EscherSpgrRecord spgr = new EscherSpgrRecord();
    spgr.setOptions((short)1);
    spContainer.addChildRecord(spgr);

    EscherSpRecord sp = new EscherSpRecord();
    sp.setOptions((short)((ShapeTypes.NotPrimitive << 4) + 2));
    sp.setFlags(EscherSpRecord.FLAG_PATRIARCH | EscherSpRecord.FLAG_GROUP);
    spContainer.addChildRecord(sp);
    spgrContainer.addChildRecord(spContainer);
    dgContainer.addChildRecord(spgrContainer);

    spContainer = new EscherContainerRecord();
    spContainer.setOptions((short)15);
    spContainer.setRecordId(EscherContainerRecord.SP_CONTAINER);
    sp = new EscherSpRecord();
    sp.setOptions((short)((ShapeTypes.Rectangle << 4) + 2));
    sp.setFlags(EscherSpRecord.FLAG_BACKGROUND | EscherSpRecord.FLAG_HASSHAPETYPE);
    spContainer.addChildRecord(sp);

    EscherOptRecord opt = new EscherOptRecord();
    opt.setRecordId(EscherOptRecord.RECORD_ID);
    opt.addEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, 134217728));
    opt.addEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLBACKCOLOR, 134217733));
    opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.FILL__RECTRIGHT, 10064750));
    opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.FILL__RECTBOTTOM, 7778750));
    opt.addEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 1179666));
    opt.addEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 524288));
    opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.SHAPE__BLACKANDWHITESETTINGS, 9));
    opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.SHAPE__BACKGROUNDSHAPE, 65537));
    spContainer.addChildRecord(opt);

    dgContainer.addChildRecord(spContainer);

    childRecords = new EscherRecord[]{
      dgContainer
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

   *
   * @return EscherDgRecord
   */
  public EscherDgRecord getEscherDgRecord(){
    if(dg == null){
      EscherContainerRecord dgContainer = (EscherContainerRecord)childRecords[0];
      for(Iterator<EscherRecord> it = dgContainer.getChildIterator(); it.hasNext();){
        EscherRecord r = it.next();
        if(r instanceof EscherDgRecord){
          dg = (EscherDgRecord)r;
          break;
        }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

    public StyleTextProp9Atom[] getNumberedListInfo() {
      final List<StyleTextProp9Atom> result = new LinkedList<StyleTextProp9Atom>();
      EscherRecord[] escherRecords = this.getEscherRecords();
      for (EscherRecord escherRecord : escherRecords) {
      if (escherRecord instanceof EscherContainerRecord && (short)0xf002 == escherRecord.getRecordId()) {
        EscherContainerRecord escherContainerF002 = (EscherContainerRecord) escherRecord;
        final EscherContainerRecord escherContainerF003 = findFirstEscherContainerRecordOfType((short)0xf003, escherContainerF002);
        final EscherContainerRecord[] escherContainersF004 = findAllEscherContainerRecordOfType((short)0xf004, escherContainerF003);
        for (EscherContainerRecord containerF004 : escherContainersF004) {
          final EscherContainerRecord escherContainerF011 = findFirstEscherContainerRecordOfType((short)0xf011, containerF004);
          if (null == escherContainerF011) { continue; }
          final EscherContainerRecord escherContainer1388 = findFirstEscherContainerRecordOfType((short)0x1388, escherContainerF011);
          if (null == escherContainer1388) { continue; }
          final EscherContainerRecord escherContainer138A = findFirstEscherContainerRecordOfType((short)0x138A, escherContainer1388);
          if (null == escherContainer138A) { continue; }
          int size = escherContainer138A.getChildRecords().size();
          if (2 != size) { continue; }
          final Record r0 = buildFromUnknownEscherRecord((UnknownEscherRecord) escherContainer138A.getChild(0));
          final Record r1 = buildFromUnknownEscherRecord((UnknownEscherRecord) escherContainer138A.getChild(1));
          if (!(r0 instanceof CString)) { continue; }
          if (!("___PPT9".equals(((CString) r0).getText()))) { continue; };
          if (!(r1 instanceof BinaryTagDataBlob )) { continue; }
          final BinaryTagDataBlob blob = (BinaryTagDataBlob) r1;
          if (1 != blob.getChildRecords().length) { continue; }
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

        ExObjList exobj = ppt.getDocumentRecord().getExObjList();
        if (exobj == null) {
            return null;
        }

        EscherContainerRecord spContainer = shape.getSpContainer();
        for (Iterator<EscherRecord> it = spContainer.getChildIterator(); it.hasNext(); ) {
            EscherRecord obj = it.next();
            if (obj.getRecordId() ==  EscherClientDataRecord.RECORD_ID){
                byte[] data = obj.serialize();
                Record[] records = Record.findChildRecords(data, 8, data.length-8);
                if(records != null) find(records, exobj, lst);
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.