Esempio n. 1
0
        public override int Read(BinaryReader reader)
        {
            int num = base.Read(reader);

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                MsoBaseRecord item = ImageRecordsFactory.CreateFromReader(reader);
                this.Add(item);
            }
            return(num);
        }
Esempio n. 2
0
        public override void Save(MsoContainerRecord spgrContainer, uint shapeId)
        {
            MsoContainerRecord item    = ImageRecordsFactory.CreateContainer(MsoType.SpContainer);
            MsofbtSpRecord     record2 = new MsofbtSpRecord {
                Parent   = spgrContainer,
                Instance = 1750
            };
            MsofbtOptRecord record3 = new MsofbtOptRecord();

            record2.ShapeId = shapeId;
            FopteStructure property = new FopteStructure();

            property = new FopteStructure {
                Id        = MsoOptions.LockAgainstSelect,
                UintValue = Convert.ToUInt32(true),
                IsValid   = true,
                IsComplex = false
            };
            record3.Add(property);
            property = new FopteStructure {
                Id        = MsoOptions.LockAdjustHandles,
                UintValue = Convert.ToUInt32(true),
                IsValid   = true,
                IsComplex = false
            };
            record3.Add(property);
            property = new FopteStructure {
                Id        = MsoOptions.LockAgainstGrouping,
                UintValue = Convert.ToUInt32(true),
                IsValid   = true,
                IsComplex = false
            };
            record3.Add(property);
            property = new FopteStructure {
                Id        = MsoOptions.BlipId,
                UintValue = (uint)base.Id,
                IsValid   = true,
                IsComplex = false
            };
            record3.Add(property);
            record3.Version  = 3;
            record3.Instance = 2;
            item.Add(record2);
            item.Add(record3);
            item.Add(base.GenerateClientAnchorRecord());
            spgrContainer.Add(item);
        }
Esempio n. 3
0
        public override void Save(MsoContainerRecord spgrContainer, uint shapeId)
        {
            MsoContainerRecord parent = ImageRecordsFactory.CreateContainer(MsoType.SpContainer);
            MsofbtSpRecord     item   = new MsofbtSpRecord
            {
                Parent = spgrContainer
            };
            MsofbtClientDataRecord record3 = new MsofbtClientDataRecord
            {
                Parent = parent
            };
            CmoObjSubRecord subRecord = null;
            ObjRecord       record5   = new ObjRecord();

            subRecord = new CmoObjSubRecord();
            record5.Add(subRecord);
            record3.Add(record5);
            subRecord.ID  = (ushort)shapeId;
            item.Version  = 2;
            item.Instance = 202;
            parent.Add(item);
            MsofbtOptRecord options = new MsofbtOptRecord
            {
                Parent = parent
            };

            this.SaveIsVisibleOption(options);
            parent.Add(options);
            base.Left   = (this.column + 1) * 64;
            base.Top    = this.row * 17;
            base.Right  = base.Left + 100;
            base.Bottom = base.Top + 100;
            parent.Add(base.GenerateClientAnchorRecord());
            parent.Add(record3);
            parent.Add(this.GenerateClientTextBox(parent));
            spgrContainer.Add(parent);
            this.SaveNote(subRecord.ID);
        }
Esempio n. 4
0
 public void WriteOnDemand(AbsXLSRecords records)
 {
     if (this.Count != 0)
     {
         MsoContainerRecord dgContainer = ImageRecordsFactory.CreateContainer(MsoType.DgContainer);
         MsofbtDgRecord     item        = new MsofbtDgRecord
         {
             Parent = dgContainer
         };
         MsoContainerRecord record3 = ImageRecordsFactory.CreateContainer(MsoType.SpgrContainer);
         record3.Parent = dgContainer;
         MsoContainerRecord record4 = ImageRecordsFactory.CreateContainer(MsoType.SpContainer);
         record4.Parent = record3;
         MsofbtSpgrRecord record5 = new MsofbtSpgrRecord
         {
             Parent = record4
         };
         uint           shapeId = this.GenerateUniqueShapeId();
         MsofbtSpRecord record6 = new MsofbtSpRecord
         {
             Parent    = record5,
             ShapeId   = shapeId,
             IsTopMost = true
         };
         dgContainer.Add(item);
         dgContainer.Add(record3);
         record3.Add(record4);
         record4.Add(record5);
         record4.Add(record6);
         record4.Parent    = record3;
         shapeId           = this.SaveShapes(record3, shapeId);
         item.ShapesNumber = (uint)(this.Worksheet.Shapes.Count + 1);
         item.LastId       = shapeId;
         this.SaveMsoDrawing(records, dgContainer);
         this.SaveNotes(records);
     }
 }
Esempio n. 5
0
        public static void ParseHelper(BinaryReader br, object[] format, ref object[] loadedArgs, ref int currentArgIndex, VariableArrayCountDelegate vaCount, StringLengthDelegate lastStringLength)
        {
            foreach (object obj2 in format)
            {
                if (obj2 is string)
                {
                    Stream baseStream = br.BaseStream;
                    baseStream.Position += Utilities.GetByteArrLengthFromHexStr((string)obj2);
                    continue;
                }
                if (obj2 is Type)
                {
                    Type enumType = (Type)obj2;
                    if (enumType.IsEnum)
                    {
                        enumType = Enum.GetUnderlyingType(enumType);
                    }
                    switch (enumType.FullName)
                    {
                    case "System.Int16":
                        loadedArgs[currentArgIndex] = br.ReadInt16();
                        break;

                    case "System.UInt16":
                        loadedArgs[currentArgIndex] = br.ReadUInt16();
                        break;

                    case "System.UInt32":
                        loadedArgs[currentArgIndex] = br.ReadUInt32();
                        break;

                    case "System.UInt64":
                        loadedArgs[currentArgIndex] = br.ReadUInt64();
                        break;

                    case "System.Byte":
                        loadedArgs[currentArgIndex] = br.ReadByte();
                        break;

                    case "System.Char":
                        loadedArgs[currentArgIndex] = br.ReadChar();
                        break;

                    case "System.Single":
                        loadedArgs[currentArgIndex] = br.ReadSingle();
                        break;

                    case "System.Double":
                        loadedArgs[currentArgIndex] = br.ReadDouble();
                        break;

                    case "ebexcel.ExcelShortString":
                        loadedArgs[currentArgIndex] = new ExcelShortString(br);
                        break;

                    case "ebexcel.ExcelLongString":
                        loadedArgs[currentArgIndex] = new ExcelLongString(br);
                        break;

                    case "ebexcel.ExcelStringWithoutLength":
                        loadedArgs[currentArgIndex] = new ExcelStringWithoutLength(br, lastStringLength(loadedArgs));
                        break;

                    case "ebexcel.ExcelLongStrings":
                    {
                        int remainingSize = vaCount(loadedArgs, null, (int)br.BaseStream.Length);
                        loadedArgs[currentArgIndex] = new ExcelLongStrings(br, remainingSize, null);
                        break;
                    }

                    case "ebexcel.CellRecordHeader":
                        loadedArgs[currentArgIndex] = new CellRecordHeader(br);
                        break;

                    case "ebexcel.SheetIndexes":
                        loadedArgs[currentArgIndex] = new SheetIndexes(br);
                        break;

                    case "ebexcel.MsoBaseRecord":
                        loadedArgs[currentArgIndex] = ImageRecordsFactory.CreateFromReader(br);
                        break;

                    default:
                        throw new Exception("Internal error: unsupported type in format.");
                    }
                    currentArgIndex++;
                    continue;
                }
                if (!(obj2 is object[]))
                {
                    throw new Exception("Internal error: wrong format in descriptor.");
                }
                object[] varArr    = (object[])obj2;
                int      num2      = vaCount(loadedArgs, varArr, (int)br.BaseStream.Length);
                object[] objArray2 = new object[varArr.Length * num2];
                int      num3      = 0;
                for (int i = 0; i < num2; i++)
                {
                    ParseHelper(br, varArr, ref objArray2, ref num3, vaCount, lastStringLength);
                }
                object[] destinationArray = new object[num3];
                Array.Copy(objArray2, destinationArray, num3);
                loadedArgs[currentArgIndex] = destinationArray;
                currentArgIndex++;
            }
        }