diff options
author | Stef Walter <stef@memberwebs.com> | 2006-10-24 02:46:20 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-10-24 02:46:20 +0000 |
commit | b4536dcb0909e8049df7424c8a39424933b88d3e (patch) | |
tree | b576b468e999bc4f184e7af820cf397d43cf4bf9 | |
parent | bdb9ccd0d3e058d0555a73aca3cb01f7dd45b5a7 (diff) |
- Don't let page number fields through.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/xmlcomposer.cpp | 24 |
2 files changed, 25 insertions, 1 deletions
@@ -1,9 +1,9 @@ Version 0.9.7 - - Don't let most characters below 0x0020 through. Old RTF's seem to have these for strange reasons. - Send data in chunks so massive amounts of picture data don't slow down the conversion. + - Don't let page number fields through. Version 0.9.6 - Add character styles diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index 6a731ff..e1ae89e 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -79,6 +79,22 @@ void tokenize(const string& str, StringArray& tokens, } } +void trim(string& str, const char* whitespace = " \t") +{ + string::size_type pos = str.find_last_not_of(whitespace); + if(pos != string::npos) + { + str.erase(pos + 1); + pos = str.find_first_not_of(whitespace); + if(pos != string::npos) + str.erase(0, pos); + } + else + { + str.erase(str.begin(), str.end()); + } +} + /* ---------------------------------------------------------------------------------- * CONSTRUCTION */ @@ -1074,6 +1090,7 @@ ON_CONTROLWORD(Info) // Field Analyser ------------------------------------------------------------------- static const string kFieldHyperlink = "HYPERLINK"; +static const string kFieldPage = "PAGE"; ON_CONTROLWORD(Field) { @@ -1086,6 +1103,7 @@ ON_CONTROLWORD(Field) { StringArray codes; tokenize(fieldCode, codes, " ", '"'); + trim(fieldCode); if(codes.size() >= 2 && codes[0].compare(kFieldHyperlink) == 0) { @@ -1106,6 +1124,12 @@ ON_CONTROLWORD(Field) AN_ATTRIBUTE(kAtTo, codes[1]); } } + + // Page numbers don't make sense, don't let through + else if(fieldCode.compare(kFieldPage) == 0) + { + AN_DESTINATION(Null); + } } // The internal link data |