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

#include <ILinkResource.h>

Inheritance diagram for ILinkResource:
IPMUnknownCPMUnknown< ILinkResource >CusDtLnkLinkAssetConverter

Public Types

enum  { kDefaultIID = IID_ILINKRESOURCE }
 
enum  ResourceState {
  kAvailable = 0, kMissing, kPending, kUnknown,
  kInaccessible
}
 
enum  ResourceStoreState { kNormal = 0, kCached, kEmbedded, kContained }
 
enum  AccessMode { kRead = 0, kWrite, kReadWrite }
 
enum  ResourceDownloadState { kNotStarted = 0, kInProgress, kComplete, kDownloadError }
 
typedef URI ResourceId
 
typedef WideString ResourceStamp
 
typedef boost::function< void(const
ILinkResource::ResourceId
&resourceId, const
ILinkResource::ResourceDownloadState
&resourceDownloadState)> 
DownloadCompletionFunction
 

Public Member Functions

virtual ResourceId GetURI () const =0
 
virtual ResourceId GetId () const =0
 
virtual bool IsIdEquivalent (const ResourceId &id) const =0
 
virtual LinkClientID GetClientID () const =0
 
virtual WideString GetShortName (bool bUIName) const =0
 
virtual WideString GetLongName (bool bUIName) const =0
 
virtual ResourceState GetState () const =0
 
virtual void SetState (ResourceState state)=0
 
virtual ResourceStoreState GetStoreState () const =0
 
virtual void SetContainedInObject ()=0
 
virtual ResourceStamp GetStamp () const =0
 
virtual void SetStamp (const ResourceStamp &stamp)=0
 
virtual bool IsStampEquivalent (const ResourceStamp &stamp) const =0
 
virtual IDTime GetModTime () const =0
 
virtual void SetModTime (const IDTime &time)=0
 
virtual uint64 GetSize () const =0
 
virtual void SetSize (uint64 size)=0
 
virtual FileTypeInfo GetDataType () const =0
 
virtual PMString GetFormatType () const =0
 
virtual void SetFormatType (const PMString &formatType)=0
 
virtual bool IsAccessSupported (AccessMode mode) const =0
 
virtual bool CanQueryStream (AccessMode mode) const =0
 
virtual IPMStreamQueryStream (AccessMode mode) const =0
 
virtual bool CanCache () const =0
 
virtual ErrorCode Cache ()=0
 
virtual ErrorCode Uncache ()=0
 
virtual bool CanEmbed () const =0
 
virtual ErrorCode Embed ()=0
 
virtual ErrorCode EmbedFromStream (IPMStream *stream)=0
 
virtual bool CanUnembed () const =0
 
virtual ErrorCode Unembed ()=0
 
virtual bool CanCopyToFile () const =0
 
virtual ErrorCode CopyToFile (IDFile &file) const =0
 
virtual bool CanEdit () const =0
 
virtual ErrorCode Edit (const AppInfo &appInfo, PMString *errorString)=0
 
virtual bool CanReveal () const =0
 
virtual ErrorCode Reveal ()=0
 
virtual bool CanRevealInBridge () const =0
 
virtual ErrorCode RevealInBridge ()=0
 
virtual bool CanRevealInCloudLibraries () const =0
 
virtual ErrorCode RevealInCloudLibraries ()=0
 
virtual ErrorCode CopyAttributes (const UIDRef &resourceRef)=0
 
virtual bool IsFPO () const =0
 
virtual bool CanGetXMPPacketInfo () const =0
 
virtual bool GetXMPPacketInfo (std::string &packet) const =0
 
virtual ResourceDownloadState GetDownloadProgress (PMReal &progress) const =0
 
virtual bool CanDownloadOriginal () const =0
 
virtual ErrorCode DownloadOriginal ()=0
 
virtual ErrorCode AsyncDownloadOriginal (ILinkResource::DownloadCompletionFunction completionFunction)=0
 
virtual bool CanReplaceFPOWithOriginal () const =0
 
virtual bool CanProvideFile () const =0
 
virtual ErrorCode GetFile (IDFile &idFile) const =0
 
virtual bool CanGetLinkInstance () const =0
 
virtual ErrorCode GetlinkInstance (PMString &instance) 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

ILinkResource is used to maintain and access a linked resource. A linked resource is an external or internal source of imported data, or external or internal target of exported data. All linked resources are referenced by a URI, whose scheme is used to denote the type of the resource and obtain the correct ILinkResourceHandler.

Several operations and attribute request are deferred to the ILinkResourceHandler. When the resource 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 resource is assigned a default handler that essentially treats the resource as if it were missing, and results in the resource's state to be set to kUnknown.

See Also
ILinkResourceHandler
IPMStream
URI

Member Enumeration Documentation

Identifiers that denote the type of access the link resource supports. The identifiers are used to get the type of access supported by the resource, and to query for streams.
Enumerator
kRead 

Read data from the resource.

kWrite 

Write data to the resource.

kReadWrite 

Read and write the resource's data simultaneously. \ Read/write is never supported for cached or embedded resources.

Identifiers that denote the download states of resource.
Enumerator
kNotStarted 

Download is not requested.

kInProgress 

Download started or request is in queue.

kComplete 

Download completed.

kDownloadError 

Download stopped without completion.

Identifiers that denote the availability state of the linked resource. The identifiers are used to get and set the availability state of a linked resource. The state may not be the actual current availability state of the resource.
Enumerator
kAvailable 

Resource is available for use.

kMissing 

Resource cannot be found.

kPending 

Resource's state is in the process of being updated.

kUnknown 

Resource's state is not known, and cannot be obtained.

kInaccessible 

Resource is not accessible by the user.

Identifiers that denote the store state of the link resource. The identifiers are used to get the store state of the resource.
Enumerator
kNormal 

Resource is not cached or embedded.

kCached 

Resource is cached.

kEmbedded 

Resource is embedded.

kContained 

Resource is fully contained in the object that links the resource.\ Contained resources can not be cached or embedded.

Member Function Documentation

virtual ErrorCode ILinkResource::AsyncDownloadOriginal (ILinkResource::DownloadCompletionFunction completionFunction)
pure virtual

Downloads the original asset asynchronously for the given placeholder link resource.

Parameters
completionFunctionfunction to invoke when download has completed.
Returns
kSuccess if the original can be downloaded, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::Cache ()
pure virtual

Caches the resource. \ If the resource is already cached, then attempts to update the cache from the resource.

Returns
kSuccess if the resource was cached, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanCache () const
pure virtual

Determines if the resource can be cached by calling Cache(). \ Embedded resources are never are cacheable.

