Examples of EscherAggregate


Examples of org.apache.poi.hssf.record.EscherAggregate

     *  use this with simple drawings, otherwise call
     *  {@link HSSFSheet#createDrawingPatriarch()} and
     *  start from scratch!
     */
    public HSSFPatriarch getDrawingPatriarch() {
        EscherAggregate agg = getDrawingEscherAggregate();
        if(agg == null) return null;
       
        HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
        agg.setPatriarch(patriarch);

        // Have it process the records into high level objects
        //  as best it can do (this step may eat anything
        //  that isn't supported, you were warned...)
        agg.convertRecordsToUserModel();

        // Return what we could cope with
        return patriarch;
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

            if(!createIfMissing) {
                // None found, and not allowed to add in
                return -1;
            }

            EscherAggregate aggregate = new EscherAggregate( drawingManager );
            loc = findFirstRecordLocBySid(EscherAggregate.sid);
            if (loc == -1) {
                loc = findFirstRecordLocBySid( WindowTwoRecord.sid );
            } else {
                getRecords().remove(loc);
            }
            getRecords().add( loc, aggregate );
            return loc;
        }
        List<RecordBase> records = getRecords();
        EscherAggregate r = EscherAggregate.createAggregate( records, loc, drawingManager );
        int startloc = loc;
        while ( loc + 1 < records.size()
                && records.get( loc ) instanceof DrawingRecord
                && records.get( loc + 1 ) instanceof ObjRecord )
        {
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

        }

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

Examples of org.apache.poi.hssf.record.EscherAggregate

            if(!createIfMissing) {
                // None found, and not allowed to add in
                return -1;
            }

            EscherAggregate aggregate = new EscherAggregate( drawingManager );
            loc = findFirstRecordLocBySid(EscherAggregate.sid);
            if (loc == -1) {
                loc = findFirstRecordLocBySid( WindowTwoRecord.sid );
            } else {
                getRecords().remove(loc);
            }
            getRecords().add( loc, aggregate );
            return loc;
        }
        List<RecordBase> records = getRecords();
        EscherAggregate r = EscherAggregate.createAggregate( records, loc, drawingManager );
        int startloc = loc;
        while ( loc + 1 < records.size()
                && records.get( loc ) instanceof DrawingRecord
                && (records.get( loc + 1 ) instanceof ObjRecord ||
                    records.get( loc + 1 ) instanceof TextObjectRecord) )
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

     * @param patriarch - copy all the shapes from this patriarch to new one
     * @param sheet where must be located new patriarch
     * @return new patriarch with copies of all shapes from the existing patriarch
     */
    static HSSFPatriarch createPatriarch(HSSFPatriarch patriarch, HSSFSheet sheet){
        HSSFPatriarch newPatriarch = new HSSFPatriarch(sheet, new EscherAggregate(true));
        newPatriarch.afterCreate();
        for (HSSFShape shape: patriarch.getChildren()){
            HSSFShape newShape;
            if (shape instanceof HSSFShapeGroup){
                newShape = ((HSSFShapeGroup)shape).cloneShape(newPatriarch);
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

        }

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

Examples of org.apache.poi.hssf.record.EscherAggregate

    public void testCloneSheetWithEmptyDrawingAggregate(){
        HSSFWorkbook b = new HSSFWorkbook();
        HSSFSheet s = b.createSheet("Test");
        HSSFPatriarch patriarch = s.createDrawingPatriarch();

        EscherAggregate agg1 = patriarch._getBoundAggregate();

        HSSFSheet s2 = s.cloneSheet(b);

        patriarch = s2.getDrawingPatriarch();

        EscherAggregate agg2 = patriarch._getBoundAggregate();

        EscherSpRecord sp1 = (EscherSpRecord) agg1.getEscherContainer().getChild(1).getChild(0).getChild(1);
        EscherSpRecord sp2 = (EscherSpRecord) agg2.getEscherContainer().getChild(1).getChild(0).getChild(1);

        assertEquals(sp1.getShapeId(), 1024);
        assertEquals(sp2.getShapeId(), 2048);

        EscherDgRecord dg = (EscherDgRecord) agg2.getEscherContainer().getChild(0);

        assertEquals(dg.getLastMSOSPID(), 2048);
        assertEquals(dg.getInstance(), 0x2);

        //everything except id and DgRecord.lastMSOSPID and DgRecord.Instance must be the same

        sp2.setShapeId(1024);
        dg.setLastMSOSPID(1024);
        dg.setInstance((short) 0x1);

        assertEquals(agg1.serialize().length, agg2.serialize().length);
        assertEquals(agg1.toXml(""), agg2.toXml(""));
        assertArrayEquals(agg1.serialize(), agg2.serialize());
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

            if(!createIfMissing) {
                // None found, and not allowed to add in
                return -1;
            }

            EscherAggregate aggregate = new EscherAggregate(true);
            loc = findFirstRecordLocBySid(EscherAggregate.sid);
            if (loc == -1) {
                loc = findFirstRecordLocBySid( WindowTwoRecord.sid );
            } else {
                getRecords().remove(loc);
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

      return new HSSFPictureData(blipRecord);
    }

    @Override
    void afterInsert(HSSFPatriarch patriarch) {
        EscherAggregate agg = patriarch._getBoundAggregate();
        agg.associateShapeToObjRecord(getEscherContainer().getChildById(EscherClientDataRecord.RECORD_ID), getObjRecord());
        EscherBSERecord bse =
                patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex());
        bse.setRef(bse.getRef() + 1);
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

     * to the standard output.
     */
    public void dumpDrawingRecords(boolean fat) {
        _sheet.aggregateDrawingRecords(_book.getDrawingManager(), false);

        EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
        List<EscherRecord> escherRecords = r.getEscherRecords();
        PrintWriter w = new PrintWriter(System.out);
        for (Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); ) {
            EscherRecord escherRecord = iterator.next();
            if (fat) {
                System.out.println(escherRecord.toString());
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.