コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public string readFooterFromClientTextBox(ClientTextbox textbox)
        {
            var            ms     = new System.IO.MemoryStream(textbox.Bytes);
            TextHeaderAtom thAtom = null;
            TextStyleAtom  style  = null;
            var            lst    = new List <int>();

            while (ms.Position < ms.Length)
            {
                var rec = Record.ReadRecord(ms);

                switch (rec.TypeCode)
                {
                case 0xf9e:     //OutlineTextRefAtom
                    var otrAtom           = (OutlineTextRefAtom)rec;
                    var slideListWithText = this._ctx.Ppt.DocumentRecord.RegularSlideListWithText;

                    var thAtoms = slideListWithText.SlideToPlaceholderTextHeaders[textbox.FirstAncestorWithType <Slide>().PersistAtom];
                    thAtom = thAtoms[otrAtom.Index];

                    //if (thAtom.TextAtom != null) text = thAtom.TextAtom.Text;
                    if (thAtom.TextStyleAtom != null)
                    {
                        style = thAtom.TextStyleAtom;
                    }
                    break;

                case 0xf9f:     //TextHeaderAtom
                    thAtom = (TextHeaderAtom)rec;
                    break;

                case 0xfa0:     //TextCharsAtom
                    thAtom.TextAtom = (TextAtom)rec;
                    break;

                case 0xfa1:     //StyleTextPropAtom
                    style = (TextStyleAtom)rec;
                    style.TextHeaderAtom = thAtom;
                    break;

                case 0xfa2:     //MasterTextPropAtom
                    break;

                case 0xfa8:     //TextBytesAtom
                    //text = ((TextBytesAtom)rec).Text;
                    thAtom.TextAtom = (TextAtom)rec;
                    return(thAtom.TextAtom.Text);

                case 0xfaa:     //TextSpecialInfoAtom
                case 0xfd8:     //SlideNumberMCAtom
                case 0xff9:     //HeaderMCAtom
                    break;

                case 0xffa:     //FooterMCAtom
                    break;

                case 0xff8:     //GenericDateMCAtom
                    break;

                default:
                    break;
                }
            }

            return("");
        }