This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
forked from jjgod/TextEditPlus
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDocument.h
118 lines (93 loc) · 4.65 KB
/
Document.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#import <Cocoa/Cocoa.h>
@interface Document : NSDocument {
// Book-keeping
BOOL uniqueZone; /* YES if the zone was created specially for this document */
BOOL setUpPrintInfoDefaults; /* YES the first time -printInfo is called */
// Document data
NSTextStorage *textStorage; /* The (styled) text content of the document */
CGFloat scaleFactor; /* The scale factor retreived from file */
BOOL isReadOnly; /* The document is locked and should not be modified */
NSColor *backgroundColor; /* The color of the document's background */
CGFloat hyphenationFactor; /* Hyphenation factor in range 0.0-1.0 */
NSSize viewSize; /* The view size, as stored in an RTF document. Can be NSZeroSize */
BOOL hasMultiplePages; /* Whether the document prefers a paged display */
// The next seven are document properties (applicable only to rich text documents)
NSString *author; /* Corresponds to NSAuthorDocumentAttribute */
NSString *copyright; /* Corresponds to NSCopyrightDocumentAttribute */
NSString *company; /* Corresponds to NSCompanyDocumentAttribute */
NSString *title; /* Corresponds to NSTitleDocumentAttribute */
NSString *subject; /* Corresponds to NSSubjectDocumentAttribute */
NSString *comment; /* Corresponds to NSCommentDocumentAttribute */
NSArray *keywords; /* Corresponds to NSKeywordsDocumentAttribute */
// Information about how the document was created
BOOL openedIgnoringRichText; /* Setting at the the time the doc was open (so revert does the same thing) */
NSStringEncoding documentEncoding; /* NSStringEncoding used to interpret / save the document */
BOOL convertedDocument; /* Converted (or filtered) from some other format (and hence not writable) */
BOOL lossyDocument; /* Loaded lossily, so might not be a good idea to overwrite */
BOOL transient; /* Untitled document automatically opened and never modified */
NSURL *defaultDestination; /* A hint as to where save dialog should default, used if -fileURL is nil */
// Temporary information about how to save the document
NSStringEncoding documentEncodingForSaving; /* NSStringEncoding for saving the document */
}
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName encoding:(NSStringEncoding)encoding ignoreRTF:(BOOL)ignoreRTF ignoreHTML:(BOOL)ignoreHTML error:(NSError **)outError;
/* Is the document rich? */
- (BOOL)isRichText;
- (void)setRichText:(BOOL)flag;
/* Is the document read-only? */
- (BOOL)isReadOnly;
- (void)setReadOnly:(BOOL)flag;
/* Document background color */
- (NSColor *)backgroundColor;
- (void)setBackgroundColor:(NSColor *)color;
/* The encoding of the document... */
- (NSUInteger)encoding;
- (void)setEncoding:(NSUInteger)encoding;
/* Encoding of the document chosen when saving */
- (NSUInteger)encodingForSaving;
- (void)setEncodingForSaving:(NSUInteger)encoding;
/* Whether document was converted from some other format (filter services) */
- (BOOL)isConverted;
- (void)setConverted:(BOOL)flag;
/* Whether document was opened ignoring rich text */
- (BOOL)isOpenedIgnoringRichText;
- (void)setOpenedIgnoringRichText:(BOOL)flag;
/* Whether document was loaded lossily */
- (BOOL)isLossy;
- (void)setLossy:(BOOL)flag;
/* Hyphenation factor (0.0-1.0, 0.0 == disabled) */
- (float)hyphenationFactor;
- (void)setHyphenationFactor:(float)factor;
/* View size (as it should be saved in a RTF file) */
- (NSSize)viewSize;
- (void)setViewSize:(NSSize)newSize;
/* Scale factor; 1.0 is 100% */
- (CGFloat)scaleFactor;
- (void)setScaleFactor:(CGFloat)scaleFactor;
/* Attributes */
- (NSTextStorage *)textStorage;
- (void)setTextStorage:(id)ts; // This will _copy_ the contents of the NS[Attributed]String ts into the document's textStorage.
/* Page-oriented methods */
- (void)setHasMultiplePages:(BOOL)flag;
- (BOOL)hasMultiplePages;
- (NSSize)paperSize;
- (void)setPaperSize:(NSSize)size;
/* Action methods */
- (IBAction)toggleReadOnly:(id)sender;
- (IBAction)togglePageBreaks:(id)sender;
- (IBAction)saveDocumentAsPDFTo:(id)sender;
/* Whether conversion to rich/plain be done without loss of information */
- (BOOL)toggleRichWillLoseInformation;
/* Default text attributes for plain or rich text formats */
- (NSDictionary *)defaultTextAttributes:(BOOL)forRichText;
- (void)applyDefaultTextAttributes:(BOOL)forRichText;
/* Document properties */
- (NSDictionary *)documentPropertyToAttributeNameMappings;
- (NSArray *)knownDocumentProperties;
- (void)clearDocumentProperties;
- (void)setDocumentPropertiesToDefaults;
- (BOOL)hasDocumentProperties;
/* Transient documents */
- (BOOL)isTransient;
- (void)setTransient:(BOOL)flag;
- (BOOL)isTransientAndCanBeReplaced;
@end