123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- //
- // 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>
- #define SKAnnotationKey @"SKAnnotation"
- extern NSString *SKPasteboardTypeLineStyle;
- 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;
- extern NSNotificationName const KMPDFViewTableAnnotationDidChangeNotification;
- 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,
- CAnnotationTypeEditTextImage,
- CAnnotationTypeAddText,
- CAnnotationTypeAddImage,
-
- CAnnotationTypeRadioButton = 100,
- CAnnotationTypeCheckBox,
- CAnnotationTypeTextField,
- CAnnotationTypeComboBox,
- CAnnotationTypeListMenu,
- CAnnotationTypeActionButton,
- CAnnotationTypeSignature,
-
- CAnnotationTypeSignText = 200,
- CAnnotationTypeSignFalse,
- CAnnotationTypeSignTure,
- CAnnotationTypeSignCircle,
- CAnnotationTypeSignLine,
- CAnnotationTypeSignDot,
- CAnnotationTypeSignConfig,
- CAnnotationTypeSignDate,
-
- CAnnotationTypeTable,
- };
- typedef NS_ENUM(NSInteger, CToolMode) {
- CTextToolMode = 0,
- CMoveToolMode,
- CMagnifyToolMode,
- CSelectToolMode,
- CNoteToolMode,
- CSelectZoomToolMode,
- CFormToolMode,
- CSelfSignMode,
- CRedactToolMode,
- CRedactErasureToolMode,
- CEditPDFToolMode,
- };
- typedef NS_ENUM(NSUInteger, KMPDFActiveFormsAlignType) {
- KMPDFActiveFormsAlignType_Left = 0,
- KMPDFActiveFormsAlignType_Vertical,
- KMPDFActiveFormsAlignType_Right,
- KMPDFActiveFormsAlignType_Top,
- KMPDFActiveFormsAlignType_Horizontally,
- KMPDFActiveFormsAlignType_Bottom,
- KMPDFActiveFormsAlignType_DisHorizontally,
- KMPDFActiveFormsAlignType_DisVertical
- };
- typedef NS_ENUM(NSUInteger, KMPDFViewActiveFormsType) {
- KMPDFViewActiveFormsType_NotAllform = -1,//注释类型不全为form类型
- KMPDFViewActiveFormsType_Mix = 0,//包含多种类型的form(全为form)
- KMPDFViewActiveFormsType_Pure,//单纯只有一种form(全为form)
- KMPDFViewActiveFormsType_PureSingle,//单纯只有一种form(全为form),个数为1
- KMPDFViewActiveFormsType_Text,//单纯只有一种form,并且是text(全为form)
- KMPDFViewActiveFormsType_TextSingle,//单纯只有一种form,并且是text(全为form),个数为1
- KMPDFViewActiveFormsType_None
- };
- typedef NS_ENUM(NSUInteger, KMPDFViewMode) {
- KMPDFViewModeNormal = 0,
- KMPDFViewModeSoft,
- KMPDFViewModeNight,
- KMPDFViewModeGreen,
- KMPDFViewModeThemes1,
- KMPDFViewModeThemes2,
- KMPDFViewModeThemes3,
- KMPDFViewModeThemes4,
- KMPDFViewModeOther
- };
- typedef NS_ENUM(NSInteger, KMPDFViewSplitMode) {
- KMPDFViewSplitModeDisable = 0,
- KMPDFViewSplitModeHorizontal,
- KMPDFViewSplitModeVertical
- };
- enum {
- SKDragArea = 1 << 16,
- SKResizeUpDownArea = 1 << 17,
- SKResizeLeftRightArea = 1 << 18,
- SKResizeDiagonal45Area = 1 << 19,
- SKResizeDiagonal135Area = 1 << 20,
- SKReadingBarArea = 1 << 21,
- SKSpecialToolArea = 1 << 22
- };
- @protocol CPDFListViewDelegate;
- @class CStampSignatureObject,CPDFListStampAnnotation,CPDFListSignatureAnnotation, KMFormListMenuPopWindowController, KMTableCellData;
- @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;
- @property (nonatomic, assign) NSPoint lastAddAnnotationPoint;
- @property (nonatomic, assign) BOOL isCreatAnnotation;
- @property (nonatomic, assign) NSInteger toolBarCreateAnnotationMenuItem;
- @property (nonatomic, assign) BOOL isTakeSnapeSelectConetent;
- @property (nonatomic, assign) KMPDFViewMode viewMode;
- @property (nonatomic, assign) KMPDFViewSplitMode viewSplitMode;
- @property (nonatomic, strong) KMFormListMenuPopWindowController *listWindowController;
- @property (nonatomic, strong) NSTrackingArea *trackingArea;
- @property (nonatomic, strong) NSImage *originImage;
- @property (nonatomic,retain) KMTableCellData *cellCopyData;
- @property (nonatomic,retain) NSTextField *tableTextField;
- @property (nonatomic, assign) NSPoint dragTablePoint;
- - (CPDFAnnotation *)addAnnotationWithType:(CAnnotationType)annotationType selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds;
- - (void)addAnnotationWithAnnotation:(CPDFAnnotation *)annotation toPage:(CPDFPage *)page;
- // 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;
- // Determines whether the current annotation is consistent with the selected annotation mode
- - (BOOL)consistentTypeWithAnnotation:(CPDFAnnotation *)annotation;
- - (void)formsAnnotationAlign:(KMPDFActiveFormsAlignType)type;
- - (void)addImageAnnotation:(NSImage *)image center:(NSPoint)center isRemoveBGColor:(BOOL)isRemoveBGColor;
- - (void)setPageBackgroundColorWithColor:(NSColor *)color viewMode:(KMPDFViewMode)viewMode;
- - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types;
- @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 isMoveSelectAnno:(BOOL)isMoveSelectAnno;
- - (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;
- - (void)PDFListView:(CPDFListView *)sender showSnapshotAtPageNumber:(NSInteger)pageNum forRect:(NSRect)rect scaleFactor:(CGFloat)scaleFactor autoFits:(BOOL)autoFits;
- - (void)PDFListView:(CPDFListView *)pdfView documentDataDidChanged:(id)docData withInfo:(NSDictionary *)info;
- @end
|