mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:40:48 +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
e5a4ab5b40
commit
0039705817
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>
|
2009-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSMenu.m: Keep the main menu in the main window (or visible
|
* Source/NSMenu.m: Keep the main menu in the main window (or visible
|
||||||
|
|
|
@ -841,6 +841,7 @@ documentAttributes: (NSDictionary **)dict
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Pass on baseURL
|
||||||
return [self initWithData: data
|
return [self initWithData: data
|
||||||
options: options
|
options: options
|
||||||
documentAttributes: dict
|
documentAttributes: dict
|
||||||
|
@ -858,7 +859,43 @@ documentAttributes: (NSDictionary **)dict
|
||||||
documentAttributes: (NSDictionary *)dict
|
documentAttributes: (NSDictionary *)dict
|
||||||
error: (NSError **)error
|
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;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +903,20 @@ documentAttributes: (NSDictionary **)dict
|
||||||
documentAttributes: (NSDictionary *)dict
|
documentAttributes: (NSDictionary *)dict
|
||||||
error: (NSError **)error
|
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;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue