Lists (Long Message)


Subject: Lists (Long Message)
From: Luke Jordan (ljordan@mweb.co.za)
Date: Thu Feb 10 2000 - 20:53:42 CST


This patch gives list support (currently only numbered) to AbiWord. This is a
big feature, so I'm going to take some time and explain some of the choices I
made.

Basic rundown: We have a seperate class called fl_AutoNum which handles almost
all the logic of storing, numbering etc. This has a vector of component blocks
and various methods for inserting etc.. I made this seperate so any fl_Layout
class can use it. I wanted to extend this to things like fp_Line and column, but
there's no fp_* base class. I treat every list level as a seperate list, which
happens to be contained in a higher-level one, which I found most efficient
because we can treat flat and nested lists identically and handling the higher
level's values is easier.

The biggest problem at the moment is the actual labelling. I currently insert
a field with field type "list-label", which gets its value from its block, and
in the styles I create a hanging indent and insert a tab. This sucks, but it
does at least give a simulation of the right feel. To do this properly we need a
rather special field which allows us to a) insert tabs etc. into it, b) makes
sure it is unique in the block and c) triggers actions on deletion. I tried
implementing c) in a destructor, but the action really needs to occur *after*
the field has been deleted. There are also a few problems regarding styles and
format marks, e.g. we need to carry over our list-style without erasing the text
formatting properties, and we need to set our list-label to have the same format
as the paragraph test (not sure how to do that one).

I also have a problem with constructing the labelling string. I've done work
there which kind-of works for numbered lists as I've tested them, but it seems
very crude to me. I looked at the sources for printf, but it's way too complex
for mere mortals. Hopefully someone here has some experience with this. I wasn't
sure how to do bullets yet, mainly cause the list notes talk about different
bullets for different levels, and unicode only seems to have one. I'm also not
sure my format string routine is capable of doing them.

To test this I've put two temp menu labels in which increment and decrement the
list level, and I've attached a file which shows a pretty complex list. I have
no experience with the UI side, and would probably come up with some atrocious
solutions, so I haven't done much there (though if no one volunteers I'm
willing to do it myself). I have one suggestion: don't ape Word. I don't like
Word's list UI, especially as it makes multi-level so damn obscure.

Anyway, I've given this a pretty rigorous testing and it seems to work OK.

Luke Jordan.





This archive was generated by hypermail 2b25 : Thu Feb 10 2000 - 18:47:28 CST