1/*
2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#import <PDFKit/PDFKit.h>
27
28@class CPReadingModel;
29
30@protocol PDFLayerControllerDelegate <NSObject>
31
32- (void)updateScrollPosition:(CGPoint)newPosition;
33- (void)writeItemsToPasteboard:(NSArray *)items withTypes:(NSArray *)types;
34- (void)showDefinitionForAttributedString:(NSAttributedString *)string atPoint:(CGPoint)point;
35- (void)performWebSearch:(NSString *)string;
36- (void)performSpotlightSearch:(NSString *)string;
37- (void)openWithNativeApplication;
38- (void)saveToPDF;
39
40- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeActiveAnnotation:(PDFAnnotation *)annotation;
41- (void)pdfLayerController:(PDFLayerController *)pdfLayerController clickedLinkWithURL:(NSURL *)url;
42- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeContentScaleFactor:(CGFloat)scaleFactor;
43- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeDisplayMode:(int)mode;
44- (void)pdfLayerController:(PDFLayerController *)pdfLayerController didChangeSelection:(PDFSelection *)selection;
45
46@end
47
48@interface PDFLayerController : NSObject
49@end
50
51@interface PDFLayerController (Details)
52
53@property(retain) CALayer *parentLayer;
54@property(retain) PDFDocument *document;
55@property(retain) id<PDFLayerControllerDelegate> delegate;
56
57- (void)setFrameSize:(CGSize)size;
58
59- (PDFDisplayMode)displayMode;
60- (void)setDisplayMode:(PDFDisplayMode)mode;
61- (void)setDisplaysPageBreaks:(BOOL)pageBreaks;
62
63- (CGFloat)contentScaleFactor;
64- (void)setContentScaleFactor:(CGFloat)scaleFactor;
65
66- (CGFloat)deviceScaleFactor;
67- (void)setDeviceScaleFactor:(CGFloat)scaleFactor;
68
69- (CGSize)contentSize;
70- (CGSize)contentSizeRespectingZoom;
71
72- (void)snapshotInContext:(CGContextRef)context;
73
74- (void)magnifyWithMagnification:(CGFloat)magnification atPoint:(CGPoint)point immediately:(BOOL)immediately;
75
76- (CGPoint)scrollPosition;
77- (void)setScrollPosition:(CGPoint)newPosition;
78- (void)scrollWithDelta:(CGSize)delta;
79
80- (void)mouseDown:(NSEvent *)event;
81- (void)rightMouseDown:(NSEvent *)event;
82- (void)mouseMoved:(NSEvent *)event;
83- (void)mouseUp:(NSEvent *)event;
84- (void)mouseDragged:(NSEvent *)event;
85- (void)mouseEntered:(NSEvent *)event;
86- (void)mouseExited:(NSEvent *)event;
87
88- (NSMenu *)menuForEvent:(NSEvent *)event;
89
90- (NSArray *)findString:(NSString *)string caseSensitive:(BOOL)isCaseSensitive highlightMatches:(BOOL)shouldHighlightMatches;
91
92- (PDFSelection *)currentSelection;
93- (void)setCurrentSelection:(PDFSelection *)selection;
94- (PDFSelection *)searchSelection;
95- (void)setSearchSelection:(PDFSelection *)selection;
96- (void)gotoSelection:(PDFSelection *)selection;
97- (PDFSelection *)getSelectionForWordAtPoint:(CGPoint)point;
98
99- (NSUInteger)lastPageIndex;
100- (NSUInteger)currentPageIndex;
101- (void)gotoNextPage;
102- (void)gotoPreviousPage;
103
104- (void)copySelection;
105- (void)selectAll;
106
107- (bool)keyDown:(NSEvent *)event;
108
109- (void)setHUDEnabled:(BOOL)enabled;
110- (BOOL)hudEnabled;
111
112- (CGRect)boundsForAnnotation:(PDFAnnotation *)annotation;
113- (void)activateNextAnnotation:(BOOL)previous;
114
115- (void)attemptToUnlockWithPassword:(NSString *)password;
116
117- (void)searchInDictionaryWithSelection:(PDFSelection *)selection;
118
119// Accessibility
120
121- (CPReadingModel *)readingModel;
122- (id)accessibilityFocusedUIElement;
123- (NSArray *)accessibilityAttributeNames;
124- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute;
125- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute;
126- (NSArray *)accessibilityParameterizedAttributeNames;
127- (NSString *)accessibilityRoleAttribute;
128- (NSString *)accessibilityRoleDescriptionAttribute;
129- (NSString *)accessibilityValueAttribute;
130- (BOOL)accessibilityIsValueAttributeSettable;
131- (NSString *)accessibilitySelectedTextAttribute;
132- (BOOL)accessibilityIsSelectedTextAttributeSettable;
133- (NSValue *)accessibilitySelectedTextRangeAttribute;
134- (NSNumber *)accessibilityNumberOfCharactersAttribute;
135- (BOOL)accessibilityIsNumberOfCharactersAttributeSettable;
136- (NSValue *)accessibilityVisibleCharacterRangeAttribute;
137- (BOOL)accessibilityIsVisibleCharacterRangeAttributeSettable;
138- (NSNumber *)accessibilityLineForIndexAttributeForParameter:(id)parameter;
139- (NSValue *)accessibilityRangeForLineAttributeForParameter:(id)parameter;
140- (NSString *)accessibilityStringForRangeAttributeForParameter:(id)parameter;
141- (NSValue *)accessibilityBoundsForRangeAttributeForParameter:(id)parameter;
142
143@end
144