public void TestStore()
        {
            EndSubRecord record = new EndSubRecord();

            byte[] recordBytes = record.Serialize();
            Assert.AreEqual(recordBytes.Length - 4, data.Length);
            for (int i = 0; i < data.Length; i++)
                Assert.AreEqual(data[i], recordBytes[i + 4], "At offset " + i);
        }
Beispiel #2
0
 protected override ObjRecord CreateObjRecord()
 {
     ObjRecord obj = new ObjRecord();
     CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
     c.ObjectType = CommonObjectType.TEXT;
     c.IsLocked = (true);
     c.IsPrintable = (true);
     c.IsAutoFill = (true);
     c.IsAutoline = (true);
     EndSubRecord e = new EndSubRecord();
     obj.AddSubRecord(c);
     obj.AddSubRecord(e);
     return obj;
 }
Beispiel #3
0
        /// <summary>
        /// Creates the lowerlevel OBJ records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFTextbox hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType = (CommonObjectType)((HSSFSimpleShape)shape).ShapeType;
            c.ObjectId = GetCmoObjectId(shapeId);
            c.IsLocked = true;
            c.IsPrintable = true;
            c.IsAutoFill = true;
            c.IsAutoline = true;
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(e);

            return obj;
        }
Beispiel #4
0
        /**
         * Creates the low level OBJ record for this shape.
         */
        private ObjRecord CreateObjRecord(HSSFSimpleShape shape, int shapeId)
        {
            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType= CommonObjectType.COMBO_BOX;
            c.ObjectId= (short)shapeId;
            c.IsLocked=(true);
            c.IsPrintable=false;
            c.IsAutoFill=true;
            c.IsAutoline=false;

            LbsDataSubRecord l = LbsDataSubRecord.CreateAutoFilterInstance();

            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(l);
            obj.AddSubRecord(e);

            return obj;
        }
Beispiel #5
0
        /// <summary>
        /// Creates the lowerlevel OBJ records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType = (CommonObjectType)OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING;
            c.ObjectId = GetCmoObjectId(shapeId);
            c.IsLocked = true;
            c.IsPrintable = true;
            c.IsAutoFill = true;
            c.IsAutoline = true;
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(e);

            return obj;
        }
Beispiel #6
0
        protected override ObjRecord CreateObjRecord()
        {
            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType = (CommonObjectType)OBJECT_TYPE_COMMENT;
            c.IsLocked = (true);
            c.IsPrintable = (true);
            c.IsAutoFill = (false);
            c.IsAutoline = (true);

            NoteStructureSubRecord u = new NoteStructureSubRecord();
            EndSubRecord e = new EndSubRecord();
            obj.AddSubRecord(c);
            obj.AddSubRecord(u);
            obj.AddSubRecord(e);
            return obj;
        }
Beispiel #7
0
        public override Object Clone()
        {
            EndSubRecord rec = new EndSubRecord();

            return(rec);
        }
Beispiel #8
0
        /// <summary>
        /// Creates the low level OBJ record for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSFShape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType=((short)((HSSFSimpleShape)shape).ShapeType);
            //        c.ObjectId((short) ( 1 ));
            c.ObjectId=((short)(shapeId));
            c.IsLocked=(true);
            c.IsPrintable=(true);
            c.IsAutoFill=(true);
            c.IsAutoline=(true);
            //        c.Reserved2( 0x012C0A84 );
            c.Reserved2=(0x0);
            //        UnknownRecord sub1 = new UnknownRecord( (short)0x7, (short)0x2, new byte[] { 0x09, 0x00 } );
            //        UnknownRecord sub2 = new UnknownRecord( (short)0x8, (short)0x2, new byte[] { 0x01, 0x00 } );
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            //        obj.AddSubRecord( sub1 );
            //        obj.AddSubRecord( sub2 );
            obj.AddSubRecord(e);

            return obj;
        }
Beispiel #9
0
        /// <summary>
        /// Creates the lowerlevel OBJ records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType=CommonObjectType.MICROSOFT_OFFICE_DRAWING;
            c.ObjectId=((short)(shapeId));
            c.IsLocked=(true);
            c.IsPrintable=(true);
            c.IsAutoFill=(true);
            c.IsAutoline=(true);
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(e);

            return obj;
        }
        public override Object Clone()
        {
            EndSubRecord rec = new EndSubRecord();

            return rec;
        }
Beispiel #11
0
        public void TestConstruct()
        {
            ObjRecord record = new ObjRecord();
            CommonObjectDataSubRecord ftCmo = new CommonObjectDataSubRecord();
            ftCmo.ObjectType = (CommonObjectType.COMMENT);
            ftCmo.ObjectId = ((short)1024);
            ftCmo.IsLocked = (true);
            ftCmo.IsPrintable = (true);
            ftCmo.IsAutoFill = (true);
            ftCmo.IsAutoline = (true);
            record.AddSubRecord(ftCmo);
            EndSubRecord ftEnd = new EndSubRecord();
            record.AddSubRecord(ftEnd);

            //Serialize and Read again
            byte[] recordBytes = record.Serialize();
            //cut off the record header
            byte[] bytes = new byte[recordBytes.Length - 4];
            System.Array.Copy(recordBytes, 4, bytes, 0, bytes.Length);

            record = new ObjRecord(TestcaseRecordInputStream.Create(ObjRecord.sid, bytes));
            IList subrecords = record.SubRecords;
            Assert.AreEqual(2, subrecords.Count);
            Assert.IsTrue(subrecords[0] is CommonObjectDataSubRecord);
            Assert.IsTrue(subrecords[1] is EndSubRecord);
        }
Beispiel #12
0
 protected override ObjRecord CreateObjRecord()
 {
     ObjRecord obj = new ObjRecord();
     CommonObjectDataSubRecord cmo = new CommonObjectDataSubRecord();
     cmo.ObjectType = (CommonObjectType.GROUP);
     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);
     return obj;
 }
        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=((short)(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);

        }
Beispiel #14
0
 protected override ObjRecord CreateObjRecord()
 {
     ObjRecord obj = new ObjRecord();
     CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
     c.ObjectType = CommonObjectType.ComboBox;
     c.IsLocked = (true);
     c.IsPrintable = (false);
     c.IsAutoFill = (true);
     c.IsAutoline = (false);
     FtCblsSubRecord f = new FtCblsSubRecord();
     LbsDataSubRecord l = LbsDataSubRecord.CreateAutoFilterInstance();
     EndSubRecord e = new EndSubRecord();
     obj.AddSubRecord(c);
     obj.AddSubRecord(f);
     obj.AddSubRecord(l);
     obj.AddSubRecord(e);
     return obj;
 }
Beispiel #15
0
        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    = ((short)(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);
        }
        public void TestLoad()
        {
            EndSubRecord record = new EndSubRecord(TestcaseRecordInputStream.Create((short)0x00,  data),data.Length);

            Assert.AreEqual(0, record.DataSize);
        }