Programming Reference: ODLinkManager

# Programming Reference

## ODLinkManager

Class definition file | LinkMgr.idl
Class C++ Binding | LinkMgr.xh

Class hierarchy

    SOMObject
       ODObject
          ODLinkManager

Description

An object of the ODLinkManager class coordinates the creation and maintenance of cross-document links.

The ODLinkManager class uses a platform-dependent implementation of cross-document links, building facilities provided on each platform.

When a document is opened, the session object creates a single link-manager object. All parts of that document share the link manager. Parts do not access the link manager directly; instead, source parts use the ODLinkSource class and destination parts use the ODLink class.

The document shell or a container application can obtain a reference to the link manager by calling the session object's GetLinkManager method. The link manager's methods are called by link objects, draft objects, and document shells; they are not used by parts.

When a cross-document link is established, the link manager object of the destination draft communicates with the link-manager object of the source draft to create the link. Neither the source nor destination parts know that the link is cross-document; the source draft and the destination draft each maintain a link-source object and a link object, and the parts involved communicate only with the link-sources objects and link objects of their own drafts.

When a draft is opened, the link-manager object ensures that the link destinations from other documents have the opportunity to update to the latest content. It also maintains a list of cross-document link sources that should be updated when the draft is saved.

Methods

These methods are called only by the document shell or container applications. The methods defined for the ODLinkManager class include:

- AnyLinkImported
- DraftClosing
- DraftOpened
- DraftSaved
- UnsavedExportedLinks

Overridden methods | There are no methods overridden by the ODLinkManager class.

### AnyLinkImported

Returns a Boolean value that indicates whether one or more links to the source in other documents have been updated automatically since the specified draft was last saved.

Signature

    ODBoolean AnyLinkImported (ODDraft draft)

Parameters

draft (ODDraft) - input

  A reference to the draft to be tested for imported links.

Returns

rv (ODBoolean) - returns

  A flag indicating whether any links were automatically updated.

  kODTrue | One or more links automatically updated.
  kODFalse | No links automatically updated.

Remarks

A container application could call this method when it might otherwise close the document without saving. If the method returns true, links were updated and the document should be saved without user interaction.

At present, the document shell does not call this method.

Related Methods

- ODLinkManager::UnsavedExportedLinks

### DraftClosing

This method is called to notify this link manager that the specified draft is about to be closed.

Signature

    void DraftClosing (ODDraft draft)

Parameters

draft (ODDraft) - input

  A reference to the draft to be closed.

Returns

None.

Remarks

The document shell calls this method before reverting or closing the specified draft. If the draft contains any cross-document links created since the last save, the link manager breaks those links at the source.

A container application can call the UnsavedExportedLinks method to determine whether closing the document without saving the draft would result in the loss of cross-document links.

Related Methods

- ODLinkManager::UnsavedExportedLinks

### DraftOpened

This method is called to notify this link manager that the specified draft has been opened.

Signature

    void DraftOpened (ODDraft draft)

Parameters

draft (ODDraft) - input

  A reference to the draft that was opened.

Returns

None.

Remarks

The document shell calls this method after the specified draft is opened.

Related Methods

- ODLinkManager::DraftClosing

### DraftSaved

This method is called to notify this link manager that the specified draft has been saved.

Signature

    void DraftSaved (ODDraft draft)

Parameters

draft (ODDraft) - input

  A reference to the draft that was saved.

Returns

None.

Remarks

The document shell calls this method after saving a draft.

### UnsavedExportedLinks

This method returns a Boolean value that indicated whether any cross-document links have been established since the last time the since the draft was saved.

Signature

    ODBoolean UnsavedExportedLinks (ODDraft draft)

Parameters

draft (ODDraft) - input

  A reference to the draft of interest

Returns

rv (ODBoolean) - returns

  A flag indicating whether any links were automatically updated.

  kODTrue | Cross-document link since last saved.
  kODFalse | No link since last saved.

Remarks

A container application can call this method when the user tries to close or revert a draft without first saving it. A return value of true indicates that some cross-document links will be lost unless the draft is saved, and the container application could alert the user accordingly.

At present, the document shell does not call this method.

Related Methods

- ODLinkManager::AnyLinkImported
- ODLinkManager::DraftClosing

[ Top | Previous | Next | Contents | Index | Documentation Homepage ]