mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 16:40:53 +00:00
NSText can save rtf
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6407 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
84606cb733
commit
f6bf8a8acd
3 changed files with 170 additions and 114 deletions
|
@ -75,6 +75,15 @@ paraBreakCSet()
|
|||
return cset;
|
||||
}
|
||||
|
||||
@interface NSAttributedString(AttributedStringRTFDAdditions)
|
||||
|
||||
- (NSString*) RTFHeaderStringWithContext: (NSMutableDictionary*) contextDict;
|
||||
- (NSString*) RTFTrailerStringWithContext: (NSMutableDictionary*) contextDict;
|
||||
- (NSString*) RTFBodyStringWithContext: (NSMutableDictionary*) contextDict;
|
||||
- (NSString*) RTFDStringFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary*)dict;
|
||||
@end
|
||||
|
||||
@implementation NSAttributedString (AppKit)
|
||||
|
||||
- (BOOL) containsAttachments
|
||||
|
@ -282,7 +291,9 @@ paraBreakCSet()
|
|||
- (id) initWithRTFD: (NSData*)data
|
||||
documentAttributes: (NSDictionary**)dict
|
||||
{
|
||||
return self;
|
||||
// FIXME: We use RTF, as there are currently no additional images
|
||||
return [self initWithRTF: data
|
||||
documentAttributes: dict];
|
||||
}
|
||||
|
||||
- (id) initWithPath: (NSString*)path
|
||||
|
@ -319,19 +330,24 @@ documentAttributes: (NSDictionary**)dict
|
|||
- (NSData*) RTFFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary*)dict
|
||||
{
|
||||
return (NSData *)self;
|
||||
// FIXME: We use RTFD, as there are currently no additional images
|
||||
return [self RTFDFromRange: range
|
||||
documentAttributes: dict];
|
||||
}
|
||||
|
||||
- (NSData*) RTFDFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary*)dict
|
||||
{
|
||||
return (NSData *)self;
|
||||
return [[self RTFDStringFromRange: range documentAttributes: dict]
|
||||
dataUsingEncoding: NSNEXTSTEPStringEncoding];
|
||||
}
|
||||
|
||||
- (NSFileWrapper*) RTFDFileWrapperFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary*)dict
|
||||
{
|
||||
return (NSFileWrapper *)self;
|
||||
return [[NSFileWrapper alloc] initRegularFileWithContents:
|
||||
[self RTFDFromRange: range
|
||||
documentAttributes: dict]];
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -847,11 +863,4 @@ documentAttributes: (NSDictionary**)dict
|
|||
[output appendString: trailerString];
|
||||
return (NSString*)output;
|
||||
}
|
||||
|
||||
- (NSData*) RTFDFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary*)dict
|
||||
{
|
||||
return [[self RTFDStringFromRange: range documentAttributes: dict]
|
||||
dataUsingEncoding: NSNEXTSTEPStringEncoding];
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue