IVsUIHierWinClipboardHelper Interface

Coordinates clipboard operations between hierarchies in a UI hierarchy window.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

public interface IVsUIHierWinClipboardHelper

The IVsUIHierWinClipboardHelper type exposes the following members.

Public methodAdviseClipboardHelperEventsEstablishes client notification of hierarchy clipboard helper events without the hierarchy implementing IConnectionPointContainer.
Public methodCopyCopies a data object from a hierarchy to the clipboard.
Public methodCutCuts a data object from a hierarchy to the clipboard.
Public methodPastePastes a data object from the clipboard to the hierarchy.
Public methodUnadviseClipboardHelperEventsDisables client notification of hierarchy clipboard helper events without requiring that the hierarchy implement IConnectionPointContainer.

Any hierarchy that wishes to coordinate its clipboard operations with other hierarchies should implement IVsUIHierWinClipboardHelperEvents and register to receive notification of clipboard events by calling AdviseClipboardHelperEvents.

The following is an example of a typical cut-and-paste sequence between hierarchies:

  1. The user performs a cut of a project item from a project hierarchy.

  2. The source project creates an IDataObject containing the data in CF_VSPROJECTITEMS format (similar to the CF_HDROP format). In addition to passing the IDataObject to OLE, the source hierarchy also passes it to the environment via the Cut method.

  3. The source project changes the appearance of the cut item by calling ExpandItem and specifying a value of either EXPF_CutHighlightItem or EXPF_AddCutHighlightItem, as appropriate.

  4. The user performs a paste of the project item.

  5. The destination project handles the contents of the IDataObject, and then communicates that a paste occurred by calling Paste.

  6. When its Paste method is called, the IVsUIHierWinClipboardHelper interface iterates through the list of hierarchies that have called AdviseClipboardHelperEvents and calls OnPaste on each. When the source project is called in this way, it should complete the cut by deleting the cut item from its hierarchy.

The IVsUIHierWinClipboardHelper interface is also a clipboard watcher, so when the contents of the clipboard change, and the cut IDataObject is no longer on the clipboard, the OnClear method of each listener is called. This way, the cut item can be undimmed by calling ExpandItem and specifying a value of EXPF_UnCutHighlightItem. In a copy situation, the item need not be dimmed since it has not been cut.

See illustrations of the implementation and/or calling of this interface in the sample Basic Project.

Notes to Implementers

Implemented by the environment.

Notes to Callers

Called by hierarchies that support cut, copy, and paste operations.

Community Additions