Re: Help stepping through objects in a document

From: Dom Lachowicz (doml@appligent.com)
Date: Tue Oct 29 2002 - 14:01:46 EST

  • Next message: Jordi Mas: "commit: some i18n enhancements, select UI and Document language from preference for win32"

    On Tue, 2002-10-29 at 09: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,

    The only way I know how to do this *easily* is via writing an exporter.
    When you save the document, you necessarily iterate over the objects in
    the current document in a sequential manner.

    You could write a shim/dummy exporter which doesn't write anything to
    disk (serializing the object list, as it were), but instead did some
    other operation based on the object list that's being enumerated.

    Barring that, another good start would be to look at how these objects
    get enumerated in the piece-table code when being exported. Clearly we
    already have code for iterating over all of the objects in the document.
    You might be able to steal or use it.

    Cheers,
    Dom



    This archive was generated by hypermail 2.1.4 : Tue Oct 29 2002 - 14:10:13 EST