Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions UXReader.framework/Headers/UXReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// UXReader.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for UXReader.
FOUNDATION_EXPORT double UXReaderVersionNumber;

//! Project version string for UXReader.
FOUNDATION_EXPORT const unsigned char UXReaderVersionString[];

#import <UXReader/UXReaderDocument.h>
#import <UXReader/UXReaderDocumentPage.h>
#import <UXReader/UXReaderViewController.h>
#import <UXReader/UXReaderCanceller.h>
#import <UXReader/UXReaderSelection.h>
#import <UXReader/UXReaderOutline.h>
#import <UXReader/UXReaderDestination.h>
#import <UXReader/UXReaderAction.h>
#import <UXReader/UXReaderWatermark.h>
44 changes: 44 additions & 0 deletions UXReader.framework/Headers/UXReaderAction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// UXReaderAction.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

@class UXReaderDestination;

typedef NS_ENUM(NSUInteger, UXReaderActionType)
{
UXReaderActionTypeNone, UXReaderActionTypeURI, UXReaderActionTypeGoto,
UXReaderActionTypeRemoteGoto, UXReaderActionTypeLaunch, UXReaderActionTypeLink
};

@interface UXReaderAction : NSObject <NSObject>

- (nullable instancetype)initWithURI:(nonnull NSString *)URI rectangle:(CGRect)rect;

- (nullable instancetype)initWithGoto:(nonnull UXReaderDestination *)destination rectangle:(CGRect)rect;

- (nullable instancetype)initWithRemoteGoto:(nonnull UXReaderDestination *)destination path:(nonnull NSString *)path rectangle:(CGRect)rect;

- (nullable instancetype)initWithLaunch:(nonnull NSString *)path rectangle:(CGRect)rect;

- (nullable instancetype)initWithLink:(nonnull NSString *)URI rectangles:(nonnull NSArray<NSValue *> *)rectangles;

- (BOOL)containsPoint:(CGPoint)point;

- (UXReaderActionType)type;

- (nullable NSString *)URI;

- (nullable NSString *)path;

- (nullable UXReaderDestination *)destination;

- (nullable NSArray<NSValue *> *)rectangles;

- (CGRect)rectangle;

@end
24 changes: 24 additions & 0 deletions UXReader.framework/Headers/UXReaderCanceller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// UXReaderCanceller.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UXReaderCanceller : NSObject <NSObject>

- (nullable instancetype)initWithLock;

- (nullable instancetype)initWithUUID;

- (void)cancel;

- (BOOL)isCancelled;

- (nonnull NSLock *)lock;

- (nonnull NSUUID *)UUID;

@end
24 changes: 24 additions & 0 deletions UXReader.framework/Headers/UXReaderDestination.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// UXReaderDestination.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef struct UXReaderDestinationTarget
{
BOOL hasX, hasY, hasZoom; CGFloat pageX, pageY, zoom;

} UXReaderDestinationTarget;

@interface UXReaderDestination : NSObject <NSObject>

- (nullable instancetype)initWithPage:(NSUInteger)page target:(UXReaderDestinationTarget)target;

- (NSUInteger)page;

- (UXReaderDestinationTarget)target;

@end
136 changes: 136 additions & 0 deletions UXReader.framework/Headers/UXReaderDocument.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
};
57 changes: 57 additions & 0 deletions UXReader.framework/Headers/UXReaderDocumentPage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// UXReaderDocumentPage.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

@class UXReaderDocument;
@class UXReaderCanceller;
@class UXReaderSelection;
@class UXReaderAction;

@interface UXReaderDocumentPage : NSObject <NSObject>

- (nullable instancetype)initWithDocument:(nonnull UXReaderDocument *)document page:(NSUInteger)page;

- (nonnull UXReaderDocument *)document;

- (nullable void *)pdfPageCG;
- (nullable void *)pdfPageFP;

- (nullable void *)textPage;

- (NSUInteger)page;
- (NSUInteger)rotation;
- (CGSize)pageSize;

- (CGRect)convertToPageFromViewRect:(CGRect)rect;
- (CGPoint)convertToPageFromViewPoint:(CGPoint)point;
- (CGRect)convertFromPageX1:(CGFloat)x1 Y1:(CGFloat)y1 X2:(CGFloat)x2 Y2:(CGFloat)y2;

- (void)renderTileInContext:(nonnull CGContextRef)context;

- (void)thumbWithSize:(CGSize)size canceller:(nonnull UXReaderCanceller *)canceller completion:(nonnull void (^)(UIImage *_Nonnull thumb))handler;

- (void)setSearchSelections:(nullable NSArray<UXReaderSelection *> *)selections;
- (nullable NSArray<UXReaderSelection *> *)searchSelections;

- (nullable UXReaderAction *)linkAction:(CGPoint)point;
- (nullable UXReaderAction *)textAction:(CGPoint)point;

- (BOOL)extractPageLinks;
- (BOOL)extractPageURLs;

- (NSUInteger)unicharCount;
- (nullable NSString *)text;
- (nullable NSString *)textAtIndex:(NSUInteger)index count:(NSUInteger)count;
- (unichar)unicharAtIndex:(NSUInteger)index;
- (CGFloat)unicharFontSizeAtIndex:(NSUInteger)index;
- (CGRect)unicharRectangleAtIndex:(NSUInteger)index;
- (NSUInteger)unicharIndexAtPoint:(CGPoint)point tolerance:(CGSize)size;
- (nonnull NSArray<NSValue *> *)rectanglesForTextAtIndex:(NSUInteger)index count:(NSUInteger)count;
- (nullable NSString *)textInRectangle:(CGRect)rectangle;

@end
22 changes: 22 additions & 0 deletions UXReader.framework/Headers/UXReaderOutline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// UXReaderOutline.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

@class UXReaderAction;

@interface UXReaderOutline : NSObject <NSObject>

- (nullable instancetype)initWithName:(nonnull NSString *)name action:(nonnull UXReaderAction *)action level:(NSUInteger)level;

- (nonnull NSString *)name;

- (nonnull UXReaderAction *)action;

- (NSUInteger)level;

@end
24 changes: 24 additions & 0 deletions UXReader.framework/Headers/UXReaderSelection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// UXReaderSelection.h
// UXReader Framework v0.1
//
// Copyright © 2017-2019 Julius Oklamcak. All rights reserved.
//

#import <UIKit/UIKit.h>

@class UXReaderDocument;

@interface UXReaderSelection : NSObject <NSObject>

+ (nullable instancetype)document:(nonnull UXReaderDocument *)document page:(NSUInteger)page index:(NSUInteger)index count:(NSUInteger)count rectangles:(nonnull NSArray<NSValue *> *)rectangles;

- (NSUInteger)page;

- (nullable NSArray<NSValue *> *)rectangles;
- (CGRect)rectangle;

- (void)setHighlight:(BOOL)state;
- (BOOL)isHighlighted;

@end
Loading