patch: RTF importer can properly import styles and use them.


Subject: patch: RTF importer can properly import styles and use them.
From: Matti Picus (matti@picus.org)
Date: Tue Sep 11 2001 - 02:41:49 CDT


I created this patch with
cvs diff -u ie_imp_RTF.*

Still TODO:
1. Memory leak when closing AbiWord. I no longer have access to a good leak
tester. For all I know, the leak is not mine :). A leak does appear
(maybe fewer items) even when my code is not activated.

2. May have broken list importing. Please let me know if things that used
to work no longer do. It would be nice if some files with lists appeared
in the test directory.

3. I would like to rewrite the paragraph/character formatting
handling. Currently the information is stored in a structure, then printed
out to a formatting string. Why not immediately parse it into the form
AbiWord needs? This would have the advantage of allowing a RTF keyword -
AbiWord keyword mapping in a single structure, the parser could then build
a hash table and build the formatting string in a grow buffer.

The patch changes (at least) the following things:
1. Style name is now parsed out of a paragraph and applied properly to the
paragraph, the AbiWord user now can see what style the formatting is based on.

2. Cleaned up code so as to use the construct:
attribs[attribsCount++] = PT_LISTID_ATTRIBUTE_NAME;
attribs[attribsCount++] = szListID;

to add attributes. To this end I added a constant PT_MAX_ATTRIBUTES that
should indicate how big the attribs[] array needs to be.

3. Cleaned up the code to use the PT_*_NAME constructs instead of hard
coded strings. I probably didn't catch all of them though...

4. Started cleaning out the code a bit, removing excess use of vectors and
duplicate variables.

Please test,




This archive was generated by hypermail 2b25 : Tue Sep 11 2001 - 01:43:42 CDT