diff options
author | Stef Walter <stef@memberwebs.com> | 2005-04-19 17:24:24 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2005-04-19 17:24:24 +0000 |
commit | 6fab96c700f8a15b486c292e70c8fdb5d31121b2 (patch) | |
tree | 0262fbfd99f0954bed556599a6daaf983c566b6c /src/xmlcomposer.cpp | |
parent | c91a548602ca74b5989eb046bc9c906b81e0ae20 (diff) |
Added support for character styles.
Diffstat (limited to 'src/xmlcomposer.cpp')
-rw-r--r-- | src/xmlcomposer.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index 93bd8f3..10b476f 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -525,6 +525,8 @@ bool XmlComposer::BaseAnalyser::processTextFormatting(const string& cw, int flag format.textSetFont(param); else if(cw == "fs" && HAS_PARAM) format.textSetFontSize(param); + else if(cw == "cs" && HAS_PARAM) + format.textSetStyle(param); else return false; @@ -640,8 +642,16 @@ ON_INITIALIZE(Style) ON_CONTROLWORD(Style) { - // Get the style id - if(flags & kAsterisk) + bool use = false; + + // The style id + if((cw == "s" && (flags & kHasParam)) || + (cw == "cs" && (flags & kAsterisk) && (flags & kHasParam))) + { + use = true; + } + + else if (flags & kAsterisk) { AN_ANALYSER(Skip); return; @@ -655,18 +665,19 @@ ON_CONTROLWORD(Style) haveStyle = true; } - // The style id - if(cw == "s" && flags & kHasParam) + if (use) { AN_ATTRIBUTE(kAtId, param); } // Otherwise get as much formatting out of the tag as possible - else if(processTextFormatting(cw, flags, param)) - DUMMY; - else - DEFAULT_CONTROLWORD; + { + if(processTextFormatting(cw, flags, param)) + DUMMY; + else + DEFAULT_CONTROLWORD; + } } ON_GROUPSTART(Style) @@ -1081,6 +1092,13 @@ ON_CHARDATA(Content) } } + if(format.textStyle() != -1) + { + AN_ELEMENT(kElSpan); + AN_ATTRIBUTE(kElStyle, format.textStyle()); + elements++; + } + // Now do text Properties if necessary if(format.textIsBold()) |