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
|
/*
* Copyright (C) 2004 Stefan Kleine Stegemann
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "Document.h"
#import <AppKit/NSView.h>
// Notifications to be issued by PDFContentViews
//
/** Each time a PDFContentView changes it's zoom factor. */
extern NSString* kZoomFactorChangedNotification;
/** Possible resize policies for live resizing. */
typedef enum {
ResizePolicyNone,
ResizePolicyFitPage,
ResizePolicyFitWidth,
ResizePolicyFitHeight
} ResizePolicy;
/**
* The PDFContentView defines the interface for views which are able
* to display PDF content. The controller of a PDF document only sees
* PDFContentView's.
*/
@protocol PDFContentView
/** Set the document to be displayed in the view. As a result, the
view should display the current page of the document. */
- (void) setDocument: (Document*)aDocument;
/** Get the view's preferred size. This size should be determined such
that as much of the content as possible is visible. The preferred size
can change over time depending on various factors, like zoom or the
size of the current page. */
- (NSSize) preferredSize;
/** Set the paper color. This is the color that has to be used for the
content background. A view may decide to ignore a custom paper color.
Each view must maintain an initial paper color, it cannot assume that
the color is set from outside. */
- (void) setPaperColor: (NSColor*)aColor;
/** Get the current paper color. A view must return a valid color. See
setPaperColor: for further details. */
- (NSColor*) paperColor;
/** Set the view's zoom factor in percent. The view is not required to
update itself. The caller has to ensure that the view is redisplayed
when appropriate. */
- (void) setZoom: (float)aFactor;
/** Increase the zoom factor. It is up to the view to decide about the
amount. */
- (void) zoomIn;
/** Decrease the zoom factor. It is up to the view to decide about
about the amount. */
- (void) zoomOut;
/** Get the view's current zoom factor in percent. */
- (float) zoom;
/** Zoom the view's contents to fit the given size. If the view cannot
zoom, do nothing and simply return the aSize. Otherwise, the view
should zoom it's contents and return the content's size after zooming.
This size may be smaller than the given size but it must not be
larger. */
- (NSSize) zoomContentToFit: (NSSize)aSize;
/** Set the resize policy for this view. If the view supports the policy,
it has to adjust it's zoom factor each time the window that hosts the
view is resized. */
- (void) setResizePolicy: (ResizePolicy)aPolicy;
/** Get the current resize policy for this view. Views which do not support
auto resizing can return ResizePolicyNone. */
- (ResizePolicy) resizePolicy;
/** Scroll up by the amount of a "page". */
- (void) scrollUpOnePage;
/** Scroll down by the amount of a "page". */
- (void) scrollDownOnePage;
/** Scroll up by the amount of a "line". */
- (void) scrollUpOneLine;
/** Scroll down by the amount of a "line". */
- (void) scrollDownOneLine;
/** Scroll left by the amount of a "line". */
- (void) scrollLeftOneLine;
/** Scroll right by the amount of a "line". */
- (void) scrollRightOneLine;
/** Ensure that the top of the content is visible. The receiver has
to update it's scrolling state such that the enclosing scrollview
shows the beginning of the content. */
- (void) displayContentTop;
/** Ensure that the bottom of the content is visible. The receiver has
to update it's scrolling state such that the enclosing scrollview
shows the bottom of the content. */
- (void) displayContentBottom;
/** Ensure that the left side of the content is visible. The receiver
has to update it's scrolling state such that the encolsing scrollview
shows the leftmost part of the content. */
- (void) displayContentLeft;
/** Ensure that the right side of the content is visible. The receiver
has to update it's scrolling state such that the encolsing scrollview
shows the rightmost part of the content. */
- (void) displayContentRight;
/** Redisplay the content's with the document's current state. */
- (void) update;
@end
|