Revision: 7477
http://skim-app.svn.sourceforge.net/skim-app/?rev=7477&view=rev
Author: hofman
Date: 2011-09-08 10:16:08 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
Don't copy PDF from PDFView when the document does not allow printing
Modified Paths:
--------------
trunk/SKPDFView.m
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2011-09-08 10:02:36 UTC (rev 7476)
+++ trunk/SKPDFView.m 2011-09-08 10:16:08 UTC (rev 7477)
@@ -759,7 +759,7 @@
NSRect selRect = NSIntegralRect(selectionRect);
PDFPage *page = [self currentSelectionPage];
- if ((pdfData = [page PDFDataForRect:selRect]))
+ if ([[self document] allowsPrinting] && (pdfData = [page
PDFDataForRect:selRect]))
[types addObject:NSPDFPboardType];
if ((tiffData = [page TIFFDataForRect:selRect]))
[types addObject:NSTIFFPboardType];
@@ -1747,27 +1747,33 @@
#pragma mark Services
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray
*)types {
- if ([self toolMode] == SKSelectToolMode && NSIsEmptyRect(selectionRect) ==
NO && selectionPageIndex != NSNotFound && ([types
containsObject:NSPDFPboardType] || [types containsObject:NSTIFFPboardType])) {
+ if ([self toolMode] == SKSelectToolMode && NSIsEmptyRect(selectionRect) ==
NO && selectionPageIndex != NSNotFound &&
+ (([[self document] allowsPrinting] && [types
containsObject:NSPDFPboardType]) || [types containsObject:NSTIFFPboardType])) {
NSMutableArray *writeTypes = [NSMutableArray array];
NSData *pdfData = nil;
NSData *tiffData = nil;
NSRect selRect = NSIntegralRect(selectionRect);
if ([types containsObject:NSPDFPboardType] &&
+ [[self document] allowsPrinting] &&
(pdfData = [[self currentSelectionPage] PDFDataForRect:selRect]))
[writeTypes addObject:NSPDFPboardType];
if ([types containsObject:NSTIFFPboardType] &&
(tiffData = [[self currentSelectionPage] TIFFDataForRect:selRect]))
[writeTypes addObject:NSTIFFPboardType];
-
- [pboard declareTypes:writeTypes owner:nil];
- if (pdfData)
- [pboard setData:pdfData forType:NSPDFPboardType];
- if (tiffData)
- [pboard setData:tiffData forType:NSTIFFPboardType];
- return YES;
+ if ([writeTypes count] > 0) {
+ [pboard declareTypes:writeTypes owner:nil];
+ if (pdfData)
+ [pboard setData:pdfData forType:NSPDFPboardType];
+ if (tiffData)
+ [pboard setData:tiffData forType:NSTIFFPboardType];
+
+ return YES;
+ } else {
+ return NO;
+ }
} else if ([[SKPDFView superclass] instancesRespondToSelector:_cmd]) {
return [super writeSelectionToPasteboard:pboard types:types];
@@ -1776,7 +1782,8 @@
}
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString
*)returnType {
- if ([self toolMode] == SKSelectToolMode && NSIsEmptyRect(selectionRect) ==
NO && selectionPageIndex != NSNotFound && returnType == nil && ([sendType
isEqualToString:NSPDFPboardType] || [sendType
isEqualToString:NSTIFFPboardType])) {
+ if ([self toolMode] == SKSelectToolMode && NSIsEmptyRect(selectionRect) ==
NO && selectionPageIndex != NSNotFound && returnType == nil &&
+ (([[self document] allowsPrinting] && [sendType
isEqualToString:NSPDFPboardType]) || [sendType
isEqualToString:NSTIFFPboardType])) {
return self;
}
return [super validRequestorForSendType:sendType returnType:returnType];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit