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

#include <ILinkUtils.h>

Inheritance diagram for ILinkUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ILINKUTILS }
 

Public Member Functions

virtual ErrorCode CopyLinks (IDataBase *iDataBase, UID sourceItemUID, UID targetItemUID)=0
 
virtual ErrorCode ReplaceLinks (IDataBase *iDataBase, UID sourceItemUID, UID targetItemUID)=0
 
virtual ErrorCode CopyLinkToLinkObject (const UIDRef &sourceLinkUIDRef, const UIDRef &targetObjectUIDRef, UID &newLink)=0
 
virtual UID GetLink (const UIDRef &itemRef) const =0
 
virtual UID FindLink (const UIDRef &itemRef) const =0
 
virtual UID FindLinkResource (const UIDRef &itemRef) const =0
 
virtual bool IsLinkMissing (const UIDRef &itemRef) const =0
 
virtual bool IsLinkEmbedded (const UIDRef &itemRef) const =0
 
virtual bool IsLinkMissingOrOutOfDate (const UIDRef &itemRef) const =0
 
virtual bool IsResourceLinked (const UIDRef &resourceRef) const =0
 
virtual bool GetFileFromLink (ILink *link, IDFile *file) const =0
 
virtual bool GetFileFromLink (const UIDRef &itemRef, IDFile *file) const =0
 
virtual IPMStreamCreateReadStreamFromLink (const UIDRef &itemRef) const =0
 
virtual IPMStreamCreateWriteStreamFromLink (const UIDRef &itemRef) const =0
 
virtual ErrorCode CreateFileFromEmbedded (const UIDRef &itemRef, IDFile &file) const =0
 
virtual IPMStreamQueryLinkedStream (const UIDRef &itemRef) const =0
 
virtual uint64 GetUIDSize (IDataBase *db, UID uid) const =0
 
virtual bool IDFileToResourceId (const IDFile &file, ILinkResource::ResourceId &resourceId) const =0
 
virtual bool CloudAssetRefToResourceId (const std::string &assetRef, ILinkResource::ResourceId &resourceId) const =0
 
virtual bool ResourceIdToIDFile (const ILinkResource::ResourceId &resourceId, IDFile &file) const =0
 
virtual UID FindMatchingResource (const UIDRef &resourceRef, bool bEmbedded) const =0
 
virtual UID FindMatchingResource (IDataBase *db, const LinkClientID &clientID, const ILinkResource::ResourceId &resourceId, bool bEmbedded) const =0
 
virtual bool GetEditorList (const UIDRef &linkResource, AppInfoList &appList, const bool16 bDefaultEditorOnly)=0
 
virtual bool ComposePath (IDFile &file) const =0
 
virtual bool32 IsINDDInternalLink (const ILink *iLink) const =0
 
virtual bool GetOPIName (const UIDRef &itemRef, PMString &name) const =0
 
virtual bool16 GetXMPPacket (IDFile &theFile, std::string &packet)=0
 
virtual WideString GetLinkScheme (const ILink *iLink)=0
 
virtual bool16 IsLinkContentAvailable (const ILink *iLink)=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

Utility interface that provides useful functionality for programming against the links architecture.

See Also
ILinkCmdSuite
ILinkManager

Member Function Documentation

virtual bool ILinkUtils::CloudAssetRefToResourceId (const std::string & assetRef,
ILinkResource::ResourceIdresourceId 
) const
pure virtual

Converts an asset ref to an ILinkResource::ResourceId.

Parameters
file[IN] assetRef to convert.
resourceId[OUT] Resulting ILinkResource::ResourceId.
Returns
True if the conversion succeeds, else false.
virtual bool ILinkUtils::ComposePath (IDFilefile) const
pure virtual

Performs a form C string normalization (canonical composition) on the given file's path.

Parameters
file[IN] File whose path to compose..
Returns
True if the file's path needed normalization; else false.
virtual ErrorCode ILinkUtils::CopyLinks (IDataBaseiDataBase,
UID sourceItemUID,
UID targetItemUID 
)
pure virtual

Copies the set of links found on the source item to the target item. Each boss object behind the source and target UIDs will support the ILinkObject interface. This method will create a link (ILink) connecting the target item (ILinkObject) to an resource (ILinkResource) for each link that exists on the source item. Both the source and target items are assumed to be on the same database. No links are deleted (either on source or target) as part of this operation. New links are created, associated with the target item.

Parameters
iDataBase[IN] Document database the items exist in.
sourceItemUID[IN] Source of the copy operation.
targetItemUID[IN] Target of the copy operation.
Returns
kSuccess on success, otherwise an error.
virtual ErrorCode ILinkUtils::CopyLinkToLinkObject (const UIDRefsourceLinkUIDRef,
const UIDReftargetObjectUIDRef,
UIDnewLink 
)
pure virtual

Copies the specified link to the object specified. A copy of the link is made in the target link object database, and this new link is associated with the target link object.

Parameters
sourceLinkUIDRef[IN] Link to be copied.
targetObjectUIDRef[IN] Link object (signature interface ILinkObject) the new link is associated with.
newLink[OUT] UID of the newly created link (the copy of the link specified by sourceLinkUIDRef).
Returns
kSuccess on success, otherwise and error code.
virtual ErrorCode ILinkUtils::CreateFileFromEmbedded (const UIDRefitemRef,
IDFilefile 
) const
pure virtual

Create a file from the embedded data.

Parameters
itemRef[IN] UIDRef of the linked page item.
file[IN] File to create.
Returns
ErrorCode: kSuccess when successful.
virtual IPMStream* ILinkUtils::CreateReadStreamFromLink (const UIDRefitemRef) const
pure virtual

Create a read stream to the linked item's contents.

Parameters
itemRef[IN] UIDRef of the linked page item.
Returns
A pointer to an add-referenced IPMStream to the linked contents.
virtual IPMStream* ILinkUtils::CreateWriteStreamFromLink (const UIDRefitemRef) const
pure virtual

Create a write stream to the linked item's contents.

Parameters
itemRef[IN] UIDRef of the linked page item.
Returns
A pointer to an add-referenced IPMStream to the linked contents.
virtual UID ILinkUtils::FindLink (const UIDRefitemRef) const
pure virtual

Find any link related to the source item. This method searches the item's hierarchy for an association to a link. If none is found, the method determines if there is an association with a text story, and the story is tested for an association to a link. If a link association is found, the method returns the link.

Parameters
itemRef[IN] Reference to item we are examining.
Returns
UID of the found link, or kInvalidUID.
virtual UID ILinkUtils::FindLinkResource (const UIDRefitemRef) const
pure virtual

Find any resource that is linked or related to the source item. \ This method searches the item's hierarchy for an association to a link resource. If none is found, the method determines if there is an association with a text story, and the story is tested for an association to a link resource. If a link resource association is found, the method returns the UID of link resource.

Parameters
itemRef[IN] Reference to item we are examining.
Returns
UID of the found link resource, or kInvalidUID.
virtual UID ILinkUtils::FindMatchingResource (const UIDRefresourceRef,
bool bEmbedded 
) const
pure virtual

Find any resource that matches the URI and stamp of the given resource.\ Since the resource stamps are compared, it is important that the stamps be up-to-date before calling this method.

Parameters
resourceRef[IN] Reference to resource we are matching.
bEmbedded[IN] Denotes whether the resource to match must be embedded. \ True if the matching resource must be embedded, false if the matching resource cannot be embedded.
Returns
UID of the matching link resource, or kInvalidUID.
virtual UID ILinkUtils::FindMatchingResource (IDataBasedb,
const LinkClientIDclientID,
const ILinkResource::ResourceIdresourceId,
bool bEmbedded 
) const
pure virtual

Find any resource that matches the given link resource identifier (URI).

Parameters
db[IN] Database the resource to match.
clientId[IN] Link client identifier of the resources to check.
resourceId[IN] Link resource identifier (URI) to match.
bEmbedded[IN] Denotes whether the resource to match must be embedded. \ True if the matching resource must be embedded, false if the matching resource cannot be embedded.
Returns
UID of the matching link resource, or kInvalidUID.
virtual bool ILinkUtils::GetEditorList (const UIDReflinkResource,
AppInfoListappList,
const bool16 bDefaultEditorOnly 
)
pure virtual

Determine whether a file's associated editor is available and gather a list of editors for the file.

Parameters
linkResource[IN] Link resource we want to edit.
appList[OUT] The editor list, could be empty.
bDefaultEditorOnly[IN] If kTrue, return default editor only, kFalse to gether all editors for the file.
Returns
True if an editor is available.
virtual bool ILinkUtils::GetFileFromLink (ILinklink,
IDFilefile 
) const
pure virtual

Get the link's IDFile.

Parameters
link[IN] Link we are testing
file[OUT] IDFile if found
Returns
True if the link's resource had an IDFile, otherwise false
virtual bool ILinkUtils::GetFileFromLink (const UIDRefitemRef,
IDFilefile 
) const
pure virtual

Get the link's IDFile for the given page item.

Parameters
itemRef[IN] UIDRef of the item we are testing
file[OUT] the IDFile if found
Returns
True if the link's resource had an IDFile, otherwise false
virtual UID ILinkUtils::GetLink (const UIDRefitemRef) const
pure virtual

Get a link related to the source item. Returns the UID of first associated link. Does not search the item's hierarchy, see FindLink() instead.

Parameters
itemRef[IN] Reference to item we are examining.
Returns
UID of the found link, or kInvalidUID.
virtual WideString ILinkUtils::GetLinkScheme (const ILinkiLink)
pure virtual

Use this method to get the scheme of the link, i.e whether a placed link is from file system, CC Libraries or any other source.

Parameters
iLink[IN] The link in question.
Returns
WideString the link's scheme.
virtual bool ILinkUtils::GetOPIName (const UIDRefitemRef,
PMStringname 
) const
pure virtual

Gets the OPI name of the link resource associated to the source item.\ If there is no OPI name, an empty string is returned.

Parameters
itemRef[IN] Reference to item we are examining.
name[OUT] OPI name of the link resource.\ On the Mac an OPI file name is an HFS/POSIX path.\ On Windows, an OPI file name is a local or UNC path.\ If the link resource does not reference a file, the returned OPI name is the resource's long name.
Returns
True if the OPI name was obtained, else false.
virtual uint64 ILinkUtils::GetUIDSize (IDataBasedb,
UID uid 
) const
pure virtual

Get the size of a UID.

Parameters
db[IN] The document containing the UID.
uid[IN] UID.
Returns
Size of the UID.
virtual bool16 ILinkUtils::GetXMPPacket (IDFiletheFile,
std::string & packet 
)
pure virtual

Serializes a file's XMP metadata to a string.

Parameters
theFile[IN] The file to examine.
packet[OUT] A reference to the string to which the metadata is serialized.
Returns
kTrue if XMP is found, kFalse otherwise
virtual bool ILinkUtils::IDFileToResourceId (const IDFilefile,
ILinkResource::ResourceIdresourceId 
) const
pure virtual

Converts an IDFile to an ILinkResource::ResourceId.

Parameters
file[IN] IDFile to convert.
resourceId[OUT] Resulting ILinkResource::ResourceId.
Returns
True if the conversion succeeds, else false.
virtual bool32 ILinkUtils::IsINDDInternalLink (const ILinkiLink) const
pure virtual

Use this method to identify whether or not a data link is from within a placed InDesign document. That is, is this link a placed image, for example, on a page within an InDesign document which has been placed within another InDesign document? If so, then we may not want users to be allowed to perform certain operations on the link.

Parameters
iLink[IN] The link in question.
Returns
kTrue if the link comes from within a placed INDD document.
virtual bool16 ILinkUtils::IsLinkContentAvailable (const ILinkiLink)
pure virtual

Use this method to check whether the underlying link content is locally available or not

Parameters
iLink[IN] The link in question.
Returns
kTrue if the content is available, kFalse otherwise.
virtual bool ILinkUtils::IsLinkEmbedded (const UIDRefitemRef) const
pure virtual

Determine if the link information for a page item is embedded. A link is embedded if the link resource store state associated with the link is set to ILinkResource::kEmbedded.

Parameters
itemRef[IN] Reference to item we are testing
Returns
True if the link is embedded, otherwise false
virtual bool ILinkUtils::IsLinkMissing (const UIDRefitemRef) const
pure virtual

Determine if the link information for a page item is missing. The link is missing if there is no link (ILink) associated with the link object (ILinkObject). A link is missing if the link resource state associated with the link is set to ILinkResource::kMissing. If the link is embedded, it is not missing.

Parameters
itemRef[IN] Reference to item we are testing
Returns
True if the link is missing, otherwise false
virtual bool ILinkUtils::IsLinkMissingOrOutOfDate (const UIDRefitemRef) const
pure virtual

If IsLinkMissing returns false and IsLinkEmbedded returns false, determine if the associated ILink's GetResourceModificationState is ILink::kResourceModified or the ILinkResource's state is not ILinkResource::kAvailable.

Parameters
itemRef[IN] Reference to item we are testing
Returns
True if the link is missing or needs updating.
virtual bool ILinkUtils::IsResourceLinked (const UIDRefresourceRef) const
pure virtual

Determines if a link resource is associated with any link.

Parameters
resourceRef[IN] Reference to link resource to check.
Returns
True if the link resource is associated with a link, else false
virtual IPMStream* ILinkUtils::QueryLinkedStream (const UIDRefitemRef) const
pure virtual

Returns a stream that contains the data link's data.

Parameters
itemRef[IN] UIDRef of the linked page item.
Returns
Nil on failure.
virtual ErrorCode ILinkUtils::ReplaceLinks (IDataBaseiDataBase,
UID sourceItemUID,
UID targetItemUID 
)
pure virtual

Replaces the set of links on the target item with those that exist on the source item. This method assumes the source and target items support the ILinkObject interface. All links that exist on the target item are deleted prior to the operation. A new link (ILink) is associated with the target (ILinkObject) to every resource (ILinkResource) that is linked to on the source item. No links are deleted on the source item as part of this operation. New links are created, associated with the target item.

Parameters
iDataBase[IN] Document databse the items exist in.
sourceItemUID[IN] Source of the copy operation.
targetItemUID[IN] Target of the copy operation.
Returns
kSuccess on success, otherwise an error.
virtual bool ILinkUtils::ResourceIdToIDFile (const ILinkResource::ResourceIdresourceId,
IDFilefile 
) const
pure virtual

Converts an ILinkResource::ResourceId to an IDFile.

Parameters
resourceId[IN] ILinkResource::ResourceId to convert.
file[OUT] Resulting IDFile.
Returns
True if the conversion succeeds, else false.