-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathUXReaderDocument.h
More file actions
136 lines (92 loc) · 4.14 KB
/
UXReaderDocument.h
File metadata and controls
136 lines (92 loc) · 4.14 KB
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
//
// UXReaderDocument.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//
#import <UIKit/UIKit.h>
@class UXReaderDocument;
@class UXReaderDocumentPage;
@class UXReaderCanceller;
@class UXReaderSelection;
@class UXReaderOutline;
typedef NS_ENUM(NSUInteger, UXReaderSearchOptions)
{
UXReaderCaseSensitiveSearchOption = 1,
UXReaderCaseInsensitiveSearchOption = 0,
UXReaderMatchWholeWordSearchOption = 2
};
@protocol UXReaderDocumentSearchDelegate <NSObject>
@optional // Delegate protocols
- (void)document:(nonnull UXReaderDocument *)document didBeginDocumentSearch:(NSUInteger)kind;
- (void)document:(nonnull UXReaderDocument *)document didFinishDocumentSearch:(NSUInteger)total;
- (void)document:(nonnull UXReaderDocument *)document didBeginPageSearch:(NSUInteger)page pages:(NSUInteger)pages;
- (void)document:(nonnull UXReaderDocument *)document didFinishPageSearch:(NSUInteger)page total:(NSUInteger)total;
@required // Delegate protocols
- (void)document:(nonnull UXReaderDocument *)document searchDidMatch:(nonnull NSArray<UXReaderSelection *> *)selections page:(NSUInteger)page;
@end
@protocol UXReaderDocumentDataSource <NSObject>
@required // Data source protocols
- (BOOL)document:(nonnull UXReaderDocument *)document dataLength:(nonnull size_t *)length;
- (BOOL)document:(nonnull UXReaderDocument *)document offset:(size_t)offset length:(size_t)length buffer:(nonnull uint8_t *)buffer;
- (BOOL)document:(nonnull UXReaderDocument *)document UUID:(NSUUID * _Nullable * _Nullable)uuid;
@end
@protocol UXReaderRenderTileInContext <NSObject>
@required // Tile render protocol
- (void)documentPage:(nonnull UXReaderDocumentPage *)documentPage renderTileInContext:(nonnull CGContextRef)context;
@end
@interface UXReaderDocument : NSObject <NSObject>
@property (nullable, weak, nonatomic, readwrite) id <UXReaderDocumentSearchDelegate> search;
- (nullable instancetype)initWithURL:(nonnull NSURL *)URL;
- (nullable instancetype)initWithData:(nonnull NSData *)data;
- (nullable instancetype)initWithSource:(nonnull id <UXReaderDocumentDataSource>)source;
- (void)close;
- (nullable NSURL *)URL;
- (nullable NSData *)data;
- (void)setUUID:(nonnull NSUUID *)UUID;
- (nonnull NSUUID *)UUID;
- (void)setTitle:(nonnull NSString *)text;
- (nullable NSString *)title;
- (void)setShowRTL:(BOOL)RTL;
- (BOOL)showRTL;
- (void)setHighlightLinks:(BOOL)RTL;
- (BOOL)highlightLinks;
- (void)setRenderTile:(nullable id <UXReaderRenderTileInContext>)renderTile;
- (nullable id <UXReaderRenderTileInContext>)renderTile;
- (void)setUseNativeRendering;
- (uint32_t)permissions;
- (nullable NSString *)fileVersion;
- (BOOL)isSameDocument:(nonnull UXReaderDocument *)document;
- (void)openWithPassword:(nullable NSString *)password completion:(nonnull void (^)(NSError *_Nullable error))handler;
- (BOOL)isOpen;
- (nullable void *)pdfDocumentCG;
- (nullable void *)pdfDocumentFP;
- (NSUInteger)pageCount;
- (CGSize)pageSize:(NSUInteger)page;
- (nullable UXReaderDocumentPage *)documentPage:(NSUInteger)page;
- (nullable NSString *)pageLabel:(NSUInteger)page;
- (BOOL)isSearching;
- (void)cancelSearch;
- (void)beginSearch:(nonnull NSString *)text options:(UXReaderSearchOptions)options;
- (void)setSearchSelections:(nullable NSDictionary<NSNumber *, NSArray<UXReaderSelection *> *> *)selections;
- (nullable NSDictionary<NSNumber *, NSArray<UXReaderSelection *> *> *)searchSelections;
- (void)thumbForPage:(NSUInteger)page size:(CGSize)size canceller:(nonnull UXReaderCanceller *)canceller completion:(nonnull void (^)(UIImage *_Nonnull thumb))handler;
- (nullable NSDictionary<NSString *, NSString *> *)information;
- (nullable NSArray<UXReaderOutline *> *)outline;
@end
typedef NS_OPTIONS(NSUInteger, UXReaderDocumentPermission)
{
UXReaderDocumentPermissionCopy = (1 << 5),
UXReaderDocumentPermissionModify = (1 << 4),
UXReaderDocumentPermissionPrint = (1 << 3)
};
typedef NS_ENUM(NSUInteger, UXReaderDocumentError)
{
UXReaderDocumentErrorSuccess = 0,
UXReaderDocumentErrorUnknown = 1,
UXReaderDocumentErrorFile = 2,
UXReaderDocumentErrorFormat = 3,
UXReaderDocumentErrorPassword = 4,
UXReaderDocumentErrorSecurity = 5,
UXReaderDocumentErrorPage = 6
};