Reorganized -appendImage: in RTFDConsumer to compile on gcc 2.95

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22916 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicolas Roard 2006-05-12 15:31:04 +00:00
parent 12989e49e5
commit ac24912641
2 changed files with 22 additions and 3 deletions

View file

@ -1,4 +1,11 @@
2006-05-12 Nicolas Roard <nicolas@roard.com>
* TextConverters/RTF/RTFConsumer.m: reorganized -appendImage: in
the RTFDConsumer class to compile with gcc 2.95 and declared the
method in a private category.
2006-05-12 Nicolas Roard <nicolas@roard.com>
* TextConverters/RTF/RTFProducer.m: fixed the saving of the embedded
files by using -lastPathComponent
* TextConverters/RTF/rtfGrammer.tab.c:

View file

@ -375,6 +375,13 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
@end
@interface RTFDConsumer (Private)
- (void) appendImage: (NSString*) string;
@end
@implementation RTFDConsumer
- (id) init
@ -427,16 +434,21 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
NSImage* image = [[NSImage alloc] initWithData: [wrapper regularFileContents]];
NSTextAttachmentCell* attachedCell = [[NSTextAttachmentCell alloc] initImageCell: image];
NSTextAttachment* attachment = [[NSTextAttachment alloc] initWithFileWrapper: wrapper];
RTFAttribute* attr = [self attr];
NSMutableDictionary* attributes = nil;
NSMutableAttributedString* str = nil;
[attachment setAttachmentCell: attachedCell];
RTFAttribute* attr = [self attr];
NSMutableDictionary* attributes = [[NSMutableDictionary alloc]
attributes = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
[attr currentFont], NSFontAttributeName,
attr->paragraph, NSParagraphStyleAttributeName,
nil];
NSMutableAttributedString* str = [NSMutableAttributedString attributedStringWithAttachment: attachment];
str = (NSMutableAttributedString*) [NSMutableAttributedString
attributedStringWithAttachment: attachment];
[str addAttributes: attributes range: NSMakeRange (0, [str length])];
[result replaceCharactersInRange: insertionRange withAttributedString: str];