Example #1
0
        /// <summary>
        /// Creates the lowerlevel escher records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private EscherContainerRecord CreateSpContainer(HSSFSimpleShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherClientDataRecord clientData  = new EscherClientDataRecord();

            spContainer.RecordId = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options  = (short)0x000F;
            sp.RecordId          = EscherSpRecord.RECORD_ID;
            short shapeType = objTypeToShapeType(hssfShape.ShapeType);

            sp.Options   = (short)((shapeType << 4) | 0x2);
            sp.ShapeId   = shapeId;
            sp.Flags     = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
            opt.RecordId = EscherOptRecord.RECORD_ID;
            AddStandardOptions(shape, opt);
            EscherRecord anchor = CreateAnchor(shape.Anchor);

            clientData.RecordId = EscherClientDataRecord.RECORD_ID;
            clientData.Options  = (short)0x0000;

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            return(spContainer);
        }
Example #2
0
    /**
     * Create a new Placeholder and Initialize internal structures
     *
     * @return the Created <code>EscherContainerRecord</code> which holds shape data
     */
    protected EscherContainerRecord CreateSpContainer(int idx, bool IsChild) {
        _escherContainer = super.CreateSpContainer(idx, isChild);

        EscherSpRecord spRecord = _escherContainer.GetChildById(EscherSpRecord.RECORD_ID);
        spRecord.SetFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE | EscherSpRecord.FLAG_OLESHAPE);

        SetShapeType(ShapeTypes.HostControl);
        SetEscherProperty(EscherProperties.BLIP__PICTUREID, idx);
        SetEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001);
        SetEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008);
        SetEscherProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
        SetEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, -1);

        EscherClientDataRecord cldata = new EscherClientDataRecord();
        cldata.SetOptions((short)0xF);
        _escherContainer.AddChildRecord(cldata); // TODO unit Test to prove GetChildRecords().add is wrong

        OEShapeAtom oe = new OEShapeAtom();

        //convert hslf into ddf
        MemoryStream out = new MemoryStream();
        try {
            oe.WriteOut(out);
        } catch(Exception e){
            throw new HSLFException(e);
        }
        cldata.SetRemainingData(out.ToArray());

        return _escherContainer;
    }
Example #3
0
    /**
     * Create a new Placeholder and Initialize internal structures
     *
     * @return the Created <code>EscherContainerRecord</code> which holds shape data
     */
    protected EscherContainerRecord CreateSpContainer(int idx, bool IsChild) {
        _escherContainer = super.CreateSpContainer(idx, isChild);

        SetEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x1000100);
        SetEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x10001);

        EscherClientDataRecord cldata = new EscherClientDataRecord();
        cldata.SetOptions((short)0xF);
        _escherContainer.AddChildRecord(cldata);

        OEShapeAtom oe = new OEShapeAtom();
        InteractiveInfo info = new InteractiveInfo();
        InteractiveInfoAtom infoAtom = info.GetInteractiveInfoAtom();
        infoAtom.SetAction(InteractiveInfoAtom.ACTION_MEDIA);
        infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_NULL);

        AnimationInfo an = new AnimationInfo();
        AnimationInfoAtom anAtom = an.GetAnimationInfoAtom();
        anAtom.SetFlag(AnimationInfoAtom.Automatic, true);

        //convert hslf into ddf
        MemoryStream out = new MemoryStream();
        try {
            oe.WriteOut(out);
            an.WriteOut(out);
            info.WriteOut(out);
        } catch(Exception e){
            throw new HSLFException(e);
        }
        cldata.SetRemainingData(out.ToArray());

        return _escherContainer;
    }
Example #4
0
        /**
         * Generates the escher shape records for this shape.
         */
        private EscherContainerRecord CreateSpContainer(HSSFSimpleShape shape, int shapeId)
        {
            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherClientDataRecord clientData  = new EscherClientDataRecord();

            spContainer.RecordId = (EscherContainerRecord.SP_CONTAINER);
            spContainer.Options  = ((short)0x000F);
            sp.RecordId          = (EscherSpRecord.RECORD_ID);
            sp.Options           = ((short)((EscherAggregate.ST_HOSTCONTROL << 4) | 0x2));

            sp.ShapeId   = (shapeId);
            sp.Flags     = (EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
            opt.RecordId = (EscherOptRecord.RECORD_ID);
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 17039620));
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x00080008));
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080000));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00020000));

            HSSFClientAnchor userAnchor = (HSSFClientAnchor)shape.Anchor;

            userAnchor.AnchorType = 1;
            EscherRecord anchor = CreateAnchor(userAnchor);

            clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
            clientData.Options  = ((short)0x0000);

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            return(spContainer);
        }
Example #5
0
        private EscherClientDataRecord CreateRecord()
        {
            EscherClientDataRecord r = new EscherClientDataRecord();

            r.Options       = (short)0x0002;
            r.RecordId      = EscherClientDataRecord.RECORD_ID;
            r.RemainingData = new byte[] { };
            return(r);
        }
Example #6
0
        /// <summary>
        /// Creates the lowerlevel escher records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private EscherContainerRecord CreateSpContainer(HSSFTextbox hssfShape, int shapeId)
        {
            HSSFTextbox shape = hssfShape;

            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherRecord           anchor      = new EscherClientAnchorRecord();
            EscherClientDataRecord clientData  = new EscherClientDataRecord();

            escherTextbox = new EscherTextboxRecord();

            spContainer.RecordId = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options  = (short)0x000F;
            sp.RecordId          = EscherSpRecord.RECORD_ID;
            sp.Options           = (short)((EscherAggregate.ST_TEXTBOX << 4) | 0x2);

            sp.ShapeId   = shapeId;
            sp.Flags     = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
            opt.RecordId = EscherOptRecord.RECORD_ID;
            //        opt.AddEscherProperty( new EscherBoolProperty( EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 262144 ) );
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTID, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTLEFT, shape.MarginLeft));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTRIGHT, shape.MarginRight));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTBOTTOM, shape.MarginBottom));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTTOP, shape.MarginTop));

            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__WRAPTEXT, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__ANCHORTEXT, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));

            AddStandardOptions(shape, opt);
            HSSFAnchor userAnchor = shape.Anchor;

            //        if (userAnchor.IsHorizontallyFlipped())
            //            sp.Flags(sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ);
            //        if (userAnchor.IsVerticallyFlipped())
            //            sp.Flags(sp.Flags | EscherSpRecord.FLAG_FLIPVERT);
            anchor = CreateAnchor(userAnchor);
            clientData.RecordId    = EscherClientDataRecord.RECORD_ID;
            clientData.Options     = (short)0x0000;
            escherTextbox.RecordId = EscherTextboxRecord.RECORD_ID;
            escherTextbox.Options  = (short)0x0000;

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);
            spContainer.AddChildRecord(escherTextbox);

            return(spContainer);
        }
Example #7
0
        public void TestSerialize()
        {
            EscherClientDataRecord r = CreateRecord();

            byte[] data         = new byte[8];
            int    bytesWritten = r.Serialize(0, data);

            Assert.AreEqual(8, bytesWritten);
            Assert.AreEqual("[02, 00, " +
                            "11, F0, " +
                            "00, 00, 00, 00]",
                            HexDump.ToHex(data));
        }
Example #8
0
        /**
         * Generates the shape records for this shape.
         */

        protected override EscherContainerRecord CreateSpContainer()
        {
            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherClientDataRecord clientData  = new EscherClientDataRecord();

            spContainer.RecordId = (EscherContainerRecord.SP_CONTAINER);
            spContainer.Options  = ((short)0x000F);
            sp.RecordId          = (EscherSpRecord.RECORD_ID);
            sp.Options           = ((short)((EscherAggregate.ST_NOT_PRIMATIVE << 4) | 0x2));
            if (Parent == null)
            {
                sp.Flags = (EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
            }
            else
            {
                sp.Flags = (EscherSpRecord.FLAG_CHILD | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
            }
            opt.RecordId = (EscherOptRecord.RECORD_ID);
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.TRANSFORM__ROTATION, false, false, 0));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, false, false, 100));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, false, false, 100));
            opt.SetEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));

            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__FILLOK, false, false, 0x00010001));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINESTARTARROWHEAD, false, false, 0x0));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDARROWHEAD, false, false, 0x0));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, false, false, 0x0));

            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID));
            opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT));
            opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT));
            opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT));
            opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 1));

            opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));

            EscherRecord anchor = Anchor.GetEscherAnchor();

            clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
            clientData.Options  = ((short)0x0000);

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            return(spContainer);
        }
Example #9
0
        public void TestFillFields()
        {
            String hexData = "02 00 " +
                             "11 F0 " +
                             "00 00 00 00 ";

            byte[] data = HexRead.ReadFromString(hexData);
            EscherClientDataRecord r = new EscherClientDataRecord();
            int bytesWritten         = r.FillFields(data, new DefaultEscherRecordFactory());

            Assert.AreEqual(8, bytesWritten);
            Assert.AreEqual(unchecked ((short)0xF011), r.RecordId);
            Assert.AreEqual("[]", HexDump.ToHex(r.RemainingData));
        }
Example #10
0
        protected override EscherContainerRecord CreateSpContainer()
        {
            EscherContainerRecord  spContainer   = new EscherContainerRecord();
            EscherSpRecord         sp            = new EscherSpRecord();
            EscherOptRecord        opt           = new EscherOptRecord();
            EscherClientDataRecord clientData    = new EscherClientDataRecord();
            EscherTextboxRecord    escherTextbox = new EscherTextboxRecord();

            spContainer.RecordId = (EscherContainerRecord.SP_CONTAINER);
            spContainer.Options  = ((short)0x000F);
            sp.RecordId          = (EscherSpRecord.RECORD_ID);
            sp.Options           = ((short)((EscherAggregate.ST_TEXTBOX << 4) | 0x2));

            sp.Flags     = (EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
            opt.RecordId = (EscherOptRecord.RECORD_ID);
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTID, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__WRAPTEXT, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__ANCHORTEXT, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));

            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTLEFT, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTRIGHT, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTTOP, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTBOTTOM, 0));

            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID));
            opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
            opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT));
            opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT));
            opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT));
            opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE));
            opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));

            EscherRecord anchor = Anchor.GetEscherAnchor();

            clientData.RecordId    = (EscherClientDataRecord.RECORD_ID);
            clientData.Options     = ((short)0x0000);
            escherTextbox.RecordId = (EscherTextboxRecord.RECORD_ID);
            escherTextbox.Options  = ((short)0x0000);

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);
            spContainer.AddChildRecord(escherTextbox);

            return(spContainer);
        }
Example #11
0
        protected override EscherContainerRecord CreateSpContainer()
        {
            EscherContainerRecord  spgrContainer = new EscherContainerRecord();
            EscherContainerRecord  spContainer   = new EscherContainerRecord();
            EscherSpgrRecord       spgr          = new EscherSpgrRecord();
            EscherSpRecord         sp            = new EscherSpRecord();
            EscherOptRecord        opt           = new EscherOptRecord();
            EscherRecord           anchor;
            EscherClientDataRecord clientData = new EscherClientDataRecord();

            spgrContainer.RecordId = (EscherContainerRecord.SPGR_CONTAINER);
            spgrContainer.Options  = ((short)0x000F);
            spContainer.RecordId   = (EscherContainerRecord.SP_CONTAINER);
            spContainer.Options    = (short)0x000F;
            spgr.RecordId          = (EscherSpgrRecord.RECORD_ID);
            spgr.Options           = (short)0x0001;
            spgr.RectX1            = (0);
            spgr.RectY1            = (0);
            spgr.RectX2            = (1023);
            spgr.RectY2            = (255);
            sp.RecordId            = (EscherSpRecord.RECORD_ID);
            sp.Options             = (short)0x0002;
            if (this.Anchor is HSSFClientAnchor)
            {
                sp.Flags = (EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR);
            }
            else
            {
                sp.Flags = (EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_CHILD);
            }
            opt.RecordId = (EscherOptRecord.RECORD_ID);
            opt.Options  = ((short)0x0023);
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004));
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));

            anchor = Anchor.GetEscherAnchor();
            clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
            clientData.Options  = ((short)0x0000);

            spgrContainer.AddChildRecord(spContainer);
            spContainer.AddChildRecord(spgr);
            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);
            return(spgrContainer);
        }
Example #12
0
        public void TestSerialize()
        {
            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.Options    = ((short)0x000F);
            spContainer1.Options  = ((short)0x000F);
            spContainer1.RecordId = (EscherContainerRecord.SP_CONTAINER);
            spContainer2.Options  = ((short)0x000F);
            spContainer2.RecordId = (EscherContainerRecord.SP_CONTAINER);
            spContainer3.Options  = ((short)0x000F);
            spContainer3.RecordId = (EscherContainerRecord.SP_CONTAINER);
            d2.RecordId           = (EscherClientDataRecord.RECORD_ID);
            d2.RemainingData      = (new byte[0]);
            d3.RecordId           = (EscherClientDataRecord.RECORD_ID);
            d3.RemainingData      = (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());

            byte[] data         = new byte[112];
            int    bytesWritten = aggregate.Serialize(0, data);

            Assert.AreEqual(112, bytesWritten);
            Assert.AreEqual("[EC, 00, 40, 00, 0F, 00, 00, 00, 58, 00, 00, 00, 0F, 00, 04, F0, 10, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, EC, 00, 20, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, ]",
                            HexDump.ToHex(data));
        }
Example #13
0
        protected override EscherContainerRecord CreateSpContainer()
        {
            EscherContainerRecord spContainer = new EscherContainerRecord();

            spContainer.RecordId = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options  = ((short)0x000F);

            EscherSpRecord sp = new EscherSpRecord();

            sp.RecordId = (EscherSpRecord.RECORD_ID);
            sp.Flags    = (EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
            sp.Version  = ((short)0x2);

            EscherClientDataRecord clientData = new EscherClientDataRecord();

            clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
            clientData.Options  = ((short)(0x0000));

            EscherOptRecord optRecord = new EscherOptRecord();

            optRecord.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID));
            optRecord.SetEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
            //        optRecord.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT));
            optRecord.SetEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT));
            optRecord.SetEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT));
            optRecord.SetEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE));
            optRecord.SetEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));

            optRecord.SetEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));
            optRecord.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
            optRecord.RecordId = EscherOptRecord.RECORD_ID;

            EscherTextboxRecord escherTextbox = new EscherTextboxRecord();

            escherTextbox.RecordId = (EscherTextboxRecord.RECORD_ID);
            escherTextbox.Options  = (short)0x0000;

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(optRecord);
            spContainer.AddChildRecord(this.Anchor.GetEscherAnchor());
            spContainer.AddChildRecord(clientData);
            spContainer.AddChildRecord(escherTextbox);
            return(spContainer);
        }
Example #14
0
        /// <summary>
        /// Creates the lowerlevel escher records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private EscherContainerRecord CreateSpContainer(HSSFSimpleShape hssfShape, int shapeId)
        {
            HSSFPicture shape = (HSSFPicture)hssfShape;

            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherRecord           anchor;
            EscherClientDataRecord clientData = new EscherClientDataRecord();

            spContainer.RecordId = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options  = (short)0x000F;
            sp.RecordId          = EscherSpRecord.RECORD_ID;
            sp.Options           = (short)((EscherAggregate.ST_PICTUREFRAME << 4) | 0x2);

            sp.ShapeId   = shapeId;
            sp.Flags     = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
            opt.RecordId = EscherOptRecord.RECORD_ID;
            //        opt.AddEscherProperty( new EscherBoolProperty( EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00800080 ) ;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.BLIP__BLIPTODISPLAY, false, true, shape.PictureIndex));
            //        opt.AddEscherProperty( new EscherComplexProperty( EscherProperties.BLIP__BLIPFILENAME, true, new byte[] { (byte)0x74, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x00, (byte)0x00 } ) ;
            //        opt.AddEscherProperty( new EscherSimpleProperty( EscherProperties.Fill__FillTYPE, 0x00000003 ) ;
            AddStandardOptions(shape, opt);
            HSSFAnchor userAnchor = shape.Anchor;

            if (userAnchor.IsHorizontallyFlipped)
            {
                sp.Flags = sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ;
            }
            if (userAnchor.IsVerticallyFlipped)
            {
                sp.Flags = sp.Flags | EscherSpRecord.FLAG_FLIPVERT;
            }
            anchor = CreateAnchor(userAnchor);
            clientData.RecordId = EscherClientDataRecord.RECORD_ID;
            clientData.Options  = (short)0x0000;

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            return(spContainer);
        }
Example #15
0
    /**
     * Create a new Placeholder and Initialize internal structures
     *
     * @return the Created <code>EscherContainerRecord</code> which holds shape data
     */
    protected EscherContainerRecord CreateSpContainer(bool IsChild){
        _escherContainer = super.CreateSpContainer(isChild);

        EscherSpRecord spRecord = _escherContainer.GetChildById(EscherSpRecord.RECORD_ID);
        spRecord.SetFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HAVEMASTER);

        EscherClientDataRecord cldata = new EscherClientDataRecord();
        cldata.SetOptions((short)15);

        EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);

        //Placeholders can't be grouped
        SetEscherProperty(opt, EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 262144);

        //OEPlaceholderAtom tells powerpoint that this shape is a placeholder
        //
        OEPlaceholderAtom oep = new OEPlaceholderAtom();
        /**
         * Extarct from MSDN:
         *
         * There is a special case when the placeholder does not have a position in the layout.
         * This occurs when the user has moved the placeholder from its original position.
         * In this case the placeholder ID is -1.
         */
        oep.SetPlacementId(-1);

        oep.SetPlaceholderId(OEPlaceholderAtom.Body);

        //convert hslf into ddf record
        MemoryStream out = new MemoryStream();
        try {
            oep.WriteOut(out);
        } catch(Exception e){
            throw new HSLFException(e);
        }
        cldata.SetRemainingData(out.ToArray());

        //append placeholder Container before EscherTextboxRecord
        _escherContainer.AddChildBefore(cldata, EscherTextboxRecord.RECORD_ID);

        return _escherContainer;
    }
Example #16
0
        /// <summary>
        /// Creates the lowerlevel escher records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private EscherContainerRecord CreateSpContainer(HSSFSimpleShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherRecord           anchor      = new EscherClientAnchorRecord();
            EscherClientDataRecord clientData  = new EscherClientDataRecord();

            spContainer.RecordId = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options  = (short)0x000F;
            sp.RecordId          = EscherSpRecord.RECORD_ID;
            sp.Options           = (short)((EscherAggregate.ST_LINE << 4) | 0x2);

            sp.ShapeId   = shapeId;
            sp.Flags     = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
            opt.RecordId = EscherOptRecord.RECORD_ID;
            opt.AddEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 1048592));
            AddStandardOptions(shape, opt);
            HSSFAnchor userAnchor = shape.Anchor;

            if (userAnchor.IsHorizontallyFlipped)
            {
                sp.Flags = sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ;
            }
            if (userAnchor.IsVerticallyFlipped)
            {
                sp.Flags = sp.Flags | EscherSpRecord.FLAG_FLIPVERT;
            }
            anchor = CreateAnchor(userAnchor);
            clientData.RecordId = EscherClientDataRecord.RECORD_ID;
            clientData.Options  = ((short)0x0000);

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            return(spContainer);
        }
Example #17
0
 /**
  * Search for EscherClientDataRecord, if found, convert its contents into an array of HSLF records
  *
  * @return an array of HSLF records Contained in the shape's EscherClientDataRecord or <code>null</code>
  */
 protected Record[] GetClientRecords()
 {
     if (_clientData == null)
     {
         EscherRecord r = Shape.GetEscherChild(GetSpContainer(), EscherClientDataRecord.RECORD_ID);
         //ddf can return EscherContainerRecord with recordId=EscherClientDataRecord.RECORD_ID
         //convert in to EscherClientDataRecord on the fly
         if (r != null && !(r is EscherClientDataRecord))
         {
             byte[] data = r.Serialize();
             r = new EscherClientDataRecord();
             r.FillFields(data, 0, new DefaultEscherRecordFactory());
         }
         _clientData = (EscherClientDataRecord)r;
     }
     if (_clientData != null && _clientRecords == null)
     {
         byte[] data = _clientData.GetRemainingData();
         _clientRecords = Record.FindChildRecords(data, 0, data.Length);
     }
     return(_clientRecords);
 }
Example #18
0
        public void SetHyperlink(Hyperlink link)
        {
            if (link.GetId() == -1)
            {
                throw new HSLFException("You must call SlideShow.AddHyperlink(Hyperlink link) first");
            }

            EscherClientDataRecord cldata = new EscherClientDataRecord();

            cldata.SetOptions((short)0xF);
            GetSpContainer().AddChildRecord(cldata); // TODO - junit to prove GetChildRecords().add is wrong

            InteractiveInfo     info     = new InteractiveInfo();
            InteractiveInfoAtom infoAtom = info.GetInteractiveInfoAtom();

            switch (link.GetType())
            {
            case Hyperlink.LINK_FIRSTSLIDE:
                infoAtom.SetAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.SetJump(InteractiveInfoAtom.JUMP_FIRSTSLIDE);
                infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_FirstSlide);
                break;

            case Hyperlink.LINK_LASTSLIDE:
                infoAtom.SetAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.SetJump(InteractiveInfoAtom.JUMP_LASTSLIDE);
                infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_LastSlide);
                break;

            case Hyperlink.LINK_NEXTSLIDE:
                infoAtom.SetAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.SetJump(InteractiveInfoAtom.JUMP_NEXTSLIDE);
                infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_NextSlide);
                break;

            case Hyperlink.LINK_PREVIOUSSLIDE:
                infoAtom.SetAction(InteractiveInfoAtom.ACTION_JUMP);
                infoAtom.SetJump(InteractiveInfoAtom.JUMP_PREVIOUSSLIDE);
                infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_PreviousSlide);
                break;

            case Hyperlink.LINK_URL:
                infoAtom.SetAction(InteractiveInfoAtom.ACTION_HYPERLINK);
                infoAtom.SetJump(InteractiveInfoAtom.JUMP_NONE);
                infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_Url);
                break;
            }

            infoAtom.SetHyperlinkID(link.GetId());

            MemoryStream out1 = new MemoryStream();

            try
            {
                info.WriteOut(out1);
            }
            catch (Exception e)
            {
                throw new HSLFException(e);
            }
            cldata.SetRemainingData(out1.ToArray());
        }
        /**
         * build shape tree from escher container
         * @param container root escher container from which escher records must be taken
         * @param agg - EscherAggregate
         * @param out - shape container to which shapes must be added
         * @param root - node to create HSSFObjectData shapes
         */

        public static void CreateShapeTree(EscherContainerRecord container, EscherAggregate agg,
                                           HSSFShapeContainer out1, DirectoryNode root)
        {
            if (container.RecordId == EscherContainerRecord.SPGR_CONTAINER)
            {
                ObjRecord obj = null;
                EscherClientDataRecord clientData = (EscherClientDataRecord)((EscherContainerRecord)container.GetChild(0)).GetChildById(EscherClientDataRecord.RECORD_ID);
                if (null != clientData)
                {
                    obj = (ObjRecord)agg.GetShapeToObjMapping()[clientData];
                }
                HSSFShapeGroup group = new HSSFShapeGroup(container, obj);
                IList <EscherContainerRecord> children = container.ChildContainers;
                // skip the first child record, it is group descriptor
                for (int i = 0; i < children.Count; i++)
                {
                    EscherContainerRecord spContainer = children[(i)];
                    if (i != 0)
                    {
                        CreateShapeTree(spContainer, agg, group, root);
                    }
                }
                out1.AddShape(group);
            }
            else if (container.RecordId == EscherContainerRecord.SP_CONTAINER)
            {
                Dictionary <EscherRecord, Record.Record> shapeToObj = agg.GetShapeToObjMapping();
                ObjRecord        objRecord = null;
                TextObjectRecord txtRecord = null;

                foreach (EscherRecord record in container.ChildRecords)
                {
                    switch (record.RecordId)
                    {
                    case EscherClientDataRecord.RECORD_ID:
                        objRecord = (ObjRecord)shapeToObj[(record)];
                        break;

                    case EscherTextboxRecord.RECORD_ID:
                        txtRecord = (TextObjectRecord)shapeToObj[(record)];
                        break;
                    }
                }
                if (IsEmbeddedObject(objRecord))
                {
                    HSSFObjectData objectData = new HSSFObjectData(container, objRecord, root);
                    out1.AddShape(objectData);
                    return;
                }
                CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)objRecord.SubRecords[0];
                HSSFShape shape;
                switch (cmo.ObjectType)
                {
                case CommonObjectType.Picture:
                    shape = new HSSFPicture(container, objRecord);
                    break;

                case CommonObjectType.Rectangle:
                    shape = new HSSFSimpleShape(container, objRecord, txtRecord);
                    break;

                case CommonObjectType.Line:
                    shape = new HSSFSimpleShape(container, objRecord);
                    break;

                case CommonObjectType.ComboBox:
                    shape = new HSSFCombobox(container, objRecord);
                    break;

                case CommonObjectType.MicrosoftOfficeDrawing:
                    EscherOptRecord optRecord = (EscherOptRecord)container.GetChildById(EscherOptRecord.RECORD_ID);
                    EscherProperty  property  = optRecord.Lookup(EscherProperties.GEOMETRY__VERTICES);
                    if (null != property)
                    {
                        shape = new HSSFPolygon(container, objRecord, txtRecord);
                    }
                    else
                    {
                        shape = new HSSFSimpleShape(container, objRecord, txtRecord);
                    }
                    break;

                case CommonObjectType.Text:
                    shape = new HSSFTextbox(container, objRecord, txtRecord);
                    break;

                case CommonObjectType.Comment:
                    shape = new HSSFComment(container, objRecord, txtRecord, agg.GetNoteRecordByObj(objRecord));
                    break;

                default:
                    shape = new HSSFSimpleShape(container, objRecord, txtRecord);
                    break;
                }
                out1.AddShape(shape);
            }
        }
Example #20
0
        /// <summary>
        /// Creates the lowerlevel escher records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private EscherContainerRecord CreateSpContainer(HSSFPolygon hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            EscherContainerRecord  spContainer = new EscherContainerRecord();
            EscherSpRecord         sp          = new EscherSpRecord();
            EscherOptRecord        opt         = new EscherOptRecord();
            EscherClientDataRecord clientData  = new EscherClientDataRecord();

            spContainer.RecordId = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options  = (short)0x000F;
            sp.RecordId          = EscherSpRecord.RECORD_ID;
            sp.Options           = (short)((EscherAggregate.ST_DONUT << 4) | 0x2);
            sp.ShapeId           = shapeId;
            if (hssfShape.Parent == null)
            {
                sp.Flags = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
            }
            else
            {
                sp.Flags = EscherSpRecord.FLAG_CHILD | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
            }
            opt.RecordId = EscherOptRecord.RECORD_ID;
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TRANSFORM__ROTATION, false, false, 0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, false, false, hssfShape.DrawAreaWidth));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, false, false, hssfShape.DrawAreaHeight));
            opt.AddEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));
            EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, new byte[0]);

            verticesProp.NumberOfElementsInArray  = (hssfShape.XPoints.Length + 1);
            verticesProp.NumberOfElementsInMemory = (hssfShape.XPoints.Length + 1);
            verticesProp.SizeOfElements           = unchecked ((short)0xFFF0);
            for (int i = 0; i < hssfShape.XPoints.Length; i++)
            {
                byte[] data = new byte[4];
                LittleEndian.PutShort(data, 0, (short)hssfShape.XPoints[i]);
                LittleEndian.PutShort(data, 2, (short)hssfShape.YPoints[i]);
                verticesProp.SetElement(i, data);
            }
            int point = hssfShape.XPoints.Length;

            byte[] data1 = new byte[4];
            LittleEndian.PutShort(data1, 0, (short)hssfShape.XPoints[0]);
            LittleEndian.PutShort(data1, 2, (short)hssfShape.YPoints[0]);
            verticesProp.SetElement(point, data1);
            opt.AddEscherProperty(verticesProp);
            EscherArrayProperty segmentsProp = new EscherArrayProperty(EscherProperties.GEOMETRY__SEGMENTINFO, false, null);

            segmentsProp.SizeOfElements           = (0x0002);
            segmentsProp.NumberOfElementsInArray  = (hssfShape.XPoints.Length * 2 + 4);
            segmentsProp.NumberOfElementsInMemory = (hssfShape.XPoints.Length * 2 + 4);
            segmentsProp.SetElement(0, new byte[] { (byte)0x00, (byte)0x40 });
            segmentsProp.SetElement(1, new byte[] { (byte)0x00, (byte)0xAC });
            for (int i = 0; i < hssfShape.XPoints.Length; i++)
            {
                segmentsProp.SetElement(2 + i * 2, new byte[] { (byte)0x01, (byte)0x00 });
                segmentsProp.SetElement(3 + i * 2, new byte[] { (byte)0x00, (byte)0xAC });
            }
            segmentsProp.SetElement(segmentsProp.NumberOfElementsInArray - 2, new byte[] { (byte)0x01, (byte)0x60 });
            segmentsProp.SetElement(segmentsProp.NumberOfElementsInArray - 1, new byte[] { (byte)0x00, (byte)0x80 });
            opt.AddEscherProperty(segmentsProp);
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__FillOK, false, false, 0x00010001));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINESTARTARROWHEAD, false, false, 0x0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDARROWHEAD, false, false, 0x0));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, false, false, 0x0));

            AddStandardOptions(shape, opt);

            EscherRecord anchor = CreateAnchor(shape.Anchor);

            clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
            clientData.Options  = (short)0x0000;

            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            return(spContainer);
        }
        private void ConvertGroup(HSSFShapeGroup shape, EscherContainerRecord escherParent, Hashtable shapeToObj)
        {
            EscherContainerRecord  spgrContainer = new EscherContainerRecord();
            EscherContainerRecord  spContainer   = new EscherContainerRecord();
            EscherSpgrRecord       spgr          = new EscherSpgrRecord();
            EscherSpRecord         sp            = new EscherSpRecord();
            EscherOptRecord        opt           = new EscherOptRecord();
            EscherRecord           anchor;
            EscherClientDataRecord clientData = new EscherClientDataRecord();

            spgrContainer.RecordId = EscherContainerRecord.SPGR_CONTAINER;
            spgrContainer.Options  = (short)0x000F;
            spContainer.RecordId   = EscherContainerRecord.SP_CONTAINER;
            spContainer.Options    = (short)0x000F;
            spgr.RecordId          = EscherSpgrRecord.RECORD_ID;
            spgr.Options           = (short)0x0001;
            spgr.RectX1            = shape.X1;
            spgr.RectY1            = shape.Y1;
            spgr.RectX2            = shape.X2;
            spgr.RectY2            = shape.Y2;
            sp.RecordId            = EscherSpRecord.RECORD_ID;
            sp.Options             = (short)0x0002;
            int shapeId = drawingManager.AllocateShapeId(drawingGroupId);

            sp.ShapeId = shapeId;
            if (shape.Anchor is HSSFClientAnchor)
            {
                sp.Flags = EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR;
            }
            else
            {
                sp.Flags = EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_CHILD;
            }
            opt.RecordId = EscherOptRecord.RECORD_ID;
            opt.Options  = (short)0x0023;
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004));
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));

            anchor = ConvertAnchor.CreateAnchor(shape.Anchor);
            //        clientAnchor.Col1( ( (HSSFClientAnchor) shape.Anchor ).Col1 );
            //        clientAnchor.Row1( (short) ( (HSSFClientAnchor) shape.Anchor ).Row1 );
            //        clientAnchor.Dx1( (short) shape.Anchor.Dx1 );
            //        clientAnchor.Dy1( (short) shape.Anchor.Dy1 );
            //        clientAnchor.Col2( ( (HSSFClientAnchor) shape.Anchor ).Col2 );
            //        clientAnchor.Row2( (short) ( (HSSFClientAnchor) shape.Anchor ).Row2 );
            //        clientAnchor.Dx2( (short) shape.Anchor.Dx2 );
            //        clientAnchor.Dy2( (short) shape.Anchor.Dy2 );
            clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
            clientData.Options  = ((short)0x0000);

            spgrContainer.AddChildRecord(spContainer);
            spContainer.AddChildRecord(spgr);
            spContainer.AddChildRecord(sp);
            spContainer.AddChildRecord(opt);
            spContainer.AddChildRecord(anchor);
            spContainer.AddChildRecord(clientData);

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord cmo = new CommonObjectDataSubRecord();

            cmo.ObjectType  = CommonObjectType.GROUP;
            cmo.ObjectId    = shapeId;
            cmo.IsLocked    = true;
            cmo.IsPrintable = true;
            cmo.IsAutoFill  = true;
            cmo.IsAutoline  = true;
            GroupMarkerSubRecord gmo = new GroupMarkerSubRecord();
            EndSubRecord         end = new EndSubRecord();

            obj.AddSubRecord(cmo);
            obj.AddSubRecord(gmo);
            obj.AddSubRecord(end);
            shapeToObj[clientData] = obj;

            escherParent.AddChildRecord(spgrContainer);

            ConvertShapes(shape, spgrContainer, shapeToObj);
        }