Getting the defaults for style..

From: Ben Martin <monkeyiq_at_users.sourceforge.net>
Date: Mon Apr 25 2011 - 06:30:37 CEST

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 Mon Apr 25 06:30:55 2011

This archive was generated by hypermail 2.1.8 : Mon Apr 25 2011 - 06:30:56 CEST