internal CharacterFormatting(WordDocument owner, int offset, int length, WordDocument.FileCharacterPosition fcp, Chpx chpx) { this.owner = owner; this.Offset = offset; this.Length = length; this.FileCharacterPosition = fcp; this.Chpx = chpx; }
internal static ChpxFkp ReadChpxFkp(Stream s) { byte[] data = ReadUtils.ReadExact(s, ChpxFkp.Size); MemoryStream dataStream = new MemoryStream(data, false); ChpxFkp chpxFkp = new ChpxFkp(); chpxFkp.crun = data[PapxFkp.Size - 1]; int crun = chpxFkp.crun; if (crun < 1 || crun > 0x65) throw new WordFileReaderException("Invalid ChpxFkp: cpara"); chpxFkp.rgfc = new uint[crun + 1]; for (int i = 0; i <= crun; i++) { chpxFkp.rgfc[i] = BitConverter.ToUInt32(data, i * ReadUtils.DWordSize); } chpxFkp.rgb = new KeyValuePair<byte, Chpx>[crun]; int rgbOffset = (crun + 1) * ReadUtils.DWordSize; for (int i = 0; i < crun; i++) { byte offset = data[rgbOffset + i]; int chpxFkpOffset = 2 * offset; Chpx chpx = new Chpx(); chpx.cb = data[chpxFkpOffset++]; int grpprlLength = chpx.cb; dataStream.Position = chpxFkpOffset; int position = 0; chpx.grpprl = ReadPrls(dataStream, grpprlLength - position, ref position); chpxFkp.rgb[i] = new KeyValuePair<byte, Chpx>(offset, chpx); } return chpxFkp; }