Moved method for RTF init in this file

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6501 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2000-04-23 22:29:47 +00:00
parent 034448c171
commit a0f56f73f1

View file

@ -330,6 +330,23 @@ documentAttributes: (NSDictionary**)dict
return self;
}
- (id) initWithRTF: (NSData*)data
documentAttributes: (NSDictionary**)dict
{
NSString *rtfString = [[NSString alloc]
initWithData: data
encoding: NSASCIIStringEncoding];
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] init];
parseRTFintoAttributedString(rtfString, result, dict);
self = [self initWithAttributedString: result];
RELEASE(rtfString);
RELEASE(result);
return self;
}
- (id) initWithHTML: (NSData*)data
documentAttributes: (NSDictionary**)dict
{
@ -358,7 +375,7 @@ documentAttributes: (NSDictionary**)dict
documentAttributes: (NSDictionary*)dict
{
return [[self RTFDStringFromRange: range documentAttributes: dict]
dataUsingEncoding: NSNEXTSTEPStringEncoding];
dataUsingEncoding: NSASCIIStringEncoding];
}
- (NSFileWrapper*) RTFDFileWrapperFromRange: (NSRange)range
@ -1116,16 +1133,29 @@ documentAttributes: (NSDictionary**)dict
{
NSString *braces;
braces = [NSString stringWithFormat: @"{%@ %@%@}",
headerString, substring, trailerString];
if ([headerString length])
braces = [NSString stringWithFormat: @"{%@ %@%@}",
headerString, substring, trailerString];
else
braces = [NSString stringWithFormat: @"{%@%@}",
substring, trailerString];
[result appendString: braces];
}
else
{
NSString *nobraces;
nobraces = [NSString stringWithFormat: @"%@ %@%@",
headerString, substring, trailerString];
if ([headerString length])
nobraces = [NSString stringWithFormat: @"%@ %@",
headerString, substring];
else
nobraces = substring;
if ([trailerString length])
nobraces = [NSString stringWithFormat: @"%@%@ ",
nobraces, trailerString];
[result appendString: nobraces];
}
}