Subject: Re: How to apply formatting to a pt_PieceTable?
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Mon Sep 10 2001 - 20:01:35 CDT
On Tue, 11 Sep 2001, Matti Picus wrote:
> I am trying to get the RTF importer to set the style (some would say name)
> of a imported chunk. Apparently it works differently from other
> formatting, say margin-right or margin-left.
>
> The importer calls PD_Document::appendStrux with information about how to
> format the chunk: margin-right etc. This ends up in a pt_PieceTable.
> However the style/name has no effect, all the imported text ends up with
> the default style/name "None". Just to be on the safe side I tried with
> both "style:AbiWordSpecial;" and "name:AbiWordSpecial;"
You set the style attribute by doing
const char ** attributes = NULL;
... build all the attributes you want for your span/paragraph of text...
attributes[i] = pt_PT_STYLE_ATTRIBUTE_NAME;
attributes[i+1] = "AbiWordSpecial"
Then for a paragraph
bool ok = getDoc()->appendStrux(PTX_Block, attributes);
For a character level style...
bool ok = getDoc()->appendFmt(attributes);
All subsequent text you insert will acquire the attributes/properties you
set until you change the fmt.
Character level styles are set in ApplyCharacterAttributes(..)
Paragraph level styles are set in ApplyParagraphAttributes(..)
>
> I imagine I want to use pt_PieceTable::changeStruxFmt since it seems to
> relate to styles/names, but I cannot figure out how.
>
This is for pre-existing text - not for import.
See fv_View.cpp::setStyle(..) for how to set the style of pre-existing
text.
> When I finish importing, and use the style dialog box to change the style
> of a paragraph, I end up in fl_BlockLayout::doclistener_changeStrux and
> change a variable called m_szStyle. I don't see a pt_PieceTable anywhere
> around, but I probably am not looking well enough.
>
> Any one care to help?
>
The pt_PieceTable is totally hidden behind calls to PD_Document. In the
AbiWord framework pt_PieceTable is our Model. Pd_Document is the
controller on the model. FV_View is the interface into this model for a
particular view on the document (since we can have multiple windows on the
same document.)
Anyway, all piecetable manipulations go through PD_Document.cpp
Keep up the great work!
Cheers
Martin
This archive was generated by hypermail 2b25 : Mon Sep 10 2001 - 20:01:50 CDT