示例#1
0
        public ToolbarDelta(VirtualStreamReader reader)
            : base(reader, TBDelta_LENGTH)
        {
            byte flags1 = reader.ReadByte();

            this.dopr   = Utils.BitmaskToInt((int)flags1, 0x03);
            this.fAtEnd = Utils.BitmaskToBool((int)flags1, 0x04);

            this.ibts    = reader.ReadByte();
            this.cidNext = reader.ReadInt32();
            this.cid     = reader.ReadInt32();
            this.fc      = reader.ReadInt32();

            UInt16 flags2 = reader.ReadUInt16();

            this.fOnDisk = Utils.BitmaskToBool((int)flags2, 0x0001);
            this.iTB     = Utils.BitmaskToInt((int)flags2, 0x3FFE);
            this.fDead   = Utils.BitmaskToBool((int)flags2, 0x8000);

            this.cbTBC = reader.ReadUInt16();
        }
示例#2
0
        public OfficeArtContent(FileInformationBlock fib, VirtualStream tableStream)
        {
            var reader = new VirtualStreamReader(tableStream);

            tableStream.Seek(fib.fcDggInfo, System.IO.SeekOrigin.Begin);

            if (fib.lcbDggInfo > 0)
            {
                int maxPosition = (int)(fib.fcDggInfo + fib.lcbDggInfo);

                //read the DrawingGroupData
                this.DrawingGroupData = (DrawingGroup)Record.ReadRecord(reader);

                //read the Drawings
                this.Drawings = new List <OfficeArtWordDrawing>();
                while (reader.BaseStream.Position < maxPosition)
                {
                    var drawing = new OfficeArtWordDrawing
                    {
                        dgglbl    = (DrawingType)reader.ReadByte(),
                        container = (DrawingContainer)Record.ReadRecord(reader)
                    };

                    for (int i = 0; i < drawing.container.Children.Count; i++)
                    {
                        var groupChild = drawing.container.Children[i];
                        if (groupChild.TypeCode == 0xF003)
                        {
                            // the child is a subgroup
                            var group = (GroupContainer)drawing.container.Children[i];
                            group.Index = i;
                            drawing.container.Children[i] = group;
                        }
                        else if (groupChild.TypeCode == 0xF004)
                        {
                            // the child is a shape
                            var shape = (ShapeContainer)drawing.container.Children[i];
                            shape.Index = i;
                            drawing.container.Children[i] = shape;
                        }
                    }

                    this.Drawings.Add(drawing);
                }
            }
        }
示例#3
0
        //*****************************************************************************************
        //                                                                              CONSTRUCTOR
        //*****************************************************************************************

        public FileInformationBlock(VirtualStreamReader reader)
        {
            UInt16 flag16 = 0;
            byte   flag8  = 0;

            //read the FIB base
            this.wIdent = reader.ReadUInt16();
            this.nFib   = (FibVersion)reader.ReadUInt16();
            reader.ReadBytes(2);
            this.lid                  = reader.ReadUInt16();
            this.pnNext               = reader.ReadInt16();
            flag16                    = reader.ReadUInt16();
            this.fDot                 = Utils.BitmaskToBool((int)flag16, 0x0001);
            this.fGlsy                = Utils.BitmaskToBool((int)flag16, 0x0002);
            this.fComplex             = Utils.BitmaskToBool((int)flag16, 0x0002);
            this.fHasPic              = Utils.BitmaskToBool((int)flag16, 0x0008);
            this.cQuickSaves          = (UInt16)(((int)flag16 & 0x00F0) >> 4);
            this.fEncrypted           = Utils.BitmaskToBool((int)flag16, 0x0100);
            this.fWhichTblStm         = Utils.BitmaskToBool((int)flag16, 0x0200);
            this.fReadOnlyRecommended = Utils.BitmaskToBool((int)flag16, 0x0400);
            this.fWriteReservation    = Utils.BitmaskToBool((int)flag16, 0x0800);
            this.fExtChar             = Utils.BitmaskToBool((int)flag16, 0x1000);
            this.fLoadOverwrite       = Utils.BitmaskToBool((int)flag16, 0x2000);
            this.fFarEast             = Utils.BitmaskToBool((int)flag16, 0x4000);
            this.fCrypto              = Utils.BitmaskToBool((int)flag16, 0x8000);
            this.nFibBack             = reader.ReadUInt16();
            this.lKey                 = reader.ReadInt32();
            this.envr                 = reader.ReadByte();
            flag8                  = reader.ReadByte();
            this.fMac              = Utils.BitmaskToBool((int)flag8, 0x01);
            this.fEmptySpecial     = Utils.BitmaskToBool((int)flag8, 0x02);
            this.fLoadOverridePage = Utils.BitmaskToBool((int)flag8, 0x04);
            this.fFutureSavedUndo  = Utils.BitmaskToBool((int)flag8, 0x08);
            this.fWord97Saved      = Utils.BitmaskToBool((int)flag8, 0x10);
            reader.ReadBytes(4);
            this.fcMin = reader.ReadInt32();
            this.fcMac = reader.ReadInt32();

            this.csw = reader.ReadUInt16();

            //read the RgW97
            reader.ReadBytes(26);
            this.lidFE = reader.ReadInt16();

            this.cslw = reader.ReadUInt16();

            //read the RgLW97
            this.cbMac = reader.ReadInt32();
            reader.ReadBytes(8);
            this.ccpText = reader.ReadInt32();
            this.ccpFtn  = reader.ReadInt32();
            this.ccpHdr  = reader.ReadInt32();
            reader.ReadBytes(4);
            this.ccpAtn     = reader.ReadInt32();
            this.ccpEdn     = reader.ReadInt32();
            this.ccpTxbx    = reader.ReadInt32();
            this.ccpHdrTxbx = reader.ReadInt32();
            reader.ReadBytes(44);

            this.cbRgFcLcb = reader.ReadUInt16();

            if (this.nFib >= FibVersion.Fib1997Beta)
            {
                //Read the FibRgFcLcb97
                this.fcStshfOrig    = reader.ReadUInt32();
                this.lcbStshfOrig   = reader.ReadUInt32();
                this.fcStshf        = reader.ReadUInt32();
                this.lcbStshf       = reader.ReadUInt32();
                this.fcPlcffndRef   = reader.ReadUInt32();
                this.lcbPlcffndRef  = reader.ReadUInt32();
                this.fcPlcffndTxt   = reader.ReadUInt32();
                this.lcbPlcffndTxt  = reader.ReadUInt32();
                this.fcPlcfandRef   = reader.ReadUInt32();
                this.lcbPlcfandRef  = reader.ReadUInt32();
                this.fcPlcfandTxt   = reader.ReadUInt32();
                this.lcbPlcfandTxt  = reader.ReadUInt32();
                this.fcPlcfSed      = reader.ReadUInt32();
                this.lcbPlcfSed     = reader.ReadUInt32();
                this.fcPlcPad       = reader.ReadUInt32();
                this.lcbPlcPad      = reader.ReadUInt32();
                this.fcPlcfPhe      = reader.ReadUInt32();
                this.lcbPlcfPhe     = reader.ReadUInt32();
                this.fcSttbfGlsy    = reader.ReadUInt32();
                this.lcbSttbfGlsy   = reader.ReadUInt32();
                this.fcPlcfGlsy     = reader.ReadUInt32();
                this.lcbPlcfGlsy    = reader.ReadUInt32();
                this.fcPlcfHdd      = reader.ReadUInt32();
                this.lcbPlcfHdd     = reader.ReadUInt32();
                this.fcPlcfBteChpx  = reader.ReadUInt32();
                this.lcbPlcfBteChpx = reader.ReadUInt32();
                this.fcPlcfBtePapx  = reader.ReadUInt32();
                this.lcbPlcfBtePapx = reader.ReadUInt32();
                this.fcPlcfSea      = reader.ReadUInt32();
                this.lcbPlcfSea     = reader.ReadUInt32();
                this.fcSttbfFfn     = reader.ReadUInt32();
                this.lcbSttbfFfn    = reader.ReadUInt32();
                this.fcPlcfFldMom   = reader.ReadUInt32();
                this.lcbPlcfFldMom  = reader.ReadUInt32();
                this.fcPlcfFldHdr   = reader.ReadUInt32();
                this.lcbPlcfFldHdr  = reader.ReadUInt32();
                this.fcPlcfFldFtn   = reader.ReadUInt32();
                this.lcbPlcfFldFtn  = reader.ReadUInt32();
                this.fcPlcfFldAtn   = reader.ReadUInt32();
                this.lcbPlcfFldAtn  = reader.ReadUInt32();
                this.fcPlcfFldMcr   = reader.ReadUInt32();
                this.lcbPlcfFldMcr  = reader.ReadUInt32();
                this.fcSttbfBkmk    = reader.ReadUInt32();
                this.lcbSttbfBkmk   = reader.ReadUInt32();
                this.fcPlcfBkf      = reader.ReadUInt32();
                this.lcbPlcfBkf     = reader.ReadUInt32();
                this.fcPlcfBkl      = reader.ReadUInt32();
                this.lcbPlcfBkl     = reader.ReadUInt32();
                this.fcCmds         = reader.ReadUInt32();
                this.lcbCmds        = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcSttbfMcr         = reader.ReadUInt32();
                this.lcbSttbfMcr        = reader.ReadUInt32();
                this.fcPrDrvr           = reader.ReadUInt32();
                this.lcbPrDrvr          = reader.ReadUInt32();
                this.fcPrEnvPort        = reader.ReadUInt32();
                this.lcbPrEnvPort       = reader.ReadUInt32();
                this.fcPrEnvLand        = reader.ReadUInt32();
                this.lcbPrEnvLand       = reader.ReadUInt32();
                this.fcWss              = reader.ReadUInt32();
                this.lcbWss             = reader.ReadUInt32();
                this.fcDop              = reader.ReadUInt32();
                this.lcbDop             = reader.ReadUInt32();
                this.fcSttbfAssoc       = reader.ReadUInt32();
                this.lcbSttbfAssoc      = reader.ReadUInt32();
                this.fcClx              = reader.ReadUInt32();
                this.lcbClx             = reader.ReadUInt32();
                this.fcPlcfPgdFtn       = reader.ReadUInt32();
                this.lcbPlcfPgdFtn      = reader.ReadUInt32();
                this.fcAutosaveSource   = reader.ReadUInt32();
                this.lcbAutosaveSource  = reader.ReadUInt32();
                this.fcGrpXstAtnOwners  = reader.ReadUInt32();
                this.lcbGrpXstAtnOwners = reader.ReadUInt32();
                this.fcSttbfAtnBkmk     = reader.ReadUInt32();
                this.lcbSttbfAtnBkmk    = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcSpaMom     = reader.ReadUInt32();
                this.lcbPlcSpaMom    = reader.ReadUInt32();
                this.fcPlcSpaHdr     = reader.ReadUInt32();
                this.lcbPlcSpaHdr    = reader.ReadUInt32();
                this.fcPlcfAtnBkf    = reader.ReadUInt32();
                this.lcbPlcfAtnBkf   = reader.ReadUInt32();
                this.fcPlcfAtnBkl    = reader.ReadUInt32();
                this.lcbPlcfAtnBkl   = reader.ReadUInt32();
                this.fcPms           = reader.ReadUInt32();
                this.lcbPms          = reader.ReadUInt32();
                this.fcFormFldSttbs  = reader.ReadUInt32();
                this.lcbFormFldSttbs = reader.ReadUInt32();
                this.fcPlcfendRef    = reader.ReadUInt32();
                this.lcbPlcfendRef   = reader.ReadUInt32();
                this.fcPlcfendTxt    = reader.ReadUInt32();
                this.lcbPlcfendTxt   = reader.ReadUInt32();
                this.fcPlcfFldEdn    = reader.ReadUInt32();
                this.lcbPlcfFldEdn   = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcDggInfo           = reader.ReadUInt32();
                this.lcbDggInfo          = reader.ReadUInt32();
                this.fcSttbfRMark        = reader.ReadUInt32();
                this.lcbSttbfRMark       = reader.ReadUInt32();
                this.fcSttbfCaption      = reader.ReadUInt32();
                this.lcbSttbfCaption     = reader.ReadUInt32();
                this.fcSttbfAutoCaption  = reader.ReadUInt32();
                this.lcbSttbfAutoCaption = reader.ReadUInt32();
                this.fcPlcfWkb           = reader.ReadUInt32();
                this.lcbPlcfWkb          = reader.ReadUInt32();
                this.fcPlcfSpl           = reader.ReadUInt32();
                this.lcbPlcfSpl          = reader.ReadUInt32();
                this.fcPlcftxbxTxt       = reader.ReadUInt32();
                this.lcbPlcftxbxTxt      = reader.ReadUInt32();
                this.fcPlcfFldTxbx       = reader.ReadUInt32();
                this.lcbPlcfFldTxbx      = reader.ReadUInt32();
                this.fcPlcfHdrtxbxTxt    = reader.ReadUInt32();
                this.lcbPlcfHdrtxbxTxt   = reader.ReadUInt32();
                this.fcPlcffldHdrTxbx    = reader.ReadUInt32();
                this.lcbPlcffldHdrTxbx   = reader.ReadUInt32();
                this.fcStwUser           = reader.ReadUInt32();
                this.lcbStwUser          = reader.ReadUInt32();
                this.fcSttbTtmbd         = reader.ReadUInt32();
                this.lcbSttbTtmbd        = reader.ReadUInt32();
                this.fcCookieData        = reader.ReadUInt32();
                this.lcbCookieData       = reader.ReadUInt32();
                this.fcPgdMotherOldOld   = reader.ReadUInt32();
                this.lcbPgdMotherOldOld  = reader.ReadUInt32();
                this.fcBkdMotherOldOld   = reader.ReadUInt32();
                this.lcbBkdMotherOldOld  = reader.ReadUInt32();
                this.fcPgdFtnOldOld      = reader.ReadUInt32();
                this.lcbPgdFtnOldOld     = reader.ReadUInt32();
                this.fcBkdFtnOldOld      = reader.ReadUInt32();
                this.lcbBkdFtnOldOld     = reader.ReadUInt32();
                this.fcPgdEdnOldOld      = reader.ReadUInt32();
                this.lcbPgdEdnOldOld     = reader.ReadUInt32();
                this.fcBkdEdnOldOld      = reader.ReadUInt32();
                this.lcbBkdEdnOldOld     = reader.ReadUInt32();
                this.fcSttbfIntlFld      = reader.ReadUInt32();
                this.lcbSttbfIntlFld     = reader.ReadUInt32();
                this.fcRouteSlip         = reader.ReadUInt32();
                this.lcbRouteSlip        = reader.ReadUInt32();
                this.fcSttbSavedBy       = reader.ReadUInt32();
                this.lcbSttbSavedBy      = reader.ReadUInt32();
                this.fcSttbFnm           = reader.ReadUInt32();
                this.lcbSttbFnm          = reader.ReadUInt32();
                this.fcPlfLst            = reader.ReadUInt32();
                this.lcbPlfLst           = reader.ReadUInt32();
                this.fcPlfLfo            = reader.ReadUInt32();
                this.lcbPlfLfo           = reader.ReadUInt32();
                this.fcPlcfTxbxBkd       = reader.ReadUInt32();
                this.lcbPlcfTxbxBkd      = reader.ReadUInt32();
                this.fcPlcfTxbxHdrBkd    = reader.ReadUInt32();
                this.lcbPlcfTxbxHdrBkd   = reader.ReadUInt32();
                this.fcDocUndoWord9      = reader.ReadUInt32();
                this.lcbDocUndoWord9     = reader.ReadUInt32();
                this.fcRgbUse            = reader.ReadUInt32();
                this.lcbRgbUse           = reader.ReadUInt32();
                this.fcUsp            = reader.ReadUInt32();
                this.lcbUsp           = reader.ReadUInt32();
                this.fcUskf           = reader.ReadUInt32();
                this.lcbUskf          = reader.ReadUInt32();
                this.fcPlcupcRgbUse   = reader.ReadUInt32();
                this.lcbPlcupcRgbUse  = reader.ReadUInt32();
                this.fcPlcupcUsp      = reader.ReadUInt32();
                this.lcbPlcupcUsp     = reader.ReadUInt32();
                this.fcSttbGlsyStyle  = reader.ReadUInt32();
                this.lcbSttbGlsyStyle = reader.ReadUInt32();
                this.fcPlgosl         = reader.ReadUInt32();
                this.lcbPlgosl        = reader.ReadUInt32();
                this.fcPlcocx         = reader.ReadUInt32();
                this.lcbPlcocx        = reader.ReadUInt32();
                this.fcPlcfBteLvc     = reader.ReadUInt32();
                this.lcbPlcfBteLvc    = reader.ReadUInt32();
                this.dwLowDateTime    = reader.ReadUInt32();
                this.dwHighDateTime   = reader.ReadUInt32();
                this.fcPlcfLvcPre10   = reader.ReadUInt32();
                this.lcbPlcfLvcPre10  = reader.ReadUInt32();
                this.fcPlcfAsumy      = reader.ReadUInt32();
                this.lcbPlcfAsumy     = reader.ReadUInt32();
                this.fcPlcfGram       = reader.ReadUInt32();
                this.lcbPlcfGram      = reader.ReadUInt32();
                this.fcSttbListNames  = reader.ReadUInt32();
                this.lcbSttbListNames = reader.ReadUInt32();
                this.fcSttbfUssr      = reader.ReadUInt32();
                this.lcbSttbfUssr     = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2000)
            {
                //Read also the FibRgFcLcb2000
                this.fcPlcfTch        = reader.ReadUInt32();
                this.lcbPlcfTch       = reader.ReadUInt32();
                this.fcRmdThreading   = reader.ReadUInt32();
                this.lcbRmdThreading  = reader.ReadUInt32();
                this.fcMid            = reader.ReadUInt32();
                this.lcbMid           = reader.ReadUInt32();
                this.fcSttbRgtplc     = reader.ReadUInt32();
                this.lcbSttbRgtplc    = reader.ReadUInt32();
                this.fcMsoEnvelope    = reader.ReadUInt32();
                this.lcbMsoEnvelope   = reader.ReadUInt32();
                this.fcPlcfLad        = reader.ReadUInt32();
                this.lcbPlcfLad       = reader.ReadUInt32();
                this.fcRgDofr         = reader.ReadUInt32();
                this.lcbRgDofr        = reader.ReadUInt32();
                this.fcPlcosl         = reader.ReadUInt32();
                this.lcbPlcosl        = reader.ReadUInt32();
                this.fcPlcfCookieOld  = reader.ReadUInt32();
                this.lcbPlcfCookieOld = reader.ReadUInt32();
                this.fcPgdMotherOld   = reader.ReadUInt32();
                this.lcbPgdMotherOld  = reader.ReadUInt32();
                this.fcBkdMotherOld   = reader.ReadUInt32();
                this.lcbBkdMotherOld  = reader.ReadUInt32();
                this.fcPgdFtnOld      = reader.ReadUInt32();
                this.lcbPgdFtnOld     = reader.ReadUInt32();
                this.fcBkdFtnOld      = reader.ReadUInt32();
                this.lcbBkdFtnOld     = reader.ReadUInt32();
                this.fcPgdEdnOld      = reader.ReadUInt32();
                this.lcbPgdEdnOld     = reader.ReadUInt32();
                this.fcBkdEdnOld      = reader.ReadUInt32();
                this.lcbBkdEdnOld     = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2002)
            {
                //Read also the fibRgFcLcb2002
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcfPgp             = reader.ReadUInt32();
                this.lcbPlcfPgp            = reader.ReadUInt32();
                this.fcPlcfuim             = reader.ReadUInt32();
                this.lcbPlcfuim            = reader.ReadUInt32();
                this.fcPlfguidUim          = reader.ReadUInt32();
                this.lcbPlfguidUim         = reader.ReadUInt32();
                this.fcAtrdExtra           = reader.ReadUInt32();
                this.lcbAtrdExtra          = reader.ReadUInt32();
                this.fcPlrsid              = reader.ReadUInt32();
                this.lcbPlrsid             = reader.ReadUInt32();
                this.fcSttbfBkmkFactoid    = reader.ReadUInt32();
                this.lcbSttbfBkmkFactoid   = reader.ReadUInt32();
                this.fcPlcfBkfFactoid      = reader.ReadUInt32();
                this.lcbPlcfBkfFactoid     = reader.ReadUInt32();
                this.fcPlcfcookie          = reader.ReadUInt32();
                this.lcbPlcfcookie         = reader.ReadUInt32();
                this.fcPlcfBklFactoid      = reader.ReadUInt32();
                this.lcbPlcfBklFactoid     = reader.ReadUInt32();
                this.fcFactoidData         = reader.ReadUInt32();
                this.lcbFactoidData        = reader.ReadUInt32();
                this.fcDocUndo             = reader.ReadUInt32();
                this.lcbDocUndo            = reader.ReadUInt32();
                this.fcSttbfBkmkFcc        = reader.ReadUInt32();
                this.lcbSttbfBkmkFcc       = reader.ReadUInt32();
                this.fcPlcfBkfFcc          = reader.ReadUInt32();
                this.lcbPlcfBkfFcc         = reader.ReadUInt32();
                this.fcPlcfBklFcc          = reader.ReadUInt32();
                this.lcbPlcfBklFcc         = reader.ReadUInt32();
                this.fcSttbfbkmkBPRepairs  = reader.ReadUInt32();
                this.lcbSttbfbkmkBPRepairs = reader.ReadUInt32();
                this.fcPlcfbkfBPRepairs    = reader.ReadUInt32();
                this.lcbPlcfbkfBPRepairs   = reader.ReadUInt32();
                this.fcPlcfbklBPRepairs    = reader.ReadUInt32();
                this.lcbPlcfbklBPRepairs   = reader.ReadUInt32();
                this.fcPmsNew              = reader.ReadUInt32();
                this.lcbPmsNew             = reader.ReadUInt32();
                this.fcODSO            = reader.ReadUInt32();
                this.lcbODSO           = reader.ReadUInt32();
                this.fcPlcfpmiOldXP    = reader.ReadUInt32();
                this.lcbPlcfpmiOldXP   = reader.ReadUInt32();
                this.fcPlcfpmiNewXP    = reader.ReadUInt32();
                this.lcbPlcfpmiNewXP   = reader.ReadUInt32();
                this.fcPlcfpmiMixedXP  = reader.ReadUInt32();
                this.lcbPlcfpmiMixedXP = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcffactoid     = reader.ReadUInt32();
                this.lcbPlcffactoid    = reader.ReadUInt32();
                this.fcPlcflvcOldXP    = reader.ReadUInt32();
                this.lcbPlcflvcOldXP   = reader.ReadUInt32();
                this.fcPlcflvcNewXP    = reader.ReadUInt32();
                this.lcbPlcflvcNewXP   = reader.ReadUInt32();
                this.fcPlcflvcMixedXP  = reader.ReadUInt32();
                this.lcbPlcflvcMixedXP = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2003)
            {
                //Read also the fibRgFcLcb2003
                this.fcHplxsdr        = reader.ReadUInt32();
                this.lcbHplxsdr       = reader.ReadUInt32();
                this.fcSttbfBkmkSdt   = reader.ReadUInt32();
                this.lcbSttbfBkmkSdt  = reader.ReadUInt32();
                this.fcPlcfBkfSdt     = reader.ReadUInt32();
                this.lcbPlcfBkfSdt    = reader.ReadUInt32();
                this.fcPlcfBklSdt     = reader.ReadUInt32();
                this.lcbPlcfBklSdt    = reader.ReadUInt32();
                this.fcCustomXForm    = reader.ReadUInt32();
                this.lcbCustomXForm   = reader.ReadUInt32();
                this.fcSttbfBkmkProt  = reader.ReadUInt32();
                this.lcbSttbfBkmkProt = reader.ReadUInt32();
                this.fcPlcfBkfProt    = reader.ReadUInt32();
                this.lcbPlcfBkfProt   = reader.ReadUInt32();
                this.fcPlcfBklProt    = reader.ReadUInt32();
                this.lcbPlcfBklProt   = reader.ReadUInt32();
                this.fcSttbProtUser   = reader.ReadUInt32();
                this.lcbSttbProtUser  = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcPlcfpmiOld        = reader.ReadUInt32();
                this.lcbPlcfpmiOld       = reader.ReadUInt32();
                this.fcPlcfpmiOldInline  = reader.ReadUInt32();
                this.lcbPlcfpmiOldInline = reader.ReadUInt32();
                this.fcPlcfpmiNew        = reader.ReadUInt32();
                this.lcbPlcfpmiNew       = reader.ReadUInt32();
                this.fcPlcfpmiNewInline  = reader.ReadUInt32();
                this.lcbPlcfpmiNewInline = reader.ReadUInt32();
                this.fcPlcflvcOld        = reader.ReadUInt32();
                this.lcbPlcflvcOld       = reader.ReadUInt32();
                this.fcPlcflvcOldInline  = reader.ReadUInt32();
                this.lcbPlcflvcOldInline = reader.ReadUInt32();
                this.fcPlcflvcNew        = reader.ReadUInt32();
                this.lcbPlcflvcNew       = reader.ReadUInt32();
                this.fcPlcflvcNewInline  = reader.ReadUInt32();
                this.lcbPlcflvcNewInline = reader.ReadUInt32();
                this.fcPgdMother         = reader.ReadUInt32();
                this.lcbPgdMother        = reader.ReadUInt32();
                this.fcBkdMother         = reader.ReadUInt32();
                this.lcbBkdMother        = reader.ReadUInt32();
                this.fcAfdMother         = reader.ReadUInt32();
                this.lcbAfdMother        = reader.ReadUInt32();
                this.fcPgdFtn            = reader.ReadUInt32();
                this.lcbPgdFtn           = reader.ReadUInt32();
                this.fcBkdFtn            = reader.ReadUInt32();
                this.lcbBkdFtn           = reader.ReadUInt32();
                this.fcAfdFtn            = reader.ReadUInt32();
                this.lcbAfdFtn           = reader.ReadUInt32();
                this.fcPgdEdn            = reader.ReadUInt32();
                this.lcbPgdEdn           = reader.ReadUInt32();
                this.fcBkdEdn            = reader.ReadUInt32();
                this.lcbBkdEdn           = reader.ReadUInt32();
                this.fcAfdEdn            = reader.ReadUInt32();
                this.lcbAfdEdn           = reader.ReadUInt32();
                this.fcAfd  = reader.ReadUInt32();
                this.lcbAfd = reader.ReadUInt32();
            }
            if (this.nFib >= FibVersion.Fib2007)
            {
                //Read also the fibRgFcLcb2007
                this.fcPlcfmthd           = reader.ReadUInt32();
                this.lcbPlcfmthd          = reader.ReadUInt32();
                this.fcSttbfBkmkMoveFrom  = reader.ReadUInt32();
                this.lcbSttbfBkmkMoveFrom = reader.ReadUInt32();
                this.fcPlcfBkfMoveFrom    = reader.ReadUInt32();
                this.lcbPlcfBkfMoveFrom   = reader.ReadUInt32();
                this.fcPlcfBklMoveFrom    = reader.ReadUInt32();
                this.lcbPlcfBklMoveFrom   = reader.ReadUInt32();
                this.fcSttbfBkmkMoveTo    = reader.ReadUInt32();
                this.lcbSttbfBkmkMoveTo   = reader.ReadUInt32();
                this.fcPlcfBkfMoveTo      = reader.ReadUInt32();
                this.lcbPlcfBkfMoveTo     = reader.ReadUInt32();
                this.fcPlcfBklMoveTo      = reader.ReadUInt32();
                this.lcbPlcfBklMoveTo     = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcSttbfBkmkArto  = reader.ReadUInt32();
                this.lcbSttbfBkmkArto = reader.ReadUInt32();
                this.fcPlcfBkfArto    = reader.ReadUInt32();
                this.lcbPlcfBkfArto   = reader.ReadUInt32();
                this.fcPlcfBklArto    = reader.ReadUInt32();
                this.lcbPlcfBklArto   = reader.ReadUInt32();
                this.fcArtoData       = reader.ReadUInt32();
                this.lcbArtoData      = reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                reader.ReadUInt32();
                this.fcOssTheme            = reader.ReadUInt32();
                this.lcbOssTheme           = reader.ReadUInt32();
                this.fcColorSchemeMapping  = reader.ReadUInt32();
                this.lcbColorSchemeMapping = reader.ReadUInt32();
            }

            this.cswNew = reader.ReadUInt16();

            if (this.cswNew != 0)
            {
                //Read the FibRgCswNew
                this.nFibNew        = (FibVersion)reader.ReadUInt16();
                this.cQuickSavesNew = reader.ReadUInt16();
            }
        }
示例#4
0
        public ToolbarControl(VirtualStreamReader reader)
            : base(reader, ByteStructure.VARIABLE_LENGTH)
        {
            //HEADER START

            this.bSignature = reader.ReadByte();
            this.bVersion   = reader.ReadByte();

            int bFlagsTCR = (int)reader.ReadByte();

            this.fHidden      = Utils.BitmaskToBool(bFlagsTCR, 0x01);
            this.fBeginGroup  = Utils.BitmaskToBool(bFlagsTCR, 0x02);
            this.fOwnLine     = Utils.BitmaskToBool(bFlagsTCR, 0x04);
            this.fNoCustomize = Utils.BitmaskToBool(bFlagsTCR, 0x08);
            this.fSaveDxy     = Utils.BitmaskToBool(bFlagsTCR, 0x10);
            this.fBeginLine   = Utils.BitmaskToBool(bFlagsTCR, 0x40);

            this.tct       = (ToolbarControlType)reader.ReadByte();
            this.tcid      = reader.ReadInt16();
            this.tbct      = reader.ReadInt32();
            this.bPriority = reader.ReadByte();

            if (this.fSaveDxy)
            {
                this.width  = reader.ReadUInt16();
                this.height = reader.ReadUInt16();
            }

            //HEADER END

            //cid
            if (this.tcid != 0x01 && this.tcid != 0x1051)
            {
                this.cid = reader.ReadBytes(4);
            }

            //DATA START

            if (this.tct != ToolbarControlType.ActiveX)
            {
                //general control info
                byte flags = reader.ReadByte();
                this.fSaveText          = Utils.BitmaskToBool((int)flags, 0x01);
                this.fSaveMiscUIStrings = Utils.BitmaskToBool((int)flags, 0x02);
                this.fSaveMiscCustom    = Utils.BitmaskToBool((int)flags, 0x04);
                this.fDisabled          = Utils.BitmaskToBool((int)flags, 0x04);

                if (this.fSaveText)
                {
                    this.customText = Utils.ReadWString(reader.BaseStream);
                }
                if (this.fSaveMiscUIStrings)
                {
                    this.descriptionText = Utils.ReadWString(reader.BaseStream);
                    this.tooltip         = Utils.ReadWString(reader.BaseStream);
                }
                if (this.fSaveMiscCustom)
                {
                    this.helpFile      = Utils.ReadWString(reader.BaseStream);
                    this.idHelpContext = reader.ReadInt32();
                    this.tag           = Utils.ReadWString(reader.BaseStream);
                    this.onAction      = Utils.ReadWString(reader.BaseStream);
                    this.param         = Utils.ReadWString(reader.BaseStream);
                    this.tbcu          = reader.ReadByte();
                    this.tbmg          = reader.ReadByte();
                }

                //control specific info
                switch (this.tct)
                {
                case ToolbarControlType.Button:
                case ToolbarControlType.ExpandingGrid:

                    //TBCB Specific
                    int  bFlags         = (int)reader.ReadByte();
                    int  state          = Utils.BitmaskToInt(bFlags, 0x03);
                    bool fAccelerator   = Utils.BitmaskToBool(bFlags, 0x04);
                    bool fCustomBitmap  = Utils.BitmaskToBool(bFlags, 0x08);
                    bool fCustomBtnFace = Utils.BitmaskToBool(bFlags, 0x10);
                    bool fHyperlinkType = Utils.BitmaskToBool(bFlags, 0x20);
                    if (fCustomBitmap)
                    {
                        ToolbarControlBitmap icon     = new ToolbarControlBitmap(reader);
                        ToolbarControlBitmap iconMask = new ToolbarControlBitmap(reader);
                    }
                    if (fCustomBtnFace)
                    {
                        UInt16 iBtnFace = reader.ReadUInt16();
                    }
                    if (fAccelerator)
                    {
                        string wstrAcc = Utils.ReadWString(reader.BaseStream);
                    }

                    break;

                case ToolbarControlType.Popup:
                case ToolbarControlType.ButtonPopup:
                case ToolbarControlType.SplitButtonPopup:
                case ToolbarControlType.SplitButtonMRUPopup:

                    //TBC Menu Specific
                    Int32  tbid = reader.ReadInt32();
                    string name = Utils.ReadWString(reader.BaseStream);

                    break;

                case ToolbarControlType.Edit:
                case ToolbarControlType.ComboBox:
                case ToolbarControlType.GraphicCombo:
                case ToolbarControlType.Dropdown:
                case ToolbarControlType.SplitDropDown:
                case ToolbarControlType.OCXDropDown:
                case ToolbarControlType.GraphicDropDown:

                    //TBC Combo Dropdown Specific
                    if (this.tcid == 1)
                    {
                        Int16  cwstrItems = reader.ReadInt16();
                        string wstrList   = Utils.ReadWString(reader.BaseStream);
                        Int16  cwstrMRU   = reader.ReadInt16();
                        Int16  iSel       = reader.ReadInt16();
                        Int16  cLines     = reader.ReadInt16();
                        Int16  dxWidth    = reader.ReadInt16();
                        string wstrEdit   = Utils.ReadWString(reader.BaseStream);
                    }

                    break;

                default:
                    //no control Specific Info
                    break;
                }
            }
        }
        public CommandTable(FileInformationBlock fib, VirtualStream tableStream)
        {
            tableStream.Seek(fib.fcCmds, System.IO.SeekOrigin.Begin);
            VirtualStreamReader reader = new VirtualStreamReader(tableStream);

            //byte[] bytes = reader.ReadBytes((int)fib.lcbCmds);
            this.MacroDatas    = new List <MacroData>();
            this.KeyMapEntries = new List <KeyMapEntry>();
            this.MacroNames    = new Dictionary <int, string>();

            //skip the version
            reader.ReadByte();

            //parse the commandtable
            while (reader.BaseStream.Position < (fib.fcCmds + fib.lcbCmds) && !breakWhile)
            {
                //read the type
                byte ch = reader.ReadByte();

                switch (ch)
                {
                case 0x1:
                    //it's a PlfMcd
                    int iMacMcd = reader.ReadInt32();
                    for (int i = 0; i < iMacMcd; i++)
                    {
                        this.MacroDatas.Add(new MacroData(reader));
                    }
                    break;

                case 0x2:
                    //it's a PlfAcd
                    //skip the ACDs
                    int iMacAcd = reader.ReadInt32();
                    reader.ReadBytes(iMacAcd * 4);
                    break;

                case 0x3:
                    //Keymap Entries
                    int iMacKme = reader.ReadInt32();
                    for (int i = 0; i < iMacKme; i++)
                    {
                        this.KeyMapEntries.Add(new KeyMapEntry(reader));
                    }
                    break;

                case 0x4:
                    //Keymap Entries
                    int iMacKmeInvalid = reader.ReadInt32();
                    for (int i = 0; i < iMacKmeInvalid; i++)
                    {
                        this.KeyMapEntries.Add(new KeyMapEntry(reader));
                    }
                    break;

                case 0x10:
                    //it's a TcgSttbf
                    this.CommandStringTable = new StringTable(typeof(String), reader);
                    break;

                case 0x11:
                    //it's a MacroNames table
                    int iMacMn = reader.ReadInt16();
                    for (int i = 0; i < iMacMn; i++)
                    {
                        Int16 ibst = reader.ReadInt16();
                        Int16 cch  = reader.ReadInt16();
                        this.MacroNames[ibst] = Encoding.Unicode.GetString(reader.ReadBytes(cch * 2));
                        //skip the terminating zero
                        reader.ReadBytes(2);
                    }
                    break;

                case 0x12:
                    //it's a CTBWRAPPER structure
                    this.CustomToolbars = new CustomToolbarWrapper(reader);
                    break;

                default:
                    breakWhile = true;
                    break;
                }
            }
        }
示例#6
0
        private void parse(Type dataType, VirtualStreamReader reader, UInt32 fc)
        {
            //read fExtend
            if (reader.ReadUInt16() == 0xFFFF)
            {
                //if the first 2 bytes are 0xFFFF the STTB contains unicode characters
                this.fExtend = true;
                _enc         = Encoding.Unicode;
            }
            else
            {
                //else the STTB contains 1byte characters and the fExtend field is non-existend
                //seek back to the beginning
                this.fExtend = false;
                _enc         = Encoding.ASCII;
                reader.BaseStream.Seek((long)fc, System.IO.SeekOrigin.Begin);
            }

            //read cData
            long   cDataStart = reader.BaseStream.Position;
            UInt16 c          = reader.ReadUInt16();

            if (c != 0xFFFF)
            {
                //cData is a 2byte unsigned Integer and the read bytes are already cData
                this.cData = (int)c;
            }
            else
            {
                //cData is a 4byte signed Integer, so we need to seek back
                reader.BaseStream.Seek((long)fc + cDataStart, System.IO.SeekOrigin.Begin);
                this.cData = reader.ReadInt32();
            }

            //read cbExtra
            this.cbExtra = reader.ReadUInt16();

            //read the strings and extra datas
            for (int i = 0; i < this.cData; i++)
            {
                int cchData = 0;
                int cbData  = 0;
                if (this.fExtend)
                {
                    cchData = (int)reader.ReadUInt16();
                    cbData  = cchData * 2;
                }
                else
                {
                    cchData = (int)reader.ReadByte();
                    cbData  = cchData;
                }

                long posBeforeType = reader.BaseStream.Position;

                if (dataType == typeof(string))
                {
                    //It's a real string table
                    this.Strings.Add(_enc.GetString(reader.ReadBytes(cbData)));
                }
                else
                {
                    //It's a modified string table that contains custom data
                    ConstructorInfo constructor = dataType.GetConstructor(new Type[] { typeof(VirtualStreamReader), typeof(int) });
                    ByteStructure   data        = (ByteStructure)constructor.Invoke(new object[] { reader, cbData });
                    this.Data.Add(data);
                }

                reader.BaseStream.Seek(posBeforeType + cbData, System.IO.SeekOrigin.Begin);

                //skip the extra byte
                reader.ReadBytes(cbExtra);
            }
        }