textView, writeCell to clipboard, how to read from clipboard

  • Hi,

    in NSTextView there is a method to handling writing textattachmentcells to the clipboard. I implemented the following and it seems to work:

    - (NSArray *)textView:(NSTextView *)aTextView writablePasteboardTypesForCell:(id <NSTextAttachmentCell>)cell
                  atIndex:(NSUInteger)charIndex;
    {
        return [NSArray arrayWithObject:kDataCellTypeUTI];
    }

    - (BOOL)textView:(NSTextView *)aTextView
          writeCell:(id <NSTextAttachmentCell>)cell
            atIndex:(NSUInteger)charIndex
        toPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
    {
        if (type == kDataCellTypeUTI)
            [pboard writeObjects:[NSArray arrayWithObject:cell]];

        return YES;
    }

    Both get overridden and my custom textattachmentcell ends up on the pasteboard. But when pasting it and even though it does get pasted as a cell, the custom properties are the default values and not the ones from the copy on the pasteboard. initWithPasteboardPropertyList is never called nor initWithCoder, only the standard init method. The cell subclass subscribes to NSPastboardReading and -Writing protocol and implements all methods thereof. IS there anything else that needs to be done, or are textattachmentcells an exception to the pasteboard in some way?

    AR
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today