Examples of EscherBSERecord


Examples of org.apache.poi.ddf.EscherBSERecord

        blipRecord.setUID( uid );
        blipRecord.setMarker( (byte) 0xFF );
        blipRecord.setPictureData( pictureData );

        EscherBSERecord r = new EscherBSERecord();
        r.setRecordId( EscherBSERecord.RECORD_ID );
        r.setOptions( (short) ( 0x0002 | ( format << 4 ) ) );
        r.setBlipTypeMacOS( (byte) format );
        r.setBlipTypeWin32( (byte) format );
        r.setUid( uid );
        r.setTag( (short) 0xFF );
        r.setSize( pictureData.length + 25 );
        r.setRef( 1 );
        r.setOffset( 0 );
        r.setBlipRecord( blipRecord );

        return workbook.addBSERecord( r );
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

        blipRecord.setUID( uid );
        blipRecord.setMarker( (byte) 0xFF );
        blipRecord.setPictureData( pictureData );

        EscherBSERecord r = new EscherBSERecord();
        r.setRecordId( EscherBSERecord.RECORD_ID );
        r.setOptions( (short) ( 0x0002 | ( format << 4 ) ) );
        r.setBlipTypeMacOS( (byte) format );
        r.setBlipTypeWin32( (byte) format );
        r.setUid( uid );
        r.setTag( (short) 0xFF );
        r.setSize( pictureData.length + 25 );
        r.setRef( 1 );
        r.setOffset( 0 );
        r.setBlipRecord( blipRecord );

        return workbook.addBSERecord( r );
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

        HSSFPicture shape = new HSSFPicture(null, anchor);
        shape.setPictureIndex( pictureIndex );
        shape.anchor = anchor;
        addShape(shape);

        EscherBSERecord bse = _sheet.getWorkbook().getWorkbook().getBSERecord(pictureIndex);
        bse.setRef(bse.getRef() + 1);
        return shape;
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

        HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("SimpleWithImages.xls");
        InternalWorkbook iwb = wb.getWorkbook();
        iwb.findDrawingGroup();
       
        for(int pictureIndex=1; pictureIndex <= 4; pictureIndex++){
            EscherBSERecord bse = iwb.getBSERecord(pictureIndex);
            assertEquals(1, bse.getRef());
        }

        wb.cloneSheet(0);
        for(int pictureIndex=1; pictureIndex <= 4; pictureIndex++){
            EscherBSERecord bse = iwb.getBSERecord(pictureIndex);
            assertEquals(2, bse.getRef());
        }

        wb.cloneSheet(0);
        for(int pictureIndex=1; pictureIndex <= 4; pictureIndex++){
            EscherBSERecord bse = iwb.getBSERecord(pictureIndex);
            assertEquals(3, bse.getRef());
        }
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

                                EscherSimpleProperty prop = (EscherSimpleProperty)opt.lookup(
                                        EscherProperties.BLIP__BLIPTODISPLAY );
                                if (prop != null){
                                    int pictureIndex = prop.getPropertyValue();
                                    // increment reference count for pictures
                                    EscherBSERecord bse = getBSERecord(pictureIndex);
                                    bse.setRef(bse.getRef() + 1);
                                }

                            }
                        }
                    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

      dggContainer.addChildBefore(bstore, EscherOptRecord.RECORD_ID);
    } else {
      Iterator<EscherRecord> iter = bstore.getChildIterator();
      for (int i = 0; iter.hasNext(); i++) {
        EscherBSERecord bse = (EscherBSERecord) iter.next();
        if (Arrays.equals(bse.getUid(), uid)) {
          return i + 1;
        }
      }
    }

    PictureData pict = PictureData.create(format);
    pict.setData(data);

    int offset = _hslfSlideShow.addPicture(pict);

    EscherBSERecord bse = new EscherBSERecord();
    bse.setRecordId(EscherBSERecord.RECORD_ID);
    bse.setOptions((short) (0x0002 | (format << 4)));
    bse.setSize(pict.getRawData().length + 8);
    bse.setUid(uid);

    bse.setBlipTypeMacOS((byte) format);
    bse.setBlipTypeWin32((byte) format);

    if (format == Picture.EMF)
      bse.setBlipTypeMacOS((byte) Picture.PICT);
    else if (format == Picture.WMF)
      bse.setBlipTypeMacOS((byte) Picture.PICT);
    else if (format == Picture.PICT)
      bse.setBlipTypeWin32((byte) Picture.WMF);

    bse.setRef(0);
    bse.setOffset(offset);
    bse.setRemainingData(new byte[0]);

    bstore.addChildRecord(bse);
    int count = bstore.getChildRecords().size();
    bstore.setOptions((short) ((count << 4) | 0xF));
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

        EscherRecord escherRecord = _blipRecords.get( 0 );
        switch ( escherRecord.getRecordId() )
        {
        case (short) 0xF007:
        {
            EscherBSERecord bseRecord = (EscherBSERecord) escherRecord;
            switch ( bseRecord.getBlipTypeWin32() )
            {
            case 0x00:
                return PictureType.UNKNOWN;
            case 0x01:
                return PictureType.UNKNOWN;
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

     */
    private void searchForPictures(List<EscherRecord> escherRecords, List<Picture> pictures)
    {
       for(EscherRecord escherRecord : escherRecords) {
          if (escherRecord instanceof EscherBSERecord) {
              EscherBSERecord bse = (EscherBSERecord) escherRecord;
              EscherBlipRecord blip = bse.getBlipRecord();
              if (blip != null)
              {
                  pictures.add(new Picture(blip));
              }
                else if ( bse.getOffset() > 0 )
                {
                    try
                    {
                        // Blip stored in delay stream, which in a word doc, is
                        // the main stream
                        EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
                        EscherRecord record = recordFactory.createRecord(
                                _mainStream, bse.getOffset() );

                        if ( record instanceof EscherBlipRecord )
                        {
                            record.fillFields( _mainStream, bse.getOffset(),
                                    recordFactory );
                            blip = (EscherBlipRecord) record;
                            pictures.add( new Picture( blip ) );
                        }
                    }
                    catch ( Exception exc )
                    {
                        logger.log(
                                POILogger.WARN,
                                "Unable to load picture from BLIB record at offset #",
                                Integer.valueOf( bse.getOffset() ), exc );
                    }
                }
          }

          // Recursive call.
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

        blipRecord.setUID( uid );
        blipRecord.setMarker( (byte) 0xFF );
        blipRecord.setPictureData( pictureData );

        EscherBSERecord r = new EscherBSERecord();
        r.setRecordId( EscherBSERecord.RECORD_ID );
        r.setOptions( (short) ( 0x0002 | ( format << 4 ) ) );
        r.setBlipTypeMacOS( (byte) format );
        r.setBlipTypeWin32( (byte) format );
        r.setUid( uid );
        r.setTag( (short) 0xFF );
        r.setSize( pictureData.length + 25 );
        r.setRef( 1 );
        r.setOffset( 0 );
        r.setBlipRecord( blipRecord );

        return workbook.addBSERecord( r );
    }
View Full Code Here

Examples of org.apache.poi.ddf.EscherBSERecord

     * Return the dimension of this image
     *
     * @return image dimension
     */
    public Dimension getImageDimension(){
        EscherBSERecord bse = _patriarch._sheet._book.getBSERecord(_pictureIndex);
        byte[] data = bse.getBlipRecord().getPicturedata();
        int type = bse.getBlipTypeWin32();
        return ImageUtils.getImageDimension(new ByteArrayInputStream(data), type);
    }
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.