Returns
True if the resource can be cached by calling Cache(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanCopyToFile () const
pure virtual

Determines if the resource can be copied to a file by calling CopyToFile().

Returns
True if the resource can be copied to a file by calling CopyToFile(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanDownloadOriginal () const
pure virtual

Determines if a resource which is a placeholder(FPO) can be downloaded.

Returns
true if the original resource can be downloaded.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanEdit () const
pure virtual

Determines if the resource can be edited by calling Edit(). \ Embedded resources are never editable.

Returns
True if the resource can be edited by calling Edit(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanEmbed () const
pure virtual

Determines if the resource can be embedded by calling Embed().

Returns
True if the resource can be embedded by calling Embed(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanGetLinkInstance () const
pure virtual

Determines if a link instance can be obtained.

Returns
true if the link instance can be obtained.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanGetXMPPacketInfo () const
pure virtual

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

Returns
true if we can get the XMP info else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanProvideFile () const
pure virtual

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

Returns
true if the resource can provide the file.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanQueryStream (AccessMode mode) const
pure virtual

Test whether a stream with the given access mode can currently be obtained for the resource. \ The state of whether a stream can be obtained with the given access mode may change at any time, so it is best to attempt to obtain the stream immediately following the call to CanQueryStream().

Parameters
mode[IN] Access mode.
Returns
True if a stream with the given access mode can currently be obtained, else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanReplaceFPOWithOriginal () const
pure virtual

Determines if a placeholder(FPO) can be replaced with the original

Returns
true if the FPO can be replaced with the original else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanReveal () const
pure virtual

Determines if the resource can be revealed by calling Reveal().

Returns
True if the resource can be revealed by calling Reveal(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanRevealInBridge () const
pure virtual

Determines if the resource can be revealed by calling RevealInBridge().

Returns
True if the resource can be revealed by calling RevealInBridge(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanRevealInCloudLibraries () const
pure virtual

Determines if the resource can be revealed by calling RevealInCloudLibraries.

Returns
True if the resource can be revealed by calling RevealInCloudLibraries(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::CanUnembed () const
pure virtual

Determines if the resource can be unembedded by calling Unembed().

Returns
True if the resource can be unembedded by calling Unembed(), else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::CopyAttributes (const UIDRefresourceRef)
pure virtual

Copies the attributes of the resource referenced by the given UIDRef to this resource.

Parameters
resourceRef[IN] UIDRef of the resource to copy. \ The UIDRef may reference a resource in a different database.
Returns
kSuccess if the resource attributes were successfuly copied, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::CopyToFile (IDFilefile) const
pure virtual

Copies the resource to the given file.

Parameters
file[IN] File to copy the resource to.
Returns
kSuccess if the resource was successfuly copied, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::DownloadOriginal ()
pure virtual

Downloads the original asset synchronously for the given placeholder link resource.

Returns
kSuccess if the original is downloaded, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::Edit (const AppInfoappInfo,
PMStringerrorString 
)
pure virtual

Edits the resource. \ Embedded resources cannot be edited.

Parameters
appInfo[IN] Indicates which app to edit the resource with. kNullAppInfo to 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 edited, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::Embed ()
pure virtual

Embeds the resource. \ If the resource is already embedded, then the call is ignored and returns kSuccess.

Returns
kSuccess if the resource was embedded, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::EmbedFromStream (IPMStreamstream)
pure virtual

Embeds the resource from the given read stream. If successful, this call will set the resource's state, stored state and size. However, it is the caller's responsibility to set the resource's stamp. \ Note: This method should only be used for special cases like creating an embedded link resource from INX, or creating link resources for embedded graphics contained in Word documents.

Parameters
stream[IN] Read stream containing the resource's embedded data.
Returns
kSuccess if the resource was embedded, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual LinkClientID ILinkResource::GetClientID () const
pure virtual

Returns the resource's link client identifier.

Returns
Resource's link client identifier.

Implemented in CusDtLnkLinkAssetConverter.

virtual FileTypeInfo ILinkResource::GetDataType () const
pure virtual

Returns the resource's data/file type.

Returns
Resource's data/file type.

Implemented in CusDtLnkLinkAssetConverter.

virtual ResourceDownloadState ILinkResource::GetDownloadProgress (PMRealprogress) const
pure virtual

Return resource's download state and fill progress

Parameters
progress[OUT] the progress of the resource download - currently unused
Returns
ResourceDownloadState resource's download state

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::GetFile (IDFileidFile) const
pure virtual

Get the underlying file from the link resource.

Parameters
idFile[OUT] the underlying file for the link resource
Returns
kSuccess if the underyling file is available, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual PMString ILinkResource::GetFormatType () const
pure virtual

Returns the resource's import/export format type.

Returns
Resource's import/export format type.

Implemented in CusDtLnkLinkAssetConverter.

virtual ResourceId ILinkResource::GetId () const
pure virtual

Returns the resource's Uniform Resource Identifier (URI). \ The URI is used to uniquely identify the resource's type and location.

Returns
Resource's URI.

Implemented in CusDtLnkLinkAssetConverter.

virtual WideString ILinkResource::GetLongName (bool bUIName) const
pure virtual

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

Parameters
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 CusDtLnkLinkAssetConverter.

virtual IDTime ILinkResource::GetModTime () const
pure virtual

Returns the resource's current modification date/time.

Returns
Resource's current modification date/time.

Implemented in CusDtLnkLinkAssetConverter.

virtual WideString ILinkResource::GetShortName (bool bUIName) const
pure virtual

Returns the resource's short name. \ For example, the short name for a file resource is the file's name.

Parameters
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 CusDtLnkLinkAssetConverter.

virtual uint64 ILinkResource::GetSize () const
pure virtual

Returns the resource's size in bytes.

Returns
Resource's size in bytes.

Implemented in CusDtLnkLinkAssetConverter.

virtual ResourceStamp ILinkResource::GetStamp () const
pure virtual

Returns the resource's stamp. \ The stamp, in conjuction with the URI, uniquely identifies an resource at a given point in time.

Returns
Resource's stamp.

Implemented in CusDtLnkLinkAssetConverter.

virtual ResourceState ILinkResource::GetState () const
pure virtual

Returns the resource's availability state.

Returns
Resource's availability state.

Implemented in CusDtLnkLinkAssetConverter.

virtual ResourceStoreState ILinkResource::GetStoreState () const
pure virtual

Returns the resource's store state.

Returns
Resource's store state.

Implemented in CusDtLnkLinkAssetConverter.

virtual ResourceId ILinkResource::GetURI () const
pure virtual

DEPRECATED - Please call the GetId method instead. Returns the resource's Uniform Resource Identifier (URI). \ The URI is used to uniquely identify the resource's type and location.

Returns
Resource's URI.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::GetXMPPacketInfo (std::string & packet) const
pure virtual

Get the XMP Info for the resource

Parameters
packet[OUT] the resource's XMP info
Returns
true if the XMP info is filled in packet else false .

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::IsAccessSupported (AccessMode mode) const
pure virtual

Determines if the resource generally supports the given access mode. \ It is possible that the resource generally supports the given access mode, but it is not possible to currently obtain a stream due to the resource being read or written by other processes. Therefore, to determine if a stream can currently be obtained with the given access mode, call CanQueryStream().

Parameters
mode[IN] Access mode.
Returns
True if the resource generally supports the given access mode, else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::IsFPO () const
pure virtual

Determines if the resource is an FPO.

Returns
true if the resource is an FPO else false.
See Also
ILinkResourceRenditionData::ResourceRenditionType

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::IsIdEquivalent (const ResourceIdid) const
pure virtual

Determines if the given id is equivalent to the resource's id.

Parameters
id[IN] Resource id to compare with the resource's id.
Returns
True if the given id is equivalent to the resource's id, else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual bool ILinkResource::IsStampEquivalent (const ResourceStampstamp) const
pure virtual

Determines if the given stamp is equivalent to the resource's stamp.

Parameters
stamp[IN] Stamp to compare with the resource's stamp.
Returns
True if the given stamp is equivalent to the resource's stamp, else false.

Implemented in CusDtLnkLinkAssetConverter.

virtual IPMStream* ILinkResource::QueryStream (AccessMode mode) const
pure virtual

Returns a stream that is used to access the resource's data. \ If the access mode is kRead and the resource is cached or embedded, the returned stream will read the cached or embedded data. \ If the access mode is kWrite and the resource is cached, the returned stream will write data to the actual resource, not the cache.

Parameters
mode[IN] Access mode.
Returns
Pointer to a referenced stream; the caller is responsible for releasing the stream. \ Nil if a stream cannot be obtained.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::Reveal ()
pure virtual

Reveals the resource.

Returns
kSuccess if the resource was revealed, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::RevealInBridge ()
pure virtual

Reveals the resource.

Returns
kSuccess if the resource was revealed, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::RevealInCloudLibraries ()
pure virtual

Reveals the resource.

Returns
kSuccess if the resource was revealed in CC Libraries, else an error code.

Implemented in CusDtLnkLinkAssetConverter.

virtual void ILinkResource::SetContainedInObject ()
pure virtual

Sets the resource's store state to kContained.\ This call is ignored for resources that are cached or embedded.

Implemented in CusDtLnkLinkAssetConverter.

virtual void ILinkResource::SetFormatType (const PMStringformatType)
pure virtual

Sets the resource's import/export format type.

Parameters
formatType[IN] Resource's import/export format type.

Implemented in CusDtLnkLinkAssetConverter.

virtual void ILinkResource::SetModTime (const IDTimetime)
pure virtual

Sets the resource's current modification date/time.

Parameters
size[IN] Current modification date/time of the resource.

Implemented in CusDtLnkLinkAssetConverter.

virtual void ILinkResource::SetSize (uint64 size)
pure virtual

Sets the resource's size in bytes.

Parameters
size[IN] Size of the resource in bytes.

Implemented in CusDtLnkLinkAssetConverter.

virtual void ILinkResource::SetStamp (const ResourceStampstamp)
pure virtual

Sets the resource's stamp.

Parameters
stamp[IN] Stamp of the resource.

Implemented in CusDtLnkLinkAssetConverter.

virtual void ILinkResource::SetState (ResourceState state)
pure virtual

Sets the resource's availability state.

Parameters
state[IN] Availability state of the resource.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::Uncache ()
pure virtual

Uncaches the resource.

Returns
kSuccess if the resource was uncached, else an error code. \ kFailure is returned if the resource is not currently cached.

Implemented in CusDtLnkLinkAssetConverter.

virtual ErrorCode ILinkResource::Unembed ()
pure virtual

Unembeds the resource to the same location it was embedded from.

Returns
kSuccess if the resource was unembedded, else an error code. \ kFailure is returned if the resource is not currently embedded.

Implemented in CusDtLnkLinkAssetConverter.