Re: Getting the defaults for style..

From: Martin Sevior <msevior_at_gmail.com>
Date: Tue Apr 26 2011 - 03:43:04 CEST

Hi Ben,

To be clear, do you want a method:

const char * PD_Document::getDefaultStyle()

That returns the name of the default style in the document?

Cheers

Martin

On Mon, Apr 25, 2011 at 2:30 PM, Ben Martin
<monkeyiq@users.sourceforge.net> wrote:
> Hi,
>  While hacking away on Change Tracking for ODT, a case snuck up
> involving styles. Basically, one might have a case where
> revision 2 = ODF Style2 which == italic + bold
> revision 3 = ODF Style4 which == bold
> ie, each revision in the ODF references a style which wants to
> explicitly set the current style settings to
> default + {values}
>
> Of course, in abiword change tracking the above gets converted to
> revision 2 = italic + bold
> revision 3 = remove italic
> ie, the minimal changes needed to get to Style4 from Style2 become what
> is to be done for revision 3's abiword change tracking record. This
> folding is currently done as a postprocess to the ODF load in
> ctSimplifyStyles() of my git repo.
>
> This gives the issue where the "default" for many style related
> properties is needed by my current code. So I have something like this:
>
> std::string getDefaultStyle( std::string s )
> {
>    if( starts_with( s, "font-style" ))
>        return "font-style:normal";
>    if( starts_with( s, "text-decoration" ))
>        return "text-decoration:none";
>    return s;
> }
>
> which needs expansion. I notice things
> like ./src/wp/impexp/xp/ie_exp_HTML.cpp / s_prop_list
>
> and a string with a similar properties list used in
> pt_PieceTable::_loadBuiltinStyles(void)
>
> but there doesn't seem to be a generic getDefault() like function
> currently? Sorry if I missed it :(
>
> Perhaps such a function as the above getDefaultStyle() with a more
> appropriate name would be generally useful in other parts of abiword? If
> so I could expand mine and maybe make it
> const char* getDefaultValueForProperty( const char* p )
> to strip it down to a lightweight function.
>
>
Received on Tue Apr 26 03:43:11 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 26 2011 - 03:43:11 CEST