mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:30:47 +00:00
Add some support for help links and markers in RTF documents. These
end up as dedicated attachments in attributed strings. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31828 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3346dd5d48
commit
e86fae67c3
13 changed files with 1104 additions and 604 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
||||||
|
2011-01-03 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/GNUmakefile:
|
||||||
|
* Headers/Additions/GNUstepGUI/GSHelpAttachment.h:
|
||||||
|
* Source/GSHelpAttachment.m:
|
||||||
|
Introduce new classes GSHelpLinkAttachment and
|
||||||
|
GSHelpMarkerAttachment to implement help links and markers in RTF
|
||||||
|
documents.
|
||||||
|
|
||||||
|
* TextConverters/RTF/rtfGrammar.y:
|
||||||
|
* TextConverters/RTF/RTFConsumerFunctions.h:
|
||||||
|
* TextConverters/RTF/RTFConsumer.m (-addHelpLink:marker:,
|
||||||
|
-addHelpMarker:, GSRTFNeXTHelpLink, GSRTFNeXTHelpMarker):
|
||||||
|
Create attachments for help links and markers in RTF documents.
|
||||||
|
|
||||||
|
* TextConverters/RTF/RTFProducer.m (-_addAttributesString:):
|
||||||
|
Properly write out help links and markers to RTF documents.
|
||||||
|
|
||||||
|
* TextConverters/RTF/rtfGrammar.tab.h:
|
||||||
|
* TextConverters/RTF/rtfGrammar.tab.c: Regenerated.
|
||||||
|
|
||||||
|
* Images/GNUmakefile:
|
||||||
|
* Images/common_HelpLink.tiff:
|
||||||
|
New icon for help link attachments.
|
||||||
|
|
||||||
|
* Source/NSFileWrapper.m (-icon): Bug fix: Don't return a default
|
||||||
|
icon for a wrapper without a file name.
|
||||||
|
|
||||||
2011-01-03 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2011-01-03 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* TextConverters/RTF/rtfGrammar.y:
|
* TextConverters/RTF/rtfGrammar.y:
|
||||||
|
|
56
Headers/Additions/GNUstepGUI/GSHelpAttachment.h
Normal file
56
Headers/Additions/GNUstepGUI/GSHelpAttachment.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/** <title>GSHelpAttachment</title>
|
||||||
|
|
||||||
|
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
Date: Jan 2011
|
||||||
|
|
||||||
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||||
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GNUstep_H_GSHelpAttachment
|
||||||
|
#define _GNUstep_H_GSHelpAttachment
|
||||||
|
|
||||||
|
#import <AppKit/NSTextAttachment.h>
|
||||||
|
|
||||||
|
@interface GSHelpLinkAttachment : NSTextAttachment
|
||||||
|
{
|
||||||
|
NSString *fileName, *markerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithFileName: (NSString *)aFileName
|
||||||
|
markerName: (NSString *)aMarkerName;
|
||||||
|
- (void) dealloc;
|
||||||
|
- (NSString *)fileName;
|
||||||
|
- (NSString *)markerName;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface GSHelpMarkerAttachment : NSTextAttachment
|
||||||
|
{
|
||||||
|
NSString *markerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithMarkerName: (NSString *)aMarkerName;
|
||||||
|
- (void) dealloc;
|
||||||
|
- (NSString *)markerName;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* _GNUstep_H_GSHelpAttachment */
|
|
@ -74,6 +74,7 @@ Images_RESOURCE_FILES = \
|
||||||
common_Folder.tiff \
|
common_Folder.tiff \
|
||||||
common_GSFolder.tiff \
|
common_GSFolder.tiff \
|
||||||
common_HelpCursor.tiff \
|
common_HelpCursor.tiff \
|
||||||
|
common_HelpLink.tiff \
|
||||||
common_Home.tiff \
|
common_Home.tiff \
|
||||||
common_HomeDirectory.tiff \
|
common_HomeDirectory.tiff \
|
||||||
common_ImageFolder.tiff \
|
common_ImageFolder.tiff \
|
||||||
|
|
BIN
Images/common_HelpLink.tiff
Normal file
BIN
Images/common_HelpLink.tiff
Normal file
Binary file not shown.
|
@ -239,7 +239,8 @@ GSGormLoader.m \
|
||||||
GSGModelLoader.m \
|
GSGModelLoader.m \
|
||||||
GSNibLoader.m \
|
GSNibLoader.m \
|
||||||
GSXibLoader.m \
|
GSXibLoader.m \
|
||||||
NSManagedObjectContext.m
|
NSManagedObjectContext.m \
|
||||||
|
GSHelpAttachment.m
|
||||||
|
|
||||||
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
|
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
|
||||||
# but does not implement <NSObject>'s methods itself (it inherits
|
# but does not implement <NSObject>'s methods itself (it inherits
|
||||||
|
@ -447,7 +448,8 @@ GSInstantiator.h \
|
||||||
GSSoundSink.h \
|
GSSoundSink.h \
|
||||||
GSSoundSource.h \
|
GSSoundSource.h \
|
||||||
GSWindowDecorationView.h \
|
GSWindowDecorationView.h \
|
||||||
GSXibLoading.h
|
GSXibLoading.h \
|
||||||
|
GSHelpAttachment.h
|
||||||
|
|
||||||
libgnustep-gui_HEADER_FILES = ${GUI_HEADERS}
|
libgnustep-gui_HEADER_FILES = ${GUI_HEADERS}
|
||||||
|
|
||||||
|
|
108
Source/GSHelpAttachment.m
Normal file
108
Source/GSHelpAttachment.m
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/** <title>GSHelpAttachment</title>
|
||||||
|
|
||||||
|
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
Date: Jan 2011
|
||||||
|
|
||||||
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||||
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#import "AppKit/NSFileWrapper.h"
|
||||||
|
#import "AppKit/NSImage.h"
|
||||||
|
#import "GNUstepGUI/GSHelpAttachment.h"
|
||||||
|
|
||||||
|
@implementation GSHelpLinkAttachment
|
||||||
|
|
||||||
|
static NSImage *sharedHelpLinkIcon;
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
sharedHelpLinkIcon = [NSImage imageNamed: @"common_HelpLink"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithFileName: (NSString *)aFileName
|
||||||
|
markerName: (NSString *)aMarkerName
|
||||||
|
{
|
||||||
|
NSFileWrapper *wrapper;
|
||||||
|
|
||||||
|
/* Create an empty wrapper so that we can supply an icon to the
|
||||||
|
attachment cell. */
|
||||||
|
wrapper = [[NSFileWrapper alloc] init];
|
||||||
|
[wrapper setIcon: sharedHelpLinkIcon];
|
||||||
|
|
||||||
|
if ((self = [super initWithFileWrapper: wrapper]) != nil)
|
||||||
|
{
|
||||||
|
ASSIGN(fileName, aFileName);
|
||||||
|
ASSIGN(markerName, aMarkerName);
|
||||||
|
}
|
||||||
|
RELEASE(wrapper);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
RELEASE(fileName);
|
||||||
|
RELEASE(markerName);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) fileName
|
||||||
|
{
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) markerName
|
||||||
|
{
|
||||||
|
return markerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation GSHelpMarkerAttachment
|
||||||
|
|
||||||
|
- (id) initWithMarkerName: (NSString *)aMarkerName
|
||||||
|
{
|
||||||
|
NSFileWrapper *wrapper;
|
||||||
|
|
||||||
|
/* Create an empty wrapper so that we can supply an (nil) icon to
|
||||||
|
the attachment cell. */
|
||||||
|
wrapper = [[NSFileWrapper alloc] init];
|
||||||
|
|
||||||
|
if ((self = [super initWithFileWrapper: wrapper]) != nil)
|
||||||
|
{
|
||||||
|
ASSIGN(markerName, aMarkerName);
|
||||||
|
}
|
||||||
|
RELEASE(wrapper);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
RELEASE(markerName);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) markerName
|
||||||
|
{
|
||||||
|
return markerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -339,7 +339,7 @@
|
||||||
|
|
||||||
- (NSImage*) icon
|
- (NSImage*) icon
|
||||||
{
|
{
|
||||||
if (_iconImage == nil)
|
if (_iconImage == nil && [self filename])
|
||||||
{
|
{
|
||||||
return [[NSWorkspace sharedWorkspace] iconForFile: [self filename]];
|
return [[NSWorkspace sharedWorkspace] iconForFile: [self filename]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,12 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#include "RTFConsumer.h"
|
#import <GNUstepGUI/GSHelpAttachment.h>
|
||||||
#include "RTFConsumerFunctions.h"
|
#import "RTFConsumer.h"
|
||||||
#include "RTFProducer.h"
|
#import "RTFConsumerFunctions.h"
|
||||||
|
#import "RTFProducer.h"
|
||||||
|
|
||||||
/* we have to satisfy the scanner with a stream reading function */
|
/* we have to satisfy the scanner with a stream reading function */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -266,6 +267,8 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
|
||||||
- (void) push;
|
- (void) push;
|
||||||
- (void) pop;
|
- (void) pop;
|
||||||
- (void) appendString: (NSString*)string;
|
- (void) appendString: (NSString*)string;
|
||||||
|
- (void) appendHelpLink: (NSString*)fileName marker: (NSString *)markerName;
|
||||||
|
- (void) appendHelpMarker: (NSString*)markerName;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -662,6 +665,84 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) appendHelpLink: (NSString*)fileName marker: (NSString*)markerName
|
||||||
|
{
|
||||||
|
int oldPosition = [result length];
|
||||||
|
NSRange insertionRange = NSMakeRange(oldPosition,0);
|
||||||
|
|
||||||
|
if (!ignore)
|
||||||
|
{
|
||||||
|
GSHelpLinkAttachment* attachment;
|
||||||
|
RTFAttribute* attr = [self attr];
|
||||||
|
NSMutableDictionary* attributes = nil;
|
||||||
|
NSMutableAttributedString* str = nil;
|
||||||
|
|
||||||
|
attachment =
|
||||||
|
[[GSHelpLinkAttachment alloc]
|
||||||
|
initWithFileName: fileName
|
||||||
|
markerName: markerName];
|
||||||
|
if (attachment == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"No attachment at %d", oldPosition);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes = [[NSMutableDictionary alloc]
|
||||||
|
initWithObjectsAndKeys:
|
||||||
|
[attr currentFont], NSFontAttributeName,
|
||||||
|
attr->paragraph, NSParagraphStyleAttributeName,
|
||||||
|
nil];
|
||||||
|
|
||||||
|
str = (NSMutableAttributedString*) [NSMutableAttributedString
|
||||||
|
attributedStringWithAttachment: attachment];
|
||||||
|
|
||||||
|
[str addAttributes: attributes range: NSMakeRange (0, [str length])];
|
||||||
|
|
||||||
|
[result replaceCharactersInRange: insertionRange withAttributedString: str];
|
||||||
|
attr->changed = YES;
|
||||||
|
RELEASE(attributes);
|
||||||
|
RELEASE(attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) appendHelpMarker: (NSString*)markerName
|
||||||
|
{
|
||||||
|
int oldPosition = [result length];
|
||||||
|
NSRange insertionRange = NSMakeRange(oldPosition,0);
|
||||||
|
|
||||||
|
if (!ignore)
|
||||||
|
{
|
||||||
|
GSHelpMarkerAttachment* attachment;
|
||||||
|
RTFAttribute* attr = [self attr];
|
||||||
|
NSMutableDictionary* attributes = nil;
|
||||||
|
NSMutableAttributedString* str = nil;
|
||||||
|
|
||||||
|
attachment =
|
||||||
|
[[GSHelpMarkerAttachment alloc] initWithMarkerName: markerName];
|
||||||
|
if (attachment == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"No attachment at %d", oldPosition);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes = [[NSMutableDictionary alloc]
|
||||||
|
initWithObjectsAndKeys:
|
||||||
|
[attr currentFont], NSFontAttributeName,
|
||||||
|
attr->paragraph, NSParagraphStyleAttributeName,
|
||||||
|
nil];
|
||||||
|
|
||||||
|
str = (NSMutableAttributedString*) [NSMutableAttributedString
|
||||||
|
attributedStringWithAttachment: attachment];
|
||||||
|
|
||||||
|
[str addAttributes: attributes range: NSMakeRange (0, [str length])];
|
||||||
|
|
||||||
|
[result replaceCharactersInRange: insertionRange withAttributedString: str];
|
||||||
|
attr->changed = YES;
|
||||||
|
RELEASE(attributes);
|
||||||
|
RELEASE(attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#undef IGNORE
|
#undef IGNORE
|
||||||
|
@ -1162,3 +1243,34 @@ void GSRTFNeXTGraphic (void *ctxt, const char *fileName, int width, int height)
|
||||||
[(RTFDConsumer *)ctxt appendImage: [NSString stringWithCString: fileName]];
|
[(RTFDConsumer *)ctxt appendImage: [NSString stringWithCString: fileName]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSRTFNeXTHelpLink (void *ctxt, int num, const char *markername,
|
||||||
|
const char *linkFilename, const char *linkMarkername)
|
||||||
|
{
|
||||||
|
NSRange range;
|
||||||
|
NSString *fileName = [NSString stringWithCString: linkFilename];
|
||||||
|
NSString *markerName = [NSString stringWithCString: linkMarkername];
|
||||||
|
|
||||||
|
range = [fileName rangeOfString: @";"];
|
||||||
|
if (range.location != NSNotFound)
|
||||||
|
fileName = [fileName substringToIndex:range.location];
|
||||||
|
|
||||||
|
range = [markerName rangeOfString: @";"];
|
||||||
|
if (range.location == 0)
|
||||||
|
markerName = nil;
|
||||||
|
else if (range.location != NSNotFound)
|
||||||
|
markerName = [markerName substringToIndex:range.location];
|
||||||
|
|
||||||
|
[(RTFDConsumer *)ctxt appendHelpLink: fileName marker: markerName];
|
||||||
|
}
|
||||||
|
|
||||||
|
void GSRTFNeXTHelpMarker (void *ctxt, int num, const char *markername)
|
||||||
|
{
|
||||||
|
NSRange range;
|
||||||
|
NSString *markerName = [NSString stringWithCString: markername];
|
||||||
|
|
||||||
|
range = [markerName rangeOfString: @";"];
|
||||||
|
if (range.location != NSNotFound)
|
||||||
|
markerName = [markerName substringToIndex:range.location];
|
||||||
|
[(RTFDConsumer *)ctxt appendHelpMarker: markerName];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,11 @@ void GSRTFunderline(void *ctxt, BOOL on);
|
||||||
void GSRTFparagraph(void *ctxt);
|
void GSRTFparagraph(void *ctxt);
|
||||||
/* NeXTGraphic */
|
/* NeXTGraphic */
|
||||||
void GSRTFNeXTGraphic(void *ctxt, const char *fileName, int width, int height);
|
void GSRTFNeXTGraphic(void *ctxt, const char *fileName, int width, int height);
|
||||||
|
/* NeXTHelpLink */
|
||||||
|
void GSRTFNeXTHelpLink(void *ctxt, int num, const char *markername,
|
||||||
|
const char *linkFilename, const char *linkMarkername);
|
||||||
|
/* NeXTHelpMarker */
|
||||||
|
void GSRTFNeXTHelpMarker(void *ctxt, int num, const char *markername);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,10 @@
|
||||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
#include <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#include "RTFProducer.h"
|
#import <GNUstepGUI/GSHelpAttachment.h>
|
||||||
|
#import "RTFProducer.h"
|
||||||
|
|
||||||
// FIXME: Should be defined in a central place
|
// FIXME: Should be defined in a central place
|
||||||
#define PAPERSIZE @"PaperSize"
|
#define PAPERSIZE @"PaperSize"
|
||||||
|
@ -928,60 +929,93 @@
|
||||||
NSString *attachmentFilename;
|
NSString *attachmentFilename;
|
||||||
NSSize cellSize;
|
NSSize cellSize;
|
||||||
|
|
||||||
attachmentFileWrapper = [attachment fileWrapper];
|
if ([attachment isKindOfClass: [GSHelpLinkAttachment class]])
|
||||||
attachmentFilename = [attachmentFileWrapper filename];
|
{
|
||||||
if (! attachmentFilename)
|
GSHelpLinkAttachment *link =
|
||||||
{
|
(GSHelpLinkAttachment *)attachment;
|
||||||
attachmentFilename =
|
|
||||||
[attachmentFileWrapper preferredFilename];
|
|
||||||
|
|
||||||
if (! attachmentFilename)
|
[result appendString: @"{{\\NeXTHelpLink"];
|
||||||
{
|
[result appendString: @" \\markername "];
|
||||||
// If we do not have a proper filename, we set it here, incrementing
|
[result appendString: @";\\linkFilename "];
|
||||||
// the number of unnamed attachment so we do not overwrite existing ones.
|
[result appendString: [link fileName]];
|
||||||
|
[result appendString: @";\\linkMarkername "];
|
||||||
|
[result appendString: [link markerName]];
|
||||||
|
[result appendString: @";}"];
|
||||||
|
}
|
||||||
|
else if ([attachment
|
||||||
|
isKindOfClass: [GSHelpMarkerAttachment class]])
|
||||||
|
{
|
||||||
|
GSHelpMarkerAttachment *marker =
|
||||||
|
(GSHelpMarkerAttachment *)attachment;
|
||||||
|
|
||||||
// FIXME: setting the filename extension to tiff is not that great, but as
|
[result appendString: @"{{\\NeXTHelpMarker"];
|
||||||
// we anyway append \NeXTGraphic just after it makes sense... (without the
|
[result appendString: @" \\markername "];
|
||||||
// extension the file is not loaded)
|
[result appendString: [marker markerName]];
|
||||||
|
[result appendString: @";}"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attachmentFileWrapper = [attachment fileWrapper];
|
||||||
|
attachmentFilename = [attachmentFileWrapper filename];
|
||||||
|
if (! attachmentFilename)
|
||||||
|
{
|
||||||
|
attachmentFilename =
|
||||||
|
[attachmentFileWrapper preferredFilename];
|
||||||
|
|
||||||
attachmentFilename = [NSString stringWithFormat: @"__unnamed_file_%d.tiff",
|
if (! attachmentFilename)
|
||||||
unnamedAttachmentCounter++];
|
{
|
||||||
[attachmentFileWrapper setPreferredFilename:
|
// If we do not have a proper filename, we set it
|
||||||
attachmentFilename];
|
// here, incrementing the number of unnamed attachment
|
||||||
}
|
// so we do not overwrite existing ones.
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// FIXME: setting the filename extension to tiff
|
||||||
if ([attachmentFilename respondsToSelector:
|
// is not that great, but as we anyway append
|
||||||
@selector(fileSystemRepresentation)])
|
// \NeXTGraphic just after it makes sense... (without
|
||||||
{
|
// the extension the file is not loaded)
|
||||||
const char *fileSystemRepresentation;
|
|
||||||
|
|
||||||
fileSystemRepresentation =
|
attachmentFilename =
|
||||||
[attachmentFilename fileSystemRepresentation];
|
[NSString stringWithFormat:
|
||||||
|
@"__unnamed_file_%d.tiff",
|
||||||
|
unnamedAttachmentCounter++];
|
||||||
|
[attachmentFileWrapper
|
||||||
|
setPreferredFilename: attachmentFilename];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attachmentFilename = [self _encodedFilenameRepresentation:
|
/*
|
||||||
fileSystemRepresentation];
|
if ([attachmentFilename respondsToSelector:
|
||||||
}
|
@selector(fileSystemRepresentation)])
|
||||||
else
|
{
|
||||||
*/
|
const char *fileSystemRepresentation;
|
||||||
{
|
|
||||||
attachmentFilename =
|
|
||||||
[self _ASCIIfiedString: attachmentFilename];
|
|
||||||
}
|
|
||||||
|
|
||||||
cellSize = [[attachment attachmentCell] cellSize];
|
fileSystemRepresentation =
|
||||||
|
[attachmentFilename fileSystemRepresentation];
|
||||||
|
|
||||||
[result appendString: @"{{\\NeXTGraphic "];
|
attachmentFilename =
|
||||||
[result appendString: [attachmentFilename lastPathComponent]];
|
[self _encodedFilenameRepresentation:
|
||||||
[result appendFormat: @" \\width%d \\height%d}",
|
fileSystemRepresentation];
|
||||||
(short)points2twips(cellSize.width),
|
}
|
||||||
(short)points2twips(cellSize.height)];
|
else
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
attachmentFilename =
|
||||||
|
[self _ASCIIfiedString: attachmentFilename];
|
||||||
|
}
|
||||||
|
|
||||||
[attachmentFileWrapper setFilename: attachmentFilename];
|
cellSize = [[attachment attachmentCell] cellSize];
|
||||||
[attachmentFileWrapper setPreferredFilename: attachmentFilename];
|
|
||||||
if (attachmentFileWrapper)
|
[result appendString: @"{{\\NeXTGraphic "];
|
||||||
[attachments addObject: attachmentFileWrapper];
|
[result appendString: [attachmentFilename lastPathComponent]];
|
||||||
|
[result appendFormat: @" \\width%d \\height%d}",
|
||||||
|
(short)points2twips(cellSize.width),
|
||||||
|
(short)points2twips(cellSize.height)];
|
||||||
|
|
||||||
|
[attachmentFileWrapper setFilename: attachmentFilename];
|
||||||
|
[attachmentFileWrapper
|
||||||
|
setPreferredFilename: attachmentFilename];
|
||||||
|
if (attachmentFileWrapper)
|
||||||
|
[attachments addObject: attachmentFileWrapper];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -78,42 +78,48 @@
|
||||||
RTFNeXTGraphic = 294,
|
RTFNeXTGraphic = 294,
|
||||||
RTFNeXTGraphicWidth = 295,
|
RTFNeXTGraphicWidth = 295,
|
||||||
RTFNeXTGraphicHeight = 296,
|
RTFNeXTGraphicHeight = 296,
|
||||||
RTFpaperWidth = 297,
|
RTFNeXTHelpLink = 297,
|
||||||
RTFpaperHeight = 298,
|
RTFNeXTHelpMarker = 298,
|
||||||
RTFmarginLeft = 299,
|
RTFNeXTfilename = 299,
|
||||||
RTFmarginRight = 300,
|
RTFNeXTmarkername = 300,
|
||||||
RTFmarginTop = 301,
|
RTFNeXTlinkFilename = 301,
|
||||||
RTFmarginButtom = 302,
|
RTFNeXTlinkMarkername = 302,
|
||||||
RTFfirstLineIndent = 303,
|
RTFpaperWidth = 303,
|
||||||
RTFleftIndent = 304,
|
RTFpaperHeight = 304,
|
||||||
RTFrightIndent = 305,
|
RTFmarginLeft = 305,
|
||||||
RTFalignCenter = 306,
|
RTFmarginRight = 306,
|
||||||
RTFalignJustified = 307,
|
RTFmarginTop = 307,
|
||||||
RTFalignLeft = 308,
|
RTFmarginButtom = 308,
|
||||||
RTFalignRight = 309,
|
RTFfirstLineIndent = 309,
|
||||||
RTFlineSpace = 310,
|
RTFleftIndent = 310,
|
||||||
RTFspaceAbove = 311,
|
RTFrightIndent = 311,
|
||||||
RTFstyle = 312,
|
RTFalignCenter = 312,
|
||||||
RTFbold = 313,
|
RTFalignJustified = 313,
|
||||||
RTFitalic = 314,
|
RTFalignLeft = 314,
|
||||||
RTFunderline = 315,
|
RTFalignRight = 315,
|
||||||
RTFunderlineStop = 316,
|
RTFlineSpace = 316,
|
||||||
RTFunichar = 317,
|
RTFspaceAbove = 317,
|
||||||
RTFsubscript = 318,
|
RTFstyle = 318,
|
||||||
RTFsuperscript = 319,
|
RTFbold = 319,
|
||||||
RTFtabstop = 320,
|
RTFitalic = 320,
|
||||||
RTFfcharset = 321,
|
RTFunderline = 321,
|
||||||
RTFfprq = 322,
|
RTFunderlineStop = 322,
|
||||||
RTFcpg = 323,
|
RTFunichar = 323,
|
||||||
RTFOtherStatement = 324,
|
RTFsubscript = 324,
|
||||||
RTFfontListStart = 325,
|
RTFsuperscript = 325,
|
||||||
RTFfamilyNil = 326,
|
RTFtabstop = 326,
|
||||||
RTFfamilyRoman = 327,
|
RTFfcharset = 327,
|
||||||
RTFfamilySwiss = 328,
|
RTFfprq = 328,
|
||||||
RTFfamilyModern = 329,
|
RTFcpg = 329,
|
||||||
RTFfamilyScript = 330,
|
RTFOtherStatement = 330,
|
||||||
RTFfamilyDecor = 331,
|
RTFfontListStart = 331,
|
||||||
RTFfamilyTech = 332
|
RTFfamilyNil = 332,
|
||||||
|
RTFfamilyRoman = 333,
|
||||||
|
RTFfamilySwiss = 334,
|
||||||
|
RTFfamilyModern = 335,
|
||||||
|
RTFfamilyScript = 336,
|
||||||
|
RTFfamilyDecor = 337,
|
||||||
|
RTFfamilyTech = 338
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
|
@ -156,42 +162,48 @@
|
||||||
#define RTFNeXTGraphic 294
|
#define RTFNeXTGraphic 294
|
||||||
#define RTFNeXTGraphicWidth 295
|
#define RTFNeXTGraphicWidth 295
|
||||||
#define RTFNeXTGraphicHeight 296
|
#define RTFNeXTGraphicHeight 296
|
||||||
#define RTFpaperWidth 297
|
#define RTFNeXTHelpLink 297
|
||||||
#define RTFpaperHeight 298
|
#define RTFNeXTHelpMarker 298
|
||||||
#define RTFmarginLeft 299
|
#define RTFNeXTfilename 299
|
||||||
#define RTFmarginRight 300
|
#define RTFNeXTmarkername 300
|
||||||
#define RTFmarginTop 301
|
#define RTFNeXTlinkFilename 301
|
||||||
#define RTFmarginButtom 302
|
#define RTFNeXTlinkMarkername 302
|
||||||
#define RTFfirstLineIndent 303
|
#define RTFpaperWidth 303
|
||||||
#define RTFleftIndent 304
|
#define RTFpaperHeight 304
|
||||||
#define RTFrightIndent 305
|
#define RTFmarginLeft 305
|
||||||
#define RTFalignCenter 306
|
#define RTFmarginRight 306
|
||||||
#define RTFalignJustified 307
|
#define RTFmarginTop 307
|
||||||
#define RTFalignLeft 308
|
#define RTFmarginButtom 308
|
||||||
#define RTFalignRight 309
|
#define RTFfirstLineIndent 309
|
||||||
#define RTFlineSpace 310
|
#define RTFleftIndent 310
|
||||||
#define RTFspaceAbove 311
|
#define RTFrightIndent 311
|
||||||
#define RTFstyle 312
|
#define RTFalignCenter 312
|
||||||
#define RTFbold 313
|
#define RTFalignJustified 313
|
||||||
#define RTFitalic 314
|
#define RTFalignLeft 314
|
||||||
#define RTFunderline 315
|
#define RTFalignRight 315
|
||||||
#define RTFunderlineStop 316
|
#define RTFlineSpace 316
|
||||||
#define RTFunichar 317
|
#define RTFspaceAbove 317
|
||||||
#define RTFsubscript 318
|
#define RTFstyle 318
|
||||||
#define RTFsuperscript 319
|
#define RTFbold 319
|
||||||
#define RTFtabstop 320
|
#define RTFitalic 320
|
||||||
#define RTFfcharset 321
|
#define RTFunderline 321
|
||||||
#define RTFfprq 322
|
#define RTFunderlineStop 322
|
||||||
#define RTFcpg 323
|
#define RTFunichar 323
|
||||||
#define RTFOtherStatement 324
|
#define RTFsubscript 324
|
||||||
#define RTFfontListStart 325
|
#define RTFsuperscript 325
|
||||||
#define RTFfamilyNil 326
|
#define RTFtabstop 326
|
||||||
#define RTFfamilyRoman 327
|
#define RTFfcharset 327
|
||||||
#define RTFfamilySwiss 328
|
#define RTFfprq 328
|
||||||
#define RTFfamilyModern 329
|
#define RTFcpg 329
|
||||||
#define RTFfamilyScript 330
|
#define RTFOtherStatement 330
|
||||||
#define RTFfamilyDecor 331
|
#define RTFfontListStart 331
|
||||||
#define RTFfamilyTech 332
|
#define RTFfamilyNil 332
|
||||||
|
#define RTFfamilyRoman 333
|
||||||
|
#define RTFfamilySwiss 334
|
||||||
|
#define RTFfamilyModern 335
|
||||||
|
#define RTFfamilyScript 336
|
||||||
|
#define RTFfamilyDecor 337
|
||||||
|
#define RTFfamilyTech 338
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,7 +217,7 @@ typedef union YYSTYPE
|
||||||
RTFcmd cmd;
|
RTFcmd cmd;
|
||||||
}
|
}
|
||||||
/* Line 1529 of yacc.c. */
|
/* Line 1529 of yacc.c. */
|
||||||
#line 209 "rtfGrammar.tab.h"
|
#line 221 "rtfGrammar.tab.h"
|
||||||
YYSTYPE;
|
YYSTYPE;
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
|
|
|
@ -399,7 +399,10 @@ rtfNeXTGraphic: '{' RTFNeXTGraphic RTFtext RTFNeXTGraphicWidth RTFNeXTGraphicHei
|
||||||
other commands.
|
other commands.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtfNeXTHelpLink: '{' RTFNeXTHelpLink RTFNeXTmarkername RTFtext RTFNeXTlinkFilename RTFtext RTFNeXTlinkMarkername RTFtext '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); };
|
rtfNeXTHelpLink: '{' RTFNeXTHelpLink RTFNeXTmarkername RTFtext RTFNeXTlinkFilename RTFtext RTFNeXTlinkMarkername RTFtext '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); }
|
||||||
|
{
|
||||||
|
GSRTFNeXTHelpLink (CTXT, $2.parameter, $4, $6, $8);
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NeXTHelpMarker
|
NeXTHelpMarker
|
||||||
|
@ -410,7 +413,10 @@ rtfNeXTHelpLink: '{' RTFNeXTHelpLink RTFNeXTmarkername RTFtext RTFNeXTlinkFilena
|
||||||
other commands.
|
other commands.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtfNeXTHelpMarker: '{' RTFNeXTHelpMarker RTFNeXTmarkername RTFtext '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); };
|
rtfNeXTHelpMarker: '{' RTFNeXTHelpMarker RTFNeXTmarkername RTFtext '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); }
|
||||||
|
{
|
||||||
|
GSRTFNeXTHelpMarker (CTXT, $2.parameter, $4);
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Font description
|
Font description
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue