override public void AfterParentSet()
        {
            ClientTextbox textbox = this.ParentRecord as ClientTextbox;

            if (textbox == null)
            {
                TraceLogger.DebugInternal("Record of type StyleTextPropAtom doesn't have parent of type ClientTextbox: {0}", this);
                return;
            }

            // TODO: FindSiblingByType?
            TextAtom textAtom = textbox.FirstChildWithType <TextAtom>();

            /* This can legitimately happen... */
            if (textAtom == null)
            {
                this.Reader.Read(new char[this.BodySize], 0, (int)this.BodySize);
                return;
            }

            // TODO: Length in bytes? UTF-16 characters? Full width unicode characters?

            //TraceLogger.DebugInternal("New text style for text: {0}", Utils.StringInspect(textAtom.Text));

            uint seenLength = 0;

            while (seenLength < textAtom.Text.Length + 1)
            {
                long pos    = this.Reader.BaseStream.Position;
                uint length = this.Reader.ReadUInt32();

                ParagraphRun run = new ParagraphRun(this.Reader, false);
                run.Length = length;
                this.PRuns.Add(run);

                /*TraceLogger.DebugInternal("Read paragraph run. Before pos = {0}, after pos = {1} of {2}: {3}",
                 *  pos, this.Reader.BaseStream.Position, this.Reader.BaseStream.Length,
                 *  run);*/

                seenLength += length;
            }

            //TraceLogger.DebugInternal();

            seenLength = 0;
            while (seenLength < textAtom.Text.Length + 1)
            {
                uint length = this.Reader.ReadUInt32();

                CharacterRun run = new CharacterRun(this.Reader);
                run.Length = length;
                this.CRuns.Add(run);

                seenLength += length;
            }
        }
Esempio n. 2
0
        override public void AfterTextHeaderSet()
        {
            TextAtom textAtom = this.TextHeaderAtom.TextAtom;

            /* This can legitimately happen... */
            if (textAtom == null)
            {
                this.Reader.BaseStream.Position = this.Reader.BaseStream.Length;
                return;
            }

            uint seenLength = 0;

            while (seenLength < textAtom.Text.Length + 1)
            {
                long pos    = this.Reader.BaseStream.Position;
                uint length = this.Reader.ReadUInt32();

                ParagraphRun run = new ParagraphRun(this.Reader, false);
                run.Length = length;
                this.PRuns.Add(run);

                /*TraceLogger.DebugInternal("Read paragraph run. Before pos = {0}, after pos = {1} of {2}: {3}",
                 *  pos, this.Reader.BaseStream.Position, this.Reader.BaseStream.Length,
                 *  run);*/

                seenLength += length;
            }

            //TraceLogger.DebugInternal();

            seenLength = 0;
            while (seenLength < textAtom.Text.Length + 1)
            {
                uint length = this.Reader.ReadUInt32();

                CharacterRun run = new CharacterRun(this.Reader);
                run.Length = length;
                this.CRuns.Add(run);

                seenLength += length;
            }

            this.VerifyReadToEnd();
        }
 public TextPFExceptionAtom(BinaryReader _reader, uint size, uint typeCode, uint version, uint instance)
     : base(_reader, size, typeCode, version, instance)
 {
     Reader.ReadInt16();
     run = new ParagraphRun(Reader, true);
 }