123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- //
- // CPDFListView.h
- // ComPDFKit
- //
- // Copyright © 2014-2022 PDF Technologies, Inc. All Rights Reserved.
- //
- // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
- // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
- // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
- // This notice may not be removed from this file.
- //
- #import <ComPDFKit/ComPDFKit.h>
- #import <Foundation/Foundation.h>
- #import <QuartzCore/QuartzCore.h>
- extern NSNotificationName const CPDFListViewSelectionChangedNotification;
- extern NSNotificationName const CPDFListViewToolModeChangeNotification;
- extern NSNotificationName const CPDFListViewAnnotationTypeChangeNotification;
- extern NSNotificationName const CPDFListViewMagnificationChangedNotification;
- extern NSNotificationName const CPDFListViewDidAddAnnotationNotification;
- extern NSNotificationName const CPDFListViewDidRemoveAnnotationNotification;
- extern NSNotificationName const CPDFListViewActiveAnnotationsChangeNotification;
- extern NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotification;
- typedef NS_ENUM(NSInteger, CPDFViewSidebarSpeedMode) {
- CPDFViewSidebarSpeedModeLeft = 0,
- CPDFViewSidebarSpeedModeRight
- };
- typedef NS_ENUM(NSInteger, CAnnotationType) {
- CAnnotationTypeUnkown = 0,
- CAnnotationTypeAnchored,
- CAnnotationTypeLink,
- CAnnotationTypeFreeText,
- CAnnotationTypeLine,
- CAnnotationTypeArrow,
- CAnnotationTypeSquare,
- CAnnotationTypeCircle,
- /*CAnnotationTypePolyGon,*/
- /*CAnnotationTypePolyLine,*/
- CAnnotationTypeHighlight,
- CAnnotationTypeUnderline,
- // CAnnotationTypeSquiggly,
- CAnnotationTypeStrikeOut,
- CAnnotationTypeStamp,
- CAnnotationTypeSignSignature,
- /*CAnnotationTypeCaret,*/
- CAnnotationTypeInk,
- /*CAnnotationTypePopUp,*/
- /*CAnnotationTypeFileattachment,*/
- /*CAnnotationTypeSound,*/
- /*CAnnotationTypeMovie,*/
- CAnnotationTypeRedact,
- CAnnotationTypeEraser,
- CAnnotationTypeAddText,
- CAnnotationTypeAddImage,
-
- CAnnotationTypeRadioButton = 100,
- CAnnotationTypeCheckBox,
- CAnnotationTypeTextField,
- CAnnotationTypeComboBox,
- CAnnotationTypeListMenu,
- CAnnotationTypeActionButton,
- CAnnotationTypeSignature,
-
- CAnnotationTypeSignText = 200,
- CAnnotationTypeSignFalse,
- CAnnotationTypeSignTure,
- CAnnotationTypeSignCircle,
- CAnnotationTypeSignLine,
- CAnnotationTypeSignDot,
- CAnnotationTypeSignConfig,
- CAnnotationTypeSignDate,
- };
- typedef NS_ENUM(NSInteger, CToolMode) {
- CTextToolMode = 0,
- CMoveToolMode,
- CMagnifyToolMode,
- CSelectToolMode,
- CNoteToolMode,
- CSelectZoomToolMode,
- CFormToolMode,
- CSelfSignMode,
- CRedactToolMode,
- CRedactErasureToolMode,
- CEditPDFToolMode,
- };
- @protocol CPDFListViewDelegate;
- @class CStampSignatureObject,CPDFListStampAnnotation,CPDFListSignatureAnnotation;
- @interface CPDFListView : CPDFView
- @property (nonatomic, weak) id<CPDFListViewDelegate>pdfListViewDelegate;
- // Methods for The currently selected Annotation.
- @property (nonatomic, readonly) NSMutableArray <CPDFAnnotation *>*activeAnnotations;
- // Methods for The currently selected Annotation.
- @property (nonatomic, readonly) CPDFAnnotation * activeAnnotation;
- // Methods for The annotation type currently selected.
- @property (nonatomic, assign) CAnnotationType annotationType;
- // Method of the currently selected annotation mode.
- @property (nonatomic, assign) CToolMode toolMode;
- // The magnification times when the current magnifying glass is in mode
- @property (nonatomic, readonly) CGFloat magnification;
- @property (nonatomic, assign) BOOL isSetLinkDestinationArea;
- // Show Annotation or not
- @property (nonatomic, assign) BOOL hideNotes;
- // Whether to display a Form comment hop number
- @property (nonatomic, assign) BOOL showHopnumber;
- // Whether to display the Form name
- @property (nonatomic, assign) BOOL showFormFieldName;
- // Auxiliary reference line
- @property (nonatomic, strong) CAShapeLayer *shapeLayerLeftV;
- @property (nonatomic, strong) CAShapeLayer *shapeLayerRightV;
- @property (nonatomic, strong) CAShapeLayer *shapeLayerTopH;
- @property (nonatomic, strong) CAShapeLayer *shapeLayerBottomH;
- - (CPDFAnnotation *)addAnnotationWithType:(CAnnotationType)annotationType selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds;
- // Add stamp Annotation, add directly after mouse click
- // a new parameter.
- // stampObject - stamp Object.
- // isToolModel - Whether it is a pattern
- - (void)setAddStampObject:(CStampSignatureObject *)stampObject keepToolModel:(BOOL)isToolModel;
- // Add an image Stamp note
- - (void)addAnnotationWithImage:(NSImage *)image page:(CPDFPage *)page point:(NSPoint)point;
- // Refresh the currently selected Annotation
- - (void)updateActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotation;
- // Edit Annotation
- - (void)editAnnotation:(CPDFAnnotation *)annotation;
- // Rotate Stamp notes, angle 0-360 degrees,Rotation is supported only by the current addition
- - (void)rotateStampAnnotation:(CPDFListStampAnnotation *)annotation rotateAngle:(NSInteger)angle;
- // Rotate Signature notes, angle 0-360 degrees,Rotation is supported only by the current addition
- - (void)rotateSignatureAnnotation:(CPDFListSignatureAnnotation *)annotation rotateAngle:(NSInteger)angle;
- // When selecting a region mode, the selected region is obtained
- - (NSRect)currentSelectionRect;
- // Scale the page to the specified range
- - (void)zoomToRect:(NSRect)rect onPage:(CPDFPage *)page;
- // Remove Auxiliary reference line
- - (void)removeShapeLayer;
- @end
- @protocol CPDFListViewDelegate <NSObject>
- @optional
- - (void)PDFListViewChangedSelectionOrMagnification:(CPDFListView *)pdfListView;
- - (void)PDFListViewDidSelectionEnd:(CPDFListView *)pdfListView;
- - (void)PDFListViewChangedMagnification:(CPDFListView *)pdfListView;
- - (void)PDFListViewChangedToolMode:(CPDFListView *)pdfListView forToolMode:(CToolMode)toolMode;
- - (void)PDFListViewChangedAnnotationType:(CPDFListView *)pdfListView forAnnotationType:(CAnnotationType)annotationType;
- - (NSColor *)PDFListViewBackgroundColor;
- - (void)PDFListViewAddAnnotations:(CPDFListView *)pdfListView forAddAnnotations:(NSArray<CPDFAnnotation *> *)annotations inPage:(CPDFPage *)pdfPage;
- - (void)PDFListViewRemoveAnnotations:(CPDFListView *)pdfListView forRemoveAnnotations:(NSArray<CPDFAnnotation *> *)annotations inPage:(CPDFPage *)pdfPage;
- - (void)PDFListViewDeleteAnnotations:(CPDFListView *)pdfListView forDeleteAnnotations:(NSArray<CPDFAnnotation *> *)annotations inPage:(CPDFPage *)pdfPage;
- - (void)PDFListViewChangeatioActiveAnnotations:(CPDFListView *)pdfListView forActiveAnnotations:(NSArray<CPDFAnnotation *> *)annotations isRightMenu:(BOOL)isRightMenu;
- - (void)PDFListViewMenuForEvent:(CPDFListView *)pdfListView forEvent:(NSEvent *)theEvent clickMenu:(NSMenu **)menu;
- - (BOOL)PDFListViewMenuValidate:(CPDFListView *)pdfListView menuItem:(NSMenuItem *)menuItem isTakesEffect:(BOOL *)isTakesEffect;
- - (void)PDFListViewEditAnnotation:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)anotation;
- - (BOOL)PDFListViewKeyDownIsContinue:(CPDFListView *)pdfListView theEvent:(NSEvent *)theEvent;
- - (NSArray<NSMenuItem *> *)PDFListViewMenuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page menuItems:(NSArray <NSMenuItem *>*)menuItems;
- - (void)PDFListViewRedactErasure:(CPDFListView *)pdfListView;
- - (void)PDFListViewLinkDestinationStart:(CPDFListView *)pdfListView withActiveAnnotation:(CPDFAnnotation *)annotation;
- - (void)PDFListViewLinkDestinationEnd:(CPDFListView *)pdfListView withActiveAnnotation:(CPDFAnnotation *)annotation;
- - (void)PDFListViewKeyDowClosePanel:(CPDFViewSidebarSpeedMode)speedy event:(NSEvent *)theEvent;
- - (NSArray<NSColor *> *)PDFListViewEventMarkupColorWithAnnotation:(CPDFAnnotation *)annotation;
- - (BOOL)PDFListViewHaveDocumentAttribute;
- // 是否需要绘制注释 【文字、背景】
- - (BOOL)PDFListView:(CPDFListView *)pdfListView needDrawAnnotation:(CPDFAnnotation *)annotation;
- - (void)PDFListViewAnnotationAttributeHasChange:(CPDFListView *)pdfListView withAnnotation:(CPDFAnnotation *)annotation;
- @end
|