Copy link to clipboard
Copied
Hi,
I want to block addition of frames to InDesign Library. (*.indl).
I am observing kSnippetBasedCatalogBoss and catpure the command kLibraryAddItemCmdBoss with message kBeforeDoMessageBoss.
From kLibraryAddItemCmdBoss, I am able to identify which frames are being added by the user and I can decide whether to block the addition of frames or not.
From Observer, I set ErrorUtils::PMSetGlobalErrorCode(kCancel) when kLibraryAddItemCmdBoss && kBeforeDoMessageBoss command is executed.
The above method works and it doesn't allow frame to be added in Library.
But then it display the following message as shown in the screenshot -
I don't want any message to be displayed.
I also tried the following -
1. With kLibraryAddItemCmdBoss, we have ICopyCmdData interface, from where I get IDataExchangeHandler and call IDataExchangeHandler->Clear().
InDesign still displays the error message.
2. I added my own error ErrorStringService and passed my own error in ErrorUtils::PMSetGlobalErrorCode(kMyErrorCode) but then InDesign Crashes.
Am I observing correct boss class kSnippetBasedCatalogBoss and obsering right command kLibraryAddItemCmdBoss ?
Can anyone help me on this ?
Regards,
Rahul Rastogi
Found the solution -
if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kBeforeDoMessageBoss)
{
InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA);
if(!iLibraryCmdData)
break;
iDestLibrary = iLibraryCmdData->GetDestLibrary();
}
else if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kAfterDoMessageBoss)
{
InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA);
if(!iLibraryCmdData)
break;
AssetIDList assetIDList = iLibraryCmdData-
...Copy link to clipboard
Copied
Found the solution -
if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kBeforeDoMessageBoss)
{
InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA);
if(!iLibraryCmdData)
break;
iDestLibrary = iLibraryCmdData->GetDestLibrary();
}
else if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kAfterDoMessageBoss)
{
InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA);
if(!iLibraryCmdData)
break;
AssetIDList assetIDList = iLibraryCmdData->GetAssetList();
Utils<ILibraryCmdUtils>()->ProcessLibraryDeleteItemsCmd(assetIDList, iDestLibrary);
// set the global error to kSuccess otherwise InDesign displays message "disk is full".
ErrorUtils::PMSetGlobalErrorCode(kSuccess);
}