Re: Formatting Documents


Subject: Re: Formatting Documents
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sun Jul 29 2001 - 08:19:24 CDT


On Sun, 29 Jul 2001, William Lachance wrote:

> Ok, I give up.
>
> I can't for the life of me see how to add styles (bold, underline, etc.)
> correctly when loading a file. I've looked through just about every importer
> and none of them seem to point me in the right direction.
>
> It's pretty obvious how you add a hint to start the usage of style within a
> document (by using pd_Document->appendFmt), but I don't see how you end
> it. Many of the importers (ie: the abiword importer) don't seem to do it at
> all! (although of course that can't be true).

In abiword, formatting stays the same until a new format specification
changes it.

>
> What WordPerfect does is define a sequence of 3 bytes that both begins and
> ends a style property's occurance of arbitrary length (byte 241 begins one,
> 242 ends one).
>

Well what you need to do then is specify the new format at when it starts
via the appendFmt. When it finishes specify the next format also via the
appendFmt. If there is some span of text that does not have one of these
specified style regions, then define a default style that
all these styles drop back to. Then define what this style is before
loading the document. Give it some obvious name like "Word Perfect
Default". When one of these segments finishes, do a appendFmt(addStyle...)
command to set all the AbiWord propeties back to this default
configuration. Then do a appendFmt to give the new set of text
definitions.

Does this make sense? You reset the AbiWord text definitions via a style
definition. AbiWord has a builtin style called "Normal Clean" that resets
most properties to boring, sane, values. Have a look at pt_PT_Styles.cpp
to
see.

Also define some user defined styles in in Abiword for a document to see
how the file format works.

Let me know if you need more clarifications.

Cheers

Martin



This archive was generated by hypermail 2b25 : Sun Jul 29 2001 - 08:19:44 CDT