Re: Help stepping through objects in a document

From: Martin Sevior (msevior@physics.unimelb.edu.au)
Date: Tue Oct 29 2002 - 19:38:08 EST

  • Next message: Andrew Dunbar: "Re: Help stepping through objects in a document"

    On Wed, 2002-10-30 at 01:31, Dr William Bland wrote:
    > Hello,
    > If I understand correctly, Abiword represents a document by
    > a doubly-linked list of objects (strings, images, etc.) where the format
    > parameters (e.g. boldness, font size, etc.) are constant over a single
    > object in the list.
    >
    > I am trying to
    > 1. Find the list of objects that corresponds to the
    > document in the currently selected frame.
    > 2. Step through it, from the first object to the last.
    > Unfortunately I'm not getting very far. Could someone post a code
    > snippet if this is just a few lines (I'm sure it must be simple to those
    > who know how!) or if it's not so simple some hints would be great.
    >

    Hi Bill,
            Yes. The fundamental description of a document is made by the
    PieceTable.

    The peice table consists of a double linked list of objects called
    Fragments "frags". Each frag has it's own set of properties describing a
    segment of the document with identical properties.

    There are 4 main subclasses of frags.

    frag_strux a container of other frags => translates to a layout class
    in text/fmt/xp/fl_*
    frag_Text a collection of text with identical properties
                    (font/bold/superscript...)
    Frag_FmtMark a change of properties for following text without
    Frag_Object contains image/field

    This classes themselves have sub-classes eg frag_Strux has subclasses
    frag_strux_block, frag_strux_section, frag_strux_sectiontable etc..

    I wrote a little method in PD_Document to display the properties
    associated with struxes around a strux that I used for debugging
    purposes.

    PD_Document::miniDump(PL_StruxDocHandle sdh, UT_sint32 nstruxes)

    Input a StruxDocHandle sdh (basically a void * pointer to frag_strux,
    these are buried in every fl_Layout class) and it will dump the nstruxes
    before and after sdh to the xterm that run abiword from. Have a look at
    the code in minidump to see how to itterate over over the frags.

    Cheers

    Martin
     



    This archive was generated by hypermail 2.1.4 : Tue Oct 29 2002 - 19:52:53 EST