[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/filters/kword/rtf/import
From: Nicolas Goutte <nicolasg () snafu ! de>
Date: 2004-11-29 14:39:33
Message-ID: 20041129143933.8A6071BA45 () office ! kde ! org
[Download RAW message or body]
CVS commit by goutte:
Add support for PocketWord's PWD files
(...assuming that they are "served" as text/rtf. So either rename the file
or extend the mimetype.)
M +26 -8 rtfimport.cpp 1.123
--- koffice/filters/kword/rtf/import/rtfimport.cpp #1.122:1.123
@@ -346,9 +346,7 @@ KoFilter::ConversionStatus RTFImport::co
// Verify document type and version (RTF version 1.x)
- // Change this to > 1 so to be able to open RTF0 documents created by "Ted" \
etc...
- // RTF Version 0 should be compatible with version 1.
-
token.next();
+ // ### TODO: user visible error messages
if (token.type != RTFTokenizer::ControlWord)
{
@@ -358,8 +356,28 @@ KoFilter::ConversionStatus RTFImport::co
}
- // ### TODO: Pocket Word seems to have 2 variants of RTF. \pwd seems to very \
similar to \rtf
- if ((qstrcmp( token.text, "rtf" ) || token.value > 1))
+ if ( !qstrcmp( token.text, "rtf" ) )
{
- kdError(30515) << "Wrong document type (" << token.text << ") or version (" \
<< token.value << "; version 0 or 1.x expected)" << endl; + // RTF is normally \
version 1 but at least Ted uses 0 as version number + if ( token.value > 1 )
+ {
+ kdError(30515) << "Wrong RTF version (" << token.value << "); version 0 \
or 1 expected" << endl; + in.close();
+ return KoFilter::WrongFormat;
+ }
+ }
+ else if ( !qstrcmp( token.text, "pwd" ) )
+ {
+ // PocketWord's PWD format is similar to RTF but has a version number of 2.
+ // ### TODO: should lower version numbers be refused?
+ if ( token.value > 2 )
+ {
+ kdError(30515) << "Wrong PWD version (" << token.value << "); version 2 \
expected" << endl; + in.close();
+ return KoFilter::WrongFormat;
+ }
+ }
+ else
+ {
+ kdError(30515) << "Wrong RTF document type (\\" << token.text << "); \
\\rtf or \\pwd expected" << endl; in.close();
return KoFilter::WrongFormat;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic