Partager via


DocData Class

When overridden in a derived class, represents a document in memory.

This API is not CLS-compliant. 

Inheritance Hierarchy

System.Object
  System.MarshalByRefObject
    Microsoft.VisualStudio.Modeling.Shell.DocData
      Microsoft.VisualStudio.Modeling.Shell.ModelingDocData
      Microsoft.VisualStudio.Modeling.Shell.SubordinateDocData

Namespace:  Microsoft.VisualStudio.Modeling.Shell
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Shell.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.Shell.12.0.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
Public MustInherit Class DocData _
    Inherits MarshalByRefObject _
    Implements IVsPersistDocData2, IVsPersistDocData, IVsFileChangeEvents, IVsDocDataFileChangeControl,  _
    IPersistFileFormat, IPersist, IDisposable, IVsSaveOptionsDlg, IVsUserData,  _
    IVsFileBackup, IServiceProvider
[CLSCompliantAttribute(false)]
public abstract class DocData : MarshalByRefObject, 
    IVsPersistDocData2, IVsPersistDocData, IVsFileChangeEvents, IVsDocDataFileChangeControl, IPersistFileFormat, 
    IPersist, IDisposable, IVsSaveOptionsDlg, IVsUserData, IVsFileBackup, 
    IServiceProvider
[CLSCompliantAttribute(false)]
public ref class DocData abstract : public MarshalByRefObject, 
    IVsPersistDocData2, IVsPersistDocData, IVsFileChangeEvents, IVsDocDataFileChangeControl, IPersistFileFormat, 
    IPersist, IDisposable, IVsSaveOptionsDlg, IVsUserData, IVsFileBackup, 
    IServiceProvider
[<AbstractClass>]
[<CLSCompliantAttribute(false)>]
type DocData =  
    class 
        inherit MarshalByRefObject 
        interface IVsPersistDocData2 
        interface IVsPersistDocData 
        interface IVsFileChangeEvents 
        interface IVsDocDataFileChangeControl 
        interface IPersistFileFormat 
        interface IPersist 
        interface IDisposable 
        interface IVsSaveOptionsDlg 
        interface IVsUserData 
        interface IVsFileBackup 
        interface IServiceProvider 
    end
public abstract class DocData extends MarshalByRefObject implements IVsPersistDocData2, IVsPersistDocData, IVsFileChangeEvents, IVsDocDataFileChangeControl, IPersistFileFormat, IPersist, IDisposable, IVsSaveOptionsDlg, IVsUserData, IVsFileBackup, IServiceProvider

The DocData type exposes the following members.

Constructors

  Name Description
Protected method DocData Initializes a new instance of the DocData class.

Top

Properties

  Name Description
Public property Cookie Gets the cookie that identifies the document in the Running Documents table.
Public property DocViews Gets the collection of document views that are open for the document.
Public property Encoding Gets or sets the encoding that persists the document.
Public property FileName Gets the file name of the document.
Protected property FormatList Gets a list of formats.
Public property Hierarchy Gets the project hierarchy to which the document belongs.
Protected property IsBackupFileObsolete
Public property IsLoaded Gets the document and verifies whether it is loaded.
Public property ItemId Gets the Item ID that is assigned to the document.
Protected property ServiceProvider Gets the service provider from the shell.
Public property UndoManager Gets the UndoManager interface for the document.
Protected property UndoManagerIsShared Gets the document and verifies whether more than one document is sharing the same UndoManager interface.
Public property VSUndoManager Gets the UndoManager interface.

Top

Methods

  Name Description
Protected method BackupFile Make a single file backup of this document. Returns whether the document is expected to re-load without data loss.
Protected method CanSave Verifies whether the user can cancel the save operation.
Public method Close Closes the document.
Public method CreateObjRef Security Critical. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method DirectoryChanged Not currently implemented.
Protected method Dispose Releases the unmanaged resources used by the DocData and optionally releases the managed resources.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method FilesChanged Notifies clients that one or more documents changed.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method FlushUndoManager Clears the UndoManager.
Public method GetClassID Gets the GUID of the editor factory that created the document.
Public method GetCurFile Gets the file name of the document.
Public method GetData Gets the document data from a buffer.
Public method GetFormatList Gets the list of supported document formats.
Public method GetGuidEditorType Gets the GUID of the editor factory that created the IVsPersistDocData object.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetLifetimeService Security Critical. Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method GetService Return the requested service.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method HandleLoadDocDataException Manages any exceptions that were thrown when the document was loading.
Protected method HandleSaveDocDataException Manages any exceptions that were thrown when the document was saving.
Public method IgnoreFileChanges Determines whether changes to the document should be ignored.
Public method InitializeLifetimeService Security Critical. Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method InitNew Initializes the document.
Public method IsDirty Verifies whether the document has changed since the most recent save operation.
Public method IsDocDataDirty Verifies whether the document has changed since the most recent save operation.
Public method IsDocDataReadOnly Verifies whether the document is read-only.
Public method IsDocDataReloadable Verifies whether the document can be reloaded.
Protected method Load(String, Boolean) Loads the document into memory.
Public method Load(String, UInt32, Int32) Loads the document into memory.
Public method LoadDocData(String) Loads the document by using its file name.
Protected method LoadDocData(String, Boolean) Loads the document by using its file name.
Public method MarkDocumentChangedForBackup Mark that the document has changed and thus a new backup should be created
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected method OnDocumentClosed Alerts listeners that the document was closed.
Protected method OnDocumentClosing Alerts listeners that the document will be closed.
Protected method OnDocumentLoaded Alerts listeners that the document is loaded.
Protected method OnDocumentLoading Alerts listeners that the document will be loaded.
Protected method OnDocumentReadOnlyChanged Alerts listeners that the read-only state of the document has changed.
Protected method OnDocumentReloaded Alerts listeners that the document has been reloaded.
Protected method OnDocumentReloading Alerts listeners that the document will be reloaded.
Protected method OnDocumentSaved Alerts listeners that the document has been saved.
Protected method OnDocumentSaving Alerts listeners that the document will be saved.
Protected method OnFileNameChanged Alerts listeners that the file name of the document has changed.
Protected method OnHierarchyChanged Alerts listeners that the Item ID that is assigned to the document has changed.
Public method OnRegisterDocData Assigns the document to a cookie and project hierarchy.
Public method OpenView Opens a specific view for the document.
Public method QueryEditFile() Alerts listeners that a document is about to be edited. Listeners can vote against the edit.
Public method QueryEditFile(String, tagVSQueryEditFlags) Alerts listeners that a document is about to be edited. Listeners can vote against the edit.
Public method QuerySaveFile() Alerts listeners that a file is about to be saved. Listeners can
Public method QuerySaveFile(String, tagVSQuerySaveFlags) Alerts listeners that a file is about to be saved.
Public method ReloadDocData Reloads the document.
Protected method ReloadDocDataWorker Reloads the document.
Public method RenameDocData Renames a document and resets its position in the hierarchy.
Protected method ResumeFileChangeNotification Resumes the distribution of document-change notifications for the document.
Protected method Save(String) Saves the document.
Public method Save(String, Int32, UInt32) Saves the document.
Public method SaveCompleted Alerts listeners that the document has been saved.
Public method SaveDocData Saves the document to a specific location.
Protected method SaveDocDataToFile Saves the document to a specific location.
Protected method SaveSubordinateFile Save the specified document that is subordinate to this document, for example a diagram file.
Public method SetData Sets the document to a buffer.
Public method SetDocDataDirty Sets the document's IsDirty flag.
Public method SetDocDataReadOnly Sets the document's read-only flag.
Protected method SetFileName Initializes or changes the file name for the document.
Protected method SetHierarchyInfo Initializes or changes the project hierarchy for the document.
Public method SetUntitledDocPath Currently not implemented.
Public method ShowSaveOptionsDlg Shows a dialog box from which the user can specify additional options for save formats.
Protected method SuspendFileChangeNotification Suspends the distribution of document-change notifications for the document.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Events

  Name Description
Public event DocumentClosed Occurs after the document is closed.
Public event DocumentClosing Occurs before the document is closed.
Public event DocumentLoaded Occurs after the document has been loaded in the modeling window.
Public event DocumentLoading Occurs before the document is loaded in the modeling window.
Public event DocumentReadOnlyChanged Occurs when the read-only flag for the document changes.
Public event DocumentReloaded Occurs after the document is reloaded.
Public event DocumentReloading Occurs before the document is reloaded.
Public event DocumentSaved Occurs after the document is saved.
Public event DocumentSaving Occurs before the document is saved.
Public event FileNameChanged Occurs when the document's file name changes.
Public event HierarchyChanged Occurs when the document's hierarchy or Item ID changes.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IVsFileBackup.BackupFile Make a single file backup of this document.
Explicit interface implemetationPrivate method IDisposable.Dispose Releases all resources used by the current instance of the DocData class.
Explicit interface implemetationPrivate method IPersistFileFormat.GetClassID Gets the class ID of the editor factory that created the document.
Explicit interface implemetationPrivate method IVsFileBackup.IsBackupFileObsolete Get whether the backup file is up to date.

Top

Remarks

This class also listens to change events for external documents and can prompt the user to reload the document.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Modeling.Shell Namespace