Revision: 5092
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5092&view=rev
Author:   hofman
Date:     2008-12-26 16:25:12 +0000 (Fri, 26 Dec 2008)

Log Message:
-----------
add script property for extended rich text of anchored note as RTF data

Modified Paths:
--------------
    trunk/PDFAnnotation_SKExtensions.h
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKNPDFAnnotationNote_SKExtensions.h
    trunk/SKNPDFAnnotationNote_SKExtensions.m
    trunk/Skim.sdef

Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h  2008-12-26 16:14:44 UTC (rev 5091)
+++ trunk/PDFAnnotation_SKExtensions.h  2008-12-26 16:25:12 UTC (rev 5092)
@@ -109,6 +109,7 @@
 - (id)textContents;
 - (void)setTextContents:(id)text;
 - (id)richText;
+- (id)richTextRTF;
 - (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData;
 - (NSData *)boundsAsQDRect;
 - (NSString *)fontName;

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2008-12-26 16:14:44 UTC (rev 5091)
+++ trunk/PDFAnnotation_SKExtensions.m  2008-12-26 16:25:12 UTC (rev 5092)
@@ -404,6 +404,10 @@
     return [NSNull null];
 }
 
+- (id)richTextRTF {
+    return [NSNull null];
+}
+
 - (void)setBoundsAsQDRect:(NSData *)inQDBoundsAsData {
     if ([self isMovable]) {
         NSRect newBounds = [inQDBoundsAsData rectValueAsQDRect];

Modified: trunk/SKNPDFAnnotationNote_SKExtensions.h
===================================================================
--- trunk/SKNPDFAnnotationNote_SKExtensions.h   2008-12-26 16:14:44 UTC (rev 
5091)
+++ trunk/SKNPDFAnnotationNote_SKExtensions.h   2008-12-26 16:25:12 UTC (rev 
5092)
@@ -55,4 +55,5 @@
 @interface SKNPDFAnnotationNote (SKExtensions)
 + (NSDictionary *)textToNoteSkimNoteProperties:(NSDictionary *)properties;
 - (void)setRichText:(id)newText;
+- (void)setRichTextRTF:(id)newRTF;
 @end

Modified: trunk/SKNPDFAnnotationNote_SKExtensions.m
===================================================================
--- trunk/SKNPDFAnnotationNote_SKExtensions.m   2008-12-26 16:14:44 UTC (rev 
5091)
+++ trunk/SKNPDFAnnotationNote_SKExtensions.m   2008-12-26 16:25:12 UTC (rev 
5092)
@@ -148,6 +148,18 @@
         return [[NSScriptCoercionHandler sharedCoercionHandler] 
coerceValue:value toClass:[NSTextStorage class]];
 }
 
+- (id)richTextRTF {
+    NSData *data = [textStorage RTFFromRange:NSMakeRange(0, [textStorage 
length]) documentAttributes:NULL];
+    return [NSAppleEventDescriptor descriptorWithDescriptorType:'RTF ' 
data:data];
+}
+
+- (void)setRichTextRTF:(id)newRTF {
+    NSData *data = [newRTF isKindOfClass:[NSAppleEventDescriptor class]] ? 
[newRTF data] : nil;
+    NSAttributedString *attrString = data ? [[[NSAttributedString alloc] 
initWithRTF:data documentAttributes:nil] autorelease] : nil;
+    if (attrString)
+        [textStorage replaceCharactersInRange:NSMakeRange(0, [textStorage 
length]) withAttributedString:attrString];
+}
+
 #pragma mark Accessibility
 
 - (NSArray *)accessibilityAttributeNames {

Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef     2008-12-26 16:14:44 UTC (rev 5091)
+++ trunk/Skim.sdef     2008-12-26 16:25:12 UTC (rev 5092)
@@ -707,6 +707,10 @@
                 description="The rich extended text of an anchored note.">
                 <cocoa key="richText"/>
             </property>
+            <property name="extended RTF" code="XRTF" type="any"
+                description="RTF for the rich extended text of an anchored 
note.">
+                <cocoa key="richTextRTF"/>
+            </property>
             <property name="icon" code="iimg" type="icon type"
                 description="The icon type of an anchored note.">
                 <cocoa key="scriptingIconType"/>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to