-
Notifications
You must be signed in to change notification settings - Fork 94
/
CHMDocument.h
151 lines (119 loc) · 3.73 KB
/
CHMDocument.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//
// CHMDocument.h
// ichm
//
// Created by Robin Lu on 7/16/08.
// Copyright __MyCompanyName__ 2008 . All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class WebView;
@class CHMTableOfContent;
@class CHMSearchResult;
@class LinkItem;
@class PSMTabBarControl;
@class CHMConsole;
struct chmFile;
@interface CHMDocument : NSDocument {
IBOutlet PSMTabBarControl *tabBar;
IBOutlet NSTabView *docTabView;
IBOutlet NSOutlineView *tocView;
IBOutlet NSWindow *documentWindow;
IBOutlet NSSegmentedControl *historyItemView;
IBOutlet NSButton *homeItemView;
IBOutlet NSSegmentedControl *textSizeItemView;
IBOutlet NSButton* sidebarItemView;
IBOutlet NSSearchField *searchItemView;
IBOutlet NSSplitView *splitView;
IBOutlet NSMenuItem *textEncodingMenu;
IBOutlet NSPanel *addBookmarkPanel;
IBOutlet NSMenu *sidebarViewMenu;
IBOutlet NSWindow *exportProgressSheet;
IBOutlet NSProgressIndicator *exportProgressIndicator;
IBOutlet NSTextField *exportNoticeLabel;
struct chmFile *chmFileHandle;
NSString *filePath;
NSString *docTitle;
NSString *homePath;
NSString *tocPath;
NSString *indexPath;
CHMTableOfContent *tocSource ;
CHMTableOfContent *indexSource ;
CHMSearchResult *searchSource;
SKIndexRef skIndex;
NSMutableData *searchIndexObject;
BOOL isIndexDone;
NSCondition *searchIndexCondition;
BOOL isSidebarRestored;
NSMutableArray *webViews;
WebView *curWebView;
CHMConsole *console;
int customizedEncodingTag;
NSString* encodingName;
}
@property (readonly) NSString* filePath;
@property (readonly) NSString* docTitle;
- (NSString*)currentURL;
- (NSString*)currentTitle;
- (NSURL*)composeURL:(NSString *)path;
- (BOOL) exist: (NSString *)path;
- (NSData *)content: (NSString *)path;
- (BOOL)loadMetadata;
- (NSString *)findHomeForPath: (NSString *)basePath;
- (void)highlightString:(NSString*)pattern;
- (void)removeHighlight;
- (void)buildSearchIndex;
- (void)loadURL:(NSURL *)url;
- (IBAction)changeTopic:(id)sender;
- (IBAction)openInNewTab:(id)sender;
- (IBAction)goForward:(id)sender;
- (IBAction)goBack:(id)sender;
- (IBAction)goHistory:(id)sender;
- (IBAction)goHome:(id)sender;
- (IBAction)gotoNextPage:(id)sender;
- (IBAction)gotoPrevPage:(id)sender;
- (IBAction)locateTOC:(id)sender;
// file preferences
- (void)setPreference:(id)object forFile:(NSString*)filename withKey:(NSString*)key;
- (id)getPreferenceforFile:(NSString*)filename withKey:(NSString*)key;
// dump to pdf
- (IBAction)exportToPDF:(id)sender;
- (IBAction)showExportProgressSheet:(id)sender;
- (IBAction)endExportProgressSheet:(id)sender;
- (void)exportedProgressRate:(double)rate PageCount:(int)count;
// search
- (IBAction)setSearchInFile:(id)sender;
- (IBAction)setSearchInIndex:(id)sender;
- (IBAction)searchInFile:(id)sender;
- (IBAction)searchInIndex:(id)sender;
- (IBAction)focusOnSearch:(id)sender;
// sidebar view
- (IBAction)popViewMenu:(id)sender;
- (IBAction)changeToContentsView:(id)sender;
- (IBAction)changeToIndexView:(id)sender;
- (void)resetViewMenuState:(NSMenuItem*)sender;
- (void)resetSidebarView;
- (IBAction)zoom:(id)sender;
- (IBAction)zoomIn:(id)sender;
- (IBAction)zoomOut:(id)sender;
- (IBAction)toggleSidebar:(id)sender;
- (IBAction)hideSidebar:(id)sender;
- (void)addToSearchIndex:(const char*)path;
// find panel
- (IBAction)showFindPanel:(id)sender;
- (IBAction)beginFind:(id)sender;
- (IBAction)findNext:(id)sender;
- (IBAction)findPrev:(id)sender;
- (IBAction)findInFile:(id)sender;
- (IBAction)doneFind:(id)sender;
// bookmark
- (IBAction)showAddBookmark:(id)sender;
// tab
- (IBAction)addNewTab:(id)sender;
- (IBAction)closeTab:(id)sender;
//text encoding
- (void)setupEncodingMenu;
- (void)resetEncodingMenu;
- (IBAction)changeEncoding:(id)sender;
- (NSString*)getEncodingByTag:(int)tag;
- (NSString*)currentEncodingName;
@end