diff options
| -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  | 
