// // 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 #import #import #import #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; extern NSNotificationName const CPDFListViewDisplayModeChangeNotification; typedef NS_ENUM(NSInteger, CPDFViewSidebarSpeedMode) { CPDFViewSidebarSpeedModeLeft = 0, CPDFViewSidebarSpeedModeRight }; typedef NS_ENUM(NSInteger, CAnnotationType) { CAnnotationTypeUnkown = 0, CAnnotationTypeAnchored, //Note CAnnotationTypeLink, CAnnotationTypeFreeText, CAnnotationTypeLine, CAnnotationTypeArrow, CAnnotationTypeSquare, CAnnotationTypeCircle, CAnnotationTypeHighlight, CAnnotationTypeUnderline, CAnnotationTypeSquiggly, CAnnotationTypeStrikeOut, CAnnotationTypeStamp, CAnnotationTypeSignSignature, /*CAnnotationTypeCaret,*/ CAnnotationTypeInk, /*CAnnotationTypePopUp,*/ /*CAnnotationTypeFileattachment,*/ /*CAnnotationTypeSound,*/ /*CAnnotationTypeMovie,*/ CAnnotationTypeRedact, CAnnotationTypeEraser, CAnnotationTypeMeasureSquare, CAnnotationTypeMeasureLine, CAnnotationTypeMeasurePolyGon, CAnnotationTypeMeasurePolyLine, CAnnotationTypeRadioButton = 100, CAnnotationTypeCheckBox, CAnnotationTypeTextField, CAnnotationTypeComboBox, CAnnotationTypeListMenu, CAnnotationTypeActionButton, CAnnotationTypeSignature, CAnnotationTypeSignText = 200, CAnnotationTypeSignFalse, CAnnotationTypeSignTure, CAnnotationTypeSignCircle, CAnnotationTypeSignLine, CAnnotationTypeSignDot, CAnnotationTypeSignConfig, CAnnotationTypeSignDate, CAnnotationTypeTable, CAnnotationTypeDigitalSign, }; typedef NS_ENUM(NSInteger, CToolMode) { CTextToolMode = 0, //常规模式 CMoveToolMode, //滚动模式 CMagnifyToolMode, //放大镜模式 CSelectToolMode, //内容选择模式 CNoteToolMode, //注释创建模式 CSelectZoomToolMode, //区域放大模式 CFormToolMode, //Form模式 CEditPDFToolMode, //内容编辑模式 CEditLinkToolMode, //添加Link注释模式 CRedactToolMode, //密文模式 CRedactErasureToolMode, //密文擦除 CDigitalSignToolMode, //数字签名 COCRToolMode, //OCR模式 CCropToolMode, //裁剪模式 }; //移除填写模式+测量模式(CNoteToolMode),isMeasureAnnotationType&isSelfSignAnnotationType来区分 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, 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, KMTableCellData; @interface CPDFListView : CPDFView @property (nonatomic, weak) idpdfListViewDelegate; // Methods for The currently selected Annotation. @property (nonatomic, readonly) NSMutableArray *activeAnnotations; // Methods for The currently selected Annotation. @property (nonatomic, readonly) CPDFAnnotation * activeAnnotation; @property (nonatomic, readonly) CPDFAnnotation * editAnnotation; // 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) NSTrackingArea *trackingArea; @property (nonatomic, strong) NSImage *originImage; @property (nonatomic,retain) KMTableCellData *cellCopyData; @property (nonatomic,retain) NSTextField *tableTextField; @property (nonatomic, assign) NSPoint dragTablePoint; @property (nonatomic, assign) BOOL editAreaBoundUpdating; // Measurement attribute setting @property (nonatomic, retain) CPDFDistanceMeasureInfo *distanceMeasureInfo; @property (nonatomic, retain) CPDFPerimeterMeasureInfo *perimeterMeasureInfo; @property (nonatomic, retain) CPDFAreaMeasureInfo *polygonAreaMeasureInfo; @property (nonatomic, retain) CPDFAreaMeasureInfo *squareAreaMeasureInfo; @property (nonatomic, retain) NSArray *signatures; @property (nonatomic, assign) BOOL isPresentationMode; @property (nonatomic, readonly) BOOL isShowSplitBar; @property (nonatomic, strong) KMDrawView *presentationDrawView; - (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 *)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; - (CPDFPage *)currentSelectionPage; // 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)changeAnnotations:(NSArray *)annotations alignmentType:(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; - (void)enterPresentationDrawMode; - (BOOL)isEnterPresentationDrawMode; - (void)changePresentationDrawModelColor:(NSColor *)color; - (void)resetPresentationDrawMode; - (void)exitPresentationDrawMode; - (KMDrawView *)CreatePresentationDrawView; - (CGRect)selectionMultipleBoundsWithAnnotations:(NSArray *)annotations; - (CGRect)selectionMultipleBoundsWithEditArea:(NSArray *)editAreas; - (void)removeAnnotation:(CPDFAnnotation *)annotation; - (IBAction)menuItemClick_TwoPagesContinuous:(id)sender; - (IBAction)menuItemClick_TwoPages:(id)sender; - (IBAction)menuItemClick_SinglePagesContinuous:(id)sender; - (IBAction)menuItemClick_SinglePage:(id)sender; - (IBAction)menuItemClick_BookMode:(id)sender; - (IBAction)menuItemClick_BringForward:(NSMenuItem *)sender; - (IBAction)menuItemClick_SendBackward:(NSMenuItem *)sender; - (IBAction)menuItemClick_BringFront:(NSMenuItem *)sender; - (IBAction)menuItemClick_SendBack:(NSMenuItem *)sender; - (void)editAnnotation:(CPDFAnnotation *)annotation; - (void)redactAddAnnotationPages:(NSMutableArray *)pages redactAnnotation:(CPDFRedactAnnotation *)redactAnnotation; - (void)exprotSelection:(CPDFSelection *)selection type:(NSInteger)type; //0 png //1 jpg, 2 pdf @end @protocol CPDFListViewDelegate @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 *)annotations inPage:(CPDFPage *)pdfPage; - (void)PDFListViewRemoveAnnotations:(CPDFListView *)pdfListView forRemoveAnnotations:(NSArray *)annotations inPage:(CPDFPage *)pdfPage; - (void)PDFListViewChangeatioActiveAnnotations:(CPDFListView *)pdfListView forActiveAnnotations:(NSArray *)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 *)PDFListViewMenuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page menuItems:(NSArray *)menuItems; - (void)PDFListViewDidTextFontChanged:(CPDFListView *)pdfListView; - (void)PDFListViewDidTextColorChanged:(CPDFListView *)pdfListView withColor:(NSColor *)color; - (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 *)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; - (void)PDFListViewAnnotationMeasureInfoChange:(CPDFListView *)pdfListView withAnnotation:(CPDFAnnotation *)annotation; - (void)PDFListViewMeasureCancel:(CPDFListView *)pdfListView; - (void)PDFListViewMobileAnnotationBegan:(CGPoint)point forPDFListView:(CPDFListView *)pdfListView forActiveAnnotations:(NSArray *)annotations; - (void)PDFListViewMobileAnnotationMove:(CGPoint)point forPDFListView:(CPDFListView *)pdfListView forActiveAnnotations:(NSArray *)annotations; - (void)PDFListViewMobileAnnotationEnd:(CGPoint)point forPDFListView:(CPDFListView *)pdfListView forActiveAnnotations:(NSArray *)annotations; - (BOOL)PDFListViewSplitModeShowBar; - (BOOL)PDFListViewShowTipView; - (void)PDFListViewAnnotationEditModeChange:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)anotation; - (void)PDFListViewEndEditMode:(CPDFListView *)pdfListView; @end