Examples of EscherContainerRecord


Examples of org.apache.poi.ddf.EscherContainerRecord

     * @return          the index to this picture (1 based).
     */
    public int addPicture(byte[] data, int format) throws IOException {
        byte[] uid = PictureData.getChecksum(data);

        EscherContainerRecord bstore;
        int offset = 0;

        EscherContainerRecord dggContainer = _documentRecord.getPPDrawingGroup().getDggContainer();
        bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
        if (bstore == null){
            bstore = new EscherContainerRecord();
            bstore.setRecordId( EscherContainerRecord.BSTORE_CONTAINER);

            List child = dggContainer.getChildRecords();
            for ( int i = 0; i < child.size(); i++ ) {
                EscherRecord rec = (EscherRecord)child.get(i);
                if (rec.getRecordId() == EscherOptRecord.RECORD_ID){
                    child.add(i, bstore);
                    i++;
                }
            }
            dggContainer.setChildRecords(child);
        } else {
            List lst = bstore.getChildRecords();
            for ( int i = 0; i < lst.size(); i++ ) {
                EscherBSERecord bse = (EscherBSERecord) lst.get(i);
                if (Arrays.equals(bse.getUid(), uid)){
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

   * @return all shapes contained in this Sheet (Slide or Notes)
   */
  public Shape[] getShapes() {
  PPDrawing ppdrawing = getPPDrawing();
 
  EscherContainerRecord dg = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
  EscherContainerRecord spgr = null;
  List ch = dg.getChildRecords();

  for (Iterator it = ch.iterator(); it.hasNext();) {
    EscherRecord rec = (EscherRecord)it.next();
    if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER){
        spgr = (EscherContainerRecord)rec;
        break;
    }
  }
  ch = spgr.getChildRecords();

  ArrayList shapes = new ArrayList();
  for (int i=1;i<ch.size();i++) {
    EscherContainerRecord sp = (EscherContainerRecord)ch.get(i);
    Shape sh = ShapeFactory.createShape(sp, null);
    sh.setSheet(this);
    shapes.add(sh);
  }
 
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

   * @param shape - the Shape to add
   */
  public void addShape(Shape shape){
  PPDrawing ppdrawing = getPPDrawing();

  EscherContainerRecord dgContainer = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
  EscherContainerRecord spgr = (EscherContainerRecord)Shape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
  spgr.addChildRecord(shape.getSpContainer());

  EscherDgRecord dg = (EscherDgRecord)Shape.getEscherChild(dgContainer, EscherDgRecord.RECORD_ID);
  dg.setNumShapes(dg.getNumShapes()+1);
 
  shape.setSheet(this);
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

     */
    public Background getBackground(){
        if (_background == null){
            PPDrawing ppdrawing = getPPDrawing();

            EscherContainerRecord dg = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
            EscherContainerRecord spContainer = null;
            List ch = dg.getChildRecords();

            for (Iterator it = ch.iterator(); it.hasNext();) {
                EscherRecord rec = (EscherRecord)it.next();
                if (rec.getRecordId() == EscherContainerRecord.SP_CONTAINER){
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

     */
    public Background getBackground(){
        if (_background == null){
            PPDrawing ppdrawing = getPPDrawing();

            EscherContainerRecord dg = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
            EscherContainerRecord spContainer = null;
            List ch = dg.getChildRecords();

            for (Iterator it = ch.iterator(); it.hasNext();) {
                EscherRecord rec = (EscherRecord)it.next();
                if (rec.getRecordId() == EscherContainerRecord.SP_CONTAINER){
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

        EscherSpRecord sp = new EscherSpRecord();
        sp.setRecordId(EscherSpRecord.RECORD_ID);
        sp.setOptions((short) 0x1111);
        sp.setFlags(-1);
        sp.setShapeId(-1);
        EscherContainerRecord dggContainer = new EscherContainerRecord();
        dggContainer.setOptions((short) 0x000F);
        dggContainer.setRecordId((short) 0xF000);
        dggContainer.addChildRecord(sp);

        r.addEscherRecord(dggContainer);
        assertEquals(28, r.getRecordSize());

        byte[] data = new byte[28];
        int size = r.serialize(0, data);
        assertEquals("[EB, 00, 18, 00, 0F, 00, 00, F0, 10, 00, 00, 00, 11, 11, 0A, F0, 08, 00, 00, 00, FF, FF, FF, FF, FF, FF, FF, FF, ]", HexDump.toHex(data));
        assertEquals(28, size);

        assertEquals(24, dggContainer.getRecordSize());


        r = new DrawingGroupRecord( );
        r.setRawData( new byte[MAX_DATA_SIZE] );
        assertEquals( MAX_RECORD_SIZE, r.getRecordSize() );
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

    }

    public void testSerialize() throws Exception
    {

        EscherContainerRecord container1 = new EscherContainerRecord();
        EscherContainerRecord spContainer1 = new EscherContainerRecord();
        EscherContainerRecord spContainer2 = new EscherContainerRecord();
        EscherContainerRecord spContainer3 = new EscherContainerRecord();
        EscherSpRecord sp1 = new EscherSpRecord();
        EscherSpRecord sp2 = new EscherSpRecord();
        EscherSpRecord sp3 = new EscherSpRecord();
        EscherClientDataRecord d2 = new EscherClientDataRecord();
        EscherClientDataRecord d3 = new EscherClientDataRecord();

        container1.setOptions( (short) 0x000F );
        spContainer1.setOptions( (short) 0x000F );
        spContainer1.setRecordId( EscherContainerRecord.SP_CONTAINER );
        spContainer2.setOptions( (short) 0x000F );
        spContainer2.setRecordId( EscherContainerRecord.SP_CONTAINER );
        spContainer3.setOptions( (short) 0x000F );
        spContainer3.setRecordId( EscherContainerRecord.SP_CONTAINER );
        d2.setRecordId( EscherClientDataRecord.RECORD_ID );
        d2.setRemainingData( new byte[0] );
        d3.setRecordId( EscherClientDataRecord.RECORD_ID );
        d3.setRemainingData( new byte[0] );
        container1.addChildRecord( spContainer1 );
        container1.addChildRecord( spContainer2 );
        container1.addChildRecord( spContainer3 );
        spContainer1.addChildRecord( sp1 );
        spContainer2.addChildRecord( sp2 );
        spContainer3.addChildRecord( sp3 );
        spContainer2.addChildRecord( d2 );
        spContainer3.addChildRecord( d3 );

        EscherAggregate aggregate = new EscherAggregate(null);
        aggregate.addEscherRecord( container1 );
        aggregate.assoicateShapeToObjRecord( d2, new ObjRecord() );
        aggregate.assoicateShapeToObjRecord( d3, new ObjRecord() );
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

     */
    public Background getBackground(){
        if (_background == null){
            PPDrawing ppdrawing = getPPDrawing();

            EscherContainerRecord dg = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
            EscherContainerRecord spContainer = null;
            List ch = dg.getChildRecords();

            for (Iterator it = ch.iterator(); it.hasNext();) {
                EscherRecord rec = (EscherRecord)it.next();
                if (rec.getRecordId() == EscherContainerRecord.SP_CONTAINER){
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

   * @return all shapes contained in this Sheet (Slide or Notes)
   */
  public Shape[] getShapes() {
  PPDrawing ppdrawing = getPPDrawing();
 
  EscherContainerRecord dg = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
  EscherContainerRecord spgr = null;
  List ch = dg.getChildRecords();

  for (Iterator it = ch.iterator(); it.hasNext();) {
    EscherRecord rec = (EscherRecord)it.next();
    if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER){
        spgr = (EscherContainerRecord)rec;
        break;
    }
  }
  ch = spgr.getChildRecords();

  ArrayList shapes = new ArrayList();
  for (int i=1;i<ch.size();i++) {
    EscherContainerRecord sp = (EscherContainerRecord)ch.get(i);
    Shape sh = ShapeFactory.createShape(sp, null);
    sh.setSheet(this);
    shapes.add(sh);
  }
 
View Full Code Here

Examples of org.apache.poi.ddf.EscherContainerRecord

   * @param shape - the Shape to add
   */
  public void addShape(Shape shape){
  PPDrawing ppdrawing = getPPDrawing();

  EscherContainerRecord dgContainer = (EscherContainerRecord)ppdrawing.getEscherRecords()[0];
  EscherContainerRecord spgr = (EscherContainerRecord)Shape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
  spgr.addChildRecord(shape.getSpContainer());

  EscherDgRecord dg = (EscherDgRecord)Shape.getEscherChild(dgContainer, EscherDgRecord.RECORD_ID);
  dg.setNumShapes(dg.getNumShapes()+1);
 
  shape.setSheet(this);
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.