Question
How to control what aggregated persistent data survives a copy/paste?
Hi,<br /><br />I'm trying to come up with a way to manipulate my own aggregated persistent data of pageitems being copy/pasted. If I for instance have a link to an external source for a textstory i might need to do some special stuff if the textframe hlding that story is copy/pasted.<br /><br />It seems a good starting point would be obersving the kCopyPageItemCmdBoss as it has the old and new PageItem UIDs available on it and I could then just propagate my persisten data between the pageitems.<br /><br />On "Copy" kCopyPageItemCmdBoss is used to copy pageitems to the scrap and on "paste" it is used to copy pageitems from the scrap to the destination document. So it seems I need to observe and intervene on both these copy-occasions in order for my data to survive the copy/paste operation.<br /><br />My problem is observing the copy-operation to the scrap. I cant for the life of me figure out where to attach my observer. I tried something like this:<br /><br />InterfacePtr<IClipboardController> clipboardController(gSession,UseDefaultIID());<br /> <br />InterfacePtr<IDataExchangeHandler> scrapHandler(clipboardController->QueryHandler(kPageItemFlavor));<br />InterfacePtr<IPageItemScrapData> scrapData(scrapHandler, UseDefaultIID());<br />UIDRef parent = scrapData->GetRootNode();<br />InterfacePtr<ISubject> scrapSub(parent, IID_ISUBJECT);<br /><br />Attach observer to scrapSub.<br /><br />This only works some of the time. I guess a new scrap-database is created from time to time making my observer observe the wrong subject or something.<br /><br />Could anyone point me in the right direction?<br /><br />Cheers