mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Basic implementation for NSAttributedString data save methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27696 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a1b67a4d07
commit
7831bedb6d
2 changed files with 57 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2009-01-26 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSAttributedString.m (-dataFromRange:...,
|
||||
-fileWrapperFromRange:...): Basic implementation.
|
||||
|
||||
2009-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSMenu.m: Keep the main menu in the main window (or visible
|
||||
|
|
|
@ -841,6 +841,7 @@ documentAttributes: (NSDictionary **)dict
|
|||
return nil;
|
||||
}
|
||||
|
||||
// FIXME: Pass on baseURL
|
||||
return [self initWithData: data
|
||||
options: options
|
||||
documentAttributes: dict
|
||||
|
@ -858,7 +859,43 @@ documentAttributes: (NSDictionary **)dict
|
|||
documentAttributes: (NSDictionary *)dict
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
NSString *type = [dict objectForKey: NSDocumentTypeDocumentOption];
|
||||
|
||||
if (type == nil)
|
||||
{
|
||||
// FIXME: set error
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([type isEqualToString: NSDocFormatTextDocumentType])
|
||||
{
|
||||
return [self docFormatFromRange: range
|
||||
documentAttributes: dict];
|
||||
}
|
||||
else if ([type isEqualToString: NSHTMLTextDocumentType])
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
else if ([type isEqualToString: NSRTFDTextDocumentType])
|
||||
{
|
||||
return [self RTFDFromRange: range
|
||||
documentAttributes: dict];
|
||||
}
|
||||
else if ([type isEqualToString: NSRTFTextDocumentType])
|
||||
{
|
||||
return [self RTFFromRange: range
|
||||
documentAttributes: dict];
|
||||
}
|
||||
else if ([type isEqualToString: NSPlainTextDocumentType])
|
||||
{
|
||||
NSStringEncoding encoding = [[dict objectForKey: @"CharacterEncoding"]
|
||||
intValue];
|
||||
|
||||
if (!encoding)
|
||||
encoding = [NSString defaultCStringEncoding];
|
||||
return [[self string] dataUsingEncoding: encoding];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -866,7 +903,20 @@ documentAttributes: (NSDictionary **)dict
|
|||
documentAttributes: (NSDictionary *)dict
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
NSFileWrapper *wrapper;
|
||||
NSData *data;
|
||||
|
||||
// FIXME: This wont work for directory bundles.
|
||||
data = [self dataFromRange: range
|
||||
documentAttributes: dict
|
||||
error: error];
|
||||
if (data != nil)
|
||||
{
|
||||
wrapper = [[NSFileWrapper alloc] initRegularFileWithContents: data];
|
||||
return AUTORELEASE(wrapper);
|
||||
}
|
||||
|
||||
// FIXME: Set error
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue