From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sat Feb 23 2002 - 10:55:46 GMT
On Fri, 22 Feb 2002, William Lachance wrote:
> Hi. I think I've reverse engineered how wordperfect does lists, but I need
> some idea of how exactly to insert lists into AbiWord. Here's what I've
> gathered, in case it might be helpful:
>
> -Find a wordperfect byte group with D30E (outline define) - this starts the
> list
> - The for each element we have this structure:
> bytegroup DD04 - Para style begin on (pt. 1)
> bytegroup DD05 - Para style begin off (pt. 1)
> bytegroup DD06 - Para style begin on (pt. 2)
> bytegroup D432 - Para number on
> <then whatever you want to use as a bullet is as normal for a wordperfect
> doc.>
> bytegroup D433 - Para number off
> bytegroup E0 (tab)
> bytegroup DD07 - Para style begin off (pt. 2)
> <then whatever you want to put as list data is as normal for a wordperfect
> doc.>
> bytegroup DD08 - Para style end on
> <then eol group DD04 (may be optional?)>
> bytegroup DD09 Para style end off
>
> Then repeat this structure for every element in the list.
>
> This seems pretty screwed up, no doubt it's tied to the idiosyncricies of
> WordPerfect. I can't seem to find decent docs on how to insert lists in
> abiword using code. Any hints about how I should go about this?
>
It pretty simple. For unique list generate a randowm number. Assign the
random number to the paragraph Attribute "listID"
If the list is nested inside another list assign the listid of theparent
id to the paragraph attribute "parentID"
AbiWord has about 16 different sorts of lists. number, lower case, upper
case, bullet, dash etc.
set src/text/fmt/xp/fl_AutoLists.h so see the enumerated types.
Assign the numeric value of the type of list to the paragraph property
"list-style"
Numerical lists don't have to start at one. To set the starting value of
the list set the paragraph attribute "startv"
Numbered-type Lists can have text on either side of the list element eg.
((a--)
((b--)
((c--)
To set this text on either side of the list set set the paragraph property
of list-delim to ((%L--)
ie the %L is where the list element should go. Text to left is the
additional text in the list, text to the right goes to the right.
Set list-decimal to the char value "."
Finally you need to set the properties "text-indent" to get offset from
the current left side of the text to the list elemnt. This is typically a
negative number.
The property "left-margin" is the usual left side of the text.
Look in ie_imp_RTF.cpp "applyParagraphProperties() for some example code.
The code in there is pretty convoluted unfortunately because it has to
import lists generated by abiword's own extensions to rtf, for old style
RTF lists, for new MS extensions to lists in RTF for importing and pasting
lists into a document. However the process of acquiring all the those
properties is pretty clear.
Once these properties are set by the importer, the text layout code will
create nice lists for you. The code is now quite robust now and fix up
quite screwy orders of setting stuff.
Good Luck!
Martin
This archive was generated by hypermail 2.1.4 : Sat Feb 23 2002 - 06:00:52 GMT