Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi
I try to implement the thing described inthis discussion, but it doesn't work.
I implement my own DocFileHandler and my own DocUtils like in the sample incopyfileactions. But my method CanClose is never called.
In my fr-file I do the following:
...
Class
{
kTabFlowDocFileHandlerBoss,
kInvalidClass,
{
IID_IDOCFILEHANDLER, kTabFlowDocFileHandlerImpl,
}
}
AddIn
{
kUtilsBoss,
kInvalidClass,
{
IID_IDOCUMENTUTILS, kTabFlowDocUtilsImpl,
}
};
...
But the AddIn doesn't work. There is a message Plug-in conflict: 2 plug-ins installing same interface!".
What is wrong??? Any ideas?
Thanks
Hans
Copy link to clipboard
Copied
As a rule of thumb, never AddIn an InDesign IID to an InDesign Boss.
Use your own IID instead of IID_IDOCUMENTUTILS.
Dirk
Copy link to clipboard
Copied
Hi Dirk
Thats right, yes. I never do that usually... I saw this only in the sample....
Do you have an idea why my DocFileHandler isn't called? I know, you don't see my implementation, but maybe you have an idea...
I think the Interface for my DocFileHandler is called via QueryDocFileHandler in my implementation ofDocUtils. But this method is never called. I suppose because the method ofthe original implementation IDOCUMENTUTILS is valled of course. And I don't know how to change that. If I AddIn it with my own ID it is not called anyway. Can I replace an existing interface???
Thanks
Hans
Copy link to clipboard
Copied
How do you activate your DocFileHandler?
You're supposed to do this:
In your new document responder, get the kDocBoss.
On that boss, copy the old value from IID_ICLASSIDDATA into your private IID_MY_CHAINED_CLASSIDDATA. Use an ImplementationAlias.
Then install your kTabFlowDocFileHandlerBoss into the original IID_ICLASSIDDATA. Only then your handler may be called.
In your implementation of IID_IDOCFILEHANDLER, CreateObject(originalClassID) and chain-call the previous IID_IDOCFILEHANDLER.
Finally, hope that all other plugin developers apply the same chaining, rather than CreateObject() InDesign's original handler boss.
Dirk
Copy link to clipboard
Copied
Hi
install my handler in my responder in the method Respond:
...
InterfacePtr<IClassIDData> ipDocFileHandlerData(uidRefDoc, IID_ICLASSIDDATA);
if (ipDocFileHandlerData != nil) {
ipDocFileHandlerData->Set(kTabFlowDocFileHandlerBoss);
}
...
But for what do I need the ImplementAlias?
Do you have a short code sample?
Thanks
Hans
Copy link to clipboard
Copied
You need to store the previous handler (probably a kDocFileHandlerBoss), and call it later on so it does the actual work for you. Besides other plugins also need their chance to see and reject the same notifications.
If you still don't arrive at your handler, please verify from somewhere (menu?) later on, that nobody else has replaced your docFileHandler in that ClassIDData. Hmm, could even be the original kDocFileHandlerBoss if it also is installed by a responder ...
Forget my comment about ImplementationAlias, that ClassIDData is not persistent. It's been definitely too long that I did anything with a DocFileHandler.
Dirk
Copy link to clipboard
Copied
Hi Dirk
Thanks for your answers and hints.
But I can't solve the problem, I don't see the solution actually...
What I need is to detect the closing of a document via close icon
I install my DocFileHandler during DocOpen, but something doesn't work correct. I will search for the solution, but actually I am confused...
Thanks again
Hans
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more