Package org.apache.poi.ddf

Examples of org.apache.poi.ddf.EscherRecord


            LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));

            int pos = offset + 4;
            for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
            {
                EscherRecord r = (EscherRecord) iterator.next();
                pos += r.serialize( pos, data, new NullEscherSerializationListener() );
            }
        }
        return getRecordSize();
    }
View Full Code Here


            return rawData.length;
        }
        int size = 0;
        for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
        {
            EscherRecord r = (EscherRecord) iterator.next();
            size += r.getRecordSize();
        }
        return size;
    }
View Full Code Here

      return findFirstWithId(id, getEscherRecords());
    }
    private EscherRecord findFirstWithId(short id, List<EscherRecord> records) {
      // Check at our level
      for(Iterator<EscherRecord> it = records.iterator(); it.hasNext();) {
        EscherRecord r = it.next();
        if(r.getRecordId() == id) {
          return r;
        }
      }
     
      // Then check our children in turn
      for(Iterator<EscherRecord> it = records.iterator(); it.hasNext();) {
        EscherRecord r = it.next();
        if(r.isContainerRecord()) {
          EscherRecord found = findFirstWithId(id, r.getChildRecords());
          if(found != null) {
            return found;
          }
        }
      }
View Full Code Here

        r.decode();
        List escherRecords = r.getEscherRecords();
        PrintWriter w = new PrintWriter(System.out);
        for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
        {
            EscherRecord escherRecord = (EscherRecord) iterator.next();
            if (fat)
                System.out.println(escherRecord.toString());
            else
                escherRecord.display(w, 0);
        }
        w.flush();
    }
View Full Code Here

    StringBuffer result = new StringBuffer();
    result.append( '[' ).append( getRecordName() ).append( ']' + nl );
    for ( Iterator iterator = getEscherRecords().iterator(); iterator.hasNext(); )
    {
      EscherRecord escherRecord = (EscherRecord) iterator.next();
      result.append( escherRecord.toString() );
    }
    result.append( "[/" ).append( getRecordName() ).append( ']' + nl );

    return result.toString();
  }
View Full Code Here

    final List<EscherRecord> shapeRecords = new ArrayList<EscherRecord>();
    EscherRecordFactory recordFactory = new DefaultEscherRecordFactory()
    {
      public EscherRecord createRecord( byte[] data, int offset )
      {
        EscherRecord r = super.createRecord( data, offset );
        if ( r.getRecordId() == EscherClientDataRecord.RECORD_ID || r.getRecordId() == EscherTextboxRecord.RECORD_ID )
        {
          shapeRecords.add( r );
        }
        return r;
      }
    };

    // Calculate the size of the buffer
    EscherAggregate agg = new EscherAggregate(drawingManager);
    int loc = locFirstDrawingRecord;
    int dataSize = 0;
    while ( loc + 1 < records.size()
        && sid( records, loc ) == DrawingRecord.sid
        && isObjectRecord( records, loc + 1 ) )
    {
      dataSize += ( (DrawingRecord) records.get( loc ) ).getData().length;
      loc += 2;
    }

    // Create one big buffer
    byte buffer[] = new byte[dataSize];
    int offset = 0;
    loc = locFirstDrawingRecord;
    while ( loc + 1 < records.size()
        && sid( records, loc ) == DrawingRecord.sid
        && isObjectRecord( records, loc + 1 ) )
    {
      DrawingRecord drawingRecord = (DrawingRecord) records.get( loc );
      System.arraycopy( drawingRecord.getData(), 0, buffer, offset, drawingRecord.getData().length );
      offset += drawingRecord.getData().length;
      loc += 2;
    }

    // Decode the shapes
    //    agg.escherRecords = new ArrayList();
    int pos = 0;
    while ( pos < dataSize )
    {
      EscherRecord r = recordFactory.createRecord( buffer, pos );
      int bytesRead = r.fillFields( buffer, pos, recordFactory );
      agg.addEscherRecord( r );
      pos += bytesRead;
    }

    // Associate the object records with the shapes
View Full Code Here

    final List spEndingOffsets = new ArrayList();
    final List shapes = new ArrayList();
    int pos = 0;
    for ( Iterator iterator = records.iterator(); iterator.hasNext(); )
    {
      EscherRecord e = (EscherRecord) iterator.next();
      pos += e.serialize( pos, buffer, new EscherSerializationListener()
      {
        public void beforeRecordSerialize( int offset, short recordId, EscherRecord record )
        {
        }
View Full Code Here

    //  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

        return anchor;
    }

  private static 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) {
View Full Code Here

        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;
          }
        }
        convertShapes( patriarch, spgrContainer, shapeToObj );
View Full Code Here

TOP

Related Classes of org.apache.poi.ddf.EscherRecord

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.