mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 15:30:59 +00:00
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:
parent
034448c171
commit
a0f56f73f1
1 changed files with 35 additions and 5 deletions
|
@ -330,6 +330,23 @@ documentAttributes: (NSDictionary**)dict
|
||||||
return self;
|
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
|
- (id) initWithHTML: (NSData*)data
|
||||||
documentAttributes: (NSDictionary**)dict
|
documentAttributes: (NSDictionary**)dict
|
||||||
{
|
{
|
||||||
|
@ -358,7 +375,7 @@ documentAttributes: (NSDictionary**)dict
|
||||||
documentAttributes: (NSDictionary*)dict
|
documentAttributes: (NSDictionary*)dict
|
||||||
{
|
{
|
||||||
return [[self RTFDStringFromRange: range documentAttributes: dict]
|
return [[self RTFDStringFromRange: range documentAttributes: dict]
|
||||||
dataUsingEncoding: NSNEXTSTEPStringEncoding];
|
dataUsingEncoding: NSASCIIStringEncoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSFileWrapper*) RTFDFileWrapperFromRange: (NSRange)range
|
- (NSFileWrapper*) RTFDFileWrapperFromRange: (NSRange)range
|
||||||
|
@ -1116,16 +1133,29 @@ documentAttributes: (NSDictionary**)dict
|
||||||
{
|
{
|
||||||
NSString *braces;
|
NSString *braces;
|
||||||
|
|
||||||
|
if ([headerString length])
|
||||||
braces = [NSString stringWithFormat: @"{%@ %@%@}",
|
braces = [NSString stringWithFormat: @"{%@ %@%@}",
|
||||||
headerString, substring, trailerString];
|
headerString, substring, trailerString];
|
||||||
|
else
|
||||||
|
braces = [NSString stringWithFormat: @"{%@%@}",
|
||||||
|
substring, trailerString];
|
||||||
|
|
||||||
[result appendString: braces];
|
[result appendString: braces];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSString *nobraces;
|
NSString *nobraces;
|
||||||
|
|
||||||
nobraces = [NSString stringWithFormat: @"%@ %@%@",
|
if ([headerString length])
|
||||||
headerString, substring, trailerString];
|
nobraces = [NSString stringWithFormat: @"%@ %@",
|
||||||
|
headerString, substring];
|
||||||
|
else
|
||||||
|
nobraces = substring;
|
||||||
|
|
||||||
|
if ([trailerString length])
|
||||||
|
nobraces = [NSString stringWithFormat: @"%@%@ ",
|
||||||
|
nobraces, trailerString];
|
||||||
|
|
||||||
[result appendString: nobraces];
|
[result appendString: nobraces];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue