InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ILinkResourceHandler Class Referenceabstract

#include <ILinkResourceHandler.h>

Inheritance diagram for ILinkResourceHandler:
IPMUnknownCPMUnknown< ILinkResourceHandler >CusDtLnkLinkResourceHandlerFileLinkResourceHandlerHTTPAssetLinkResourceHandlerCusHttpLnkLinkResourceHandler

Public Types

enum  { kDefaultIID = IID_ILINKRESOURCEHANDLER }
 

Public Member Functions

virtual bool Init (const UIDRef &ref, const URI &uri)=0
 
virtual bool IsResourceURIValid (const UIDRef &ref, const URI &uri) const =0
 
virtual bool AreResourceIdsEquivalent (const ILinkResource::ResourceId &id1, const ILinkResource::ResourceId &id2) const =0
 
virtual FileTypeInfo GetResourceDataType (const UIDRef &ref, const URI &uri) const =0
 
virtual WideString GetShortResourceName (const UIDRef &ref, const URI &uri, bool bUIName) const =0
 
virtual WideString GetLongResourceName (const UIDRef &ref, const URI &uri, bool bUIName) const =0
 
virtual PMString GetResourceStateInfo (const UIDRef &ref, const URI &uri, ILinkResource::ResourceState state, ILinkResource::ResourceStoreState storeState) const =0
 
virtual bool AreStampsEquivalent (const WideString &stamp1, const WideString &stamp2) const =0
 
virtual bool CanReadResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanWriteResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanReadWriteResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanCreateResourceStream (const UIDRef &ref, const URI &uri, ILinkResource::AccessMode access) const =0
 
virtual IPMStreamCreateResourceReadStream (const UIDRef &ref, const URI &uri) const =0
 
virtual IPMStreamCreateResourceWriteStream (const UIDRef &ref, const URI &uri) const =0
 
virtual IPMStreamCreateResourceReadWriteStream (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanCacheResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanEmbedResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanUnembedResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanCopyToFile (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode CopyToFile (const UIDRef &ref, const URI &uri, IDFile &file) const =0
 
virtual bool CanEditResource (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode EditResource (const UIDRef &ref, const URI &uri, const AppInfo &appInfo, PMString *errorString) const =0
 
virtual bool CanRevealResource (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode RevealResource (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanRevealResourceInBridge (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode RevealResourceInBridge (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanRevealResourceInCloudLibraries (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode RevealResourceInCloudLibraries (const UIDRef &ref, const URI &uri) const =0
 
virtual bool CanGetXMPPacketInfo (const UIDRef &ref, const URI &uri) const =0
 
virtual bool GetXMPPacketInfo (const UIDRef &resourceRef, const URI &uri, std::string &packet) const =0
 
virtual bool CanDownloadOriginalResource (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode DownloadOriginalResource (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode AsyncDownloadOriginalResource (const UIDRef &ref, const URI &uri, ILinkResource::DownloadCompletionFunction completionFunction) const =0
 
virtual bool CanReplaceFPOWithOriginalResource (const UIDRef &ref, const URI &uri) const =0
 
virtual
ILinkResource::ResourceDownloadState 
GetResourceDownloadProgress (const UIDRef &ref, const URI &uri, PMReal &progress) const =0
 
virtual bool CanProvideFile (const UIDRef &ref, const URI &uri) const =0
 
virtual ErrorCode GetFile (const UIDRef &ref, const URI &uri, IDFile &idFile) const =0
 
virtual bool canGetInstanceName () const =0
 
virtual ErrorCode GetInstanceName (PMString &instanceURI) const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

ILinkResourceHandler is used to implement behavior for an ILinkResource that is specific to the type of a resource as identified by the scheme of the link resource's URI. The link resource defers many operations and attribute request to the handler. For example, it is left to the handler to determine if two resources have equivalent URIs or stamps. The handler is also used to determine what operations are allowed, to obtain streams to the resource, and to edit and copy the resource.

To associate a handler for a specific type of resource, a factory for the type of resource is registered via a link resource provider for the kLinkResourceService. For example, a file based link resource will require a different provider and handler than a database link resource.

When an ILinkResource object is instantiated, the handler is obtained using the scheme of the resource's URI as a key to find the appropriate provider. If no handler is found, due to a missing plug-in for instance, the link resource is assigned a default handler that essentially treats the resource as if it were missing. Therefore, all resources that have a custom URI must provide a handler.

See Also
ILinkResource
IPMStream
URI

Member Function Documentation

virtual bool ILinkResourceHandler::AreResourceIdsEquivalent (const ILinkResource::ResourceIdid1,
const ILinkResource::ResourceIdid2 
) const
pure virtual

Called to determine if the given resource references are equivalent.

Parameters
id1[IN] Resource identifier to compare with id2.
id2[IN] Resource identifier to compare with id1.
Returns
True if the given resource identifiers are equivalent, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::AreStampsEquivalent (const WideStringstamp1,
const WideStringstamp2 
) const
pure virtual

Called to determine if the given resource stamps are equivalent.

Parameters
stamp1[IN] Stamp to compare with stamp2.
stamp2[IN] Stamp to compare with stamp1.
Returns
True if the given stamps are equivalent, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::AsyncDownloadOriginalResource (const UIDRefref,
const URIuri,
ILinkResource::DownloadCompletionFunction completionFunction 
) const
pure virtual

Called to download original asynchronously for an FPO resource.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to be downloaded.
completionFunction[IN] completion function to be called at the end of download.
Returns
kSuccess if the resource can be downloaded.
See Also
ILinkResourceRenditionData::ResourceRenditionType

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanCacheResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be cached.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be cached, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanCopyToFile (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be copied to a file.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be copied to a file, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanCreateResourceStream (const UIDRefref,
const URIuri,
ILinkResource::AccessMode access 
) const
pure virtual

Called to determine if a resource can currently be opened with the given access mode.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
access[IN] Type of access desired.
Returns
True if the resource can be opened with the given access mode, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanDownloadOriginalResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if the original for an FPO resource can be downloaded.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
Returns
true if the resource can be downloaded, else false.
See Also
ILinkResourceRenditionData::ResourceRenditionType

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanEditResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be edited.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be edited, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanEmbedResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be embedded.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be embedded, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanGetXMPPacketInfo (const UIDRefref,
const URIuri 
) const
pure virtual

Determines if we can get the XMP Info for the resource.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
Returns
true if we can get the XMP info else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanProvideFile (const UIDRefref,
const URIuri 
) const
pure virtual

Determines if a resource can provide the underlying file or not.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
Returns
true if the resource can provide the file.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanReadResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be read.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be read, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanReadWriteResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be read and written simultaneously.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be read and written simultaneously, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanReplaceFPOWithOriginalResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if the FPO resource can be replaced with original.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
Returns
true if the FPO resource can be replaced with the original.
See Also
ILinkResourceRenditionData::ResourceRenditionType

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanRevealResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be revealed.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be revealed, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanRevealResourceInBridge (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be revealed in Adobe Bridge

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be revealed, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanRevealResourceInCloudLibraries (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be revealed in CC Libraries panel

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be revealed, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanUnembedResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be unembedded.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be unembedded, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::CanWriteResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if a resource can be written.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to check.
Returns
True if the resource can be written, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::CopyToFile (const UIDRefref,
const URIuri,
IDFilefile 
) const
pure virtual

Called to copy a resource to the given file.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to copy.
file[IN] File to copy the resource to.
Returns
kSuccess if the resource was successfuly copied, else an error code.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual IPMStream* ILinkResourceHandler::CreateResourceReadStream (const UIDRefref,
const URIuri 
) const
pure virtual

Called to create a stream that can be used to read data from a resource. \ The caller assumes responsibility for deleting the stream.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to create a read stream for.
Returns
Pointer to a read stream. \ Nil if the resource is not readable.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual IPMStream* ILinkResourceHandler::CreateResourceReadWriteStream (const UIDRefref,
const URIuri 
) const
pure virtual

Called to create a stream that can be used to read and write data from/to a resource. \ The caller assumes responsibility for deleting the stream.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to create a read/write stream for.
Returns
Pointer to a read/write stream. \ Nil if a read/write stream is not supported.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual IPMStream* ILinkResourceHandler::CreateResourceWriteStream (const UIDRefref,
const URIuri 
) const
pure virtual

Called to create a stream that can be used to write data to a resource. \ The caller assumes responsibility for deleting the stream.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to create a write stream for.
Returns
Pointer to a write stream. \ Nil if the resource is not writable.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::DownloadOriginalResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to download original synchronously for an FPO resource.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to be downloaded.
Returns
kSuccess if the resource was downloaded.
See Also
ILinkResourceRenditionData::ResourceRenditionType

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::EditResource (const UIDRefref,
const URIuri,
const AppInfoappInfo,
PMStringerrorString 
) const
pure virtual

Called to edit a resource.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to edit.
appInfo[IN] Indicates which app to edit the resource with. kNullAppInfo means use the default editor.
errorString[OUT] If editing fails, this fills out an error message when the string pointer is non-nil
Returns
kSuccess if the resource was successfully edited, else an error code.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::GetFile (const UIDRefref,
const URIuri,
IDFileidFile 
) const
pure virtual

Get the underlying file from the link resource.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
idFile[OUT] IDFile of the underlying link resource.
Returns
kSuccess if the underlying file is available, else an error code.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual WideString ILinkResourceHandler::GetLongResourceName (const UIDRefref,
const URIuri,
bool bUIName 
) const
pure virtual

Called to get a resource's long name. \ For example, the long name for a file resource is the file's full path.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to get a long name for.
bUIName[IN] Denotes to return the resource's long UI name if different from the resource's actual long name.\ In some cases, resources may want to have long UI name that differs from the resource's actual long name. For example, file resources on the Mac return a POSIX path as the resource's actual long name, and a HFS/POSIX path as the resource's long UI name.
Returns
Resource's long name.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, FileLinkResourceHandler, and CusHttpLnkLinkResourceHandler.

virtual FileTypeInfo ILinkResourceHandler::GetResourceDataType (const UIDRefref,
const URIuri 
) const
pure virtual

Called to get a resource's data/file type.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to get the data/file type for.
Returns
Resource's data/file type.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ILinkResource::ResourceDownloadState ILinkResourceHandler::GetResourceDownloadProgress (const UIDRefref,
const URIuri,
PMRealprogress 
) const
pure virtual

Return resource's download state and fill progress

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
progress[OUT] the download progress, currently unused. resource's download state

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual PMString ILinkResourceHandler::GetResourceStateInfo (const UIDRefref,
const URIuri,
ILinkResource::ResourceState state,
ILinkResource::ResourceStoreState storeState 
) const
pure virtual

Called to get additional information about a resource's state. \ The additional information is added to state string the Links UI displays in the link information pane and the status tooltip.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to get a state informational string for.
state[IN] Resource's current availability state.
storeState[IN] Resource's current store state.
Returns
Additional resource state information.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual WideString ILinkResourceHandler::GetShortResourceName (const UIDRefref,
const URIuri,
bool bUIName 
) const
pure virtual

Called to get a resource's short name. \ For example, the short name for a file resource is the file's name.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to get a short name for.
bUIName[IN] Denotes to return the resource's short UI name if different from the resource's actual short name.\ In some cases, resources may want to have short UI name that differs from the resource's actual short name. For example, file resources on the Mac return a POSIX file name as the resource's actual short name, and a HFS/POSIX file name as the resource's short UI name.
Returns
Resource's short name.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::GetXMPPacketInfo (const UIDRefresourceRef,
const URIuri,
std::string & packet 
) const
pure virtual

Get the XMP Info for the resource

Parameters
resourceRef[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
packet[OUT] the resource's XMP info
Returns
true if the XMP info is filled in packet else false .

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::Init (const UIDRefref,
const URIuri 
)
pure virtual

Called by the LinkResource to allow the handler to initialize itself. This method can be used by the handler to optimize its resource handling. For example, the handler may want to parse the URI in this method so that calls to other methods can used the parsed information.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the link resource.
Returns
True if the handler initializes without errors, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual bool ILinkResourceHandler::IsResourceURIValid (const UIDRefref,
const URIuri 
) const
pure virtual

Called to determine if the provider supports the given URI.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI to check.
Returns
True if the URI is supported, else false.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::RevealResource (const UIDRefref,
const URIuri 
) const
pure virtual

Called to reveal a resource.

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to reveal.
Returns
kSuccess if the resource was successfully revealed, else an error code.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::RevealResourceInBridge (const UIDRefref,
const URIuri 
) const
pure virtual

Called to reveal a resource in Adobe Bridge

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to reveal.
Returns
kSuccess if the resource was successfully revealed, else an error code.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.

virtual ErrorCode ILinkResourceHandler::RevealResourceInCloudLibraries (const UIDRefref,
const URIuri 
) const
pure virtual

Called to reveal a resource in CC Libraries panel

Parameters
ref[IN] UID reference of the link resource.
uri[IN] URI of the resource to reveal.
Returns
kSuccess if the resource was successfully revealed, else an error code.

Implemented in HTTPAssetLinkResourceHandler, CusDtLnkLinkResourceHandler, and FileLinkResourceHandler.