internal StyleDefinition(WordDocument owner, STD std) { this.owner = owner; this.std = std; }
private static STD ReadStd(Stream s, ushort length, ushort stdfLength, out int read) { STD std = new STD(); read = 0; Stdf stdf = new Stdf(); StdfBase stdfBase = new StdfBase(); byte[] data = ReadUtils.ReadExact(s, StdfBase.Size, ref read); stdfBase.sti = (ushort)(BitConverter.ToUInt16(data, 0) & 0xFFF); stdfBase.stk = (byte)(data[2] & 0x0F); stdfBase.istdBase = (ushort)(BitConverter.ToUInt16(data, 2) >> 4); stdfBase.cupx = (byte)(data[4] & 0x0F); stdfBase.istdNext = (ushort)(BitConverter.ToUInt16(data, 4) >> 4); stdfBase.bchUpe = BitConverter.ToUInt16(data, 6); ushort grfstdData = BitConverter.ToUInt16(data, 8); GRFSTD grfstd = new GRFSTD(); grfstd.fAutoRedef = (grfstdData & 0x0001) != 0; grfstd.fHidden = (grfstdData & 0x0002) != 0; grfstd.f97LidsSet = (grfstdData & 0x0004) != 0; grfstd.fCopyLang = (grfstdData & 0x0008) != 0; grfstd.fPersonalCompose = (grfstdData & 0x0010) != 0; grfstd.fPersonalReply = (grfstdData & 0x0020) != 0; grfstd.fPersonal = (grfstdData & 0x0040) != 0; grfstd.fSemiHidden = (grfstdData & 0x0100) != 0; grfstd.fLocked = (grfstdData & 0x0200) != 0; grfstd.fUnhideWhenUsed = (grfstdData & 0x0800) != 0; grfstd.fQFormat = (grfstdData & 0x1000) != 0; stdfBase.grfstd = grfstd; stdf.stdfBase = stdfBase; if (StdfBase.Size + StdfPost2000OrNone.Size <= stdfLength) { data = ReadUtils.ReadExact(s, StdfPost2000OrNone.Size, ref read); StdfPost2000OrNone stdfPost2000 = new StdfPost2000OrNone(); stdfPost2000.istdLink = (ushort)(BitConverter.ToUInt16(data, 0) & 0xFFF); stdfPost2000.fHasOriginalStyle = (data[1] & 0x10) != 0; stdfPost2000.rsid = BitConverter.ToUInt32(data, 2); stdfPost2000.iPriority = (ushort)(BitConverter.ToUInt16(data, 6) >> 4); stdf.StdfPost2000OrNone = stdfPost2000; } else stdf.StdfPost2000OrNone = null; std.stdf = stdf; std.xstzName = ReadXstz(s, length - read, ref read); switch (std.stdf.stdfBase.stk) { case GrLPUpxSw.StkParaGRLPUPXStkValue: std.grLPUpxSw = ReadStkParaGRLPUPX(s, length - read, ref read); break; case GrLPUpxSw.StkCharGRLPUPXStkValue: std.grLPUpxSw = ReadStkCharGRLPUPX(s, length - read, ref read); break; case GrLPUpxSw.StkTableGRLPUPXStkValue: std.grLPUpxSw = ReadStkTableGRLPUPX(s, length - read, ref read); break; case GrLPUpxSw.StkListGRLPUPXStkValue: std.grLPUpxSw = ReadStkListGRLPUPX(s, length - read, ref read); break; default: throw new WordFileReaderException("Invalid Std: stk"); } return std; }