Share via


In-Place Activation

If your editor view hosts ActiveX or other active controls, you must implement your editor view either as an ActiveX control or as an active document data object using the in-place activation model.

Support for Menus, Toolbars, and Commands

The Visual Studio integrated development environment (IDE) provides extensions to the OLE in-place interfaces that enable your editor view to use the menus and toolbars of the IDE. These extensions are referred to as OLE in-place components. For more information, see the IOleInPlaceComponent and IOleInPlaceComponentUIManager.

If you implement an ActiveX control, you can host other embedded objects. If you implement a document data object, the window frame constrains your ability to use ActiveX controls.

Note

The IOleDocument and IOleDocumentView interfaces allow for a separation of data and view. However, this functionality is not used by the IDE. In the IDE, these interfaces are used only in the representation of the document view object.

Editors that use the SOleComponentUIManager service can support menu, toolbar, and command integration by calling methods of the IOleInPlaceComponentUIManager interface implemented by the SOleComponentUIManager service. Editors also can offer functionality, such as selection tracking, macro recording, and undo management, that IDE services support. For more information, see Kinds of Editors.

Objects and Interfaces Used

The objects that are used to create in-place activation are shown in the following illustration.

In-place activation editor

In-place Activation Editor

Note

Of the objects in this drawing, only the CYourEditorFactory object is required to create a standard editor. If you are creating a custom editor, you are not required to implement IVsPersistDocData2 because your editor will likely have its own private persistence mechanism. For more information, see Kinds of Editors.

All interfaces that are implemented to create an in-place activation editor are shown on the single CYourEditorDocument object, but this configuration only supports a single view of document data. For more information about supporting multiple views of your document data, see Supporting Multiple Document Views.

Interface

Type of object

Use

IOleInPlaceComponent

View

Enables in-place VSPackage objects to operate as fully integrated components of the IDE by using the SOleComponentUIManager service. This service integrates the menus, toolbars, and commands of the object into the IDE and issues notifications of state changes.

IOleObject

View

Principal means by which an embedded object provides basic functionality to its container and communicates with it.

IOleInPlaceActiveObject

View

Manages the activation and deactivation of in-place objects, and determines how much of the in-place object should be visible.

IOleInPlaceObject

View

Provides a direct channel of communication between an in-place object, the associated application's outermost frame window, and the document window in the application that contains the embedded object.

IOleDocument

View

Implements an ActiveX object. Note that the methods of IOleDocument and T:Microsoft.VisualStudio.OLE.Interop.IOleDocumentView that separate document data and view are not used in the IDE .

IOleCommandTarget

View/Data

Enables the document data object or the document view object or both to participate in command handling.

IVsStatusbarUser

View

Enables status bar updates.

IVsToolboxUser

View

Enables adding items to the Toolbox.

IVsFileChangeEvents

Data

Sends notification of changes to the edited file. (This interface is optional.)

IPersistFileFormat

Data

Used to enable the Save As feature for a file type.

IVsPersistDocData

Data

Enables persistence for the document. For read-only files, call SetDocDataReadOnly to provide the "lock" icon that indicates read-only files.

IVsDocDataFileChangeControl

Data

Determines whether changes to document data should be ignored.

For more information about implementing these interfaces, see the SingleViewEditorPane class in the SingleViewEditorPane.cs file, located in the Visual C# version of the Reference.SingleViewEditor sample. By default, this sample is located in: C:\Program Files\Visual Studio 2008 SDK\<version number>\VisualStudioIntegration\Samples\IDE\CSharp\Reference.SingleViewEditor.

See Also

Tasks

How to: Create an Editor for a VSPackage