added some development tools
[windows-sources.git] / developer / VSSDK / VisualStudioIntegration / Common / IDL / textmgr.idl
blobb678778e87124bd1e9abd28cbeae92f6ce1ab572
1 ////////////////////////////////////////////////////////////////////////////////
2 // TEXTMGR.IDL
3 //
4 // Interfaces for text buffer/view management
5 //
6 // NOTE: please read the text editor architecture document for more information
7 // about many of these interfaces.
8 //
9 ////////////////////////////////////////////////////////////////////////////////
11 // imports (UNDONE: Is there a better way to get IOleCommandTarget in?)
12 #ifndef INTEROPLIB
14 import "docobj.idl";
15 import "context.idl";
17 #else
19 #define IVsUserContextUpdate IUnknown
20 #define IVsUserContext IUnknown
22 #endif
24 #include "shared.idh"
25 #include "indentstyle.idh"
27 #include "textmgruuids.h"
29 /****************************************************************************
30 ******** IMPORTANT!! *********
32 All guids for interfaces and co-creatable objects in this file should be defined
33 in textmgruuids.h
35 ****************************************************************************/
38 interface IVsTextBuffer;
39 interface IVsTextLines;
40 interface IVsTextStream;
41 interface IVsTextLayer;
42 interface IVsLayerModule;
43 interface IVsTextMarker;
44 interface IVsTextLineMarker;
45 interface IVsTextStreamMarker;
46 interface IVsTextLayerMarker;
47 interface IVsTextMarkerClient;
48 interface IVsTextMarkerType;
49 interface IVsEnumStreamMarkers;
50 interface IVsEnumLineMarkers;
51 interface IVsEnumLayerMarkers;
52 interface IVsEnumTextBuffers;
53 interface IVsEnumTextSpans;
54 interface IVsTextScanner;
55 interface IVsTextBufferEvents;
56 interface IVsTextBufferDataEvents;
57 interface IVsTextLinesEvents;
58 interface IVsTextStreamEvents;
59 interface IVsColorizer;
60 interface IVsColorableItem;
61 interface IVsProvideColorableItems;
62 interface IVsTextColorState;
63 interface IVsCompletionSet;
64 interface IVsTipWindow;
65 interface IVsTextView;
66 interface IVsTextViewEvents;
67 interface IVsTextViewFilter;
68 interface IVsViewRangeClient;
69 interface IVsTextManager;
70 interface IVsTextManagerEvents;
71 interface IVsTextSelectionAction;
72 interface IVsEnumTextViews;
73 interface IVsAction;
74 interface IVsCodeWindow;
75 interface IVsCodeWindowManager;
76 interface IVsSplitPane;
77 interface IVsSplitter;
78 interface IVsSplitRoot;
79 interface IVsLanguageInfo;
80 interface IVsLanguageDebugInfo;
81 interface IVsCompoundAction;
82 interface IVsCompoundActionEvents;
83 interface IVsMethodData;
84 interface IVsTextTipData;
85 interface IVsUserData;
86 interface IVsLastChangeTimeProvider;
87 interface IVsShortcutManager;
88 interface IVsDropdownBar;
89 interface IVsButtonBar;
90 interface IVsHiddenTextSession;
91 interface IVsTextMacroHelper;
92 interface IVsLanguageBlock;
93 interface IVsTextImage; // simple lines-of-text abstraction
94 interface IVsTextImageEvents; // change events for modifications on IVsTextImage
95 interface IVsEnumGUID;
96 interface IVsTextEditorPropertyContainer;
97 interface IVsTextEditorPropertyCategoryContainer;
98 interface IVsMergeableUIItem;
99 interface IVsLanguageTextOps;
100 interface IVsLanguageClipboardOps;
101 interface IVsCodeWindowEvents;
102 interface IVsFileBackup;
103 interface IVsEditorGoBackLocations;
104 interface IVsEnumIndependentViews;
105 interface IVsChangeClusterEvents;
106 interface IVsUndoUnit;
107 interface IVsUndoTrackingEvents;
108 interface IVsUndoRedoClusterWithCommitEvents;
110 #ifndef INTEROPLIB
112 uuid(uuid_lib_TextManagerInternal),
113 version(1.0)
115 library TextManagerInternal
117 #endif
118 importlib("stdole32.tlb");
119 // importlib("vsshell.tlb");
122 Error codes
124 These are HRESULT values that interfaces in this IDL can return.
127 // some general definitions
128 #define FACILITY_ITF 4 // from winerror.h
130 #define BUFFER_FACILITY (FACILITY_ITF)
131 #define BUFFER_ERROR(x) (0x80000000 /* failure bit */ | (BUFFER_FACILITY << 16) /* facility bits */ | (x) /* plus the error code */)
133 enum TextBufferErrors
135 // BUFFER_E_READONLY: the buffer has been marked as read-only
136 BUFFER_E_READONLY = BUFFER_ERROR(0x1001),
138 // BUFFER_E_READONLY_REGION: a region has been marked as read-only
139 BUFFER_E_READONLY_REGION = BUFFER_ERROR(0x1002),
141 // BUFFER_E_TIMEOUT: timed out waiting for access
142 BUFFER_E_TIMEOUT = BUFFER_ERROR(0x1003),
144 // BUFFER_E_LOCKED: the buffer was locked for writing
145 BUFFER_E_LOCKED = BUFFER_ERROR(0x1004),
147 // BUFFER_E_SCC_READONLY: the file backing the buffer is under source code control and checked in
148 BUFFER_E_SCC_READONLY = BUFFER_ERROR(0x1005),
150 // BUFFER_E_DEST_TOO_SMALL: the memory block passed in was too small
151 BUFFER_E_DEST_TOO_SMALL = BUFFER_ERROR(0x1006),
153 // MARKER_E_INVALIDATED: you're trying to manipulate an invalid marker
154 MARKER_E_INVALIDATED = BUFFER_ERROR(0x1007),
156 // MARKER_E_BUFFERDESTROYED: you're trying to manipulate a markers whose buffer has been destroyed
157 MARKER_E_BUFFERDESTROYED = BUFFER_ERROR(0x1008)
162 // some general definitions
163 #define VIEW_FACILITY (FACILITY_ITF)
164 #define VIEW_ERROR(x) (0x80000000 /* failure bit */ | (VIEW_FACILITY << 16) /* facility bits */ | (x) /* plus the error code */)
166 enum TextViewErrors
168 // VIEW_E_NO_BOOKMARKS: there are no bookmarks to navigate to or delete
169 VIEW_E_NO_BOOKMARKS = VIEW_ERROR(0x2001),
171 // VIEW_E_NO_DEBUGGER: there's no debugger available to handle the requested command
172 VIEW_E_NO_DEBUGGER = VIEW_ERROR(0x2002),
174 // VIEW_E_USERREADONLY: this file cannot be modified in the editor
175 VIEW_E_USERREADONLY = VIEW_ERROR(0x2004),
178 VIEW_E_LOCATION_HIDDEN: the location you referenced (moving selection to, scrolling into view, etc.) is not
179 presently visible in this view. Can happen during restricted view, outlining, etc.
181 VIEW_E_LOCATION_HIDDEN = VIEW_ERROR(0x2005)
185 // undo errors
186 #define LINKEDUNDO_FACILITY (FACILITY_ITF)
187 #define LINKEDUNDO_ERROR(x) (0x80000000 /* failure bit */ | (LINKEDUNDO_FACILITY << 16) /* facility bits */ | (x) /* plus the error code */)
189 enum LinkedUndoErrors
192 LinkedUNDO_E_INTERVENING_ACTION: a parent action failed due to another action not being at the top of the stack.
193 This will be returned from our IOleUndoManager implementation when an undo is attempted but fails.
195 LINKEDUNDO_E_INTERVENING_ACTION = LINKEDUNDO_ERROR(0x3001),
198 #define UNDO_FACILITY (FACILITY_ITF)
199 #define UNDO_ERROR(x) (0x80000000 /* failure bit */ | (UNDO_FACILITY << 16) /* facility bits */ | (x) /* plus the error code */)
201 enum UndoErrors
204 LinkedUNDO_E_INTERVENING_ACTION: a parent action failed due to another action not being at the top of the stack.
205 This will be returned from our IOleUndoManager implementation when an undo is attempted but fails.
207 UNDO_E_CLIENTABORT = UNDO_ERROR(0x4001),
210 #define TIP_FACILITY (FACILITY_ITF)
211 #define TIP_SUCCESS(x) ((TIP_FACILITY << 16) /* facility bits */ | (x) /* plus the error code */)
212 enum TipSuccesses
214 TIP_S_ONLYIFNOMARKER =TIP_SUCCESS(0x4001)
217 ////////////////////////////////////////////////////////////////////////////
218 // Editor command table
219 ////////////////////////////////////////////////////////////////////////////
220 cpp_quote("#include <stdidcmd.h>")
221 cpp_quote("#include <vsshlids.h>")
224 ////////////////////////////////////////////////////////////////////////////
225 // IVsCompoundAction interface
226 // Exposed by objects that allow the creation of compound actions.
227 ////////////////////////////////////////////////////////////////////////////
229 uuid(uuid_IVsCompoundAction)
231 interface IVsCompoundAction : IUnknown
233 HRESULT OpenCompoundAction([in] const WCHAR *pszDescription);
234 HRESULT AbortCompoundAction(void);
235 HRESULT CloseCompoundAction(void);
236 HRESULT FlushEditActions(void);
239 ////////////////////////////////////////////////////////////////////////////
240 // IVsCompoundViewChange interface
241 // Exposed by objects that allow the creation of compound view actions.
242 // This should be QI'd for off of the buffer. It does not create an undo
243 // aciton and is specifically for grouping together actions that will make
244 // multiple changes to the view, such as multiple caret moves and selection
245 // changes.
246 ////////////////////////////////////////////////////////////////////////////
248 uuid(uuid_IVsCompoundViewChange)
250 interface IVsCompoundViewChange : IUnknown
252 HRESULT OpenCompoundViewChange(void);
253 HRESULT CloseCompoundViewChange(void);
257 WARNING: IVsCompoundActionEvents may be going away now that
258 we'll have a different line event model.
260 ////////////////////////////////////////////////////////////////////////////
261 // IVsCompoundActionEvents
263 // OnBeforeAction is fired before an action takes place. This allows clients
264 // to prepare for a transaction by caching information or creating objects
265 // that live only during a transaction.
267 // ActionAborted allows clients to discard their cache when a compound action
268 // is aborted.
270 // The "wrapped", or "interior" events that arise from a compound action are
271 // other event sets.
273 // To reduce the number of events fired, there is no terminating event.
274 // Implementers should pass a flag in the final event or fire their own
275 // terminating event.
276 ////////////////////////////////////////////////////////////////////////////
278 uuid(uuid_IVsCompoundActionEvents)
280 interface IVsCompoundActionEvents : IUnknown
282 #ifdef PROXYSTUB_BUILD
283 HRESULT OnBeforeAction(void);
284 HRESULT OnAbortAction(void);
285 #else
286 void OnBeforeAction(void);
287 void OnAbortAction(void);
288 //void OnAfterAction(void); // NOT IMPLEMENTED TO REDUCE EVENT TRAFFIC
289 #endif
293 ////////////////////////////////////////////////////////////////////////////
294 // IVsAction interface
296 // Actions placed in the undo history of a text buffer expose this
297 // interface.
298 ////////////////////////////////////////////////////////////////////////////
300 object,
301 uuid(uuid_IVsAction),
302 helpstring("IVsAction Interface"),
303 pointer_default(unique)
305 interface IVsAction : IUnknown
307 HRESULT CanMerge ([in] IVsAction *pAction);
308 HRESULT Merge ([in] IVsAction *pAction);
312 User preference management structures/enums
313 ===========================================
315 These structures are used to communicate user preferences between the text manager, views, and
316 language services. View settings will follow the text manager's settings unless a specific set of
317 forced settings has been specified when IVsTextView::Initialize is called.
319 enum { MAX_FILE_TYPE = 24 };
320 enum { MAX_EDITOR_TAB_SIZE = 60 };
322 typedef struct _LANGPREFERENCES
324 CHAR szFileType[MAX_FILE_TYPE]; // file type: "HTML"
326 // Things some language services don't support
327 unsigned fShowCompletion; // set statement completion through UI?
328 unsigned fShowSmartIndent; // set smart indent option through UI?
330 // advanced statement builder setting
331 unsigned fHideAdvancedAutoListMembers; // hide advanced members (irrelevant if !fAutoListMembers)
333 // tab settings
334 unsigned uTabSize; // limit of MAX_EDITOR_TAB_SIZE
335 unsigned uIndentSize; // limit of MAX_EDITOR_TAB_SIZE
336 unsigned fInsertTabs; // insert tab chars or just spaces?
338 // indent settings
339 vsIndentStyle IndentStyle; // none/block/smart
341 // statement builder settings
342 unsigned fAutoListMembers; // bring up a proposed list of members on the fly?
343 unsigned fAutoListParams; // bring up a proposed list of params on the fly?
345 // selection settings
346 unsigned fVirtualSpace; // virtual space navigation/selection?
348 // display settings
349 unsigned fWordWrap ; // Word wrap
350 unsigned fTwoWayTreeview ; // show tree view?
351 unsigned fHotURLs ; // Single click URL navigation?
352 unsigned fDropdownBar ; // Should language services support the dropdown/nav bar?
353 unsigned fLineNumbers ; // Show line numbers in the selection margin?
355 GUID guidLang; // language service
356 } LANGPREFERENCES;
358 // GUID for default language/file type - {8239BEC4-EE87-11d0-8C98-00C04FC2AB22}
359 cpp_quote("DEFINE_GUID(DEFAULT_FILE_TYPE, 0x8239bec4, 0xee87, 0x11d0, 0x8c, 0x98, 0x0, 0xc0, 0x4f, 0xc2, 0xab, 0x22);")
360 // GUID for ALL - {2149A66E-F261-11d0-8C9C-00C04FC2AB22}
361 cpp_quote("DEFINE_GUID(ALL_FILE_TYPES, 0x2149a66e, 0xf261, 0x11d0, 0x8c, 0x9c, 0x0, 0xc0, 0x4f, 0xc2, 0xab, 0x22);")
363 typedef struct _VIEWPREFERENCES
365 // settings for text views
366 unsigned fVisibleWhitespace; // show spaces/tabs etc?
367 unsigned fSelectionMargin; // display selection margin?
368 unsigned fAutoDelimiterHighlight; // allow automatic delimiter highlighting?
369 unsigned fGoToAnchorAfterEscape; // go to anchor after escape?
370 unsigned fDragDropEditing; // drag/drop editing?
371 unsigned fUndoCaretMovements; // include caret movements and text selections in undo list?
372 unsigned fOvertype; // overtype/insert? - NOT persisted
373 unsigned fDragDropMove; // whether we allow drag/drop moves
374 unsigned fWidgetMargin; // show widget margin?
375 } VIEWPREFERENCES;
377 // Note that the issue of the frame providing scrollbars for views is totally different from the issue of
378 // whether a view itself should provide a scrollbar; a view itself providing a scrollbar is handled via
379 // flags to IVsTextViewInitialize and cannot ever change after that. What's being dealt with here is the
380 // issue of the MDI child frame providing scrollbars to views in editor windows, which CAN be customized
381 // by the user.
383 typedef struct _FRAMEPREFERENCES
385 // settings for the frame (MDI child)
386 unsigned fHorzScrollbar; // should frame display horz scrollbar for views
387 unsigned fVertScrollbar; // should frame display vert scrollbar for views?
388 } FRAMEPREFERENCES;
391 // preferences for color tables, which are used by anyone interested in painting text or markers
392 typedef struct _FONTCOLORPREFERENCES
395 If pguidColorService is NULL, it means that the caller doesn't have any color information to provide.
396 If *pguidColorService is DEFAULT_FILE_TYPE, it represents the base color table build with the stock
397 colorable item provider.
398 Note that pguidColorService is always set to either NULL or to point to a valid GUID by the allocator
399 of the FONTCOLORPREFERENCES struct.
401 #ifdef PROXYSTUB_BUILD
402 // This struct is used as [out] param by some methods, so it can not have const members.
403 GUID *pguidColorService; // the CLSID of an IVsProvideColorableItems implementor
404 #else
405 const GUID *pguidColorService; // the CLSID of an IVsProvideColorableItems implementor
406 #endif
409 pColorTable is a COM pointer to the color table for the colorable item provider indicated by *pguidColorService.
410 Note that this object will be created as a result of this call if it hadn't been created already.
411 This pointer is guaranteed to be valid if the FONTCOLORPREFERENCES struct is an in param to a function, but
412 naturally if you want to hold onto it beyond that you must AddRef (and later Release) it.
414 IUnknown *pColorTable;
417 hViewFont represents the fonts that are to be used by text views.
419 #ifdef PROXYSTUB_BUILD
420 LONG_PTR hRegularViewFont;
421 LONG_PTR hBoldViewFont;
422 #else
423 HFONT hRegularViewFont;
424 HFONT hBoldViewFont;
425 #endif
428 When IVsTextManagerEvents::OnUserPreferencesChanged is fired, the recipient of the event should check
429 these values. The recipient should only react to the change event if its own category GUIDs match
430 those of the FONTCOLORPREFERENCES struct.
432 #ifdef PROXYSTUB_BUILD
433 GUID *pguidFontCategory;
434 GUID *pguidColorCategory;
435 #else
436 const GUID *pguidFontCategory;
437 const GUID *pguidColorCategory;
438 #endif
440 } FONTCOLORPREFERENCES;
443 Start of new editor option property section
447 Editor options ID values:
450 typedef enum __VSEDITPROPID
452 // boundary member
453 VSEDITPROPID_LAST = -0x00000001,
455 // composite meta-property that sets an entire class of properties
456 VSEDITPROPID_ViewComposite_AllCodeWindowDefaults = -0x00010001, // BOOL must be TRUE; inits settings to code window defaults
458 // These are special properties that apply to a given view instance.
460 // These control whether the view tracks changes to Tools.Option / Environment / Text Editor
461 // VSEDITPROPID_ViewGeneral_DetachCommandToggledBehaviors = -0x00011001, // BOOL do setting toggle commands only affect current view?
463 // Other specific view behaviors
464 // VSEDITPROPID_ViewGeneral_OutliningEnabled = -0x00012001, // BOOL are the outlining commands enabled?
465 // VSEDITPROPID_ViewGeneral_MacroRecordingEnabled = -0x00012002, // BOOL is macro recording from this view enabled?
466 // VSEDITPROPID_ViewGeneral_GoBackSourcingEnabled = -0x00012003, // BOOL does this view drop go back markers?
467 VSEDITPROPID_ViewGeneral_FontCategory = -0x00012005, // BSTR category from which to load font info
468 VSEDITPROPID_ViewGeneral_ColorCategory = -0x00012006, // BSTR category from which to load color info
470 // These are properties for view behaviors that normally apply to all views.
471 VSEDITPROPID_ViewGlobalOpt_VisibleWhitespace = -0x00020001, // BOOL show spaces/tabs etc?
472 VSEDITPROPID_ViewGlobalOpt_Overtype = -0x00020002, // BOOL overtype/insert? - NOT persisted
473 VSEDITPROPID_ViewGlobalOpt_SelectionMargin = -0x00020003, // BOOL display selection margin?
474 // VSEDITPROPID_ViewGlobalOpt_ToAnchorAfterEsc = -0x00020004, // BOOL go to anchor after escape?
475 // VSEDITPROPID_ViewGlobalOpt_DragDropEditing = -0x00020005, // BOOL allow any drag/drop editing?
476 // VSEDITPROPID_ViewGlobalOpt_DragDropMove = -0x00020006, // BOOL whether we allow drag/drop moves (as opposed to just copies)
477 // VSEDITPROPID_ViewGlobalOpt_UndoCaretMoves = -0x00020007, // BOOL include caret movements and text selections in undo list?
478 // VSEDITPROPID_ViewGlobalOpt_WidgetMargin = -0x00020008, // BOOL show widget margin?
479 // VSEDITPROPID_ViewGlobalOpt_CaretToStartAfterPaste = -0x00020009, // BOOL whether caret goes to end after paste (support probably going away soon!)
480 VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry = -0x00020010, //BOOL wether the caret scrolls or not based on the last line of the buffer
482 // These are properties for view behaviors that normally apply per language.
483 VSEDITPROPID_ViewLangOpt_WordWrap = -0x00030001, // BOOL word wrap on?
484 // VSEDITPROPID_ViewLangOpt_TabSize = -0x00030002, // I4 width (in spaces) of a tab character
485 // VSEDITPROPID_ViewLangOpt_IndentSize = -0x00030003, // I4 width (in spaces) of an indent level
486 // VSEDITPROPID_ViewLangOpt_InsertTabs = -0x00030004, // BOOL whether to insert tabs (vs. keeping spaces)
487 // VSEDITPROPID_ViewLangOpt_IndentStyle = -0x00030005, // BOOL none/block/smart; see vsIndentStyle
488 VSEDITPROPID_ViewLangOpt_VirtualSpace = -0x00030006, // BOOL virtual space navigation/selection?
489 // VSEDITPROPID_ViewLangOpt_HotUrls = -0x00030007, // BOOL Single click URL navigation?
490 // VSEDITPROPID_ViewLangOpt_LineNumbers = -0x00030008, // BOOL line #'s visible in the view?
491 VSEDITPROPID_ViewLangOpt_RawTextDisplay = -0x00030009, // BOOL text is displayed in raw mode: no bidi layout, shaping, or combining
493 // These are properties that relate to font and color information for a particular category.
494 // VSEDITPROPID_ViewPaintOpt_ColorTable = -0x00040001, // UNK QI for IVsColorTable (private iface for text editor)
495 // VSEDITPROPID_ViewPaintOpt_PlainFontHandle = -0x00040002, // I4|BYREF plVal holds the HFONT of regular view font
496 // VSEDITPROPID_ViewPaintOpt_BoldFontHandle = -0x00040003, // I4|BYREF plVal holds the HFONT of bold view font
498 // These are properties for behaviors that apply to all editor MDI frame windows (code windows).
499 // VSEDITPROPID_FrameOpt_HorzScrollbar = -0x00050001, // BOOL should frame display horz scrollbar for views?
500 // VSEDITPROPID_FrameOpt_VertScrollbar = -0x00050002, // BOOL should frame display vert scrollbar for views?
501 VSEDITPROPID_FrameOpt_SuppressResizeWidget = -0x00050003, // BOOL should frame have a resize widget?
504 // These are properties that describe other info about language services
505 // VSEDITPROPID_ProgLang_LocalizedLangName = -0x00060001, // BSTR the localized name of the language type
506 // VSEDITPROPID_ProgLang_NonLocalizedLangName = -0x00060002, // BSTR the non-localized canonical name of the language type
507 VSEDITPROPID_ProgLang_DebuggerLanguages = -0x00060003, // UNK QI for IVsEnumGUID for the associated debugger languages
508 // VSEDITPROPID_ProgLang_ShowCompletionInOpt = -0x00060004, // BOOL whether the statement completion chkbox will be enabled in Tools.Options
509 // VSEDITPROPID_ProgLang_ShowSmartIndentInOpt = -0x00060005, // BOOL whether the statement completion chkbox will be enabled in Tools.Options
510 VSEDITPROPID_ProgLang_SuppressMultipleCodeWindows = -0x00060006, // BOOL whether the Window.NewWindow command should be disabled
511 VSEDITPROPID_ProgLang_SupportCF_HTML = -0x00060008, // BOOL whether the language service supports the CF_HTML clipboard format
512 // boundary member
513 VSEDITPROPID_FIRST = -0x7FFFFFFF
515 } VSEDITPROPID;
519 uuid(uuid_IVsTextEditorPropertyCategoryContainer)
521 interface IVsTextEditorPropertyCategoryContainer : IUnknown
523 HRESULT GetPropertyCategory([in] REFGUID rguidCategory, [out] IVsTextEditorPropertyContainer **ppProp);
527 uuid(uuid_IVsTextEditorPropertyContainer)
529 interface IVsTextEditorPropertyContainer : IUnknown
531 HRESULT GetProperty ([in] VSEDITPROPID idProp, [out] VARIANT *pvar);
532 HRESULT SetProperty ([in] VSEDITPROPID idProp, [in] VARIANT var);
533 HRESULT RemoveProperty ([in] VSEDITPROPID idProp);
536 // known editor property categories
538 // GUID for current view properties {89B22A38-2BC3-4816-A629-D3186DE786DA}
539 // cpp_quote("DEFINE_GUID(GUID_EditPropCategory_View_CurrentValues, 0x89b22a38, 0x2bc3, 0x4816, 0xa6, 0x29, 0xd3, 0x18, 0x6d, 0xe7, 0x86, 0xda);")
541 // GUID for view properties that override everything -- Tools.Options *and* user commands {D1756E7C-B7FD-49a8-B48E-87B14A55655A}
542 cpp_quote("DEFINE_GUID(GUID_EditPropCategory_View_MasterSettings, 0xd1756e7c, 0xb7fd, 0x49a8, 0xb4, 0x8e, 0x87, 0xb1, 0x4a, 0x55, 0x65, 0x5a);")
544 // GUID for text manager global properties {6BFB60A2-48D8-424e-81A2-040ACA0B1F68}
545 cpp_quote("DEFINE_GUID(GUID_EditPropCategory_TextMgr_Global, 0x6bfb60a2, 0x48d8, 0x424e, 0x81, 0xa2, 0x4, 0xa, 0xca, 0xb, 0x1f, 0x68);")
550 End of new editor option property section
555 /////////////////////////////////////////////////////////////////////////
556 // TextSelMode enum
557 /////////////////////////////////////////////////////////////////////////
558 typedef enum _TextSelMode
560 SM_STREAM,
561 SM_BOX
562 } TextSelMode;
564 /////////////////////////////////////////////////////////////////////////
565 // TextViewInitFlags enum
566 /////////////////////////////////////////////////////////////////////////
567 typedef enum _TextViewInitFlags
569 // note that these can exist in combinations and so are generally bitwise disjoint
571 VIF_DEFAULT = 0x00000000, // no view-owned scrollbars, and no forced settings
573 // For the scrolling flags we simply use the WS_ values for efficiency.
574 // Note that this setting is different from the MDI child scrollbars used by the text editor.
575 VIF_HSCROLL = 0x00100000, // WS_HSCROLL; indicates that the view should have a horizontal scrollbar
576 VIF_VSCROLL = 0x00200000, // WS_VSCROLL; indicates that the view should have a vertical scrollbar
578 VIF_UPDATE_STATUS_BAR = 0x00400000, // tells view to update status bar
580 // If you wish to force a certain setting upon a view, regardless of the user's editor preference settings,
581 // use these flags along with a VIEWPREFERENCES* into IVsTextView::Initialize() to force a given setting.
582 VIF_SET_WIDGET_MARGIN = 0x00000001, // use the widget margin setting from the VIEWPREFERENCES struct
583 VIF_SET_SELECTION_MARGIN = 0x00000002, // use the selection margin setting from the VIEWPREFERENCES struct
584 VIF_SET_VIRTUAL_SPACE = 0x00000004, // use the virtual space setting from the VIEWPREFERENCES struct
585 VIF_SET_INDENT_MODE = 0x00000008, // use the autoindent suppression setting from the VIEWPREFERENCES struct
586 VIF_SET_STREAM_SEL_MODE = 0x00000010, // OBSOLETE
587 VIF_SET_VISIBLE_WHITESPACE = 0x00000020, // use visible whitespace setting
588 VIF_SET_OVERTYPE = 0x00000040, // use overtype mode setting
589 VIF_SET_DRAGDROPMOVE = 0x00000080, // use dd move setting
590 VIF_SET_HOTURLS = 0x00000100 // use the Hot URLs setting
591 } TextViewInitFlags;
594 /////////////////////////////////////////////////////////////////////////
595 // INITVIEW - this is passed to IVsTextView::Initialize()
596 /////////////////////////////////////////////////////////////////////////
597 typedef struct _INITVIEW
599 unsigned fVirtualSpace;
600 unsigned fStreamSelMode;//OBSOLETE:ignored by core editor - needed until HTMED's view clone goes away
601 unsigned fOvertype;
602 unsigned fVisibleWhitespace;
603 unsigned fWidgetMargin;
604 unsigned fSelectionMargin;
605 unsigned fDragDropMove;
606 unsigned fHotURLs;
607 vsIndentStyle IndentStyle;
608 } INITVIEW;
610 ////////////////////////////////////////////////////////////////////////////
611 // CompletionStatusFlags enum
612 ////////////////////////////////////////////////////////////////////////////
613 typedef enum _CompletionStatusFlags
615 // UCS_* flags are passed to IVsTextView::UpdateCompletionStatus
616 UCS_NAMESCHANGED = 0x0001, // Names or name count has changed
617 UCS_EXTENTCHANGED = 0x0002, // Extent changed
618 UCS_FLAGSCHANGED = 0x0004, // Flags have changed...
619 UCS_COMPLETEWORD = 0x0008, // Attempt word completion
621 // CSF_* flags are returned from IVsCompletionSet::GetFlags
622 CSF_CUSTOMMATCHING = 0x0004, // Use ICompletionSet::GetBestMatch() to manage selection
623 CSF_CUSTOMCOMMIT = 0x0008, // Use ICompletionSet::OnCommit() to commit completions
624 CSF_HAVEDESCRIPTIONS = 0x0010, // ICompletionSet::GetDescriptionText will provide text for at least some of the entries
625 CSF_INITIALEXTENTKNOWN = 0x0020, // Use ICompletionSet::GetInitialExtent to determine initial word extent
626 CSF_NOCASEMATCHING = 0x0040, // Don't apply case sensitive matching
627 CSF_NOCASEUNIQUENESS = 0x0080, // Don't apply case as well as character matching to determine uniqueness (for word completion)
629 // GBM_* flags are returned from IVsCompletionSet::GetBestMatch
630 GBM_SELECT = 0x0001, // The returned index should be selected
631 GBM_UNIQUE = 0x0002 // The returned index is the only appropriate match
633 } UpdateCompletionFlags;
635 /////////////////////////////////////////////////////////////////////////
636 // IVsCompletionSet interface
637 /////////////////////////////////////////////////////////////////////////
639 uuid(uuid_IVsCompletionSet)
641 interface IVsCompletionSet : IUnknown
643 // Flags indicating specific behaviors of this completion set (CSF_* above)
644 #ifdef PROXYSTUB_BUILD
645 HRESULT GetFlags (void);
646 #else
647 DWORD GetFlags (void);
648 #endif
650 // Get the number of available completions (assert > 1?)
651 #ifdef PROXYSTUB_BUILD
652 // Note that it is safe to return a HRESULT because, according with WinNT.h HRESULT is a typedef for long
653 HRESULT GetCount(void);
654 #else
655 long GetCount(void);
656 #endif
658 // Get the text of a completion, as it is to be displayed in the list.
659 // The pointer returned should be maintained by the completion set
660 // object, and remain valid until final release, or until updated
661 // through IVsTextView::UpdateCompletionStatus
662 #ifdef PROXYSTUB_BUILD
663 // The MIDL compiler dosn't allow an out parameter to be const.
664 HRESULT GetDisplayText ([in] long iIndex, [out] WCHAR **ppszText, [out, optional] long *piGlyph);
665 #else
666 HRESULT GetDisplayText ([in] long iIndex, [out] const WCHAR **ppszText, [out, optional] long *piGlyph);
667 #endif
669 // Get the list of images (glyphs) supported by this completion set.
670 // UNDONE: Define HIMAGELIST so we don't have to cast...
671 HRESULT GetImageList ([out] HANDLE *phImages);
673 // Return text describing the indicated item
674 HRESULT GetDescriptionText ([in] long iIndex, [out] BSTR *pbstrDescription);
676 // Get the initial extent of the word to be completed. *piEndCol
677 // should an index on the line *piLine
678 HRESULT GetInitialExtent ([out] long *piLine, [out] long *piStartCol, [out] long *piEndCol);
680 // Determine the index of the closest matching completion, given
681 // what has been typed so far. Note that this is only called if
682 // CSF_CUSTOMMATCHING is set in this completion set's flags. If
683 // *pdwFlags is set to contain one of the GBM_* flags
684 // The default matching in the view uses case sensitive comparison.
685 HRESULT GetBestMatch ([in] const WCHAR *pszSoFar, [in] long iLength, [out] long *piIndex, [out] DWORD *pdwFlags);
687 // Commit a completion. This is only called if the completion set's flags
688 // include CSF_CUSTOMCOMMIT. If a word should be completed, return S_OK
689 // with *pszCompleteWord set to the completion text. By default this is the
690 // text returned by GetDisplayText. Normally a word should be completed
691 // when fSelected is TRUE and cCommit is a commit character. Return S_FALSE
692 // if the word shouldn't be completed. The default behaviour is to set
693 // *pstrCompleteWord to pszSoFar.
695 HRESULT OnCommit ([in] const WCHAR *pszSoFar, [in] long iIndex, [in] BOOL fSelected, [in] WCHAR cCommit, [out] BSTR *pbstrCompleteWord);
697 // Called by the view when the completion set is no longer needed.
698 // Note that if a language filter wants to force a dismiss of a completion
699 // set, it calls IVsTextView::UpdateCompletionStatus with pCompSet == NULL;
700 // if the view has a completion set pointer cached, it calls Dismiss()
701 // on it and then releases it (and also removes the UI, etc).
702 #ifdef PROXYSTUB_BUILD
703 HRESULT Dismiss (void);
704 #else
705 void Dismiss (void);
706 #endif
709 /////////////////////////////////////////////////////////////////////////
710 // TipWindowFlags enum
711 /////////////////////////////////////////////////////////////////////////
712 typedef enum _TipWindowFlags
714 UTW_CONTEXTCHANGED = 0x0001, // Context stream is different
715 UTW_CONTENTCHANGED = 0x0002, // Data displayed in window has changed (size will be re-queried)
716 UTW_DISMISS = 0x0004, // Tip window should be dismissed
717 } TipWindowFlags;
719 ////////////////////////////////////////////////////////////////////////////
720 // TipPosPreference enum
721 ////////////////////////////////////////////////////////////////////////////
722 typedef enum _TipPosPreference
724 TPP_ABOVE,
725 TPP_BELOW,
726 TPP_LEFT,
727 TPP_RIGHT,
728 TPP_DOCKED // Current NYI -- defaults to TPP_ABOVE
729 } TipPosPreference;
731 ////////////////////////////////////////////////////////////////////////////
732 // TIPSIZEDATA structure
733 ////////////////////////////////////////////////////////////////////////////
734 typedef struct _tipsizedata
736 SIZE size;
737 TipPosPreference dwPosition; // NOTE: this field is ignored in VS99
738 } TIPSIZEDATA;
740 ////////////////////////////////////////////////////////////////////////////
741 // IVsTipWindow interface
742 ////////////////////////////////////////////////////////////////////////////
744 #ifdef PROXYSTUB_BUILD
745 // MIDL2269
746 local,
747 #endif
748 uuid(uuid_IVsTipWindow)
750 interface IVsTipWindow : IUnknown
752 // Return the context stream (the position and length of text in the
753 // buffer that should not be obscured by the tip window, but to which
754 // the content of the tip is related).
755 HRESULT GetContextStream ([out] long *piPos, [out] long *piLength);
757 // Get the size preferences for this tip window. Note that implementations
758 // should be written to handle cases where the size preference they
759 // return here are not what they are given for real estate in which to
760 // display content. (i.e., it may not be possible to provide the
761 // tip window in the requested size). prcCtxBounds represents the bounding
762 // rectangle of the tip's context should the implementation be interested.
763 // (This rectangle is provided in screen coordinates).
764 HRESULT GetSizePreferences ([out] const RECT *prcCtxBounds, [out] TIPSIZEDATA *pSizeData);
766 // Paint the tip window.
767 HRESULT Paint ([in] HDC hdc, [in] const RECT *prc);
769 // The window is being dismissed by the view.
770 void Dismiss (void);
772 // Event handler for the tip window
773 LRESULT WndProc ([in] HWND hwnd, [in] UINT iMsg, [in] WPARAM wParam, [in] LPARAM lParam);
776 /////////////////////////////////////////////////////////////////////////
777 // IVsMethodTipWindow interface
778 /////////////////////////////////////////////////////////////////////////
780 uuid(uuid_IVsMethodTipWindow)
782 interface IVsMethodTipWindow : IVsTipWindow
784 HRESULT SetMethodData ([in] IVsMethodData *pMethodData);
787 /////////////////////////////////////////////////////////////////////////
788 // IVsTextTipWindow interface
789 /////////////////////////////////////////////////////////////////////////
791 uuid(uuid_IVsTextTipWindow)
793 interface IVsTextTipWindow : IVsTipWindow
795 HRESULT SetTextTipData([in] IVsTextTipData *pMethodData);
798 /////////////////////////////////////////////////////////////////////////
799 // MethodTextType enum
800 /////////////////////////////////////////////////////////////////////////
801 typedef enum _MethodTextType
803 // Note that GetMethodText can return NULL for any of these types except NAME.
804 // Any that it does not will be displayed. Format is as follows:
805 // [TYPEPREFIX] [NAME] ( <parms> ) [TYPEPOSTFIX]
806 // [DESCRIPTION]
807 MTT_TYPEPREFIX, // return type if prefixed, ala C++ ("long foo()")
808 MTT_TYPEPOSTFIX, // return type if postfixed, ala Basic ("foo() as long") (text must include "as" keyword)
809 MTT_NAME, // Method name
810 MTT_DESCRIPTION, // Description of method (gets its own line)
811 MTT_OPENBRACKET, // Open bracket delimiter. default is paren
812 MTT_CLOSEBRACKET, // Close bracket delimiter. default is paren
813 MTT_DELIMITER // Parameter delimiter. default is ", ". You must specify the space if you want one
814 } MethodTextType;
816 /////////////////////////////////////////////////////////////////////////
817 // ParameterTextType enum
818 /////////////////////////////////////////////////////////////////////////
819 typedef enum _ParameterTextType
821 // Note that GetParameterText can return NULL for any except DECLARATION, and NAME if DESCRIPTION is non-NULL.
822 PTT_DECLARATION, // full decl as it appears in signature (i.e. "long x", or "x as long")
823 PTT_NAME, // parameter name only (i.e. "x")
824 PTT_DESCRIPTION // description (gets its own line, and is prefixed with NAME: (bolded))
825 } ParameterTextType;
827 /////////////////////////////////////////////////////////////////////////
828 // IVsMethodData interface
829 /////////////////////////////////////////////////////////////////////////
831 #ifdef PROXYSTUB_BUILD
832 // MIDL2269
833 local,
834 #endif
835 uuid(uuid_IVsMethodData)
837 interface IVsMethodData : IUnknown
839 long GetOverloadCount (void);
840 const WCHAR * GetMethodText ([in] long iMethod, [in] MethodTextType type);
841 long GetParameterCount ([in] long iMethod);
842 const WCHAR * GetParameterText ([in] long iMethod, [in] long iParm, [in] ParameterTextType type);
843 long GetCurrentParameter ([in] long iMethod);
844 HRESULT GetContextStream ([out] long *piPos, [out] long *piLength);
845 void OnDismiss (void);
846 long GetCurMethod (void);
847 void UpdateView (void);
848 long NextMethod (void);
849 long PrevMethod (void);
852 /////////////////////////////////////////////////////////////////////////
853 // IVsTextTipData interface
854 /////////////////////////////////////////////////////////////////////////
856 uuid(uuid_IVsTextTipData)
858 interface IVsTextTipData : IUnknown
860 HRESULT GetTipText ([out, custom(uuid_IVsTextTipData, "optional")] BSTR *pbstrText, [out] BOOL *pfGetFontInfo);
862 // NOTE: *pdwFontAttr will already have been memset-ed to zeroes, so you can set only the indices that are not normal
863 HRESULT GetTipFontInfo (
864 [in] long cChars,
865 [out, size_is(cChars)] ULONG *pdwFontAttr);
866 HRESULT GetContextStream ([out] long *piPos, [out] long *piLength);
867 #ifdef PROXYSTUB_BUILD
868 HRESULT OnDismiss (void);
869 HRESULT UpdateView (void);
870 #else
871 void OnDismiss (void);
872 void UpdateView (void);
873 #endif
876 /////////////////////////////////////////////////////////////////////////
877 // IVsTextView interface
879 // Represents an editor window.
880 /////////////////////////////////////////////////////////////////////////
882 uuid(uuid_IVsTextView)
884 interface IVsTextView : IUnknown
887 WARNING: this interface is not thread-safe. You should not call anything on this
888 interface from anything but the main UI thread.
890 If you need to perform any operations on the view from a different thread, you may
891 either:
892 1) use IVsThreadSafeTextView
893 2) call IVsTextView::GetWindowHandle and use ::PostMessage to post messages to the main thread
896 // Initialize creates the view and lets clients specify one or more TextViewInitFlags options from above
897 HRESULT Initialize ([in] IVsTextLines *pBuffer, [in] HWND hwndParent,
898 [in] DWORD InitFlags, [in] const INITVIEW *pInitView); // TextViewInitFlags values OR'ed together
899 // Close -- this unregisters this view with the view manager
900 HRESULT CloseView (void);
902 // Caret (insertion point) management. GetCaretPos will return the coordinates
903 // of the end point of a selection if there is one. piLine and/or piColumn can
904 // be null if only one or the other is needed.
905 HRESULT GetCaretPos ([out] long *piLine, [out] ViewCol *piColumn);
906 HRESULT SetCaretPos ([in] long iLine, [in] ViewCol iColumn);
908 // like GetSelection, but returns a TextSpan with buffer coordinates; returns S_FALSE if there's no selection
909 HRESULT GetSelectionSpan ([out] TextSpan *pSpan);
911 // Selection management. As with GetCaretPos, any of GetSelection's parameters can
912 // be NULL if they are not desired. GetSelection will return S_FALSE if there is
913 // currently no selection.
914 HRESULT GetSelection ([out] long *piAnchorLine, [out] ViewCol *piAnchorCol, [out] long *piEndLine, [out] ViewCol *piEndCol);
915 HRESULT SetSelection ([in] long iAnchorLine, [in] ViewCol iAnchorCol, [in] long iEndLine, [in] ViewCol iEndCol);
916 #ifdef PROXYSTUB_BUILD
917 HRESULT GetSelectionMode (void);
918 #else
919 TextSelMode GetSelectionMode (void);
920 #endif
921 HRESULT SetSelectionMode ([in] TextSelMode iSelMode);
922 HRESULT ClearSelection ([in] BOOL fMoveToAnchor);
924 // Place the specified lines of text in the center of the view
925 HRESULT CenterLines ([in] long iTopLine, [in] long iCount);
927 // Return a copy of the selected text
928 HRESULT GetSelectedText ([out] BSTR * pbstrText);
930 // Same, in IDataObject form
931 HRESULT GetSelectionDataObject ([out] IDataObject **ppIDataObject);
933 // Get a specified stream of text
934 HRESULT GetTextStream ([in] long iTopLine, [in] ViewCol iTopCol, [in] long iBottomLine, [in] ViewCol iBottomCol, [out] BSTR * pbstrText);
936 // Text buffer access
937 HRESULT GetBuffer ([out] IVsTextLines **ppBuffer);
938 HRESULT SetBuffer ([in] IVsTextLines *pBuffer);
940 // Get window handle for this view
941 #ifdef PROXYSTUB_BUILD
942 // NOTE: We need to change this return value in order to let the MIDL compiler compile this file, anyway it is possible
943 // that this will not work on 64bit builds: HWND==HANDLE==void*, but HRESULT==long
944 HRESULT GetWindowHandle (void);
945 #else
946 HWND GetWindowHandle (void);
947 #endif
949 // Scrolling control
950 HRESULT GetScrollInfo ([in] long iBar, [out] long *piMinUnit, [out] long *piMaxUnit, [out] long *piVisibleUnits, [out] long *piFirstVisibleUnit);
951 HRESULT SetScrollPosition ([in] long iBar, [in] long iFirstVisibleUnit);
953 // Command Target chaining
954 HRESULT AddCommandFilter ([in] IOleCommandTarget *pNewCmdTarg, [out] IOleCommandTarget **ppNextCmdTarg);
955 HRESULT RemoveCommandFilter ([in] IOleCommandTarget *pCmdTarg);
957 // Word completion control
958 HRESULT UpdateCompletionStatus ([in] IVsCompletionSet *pCompSet, [in] DWORD dwFlags);
960 // Tip window control
961 HRESULT UpdateTipWindow ([in] IVsTipWindow *pTipWindow, [in] DWORD dwFlags);
963 // Word extent
964 HRESULT GetWordExtent ([in] long iLine, [in] CharIndex iCol, [in] DWORD dwFlags, [out] TextSpan *pSpan);
966 // Reduces view's range of visible / editable lines to a subset of the buffer's
967 HRESULT RestrictViewRange ([in] long iMinLine, [in] long iMaxLine, [in] IVsViewRangeClient *pClient);
969 // Editing function(s)
970 HRESULT ReplaceTextOnLine ([in] long iLine, [in] CharIndex iStartCol, [in] long iCharsToReplace, [in] const WCHAR *pszNewText, [in] long iNewLen);
972 // Line-Col to/from Position conversion. Note that GetNearestPosition will
973 // account for virtual space, and provide the position of the EOL marker
974 // on the given line if the column is in virtual space (or at the end)
975 HRESULT GetLineAndColumn ([in] long iPos, [out] long *piLine, [out] CharIndex *piIndex);
976 HRESULT GetNearestPosition ([in] long iLine, [in] ViewCol iCol, [out] long *piPos, [out] long *piVirtualSpaces);
978 // Used to force the view to update its frame window caption for things like
979 // [Read only] files.
980 HRESULT UpdateViewFrameCaption();
982 // Place the specified column of text in the center of the view
983 // NOTE: this is ill-defined in the case of word wrap!!
984 HRESULT CenterColumns ([in] long iLine, [in] ViewCol iLeftCol, [in] long iColCount);
986 // Will make sure text is in view both vertically & horizontally.
987 HRESULT EnsureSpanVisible([in] TextSpan span);
989 // This method will put the caret in a position suitable for editing a function. If there is text on
990 // the line, the caret will go to the first non-whitespace text. Otherwise, it will create cIndentLevels
991 // of whitespace per the current language settings and put the caret there. No centering is done.
992 HRESULT PositionCaretForEditing(
993 [in] long iLine,
994 [in] long cIndentLevels);
996 // Client pixel coordinates of the specified line and column
997 HRESULT GetPointOfLineColumn ([in] long iLine, [in] ViewCol iCol, [out, retval] POINT * ppt);
999 // Pixel height of a line
1000 HRESULT GetLineHeight ([out, retval] long * piLineHeight);
1002 HRESULT HighlightMatchingBrace([in] DWORD dwFlags, [in] ULONG cSpans, [in, size_is(cSpans)] TextSpan *rgBaseSpans);
1004 // To send explicit focus to the window. Reglar send focus messages post a GimmeFocus message. This directly sends it.
1005 HRESULT SendExplicitFocus();
1007 // Sets the top line in the view to the base line
1008 HRESULT SetTopLine([in] long iBaseLine);
1011 /////////////////////////////////////////////////////////////////////////
1012 // IVsThreadSafeTextView interface
1014 // This is a thread-safe subset of IVsTextView. All these methods do is
1015 // post messages to the main thread, which then calls the regular handlers.
1016 /////////////////////////////////////////////////////////////////////////
1018 uuid(uuid_IVsThreadSafeTextView)
1020 interface IVsThreadSafeTextView : IUnknown
1022 HRESULT ThreadSafeSetCaretPos ([in] long iLine, [in] ViewCol iColumn);
1025 typedef enum _GetSelectedAtomFlags
1027 gsaDefault = 0 // matches an atom when the selection is 1) empty & to the left of it, or 2) exactly selecting it
1028 } GetSelectedAtomFlags;
1031 typedef enum _SELECTIONSTATEFLAGS
1033 ssfDefault = 0,
1034 ssfColumn = 1
1035 } SELECTIONSTATEFLAGS;
1038 SELECTIONSTATE
1040 This struct represents the state of a selection such that it can be restored to a particular
1041 state.
1043 typedef struct _SELECTIONSTATE
1045 ViewCol iAnchorCol; // WARNING: this is a ViewCol, NOT a CharIndex! It may be past the end of the physical line.
1046 long iAnchorLine;
1047 ViewCol iActiveCol; // WARNING: this is a ViewCol, NOT a CharIndex! It may be past the end of the physical line.
1048 long iActiveLine;
1049 DWORD dwFlags; // ORing of SELECTIONSTATEFLAGS enum
1050 DWORD dwReserved; // unused for now
1051 } SELECTIONSTATE;
1054 typedef enum _RelativeSelectionStateFlags
1056 RSS_DEFAULT = 0x0, // coords relative to the top view layer
1057 RSS_TOP_LAYER = 0x0, // coords relative to the top view layer
1058 RSS_BUFFER = 0x1, // coords relative to the buffer
1059 RSS_RELATIVE_LAYER = 0x2, // coords relative to the layer * specified in pReference
1061 RSS_TRACKSEL = 0x010,
1062 // flags for SetRelativeSelection
1063 RSS_SET_WITHOUT_SCROLLING = 0x1000, // tells the view to not scroll to force the selection to be visible
1064 RSS_SET_TO_NEAREST_LOCAL = 0x2000, // for RSS_BUFFER or RSS_RELATIVE_LAYER, tells the view to put the caret at the nearest local position
1066 // old flags for compatibility
1067 rssDefault = RSS_DEFAULT,
1068 rssTopLayer = RSS_TOP_LAYER,
1069 rssBuffer = RSS_BUFFER,
1070 rssRelativeLayer = RSS_RELATIVE_LAYER,
1071 rssTrackSel = RSS_TRACKSEL
1073 } RelativeSelectionStateFlags;
1077 IVsLayeredTextView interface
1079 This is another interface exposed by text views. Its purpose is to help interact with
1080 non-buffer layer modules in the view. By default it methods operate on the top view layer.
1083 uuid(uuid_IVsLayeredTextView)
1085 interface IVsLayeredTextView : IUnknown
1088 GetSelectedAtom tells a client when the selection is "at" an atomic object, "at" being
1089 defined by dwFlags. An atomic object is a special object inserted into the regular
1090 text stream, such as a hidden text banner. The returned IUnknown is a pointer to the
1091 object that corresponds to the atom; QI it for whatever custom interface might be of
1092 interest.
1094 Return values:
1095 S_OK: found it
1096 S_FALSE: didn't find it
1098 HRESULT GetSelectedAtom(
1099 [in] DWORD dwFlags, // ORing of GetSelectedAtomFlags values
1100 [out] IUnknown **ppunkAtom);
1103 Get/SetRelativeSelectionState get and set the selection relative to a specified layer.
1105 S_OK is the only success code. Anything else indicates a serious failure.
1107 HRESULT GetRelativeSelectionState(
1108 [in] DWORD dwFlags, // ORing of RelativeSelectionStateFlags values
1109 [in] IVsTextLayer *pReferenceLayer, // must be NULL unless rssRelativeLayer is specified
1110 [out] SELECTIONSTATE *pSelState); // caller-allocated
1112 HRESULT SetRelativeSelectionState(
1113 [in] DWORD dwFlags, // ORing of RelativeSelectionStateFlags values
1114 [in] IVsTextLayer *pReferenceLayer, // must be NULL unless rssRelativeLayer is specified
1115 [in] SELECTIONSTATE *pSelState); // caller-allocated
1117 HRESULT GetTopmostLayer([out] IVsTextLayer **ppLayer); // the view's top-level layer representation
1120 ////////////////////////////////////////////////////////////////////////////
1121 // WORDEXTFLAGS enum
1122 ////////////////////////////////////////////////////////////////////////////
1123 typedef enum _wordextflags
1125 WORDEXT_MOVETYPE_MASK = 0x0003,
1126 WORDEXT_CURRENT = 0x0000, // Finds word/token containing iPos (if any) (default)
1127 WORDEXT_PREVIOUS = 0x0001, // Finds nearest word/token whose last character is < iPos
1128 WORDEXT_NEXT = 0x0002, // Finds nearest word/token whose 1st character is > iPos
1129 WORDEXT_NEAREST = 0x0003, // Finds word/token nearest to iPos
1132 A few words about WORDEXT_FINDWORD vs. WORDEXT_FINDTOKEN.
1134 Here's the way WORD extent is intended to be used, and the way the editor interprets
1135 them for it's operations. If these semantics are implemented as described, we get the
1136 nicest double click, word select, ctrl+drag behaviors.
1138 For programming languages:
1139 "WORD" is
1140 keyword
1141 | identifier
1142 | number
1144 "TOKEN" is
1145 WORD
1146 | operator e.g. ++, --, ->, %, |=, ==
1147 | delimiter e.g. ", /, //, star+slash, slash+start
1148 | run of whitespace
1151 In other words:
1153 WORDEXT_FINDWORD means that you would send back something that corresponds to a keyword,
1154 number, or identifier. So for "a[1]", the "a" or the "1" would be valid runs for it to
1155 return, but not anything else (such as the whole expression).
1157 WORDEXT_FINDTOKEN means that you would find anything that matches WORDEXT_FINDWORD, *or*
1158 you would find operators, delimiters, or runs of whitespace. So for "a[1]", any single
1159 char of the string could match, but not any larger chunk of it. Note that "token" as
1160 used here has nothing to do with what might be considered a language token in the sense
1161 of compiler terminology. (Perhaps an unfortunate choice of names.)
1163 WORDEXT_FINDWORD = 0x0000, // Finds words only (default)
1164 WORDEXT_FINDTOKEN = 0x0004, // Finds words and tokens
1165 WORDEXT_FINDEXPRESSION = 0x0008, // Find simple expressions, like *pFoo
1167 } WORDEXTFLAGS;
1169 ////////////////////////////////////////////////////////////////////////////
1170 // IVsTextViewFilter interface
1171 ////////////////////////////////////////////////////////////////////////////
1173 uuid(uuid_IVsTextViewFilter)
1175 interface IVsTextViewFilter : IUnknown
1177 // Word extent calculation
1178 HRESULT GetWordExtent (
1179 [in] long iLine,
1180 [in] CharIndex iIndex,
1181 [in] DWORD dwFlags,
1182 [out] TextSpan * pSpan);
1184 // Data-tip support. piPos and piLength are in/out -- they indicate the selected characters
1185 // on the way in, and indicate the bounding context of the tip on the way out.
1186 HRESULT GetDataTipText (
1187 [in, out] TextSpan * pSpan,
1188 [out] BSTR * pbstrText);
1190 HRESULT GetPairExtents([in] long iLine, [in] CharIndex iIndex, [out] TextSpan * pSpan);
1193 ////////////////////////////////////////////////////////////////////////////
1194 // LanguageContextHint enum
1196 // Used as a param for IVsLanguageContextProvider.
1198 ////////////////////////////////////////////////////////////////////////////
1199 typedef enum _LanguageContextHint
1201 LCH_DEFAULT = 0x00000000, // typical idle-time update; should be as fast as possible
1202 LCH_F1_HELP = 0x00000001 // means that the context will be used for F1 handling; OK to take longer
1203 } LanguageContextHint;
1205 ////////////////////////////////////////////////////////////////////////////
1206 // IVsLanguageContextProvider interface
1208 // Optional interface that the language service can expose. This lets the
1209 // view "pull" data from the language service at an appropriate time.
1211 ////////////////////////////////////////////////////////////////////////////
1213 uuid(uuid_IVsLanguageContextProvider)
1215 interface IVsLanguageContextProvider : IUnknown
1218 ProvideContext return values:
1219 - S_OK: the implementor has added whatever context should be added
1220 - any other success code: forbidden (caller will assert)
1221 - any failure code: means the implementor is "passing" on this opportunity to provide context and the text editor will fall back to other mechanisms
1223 HRESULT UpdateLanguageContext(
1224 DWORD dwHint, // ORing of LanguageContextHint enum values
1225 IVsTextLines *pBuffer, // buffer in question
1226 TextSpan *ptsSelection, // relevant range of text
1227 IVsUserContext *pUC // context to update
1231 ////////////////////////////////////////////////////////////////////////////
1232 // IVsTextMarkerContextProvider interface
1234 // Optional interface that a text marker client can expose. This lets the
1235 // view "pull" data from the marker client at an appropriate time. Note that
1236 // an implementor is responsible for both adding and removing its contribution
1237 // at an appropriate time.
1239 // Note also that text marker contributions are strictly a supplement to other
1240 // context contribution mechanisms. Regardless of whether this fn ends up
1241 // adding context, the view's other mechanisms for gathering context will still
1242 // apply.
1244 // If a marker has the MV_CONTEXT_CONTRIBUTION_FOR_BODY style set, its client
1245 // will be QI'd for this.
1247 ////////////////////////////////////////////////////////////////////////////
1249 uuid(uuid_IVsTextMarkerContextProvider)
1251 interface IVsTextMarkerContextProvider : IUnknown
1254 When UpdateContextForMarker() is called, the client should add relevant context to the IVsUserContext *.
1256 Return values:
1257 - S_OK: the implementor has added whatever context should be added, and the editor will call
1258 RemoveLastContext at the next context update time
1259 - any other success code: forbidden (caller will assert)
1260 - any failure code: means the implementor is "passing" on this opportunity to provide context and the
1261 text editor will fall back to other mechanisms; RemoveLastContext will not be called
1263 HRESULT UpdateContextForMarker(
1264 DWORD dwReserved, // should be 0
1265 IVsUserContext *pUC // context to update
1268 //There is no longer any need to implement this method V7-124350
1269 HRESULT RemoveLastContext(
1270 DWORD dwReserved, // should be 0
1271 IVsUserContext *pUC); // context to update
1274 /////////////////////////////////////////////////////////////////////////
1275 // TextViewAction enum
1276 /////////////////////////////////////////////////////////////////////////
1277 typedef enum _TextViewAction
1279 TVA_SETCARETPOS, // Caret (insertion point) management
1280 TVA_CENTERLINES // Place the specified lines of text in the center of the view
1281 } TextViewAction;
1283 /////////////////////////////////////////////////////////////////////////////////
1284 // IVsViewRangeClient interface
1285 /////////////////////////////////////////////////////////////////////////////////
1287 uuid(uuid_IVsViewRangeClient)
1289 interface IVsViewRangeClient : IUnknown
1291 HRESULT AdjustViewRange([in] IVsTextView *pView, [in] TextViewAction action, [in] long iLine, [in] long iCount);
1295 ////////////////////////////////////////////////////////////////////////////
1296 // IVsTextViewEvents interface
1297 ////////////////////////////////////////////////////////////////////////////
1299 uuid(uuid_IVsTextViewEvents)
1301 interface IVsTextViewEvents : IUnknown
1303 #ifdef PROXYSTUB_BUILD
1304 HRESULT OnSetFocus ([in] IVsTextView *pView);
1305 HRESULT OnKillFocus ([in] IVsTextView *pView);
1306 HRESULT OnSetBuffer ([in] IVsTextView *pView, [in] IVsTextLines *pBuffer);
1307 HRESULT OnChangeScrollInfo ([in] IVsTextView *pView, [in] long iBar, [in] long iMinUnit, [in] long iMaxUnits, [in] long iVisibleUnits, [in] long iFirstVisibleUnit);
1308 HRESULT OnChangeCaretLine([in] IVsTextView *pView, [in] long iNewLine, [in] long iOldLine);
1309 #else
1310 void OnSetFocus ([in] IVsTextView *pView);
1311 void OnKillFocus ([in] IVsTextView *pView);
1312 void OnSetBuffer ([in] IVsTextView *pView, [in] IVsTextLines *pBuffer);
1313 void OnChangeScrollInfo ([in] IVsTextView *pView, [in] long iBar, [in] long iMinUnit, [in] long iMaxUnits, [in] long iVisibleUnits, [in] long iFirstVisibleUnit);
1316 New code should not use OnChangeCaretLine. If anything, you should use our new line commit
1317 events, IVsPreliminaryTextChangeCommitEvents and IVsFinalTextChangeCommitEvents.
1319 void OnChangeCaretLine([in] IVsTextView *pView, [in] long iNewLine, [in] long iOldLine);
1320 #endif
1324 ////////////////////////////////////////////////////////////////////////////
1325 // IVsTextManager interface
1326 ////////////////////////////////////////////////////////////////////////////
1328 uuid(uuid_IVsTextManager)
1330 interface IVsTextManager : IUnknown
1332 // Register a view
1333 HRESULT RegisterView ([in] IVsTextView *pView, [in] IVsTextBuffer *pBuffer);
1335 // Unregister a view
1336 HRESULT UnregisterView ([in] IVsTextView *pView);
1338 // Enumerate views. Pass NULL for pBuffer to get all views.
1339 HRESULT EnumViews ([in] IVsTextBuffer *pBuffer, [out] IVsEnumTextViews **ppEnum);
1341 // Create an IAction object that remembers/sets selection in a view on
1342 // a given buffer
1343 HRESULT CreateSelectionAction ([in] IVsTextBuffer *pBuffer, [out] IVsTextSelectionAction **ppAction);
1345 // Given a file name, determine the registered language service that
1346 // understands it (if one exists)
1347 HRESULT MapFilenameToLanguageSID ([in] const WCHAR *pszFileName, [out] GUID *pguidLangSID);
1349 // Marker registration
1351 // Used to obtain the marker ID of a registered marker type. The marker ID can then be used with IVsTextLines::CreateLineMarker() or IVsTextStream::CreateStreamMarker().
1352 HRESULT GetRegisteredMarkerTypeID([in] const GUID *pguidMarker, [out] long *piMarkerTypeID);
1353 HRESULT GetMarkerTypeInterface ([in] long iMarkerTypeID, [out] IVsTextMarkerType **ppMarkerType);
1354 HRESULT GetMarkerTypeCount ([out] long *piMarkerTypeCount);
1356 // Get the currently active (or last active) text view. Pass NULL for pBuffer
1357 // to get the [last] active view on any buffer.
1358 HRESULT GetActiveView ([in] BOOL fMustHaveFocus, [in] IVsTextBuffer *pBuffer, [out] IVsTextView **ppView);
1360 // Gets user preferences for things like tab usage, indent size, widget margin presence, etc.
1362 // For the LANGPREFERENCES member, specify the language in question by setting
1363 // pLangPrefs->guidLang to the language SID.
1364 HRESULT GetUserPreferences ([out] VIEWPREFERENCES * pViewPrefs, // struct is caller-allocated
1365 [out] FRAMEPREFERENCES * pFramePrefs, // struct is caller-allocated
1366 [in, out] LANGPREFERENCES * pLangPrefs, // struct is caller-allocated
1367 [in, out] FONTCOLORPREFERENCES * pColorPrefs);
1368 HRESULT SetUserPreferences ([in] const VIEWPREFERENCES * pViewPrefs,
1369 [in] const FRAMEPREFERENCES * pFramePrefs,
1370 [in] const LANGPREFERENCES * pLangPrefs,
1371 [in] const FONTCOLORPREFERENCES * pColorPrefs);
1373 HRESULT SetFileChangeAdvise([in] const WCHAR *pszFileName, [in] BOOL fStart);
1374 HRESULT SuspendFileChangeAdvise([in] const WCHAR *pszFileName, [in] BOOL fSuspend);
1376 HRESULT NavigateToPosition( [in] IVsTextBuffer * pBuffer,
1377 [in] REFGUID guidDocViewType,
1378 [in] long iPos,
1379 [in] long iLen);
1380 HRESULT NavigateToLineAndColumn([in] IVsTextBuffer* pBuffer, [in] REFGUID guidDocViewType,
1381 [in] long iStartRow, [in] CharIndex iStartIndex,
1382 [in] long iEndRow, [in] CharIndex iEndIndex);
1384 // OBSOLETE: use GetBufferSccStatus2 instead
1385 // returns S_OK if the buffer is under SCC, and S_FALSE if not. If it is, *pbNonEditable
1386 // will reflect whether the file is checked in or not.
1387 HRESULT GetBufferSccStatus([in] IVsUserData *pBufData, [out] BOOL *pbNonEditable);
1389 // Buffer Registration -- all buffers must register/unregister with the
1390 // text mgr service in order to get things like change notifications, etc.
1391 // NOTE ALSO that in order to avoid circular reference problems, UnregisterBuffer
1392 // should be called from the buffer's implementation of IVsPersistDocData::Close(),
1393 // which is called from the running document table.
1394 HRESULT RegisterBuffer ([in] IVsTextBuffer *pBuffer);
1395 HRESULT UnregisterBuffer ([in] IVsTextBuffer *pBuffer);
1397 // Buffer enumeration (NOTE: Currently NYI...)
1398 HRESULT EnumBuffers ([out] IVsEnumTextBuffers **ppEnum);
1400 // Gets/Set per-language preferences - ONLY WORKS DURING TOOLS.OPTIONS dialog lifetime
1401 HRESULT GetPerLanguagePreferences ([out] LANGPREFERENCES *pLangPrefs);
1402 HRESULT SetPerLanguagePreferences ([in] const LANGPREFERENCES *pLangPrefs);
1404 // OBSOLETE: use AttemptToCheckOutBufferFromScc2 instead
1405 // try to check out a file from SCC
1406 HRESULT AttemptToCheckOutBufferFromScc([in] IVsUserData *pBufData, [out] BOOL *pfCheckoutSucceeded);
1408 HRESULT GetShortcutManager([out]IVsShortcutManager **ppShortcutMgr);
1410 // Register a 'view' from some source other then the core editor.
1411 HRESULT RegisterIndependentView ([in] IUnknown *pUnk, [in] IVsTextBuffer *pBuffer);
1413 // Unregister an externally created 'view'
1414 HRESULT UnregisterIndependentView ([in] IUnknown *pUnk, [in] IVsTextBuffer *pBuffer);
1416 // Ignore the next file change (has a 4-second timeout)
1417 HRESULT IgnoreNextFileChange([in] IVsTextBuffer *pBuffer);
1419 // Increases/decreases the ignore count for file change
1420 HRESULT AdjustFileChangeIgnoreCount([in] IVsTextBuffer *pBuffer, [in] BOOL fIgnore);
1422 // These two methods are the preferred means for interacting with SCC.
1423 // GetBufferSccStatus2 determines whether a file is under SCC
1424 HRESULT GetBufferSccStatus2(
1425 [in] const WCHAR *pszFileName, // filename
1426 [out] BOOL *pbNonEditable, // whether the file is unmodifiable (e.g. it's under SCC & checked in)
1427 [out] int *piStatusFlags); // may be NULL; returns add'l status flags; this is the VSQueryEditResult returned from IVsQueryEditQuerySave::QueryEditFiles
1429 // AttemptToCheckOutBufferFromScc2 tries to check a file out of SCC
1430 HRESULT AttemptToCheckOutBufferFromScc2(
1431 [in] const WCHAR *pszFileName, // filename
1432 [out] BOOL *pfCheckoutSucceeded, // whether the checkout succeeded
1433 [out] int *piStatusFlags); // may be NULL; add'l status flags; this is the VSQueryEditResult returned from IVsQueryEditQuerySave::QueryEditFiles
1436 HRESULT EnumLanguageServices([out] IVsEnumGUID **ppEnum); // enumerates the registered language service ID's
1438 // Enumerates ndependent views. Pass NULL for pBuffer to get all views.
1439 HRESULT EnumIndependentViews ([in] IVsTextBuffer *pBuffer, [out] IVsEnumIndependentViews **ppEnum);
1442 ////////////////////////////////////////////////////////////////////////////
1443 // IVsShortcutManager interface
1444 ////////////////////////////////////////////////////////////////////////////
1446 uuid(uuid_IVsShortcutManager)
1448 interface IVsShortcutManager : IUnknown
1450 HRESULT CreateItem([in]long iShortcutLine, [in]IVsTextLines* pBuffer, [in]LPCOLESTR pszBufMoniker);
1451 HRESULT RemoveItem([in]IVsTextLineMarker *pMarker);
1452 HRESULT WriteUserOptions([in]IStream *pOptionsStream);
1453 HRESULT ReadUserOptions([in]IStream *pOptionsStream);
1456 ////////////////////////////////////////////////////////////////////////////
1457 // IVsEnumTextBuffers interface
1458 ////////////////////////////////////////////////////////////////////////////
1460 uuid(uuid_IVsEnumTextBuffers)
1462 interface IVsEnumTextBuffers : IUnknown
1464 HRESULT Next (ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] IVsTextBuffer **rgelt, ULONG *pceltFetched);
1465 HRESULT Skip (ULONG celt);
1466 HRESULT Reset ();
1467 HRESULT Clone (IVsEnumTextBuffers **ppenum);
1470 ////////////////////////////////////////////////////////////////////////////
1471 // IVsTextManagerEvents interface
1472 ////////////////////////////////////////////////////////////////////////////
1474 uuid(uuid_IVsTextManagerEvents)
1476 interface IVsTextManagerEvents : IUnknown
1478 #ifdef PROXYSTUB_BUILD
1479 // Fired when a new marker type is registered
1480 HRESULT OnRegisterMarkerType ([in] long iMarkerType);
1482 // Fired when views are [un]registered
1483 HRESULT OnRegisterView ([in] IVsTextView *pView);
1484 HRESULT OnUnregisterView ([in] IVsTextView *pView);
1486 // Fired when the user's global preferences have changed
1487 HRESULT OnUserPreferencesChanged([in] const VIEWPREFERENCES * pViewPrefs,
1488 [in] const FRAMEPREFERENCES * pFramePrefs,
1489 [in] const LANGPREFERENCES * pLangPrefs,
1490 [in] const FONTCOLORPREFERENCES * pColorPrefs);
1491 #else
1492 // Fired when a new marker type is registered
1493 void OnRegisterMarkerType ([in] long iMarkerType);
1495 // Fired when views are [un]registered
1496 void OnRegisterView ([in] IVsTextView *pView);
1497 void OnUnregisterView ([in] IVsTextView *pView);
1499 // Fired when the user's global preferences have changed
1500 void OnUserPreferencesChanged([in] const VIEWPREFERENCES * pViewPrefs,
1501 [in] const FRAMEPREFERENCES * pFramePrefs,
1502 [in] const LANGPREFERENCES * pLangPrefs,
1503 [in] const FONTCOLORPREFERENCES * pColorPrefs);
1504 #endif
1507 ////////////////////////////////////////////////////////////////////////////
1508 // IVsTextSelectionAction interface
1509 ////////////////////////////////////////////////////////////////////////////
1511 uuid(uuid_IVsTextSelectionAction)
1513 interface IVsTextSelectionAction : IUnknown
1515 // Set the selection state for this action. The next call to
1516 // IAction::Undo or IAction::Redo on this will set the selection state
1517 // to that given in the view on this action's buffer that has focus,
1518 // if there is one.
1519 HRESULT GetOrigin([out] SELECTIONSTATE *pSelState);
1520 HRESULT GetDestination([out] SELECTIONSTATE *pSelState);
1522 // Retrieve selection data
1523 HRESULT SetOrigin([in] SELECTIONSTATE *pSelState);
1524 HRESULT SetDestination([in] SELECTIONSTATE *pSelState);
1527 ////////////////////////////////////////////////////////////////////////////
1528 // IVsEnumTextViews interface
1529 ////////////////////////////////////////////////////////////////////////////
1531 uuid(uuid_IVsEnumTextViews)
1533 interface IVsEnumTextViews : IUnknown
1535 HRESULT Next (ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] IVsTextView **rgelt, ULONG *pceltFetched);
1536 HRESULT Reset ();
1537 HRESULT GetCount (ULONG *pCount);
1540 ////////////////////////////////////////////////////////////////////////////
1541 // IVsEnumIndependentViews interface
1542 ////////////////////////////////////////////////////////////////////////////
1544 uuid(uuid_IVsEnumIndependentViews)
1546 interface IVsEnumIndependentViews : IUnknown
1548 HRESULT Next (ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] IUnknown **rgelt, [out] ULONG *pceltFetched);
1549 HRESULT Reset ();
1550 HRESULT GetCount (ULONG *pCount);
1553 ////////////////////////////////////////////////////////////////////////////
1554 // COLORINDEX enum
1555 ////////////////////////////////////////////////////////////////////////////
1556 typedef enum _COLORINDEX
1558 CI_USERTEXT_FG = 0,
1559 CI_USERTEXT_BK,
1561 // beginning of fixed color range
1562 CI_FIRSTFIXEDCOLOR,
1563 CI_BLACK = CI_FIRSTFIXEDCOLOR,
1564 CI_WHITE,
1565 CI_MAROON,
1566 CI_DARKGREEN, // was CI_14
1567 CI_BROWN,
1568 CI_DARKBLUE, // was CI_13
1569 CI_PURPLE, // was CI_15
1570 CI_AQUAMARINE, // was CI_16
1571 CI_LIGHTGRAY,
1572 CI_DARKGRAY,
1573 CI_RED,
1574 CI_GREEN,
1575 CI_YELLOW,
1576 CI_BLUE,
1577 CI_MAGENTA,
1578 CI_CYAN,
1579 CI_LASTFIXEDCOLOR = CI_CYAN,
1580 // end of fixed color range
1582 // more system color placeholders
1583 CI_SYSSEL_FG, // foreground for selected text
1584 CI_SYSSEL_BK, // background for selected text
1585 CI_SYSINACTSEL_FG, // foreground for inactive selection
1586 CI_SYSINACTSEL_BK, // background for inactive selection
1587 CI_SYSWIDGETMGN_BK, // background for widget margin
1588 CI_SYSPLAINTEXT_FG, // foreground for plain text
1589 CI_SYSPLAINTEXT_BK, // background for plain text
1591 CI_PALETTESIZE,
1592 CI_FORBIDCUSTOMIZATION,
1594 // these two are obsolete, and provided for compatibility; please don't use
1595 CI_SYSTEXT_FG = CI_USERTEXT_FG,
1596 CI_SYSTEXT_BK = CI_USERTEXT_BK,
1598 } COLORINDEX;
1600 ////////////////////////////////////////////////////////////////////////////
1601 // LINESTYLE enum
1602 ////////////////////////////////////////////////////////////////////////////
1603 typedef enum _LINESTYLE
1605 LI_NONE = 0, // no line at all
1606 LI_SOLID = 1, // solid - only valid for MV_BORDER markers
1607 LI_SQUIGGLY = 2, // squiggly - only valid for MV_LINE markers
1608 LI_HATCH = 3, // hatch pattern - only valid for MV_BORDER markers
1609 LI_DOTTED = 4 // 50% gray dither (dotted when 1 pixel) - only valid for MV_BORDER markers
1610 } LINESTYLE;
1612 ////////////////////////////////////////////////////////////////////////////
1613 // GLYPHDRAWFLAGS
1614 ////////////////////////////////////////////////////////////////////////////
1615 typedef enum _GLYPHDRAWFLAGS
1617 GDF_DEFAULT = 0x00000000, // single-line glyph
1618 GDF_MULTILINE = 0x00000001, // multi-line glyph
1619 GDF_TOPEDGE = 0x00000002, // client should draw special top line
1620 GDF_BOTTOMEDGE = 0x00000004 // client should draw special bottom line
1621 } GLYPHDRAWFLAGS;
1623 ////////////////////////////////////////////////////////////////////////////
1624 // MARKERVISUAL enum
1625 ////////////////////////////////////////////////////////////////////////////
1626 typedef enum _MARKERVISUAL
1628 MV_GLYPH = 0x00000001, // can show a glyph in the widget margin
1629 MV_COLOR_ALWAYS = 0x00000002, // always does body text coloring
1630 MV_COLOR_LINE_IF_NO_MARGIN = 0x00000004, // does body text coloring if there's no widget margin
1631 MV_LINE = 0x00000008, // means the marker is ONLY a line adornment & doesn't otherwise affect coloring; implies a squiggly for v7; unrelated to MB_LINESPAN
1632 MV_TIP_FOR_BODY = 0x00000010, // whether a tip should be shown for the body of the marker text
1633 MV_TIP_FOR_GLYPH = 0x00000020, // whether a tip should be shown the widget margin
1634 MV_SEL_MARGIN_GLYPH = 0x00000040, // like MV_GLYPH but indicates that the glyph lives in the selection margin, not the normal widget margin
1637 MV_FORCE_INVISIBLE forces the marker to be invisible; if you need to toggle a marker between being visible & invisible,
1638 this is faster than using IVsTextMarker::SetType().
1640 MV_FORCE_INVISIBLE = 0x00000080,
1643 MV_BORDER indicates that a box is drawn around the marked text.
1645 MV_BORDER = 0x00000100,
1648 MV_GLYPH_HOVER_CURSOR indicates that the client wants a callback (via their client interface) to set
1649 the mouse cursor when the user hovers the mouse over the glyph.
1651 MV_GLYPH_HOVER_CURSOR = 0x00000200,
1654 MV_DRAGGABLE_GLYPH indicates that a glyph can be dragged in a drag/drop operation.
1656 MV_DRAGGABLE_GLYPH = 0x00000400,
1658 // MV_MULTILINE_GLYPH indicates that a glyph spans multiple lines.
1659 MV_MULTILINE_GLYPH = 0x00000800,
1661 // MV_CONTEXT_CONTRIBUTION_FOR_BODY indicates that the body of a marker wants to contribute context,
1662 // and thus its client can be queried for IVsUserContextUpdate.
1663 MV_CONTEXT_CONTRIBUTION_FOR_BODY = 0x00001000,
1665 // MV_COLOR_SPAN_IF_ZERO_LENGTH indicates that a marker should paint as a solid bar if the textspan is zerolength. This shouldn't be used for
1666 // markers such as squigglies since it will only be this solid bar
1667 MV_COLOR_SPAN_IF_ZERO_LENGTH = 0x00002000
1669 } MARKERVISUAL;
1671 ////////////////////////////////////////////////////////////////////////////
1672 // FONTFLAGS enum
1673 ////////////////////////////////////////////////////////////////////////////
1674 typedef enum _FONTFLAGS
1676 FF_DEFAULT = 0x00000000, // plain text
1677 FF_BOLD = 0x00000001, // bold
1678 FF_STRIKETHROUGH = 0x00000002 // strikethrough
1679 } FONTFLAGS;
1682 MARKERBEHAVIORFLAGS enum
1684 Flags returned by the IVsTextMarkerType::GetBehaviorFlags & IVsTextMarker::GetBehavior methods.
1686 typedef enum _markerbehaviorflags
1688 MB_DEFAULT = 0x00000000, // default stream behavior
1689 MB_LINESPAN = 0x00000001, // a marker that always adjusts itself to span a line at a time
1690 MB_LEFTEDGE_LEFTTRACK = 0x00000002,
1691 MB_RIGHTEDGE_RIGHTTRACK = 0x00000004,
1692 MB_MULTILINESPAN = 0x00000008,
1695 MB_TRACK_ON_RELOAD forces a marker to track every edit as a replace, ignoring any reload semantics.
1696 In other words, IVsTextLines::ReloadLines() will have the same effect as IVsTextLines::ReplaceLines()
1697 for markers with this style set. Do not use this unless you have markers that need to guarantee that
1698 they're tracking in response to OnChangeLineText() events. (You should not specify this style unless
1699 you're doing something special and have contacted the VS text editor team about it.)
1701 MB_TRACK_EDIT_ON_RELOAD = 0x00000100
1702 } MARKERBEHAVIORFLAGS;
1705 // colorable items that we provide in the stock provider
1706 typedef enum _DEFAULTITEMS
1708 COLITEM_TEXT = 0, // Default
1709 COLITEM_KEYWORD, // Keyword
1710 COLITEM_COMMENT, // Comment
1711 COLITEM_IDENTIFIER, // Identifier
1712 COLITEM_STRING, // String
1713 COLITEM_NUMBER, // Number
1714 DEFAULT_ITEM_COUNT // Must be last enum!!! Put any other value before this one
1715 } DEFAULTITEMS;
1718 Here are the colors that should by default be associated with the DEFAULTITEMS indices:
1719 COLITEM_KEYWORD: Foreground: CI_BLUE Background: CI_USERTEXT_BK; Font flags: FF_BOLD
1720 COLITEM_COMMENT: Foreground: CI_DARKGREEN Background: CI_USERTEXT_BK, Font flags: 0
1721 COLITEM_IDENTIFIER: Foreground: CI_USERTEXT_FG Background: CI_USERTEXT_BK, Font flags: 0
1722 COLITEM_STRING: Foreground: CI_USERTEXT_FG Background: CI_USERTEXT_BK, Font flags: 0
1723 COLITEM_NUMBER: Foreground: CI_USERTEXT_FG Background: CI_USERTEXT_BK, Font flags: 0
1726 ////////////////////////////////////////////////////////////////////////////
1727 // IVsColorableItem interface
1728 ////////////////////////////////////////////////////////////////////////////
1730 uuid(uuid_IVsColorableItem)
1732 interface IVsColorableItem : IUnknown
1734 // Default foreground/background colors for this item
1735 HRESULT GetDefaultColors ([out] COLORINDEX *piForeground, [out] COLORINDEX *piBackground);
1737 // Default font flags for this item
1738 HRESULT GetDefaultFontFlags ([out] DWORD *pdwFontFlags); // see FONTFLAGS enum
1740 // Name of this item. Display name is used in UI for customization of
1741 // colors, as well as comparison in inter-language merging of
1742 // colorable items.
1743 HRESULT GetDisplayName ([out] BSTR * pbstrName); // string SHOULD be localized
1746 ////////////////////////////////////////////////////////////////////////////
1747 // IVsMergeableUIItem interface
1749 // This interface must be implemented by implementors of IVsPackageDefinedTextMarkerType,
1750 // and may be implemented (that is, it would be nice but is not absolutely required)
1751 // by implementors of IVsColorableItem.
1752 ////////////////////////////////////////////////////////////////////////////
1754 uuid(uuid_IVsMergeableUIItem)
1756 interface IVsMergeableUIItem : IUnknown
1758 // Non-localized item name, used for comparison in inter-language
1759 // merging of items.
1760 HRESULT GetCanonicalName ([out] BSTR *pbstrNonLocalizeName);
1762 // Localized item name, used for display in UI.
1763 // NOTE: for package-defined marker types, we also get the localized
1764 // name via a string resource put into the registry key for this
1765 // external marker. See architecture document for details.
1766 HRESULT GetDisplayName ([out] BSTR *pbstrDisplayName);
1768 // Merging priority; used to resolve conflicts. The higher the #, the more preferred it is.
1769 // Guidelines:
1770 // - If this is a Microsoft product, pri should be 0x1000 or greater.
1771 // - If yours is the primary package to be defining the marker, use 0x2000 or greater.
1772 // - If you are not doing any localization, your priority should be negative.
1773 HRESULT GetMergingPriority ([out] long *piMergingPriority);
1775 // Item description. NOTE: this may be unused for VS7, so don't bother implementing it yet.
1776 // Just return E_NOTIMPL for now.
1777 HRESULT GetDescription ([out] BSTR *pbstrDesc);
1780 ////////////////////////////////////////////////////////////////////////////
1781 // IVsProvideColorableItems interface
1783 // NOTE: please read the text editor architecture document in the spectool
1784 // and be sure that you understand the section on defining your own
1785 // colorable items before you attempt to implement this interface!!!
1787 ////////////////////////////////////////////////////////////////////////////
1789 uuid(uuid_IVsProvideColorableItems)
1791 interface IVsProvideColorableItems : IUnknown
1793 // Number of colorable items
1794 HRESULT GetItemCount ([out] int *piCount);
1796 // Iteration of colorable items; iIndex can range from 1 to GetItemCount()
1797 // We will never call for iIndex 0, since that means normal text. You should not
1798 // return anything comparable to "normal text" from this interface. See the
1799 // text editor architecture document if you have questions about this.
1800 // WARNING: this means that this is a ONE-based, not a zero-based interface!!!
1801 HRESULT GetColorableItem ([in] int iIndex, [out] IVsColorableItem **ppItem);
1804 typedef enum _COLORIZER_ATTRIBUTE
1806 COLOR_INDEX_MASK = 0x000000ff,
1807 COLOR_MARKER_MASK = 0x00003f00,
1808 LINE_MARKER_MASK = 0x000fc000,
1809 PRIVATE_CLIENT_MASK = 0x00f00000, // Reserved for editor client use
1810 HUMAN_TEXT_ATTR = 0x01000000, // Text to be treated as natural human-language text
1811 SEPARATOR_AFTER_ATTR= 0x02000000, // Indicates that a visual line separator should follow the char's line.
1812 PRIVATE_EDITOR_MASK = 0xfc000000 // Top 6 bits reserved for editor internal use
1813 } COLORIZER_ATTRIBUTE;
1815 ////////////////////////////////////////////////////////////////////////////
1816 // IVsColorizer interface
1817 ////////////////////////////////////////////////////////////////////////////
1819 uuid(uuid_IVsColorizer)
1821 interface IVsColorizer : IUnknown
1823 // If this colorizer requires per-line state maintenance, this method
1824 // should set pfFlag to TRUE, otherwise it should be set to FALSE. If
1825 // state maintenance is not required, and editing performance will likely
1826 // be better.
1827 HRESULT GetStateMaintenanceFlag ([out] BOOL *pfFlag);
1829 // Start state. Called only if the colorizer needs state maintenance.
1830 // Indicates the state in which colorization of the first line of the
1831 // buffer should start
1832 HRESULT GetStartState ([out] long *piStartState);
1834 // Colorize the given text. For each character in the line of text
1835 // given, a matching index into the colorizer's syntax item array (+1) should
1836 // be placed in the color index array provided. The colorizer should
1837 // start in the state provided, and return its current state (which will
1838 // be stored and provided as the start state when the following line is
1839 // colorized). The index array given is gauranteed to be ONE ELEMENT
1840 // longer than the number of characters in the line. This element is
1841 // used to determine the (background) color of the space to the right of
1842 // the last character on the line.
1844 // Color indexes are 1-BASED -- use 0 to specify default text color.
1845 // pText is NOT null-terminated. iLength is the length of the line
1846 // MINUS the end-of-line marker (CR, LF, CRLF pair, or 0 (EOF)), which
1847 // will be present.
1849 // A colorizer should mark text to be treated as human natural-language
1850 // text with the HUMAN_TEXT_ATTR bit. This bit should be set for
1851 // the contents of comments and strings, excluding delimiters.
1852 // This is used to obtain the correct layout of bidirectional text.
1853 // This may be used to identify when to apply natural-language rules
1854 // instead of programming-language rules (e.g. spell checking, word
1855 // boundaries).
1856 #ifdef PROXYSTUB_BUILD
1857 // According with WinNT.h, HRESULT and long are the same type
1858 HRESULT ColorizeLine([in] long iLine,
1859 [in] long iLength,
1860 [in] const WCHAR *pszText,
1861 [in] long iState,
1862 [out] ULONG * pAttributes);
1863 #else
1864 long ColorizeLine([in] long iLine,
1865 [in] long iLength,
1866 [in] const WCHAR *pszText,
1867 [in] long iState,
1868 [out] ULONG * pAttributes);
1869 #endif
1871 // Determine the end-of-line state for the line given. This method is
1872 // essentially the same as ColorizeLine, except that the line color data
1873 // is not required by the editor. This method is an optimization for
1874 // cases when the start state for a line is needed but lines above are
1875 // not being displayed. If state maintenance is not required by this
1876 // colorizer, this method will not be called. Implementations should
1877 // be as fast as possible to keep peak editor performance.
1878 #ifdef PROXYSTUB_BUILD
1879 // According with WinNT.h, HRESULT and long are the same type
1880 HRESULT GetStateAtEndOfLine ([in] long iLine,
1881 [in] long iLength,
1882 [in] const WCHAR *pText,
1883 [in] long iState);
1884 #else
1885 long GetStateAtEndOfLine ([in] long iLine,
1886 [in] long iLength,
1887 [in] const WCHAR *pText,
1888 [in] long iState);
1889 #endif
1891 // The buffer will call this before Release()ing the colorizer so that
1892 // it can Release() any references it holds on the buffer, thereby
1893 // breaking the circular reference chain.
1894 #ifdef PROXYSTUB_BUILD
1895 HRESULT CloseColorizer(void);
1896 #else
1897 void CloseColorizer(void);
1898 #endif
1901 /*//////////////////////////////////////////////////////////////////////////
1902 // IVsEnumGUID interface
1904 // This is in the form of a standard COM enumerator interface. See MSDN for docs
1905 // on how the standard enumerator interface works.
1907 //////////////////////////////////////////////////////////////////////////*/
1909 uuid(uuid_IVsEnumGUID)
1911 interface IVsEnumGUID : IUnknown
1913 // caller must allocate memory for the GUID's
1914 HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] GUID *rgelt, [out] ULONG *pceltFetched);
1915 HRESULT Skip ([in] ULONG celt);
1916 HRESULT Reset (void);
1917 HRESULT Clone ([out] IVsEnumGUID **ppenum);
1918 HRESULT GetCount ([out] ULONG *pceltCount);
1922 ////////////////////////////////////////////////////////////////////////////
1923 // IVsLanguageInfo interface
1924 ////////////////////////////////////////////////////////////////////////////
1926 uuid(uuid_IVsLanguageInfo)
1928 interface IVsLanguageInfo : IUnknown
1930 // Name of language (i.e. "Visual Basic", "C++", "HTML", etc..)
1931 // as a LOCALIZED string.
1932 HRESULT GetLanguageName ([out] BSTR *bstrName);
1934 // File extensions belonging to this language. If multiple, separate
1935 // with semicolons (i.e., ".html", ".c;.cpp;.cxx;.h;.hpp;.hxx", etc...)
1936 HRESULT GetFileExtensions ([out] BSTR * pbstrExtensions);
1938 // Colorizer provision. This can return an interface on the language
1939 // info object itself, or farm out new objects (if, for instance, the
1940 // colorizers for this language need state information on a per-file
1941 // basis)
1942 HRESULT GetColorizer ([in] IVsTextLines *pBuffer, [out] IVsColorizer **ppColorizer);
1944 // Provide language with opportunity to add "adornments" to a code window
1945 HRESULT GetCodeWindowManager ([in] IVsCodeWindow *pCodeWin, [out] IVsCodeWindowManager **ppCodeWinMgr);
1948 ////////////////////////////////////////////////////////////////////////////
1949 // IVsLanguageInfo IVsUserData GUIDs
1950 // QueryService language SID, IVsUserData iid
1951 ////////////////////////////////////////////////////////////////////////////
1953 //--------------------------------------------------------------------------
1954 // GUID_VsLang_Support_CF_HTML VT_BOOL {27E97702-589E-11d2-8233-0080C747D9A0}
1956 // The default behavior for most languages is TRUE
1958 // TRUE = Recognize CF_HTML and allow pasting/dropping the text of the HTML fragment.
1959 // FALSE = Don't recognize CF_HTML (HTML editor wants this).
1961 cpp_quote("extern const __declspec(selectany) GUID GUID_VsLang_Support_CF_HTML = { 0x27e97702, 0x589e, 0x11d2, { 0x82, 0x33, 0x0, 0x80, 0xc7, 0x47, 0xd9, 0xa0 } };")
1963 ////////////////////////////////////////////////////////////////////////////
1964 // IVsLanguageBlock
1965 // Optional service of language service.
1966 // Provided the same way as IVsLanguageInfo.
1967 ////////////////////////////////////////////////////////////////////////////
1969 uuid(uuid_IVsLanguageBlock)
1971 interface IVsLanguageBlock : IUnknown
1974 // GetCurrentBlock
1976 // From the current position, return a textspan for the interesting
1977 // enclosing or nearby block of text and a short description of the
1978 // block.
1980 // Called from the view to populate the Find dialog's
1981 // "Search only: <current procedure>"
1982 // option where <current procedure> is the pbstrDescription text.
1984 // The description should be short due to limited space on the Find
1985 // dialog.
1987 // pfBlockAvailable must be set to TRUE when a block is available,
1988 // and FALSE when the position is outside any blocks.
1990 // ptsBlockSpan may be NULL.
1991 // pbstrDescription may be NULL.
1993 HRESULT GetCurrentBlock (
1994 [in] IVsTextLines * pTextLines,
1995 [in] LONG iCurrentLine,
1996 [in] LONG iCurrentChar,
1997 [out] TextSpan * ptsBlockSpan,
1998 [out] BSTR * pbstrDescription,
1999 [out, retval] BOOL * pfBlockAvailable
2003 ////////////////////////////////////////////////////////////////////////////
2004 // IVsEnumBSTR interface
2005 ////////////////////////////////////////////////////////////////////////////
2007 uuid(uuid_IVsEnumBSTR)
2009 interface IVsEnumBSTR : IUnknown
2011 HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] BSTR *rgelt, [out] ULONG *pceltFetched);
2012 HRESULT Skip ([in] ULONG celt);
2013 HRESULT Reset (void);
2014 HRESULT Clone ([out] IVsEnumBSTR **ppenum);
2015 HRESULT GetCount ([out] ULONG *pceltCount);
2018 ////////////////////////////////////////////////////////////////////////////
2019 // RESOLVENAMEFLAGS
2020 ////////////////////////////////////////////////////////////////////////////
2021 typedef enum _resolvenameflags
2023 RNF_BREAKPOINT = 0x0001, // Resolve names for breakpoint
2024 } RESOLVENAMEFLAGS;
2026 ////////////////////////////////////////////////////////////////////////////
2027 // IVsDebugName interface
2028 ////////////////////////////////////////////////////////////////////////////
2030 uuid(uuid_IVsDebugName)
2032 interface IVsDebugName : IUnknown
2034 HRESULT GetName ([out] BSTR *pbstrName);
2035 HRESULT GetLocation ([out] BSTR *pbstrMkDoc, [out] TextSpan *pspanLocation);
2038 ////////////////////////////////////////////////////////////////////////////
2039 // IVsEnumDebugName interface
2040 ////////////////////////////////////////////////////////////////////////////
2042 uuid(uuid_IVsEnumDebugName)
2044 interface IVsEnumDebugName : IUnknown
2046 HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] IVsDebugName **rgelt, [out] ULONG *pceltFetched);
2047 HRESULT Skip ([in] ULONG celt);
2048 HRESULT Reset ();
2049 HRESULT Clone ([out] IVsEnumDebugName **ppenum);
2050 HRESULT GetCount ([out] ULONG *pceltCount);
2053 ////////////////////////////////////////////////////////////////////////////
2054 // IVsLanguageDebugInfo interface
2055 ////////////////////////////////////////////////////////////////////////////
2057 uuid(uuid_IVsLanguageDebugInfo)
2059 interface IVsLanguageDebugInfo : IUnknown
2061 // Generate "proximity" expressions, i.e., expressions surrounding the
2062 // given position in the given file that might spark the user's interest.
2063 HRESULT GetProximityExpressions ([in] IVsTextBuffer *pBuffer,
2064 [in] long iLine,
2065 [in] long iCol,
2066 [in] long cLines,
2067 [out] IVsEnumBSTR **ppEnum);
2069 // Validate the given position as a place to set a breakpoint. If the
2070 // location is valid, and pCodeSpan is non-NULL, the span is filled in
2071 // with the extent of the statement at which execution would stop. If
2072 // the position is known to not contain code, this will return S_FALSE.
2073 // If this function fails, the breakpoint is set, pending validation
2074 // during debug session startup.
2075 HRESULT ValidateBreakpointLocation ([in] IVsTextBuffer *pBuffer,
2076 [in] long iLine,
2077 [in] long iCol,
2078 [out] TextSpan *pCodeSpan);
2080 // Generate a name for the given location in the given file. Represents
2081 // the "innermost named entity" in the source. If non-NULL,
2082 // piLineOffset is filled with the offset from the first line
2083 // of the named entity. Returns S_FALSE if the position doesn't fall
2084 // within anything interesting.
2085 HRESULT GetNameOfLocation ([in] IVsTextBuffer *pBuffer,
2086 [in] long iLine,
2087 [in] long iCol,
2088 [out] BSTR *pbstrName,
2089 [out] long *piLineOffset);
2091 // UNDONE: Obsolete method; remove
2092 HRESULT GetLocationOfName ([in] LPCOLESTR pszName,
2093 [out] BSTR *pbstrMkDoc,
2094 [out] TextSpan *pspanLocation);
2096 // Disambiguate the given name, providing non-ambiguous names for all
2097 // entities that "match" the name. The flags given is one of the RNF_*
2098 // flags above
2099 HRESULT ResolveName ([in] LPCOLESTR pszName,
2100 [in] DWORD dwFlags,
2101 [out] IVsEnumDebugName **ppNames);
2103 // Return the corresponding debugger back-end "language ID". Note that
2104 // this is NOT the "engine ID", which should be obtained by the current
2105 // project or somewhere else that knows how the sources for this language
2106 // are being built.
2107 HRESULT GetLanguageID ([in] IVsTextBuffer *pBuffer,
2108 [in] long iLine,
2109 [in] long iCol,
2110 [out] GUID *pguidLanguageID);
2112 // Return whether the location contains code that is mapped to another
2113 // document, for example client-side script code
2114 // Returns S_OK if the location contains mapped code, S_FALSE if not, or an error code
2115 HRESULT IsMappedLocation ([in] IVsTextBuffer *pBuffer,
2116 [in] long iLine,
2117 [in] long iCol);
2120 ////////////////////////////////////////////////////////////////////////////
2121 // MARKERTYPE enum
2123 // These represent the pre-registered set of markers.
2125 ////////////////////////////////////////////////////////////////////////////
2126 typedef enum _markertype
2127 { // Priority
2128 MARKER_INVISIBLE = 0, // Invisible marker 100 (WARNING: internal editor team use ONLY!!!)
2129 MARKER_READONLY, // Read-only 0 // lower pri for performance reasons
2130 MARKER_SHORTCUT, // Task list shortcut 199
2131 MARKER_BOOKMARK, // Generic bookmark/tag 200
2133 MARKER_COMPILE_ERROR, // Compile error 600
2134 MARKER_CODESENSE_ERROR, // CodeSense error 700
2135 MARKER_OTHER_ERROR, // 3rd Party tool error 750
2138 MARKER_REGION_COLLAPSED, // A collapsible region is collapsed 801
2139 MARKER_REGION_EXPANDED, // A collapsible region is expanded 800
2141 MARKER_LIST_LOCATION, // Current location from result list
2143 DEF_MARKER_COUNT, // this should be at the end to define the number of markers
2145 MARKER_IDENTERROR = MARKER_COMPILE_ERROR, // OBSOLETE!
2146 MARKER_SYNTAXERROR = MARKER_COMPILE_ERROR // OBSOLETE!
2147 } MARKERTYPE;
2149 ////////////////////////////////////////////////////////////////////////////
2150 // ENUMMARKERFLAGS enum
2152 // Options for the IVsTextStream::EnumMarkers and IVsTextLines::EnumMarkers methods.
2153 ////////////////////////////////////////////////////////////////////////////
2154 typedef enum _enummarkerflags
2156 EM_DEFAULT = 0x00000000, // default settings
2157 EM_ENTIREBUFFER = 0x00000001, // ignore iPos and iLen parameters
2158 EM_ALLTYPES = 0x00000002, // ignore iMarkerType parameter
2159 EM_SORTDESCENDING = 0x00000004, // sort in descending order
2160 EM_SORTPRIORITY = 0x00000008, // sort by marker priority
2161 EM_GLYPHINSPAN = 0x00000010, // return markers that 1) have a margin glyph & 2) start at the same line at the specified span
2162 EM_INCLUDEINVISIBLE = 0x00000020, // includes invisible markers; normally they are excluded
2163 // discludes any marker whos span is not fully contained in the given span. Ex: marker from col 0-1 and maker form col 1-3. Given span 0-1 you will only get marker1.
2164 // Given span 1-2 you will only get marker 2. Given span 0-2 you will get both.
2165 EM_CONTAINED = 0x00000040
2166 } ENUMMARKERFLAGS;
2168 ////////////////////////////////////////////////////////////////////////////
2169 // FINDMARKERFLAGS enum
2171 // Options for the IVsTextBuffer::FindMarkerByPosition method.
2172 ////////////////////////////////////////////////////////////////////////////
2173 typedef enum _findmarkerflags
2175 FM_FORWARD = 0x00000000, // search forward (implicit)
2176 FM_BACKWARD = 0x00000001, // search backward
2177 // FUTURE: could have other flags to prevent looping, etc.
2178 } FINDMARKERFLAGS;
2180 ////////////////////////////////////////////////////////////////////////////
2181 // BUFFERSTATEFLAGS enum
2183 // Options for the IVsTextBuffer::Get/SetStateFlags methods.
2184 ////////////////////////////////////////////////////////////////////////////
2185 typedef enum _bufferstateflags
2187 BSF_USER_READONLY = 0x00000001, // user marked it as read only -- no editing allowed at all
2188 BSF_FILESYS_READONLY = 0x00000002, // RO on filesystem; possibly under SCC
2189 BSF_MODIFIED = 0x00000004, // whether it's been modified UNDONE: what if one undoes all actions?
2190 BSF_SUPPRESS_UI = 0x00000008, // whether to prevent the buffer from showing UI (off by default)
2192 BSF_RESERVED = ~(BSF_USER_READONLY | BSF_FILESYS_READONLY | BSF_MODIFIED)
2193 } BUFFERSTATEFLAGS;
2195 ////////////////////////////////////////////////////////////////////////////
2196 // BufferLockFlags enum
2198 // Options for the IVsTextBuffer/IVsTextLayer::Lock/UnlockBufferEx methods.
2199 ////////////////////////////////////////////////////////////////////////////
2201 typedef enum _BufferLockFlags
2203 BLF_READ = 0x0, // causes writes from other threads to block, but allows reads
2204 BLF_READ_AND_WRITE = 0x1 // causes writes and reads from other threads to block (implies BLF_READ)
2205 } BufferLockFlags;
2208 typedef enum _textbufferinitflags
2210 BIF_DEFAULT = 0x0,
2211 BIF_CUSTOMSTORAGE = 0x1,
2212 BIF_INITTEXT = 0x2
2213 // FUTURE: could specify threading preference here
2214 } TextBufferInitFlags;
2216 typedef struct
2218 DWORD dwFlags; // ORing of TextBufferInitFlags enum
2219 IUnknown *pStorage; // relevant if BIF_CUSTOMSTORAGE specified
2220 const WCHAR *pszText; // relevant if BIF_INITTEXT specified
2221 long iLength; // relevant if BIF_INITTEXT specified
2222 } BUFFERINITEX;
2224 ////////////////////////////////////////////////////////////////////////////
2225 // IVsTextBufferTempInit interface
2227 // Temporary interface for special initialization.
2228 ////////////////////////////////////////////////////////////////////////////
2230 uuid(uuid_IVsTextBufferTempInit)
2232 interface IVsTextBufferTempInit : IUnknown
2234 // new initialization methods
2235 HRESULT InitializeContentEx(
2236 [in] BUFFERINITEX *pInit);
2240 ////////////////////////////////////////////////////////////////////////////
2241 // IVsTextBuffer interface
2243 // Abstraction over a block of (Unicode) text.
2244 ////////////////////////////////////////////////////////////////////////////
2246 uuid(uuid_IVsTextBuffer)
2248 interface IVsTextBuffer : IUnknown
2250 // [Un]LockBuffer() deprecated in Dev10. IVsTextBuffer should be accessed from the UI thread.
2251 HRESULT LockBuffer (void);
2252 HRESULT UnlockBuffer (void);
2254 // Initialize content (will fail unless called on brand new untitled buffer)
2255 HRESULT InitializeContent ([in] const WCHAR *pszText, [in] long iLength);
2257 // state flags include: modified, read-only, read-only on disk
2258 HRESULT GetStateFlags ([out] DWORD *pdwReadOnlyFlags); // bitwise union of BUFFERSTATEFLAGS values
2259 HRESULT SetStateFlags ([in] DWORD dwReadOnlyFlags); // bitwise union of BUFFERSTATEFLAGS values
2261 // NOTE: These methods could be expensive, depending upon the underlying
2262 // implementation of the buffer (i.e. it could be very difficult to
2263 // calculate the size of the buffer if it is a virtual-line-oriented
2264 // implementation as VB's, etc.). The only methods used heavily by views
2265 // and that should be reasonably efficient by all implementations are
2266 // GetLineCount() and GetLengthOfLine().
2268 HRESULT GetPositionOfLine([in] long iLine, [out] long *piPosition);
2269 HRESULT GetPositionOfLineIndex([in] long iLine, [in] CharIndex iIndex, [out] long *piPosition);
2270 HRESULT GetLineIndexOfPosition([in] long iPosition, [out] long *piLine, [out] CharIndex *piColumn);
2271 HRESULT GetLengthOfLine ([in] long iLine, [out] long *piLength);
2272 HRESULT GetLineCount ([out] long *piLineCount);
2273 HRESULT GetSize ([out] long *piLength);
2275 HRESULT GetLanguageServiceID ([out] GUID *pguidLangService);
2276 HRESULT SetLanguageServiceID ([in] REFGUID guidLangService);
2278 HRESULT GetUndoManager ([out] IOleUndoManager **ppUndoManager);
2280 HRESULT Reserved1(void);
2281 HRESULT Reserved2(void);
2283 HRESULT Reserved3(void);
2284 HRESULT Reserved4(void);
2286 HRESULT Reload([in] BOOL fUndoable);
2288 // new, more general locking mechanism
2289 // [Un]LockBufferEx() deprecated in Dev10. IVsTextBuffer should be accessed from the UI thread.
2290 HRESULT LockBufferEx([in] DWORD dwFlags); // dwFlags is an ORing of BufferLockFlags (presently either BLF_READ or BLF_WRITE)
2291 HRESULT UnlockBufferEx([in] DWORD dwFlags); // dwFlags is an ORing of BufferLockFlags (presently either BLF_READ or BLF_WRITE)
2293 HRESULT GetLastLineIndex ([out] long *piLine, [out] long *piIndex); // gets length of last line; shortcut for frequent pattern of calling GetLineCount & then GetLengthOfLine on that line
2295 // we reserve these slots in the vtbl for future use
2296 HRESULT Reserved5(void);
2297 HRESULT Reserved6(void);
2298 HRESULT Reserved7(void);
2299 HRESULT Reserved8(void);
2300 HRESULT Reserved9(void);
2301 HRESULT Reserved10(void);
2304 ////////////////////////////////////////////////////////////////////////////
2305 // CHARFMT enum -- file encoding format
2306 ////////////////////////////////////////////////////////////////////////////
2307 typedef enum _CHARFMT
2309 CHARFMT_UNI, // Unicode
2310 CHARFMT_UNI_SWAP, // Byte-swapped Unicode
2311 CHARFMT_MBCS, // MBCS
2312 CHARFMT_UTF8 // UTF-8 with file signature
2313 } CHARFMT;
2315 ////////////////////////////////////////////////////////////////////////////
2316 // EOLTYPE -- identifies the thing that terminated a given line
2317 ////////////////////////////////////////////////////////////////////////////
2318 typedef enum _EOLTYPE
2320 eolCRLF = 0, // MS-DOS \r\n carriage-return/linefeed
2321 eolCR, // Mac \r
2322 eolLF, // Unix \n
2323 eolUNI_LINESEP, // Unicode line separator
2324 eolUNI_PARASEP, // Unicode paragraph separator
2325 eolEOF, // End of file
2326 eolNONE, // Artificial ending point (e.g. word-wrapped line)
2327 MAX_EOLTYPES
2328 } EOLTYPE;
2330 ////////////////////////////////////////////////////////////////////////////
2331 // LINEDATAEXFLAGS -- add'l info about a line
2332 ////////////////////////////////////////////////////////////////////////////
2333 typedef enum _LINEDATAEXFLAGS
2335 ldfDefault = 0x0, // nothing unusual
2336 ldfMarkers = 0x1, // markers do inline coloring of the text of this line
2337 ldfNoReadLock = 0x2 // no locking was done for this line data
2338 } LINEDATAEXFLAGS;
2340 ////////////////////////////////////////////////////////////////////////////
2341 // LINEDATA structure
2343 // Used to pass direct-access to line data in a buffer through IVsTextLines
2344 ////////////////////////////////////////////////////////////////////////////
2345 typedef struct _linedata
2347 long iLength; // # of plain text characters, excluding EOL
2348 #ifdef PROXYSTUB_BUILD
2349 // _linedata structure is used as out parameter by some interfaces, so it can not have
2350 // const member, otherwise the midl compiler will complain creating the proxy/stub code
2351 WCHAR *pszText; // NOTE: NOT NULL TERMINATED! Use iLength to determine end of text
2352 ULONG *pAttributes;
2353 #else
2354 const WCHAR *pszText; // NOTE: NOT NULL TERMINATED! Use iLength to determine end of text
2355 const ULONG *pAttributes;
2356 #endif
2357 EOLTYPE iEolType;
2358 BOOL fMarkers;
2359 } LINEDATA;
2362 ////////////////////////////////////////////////////////////////////////////
2363 // AtomicText structure
2365 // Describes an embedded object within a LINEDATAEX (see below for that).
2366 ////////////////////////////////////////////////////////////////////////////
2368 typedef struct _tag_AtomicText AtomicText;
2370 struct _tag_AtomicText
2372 AtomicText *pNext;
2373 CharIndex iIndex; // index of position into line
2374 #ifdef PROXYSTUB_BUILD
2375 // This structure is used as out parameter, so it can't have const members.
2376 WCHAR *pszAtomicText;
2377 #else
2378 const WCHAR *pszAtomicText;
2379 #endif
2380 IUnknown *punkAtom; // IUnknown on originating object for any custom processing
2383 ////////////////////////////////////////////////////////////////////////////
2384 // LINEDATAEX structure
2386 // Like LINEDATA, but used by GetLineDataEx
2387 ////////////////////////////////////////////////////////////////////////////
2388 typedef struct _linedataex
2390 long iLength; // # of plain text characters, excluding EOL
2391 #ifdef PROXYSTUB_BUILD
2392 // This struct is used as out parameter, so it can't have const members.
2393 WCHAR * pszText; // NOTE: NOT NULL TERMINATED! Use iLength to determine end of text
2394 #else
2395 const WCHAR * pszText; // NOTE: NOT NULL TERMINATED! Use iLength to determine end of text
2396 #endif
2397 EOLTYPE iEolType;
2398 #ifdef PROXYSTUB_BUILD
2399 // This struct is used as out parameter, so it can't have const members.
2400 ULONG * pAttributes;
2401 #else
2402 const ULONG * pAttributes;
2403 #endif
2404 USHORT dwFlags; // formerly fMarkers field; now an ORing of LINEDATAFLAGS enum
2405 USHORT dwReserved; // reserved for use by IVsTextLines implementation
2406 AtomicText * pAtomicTextChain; // list of embedded objects within the line
2407 } LINEDATAEX;
2409 typedef enum _paintingrestrictions
2411 PR_NONE = 0, // no restrictions
2412 PR_NO_MARGIN // no widget margin available
2413 } PAINTINGRESTRICTIONS;
2415 ////////////////////////////////////////////////////////////////////////////
2416 // MARKERDATA structure
2418 // Used to pass information about markers that involves lines in a given
2419 // range. For each n < iCount, rgpMarker[n] STARTS on line rgiLine[n]. The
2420 // array is guaranteed to be sorted by priority lowest to highest. As an
2421 // optimization in GetLineData, for each n : iTopLine <= n <= iBottomLine,
2422 // rgfLineMarker[n - iTopLine] is TRUE if a marker involved line n.
2423 ////////////////////////////////////////////////////////////////////////////
2425 typedef struct _tag_MARKERDATA MARKERDATA;
2427 struct _tag_MARKERDATA
2429 long iTopLine; // Top line of range
2430 long iBottomLine; // Bottom line of range
2431 long iCount; // Number of markers contained
2432 IVsTextLayerMarker **rgpMarker; // Marker instance
2433 BOOL *rgfLineMarked; // Used by GetLineData for optimization
2434 IVsTextLayer *pLayer; // The layer originating this information
2435 MARKERDATA *pNext; // Next entry in our linked list
2439 GLDE_FLAGS enum
2441 Used as params to GetLineDataEx
2443 typedef enum _GLDE_FLAGS
2445 gldeDefault = 0x00000000, // default behavior: whole line, no attributes, regular locking
2446 gldeSubset = 0x00000001, // get info only for line subset defined by iStartIndex & iEndIndex (does what GetLineSubsetData did)
2447 gldeColorizerState = 0x00000002, // NO LONGER USED!!!
2448 gldeSyntaxAttr = 0x00000004, // return syntax coloring attributes (as GetLineData2 did) and colorizer state
2449 gldeMarkerAttr = 0x00000008, // return marker coloring attributes plus other attributes
2450 gldeFullAttr = gldeSyntaxAttr | gldeMarkerAttr,
2453 WARNING: gldeNoReadLock tells GetLineDataEx/ReleaseLineDataEx to skip locking entirely. This is only
2454 safe to do if you have separately put a read (or read/write) lock on the buffer beforehand, and keep
2455 it locked until you've released the LINEDATAEX structure again via ReleaseLineDataEx.
2457 This allows a fast iteration over an entire set of lines, factoring out the locking overhead (which
2458 becomes significant if you're iterating over many lines).
2460 gldeNoReadLock = 0x00000010,
2462 gldeNoWidgetMargin = 0x00000020, // means there's no widget margin, so appropriate markers can color text
2463 } GLDE_FLAGS;
2466 REPLACE_TEXT_FLAGS
2468 typedef enum _REPLACE_TEXT_FLAGS
2470 rtfDefault = 0x0000, // does newline normalization
2471 rtfKeepMarkers = 0x0001,
2472 rtfDoNotNormalizeNewlines = 0x0002,
2473 rtfNormalizeTabsAndSpaces = 0x0004, // not yet supported
2474 rtfSyntacticReformat = 0x0008, // not yet supported
2475 rtfClientSuppressFormatting = 0x0010, // Stop OnReplace() listeners from formatting code
2476 rtfInterimText = 0x0020 // The last character of the inserted text
2477 // is an interim character from the IME
2478 } REPLACE_TEXT_FLAGS;
2480 ////////////////////////////////////////////////////////////////////////////
2481 // IVsTextLines interface
2482 ////////////////////////////////////////////////////////////////////////////
2484 uuid(uuid_IVsTextLines)
2486 interface IVsTextLines : IVsTextBuffer
2488 // Same as IVsOLDTextLines...
2489 HRESULT GetMarkerData ([in] long iTopLine, [in] long iBottomLine, [out] MARKERDATA *pMarkerData);
2490 HRESULT ReleaseMarkerData ([in] MARKERDATA *pMarkerData);
2491 HRESULT GetLineData ([in] long iLine, [out] LINEDATA *pLineData, [in] MARKERDATA *pMarkerData);
2492 HRESULT ReleaseLineData ([in] LINEDATA *pLineData);
2494 // Puts the specified span of text into a BSTR; it is the caller's responsibility to free the BSTR.
2495 HRESULT GetLineText(
2496 [in] long iStartLine, // starting line
2497 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2498 [in] long iEndLine, // ending line
2499 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2500 [out] BSTR * pbstrBuf); // text to insert, if any
2502 // Puts the specified span of text into a caller-allocated buffer; this will
2503 // copy up to cchBuf characters, and if the buffer wasn't big enough, returns
2504 // BUFFER_E_DEST_TOO_SMALL and sets *pcchBuf to the required size.
2505 // To just get the required size, you can pass in NULL for pszBuf.
2506 // NOTE: CopyLineText does NOT append NULL to the output string.
2507 HRESULT CopyLineText(
2508 [in] long iStartLine, // starting line
2509 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2510 [in] long iEndLine, // ending line
2511 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2512 [in] LPWSTR pszBuf, // text to insert, if any
2513 [in, out] long *pcchBuf); // NOTE: this is a count of UNICODE CHARACTERS, *not* BYTES!!!
2515 // Stream-like line editing -- handles line breaking/joining, etc.
2516 HRESULT ReplaceLines (
2517 [in] long iStartLine, // starting line
2518 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2519 [in] long iEndLine, // ending line
2520 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2521 [in] LPCWSTR pszText, // text to insert, if any
2522 [in] long iNewLen, // # of chars to insert, if any
2523 [out] TextSpan *pChangedSpan); // range of characters changed
2525 HRESULT CanReplaceLines(
2526 [in] long iStartLine, // starting line
2527 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2528 [in] long iEndLine, // ending line
2529 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2530 [in] long iNewLen); // # of chars to insert, if any
2532 // Markers -- note that these are line-oriented markers -- use IVsTextStream
2533 // to create stream-oriented ones
2534 HRESULT CreateLineMarker (
2535 [in] long iMarkerType,
2536 [in] long iStartLine, // starting line
2537 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2538 [in] long iEndLine, // ending line
2539 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2540 [in] IVsTextMarkerClient * pClient,
2541 [out] IVsTextLineMarker ** ppMarker); // if this is NULL, it means that the marker is buffer-owned
2543 // IVsTextLines::EnumMarkers enumerates ALL markers, but gets their IVsTextLineMarker interface via IVsEnumLineMarkers.
2544 HRESULT EnumMarkers(
2545 [in] long iStartLine, // starting line
2546 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2547 [in] long iEndLine, // ending line
2548 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2549 [in] long iMarkerType,
2550 [in] DWORD dwFlags, // ORing of ENUMMARKERFLAGS
2551 [out] IVsEnumLineMarkers ** ppEnum);
2552 HRESULT FindMarkerByLineIndex ([in] long iMarkerType, [in] long iStartingLine, [in] CharIndex iStartingIndex, [in] DWORD dwFlags, [out] IVsTextLineMarker **ppMarker);
2554 // event advisement/unadvisement
2556 // not implemented (QI for IConnectionPointContainer and use IConnectionPointContainer::FindConnectionPoint)
2557 HRESULT AdviseTextLinesEvents([in] IVsTextLinesEvents *pSink, [out] DWORD *pdwCookie);
2558 // not implemented (QI for IConnectionPointContainer and use IConnectionPointContainer::FindConnectionPoint)
2559 HRESULT UnadviseTextLinesEvents([in] DWORD dwCookie);
2561 // OBSOLETE: Do not implement
2562 HRESULT GetPairExtents([in] const TextSpan *pSpanIn, [out] TextSpan *pSpanOut);
2565 ReloadLines indicates that the text should be replaced, but that markers should not be deleted.
2566 You should only use this interface in special circumstances, such as when a buffer is being
2567 reloaded from disk or when a Wizard is substituting a particular section of code.
2569 HRESULT ReloadLines (
2570 [in] long iStartLine, // starting line
2571 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2572 [in] long iEndLine, // ending line
2573 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2574 [in] LPCWSTR pszText, // text to insert, if any
2575 [in] long iNewLen, // # of chars to insert, if any
2576 [out] TextSpan * pChangedSpan);// range of characters changed
2578 // Like GetLineData, but gets attributes without marker info.
2579 // Only the bits in COLOR_INDEX_MASK|HUMAN_TEXT_ATTR are guaranteed to be valid.
2580 // When fAttributes is false, this is the same as GetLineData(iLine, &ld, NULL);
2581 HRESULT IVsTextLinesReserved1( /* formerly GetLineData2, which is now obsolete */
2582 [in] long iLine,
2583 [out] LINEDATA * pLineData,
2584 [in] BOOL fAttributes // You want color with that?
2587 // End VS6 compatibility section
2589 // the mother of all GetLineData calls
2590 HRESULT GetLineDataEx ([in] DWORD dwFlags, [in] long iLine, [in] long iStartIndex, [in] long iEndIndex, [out] LINEDATAEX *pLineData, [in] MARKERDATA *pMarkerData);
2591 HRESULT ReleaseLineDataEx ([in] LINEDATAEX *pLineData); // releases LINEDATAEX
2593 HRESULT CreateEditPoint ([in] long iLine, [in] CharIndex iIndex, [out] IDispatch **ppEditPoint);
2595 // Line editing -- handles line breaking/joining, etc.
2596 HRESULT ReplaceLinesEx (
2597 [in] DWORD dwFlags, // special handling; ORing of REPLACE_TEXT_FLAGS enum
2598 [in] long iStartLine, // starting line
2599 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2600 [in] long iEndLine, // ending line
2601 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
2602 [in] LPCWSTR pszText, // text to insert, if any
2603 [in] long iNewLen, // # of chars to insert, if any
2604 [out] TextSpan *pChangedSpan); // range of characters changed
2606 HRESULT CreateTextPoint ([in] long iLine, [in] CharIndex iIndex, [out] IDispatch **ppTextPoint);
2609 ////////////////////////////////////////////////////////////////////////////
2610 // IVsTextColorState interface
2612 // Implemented by the standard text buffer, consumed by IVsColorizer instances
2613 // or any other outside party instigating a change to the color states of lines
2614 // in a text buffer (without necessarily changing the contents of the buffer itself).
2616 ////////////////////////////////////////////////////////////////////////////
2618 uuid(uuid_IVsTextColorState)
2620 interface IVsTextColorState : IUnknown
2622 // Colorizers that need to signal changes in color status of a set of lines
2623 // will call this. The buffer's implementation will be color calculate the
2624 // color state at the end of each line from iTopLine to iBottomLine, and
2625 // continue calculating EOL states until a line reports the same color state
2626 // (as it does today following a content change). The buffer will then fire
2627 // OnChangeAttributes to relay this color change to listening views.
2628 // iTopLine = -1, iBottomLine = -1 is a special case that means colorize all lines
2629 HRESULT ReColorizeLines ([in] long iTopLine, [in] long iBottomLine);
2631 // Returns the buffer's cached state for the start of the given line.
2632 // You may not call this method if you return FALSE for IVsColorizer::GetStateMaintenanceFlag().
2634 // WARNING 1: may result in callbacks to colorize previous lines if the state isn't
2635 // already in the buffer's cache.
2637 // WARNING 2: this function will not work correctly if called from within an
2638 // IVsTextLinesEvent::OnChangeLineText() handler, because that event is called
2639 // before the associated event to update colorization. If you want to use this
2640 // from within an IVsTextLinesEvent::OnChangeLineText() handler, you first need
2641 // call the above ReColorizeLines() method on the line(s) you're interested in
2642 // to make sure the colorization state is in place.
2644 // WARNING 3: the same applies to IVsFinalTextChangeCommitEvents::OnChangesCommitted() as
2645 // applies to IVsTextLinesEvent::OnChangeLineText(), since in the case where it's only a
2646 // CCG_MULTILINE_CHANGE gesture (e.g. automation or some random component partied on the
2647 // document) the colorization info still wouldn't be ready yet.
2648 HRESULT GetColorStateAtStartOfLine([in] long iLine, [out] long *piState);
2652 TextLineChange structure
2655 typedef struct _TextLineChange
2657 CharIndex iStartIndex;
2658 long iStartLine;
2659 CharIndex iOldEndIndex;
2660 long iOldEndLine;
2661 CharIndex iNewEndIndex;
2662 long iNewEndLine;
2663 } TextLineChange;
2665 ////////////////////////////////////////////////////////////////////////////
2666 // IVsTextLinesEvents interface
2668 // Events fired by line-oriented text buffers
2669 ////////////////////////////////////////////////////////////////////////////
2671 uuid(uuid_IVsTextLinesEvents)
2673 interface IVsTextLinesEvents : IUnknown
2675 #ifdef PROXYSTUB_BUILD
2676 HRESULT OnChangeLineText(
2677 [in] const TextLineChange *pTextLineChange,
2678 [in] BOOL fLast);
2680 HRESULT OnChangeLineAttributes ([in] long iFirstLine,
2681 [in] long iLastLine);
2682 #else
2683 void OnChangeLineText(
2684 [in] const TextLineChange *pTextLineChange,
2685 [in] BOOL fLast);
2687 void OnChangeLineAttributes ([in] long iFirstLine,
2688 [in] long iLastLine);
2689 #endif
2693 ////////////////////////////////////////////////////////////////////////////
2694 // IVsTextStream interface
2695 ////////////////////////////////////////////////////////////////////////////
2697 uuid(uuid_IVsTextStream)
2699 interface IVsTextStream : IVsTextBuffer
2701 // Text retrieval (NOTE: Was GetText(); no retrieval of attributes here)
2702 HRESULT GetStream ([in] long iPos, [in] long iLength, [out] WCHAR *pszDest); // be sure to allocate a buffer of iLength+1 since this call appends a NULL
2704 // Editing
2705 HRESULT ReplaceStream ([in] long iPos,
2706 [in] long iOldLen,
2707 [in] LPCOLESTR pszText,
2708 [in] long iNewLen);
2710 HRESULT CanReplaceStream ([in] long iPos,
2711 [in] long iOldLen,
2712 [in] long iNewLen);
2714 // Markers -- note that these are stream-oriented markers -- use IVsTextLines
2715 // to create line markers
2716 HRESULT CreateStreamMarker ([in] long iMarkerType, [in] long iPos, [in] long iLength, [in] IVsTextMarkerClient *pClient, [out] IVsTextStreamMarker **ppMarker); // if ppMarker is NULL, it means that the marker is buffer-owned
2718 // IVsTextStream::EnumMarkers enumerates ALL markers, but gets their IVsTextStreamMarker interface via IVsEnumStreamMarkers.
2719 HRESULT EnumMarkers ([in] long iPos, [in] long iLen, [in] long iMarkerType, [in] DWORD dwFlags, [out] IVsEnumStreamMarkers **ppEnum);
2720 HRESULT FindMarkerByPosition([in] long iMarkerType, [in] long iStartingPos, [in] DWORD dwFlags, [out] IVsTextStreamMarker **ppMarker);
2722 // not implemented 'til VS99 (QI for IConnectionPointContainer and use IConnectionPointContainer::FindConnectionPoint)
2723 HRESULT AdviseTextStreamEvents([in] IVsTextStreamEvents *pSink, [out] DWORD *pdwCookie);
2724 // not implemented 'til VS99 (QI for IConnectionPointContainer and use IConnectionPointContainer::FindConnectionPoint)
2725 HRESULT UnadviseTextStreamEvents([in] DWORD dwCookie);
2728 ReloadStream indicates that the text should be replaced, but that markers should not be deleted.
2729 You should only use this interface in special circumstances, such as when a buffer is being
2730 reloaded from disk or when a Wizard is substituting a particular section of code.
2732 HRESULT ReloadStream (
2733 [in] long iPos,
2734 [in] long iOldLen,
2735 [in] const WCHAR *pszText,
2736 [in] long iNewLen);
2738 HRESULT CreateEditPoint ([in] long iPosition, [out] IDispatch **ppEditPoint);
2740 // more general version of ReplaceStream/ReloadStream
2741 HRESULT ReplaceStreamEx (
2742 [in] DWORD dwFlags, // special handling; ORing of REPLACE_TEXT_FLAGS enum
2743 [in] long iPos,
2744 [in] long iOldLen,
2745 [in] const WCHAR *pszText,
2746 [in] long iNewLen,
2747 [out] long *piActualLen);
2749 HRESULT CreateTextPoint ([in] long iPosition, [out] IDispatch **ppTextPoint);
2754 /////////////////////////////////////////////////////////////////////////
2755 // IVsEnumStreamMarkers interface
2756 /////////////////////////////////////////////////////////////////////////
2758 uuid(uuid_IVsEnumStreamMarkers)
2760 interface IVsEnumStreamMarkers : IUnknown
2762 HRESULT Reset(void);
2763 HRESULT Next([out, retval] IVsTextStreamMarker** ppRetval);
2764 HRESULT GetCount([out] long *pcMarkers);
2767 /////////////////////////////////////////////////////////////////////////
2768 // IVsEnumLineMarkers interface
2769 /////////////////////////////////////////////////////////////////////////
2771 uuid(uuid_IVsEnumLineMarkers)
2773 interface IVsEnumLineMarkers : IUnknown
2775 HRESULT Reset(void);
2776 HRESULT Next([out, retval] IVsTextLineMarker** ppRetval);
2777 HRESULT GetCount([out] long *pcMarkers);
2780 /////////////////////////////////////////////////////////////////////////
2781 // IVsEnumLayerMarkers interface
2782 /////////////////////////////////////////////////////////////////////////
2784 uuid(uuid_IVsEnumLayerMarkers)
2786 interface IVsEnumLayerMarkers : IUnknown
2788 HRESULT Reset(void);
2789 HRESULT Next([out] IVsTextLayerMarker** ppRetval);
2790 HRESULT GetCount([out] long *pcMarkers);
2793 typedef enum _MarkerCommandValues
2795 mcvFirstContextMenuCommand = 0x000,
2796 mcvLastContextMenuCommand = 0x009,
2797 mcvGlyphSingleClickCommand = 0x101, // fired for a _single_ click on the glyph (if one exists)
2798 mcvBodyDoubleClickCommand = 0x102, // fired for a _double_ click on the body text
2799 mcvGlyphDoubleClickCommand = 0x103 // fired for a _double_ click on the glyph (if one exists)
2800 } MarkerCommandValues;
2803 /////////////////////////////////////////////////////////////////////////
2804 // IVsTextMarker interface
2806 // A "text marker" tracks edits in its owning buffer and maintains the
2807 // position data so that interested parties can query the new position
2808 // information post-edit. Note that if any part of the range specified
2809 // in the creation of the marker is involved in an edit, the marker
2810 // becomes invalid.
2811 /////////////////////////////////////////////////////////////////////////
2813 uuid(uuid_IVsTextMarker)
2815 interface IVsTextMarker : IUnknown
2817 // Marker type
2818 HRESULT GetType ([out] long *piMarkerType);
2819 HRESULT SetType ([in] long iMarkerType);
2821 // Visual style
2822 HRESULT GetVisualStyle([out] DWORD *pdwFlags);
2823 HRESULT SetVisualStyle([in] DWORD dwFlags); // NOTE: if you call this, the settings are lost if SetType is called!!
2825 // To prevent it from appearing in UI, even if there are lingering references to it, call this
2826 HRESULT Invalidate(void);
2828 // Draws a glyph in the given DC & RECT
2829 HRESULT DrawGlyph([in] HDC hdc, [in] RECT *pRect);
2831 // Text to display in a tip.
2832 HRESULT GetTipText([out, optional] BSTR *pbstrText);
2834 // Unadvise the client, if any
2835 HRESULT UnadviseClient(void);
2837 // Commands -- see MarkerCommandValues for meaning of iItem param
2838 HRESULT GetMarkerCommandInfo([in] long iItem, [out, custom(uuid_IVsTextMarker, "optional")] BSTR * pbstrText, [out] DWORD* pcmdf);
2839 HRESULT ExecMarkerCommand([in] long iItem);
2841 // Marker behavior
2842 HRESULT GetBehavior ([out] DWORD *pdwBehavior);
2843 HRESULT SetBehavior ([in] DWORD dwBehavior);
2845 // Priority index. Highest value gets topmost placement.
2846 HRESULT GetPriorityIndex ([out] long *piPriorityIndex);
2850 ////////////////////////////////////////////////////////////////////////////
2851 // IVsTextStreamMarker
2852 ////////////////////////////////////////////////////////////////////////////
2854 uuid(uuid_IVsTextStreamMarker)
2856 interface IVsTextStreamMarker : IVsTextMarker
2858 // Access to associated buffer
2859 HRESULT GetStreamBuffer ([out] IVsTextStream **ppBuffer);
2861 // Reset position
2862 HRESULT ResetSpan ([in] long iNewPos, [in] long iNewLen);
2864 // Get position information
2865 HRESULT GetCurrentSpan ([out] long *piPos, [out] long *piLen);
2868 ////////////////////////////////////////////////////////////////////////////
2869 // IVsTextLineMarker
2870 ////////////////////////////////////////////////////////////////////////////
2872 uuid(uuid_IVsTextLineMarker)
2874 interface IVsTextLineMarker : IVsTextMarker
2876 // Access to associated buffer
2877 HRESULT GetLineBuffer([out] IVsTextLines **ppBuffer);
2879 // Reset position
2880 HRESULT ResetSpan (
2881 [in] long iStartLine, // starting line
2882 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2883 [in] long iEndLine, // ending line
2884 [in] CharIndex iEndIndex // ending character index within the line (must be <= length of line)
2887 // Current position
2888 HRESULT GetCurrentSpan ([out] TextSpan *pSpan);
2892 ////////////////////////////////////////////////////////////////////////////
2893 // IVsTextLayerMarker
2894 ////////////////////////////////////////////////////////////////////////////
2897 This is an interface exposed by marker objects that live in an arbitrary layer. They are
2898 a more general concept than a buffer marker. Buffer markers are by definition layer markers,
2899 but some layers that are not buffers can also originate markers. If you have an IVsTextLineMarker
2900 or IVsTextStreamMarker * it is guaranteed that you can QI for IVsTextLayerMarker, but not vice
2901 versa. (This will be true for buffer-originated markers however.)
2905 uuid(uuid_IVsTextLayerMarker)
2907 interface IVsTextLayerMarker : IVsTextMarker
2909 // Access to associated layer
2910 HRESULT GetTextLayer([out] IVsTextLayer **ppLayer);
2912 // Reset position
2913 HRESULT ResetSpan (
2914 [in] long iStartLine, // starting line
2915 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
2916 [in] long iEndLine, // ending line
2917 [in] CharIndex iEndIndex // ending character index within the line (must be <= length of line)
2920 // Current position
2921 HRESULT GetCurrentSpan ([out] TextSpan *pSpan);
2923 HRESULT IsInvalidated(void); // whether marker was invalidated: S_OK == yes, S_FALSE == no (i.e. Invalidate() called or buffer freed)
2924 #ifdef PROXYSTUB_BUILD
2925 HRESULT QueryClientInterface([in] REFIID iid, [out, iid_is(iid)] void **ppClient);
2926 #else
2927 HRESULT QueryClientInterface([in] REFIID iid, [out] void **ppClient);
2928 #endif
2930 HRESULT DrawGlyphEx(
2931 [in] DWORD dwFlags, // ORing of GLYPHDRAWFLAGS
2932 [in] HDC hdc,
2933 [in] RECT *pRect,
2934 [in] long iLineHeight);
2938 /////////////////////////////////////////////////////////////////////////
2939 // IVsTextMarkerType interface
2941 // This interface presents a uniform way to talk to any marker type, be it
2942 // predefined by the editor or registered by a package.
2944 /////////////////////////////////////////////////////////////////////////
2946 uuid(uuid_IVsTextMarkerType)
2948 interface IVsTextMarkerType : IUnknown
2950 // Visual type for this marker (foreground/background color, or line)
2951 HRESULT GetVisualStyle ([out] DWORD* pdwVisualFlags); // a bitwise union of MARKERVISUAL enum values
2953 // Default foreground/background colors for this marker
2954 HRESULT GetDefaultColors ([out] COLORINDEX *piForeground, [out] COLORINDEX *piBackground);
2956 // Default line attributes for this marker
2957 HRESULT GetDefaultLineStyle ([out] COLORINDEX *piLineColor, [out] LINESTYLE *piLineIndex);
2959 // Draws a glyph in the given DC & RECT
2960 HRESULT DrawGlyph([in] HDC hdc, [in] RECT *pRect);
2962 // Behavior flags. For now, only streaming and line-spanning are supported.
2963 HRESULT GetBehaviorFlags([out] DWORD *pdwFlags);
2965 // Priority index. Highest value gets topmost placement.
2966 HRESULT GetPriorityIndex ([out] long *piPriorityIndex);
2968 // Displayable name
2969 HRESULT GetDisplayName ([out] BSTR *pbstrName); // SHOULD be localized
2971 // Draws a glyph in the given DC & RECT
2972 HRESULT DrawGlyphEx(
2973 [in] DWORD dwFlags, // ORing of GLYPHDRAWFLAGS
2974 [in] HDC hdc,
2975 [in] RECT *pRect,
2976 [in] long iLineHeight);
2979 /////////////////////////////////////////////////////////////////////////
2980 // IVsTextMarkerColorSet interface
2982 // Passed to IVsPackageDefinedTextMarkerType::DrawGlyphWithColors() to
2983 // allow a marker type to sneak a look at other marker types in case the
2984 // glyph has colors tied to other types.
2986 /////////////////////////////////////////////////////////////////////////
2988 uuid(uuid_IVsTextMarkerColorSet)
2990 interface IVsTextMarkerColorSet : IUnknown
2992 HRESULT GetMarkerColors([in] long iMarkerType, [out] COLORREF *pclrFore, [out] COLORREF *pclrBack);
2995 /////////////////////////////////////////////////////////////////////////
2996 // IVsPackageDefinedTextMarkerType interface
2998 // When a package registers an external marker type, this interface is
2999 // implemented for each marker type.
3001 // NOTE: implementors of this interface MUST ALSO IMPLEMENT IVsMergeableUIItem.
3003 /////////////////////////////////////////////////////////////////////////
3005 uuid(uuid_IVsPackageDefinedTextMarkerType)
3007 interface IVsPackageDefinedTextMarkerType : IUnknown
3009 // Visual type for this marker (foreground/background color, or line)
3010 HRESULT GetVisualStyle ([out] DWORD* pdwVisualFlags); // a bitwise union of MARKERVISUAL enum values
3012 // Default foreground/background colors for this marker
3013 HRESULT GetDefaultColors ([out] COLORINDEX *piForeground, [out] COLORINDEX *piBackground);
3015 // Default line attributes for this marker
3016 HRESULT GetDefaultLineStyle ([out] COLORINDEX *piLineColor, [out] LINESTYLE *piLineIndex);
3018 // Default font flags for this marker
3019 HRESULT GetDefaultFontFlags ([out] DWORD *pdwFontFlags); // see FONTFLAGS enum
3021 // Draws a glyph in the given DC & RECT using the provided colors
3022 HRESULT DrawGlyphWithColors(
3023 [in] HDC hdc,
3024 [in] RECT *pRect,
3025 [in] long iMarkerType,
3026 [in] IVsTextMarkerColorSet *pMarkerColors,
3027 [in] DWORD dwGlyphDrawFlags, // ORing of GLYPHDRAWFLAGS
3028 [in] long iLineHeight); // reserved for future use; pass zero if calling
3030 // Behavior flags. For now, only streaming and line-spanning are supported.
3031 HRESULT GetBehaviorFlags([out] DWORD *pdwFlags);
3033 // Priority index. Highest value gets topmost placement.
3034 HRESULT GetPriorityIndex ([out] long *piPriorityIndex);
3037 /////////////////////////////////////////////////////////////////////////
3038 // IVsTextMarkerTypeProvider interface
3040 // When a package registers an external marker type, this interface is
3041 // implemented once by the specified service.
3043 /////////////////////////////////////////////////////////////////////////
3045 uuid(uuid_IVsTextMarkerTypeProvider)
3047 interface IVsTextMarkerTypeProvider : IUnknown
3049 HRESULT GetTextMarkerType([in] GUID *pguidMarker, [out] IVsPackageDefinedTextMarkerType **ppMarkerType);
3053 /////////////////////////////////////////////////////////////////////////////////
3054 // IVsTextMarkerClient interface
3056 // Receives callbacks from a marker.
3057 /////////////////////////////////////////////////////////////////////////////////
3059 uuid(uuid_IVsTextMarkerClient)
3061 interface IVsTextMarkerClient : IUnknown
3063 // MarkerInvalidated is called when the text of a marker is deleted via a user action, but
3064 // not when the buffer is closed; OnBeforeBufferClose is called in that case.
3065 #ifdef PROXYSTUB_BUILD
3066 HRESULT MarkerInvalidated(void);
3067 #else
3068 void MarkerInvalidated(void);
3069 #endif
3071 HRESULT GetTipText([in] IVsTextMarker* pMarker, [out, optional] BSTR *pbstrText);
3073 //pszFileName is so you know if the buffer has been saved to a different
3074 //name, in certain types of buffers, this may not be applicable, in which
3075 //case the parameter may be NULL
3076 #ifdef PROXYSTUB_BUILD
3077 HRESULT OnBufferSave(LPCOLESTR pszFileName);
3078 #else
3079 void OnBufferSave(LPCOLESTR pszFileName);
3080 #endif
3082 // called before the buffer goes away due to its being closed; clients may still grab
3083 // span information from the marker in response to this
3084 #ifdef PROXYSTUB_BUILD
3085 HRESULT OnBeforeBufferClose(void);
3086 #else
3087 void OnBeforeBufferClose(void);
3088 #endif
3090 // Commands -- see MarkerCommandValues for meaning of iItem param
3091 HRESULT GetMarkerCommandInfo([in] IVsTextMarker* pMarker, [in] long iItem, [out, custom(uuid_IVsTextMarkerClient, "optional")] BSTR * pbstrText, [out] DWORD* pcmdf);
3092 HRESULT ExecMarkerCommand([in] IVsTextMarker* pMarker, [in] long iItem);
3094 // OnAfterSpanReload is called when someone calls IVsTextLines::ReloadLines or IVsTextStream::ReloadStream.
3095 // This means that the text under the marker has been altered, but it's been requested that the marker not
3096 // be deleted. Thus the marker's position may not be appropriate. This is your chance to correct it if
3097 // needed.
3098 #ifdef PROXYSTUB_BUILD
3099 HRESULT OnAfterSpanReload(void);
3100 #else
3101 void OnAfterSpanReload(void);
3102 #endif
3104 HRESULT OnAfterMarkerChange([in] IVsTextMarker* pMarker);
3108 ////////////////////////////////////////////////////////////////////////////
3109 // IVsMouseCursorProvider interface
3110 ////////////////////////////////////////////////////////////////////////////
3113 If a marker has MV_GLYPH_HOVER_CURSOR turned on for its visual style bits, the
3114 IVsTextMarkerClient * that is the marker client will be QI'd for this interface.
3115 This allows a marker to alter the mouse cursor when it's over its glyph. This
3116 flag is ignored for markers that don't have MV_GLYPH specified.
3119 uuid(uuid_IVsMouseCursorProvider)
3121 interface IVsMouseCursorProvider : IUnknown
3123 HRESULT SetMouseCursor([in] DWORD dwReserved); // implementor should call SetCursor()
3127 ////////////////////////////////////////////////////////////////////////////
3128 // CUSTOM_DROP_HANDLER_FLAGS enum
3129 ////////////////////////////////////////////////////////////////////////////
3131 // CUSTOM_DROP_HANDLER_FLAGS are used by IVsTextMarkerGlyphDropHandler
3132 typedef enum _CUSTOM_DROP_HANDLER_FLAGS
3134 CDH_DEFAULT = 0, // success -- means that a drop can proceed, or already did so successfully
3135 CDH_OVER_SELF = 1, // means that the drop would be over the origin, thus a no-op
3136 CDH_INVALID_DEST = 2 // means the destination is unacceptable for a drop
3137 } CUSTOM_DROP_HANDLER_FLAGS;
3140 ////////////////////////////////////////////////////////////////////////////
3141 // IVsTextMarkerGlyphDropHandler interface
3142 ////////////////////////////////////////////////////////////////////////////
3145 When MV_DRAGGABLE_GLYPH is specified, the marker client will be QI'd for this interface when
3146 a drag/drop is underway.
3149 uuid(uuid_IVsTextMarkerGlyphDropHandler)
3151 interface IVsTextMarkerGlyphDropHandler : IUnknown
3153 // DrawCandidateOutlineGlyph draws a "shadow" of the glyph in the widget margin at a potential destination line.
3154 // Draw the same glyph without regard for whether the destination is valid or not; that feedback will be given
3155 // by the mouse cursor.
3156 HRESULT DrawCandidateOutlineGlyph([in] DWORD dwReserved, [in] HDC hdc, [in] RECT *pRect, [in] COLORREF clrref);
3158 // QueryDropLocation is a way of asking whether a given location is a valid drop destination.
3159 HRESULT QueryDropLocation(
3160 [in] DWORD dwReserved, // ignore
3161 [in] IVsTextView *pDestView, // proposed destination view
3162 [in] IVsTextLines *pDestBuffer, // proposed destination buffer
3163 [in] long iLine, // proposed buffer line
3164 [in] CharIndex iIndex, // proposed buffer char index
3165 [out] DWORD *pdwDropResult); // ORing of CUSTOM_DROP_HANDLER_FLAGS
3167 // DropAtLocation tells the client to handle the glyph being dropped at the given location.
3168 HRESULT DropAtLocation(
3169 [in] DWORD dwReserved, // ignore
3170 [in] IVsTextView *pDestView, // destination view
3171 [in] IVsTextLines *pDestBuffer, // destination buffer
3172 [in] long iLine, // buffer line
3173 [in] CharIndex iIndex, // buffer char index
3174 [out] DWORD *pdwDropResult); // ORing of CUSTOM_DROP_HANDLER_FLAGS
3178 /*/////////////////////////////////////////////////////////////////////////
3179 IVsTextTrackingPoint interface
3181 The best way to explain this interface is to explain the problem that
3182 it solves. When tracking certain positions, such as the current
3183 selection, one needs to track a location in layer-generated text (e.g.
3184 that produced by the synthetic text layer), but still be able to track
3185 it even if that layer goes away. The solution: a track point object,
3186 which is like a marker except that it is guaranteed to keep tracking --
3187 possibly in a different layer -- for as long as the buffer lives.
3189 Put another way, a multi-layer track point is similar to a zero-length
3190 marker, but it is guaranteed to always have a meaningful location in
3191 SOME layer, provided the buffer continues to exist.
3193 A track point it never shows any UI, and its position may not be reset.
3194 The only things you can do with them are create them and query their
3195 layer and current line/index.
3197 This interface is used only in special-purpose scenarios; unless you
3198 need to track a point which may exist in a synthetic text region, you
3199 don't need to worry about this interface. Clients should use normally
3200 use ordinary text markers on the buffer.
3201 /////////////////////////////////////////////////////////////////////////*/
3204 uuid(uuid_IVsTextTrackingPoint)
3206 interface IVsTextTrackingPoint : IUnknown
3208 HRESULT GetTextLayer([out] IVsTextLayer **ppLayer);
3209 HRESULT GetCurrentLineIndex([out] long *piLine, [out] long *piIndex);
3210 HRESULT(GetBehavior)([out] DWORD *pdwBehavior);
3211 HRESULT(SetBehavior)([in] DWORD dwBehavior);
3214 /////////////////////////////////////////////////////////////////////////
3215 // IVsFullTextScanner interface
3217 // This is a special-purpose interface exposed by text buffers that is
3218 // used by entities like compilers that need immediate access to the
3219 // entire buffer. It differs from IVsTextScanner above in that it cannot
3220 // ever return a portion of the buffer; it will always return all or
3221 // nothing. In addition, it differs from IVsTextScanner in that multiple
3222 // clients may have IVsFullTextScanner sessions in progress, whereas
3223 // IVsTextScanner cannot cope with this.
3224 /////////////////////////////////////////////////////////////////////////
3226 uuid(uuid_IVsFullTextScanner)
3228 interface IVsFullTextScanner : IUnknown
3230 // Open the buffer for scanning. This will lock the buffer and do a
3231 // garbage collection pass (read: EXPENSIVE!!), so don't use this in
3232 // a QueryStatus handler or other speed-intensive scenario.
3233 HRESULT OpenFullTextScan (void);
3235 // Does the actual scan.
3237 // piLength is filled with the length of text pointed to by *ppszText.
3239 #ifdef PROXYSTUB_BUILD
3240 // out parameter can not be const.
3241 HRESULT FullTextRead ([out] WCHAR **ppszText, [out] long *piLength);
3242 #else
3243 HRESULT FullTextRead ([out] const WCHAR **ppszText, [out] long *piLength);
3244 #endif
3246 // Close the buffer for scanning. Writable buffer implementations
3247 // use this to re-allow writing to the buffer, so don't forget to
3248 // call this guy!
3249 HRESULT CloseFullTextScan (void);
3253 /////////////////////////////////////////////////////////////////////////
3254 // IVsTextScanner interface
3256 // This is a special-purpose interface exposed by text buffers that is
3257 // used by entities like compilers that need fast, stream-oriented,
3258 // sequential access to the text in the buffer.
3260 // Right now, this interface is just as slow as IVsFullTextScanner, but
3261 // prevents multiple clients from using it. In the future, this might
3262 // change so as to only send back a line at a time. If you normally
3263 // only want a full buffer back, please use IVsFullTextScanner instead.
3264 /////////////////////////////////////////////////////////////////////////
3266 uuid(uuid_IVsTextScanner)
3268 interface IVsTextScanner : IUnknown
3270 // "Open" the buffer for scanning. Scan functions are successful
3271 // only after calling this and before calling Close, and only for
3272 // the calling thread.
3273 HRESULT OpenScan (void);
3275 // Scan text. The block provided is guaranteed valid until the next
3276 // call to Read, or Close(). piLength is filled with the length of text
3277 // pointed to by *ppszText -- if 0, there is no more text. In the
3278 // most efficient of implementations, the entire buffer will be
3279 // provided by one call to Read.
3280 #ifdef PROXYSTUB_BUILD
3281 // out parameter can not be const
3282 HRESULT Read ([out] WCHAR **ppszText, [out] long *piLength);
3283 #else
3284 HRESULT Read ([out] const WCHAR **ppszText, [out] long *piLength);
3285 #endif
3287 // Close the buffer for scanning. Writable buffer implementations
3288 // use this to re-allow writing to the buffer, so don't forget to
3289 // call this guy!
3290 HRESULT CloseScan (void);
3293 /////////////////////////////////////////////////////////////////////////
3294 // Definition of text find / replace flags shared by both the buffer
3295 // and view.
3296 /////////////////////////////////////////////////////////////////////////
3297 typedef enum _TextFindMode
3299 TFIND_BACKWARDS = 1,
3300 TFIND_MATCH_CASE = 2,
3301 TFIND_WHOLE_WORD = 4,
3302 TFIND_REG_EXPR = 8,
3303 TFIND_WRAP_SEARCH = 16,
3304 TFIND_IN_SELECTION = 32,
3305 TFIND_NEW_SEARCH = 64
3306 } TextFindMode;
3308 /////////////////////////////////////////////////////////////////////////
3309 // IVsTextFind interface
3311 // Find a given hunk of text in the buffer
3312 /////////////////////////////////////////////////////////////////////////
3314 uuid(uuid_IVsTextFind)
3316 interface IVsTextFind : IUnknown
3318 HRESULT Find (
3319 [in] const WCHAR *pszText,
3320 [in] long iStartLine, // starting line
3321 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
3322 [in] long iEndLine, // ending line
3323 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
3324 [in] long iFlags, [out] long *piLine, [out] long *piCol);
3327 /////////////////////////////////////////////////////////////////////////
3328 // IVsTextBufferEvents interface
3330 // Events fired by text buffers
3331 /////////////////////////////////////////////////////////////////////////
3333 uuid(uuid_IVsTextBufferEvents)
3335 interface IVsTextBufferEvents : IUnknown
3337 // New language service has been associated with this buffer
3338 #ifdef PROXYSTUB_BUILD
3339 HRESULT OnNewLanguageService ([in] REFGUID sidLangServiceID);
3340 #else
3341 void OnNewLanguageService ([in] REFGUID sidLangServiceID);
3342 #endif
3345 /////////////////////////////////////////////////////////////////////////
3346 // IVsTextBufferDataEvents interface
3347 /////////////////////////////////////////////////////////////////////////
3349 uuid(uuid_IVsTextBufferDataEvents)
3351 interface IVsTextBufferDataEvents : IUnknown
3353 // This event forwards the IVsFileChangeEvents::FilesChanged notification that the TextBuffer monitors to other
3354 // interested parties. Non-TextEditorView (e.g. a Form view) will want to hook up to this event to manage whether
3355 // "[ReadOnly]" should be included in the document window caption (VSFPROPID_EditorCaption).
3356 // Note: dwFileAttrs is only valid if VSFILECHG_Attr is set in which case it returns the result of WinAPI GetFileAttributes().
3357 // This is useful to check for (dwFileAttrs & FILE_ATTRIBUTE_READONLY) to know if the file's ReadOnly status changes.
3358 #ifdef PROXYSTUB_BUILD
3359 HRESULT OnFileChanged([in] DWORD grfChange, [in] DWORD dwFileAttrs);
3360 #else
3361 void OnFileChanged([in] DWORD grfChange, [in] DWORD dwFileAttrs);
3362 #endif
3363 // This event is fired after the buffer is first initialized with data either by a call to IVsPersistDocData::LoadDocData,
3364 // IPersistStream::Load, IVsTextBuffer::InitializeContent, IPersistFile::Load/InitNew. This event is also fired if the
3365 // buffer executes a reload of its file in response to a OnFileChanged event (i.e. file edited outside of the Environment).
3366 // In the non-reload case, if ANY of the event sinks return an error HRESULT from OnLoadCompleted, this will cause the
3367 // corresponding Load[DocData] call to return with that same error HRESULT. In the reload scenario, the return value will
3368 // be ignored.
3369 HRESULT OnLoadCompleted([in] BOOL fReload);
3372 /////////////////////////////////////////////////////////////////////////
3373 // IVsTextStreamEvents interface
3375 // Events fired by stream-oriented text buffers
3376 /////////////////////////////////////////////////////////////////////////
3378 uuid(uuid_IVsTextStreamEvents)
3380 interface IVsTextStreamEvents : IUnknown
3382 #ifdef PROXYSTUB_BUILD
3383 HRESULT OnChangeStreamText ([in] long iPos,
3384 [in] long iOldLen,
3385 [in] long iNewLen,
3386 [in] BOOL fLast);
3388 HRESULT OnChangeStreamAttributes ([in] long iPos,
3389 [in] long iLength);
3390 #else
3391 void OnChangeStreamText ([in] long iPos,
3392 [in] long iOldLen,
3393 [in] long iNewLen,
3394 [in] BOOL fLast);
3396 void OnChangeStreamAttributes ([in] long iPos,
3397 [in] long iLength);
3398 #endif
3401 typedef enum _splitnotifycode
3403 SNC_BEGINSIZE,
3404 SNC_ENDSIZE,
3405 SNC_ANCESTORDETACHED,
3406 SNC_ANCESTORATTACHED,
3407 SNC_LBUTTONDBLCLK, // splitter was double clicked
3408 } SPLITNOTIFYCODE;
3410 typedef enum _splitflags
3412 SF_HORIZONTAL = 0x0000, // (default)
3413 SF_VERTICAL = 0x0001,
3415 SF_MAKESECONDARY = 0x0000, // (default)
3416 SF_MAKEPRIMARY = 0x0002,
3418 SF_ADJUSTABLE = 0x0000, // (default)
3419 SF_FIXED = 0x0004
3420 } SPLITFLAGS;
3422 typedef enum _paneflags
3424 PF_SUNKEN = 0x0000, // Default border style
3425 PF_RAISED = 0x0001,
3426 PF_ETCHED = 0x0002,
3427 PF_BUMP = 0x0003,
3428 PF_SHALLOW = 0x0004,
3429 PF_BORDERMASK = 0x0007,
3430 PF_BORDER = 0x0008, // Border types are ignored unless this is set
3431 PF_ELASTICX = 0x0010, // Pane "prefers" elasticity when sized horizontally
3432 PF_ELASTICY = 0x0020, // Pane "prefers" elasticity when sized vertically
3435 There is a slight misnomer with PF_NOFOCUS. If a pane specifies PF_NOFOCUS it can still
3436 get the focus via the mouse, but it will never participate in F6-style pane hopping.
3438 PF_NOFOCUS = 0x0040
3439 } PANEFLAGS;
3441 typedef enum _paneevents
3443 PE_GOTFOCUS = 1,
3444 PE_CLOSED,
3445 PE_FLAGSCHANGED,
3446 PE_DETACHED,
3447 PE_FOCUS_TO_EDIT_PANE // puts focus on an edit pane
3448 } PANEEVENTS;
3451 ////////////////////////////////////////////////////////////////////////////
3452 // IVsSplitPane interface
3453 ////////////////////////////////////////////////////////////////////////////
3455 uuid(uuid_IVsSplitPane)
3457 interface IVsSplitPane : IUnknown
3459 // Set/Get the parent splitter for this pane
3460 HRESULT SetParentSplitter ([in] IVsSplitter *pSplitter);
3461 HRESULT GetParentSplitter ([out] IVsSplitter **ppSplitter);
3463 // Set focus on this pane
3464 HRESULT SetFocus (void);
3466 // Set/Get position relative to parent HWND client area
3467 HRESULT SetPosition ([in] long iLeft, [in] long iTop, [in] long iRight, [in] long iBottom);
3468 HRESULT GetPosition ([out] long *piLeft, [out] long *piTop, [out] long *piRight, [out] long *piBottom);
3470 // Get mins and maxes for this pane (E_NOTIMPL is allowed; 0 and full screen are defaults)
3471 HRESULT GetSizeExtents ([out] long *piMinHorz, [out] long *piMaxHorz, [out] long *piMinVert, [out] long *piMaxVert);
3473 // Get the parent window of this pane. All panes have the same parent window,
3474 // which is the parent of all child windows created by leaf-node panes
3475 HRESULT GetParentWindow ([out] HWND *phwndParent);
3477 // Pane flags
3478 HRESULT GetPaneFlags ([out] DWORD *pdwPaneFlags);
3480 // Close this pane
3481 HRESULT ClosePane (void);
3483 // Notification of splitter adjustment
3484 HRESULT NotifyPane ([in] SPLITNOTIFYCODE iCode);
3486 // Detach this pane from its parent splitter, without closing
3487 HRESULT DetachPane (void);
3490 ////////////////////////////////////////////////////////////////////////////
3491 // IVsSplitter interface
3492 ////////////////////////////////////////////////////////////////////////////
3494 uuid(uuid_IVsSplitter)
3496 interface IVsSplitter : IVsSplitPane
3498 // Get the indicated pane (index can be 0 (primary), or 1 (secondary))
3499 HRESULT GetPane ([in] long iIndex, [out] IVsSplitPane **ppPane);
3501 // Called by child panes when they get focus, close, other events
3502 HRESULT NotifySplitter ([in] IVsSplitPane *pPane, [in] PANEEVENTS iEvent);
3504 // S_OK indicates given pane is primary; S_FALSE means secondary
3505 HRESULT IsPanePrimary ([in] IVsSplitPane *pPane);
3507 // Handle mouse-oriented message
3508 HRESULT HandleMessage ([in] UINT iMsg, [in] WPARAM wParam, [in] LPARAM lParam);
3510 // Split the indicated pane of this splitter. The provided pane can
3511 // become either the primary or secondary pane of the newly created
3512 // splitter pane, which replaces the indicated pane. iSize refers to
3513 // the size of the new pane, regardless of if it is becoming the primary
3514 // or secondary pane.
3515 HRESULT SplitPane ([in] IVsSplitPane *pNewPane, [in] long iIndex, [in] long iSize, [in] DWORD dwFlags, [out] IVsSplitter **ppSplitter);
3518 typedef enum _panetype
3520 GP_FOCUS = 1,
3521 GP_NEXT,
3522 GP_PREV
3523 } PANETYPE;
3525 ////////////////////////////////////////////////////////////////////////////
3526 // IVsSplitRoot interface
3527 ////////////////////////////////////////////////////////////////////////////
3529 uuid(uuid_IVsSplitRoot)
3531 interface IVsSplitRoot : IUnknown
3533 HRESULT GetRootSplitter ([out] IVsSplitter **ppPane);
3534 HRESULT GetWindowHandle ([out] HWND *phwnd);
3535 HRESULT GetPane([in] PANETYPE paneType, [out] IVsSplitPane **ppPane);
3538 // Parameter to IVsCodeWindow::GetEditorCaption
3539 typedef enum _READONLYSTATUS
3541 ROSTATUS_NotReadOnly = 0,
3542 ROSTATUS_ReadOnly = 1,
3543 ROSTATUS_Unknown = -1, // determine status by checking with the associated TextBuffer
3544 } READONLYSTATUS;
3547 ////////////////////////////////////////////////////////////////////////////
3548 // IVsCodeWindow interface
3549 ////////////////////////////////////////////////////////////////////////////
3551 uuid(uuid_IVsCodeWindow)
3553 interface IVsCodeWindow : IUnknown
3555 HRESULT SetBuffer ([in] IVsTextLines *pBuffer);
3556 HRESULT GetBuffer ([out] IVsTextLines **ppBuffer);
3557 HRESULT GetPrimaryView ([out] IVsTextView **ppView);
3558 HRESULT GetSecondaryView ([out] IVsTextView **ppView);
3560 // The code window by default uses CLSID_VsTextView for the edit panes.
3561 // Use these methods to query/change the text view class to use.
3562 HRESULT SetViewClassID ([in] REFCLSID clsidView);
3563 HRESULT GetViewClassID ([out] CLSID *pclsidView);
3565 // Used by editors to append custom text to the editor caption.
3567 // NOTE: the LPCOLESTR * in this method is basically a design flaw, but use it for now.
3568 // There's too much code relying on the current behavior.
3569 HRESULT SetBaseEditorCaption([in] LPCOLESTR *pszBaseEditorCaption);
3570 HRESULT GetEditorCaption([in] READONLYSTATUS dwReadOnly, [out] BSTR *pbstrEditorCaption);
3572 // UNDONE: Remove when IWindowPane gets a Close() method
3573 HRESULT Close (void);
3575 HRESULT GetLastActiveView ([out] IVsTextView **ppView);
3578 ////////////////////////////////////////////////////////////////////////////
3579 // IVsCodeWindowManager interface
3581 // NOTE: To get the code window manager attached to an instance of
3582 // IVsCodeWindow, QS it for SID_SVsCodeWindowManager and the interface you want
3583 // on it. It is inappropriate for any external entity (other than the
3584 // code window itself) to call IVsCodeWindowManager methods, but private
3585 // interfaces may be exposed on the code window manager that may be useful
3586 // to other parties.
3587 ////////////////////////////////////////////////////////////////////////////
3589 uuid(uuid_IVsCodeWindowManager)
3591 interface IVsCodeWindowManager : IUnknown
3593 // Called by a code window to provide opportunity to add adornments
3594 // (additional split panes) to the code window, etc.
3597 Note: this is a convenient place for the following operations:
3598 - Adding a dropdown bar (IVsDropdownBar).
3599 - Adding attributes/context to the current user context (in some situations).
3600 - Updating an editor caption by calling IVsCodeWindow::SetBaseEditorCaption/GetEditorCaption,
3601 then using IVsFindTarget to get the window frame & then using the window frame to set the
3602 actual window frame's editor caption.
3604 HRESULT AddAdornments (void);
3606 // The language has changed, or the code window is going away; this
3607 // code win mgr needs to now remove its adornments
3608 HRESULT RemoveAdornments (void);
3610 // A new text view has been created in the code window; now's your
3611 // chance to provide a filter for it.
3612 HRESULT OnNewView ([in] IVsTextView *pView);
3616 // DROPDOWNFONTATTR is an enum used by IVsDropdownBarClient to describe the appearance of text entries.
3617 enum DROPDOWNFONTATTR
3619 FONTATTR_PLAIN = 0, // plain text
3620 FONTATTR_BOLD = 1, // bold text
3621 FONTATTR_ITALIC = 2, // italicized text
3622 FONTATTR_UNDERLINE = 4, // underlined text
3623 FONTATTR_GRAY = 8 // grayed out text
3626 // DROPDOWNENTRYTYPE is used by IVsDropdownBarClient to pick the drawing protocol requested for a combo.
3627 enum DROPDOWNENTRYTYPE
3629 ENTRY_TEXT = 1, // plain text only (IVsDropdownBarClient::GetText will be called)
3630 ENTRY_ATTR = 2, // text that may have bold/italic/underline attributes (IVsDropdownBarClient::GetAttributes will be called)
3631 ENTRY_IMAGE = 4 // a glyph is drawn to the left of the entries (IVsDropdownBarClient::GetImage will be called)
3634 ////////////////////////////////////////////////////////////////////////////
3635 // IVsDropdownBarClient interface
3637 // NOTE: the HANDLE * from GetComboAttributes obviously cannot be marshalled across machines.
3639 ////////////////////////////////////////////////////////////////////////////
3641 uuid(uuid_IVsDropdownBarClient)
3643 interface IVsDropdownBarClient : IUnknown
3646 SetDropdownBar is called by the dropdownbar to hook itself up to the client. The reason
3647 this callback is necessary rather than relying on a return value from
3648 IVsDropdownBarManager::AddDropdownBar is that client callbacks are required as a result
3649 of attaching the combo bar, before IVsDropdownBarManager::AddDropdownBar even returns!
3650 SetDropdownBar should be called exactly once.
3652 HRESULT SetDropdownBar([in] IVsDropdownBar *pDropdownBar);
3654 // called whenever info about a combo is needed; any of the out parameters are allowed to be passed in as NULL ptrs if not needed
3655 HRESULT GetComboAttributes(
3656 [in] long iCombo,
3657 [out] ULONG *pcEntries,
3658 [out] ULONG *puEntryType, // ORing of DROPDOWNENTRYTYPE enum
3659 [out] HANDLE *phImageList // actually an HIMAGELIST
3662 // called for ENTRY_TEXT
3663 HRESULT GetEntryText([in] long iCombo, [in] long iIndex, [out] WCHAR **ppszText);
3665 // called for ENTRY_ATTR
3666 HRESULT GetEntryAttributes([in] long iCombo, [in] long iIndex, [out] ULONG *pAttr); // ORing of DROPDOWNFONTATTR enum values
3669 GetImage will only be called if you specified ENTRY_IMAGE for the entry attributes of the given combo.
3670 There are two expected return codes from GetImage:
3671 S_OK: Draw the glyph indicated in *piImageIndex. Use this for entries that should have a glyph.
3672 S_FALSE: Set aside space for a glyph, but don't draw anything. Use this for entries that don't have
3673 a glyph but might have sibling entries in the same combo with glyphs.
3674 Other: Some terrible failure occured.
3676 It is presently assumed that your image lists will all be of the same height.
3678 HRESULT GetEntryImage([in] long iCombo, [in] long iIndex, [out] long *piImageIndex);
3680 HRESULT OnItemSelected([in] long iCombo, [in] long iIndex);
3681 HRESULT OnItemChosen([in] long iCombo, [in] long iIndex);
3682 HRESULT OnComboGetFocus([in] long iCombo);
3684 // GetComboTipText returns a tooltip for an entire combo
3685 HRESULT GetComboTipText([in] long iCombo, [out] BSTR *pbstrText);
3688 ////////////////////////////////////////////////////////////////////////////
3689 // IVsDropdownBar interface
3691 // Used to provide dropdowns at the top of a code window like in VB. To get
3692 // one of these, use IVsDropdownBarManager.
3693 ////////////////////////////////////////////////////////////////////////////
3695 uuid(uuid_IVsDropdownBar)
3697 interface IVsDropdownBar : IUnknown
3700 Attach is called by IVsDropdownBarManager::AddDropdownBar. This function
3701 creates the window and dropdown combos and sets up a link between the dropdown
3702 bar and its client. Do not call this function unless you're bypassing
3703 IVsDropdownBarManager.
3705 HRESULT Attach(
3706 [in] HWND hwndParent,
3707 [in] long cCombos,
3708 [in] IVsDropdownBarClient *pClient);
3711 Detach is called by IVsDropdownBarManager::RemoveDropdownBar. This function
3712 breaks the link between the dropdown bar and its client. Do not call this
3713 function unless you're bypassing IVsDropdownBarManager and in the process of
3714 removing the dropdown bar from the window.
3716 #ifdef PROXYSTUB_BUILD
3717 HRESULT Detach(void);
3718 #else
3719 void Detach(void);
3720 #endif
3722 // GetCurrentSelection tells you what entry is currently selected in a given
3723 // combo. Note that mouse moves change the highlight but not the selection.
3724 HRESULT GetCurrentSelection([in] long iCombo, [out] long *piCurSel);
3726 // RefreshCombo is used to force a repaint of a combo, specifying the new selection.
3727 HRESULT RefreshCombo([in] long iCombo, [in] long iNewSelection);
3729 // GetClient sends back the client associated with this dropdown bar.
3730 HRESULT GetClient([out] IVsDropdownBarClient **ppClient);
3732 // Sets the current selection in the given combo
3733 HRESULT SetCurrentSelection([in] long iCombo, [in] long iNewSelection);
3737 ////////////////////////////////////////////////////////////////////////////
3738 // IVsDropdownBarManager interface
3739 ////////////////////////////////////////////////////////////////////////////
3741 uuid(uuid_IVsDropdownBarManager)
3743 interface IVsDropdownBarManager : IUnknown
3745 // AddDropdownBar lets you add a set of combo dropdowns to a code window. This call
3746 // wraps the call to IVsDropdownBar::Attach. If there is already a dropdown bar
3747 // attached to the code window it returns E_UNEXPECTED. In general you should call
3748 // GetDropdownBar first before calling AddDropdownBar to make sure there isn't already
3749 // a dropdown bar associated with the given code window.
3750 HRESULT AddDropdownBar([in] long cCombos,
3751 [in] IVsDropdownBarClient *pClient);
3753 // GetDropdownBar sends back the dropdown bar associated with the code window, if
3754 // if any. If there is one, it returns S_OK and sends back an AddRef'd ptr to it.
3755 // If there isn't one, it returns S_FALSE and nulls out the out param.
3756 HRESULT GetDropdownBar([out] IVsDropdownBar **ppDropdownBar);
3758 // RemoveDropdownBar removes a dropdown bar from a code window.
3759 HRESULT RemoveDropdownBar(void);
3762 ////////////////////////////////////////////////////////////////////////////
3763 // IVsButtonBarClient interface
3765 ////////////////////////////////////////////////////////////////////////////
3767 uuid(uuid_IVsButtonBarClient)
3769 interface IVsButtonBarClient : IUnknown
3772 SetButtonBar is called by the Buttonbar to hook itself up to the client. The reason
3773 this callback is necessary rather than relying on a return value from
3774 IVsButtonBarManager::AddButtonBar is that client callbacks are required as a result
3775 of attaching the combo bar, before IVsButtonBarManager::AddButtonBar even returns!
3776 SetButtonBar should be called exactly once.
3778 HRESULT SetButtonBar([in] IVsButtonBar *pButtonBar);
3780 // GetButtonTipText sends back text for a tooltip over the button
3781 HRESULT GetButtonTipText([in] long iButton, [out] BSTR *pbstrTip);
3783 // OnButtonPressed is fired whenever a new button is pressed.
3784 HRESULT OnButtonPressed([in] long iButton);
3787 /////////////////////////////////////////////////////////////////////////////////////////////////////
3788 // IVsButtonBar interface
3790 // Used to provide buttons at the bottom of a code window like in VB for fn-at-a-time view toggling.
3791 //////////////////////////////////////////////////////////////////////////////////////////////////////
3793 uuid(uuid_IVsButtonBar)
3795 interface IVsButtonBar : IUnknown
3798 Attach is called by IVsButtonBarManager::AddButtonBar. This function
3799 creates the window and Button combos and sets up a link between the Button
3800 bar and its client. Do not call this function unless you're bypassing
3801 IVsButtonBarManager. Each bmp in the image list MUST be 16x16.
3803 HRESULT Attach(
3804 [in] HWND hwndParent,
3805 [in] long cButtons,
3806 [in] HANDLE hImageList,
3807 [in] IVsButtonBarClient *pClient);
3810 Detach is called by IVsButtonBarManager::RemoveButtonBar. This function
3811 breaks the link between the button bar and its client, dropping the reference
3812 that the button bar has on the client.
3814 #ifdef PROXYSTUB_BUILD
3815 HRESULT Detach(void);
3816 #else
3817 void Detach(void);
3818 #endif
3820 HRESULT SetHeight([in] long iHeight); // this is called by the parent; clients need not call this unless writing another owner for it
3821 HRESULT GetSize([out] long *piWidth, long *piHeight); // the width is a fn of height
3823 // SetCurrentSelection specifies which button is selected
3824 HRESULT SetCurrentSelection([in] long iCurButton);
3825 // GetCurrentSelection tells you what button is currently pressed.
3826 HRESULT GetCurrentSelection([out] long *piCurButton);
3828 // GetClient sends back the client associated with this Button bar.
3829 HRESULT GetClient([out] IVsButtonBarClient **ppClient);
3833 ////////////////////////////////////////////////////////////////////////////
3834 // IVsButtonBarManager interface
3835 ////////////////////////////////////////////////////////////////////////////
3837 uuid(uuid_IVsButtonBarManager)
3839 interface IVsButtonBarManager : IUnknown
3841 // AddButtonBar lets you add a set of combo Buttons to a code window. This call
3842 // wraps the call to IVsButtonBar::Attach. If there is already a Button bar
3843 // attached to the code window it returns E_UNEXPECTED. In general you should call
3844 // GetButtonBar first before calling AddButtonBar to make sure there isn't already
3845 // a button bar associated with the given code window.
3846 HRESULT AddButtonBar(
3847 [in] long cButtons,
3848 [in] HANDLE hImageList, // actually an HIMAGELIST
3849 [in] IVsButtonBarClient *pClient);
3851 // GetButtonBar sends back the Button bar associated with the code window, if
3852 // if any. If there is one, it returns S_OK and sends back an AddRef'd ptr to it.
3853 // If there isn't one, it returns S_FALSE and nulls out the out param.
3854 HRESULT GetButtonBar([out] IVsButtonBar **ppButtonBar);
3856 // RemoveButtonBar removes a Button bar from a code window.
3857 HRESULT RemoveButtonBar(void);
3861 ////////////////////////////////////////////////////////////////////////////
3862 // IVsDefaultButtonBarImages interface
3864 ////////////////////////////////////////////////////////////////////////////
3866 uuid(uuid_IVsDefaultButtonBarImages)
3868 interface IVsDefaultButtonBarImages : IUnknown
3870 HRESULT GetButtonCount([out] long *pcButtons);
3873 Do not attempt to free this image list that you get back; the implementor of this interface will do that.
3875 HRESULT GetImageList([out] HANDLE *phImageList);
3879 typedef enum
3881 MOVESELECTION_REL_CHARACTER = 1,
3882 MOVESELECTION_REL_WORD,
3883 MOVESELECTION_REL_LINE,
3884 MOVESELECTION_REL_PAGE
3885 } MOVESELECTION_REL_TYPE;
3887 typedef enum
3889 MOVESELECTION_ABS_FIRSTCOLUMN = 1,
3890 MOVESELECTION_ABS_FIRSTTEXTCOLUMN,
3891 MOVESELECTION_ABS_LASTCOLUMN,
3892 MOVESELECTION_ABS_FIRSTLINE,
3893 MOVESELECTION_ABS_LASTLINE
3894 } MOVESELECTION_ABS_TYPE;
3896 typedef enum
3898 CASESELECTION_UPPER = 1,
3899 CASESELECTION_LOWER,
3900 CASESELECTION_TITLE
3901 } CASESELECTION_TYPE;
3903 ////////////////////////////////////////////////////////////////////////////
3904 // IVsTextMacroHelper interface
3906 // Used to emit macro recording code. An action performed in the editor
3907 // should be captured by recording automation code that can later be
3908 // replayed by the user to repeat the action.
3909 ////////////////////////////////////////////////////////////////////////////
3912 uuid(uuid_IVsTextMacroHelper)
3914 interface IVsTextMacroHelper : IUnknown
3916 // Typing into file
3917 HRESULT RecordNewLine();
3918 HRESULT RecordTypeChar(OLECHAR wchChar, BOOL fIsOvertype);
3919 HRESULT RecordTypeChars(LPCOLESTR pwszChars, BOOL fIsOvertype);
3920 HRESULT RecordRemovePreviousTyping(LPCOLESTR pwszPrevChars);
3922 // Deleting
3923 HRESULT RecordDelete(BOOL fLeft, UINT uiReps);
3924 HRESULT RecordDeleteSpace(BOOL fVertical);
3926 // Selection changes
3927 HRESULT RecordMoveSelectionRel(MOVESELECTION_REL_TYPE mst, BOOL fBackwards, BOOL fExtend);
3928 HRESULT RecordMoveSelectionAbs(MOVESELECTION_ABS_TYPE mst, BOOL fExtend);
3929 HRESULT RecordCollapseSelection();
3930 HRESULT RecordSelectAll();
3931 HRESULT RecordSwapAnchor();
3932 HRESULT RecordEnterBoxMode();
3933 HRESULT RecordActivateDocument();
3934 HRESULT RecordGotoLine(long iLine, BOOL fExtend);
3936 // Clipboard
3937 HRESULT RecordCut();
3938 HRESULT RecordCopy();
3939 HRESULT RecordPaste();
3941 // Bookmarks
3942 HRESULT RecordBookmarkClearAll();
3943 HRESULT RecordBookmarkSetClear(BOOL fSet);
3944 HRESULT RecordBookmarkNextPrev(BOOL fNext);
3946 // Formatting
3947 HRESULT RecordChangeCase(CASESELECTION_TYPE cst);
3948 HRESULT RecordIndentUnindent(BOOL fIndent);
3949 HRESULT RecordFormatSelection();
3950 HRESULT RecordTabifyUntabify(BOOL fTabify);
3952 // Misc. file manipulation
3953 HRESULT RecordInsertFile(LPCOLESTR pwszName);
3956 ////////////////////////////////////////////////////////////////////////////
3957 // IVsUserData interface
3958 ////////////////////////////////////////////////////////////////////////////
3960 uuid(uuid_IVsUserData)
3962 interface IVsUserData : IUnknown
3964 // UNDONE: Midl barfs on the following for some weird reason...
3965 //[propput] HRESULT Data ([in] REFGUID riidKey, [in] VARIANT vtData);
3966 //[propget] HRESULT Data ([in] REFGUID riidKey, [out,retval] VARIANT *pvtData);
3967 HRESULT GetData ([in] REFGUID riidKey, [out] VARIANT *pvtData);
3968 HRESULT SetData ([in] REFGUID riidKey, [in] VARIANT vtData);
3971 ////////////////////////////////////////////////////////////////////////////
3972 // IVsUserDataEvents interface
3973 ////////////////////////////////////////////////////////////////////////////
3975 uuid(uuid_IVsUserDataEvents)
3977 interface IVsUserDataEvents : IUnknown
3979 #ifdef PROXYSTUB_BUILD
3980 HRESULT OnUserDataChange ([in] REFGUID riidKey, [in] VARIANT vtNewValue);
3981 #else
3982 void OnUserDataChange ([in] REFGUID riidKey, [in] VARIANT vtNewValue);
3983 #endif
3986 ////////////////////////////////////////////////////////////////////////////
3987 // IVsUndoUnit interface
3989 // Interface an IOleUndoUnit exposes if it wants to be able to put UI-only
3990 // undo items (like text selection and/or caret movements) on the undo stack
3991 // which will NOT blow away the redo stack. The VS implementation of
3992 // IOleUndoManager looks for this interface and if found calls fChangeData()
3993 // to determine whether this is a UI-only undo unit (fChangeData returns FALSE).
3994 ////////////////////////////////////////////////////////////////////////////
3996 uuid(uuid_IVsUndoUnit)
3998 interface IVsUndoUnit : IUnknown
4000 // does this undo unit change data? - if so, undo mgr blows redo stack
4001 #ifdef PROXYSTUB_BUILD
4002 // NOTE: Check if this change is safe on 64bits platforms.
4003 HRESULT fChangeData(void);
4004 #else
4005 BOOL fChangeData(void);
4006 #endif
4009 ////////////////////////////////////////////////////////////////////////////
4010 // IVsUndoTrackingEvents interface
4012 // Interface an IOleUndoManager client can expose to be told by the undo
4013 // manager the undo stack has returned to an unmodified state (i.e. no
4014 // data-changing mods exist). This is how the "remove modified star after
4015 // undo" feature works.
4016 ////////////////////////////////////////////////////////////////////////////
4018 uuid(uuid_IVsUndoTrackingEvents)
4020 interface IVsUndoTrackingEvents : IUnknown
4022 // tells the client that we've returned to a clean state
4023 #ifdef PROXYSTUB_BUILD
4024 HRESULT OnReturnToCleanState(void);
4025 #else
4026 void OnReturnToCleanState(void);
4027 #endif
4030 ////////////////////////////////////////////////////////////////////////////
4031 // IVsChangeTrackingUndoManager interface
4033 // Interface an IOleUndoManager implementation can expose to help clients
4034 // know when the undo stack has returned to an unmodified state (i.e. no
4035 // data-changing mods exist). This is how the "remove modified star after
4036 // undo" feature works.
4037 ////////////////////////////////////////////////////////////////////////////
4039 uuid(uuid_IVsChangeTrackingUndoManager)
4041 interface IVsChangeTrackingUndoManager : IUnknown
4043 // tell the undo manager that we're at an unmodified point (e.g. called after a save operation)
4044 HRESULT MarkCleanState(void);
4046 // find out whether we're at an umodified state (no particular need, but seems like it would be useful)
4047 HRESULT QueryCleanState([out] BOOL *pfClean);
4050 These calls manage an event interface to be told when we return to unmodified state.
4052 IMPORTANT: These interfaces *DO NOT* call AddRef/Release on pUndoTrackingEvents so as to avoid
4053 circular reference problems. Therefore you should be sure to call UnadviseTrackingClient()
4054 before you release your reference to the undo manager, or the undo manager will assert.
4056 HRESULT AdviseTrackingClient([in] IVsUndoTrackingEvents *pUndoTrackingEvents);
4057 HRESULT UnadviseTrackingClient(void);
4062 uuid(uuid_IVsLinkedUndoClient)
4064 interface IVsLinkedUndoClient : IUnknown
4067 When this method is called, it means that your undo manager has a non-linked action on
4068 top of its undo or redo stack which is blocking another undo manager from executing its
4069 linked action.
4071 If possible, you should do the following in response to this call:
4072 1) Activate a window with a view on the corresponding data using the undo manager.
4073 2) Put up a message box with the provided localized error string or put up your own
4074 custom UI.
4076 If you CAN do the above two so that the user knows what happened, return S_OK. Otherwise,
4077 you must return E_FAIL, which will cause the undo to fail and break all transaction links
4078 to that document.
4080 HRESULT OnInterveningUnitBlockingLinkedUndo(void);
4084 uuid(uuid_IVsLinkCapableUndoManager)
4086 interface IVsLinkCapableUndoManager : IUnknown
4089 These calls manage an event interface to be told when we need to put focus on the owner of
4090 the given undo manager.
4092 Implicit linked undos will only work for undo managers where AdviseLinkedUndoClient has
4093 been called!
4095 IMPORTANT: These interfaces *DO NOT* call AddRef/Release on pClient so as to avoid
4096 circular reference problems. Therefore you should be sure to call UnadviseLinkedUndoClient()
4097 before you release your reference to the undo manager, or the undo manager will assert.
4099 HRESULT AdviseLinkedUndoClient([in] IVsLinkedUndoClient *pClient);
4100 HRESULT UnadviseLinkedUndoClient(void);
4104 uuid(uuid_IVsLifetimeControlledObject)
4106 interface IVsLifetimeControlledObject : IUnknown
4108 HRESULT SeverReferencesToOwner(void); // indicates that it should clear all stacks & be zombified
4113 IVsLinkedUndoTransactionManager
4115 This is a service used to implement the linked undo stacks feature. To get this, use
4116 QueryService(SID_SVsLinkedUndoManager, IID_IVsLinkedUndoTransactionManager).
4118 The contract here is the same as IVsCompoundAction. The string passed into OpenLinkedUndo identifies
4119 the action in the UI if this is the outermost multi doc undo. After calling OpenLinkedUndo you must
4120 later call CloseLinkedUndo or AbortLinkedUndo.
4122 Note that there is only one multi doc undo service; one session can, however, contain another.
4125 typedef enum _LinkedTransactionFlags
4127 mdtDefault = 0x0, // non-strict transaction
4128 mdtStrict = 0x1 // strict transaction
4129 } LinkedTransactionFlags;
4132 uuid(uuid_IVsLinkedUndoTransactionManager)
4134 interface IVsLinkedUndoTransactionManager : IUnknown
4136 HRESULT OpenLinkedUndo(
4137 [in] DWORD dwFlags, // ORing of LinkedTransactionFlags enum values
4138 [in] const WCHAR *pszDescription); // Localized string that describes this action; appears in the undo/redo dropdowns. May NOT be NULL!!
4140 HRESULT CloseLinkedUndo(void); // successful completion
4143 WARNING: in vs7, AbortLinkedUndo does not roll back the most recently opened subtransaction. Instead,
4144 it marks the ENTIRE transaction for death when the outermost CloseLinkedUndo/AbortLinkedUndo
4145 is called.
4147 HRESULT AbortLinkedUndo(void); // unsuccessful completion; rolls back all actions done since OpenLinkedUndo was called
4149 HRESULT IsAborted(BOOL *pfAborted);
4150 HRESULT IsStrict(BOOL *pfStrict);
4151 HRESULT CountOpenTransactions(long *pCount);
4156 IVsLimitedLinkedUndoTransactionManager
4157 ========================================
4159 This interface is not planned to be implemented for vs7. But when/if the need arises for non-global
4160 (or, more accurately, non-implicit) linked undo transactions, it can very easily be exposed via the
4161 following interface. Since this is a natural complement to IVsLinkedUndoTransactionManager, this
4162 interface should stay here for future reference in case it needs to be used someday.
4165 uuid(uuid_IVsLimitedLinkedUndoTransactionManager)
4167 interface IVsLimitedLinkedUndoTransactionManager : IUnknown
4169 HRESULT CreateLimitedLinkedUndo(
4170 [in] DWORD dwFlags, // ORing of LinkedTransactionFlags enum values
4171 [in] const WCHAR *pszDescription, // Localized string that describes this action; appears in the undo/redo dropdowns. May NOT be NULL!!
4172 [out] DWORD *pdwCookie); // DWORD describing transaction
4174 HRESULT AddToLimitedLinkedUndo(
4175 [in] DWORD dwCookie,
4176 [in] IOleUndoManager *pUndoMgr);
4178 HRESULT CloseLimitedLinkedUndo(
4179 [in] DWORD dwCookie);
4184 ChangeClusterFlags
4186 Flags used for IVsChangeClusterEvents.
4188 typedef enum _ChangeClusterFlags
4190 CCE_BEFORE_OPEN = 0x0001, // indicates that the notification is being fired before a cluster has opened
4191 CCE_BEFORE_CLOSE = 0x0002, // indicates that the notification is being fired before a cluster has closed
4192 CCE_AFTER_CLOSE = 0x0004, // indicates that the notification is being fired after a cluster has closed
4194 CCE_UNDO = 0x0008, // indicates that a cluster is an undo operation
4195 CCE_REDO = 0x0010, // indicates that a cluster is a redo operation
4197 CCE_FLUSH = 0x0020, // indicates an early notification was prompted by an explicit flush request
4199 CCE_ABORTED = 0x0100 // indicates that a cluster has been aborted
4200 } ChangeClusterFlags;
4204 IVsChangeClusterEvents is used to bracket a series of changes from an undo manager. To get it, QI an
4205 undo manager for IConnectionPointContainer and go from there.
4207 A cluster is a series of edits that is grouped into an undo action.
4209 NOTE: This event set, which is used internally for the text buffer's commit event, is being exposed for a
4210 very specific purpose by the edit & continue group. Listening to this event set imposes nontrivial
4211 overhead for every modification made to a text buffer. You may look at this interface and be tempted to
4212 use it for many different things, but this is not encouraged. Do not use this interface unless you have
4213 talked to the text editor team and have confirmed that you have no other options. In particular,
4214 IVsPreliminaryTextChangeCommitEvents (which is built on top of this event) should be able to address the
4215 needs of most clients without needing to listen to IVsChangeClusterEvents.
4218 uuid(uuid_IVsChangeClusterEvents)
4220 interface IVsChangeClusterEvents : IUnknown
4222 #ifdef PROXYSTUB_BUILD
4223 HRESULT OnChangeClusterOpening([in] DWORD dwFlags);
4224 HRESULT OnChangeClusterClosing([in] DWORD dwFlags);
4225 #else
4226 void OnChangeClusterOpening([in] DWORD dwFlags);
4227 void OnChangeClusterClosing([in] DWORD dwFlags);
4228 #endif
4232 ////////////////////////////////////////////////////////////////////////////
4233 // VsUserData coclass
4234 ////////////////////////////////////////////////////////////////////////////
4236 uuid(uuid_coclass_VsLocalUserData),
4237 helpstring("VsLocalUserData Class")
4239 coclass VsLocalUserData
4241 interface IVsUserData;
4244 ////////////////////////////////////////////////////////////////////////////
4245 // VsUserData coclass
4246 ////////////////////////////////////////////////////////////////////////////
4248 uuid(uuid_coclass_VsUserData),
4249 helpstring("VsUserData Class")
4251 coclass VsUserData
4253 interface IVsUserData;
4256 ////////////////////////////////////////////////////////////////////////////
4257 // VsCodeWindow coclass
4258 ////////////////////////////////////////////////////////////////////////////
4260 uuid(uuid_coclass_VsCodeWindow),
4261 helpstring("VsCodeWindow Class")
4263 coclass VsCodeWindow
4265 interface IVsCodeWindow;
4268 ////////////////////////////////////////////////////////////////////////////
4269 // VsSplitRoot coclass
4270 ////////////////////////////////////////////////////////////////////////////
4272 uuid(uuid_coclass_VsSplitRoot),
4273 helpstring("VsSplitRoot Class")
4275 coclass VsSplitRoot
4277 interface IVsSplitRoot;
4280 /////////////////////////////////////////////////////////////////////////
4281 // VsDropdownBar class
4283 uuid(uuid_coclass_VsDropdownBar),
4284 helpstring("VsDropdownBar Class")
4286 coclass VsDropdownBar
4288 [default] interface IVsDropdownBar;
4291 ////////////////////////////////////////////////////////////////////////////
4292 // VsTextBuffer coclass
4293 ////////////////////////////////////////////////////////////////////////////
4295 uuid(uuid_coclass_VsTextBuffer),
4296 helpstring("VsTextBuffer Class")
4298 coclass VsTextBuffer
4300 interface IVsTextBuffer;
4301 interface IVsTextLines;
4304 ////////////////////////////////////////////////////////////////////////////
4305 // VsTextLineStorage coclass
4306 ////////////////////////////////////////////////////////////////////////////
4308 uuid(uuid_coclass_VsTextLineStorage),
4309 helpstring("VsTextLineStorage Class")
4311 coclass VsTextLineStorage
4313 interface IVsTextStorage;
4314 interface IVsPersistentTextImage;
4317 ////////////////////////////////////////////////////////////////////////////
4318 // VsTextManager coclass
4319 ////////////////////////////////////////////////////////////////////////////
4321 uuid(uuid_coclass_VsTextManager),
4322 helpstring("VsTextManager Class")
4324 coclass VsTextManager
4326 interface IVsTextManager;
4329 ////////////////////////////////////////////////////////////////////////////
4330 // VsTextView coclass
4331 ////////////////////////////////////////////////////////////////////////////
4333 uuid(uuid_coclass_VsTextView),
4334 helpstring("VsTextView Class")
4336 coclass VsTextView
4338 interface IVsTextView;
4341 ////////////////////////////////////////////////////////////////////////////
4342 // VsTextPackage coclass
4343 ////////////////////////////////////////////////////////////////////////////
4345 uuid(uuid_coclass_VsTextPackage),
4346 helpstring("VsTextPackage Class")
4348 coclass VsTextPackage
4350 interface IVsTextManager;
4353 ////////////////////////////////////////////////////////////////////////////
4354 // VsUndoPackage coclass
4355 ////////////////////////////////////////////////////////////////////////////
4357 uuid(uuid_coclass_VsUndoPackage),
4358 helpstring("VsUndoPackage Class")
4360 coclass VsUndoPackage
4362 interface IVsLinkedUndoTransactionManager;
4365 ////////////////////////////////////////////////////////////////////////////
4366 // VsUndoUnit coclass
4367 ////////////////////////////////////////////////////////////////////////////
4369 uuid(uuid_coclass_VsUndoUnit),
4370 helpstring("VsUndoUnit Class")
4372 coclass VsUndoUnit
4374 interface IVsUndoUnit;
4377 ////////////////////////////////////////////////////////////////////////////
4378 // VsMethodTipWindow coclass
4379 ////////////////////////////////////////////////////////////////////////////
4381 uuid(uuid_coclass_VsMethodTipWindow),
4382 helpstring("VsMethodTipWindow Class")
4384 coclass VsMethodTipWindow
4386 interface IVsMethodTipWindow;
4389 ////////////////////////////////////////////////////////////////////////////
4390 // VsTextTipWindow coclass
4391 ////////////////////////////////////////////////////////////////////////////
4393 uuid(uuid_coclass_VsTextTipWindow),
4394 helpstring("VsTextTipWindow Class")
4396 coclass VsTextTipWindow
4398 interface IVsTextTipWindow;
4402 VsHiddenTextLayer coclass
4405 uuid(uuid_coclass_VsHiddenTextLayer)
4407 coclass VsHiddenTextLayer
4409 interface IVsHiddenTextSession;
4413 VsDefaultButtonBarImages coclass
4416 uuid(uuid_coclass_VsDefaultButtonBarImages)
4418 coclass VsDefaultButtonBarImages
4420 interface IVsDefaultButtonBarImages;
4424 uuid(uuid_coclass_VsSyntheticTextLayer)
4426 coclass VsSyntheticTextLayer
4428 interface IVsSyntheticTextSession;
4433 uuid(uuid_coclass_VsDiffLayer)
4435 coclass VsDiffLayer
4437 interface IUnknown;
4440 /*-------------*/
4442 cpp_quote("#define SID_SVsTextManager CLSID_VsTextManager")
4443 cpp_quote("#define SID_SVsLanguageFilter IID_IVsTextViewFilter")
4444 cpp_quote("#define SID_SVsCodeWindowManager IID_IVsCodeWindowManager")
4445 cpp_quote("#define SID_SVsCodeWindow IID_IVsCodeWindow")
4446 cpp_quote("#define SID_SVsLinkedUndoTransactionManager IID_IVsLinkedUndoTransactionManager")
4448 ////////////////////////////////////////////////////////////////////////////
4449 // Buffer-defined UserData GUIDs
4451 ////////////////////////////////////////////////////////////////////////////
4453 //--------------------------------------------------------------------------
4454 // GUID_VsBufferMoniker VT_BSTR
4455 cpp_quote("#define GUID_VsBufferMoniker IID_IVsUserData")
4457 //--------------------------------------------------------------------------
4458 // GUID_VsBufferIsDiskFile VT_BOOL {D9126592-1473-11d3-BEC6-0080C747D9A0}
4460 // VARIANT_TRUE if buffer is a file on disk
4461 // You cannot set this property.
4463 cpp_quote("extern const __declspec(selectany) GUID GUID_VsBufferIsDiskFile = { 0xd9126592, 0x1473, 0x11d3, { 0xbe, 0xc6, 0x0, 0x80, 0xc7, 0x47, 0xd9, 0xa0 } };")
4465 //--------------------------------------------------------------------------
4466 // GUID_VsBufferEncoding VT_UI4 {212729AC-D6BB-11d0-AE75-00C04FB68006}
4468 // Obsolete- Should use GUID_VsBufferEncodingVSTFF
4470 // CHARFMT in the low word, codepage in the high word
4472 // CHARFMT charfmt; // CHARFMT_UNI, CHARFMT_UNI_SWAP, CHARFMT_MBCS, CHARFMT_UTF8
4473 // UINT codepage; // Affects persistence format only when charfmt == CHARFMT_MBCS
4474 // DWORD dwBufferEncoding;
4476 // dwBufferEncoding = MAKELONG(charfmt,codepage); // to create
4477 // codepage = HIWORD(dwBufferEncoding); // to extract codepage
4478 // charfmt = (CHARFMT)LOWORD(dwBufferEncoding); // to extract CHARFMT
4480 cpp_quote("extern const __declspec(selectany) GUID GUID_VsBufferEncoding = {0x212729ac,0xd6bb,0x11d0,{0xae,0x75,0x0,0xc0,0x4f,0xb6,0x80,0x6}};")
4482 //--------------------------------------------------------------------------
4483 // GUID_VsBufferEncodingVSTFF VT_UI4 {16417F39-A6B7-4c90-89FA-770D2C60440B}
4485 // DWORD dwBufferVSTFF;
4487 // dwBufferVSTFF = vstff; // to create
4488 // codepage = dwBufferVSTFF & VSTFF_CPMASK; // to extract codepage
4489 // vstffFlags = dwBufferVSTFF & VSTFF_FLAGSMASK; // to extract CHARFMT
4491 cpp_quote("extern const __declspec(selectany) GUID GUID_VsBufferEncodingVSTFF = { 0x16417f39, 0xa6b7, 0x4c90, { 0x89, 0xfa, 0x77, 0xd, 0x2c, 0x60, 0x44, 0xb }};")
4493 //--------------------------------------------------------------------------
4494 // GUID_VsBufferEncodingPromptOnLoad VT_UI4 {99EC03F0-C843-4c09-BE74-CDCA5158D36C}
4496 // Contact editor team with questions if you think you may want to use this.
4497 // This data is only for a set purpose. You cannot get the value of this back.
4498 // This should only be used by editor factories that want to specify a codepage on loading from the openwith dialog.
4500 // DWORD dwPromptOnLoadFlag; PROMPTONLOADFLAGS: Set to codepageNoPrompt = 0x000000000 to detect or codepagePrompt = 0x000000001 to prompt for encoding on load
4502 cpp_quote("extern const __declspec(selectany) GUID GUID_VsBufferEncodingPromptOnLoad = { 0x99ec03f0, 0xc843, 0x4c09, { 0xbe, 0x74, 0xcd, 0xca, 0x51, 0x58, 0xd3, 0x6c }};")
4505 //--------------------------------------------------------------------------
4506 // GUID_VsBufferDetectCharSet VT_BOOL {36358D1F-BF7E-11d1-B03A-00C04FB68006}
4508 // When DetectCharSet is TRUE, and the current BufferEncoding is CHARFMT_MBCS, the buffer
4509 // runs it's HTML charset tag detection code to determine a codepage to load and
4510 // save the file. The detected codepage overrides any codepage set in CHARFMT_MBCS.
4512 // This is forced on in the buffer's IPersistFileFormat::LoadDocData when it sees an
4513 // HTML type of file, according to the extension mapping in
4514 // HKLM\Visual Studio\<ver>\Languages\File Extensions
4516 cpp_quote("extern const __declspec(selectany) GUID GUID_VsBufferDetectCharSet = {0x36358d1f,0xbf7e,0x11d1,{0xb0,0x3a,0x0,0xc0,0x4f,0xb6,0x80,0x6}};")
4518 //--------------------------------------------------------------------------
4519 // GUID_VsBufferDetectLangSID VT_BOOL {17F375AC-C814-11d1-88AD-0000F87579D2}
4521 // When DetectLangSID is VARIANT_TRUE, a change to the buffer's moniker will cause the buffer
4522 // to change the language service based on the moniker when the moniker is believed to
4523 // represent a disk file. By default this is VARIANT_TRUE.
4525 cpp_quote("extern const __declspec(selectany) GUID GUID_VsBufferDetectLangSID = { 0x17f375ac, 0xc814, 0x11d1, { 0x88, 0xad, 0x0, 0x0, 0xf8, 0x75, 0x79, 0xd2 } };")
4528 //--------------------------------------------------------------------------
4529 // GUID_PropertyBrowserSID VT_BSTR
4532 // This property will be used to set the SEID_PropertyBrowserSID element of the selection
4533 // for text views. This is only used if you have a custom property browser. If this
4534 // property is not set, the standard property browser will be associated with the view.
4536 cpp_quote("extern const __declspec(selectany) GUID GUID_PropertyBrowserSID = { 0xce6ddbba, 0x8d13, 0x11d1, { 0x88, 0x89, 0x0, 0x0, 0xf8, 0x75, 0x79, 0xd2 }};")
4538 //--------------------------------------------------------------------------
4539 // GUID_UserReadOnlyErrorString VT_BSTR
4542 // This property is used to allow the buffer to provide specific rich error info in the
4543 // case where the buffer originates the BUFFER_E_READONLY error. Set this BSTR to be
4544 // the (localized) text you want displayed by the UI. Note that the buffer itself doesn't
4545 // put up UI, but only sets rich error info so that the calling UI can do so.
4547 cpp_quote("extern const __declspec(selectany) GUID GUID_UserReadOnlyErrorString = { 0xa3bcfe56, 0xcf1b, 0x11d1, { 0x88, 0xb1, 0x0, 0x0, 0xf8, 0x75, 0x79, 0xd2 }};")
4549 //--------------------------------------------------------------------------
4550 // GUID_BufferStorage VT_UNKNOWN
4552 // This property is used to get access to the buffer's storage object. The returned
4553 // pointer can be QI'd for IVsTextStorage and IVsPersistentTextImage. This is a get-only
4554 // property. To set the storage, use the buffer's InitializeContentEx method.
4556 // {D97F167A-638E-11d2-88F6-0000F87579D2}
4557 cpp_quote("extern const __declspec(selectany) GUID GUID_BufferStorage = { 0xd97f167a, 0x638e, 0x11d2, { 0x88, 0xf6, 0x0, 0x0, 0xf8, 0x75, 0x79, 0xd2 } };")
4560 General text editor GUIDs
4563 cpp_quote("extern const __declspec(selectany) GUID CLSID_TextEditorFactory = { 0x8B382828, 0x6202, 0x11d1, { 0x88, 0x70, 0x00, 0x00, 0xF8, 0x75, 0x79, 0xD2 }};")
4564 cpp_quote("extern const __declspec(selectany) GUID CMDUIGUID_TextEditor = { 0x8B382828, 0x6202, 0x11d1, { 0x88, 0x70, 0x00, 0x00, 0xF8, 0x75, 0x79, 0xD2 }};")
4566 struct TabStop
4568 long *iCol;
4569 ULONG cEl;
4570 UINT iRepeatWidth;
4571 DWORD dwFlags;
4573 enum TabStopFlags
4575 USE_DEFAULT_REPEAT = 0x00000001
4580 uuid(uuid_IVsDynamicTabProvider)
4582 interface IVsDynamicTabProvider : IUnknown
4584 HRESULT GetTabStopElements(
4585 [in] IVsTextLines *pBuffer,
4586 [in] long iLine,
4587 [out] UINT *cEl);
4589 HRESULT GetTabStop(
4590 [in] IVsTextLines *pBuffer,
4591 [in] long iLine,
4592 [out] struct TabStop *sTabStop);
4595 ////////////////////////////////////////////////////////////////////////////
4596 // IVsLastChangeTimeProvider
4598 // Allows an object to tell clients when its last change occured. Presently
4599 // used by the default text buffer implementation.
4600 ////////////////////////////////////////////////////////////////////////////
4602 uuid(uuid_IVsLastChangeTimeProvider),
4604 interface IVsLastChangeTimeProvider : IUnknown
4606 HRESULT GetLastChangeTime([out] FILETIME *pFileTime);
4609 // IVsEnumTextSpans
4611 uuid(uuid_IVsEnumTextSpans)
4613 interface IVsEnumTextSpans : IUnknown
4615 HRESULT Reset(void);
4616 HRESULT Next([in] ULONG cEl, [out, size_is(cEl)] TextSpan *ppOut, [out] ULONG *pcElFetched);
4617 HRESULT GetCount([out] ULONG *pcSpans);
4620 typedef enum _MapLocalSpanFlags
4622 // compatibility names
4623 MLS_VISIBLE_ONLY = 0x00000, // omits concealed and collapsed text
4624 MLS_INCLUDE_USER_EXPANDABLE = 0x00001, // omits concealed text but includes collapsed text (collapsible text that's in the collapsed state)
4625 MLS_NEVER_COMBINE_SPANS = 0x00002, // keeps adjacent spans from being combined into a single underlying span
4627 // compatibility names
4628 mlsVisibleOnly = MLS_VISIBLE_ONLY,
4629 mlsIncludeUserExpandable = MLS_INCLUDE_USER_EXPANDABLE,
4630 mlsNeverCombineSpans = MLS_NEVER_COMBINE_SPANS
4631 } MapLocalSpanFlags;
4633 typedef enum _DeeperLayerLineIndexToLocalFlags
4635 DLI_DEFAULT = 0x00000000, // fail with VIEW_E_LOCATION_HIDDEN if deeper text is hidden
4636 DLI_CLOSEST = 0x00000001, // send back the closest available local coordinates
4637 DLI_RIGHTMOST = 0x00000002, // opts for rightmost in case of ambiguity; by default we opt for leftmost in case of ambiguity
4640 DLI_AVOID_OUTER_EDGE is a "request", not "requirement" flag. It is used to tell a layer that during
4641 the conversion it should avoid converting the coordinate to a local coordinate that is on the "outer"
4642 edge of a visible region ("outer" meaning the right edge if DLI_RIGHTMOST is specified, and meaning
4643 the left edge otherwise).
4645 DLI_AVOID_OUTER_EDGE = 0x00000004, // try to enclose outer edge
4647 // compatibility names
4648 dliDefault = DLI_DEFAULT,
4649 dliClosest = DLI_CLOSEST,
4650 dliRightmost = DLI_RIGHTMOST
4651 } DeeperLayerLineIndexToLocalFlags;
4654 IVsTextLayer
4656 Used to handle layout between a base buffer and a view.
4659 uuid(uuid_IVsTextLayer)
4661 interface IVsTextLayer : IUnknown
4664 Coordinate conversion functions
4666 For these two it's OK to pass in NULL for coordinates you don't care about.
4668 Expected return values:
4669 S_OK: coordinates transformed, everything's fine.
4670 VIEW_E_LOCATION_HIDDEN: the coordinates you requested exist, but are hidden in the UI at present.
4671 E_INVALIDARG: bad [in] params.
4673 HRESULT LocalLineIndexToBase([in] long iLocalLine, [in] CharIndex iLocalIndex, [out] long *piBaseLine, [out] CharIndex *piBaseIndex);
4674 HRESULT BaseLineIndexToLocal([in] long iBaseLine, [in] CharIndex iBaseIndex, [out] long *piLocalLine, [out] CharIndex *piLocalIndex);
4676 HRESULT LocalLineIndexToDeeperLayer([in] IVsTextLayer *pTargetLayer, [in] long iLocalLine, [in] CharIndex iLocalIndex, [out] long *piTargetLine, [out] CharIndex *piTargetIndex);
4677 HRESULT DeeperLayerLineIndexToLocal(
4678 [in] DWORD dwFlags, // ORing of DeeperLayerLineIndexToLocalFlags enum
4679 [in] IVsTextLayer *pTargetLayer,
4680 [in] long iLayerLine,
4681 [in] CharIndex iLayerIndex,
4682 [out] long *piLocalLine,
4683 [out] CharIndex *piLocalIndex);
4685 HRESULT GetBaseBuffer([out] IVsTextLines **ppiBuf); // NOTE: ppiBuf is AddRef'd
4687 /* stuff from IVsTextBuffer */
4688 // [Un]LockBufferEx() deprecated in Dev10. IVsTextLayer should be accessed from the UI thread.
4689 HRESULT LockBufferEx([in] DWORD dwFlags); // dwFlags is an ORing of BufferLockFlags (presently either BLF_READ or BLF_WRITE)
4690 HRESULT UnlockBufferEx([in] DWORD dwFlags); // dwFlags is an ORing of BufferLockFlags (presently either BLF_READ or BLF_WRITE)
4692 HRESULT GetLengthOfLine ([in] long iLine, [out] long *piLength);
4693 HRESULT GetLineCount ([out] long *piLineCount);
4694 HRESULT GetLastLineIndex ([out] long *piLine, [out] long *piIndex); // gets length of last line; shortcut for frequent pattern of calling GetLineCount & then GetLengthOfLine on that line
4696 /* stuff similar to IVsTextLines */
4697 HRESULT GetMarkerData ([in] long iTopLine, [in] long iBottomLine, [out] MARKERDATA *pMarkerData);
4698 HRESULT ReleaseMarkerData ([in] MARKERDATA *pMarkerData);
4700 // the mother of all GetLineData calls
4701 HRESULT GetLineDataEx ([in] DWORD dwFlags, [in] long iLine, [in] long iStartIndex, [in] long iEndIndex, [out] LINEDATAEX *pLineData, [in] MARKERDATA *pMarkerData);
4702 HRESULT ReleaseLineDataEx ([in] LINEDATAEX *pLineData); // releases LINEDATAEX
4704 // Puts the specified span of text into a BSTR; it is the caller's responsibility to free the BSTR.
4705 HRESULT GetLineText(
4706 [in] long iStartLine, // starting line
4707 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
4708 [in] long iEndLine, // ending line
4709 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
4710 [out] BSTR * pbstrBuf); // text of span
4712 // Puts the specified span of text into a caller-allocated buffer; this will copy up to cchBuf characters, and
4713 // if the buffer wasn't big enough, returns BUFFER_E_DEST_TOO_SMALL and sets *pcchBuf to the required size.
4714 // To just get the required size, you can pass in NULL for pszBuf.
4715 HRESULT CopyLineText(
4716 [in] long iStartLine, // starting line
4717 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
4718 [in] long iEndLine, // ending line
4719 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
4720 [in] LPWSTR pszBuf, // text to insert, if any
4721 [in, out] long * pcchBuf); // NOTE: this is a count of UNICODE CHARACTERS, *not* BYTES!!!
4723 // Stream-like line editing -- handles line breaking/joining, etc.
4724 HRESULT ReplaceLines (
4725 [in] long iStartLine, // starting line
4726 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
4727 [in] long iEndLine, // ending line
4728 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
4729 [in] LPCWSTR pszText, // text to insert, if any
4730 [in] long iNewLen, // # of chars to insert, if any
4731 [out] TextSpan * pChangedSpan); // range of characters changed
4733 HRESULT CanReplaceLines(
4734 [in] long iStartLine, // starting line
4735 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
4736 [in] long iEndLine, // ending line
4737 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
4738 [in] long iNewLen); // # of chars to insert, if any
4740 // to create a zero-length tracking point (similar to a zero-length marker)
4741 HRESULT CreateTrackingPoint (
4742 [in] long iLine, // line
4743 [in] CharIndex iIndex, // character index within the line (must be <= length of line)
4744 [out] IVsTextTrackingPoint ** ppMarker);
4746 // IVsTextLayer::EnumLayerMarkers enumerates ALL markers, but gets their IVsTextLineMarker interface via IVsEnumLineMarkers.
4747 HRESULT EnumLayerMarkers(
4748 [in] long iStartLine, // starting line
4749 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
4750 [in] long iEndLine, // ending line
4751 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
4752 [in] long iMarkerType,
4753 [in] DWORD dwFlags, // ORing of ENUMMARKERFLAGS
4754 [out] IVsEnumLayerMarkers ** ppEnum);
4756 // Line editing -- handles line breaking/joining, etc.
4757 HRESULT ReplaceLinesEx (
4758 [in] DWORD dwFlags, // special handling; ORing of REPLACE_TEXT_FLAGS enum
4759 [in] long iStartLine, // starting line
4760 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
4761 [in] long iEndLine, // ending line
4762 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
4763 [in] LPCWSTR pszText, // text to insert, if any
4764 [in] long iNewLen, // # of chars to insert, if any
4765 [out] TextSpan *pChangedSpan); // range of characters changed
4768 MapLocalSpansToTextOriginatingLayer will take a set of local spans & map them down to the shallowest
4769 layer that originates text. So you aren't guaranteed that you'll get back the layer that actually
4770 originates a given set of text, but you are guaranteed that you'll get the shallowest layer that
4771 originates "real" text (which excludes non-text atoms).
4773 HRESULT MapLocalSpansToTextOriginatingLayer(
4774 [in] DWORD dwFlags, // one of MapLocalSpanFlags values
4775 [in] IVsEnumTextSpans *pLocalSpanEnum,
4776 [out] IVsTextLayer **ppTargetLayer,
4777 [out] IVsEnumTextSpans **ppTargetSpanEnum);
4780 typedef enum _tag_LAYER_MODULE_CAPABILITIES
4782 LMC_TEXTFIND = 0x01, // shallow text find operations (e.g. ISearch)
4783 LMC_TEXTPRINT = 0x02, // printing
4784 LMC_TEXTORIGINATE = 0x04 // originates text
4785 } LAYER_MODULE_CAPABILITIES;
4788 /*///////////////////////////////////////////////////////////////////////
4789 Synthetic text interfaces
4790 ///////////////////////////////////////////////////////////////////////*/
4792 typedef struct _NewSyntheticRegion
4794 // general information
4795 long iMarkerType; // standard marker type; display characteristics (coloring, glyph) to show for this region (has no effect on base buffer)
4796 DWORD dwBehavior; // currently unused; must be zero
4798 // the text to display (can be >1 line)
4799 LPCWSTR pszText; // any WCHAR* will do; the synthetic text session will make a copy of this
4801 // iAnchorLine/iAnchorIndex define where the text will show up; these are in base buffer coordinates
4802 long iAnchorLine; // the zero-based line #
4803 CharIndex iAnchorIndex; // the zero-based char index (must not be in virtual space)
4805 DWORD dwClient; // client-defined DWORD; this can be retrieved via IVsSyntheticRegion::GetClientData
4807 // iSerialValue is used to sort adjacent regions; if you expect adjacent regions, you should set this to ensure good sorting.
4808 // Otherwise, set iSerialValue to zero for everything and adjacent regions will be sorted by time (last added -> last logical position)
4809 long iSerialValue;
4811 NewSyntheticRegion;
4814 uuid(uuid_IVsSyntheticRegion)
4816 interface IVsSyntheticRegion : IUnknown
4818 // Permanent properties
4819 HRESULT GetMarkerType ([out] long *piMarkerType); // see SYNTHETIC_REGION_TYPE enum
4820 HRESULT GetBehavior ([out] DWORD *pdwBehavior); // see SYNTHETIC_REGION_BEHAVIOR enum
4822 HRESULT GetText([out] BSTR *pbstrText); // NOTE: this allocates a new BSTR which must be freed by the caller!
4823 HRESULT SetText([in] LPCWSTR pszText); // NOTE: Synthetic text mgr allocates a new string
4825 HRESULT GetBaseBufferAnchor([out] long *piAnchorLine, [out] long *piAnchorIndex); // returns the current base buffer location of the region
4826 HRESULT SetBaseBufferAnchor([in] long iAnchorLine, [in] long iAnchorIndex); // changes the current base buffer location of the region
4828 HRESULT GetClientData([out] DWORD_PTR *pdwData); // returns the dwClient DWORD associated with the region
4829 HRESULT SetClientData([in] DWORD_PTR dwData); // changes the dwClient DWORD associated with the region
4831 // Deletion management
4832 HRESULT Invalidate([in] DWORD dwUpdate); // dwUpdateFlags is ORing of CHANGE_SYNTHETIC_REGION_FLAGS enum; this causes the region to go away; i.e. the text becomes exposed & normal
4833 HRESULT IsValid([out] BOOL *pfValid); // valid if TRUE, FALSE if not
4835 // Layer, text image interaction
4836 HRESULT GetTextLayer([out] IVsTextLayer **ppLayer); // *ppLayer will be AddRef'd
4837 HRESULT GetSyntheticLayerSpan([out] TextSpan *pSpan); // returns the extent of the region in coordinates of the owning layer
4838 HRESULT GetTextImage([out] IVsTextImage **ppImage); // a relative text image that encompasses only the synthetic region's text
4843 uuid(uuid_IVsEnumSyntheticRegions)
4845 interface IVsEnumSyntheticRegions : IUnknown
4847 HRESULT Reset(void);
4848 HRESULT Next([in] ULONG cEl, [out, size_is(cEl)] IVsSyntheticRegion** ppOut, [out] ULONG *pcElFetched);
4849 HRESULT GetCount([out] ULONG *pcRegions);
4853 typedef enum _syntheticregionevent
4855 sreRegionReloaded = 0, // the text of a Synthetic region was reloaded and may no longer be at an appropriate location
4856 } SYNTHETIC_REGION_EVENT;
4859 uuid(uuid_IVsSyntheticTextClient)
4861 interface IVsSyntheticTextClient : IUnknown
4863 #ifdef PROXYSTUB_BUILD
4864 HRESULT OnSyntheticRegionChange(
4865 [in] IVsSyntheticRegion *pSynthReg, // the synthetic region in question
4866 [in] SYNTHETIC_REGION_EVENT EventCode); // SYNTHETIC_REGION_EVENT value
4867 #else
4868 void OnSyntheticRegionChange(
4869 [in] IVsSyntheticRegion *pSynthReg, // the synthetic region in question
4870 [in] SYNTHETIC_REGION_EVENT EventCode); // SYNTHETIC_REGION_EVENT value
4871 #endif
4873 HRESULT GetTipText( // returns tip text for hovering
4874 [in] IVsSyntheticRegion *pSynthReg, // the synthetic region in question
4875 [out, optional] BSTR *pbstrText); // a BSTR that returns the text to display
4877 // GetErrorText is not yet utilized, pending investigation of how best to handle editing scenarios
4878 HRESULT GetErrorText( // returns tip text for hovering
4879 [in] DWORD dwReason, // reason for the call
4880 [in] IVsSyntheticRegion *pSynthReg, // the synthetic region in question
4881 [out] BSTR *pbstrText); // a BSTR that returns the text to display
4883 // Commands -- see MarkerCommandValues for meaning of iItem param
4884 HRESULT GetMarkerCommandInfo(
4885 [in] IVsSyntheticRegion *pSynthReg, // the synthetic region in question
4886 [in] long iItem, // which command (see MarkerCommandValues)
4887 [out, custom(uuid_IVsSyntheticTextClient, "optional")] BSTR * pbstrText, // [optional to set] title for command
4888 [out] DWORD* pcmdf); // command flags for visibility, being enabled, etc.
4889 HRESULT ExecMarkerCommand(
4890 [in] IVsSyntheticRegion *pSynthReg, // the synthetic region in question
4891 [in] long iItem); // which command (see MarkerCommandValues)
4893 #ifdef PROXYSTUB_BUILD
4894 HRESULT OnBeforeSessionEnd(void); // a notification that the synthetic text session is ending
4895 #else
4896 void OnBeforeSessionEnd(void); // a notification that the synthetic text session is ending
4897 #endif
4900 typedef enum _tag_FIND_SYNTHETIC_REGION_FLAGS
4902 FSR_ALL_REGIONS = 0x0, // if you want to find every region, specify *ONLY* this flag
4904 // dwCookie group
4905 FSR_BY_CLIENT_DATA = 0x1, // find region with matching client DWORD
4907 // span param group (mutually exclusive)
4908 FSR_WITHIN_SPAN = 0x4, // find all regions within the given span
4909 FSR_EXACT_SPAN = 0x8, // find only regions whose base span exactly matches the given span
4911 } FIND_SYNTHETIC_REGION_FLAGS;
4914 typedef enum _tag_CHANGE_SYNTHETIC_REGION_FLAGS
4916 CSR_DEFAULT = 0x0, // undoable
4917 CSR_NONUNDOABLE = 0x1 // not added to undo/redo stack (e.g. for initial presentation)
4918 } CHANGE_SYNTHETIC_REGION_FLAGS;
4921 uuid(uuid_IVsSyntheticTextSession)
4923 interface IVsSyntheticTextSession : IUnknown
4925 HRESULT AddSyntheticRegions(
4926 [in] DWORD dwUpdateFlags, // ORing of CHANGE_SYNTHETIC_REGION_FLAGS enum
4927 [in] long cRegions, // how many regions you want to add
4928 [in, size_is(cRegions)] NewSyntheticRegion *rgSynthReg, // array of (cRegions) structs defining the new regions
4929 [out] IVsEnumSyntheticRegions **ppEnum); // may be NULL; if non-NULL, returns an enum of the new regions
4932 EnumSyntheticRegions returns a static snapshot list of Synthetic regions.
4934 HRESULT EnumSyntheticRegions(
4935 [in] DWORD dwFindFlags, // tells how to find region; ORing of FIND_SYNTHETIC_REGION_FLAGS enum
4936 [in] DWORD_PTR dwCookie, // extra search parameter; can be used to search for specific client DWORD
4937 [in] TextSpan *ptsRange, // search paramter for finding text
4938 [out] IVsEnumSyntheticRegions **ppEnum); // the resulting enumeration
4940 HRESULT UnadviseClient(void); // tells the session to sever its link (and drop its COM reference) to the client (i.e. you)
4941 HRESULT Terminate(void); // immediately kills the synthetic text session
4945 uuid(uuid_IVsSyntheticTextManager)
4947 interface IVsSyntheticTextManager : IUnknown
4949 // GetSyntheticTextSession asks the owning object whether a synthetic text session currently exists
4950 HRESULT GetSyntheticTextSession(
4951 [in] IUnknown *pOwningObject, // the owning object (normally the buffer)
4952 [out] IVsSyntheticTextSession **ppSession); // an existing session
4954 HRESULT CreateSyntheticTextSession(
4955 [in] DWORD dwFlags, // currently unused; must be zero
4956 [in] IUnknown *pOwningObject, // the owning object (normally the buffer)
4957 [in] IVsSyntheticTextClient *pClient, // your client interface
4958 [out] IVsSyntheticTextSession **ppState); // the new session
4963 Hidden text interfaces
4967 IVsTextHidingLayerModule
4969 This interface is implemented by any layer module that hides text on the layer below. In other words,
4970 if a given layer can ever return VIEW_E_LOCATION_HIDDEN, it must implement this interface to allow the
4971 text to be made visible if some user action (e.g. the "Go To Line" command) makes it necessary.
4973 When MakeBaseSpanVisible is called, the layer should make the text visible at its layer if it knows
4974 how. If it fails, the layout module will be destroyed! Layers that don't hide text must not implement
4975 this interface. However, when MakeBaseSpanVisible is called, layers can assume (and are welcome to
4976 ASSERT) that the base span has already been made visible by the layer below.
4978 Finally, there is one very important semantic detail wrt MakeBaseSpanVisible's pBaseSpan parameter.
4979 This parameter indicates that ALL the base text therein should be made visible, not merely that the
4980 begin & end should be made visible. For example, if I have hidden text in the middle of a line and
4981 pass the start & end of the line as the param to MakeBaseSpanVisible, it's not sufficient to ensure
4982 that only the start & end of the line are visible. EVERY CHARACTER in the span must be visible!!
4983 Therefore, this must be used carefully. In some cases (e.g. highlighting a find hit) you want to use
4984 this on a span of text. In others (e.g. the "Go To Line" command), you only want to ensure that the
4985 beginning of the physical line is visible, but you don't want to force the entire contents of the
4986 physical line to be revealed.
4988 The required side effect of this function succeeding is that a call to BaseLineIndexToLocal on any
4989 character within *pBaseSpan must succeed and not return VIEW_E_LOCATION_HIDDEN.
4992 uuid(uuid_IVsTextHidingLayerModule)
4994 interface IVsTextHidingLayerModule : IUnknown
4997 MakeBaseSpanVisible return codes:
4998 S_OK: the span was hidden but is now visible
4999 S_FALSE: the span wasn't hidden by this layer
5000 E_FAIL: the span is hidden but the layer doesn't know how to unhide it (will result in the layer being destroyed)
5002 HRESULT MakeBaseSpanVisible(TextSpan *pBaseSpan); // make EVERY CHARACTER of the span visible
5005 typedef enum _hidden_region_state
5007 hrsDefault = 0x0, // implies it's collapsed
5008 hrsExpanded = 0x1 // expanded
5009 } HIDDEN_REGION_STATE;
5011 typedef enum _hidden_region_type
5013 hrtConcealed = 0x0,
5014 hrtCollapsible = 0x1
5015 } HIDDEN_REGION_TYPE;
5018 Hidden region behavior flags
5019 ============================
5021 hrbClientControlled vs. hrbEditorControlled:
5023 To fully control every aspect of a hidden text region, you can use hrbClientControlled to get
5024 notifications for a variety of events. If you just want to do outlining-type hiding of a region
5025 & want the editor to take responsibility for the appearance, behavior, and lifetime of the hidden
5026 region, use hrbEditorControlled. Here are the pieces of information that you can explicitly
5027 control if you use hrbClientControlled, along with their default implementation:
5029 - Banner text:
5030 hrbClientControlled: specified via NewHiddenRegion and IVsHiddenRegion::SetBanner()
5031 hrbEditorControlled: always a fixed string, probably something like "..."
5032 - Tip text
5033 hrbClientControlled: specified via IVsHiddenTextClient::GetTipText()
5034 hrbEditorControlled: the first N non-whitespace text of the hidden text, truncated for presentability
5035 - Command negotiation
5036 hrbClientControlled: you can expose/handle context menu commands via IVsHiddenTextClient::GetMarkerCommandInfo()/ExecMarkerCommand()
5037 hrbEditorControlled: always fixed to "expand"/"collapse" and "stop hiding" (or whatever they wind up be called)
5038 - Event notification
5039 hrbClientControlled: you get lots of notifications via IVsHiddenTextClient about when the hidden region is deleted, state changes, etc.
5040 hrbEditorControlled: you get no such notifications (editor handles them internally)
5042 If you want to do simple outlining, use hrbEditorControlled. If you want more detailed control over
5043 how the hidden regions behave, use hrbClientControlled.
5046 typedef enum _hidden_region_behavior
5048 hrbClientControlled = 0x0,
5049 hrbEditorControlled = 0x1
5050 } HIDDEN_REGION_BEHAVIOR;
5052 typedef enum _tag_CHANGE_HIDDEN_REGION_FLAGS
5054 chrDefault = 0x0, // undoable
5055 chrNonUndoable = 0x1 // not added to undo/redo stack (e.g. for initial presentation)
5056 } CHANGE_HIDDEN_REGION_FLAGS;
5059 // NewHiddenRegion
5060 //------------------------------------------------------------------------------
5061 typedef struct _tag_NewHiddenRegion
5063 // These members reflect permanent properties of the hidden region
5064 long iType; // see HIDDEN_REGION_TYPE enum
5065 DWORD dwBehavior; // ORing of HIDDEN_REGION_BEHAVIOR enum values
5067 // These members reflect changeable properties of the hidden region
5068 DWORD dwState; // State bits (e.g. expand/collapse state) -- see HIDDEN_REGION_STATE enum
5069 TextSpan tsHiddenText; // Span of hidden text
5071 // pszBanner is ignored unless hrbClientControlled is specified for dwBehavior
5072 LPCWSTR pszBanner; // Banner; NOTE: text hiding mgr will alloc a new string
5073 DWORD_PTR dwClient; // Opaque client-defined information (e.g. array index or ptr to retrieve internal data)
5074 } NewHiddenRegion;
5078 uuid(uuid_IVsHiddenRegion)
5080 interface IVsHiddenRegion : IUnknown
5082 // Permanent properties
5083 HRESULT GetType ([out] long *piHiddenRegionType); // see HIDDEN_REGION_TYPE enum
5084 HRESULT GetBehavior ([out] DWORD *pdwBehavior); // see HIDDEN_REGION_BEHAVIOR enum
5086 // Changeable properties
5087 HRESULT GetState([out] DWORD *dwState);
5088 HRESULT SetState(
5089 [in] DWORD dwState, // ORing of HIDDEN_REGION_STATE values
5090 [in] DWORD dwUpdate); // ORing of CHANGE_HIDDEN_REGION_FLAGS values
5092 HRESULT GetBanner([out] BSTR *pbstrBanner); // NOTE: this allocates a new BSTR which must be freed by the caller!
5093 HRESULT SetBanner([in] LPCWSTR pszBanner); // NOTE: hidden text mgr allocates a new string
5095 HRESULT GetSpan([out] TextSpan *pSpan);
5096 HRESULT SetSpan([in] TextSpan *pSpan);
5098 HRESULT GetClientData([out] DWORD_PTR *pdwData);
5099 HRESULT SetClientData([in] DWORD_PTR dwData);
5101 // Deletion management
5102 HRESULT Invalidate([in] DWORD dwUpdate); // dwUpdateFlags is ORing of CHANGE_HIDDEN_REGION_FLAGS enum; this causes the region to go away; i.e. the text becomes exposed & normal
5103 HRESULT IsValid(void); // S_OK: yes; S_FALSE: no
5105 // Layer, text image interaction
5106 HRESULT GetBaseBuffer([out] IVsTextLines **ppBuffer); // *ppBuffer will be AddRef'd
5110 /////////////////////////////////////////////////////////////////////////
5111 // IVsEnumHiddenRegions interface
5112 /////////////////////////////////////////////////////////////////////////
5114 uuid(uuid_IVsEnumHiddenRegions)
5116 interface IVsEnumHiddenRegions : IUnknown
5118 HRESULT Reset(void);
5119 HRESULT Next([in] ULONG cEl, [out, size_is(cEl)] IVsHiddenRegion** ppOut, [out] ULONG *pcElFetched);
5120 HRESULT GetCount([out] ULONG *pcRegions);
5123 typedef enum _hiddenregionevent
5125 hreRegionDeleted = 0, // region deleted by a text edit
5126 hreRegionResurrected, // was deleted, but restored by an undo or redo
5127 hreRegionReloaded, // the text of a hidden region was reloaded and may no longer be at an appropriate location
5128 hreBeforeRegionExpanded, // a region with user-controlled visibility will be expanded
5129 hreAfterRegionExpanded, // a region with user-controlled visibility was expanded
5130 hreBeforeRegionCollapsed, // a region with user-controlled visibility will be collapsed
5131 hreAfterRegionCollapsed // a region with user-controlled visibility was collapsed
5132 } HIDDEN_REGION_EVENT;
5135 IVsHiddenTextClient
5137 Passed into IVsHiddenTextManager::CreateHiddenTextSession().
5140 uuid(uuid_IVsHiddenTextClient)
5142 interface IVsHiddenTextClient : IUnknown
5145 OnHiddenRegionChange is only fired in response to "external" churn on the view or buffer. It is not fired in
5146 response to calls on IVsHiddenTextState.
5148 NOTE: Clients should not add or remove hidden regions in response to this call!
5150 #ifdef PROXYSTUB_BUILD
5151 HRESULT OnHiddenRegionChange(
5152 [in] IVsHiddenRegion *pHidReg,
5153 [in] HIDDEN_REGION_EVENT EventCode, // HIDDENREGIONEVENT value
5154 [in] BOOL fBufferModifiable); // whether it's safe to change the buffer in response to this event
5155 #else
5156 void OnHiddenRegionChange(
5157 [in] IVsHiddenRegion *pHidReg,
5158 [in] HIDDEN_REGION_EVENT EventCode, // HIDDENREGIONEVENT value
5159 [in] BOOL fBufferModifiable); // whether it's safe to change the buffer in response to this event
5160 #endif
5162 HRESULT GetTipText([in] IVsHiddenRegion *pHidReg, [out, optional] BSTR *pbstrText); // tip text for hovering (different from banner)
5164 // Commands -- see MarkerCommandValues for meaning of iItem param, but note that mcvGlyphCommand is never sent here
5165 HRESULT GetMarkerCommandInfo([in] IVsHiddenRegion *pHidReg, [in] long iItem, [out, custom(uuid_IVsHiddenTextClient, "optional")] BSTR * pbstrText, [out] DWORD* pcmdf);
5166 HRESULT ExecMarkerCommand([in] IVsHiddenRegion *pHidReg, [in] long iItem);
5169 MakeBaseSpanVisible is used for visibility control. If the user does something that requires a
5170 piece of hidden text to be visible (e.g. Goto line command, debugger stepping, find in files hit,
5171 etc.) then we will turn around and call this for regions that the text hiding manager cannot
5172 automatically make visible. (In the current implementation this will only happen for concealed
5173 regions; collapsible ones will be automatically expanded.) This CANNOT fail!! You must either
5174 destroy the hidden region by calling IVsHiddenRegion::Remove() or else reset its range so that
5175 it is no longer hiding the hidden text. It is OK to add/remove other regions when this is called.
5177 HRESULT MakeBaseSpanVisible([in] IVsHiddenRegion *pHidReg, [in] TextSpan *pBaseSpan);
5179 #ifdef PROXYSTUB_BUILD
5180 HRESULT OnBeforeSessionEnd(void);
5181 #else
5182 void OnBeforeSessionEnd(void);
5183 #endif
5187 typedef enum _tag_FIND_HIDDEN_REGION_FLAGS
5189 FHR_ALL_REGIONS = 0x0, // if you want to find every region, specify *ONLY* this flag
5191 // dwCookie group (mutually exclusive)
5192 FHR_BY_CLIENT_DATA = 0x1, // find region with matching client DWORD
5193 FHR_BY_TYPE = 0x2, // finds by type; cast marker type to DWORD & put in dwCookie
5195 // span param group (mutually exclusive)
5196 FHR_INTERSECTS_SPAN = 0x4, // find all regions intersecting the given span
5197 FHR_EXACT_SPAN = 0x8, // find only regions whose base span exactly matches the given span
5199 // behavior filter group (mutually exclusive)
5200 FHR_EDITOR_CONTROLLED_ONLY = 0x10,
5201 FHR_CLIENT_CONTROLLED_ONLY = 0x20,
5203 // another span param (mutually exclusive with others)
5204 FHR_ENTIRELY_WITHIN_SPAN = 0x40, // finds regions that are *entirely* within the given span, not simply intersecting with it
5206 // FHR_INNERMOST can be used along with other conditions; it finds the most deeply nested region
5207 FHR_INNERMOST = 0x80, // finds one region that is the most deeply nested at the given location
5209 FHR_VISIBLE_ONLY = 0x100, // excludes regions inside a collapsed region
5211 FHR_PREFER_START_IN_SPAN = 0x200, // gives a region starting within the span higher priority than one ending
5212 // in the span. Only has effect with FHR_INNERMOST specified.
5214 FHR_MUST_START_IN_SPAN = 0x400, // like FHR_PREFER_START_IN_SPAN, except *only* regions starting within spans
5215 // will be returned
5217 // old compatibility flags
5218 fhrAllRegions = FHR_ALL_REGIONS, // if you want to find every region, specify *ONLY* this flag
5220 // dwCookie group (mutually exclusive)
5221 fhrByClientData = FHR_BY_CLIENT_DATA, // find region with matching client DWORD
5222 fhrByType = FHR_BY_TYPE, // finds by type; cast marker type to DWORD & put in dwCookie
5224 // span param group (mutually exclusive)
5225 fhrWithinSpan = FHR_INTERSECTS_SPAN, // find all regions within the given span
5226 fhrExactSpan = FHR_EXACT_SPAN, // find only regions whose base span exactly matches the given span
5228 // behavior filter group (mutually exclusive)
5229 fhrEditorControlledOnly = FHR_EDITOR_CONTROLLED_ONLY,
5230 fhrClientControlledOnly = FHR_CLIENT_CONTROLLED_ONLY
5232 } FIND_HIDDEN_REGION_FLAGS;
5235 uuid(uuid_IVsHiddenTextManager)
5237 interface IVsHiddenTextManager : IUnknown
5239 HRESULT GetHiddenTextSession([in] IUnknown *pOwningObject, [out] IVsHiddenTextSession **ppSession);
5240 HRESULT CreateHiddenTextSession(
5241 [in] DWORD dwFlags,
5242 [in] IUnknown *pOwningObject,
5243 [in] IVsHiddenTextClient *pClient,
5244 [out] IVsHiddenTextSession **ppState);
5248 uuid(uuid_IVsHiddenTextSession)
5250 interface IVsHiddenTextSession : IUnknown
5252 HRESULT AddHiddenRegions(
5253 [in] DWORD dwUpdateFlags, // ORing of CHANGE_HIDDEN_REGION_FLAGS enum
5254 [in] long cRegions,
5255 [in, size_is(cRegions)] NewHiddenRegion *rgHidReg,
5256 [out] IVsEnumHiddenRegions **ppEnum);
5259 EnumHiddenRegions returns a static snapshot list of hidden regions.
5261 HRESULT EnumHiddenRegions(
5262 [in] DWORD dwFindFlags, // tells how to find region; ORing of FIND_HIDDEN_REGION_FLAGS enum
5263 [in] DWORD_PTR dwCookie,
5264 [in] TextSpan *ptsRange,
5265 [out] IVsEnumHiddenRegions **ppEnum);
5267 HRESULT UnadviseClient(void);
5268 HRESULT Terminate(void);
5272 Explicit outlining support. These are handy wrappers that make it easy to do outlining in the view.
5273 Anything you can do with these methods can be done with the lower-level IVsHiddenTextSession methods,
5274 but these are simpler for outlining (but less flexible).
5277 // NewOutlineRegion
5278 //------------------------------------------------------------------------------
5279 typedef struct _tag_NewOutlineRegion
5281 DWORD dwState; // State bits (e.g. expand/collapse state) -- see HIDDEN_REGION_STATE values
5282 TextSpan tsHiddenText; // Span of hidden text
5283 } NewOutlineRegion;
5285 typedef enum _tag_ADD_OUTLINE_REGION_FLAGS
5287 AOR_DEFAULT = 0x0, // blasts away existing outlining regions (a fresh start)
5288 AOR_PRESERVE_EXISTING = 0x1, // leaves other regions, strictly adding these
5291 // AOR_NON_UNDOABLE indicates that the action is not part of the undo/redo stack (e.g. if outlining is done when
5292 // the document is first loaded)
5293 AOR_NON_UNDOABLE = 0x100
5294 } ADD_OUTLINE_REGION_FLAGS;
5297 uuid(uuid_IVsOutliningSession)
5299 interface IVsOutliningSession : IUnknown
5301 HRESULT AddOutlineRegions(
5302 [in] DWORD dwOutliningFlags, // ORing of ADD_OUTLINE_REGION_FLAGS enum
5303 [in] long cRegions, // count of regions
5304 [in, size_is(cRegions)] NewOutlineRegion *rgOutlnReg); // caller-allocated array of regions
5308 uuid(uuid_IVsOutliningCapableLanguage)
5310 interface IVsOutliningCapableLanguage : IUnknown
5312 HRESULT CollapseToDefinitions(
5313 [in] IVsTextLines *pTextLines, // the buffer in question
5314 [in] IVsOutliningSession *pSession); // the interface you call back into in order to hide the text
5317 typedef enum _tag_DATA_OBJECT_RENDER_HINT
5319 DORH_DEFAULT = 0x0000, // no information available
5320 DORH_MOVE_IN_SAME_DOC = 0x0001, // rendering was a move in the same document
5321 DORH_DROP = 0x0002, // a general drag/drop operation (includes drag/drop from toolbox as well as DORH_MOVE_IN_SAME_DOC)
5322 DORH_CLIPBOARD = 0x0004, // a general paste from the system clipboard (e.g. ctrl+V)
5323 DORH_TOOLBOX = 0x0008, // the user double-clicked an item from the toolbox
5324 DORH_PREVIEW = 0x0010 // a tentative preview (e.g. doing ctrl+shift+V to cycle through the clipboard -- don't do anything slow in this case!)
5325 } DATA_OBJECT_RENDER_HINT;
5329 IVsTextLayerEvents
5331 Notifies a client that a layer's coordinate mapping is changing.
5333 For example, sizing the window changes the word-wrap layer's
5334 mapping. The view sinks these events to maintain the selection.
5336 A client will generally convert all of it's local coordinates to
5337 base buffer coordinates in OnMappingChange, then convert to the new
5338 local coordinates in OnMappingChangeComplete.
5340 IVsTextLayerEvents are purely changes in coordinate mapping.
5341 If there is a change in the data, the layer should fire
5342 IVsTextLinesEvents::OnChangeLineText.
5346 uuid(uuid_IVsTextLayerEvents),
5348 interface IVsTextLayerEvents : IUnknown
5350 #ifdef PROXYSTUB_BUILD
5351 HRESULT OnMappingChange(void);
5352 HRESULT OnMappingChangeComplete(void);
5353 #else
5354 void OnMappingChange(void);
5355 void OnMappingChangeComplete(void);
5356 #endif
5359 /* Custom storage interfaces */
5361 // ChangeInput -- holds information about a pending change request *before* it has happened.
5362 //------------------------------------------------------------------------------
5363 typedef struct tag_ChangeInput
5365 TextSpan m_DelSpan; // Span to delete
5366 long m_iOldLen; // Old length
5367 long m_iNewLen; // New length
5368 const WCHAR *m_pszNewText; // Text to insert; memory owned by creator of struct
5369 DWORD m_dwFlags; // Flags that describe change (ORing of REPLACE_TEXT_FLAGS enum values)
5370 } ChangeInput;
5373 IVsTextStorage
5375 IVsTextStorage is REQUIRED for all storage objects. It represents the range of text that is
5376 viewable and editable by text editor views.
5379 uuid(uuid_IVsTextStorage)
5381 interface IVsTextStorage : IUnknown
5383 // storage methods concerning visible, editable text
5385 HRESULT Storage_Attach ([in] IUnknown *pBuffer);
5386 #ifdef PROXYSTUB_BUILD
5387 HRESULT Storage_Detach (void);
5389 HRESULT Storage_GetLength (void);
5390 HRESULT Storage_GetLineCount (void);
5391 #else
5392 void Storage_Detach (void);
5394 long Storage_GetLength (void);
5395 long Storage_GetLineCount (void);
5396 #endif
5397 HRESULT Storage_GetLengthOfLine ([in] long iLine, [out] long *piLength);
5399 HRESULT Storage_GetPositionOfLineIndex ([in] long iLine, [in] CharIndex iIndex, [out] long *piPosition);
5400 HRESULT Storage_GetLineIndexOfPosition ([in] long iPosition, [out] long *piLine, [out] CharIndex *piIndex);
5402 HRESULT Storage_Replace ([in] ChangeInput *pCI, [out] TextSpan *ptsOut);
5403 HRESULT Storage_CopyText ([in] long iStartLine, [in] CharIndex iStartIndex, [in] long iBufMax, [out] WCHAR *pszDest, [out] long *pcCharsCopied);
5404 HRESULT Storage_GetCharsInSpan ([in] TextSpan *pSpanToMeasure, [out] long *piChars);
5406 HRESULT Storage_GetLineDataEx (
5407 [in] DWORD dwFlags,
5408 [in] long iLine,
5409 [in] long iStartIndex,
5410 [in] long iEndIndex,
5411 [out] LINEDATAEX * pLineData);
5412 HRESULT Storage_ReleaseLineDataEx ([in] LINEDATAEX *pLineData);
5413 HRESULT Storage_GetLanguageServiceID ([out] GUID *pguidLangService);
5414 HRESULT Storage_SetLanguageServiceID ([in] REFGUID guidLangService);
5415 HRESULT Storage_RefreshColorization ([in] long iTopLine, [in] long iBotLine, [out] long *piLastAffectedLine);
5417 HRESULT Storage_Find (
5418 [in] const WCHAR * pszText,
5419 [in] long iStartLine, // starting line
5420 [in] CharIndex iStartIndex, // starting character index within the line (must be <= length of line)
5421 [in] long iEndLine, // ending line
5422 [in] CharIndex iEndIndex, // ending character index within the line (must be <= length of line)
5423 [in] long iFlags,
5424 [out] long * piLine,
5425 [out] CharIndex * piCol);
5428 typedef enum _StorageLoadFlags
5430 slfDefault = 0x0,
5431 slfReload = 0x1
5432 } StorageLoadFlags;
5435 IVsPersistentTextImage
5437 IVsPersistentTextImage is REQUIRED for all storage objects. It represents the image that is
5438 persisted and unpersisted. This is not necessarily the same data that is exposed by IVsTextStorage.
5441 #ifdef PROXYSTUB_BUILD
5442 // MIDL2269
5443 local,
5444 #endif
5445 uuid(uuid_IVsPersistentTextImage)
5447 interface IVsPersistentTextImage : IUnknown
5449 // storage methods concerning the docdata, i.e. the persistent disk image (may be different from the editable image)
5450 void * Image_Alloc ([in] int iSize);
5451 void * Image_Realloc ([in,out] void *p, [in] int iSize);
5452 void Image_Free ([in] void *p);
5454 long Image_GetLength(void); // Unicode chars
5455 // If Image_LoadText succeeds, storage assumes ownership of memory (allocated via Image_Alloc/Image_Realloc)
5456 HRESULT Image_LoadText ([in] const WCHAR *pszText, [in] INT iLength, [in] DWORD dwFlags); // Initialization
5458 HRESULT Image_OpenFullTextScan (void);
5459 HRESULT Image_FullTextRead ([out] const WCHAR **ppszText, [out] long *piLength);
5460 HRESULT Image_CloseFullTextScan (void);
5464 IVsTextStorageColorState
5466 IVsTextStorageColorState is optional for storage objects. If the storage talks to pluggable colorizers,
5467 it should expose this. Otherwise, it need not do so.
5470 uuid(uuid_IVsTextStorageColorState)
5472 interface IVsTextStorageColorState : IUnknown
5474 HRESULT GetColorStateAtStartOfLine([in] long iLine, [out] long *piState);
5478 typedef enum _ChangeCommitGestureFlags
5480 CCG_SAVE = 0x0001,
5481 CCG_MULTILINE_CHANGE = 0x0002,
5482 CCG_CARET_ON_NEW_BUFFER_LINE = 0x0010,
5483 CCG_MASS_REPLACE = 0x0008,
5484 CCG_ENTER_COMMAND = 0x0010,
5485 CCG_FIND_STARTING = 0x0020,
5486 CCG_LOST_FOCUS = 0x0040,
5487 CCG_DESTRUCTIVEACTION = 0x0080,
5488 CCG_PROGRAMMATIC_CHANGE = 0x1000
5489 } ChangeCommitGestureFlags;
5492 IVsFinalTextChangeCommitEvents
5494 Language services or other parties who have total control over the editing experience
5495 are the only intended client of this interface.
5498 uuid(uuid_IVsFinalTextChangeCommitEvents)
5500 interface IVsFinalTextChangeCommitEvents : IUnknown
5502 #ifdef PROXYSTUB_BUILD
5503 HRESULT OnChangesCommitted([in] DWORD dwGestureFlags, [in] TextSpan *ptsChanged);
5504 #else
5505 void OnChangesCommitted([in] DWORD dwGestureFlags, [in] TextSpan *ptsChanged);
5506 #endif
5510 IVsPreliminaryTextChangeCommitEvents is another incarnation of the "Tier 3" event, but
5511 is intended for extensibility and any other client that doesn't want to risk breaking
5512 VB & other pretty-listed languages.
5514 Extensibility event proxies should use this sink. If in doubt, use this sink rather
5515 than IVsFinalTextChangeCommitEvents.
5518 uuid(uuid_IVsPreliminaryTextChangeCommitEvents)
5520 interface IVsPreliminaryTextChangeCommitEvents : IVsFinalTextChangeCommitEvents
5525 If you are not VB, do not even think about monitoring this event.
5527 It fires when an undo or redo cluster is closing, provided an intervening commit gesture
5528 occurred while it was open.
5530 Clients are explicitly forbidden from modifying the buffer in response to this event.
5533 uuid(uuid_IVsUndoRedoClusterWithCommitEvents)
5535 interface IVsUndoRedoClusterWithCommitEvents : IUnknown
5537 #ifdef PROXYSTUB_BUILD
5538 HRESULT OnUndoRedoClusterClosingWithCommitGesture([in] DWORD dwGestureFlags, [in] TextSpan *ptsChanged);
5539 #else
5540 void OnUndoRedoClusterClosingWithCommitGesture([in] DWORD dwGestureFlags, [in] TextSpan *ptsChanged);
5541 #endif
5546 //================================================================
5548 uuid(uuid_IVsTextImageEvents),
5549 version(1.0)
5551 interface IVsTextImageEvents : IUnknown
5553 #ifdef PROXYSTUB_BUILD
5554 HRESULT OnTextChange ([in] TextAddress taStart, [in] TextAddress taEnd, [in] TextAddress taNewEnd);
5555 #else
5556 void OnTextChange ([in] TextAddress taStart, [in] TextAddress taEnd, [in] TextAddress taNewEnd);
5557 #endif
5561 IVsCommitGestureSink
5563 This is exposed by the tier 3 event manager to let clients indicate that some form of UI commit
5564 gesture has occurred.
5566 Because this is a many-to-one event rather than a one-to-many broadcast, this is just an
5567 interface that multiple clients QI for & call as necessary.
5570 uuid(uuid_IVsCommitGestureSink)
5572 interface IVsCommitGestureSink : IUnknown
5574 #ifdef PROXYSTUB_BUILD
5575 HRESULT OnCommitGesture([in] DWORD dwGestureFlags);
5576 HRESULT FlushCommitEventIfCurrentClusterIsOutermost(void);
5577 #else
5578 void OnCommitGesture([in] DWORD dwGestureFlags);
5579 void FlushCommitEventIfCurrentClusterIsOutermost(void);
5580 #endif
5583 //================================================================
5584 // IVsTextImage
5586 // Objects implementing this also implement IVsPersistentTextImage
5588 // Implemented by the shell's IVsTextBuffer object.
5589 // Implemented by a class available in UniLib: see TxFactory.h, TxImgHlp.h
5592 uuid (67068DC0-C069-11d2-936C-D714766E8B50),
5593 version(1.0),
5594 pointer_default(unique)
5596 interface IVsTextImage : IUnknown
5598 HRESULT GetCharSize ([out, retval] LONG * pcch); // count of chars
5599 HRESULT GetLineSize ([out, retval] LONG * pcLines); // count of lines
5601 HRESULT GetOffsetOfTextAddress ([in] TextAddress ta, [out, retval] LONG * piOffset);
5602 HRESULT GetTextAddressOfOffset ([in] LONG iOffset, [out, retval] TextAddress * pta);
5604 HRESULT Replace ([in] DWORD dwFlags,
5605 [in] const TextSpan * pts,
5606 [in] LONG cch,
5607 [in, size_is(cch)] LPCOLESTR pchText,
5608 [out, retval] TextSpan * ptsChanged);
5610 HRESULT GetSpanLength ([in] const TextSpan * pts, [out, retval] LONG * pcch);
5611 HRESULT GetTextBSTR ([in] const TextSpan * pts, [out, retval] BSTR * pbstrText);
5612 HRESULT GetText ([in] const TextSpan * pts, [in] LONG cch, [out, size_is(cch)] LPOLESTR psz);
5614 HRESULT GetLineLength ([in] LONG iLine, [out, retval] LONG * piLength);
5615 HRESULT GetLine ([in] DWORD grfGet,
5616 [in] LONG iLine,
5617 [in] LONG iStartIndex,
5618 [in] LONG iEndIndex,
5619 [out, retval] LINEDATAEX * pLineData);
5620 HRESULT ReleaseLine ([in] LINEDATAEX * pLineData);
5622 HRESULT AdviseTextImageEvents ([in] IVsTextImageEvents * pSink, [out, retval] DWORD * pCookie);
5623 HRESULT UnadviseTextImageEvents ([in] DWORD Cookie);
5625 HRESULT LockImage ([in] DWORD grfLock); // BLF_READ or BLF_READ_AND_WRITE
5626 HRESULT UnlockImage ([in] DWORD grfLock); // BLF_READ or BLF_READ_AND_WRITE
5629 // IVsEditorGoBackLocations
5630 // This is an optional interfce that can be QI'd from the IVsTextView interface.
5632 // The bool variable, fCurrentCaretPos, is to allow you to not specify the line and column, but to have the current caret position marked
5633 // If this is false, a valid base buffer line and column is required
5635 uuid(uuid_IVsEditorGoBackLocations)
5637 interface IVsEditorGoBackLocations : IUnknown
5639 HRESULT SetNonMergeableGoBackLocation ([in] BOOL fCurrentCaretPos, [in] long iBaseLine, [in] long iBaseCol);
5640 HRESULT SetMergeableGoBackLocation ([in] BOOL fCurrentCaretPos, [in] long iBaseLine, [in] long iBaseCol);
5643 #ifndef INTEROPLIB
5645 #endif
5649 /////////////////////////////////////////////////////////////////////////
5650 // IVsReplaceEvents interface
5652 // This event tells you information about a change that is about to
5653 // occur.
5655 // WARNING: use of this interface is discouraged. Do not use in new code. Talk
5656 // to the VS editor team if you have questions.
5658 /////////////////////////////////////////////////////////////////////////
5660 uuid(uuid_IVsTextReplaceEvents)
5662 interface IVsTextReplaceEvents : IUnknown
5664 // WARNING: use of this interface is discouraged. Do not use in new code. Talk
5665 // to the VS editor team if you have questions.
5667 HRESULT OnReplace( [in] const ChangeInput* pCI );
5670 //Flags to prompt user for an encoding on an open with specified codepage. Should only be used by editor factories supporting this!!!
5671 enum __PROMPTONLOADFLAGS {
5672 codepageNoPrompt = 0x000000000,
5673 codepagePrompt = 0x000000001
5675 typedef DWORD PROMPTONLOADFLAGS;
5677 enum __VSTFF { // VS Text File Format
5678 VSTFF_SIGNATURE = 0x00010000, // file signature (Byte Order Mark, UTF-8 sig.)
5679 VSTFF_DETECT = 0x01000000, // extra analysis to detect encoding
5680 VSTFF_HTML = 0x02000000, // HTML
5681 VSTFF_XML = 0x04000000, // XML
5682 VSTFF_BINARY = 0x08000000, // binary handling
5683 VSTFF_CPMASK = 0x0000FFFF, // mask for the codepage portion of VSTFF
5684 VSTFF_FLAGSMASK = 0xFFFF0000 // mask for the flags portion of VSTFF
5686 typedef DWORD VSTFF;
5690 uuid(uuid_IVsFormatFilterProvider)
5692 interface IVsFormatFilterProvider : IUnknown
5694 //Provides the list of available extensions for Save As.
5695 //If no filter is provided, the default filter string is "All Files (*.*)\n*.*\nText Files (*.txt)\n*.txt\n"
5696 //This filter list should not contain the All Files filer or Text Files. These will be added by the shell
5697 HRESULT GetFormatFilterList([out] BSTR *pbstrFilterList);
5699 //Provides the index to the filter matching the extension of the file passed in. This is determined by the place
5700 //in the FormatFilterList of the filter matching the extension passed in.
5701 //For example, if ".*" was passed into the default filter above, 0 would be stored in iExtnIndex. Likewise
5702 //a 1 would be stored for a ".txt" passed in. You should only be concerned with your file extensions and
5703 //not the All Files or Text files. If you don't match the file extension to one of yours, return E_FAIL
5704 HRESULT CurFileExtensionFormat([in]BSTR bstrFileName, [out] DWORD *pdwExtnIndex );
5706 //QueryInvalidEncoding allows the language service to supply an appropriate message
5707 //when the user has chosen an encoding htat is not supported by the language tools.
5708 //For example, if the compiler is unable to accept Unicode or UTF-8 source files, it is
5709 //appropriate to warn users that they have chosen an incompatable encoding.
5710 HRESULT QueryInvalidEncoding([in]VSTFF format, [out] BSTR * pbstrMessage);
5716 enum _NavigableLocationResolverFlags
5718 NLR_ABSOLUTEPATH = 0x00000001,
5719 NLR_PARTIALPATH = 0x00000002,
5720 NLR_URL = 0x00000010
5722 typedef DWORD NavigableLocationResolverFlags;
5725 uuid(uuid_IVsNavigableLocationResolver)
5727 interface IVsNavigableLocationResolver: IUnknown
5729 HRESULT GetDisplayText(
5730 [in] DWORD dwReserved, // for any unforeseen need
5731 [in] TextSpan *ptsBase, //Current selection or caret location
5732 [in] IVsTextLines *pBuffer, //Base buffer
5733 [out] NavigableLocationResolverFlags *dwOutFlags, //If current location is a URL
5734 [out,retval] BSTR * pbstrDisplayText); //Text to display in context menu
5736 HRESULT GetPathFromLocation(
5737 [in] DWORD dwReserved, // for any unforeseen need
5738 [in] TextSpan *ptsBase, //Current selection or caret location
5739 [in] IVsTextLines *pBuffer, //Base buffer
5740 [in] const WCHAR *pszDisplayText, //Display Text from GetDisplayText
5741 [out] NavigableLocationResolverFlags *dwOutFlags, //If current location is a URL
5742 [out,retval] BSTR * pbstrPath); //As much of a path as possible or just the file name
5747 uuid(uuid_IVsLanguageTextOps)
5749 interface IVsLanguageTextOps : IUnknown
5751 //----------------------------------------------------------------
5752 // Get a data tip for the selection/point
5754 // Return values:
5755 // S_OK Determined a tip to display
5756 // S_FALSE No tip
5757 //----------------------------------------------------------------
5758 HRESULT GetDataTip(
5759 [in] IVsTextLayer *pTextLayer,
5760 [in] const TextSpan *ptsSel, // selected text
5761 [out] TextSpan *ptsTip, // bounding context of the tip
5762 [out, retval] BSTR *pbstrText); // text of the tip to display
5764 //----------------------------------------------------------------
5765 // Get position of the pair characters enclosing the caret.
5766 // Pair characters are braces, parens, quotes, brackets, etc.
5768 // Return values:
5769 // S_OK Found enclosing pair
5770 // S_FALSE Not found (no errors)
5771 //----------------------------------------------------------------
5772 HRESULT GetPairExtent(
5773 [in] IVsTextLayer *pTextLayer,
5774 [in] TextAddress ta,
5775 [out, retval] TextSpan *pts);
5777 //----------------------------------------------------------------
5778 // Get the extent of a word or token on or near the point.
5780 // Return values:
5781 // S_OK Found the specified word or token
5782 // S_FALSE Not found (no errors)
5783 //----------------------------------------------------------------
5784 HRESULT GetWordExtent(
5785 [in] IVsTextLayer *pTextLayer,
5786 [in] TextAddress ta,
5787 [in] WORDEXTFLAGS flags,
5788 [out, retval] TextSpan *pts);
5790 //----------------------------------------------------------------
5791 // Format the selected text
5792 //----------------------------------------------------------------
5793 HRESULT Format(
5794 [in] IVsTextLayer *pTextLayer,
5795 [in] const TextSpan *ptsSel);
5799 // flags for TextFromData
5800 typedef enum _LTE_TEXTDATAFLAGS
5802 LTE_NORMAL = 0x00000000, // normal (stream) mode data
5803 LTE_BOX = 0x00000001, // box (column) mode data - text is inserted as a box
5804 LTE_LINE = 0x00000002, // line mode data - text is inserted as whole lines only
5805 } LTE_TEXTDATAFLAGS;
5808 uuid(uuid_IVsLanguageClipboardOps)
5810 interface IVsLanguageClipboardOps : IUnknown
5812 //----------------------------------------------------------------
5813 // Create an IDataObject with lang-specific formats
5815 // The created data object must not hold a reference to pView or pTextLayer -
5816 // the data object can outlive them.
5818 // Return values:
5819 // S_OK Created the data object
5820 // E_FAIL Did not create a data object (no errors)
5821 //----------------------------------------------------------------
5822 HRESULT GetDataObject(
5823 [in] IVsTextView *pView,
5824 [in] IVsTextLayer *pTextLayer,
5825 [out, retval] IDataObject **ppDO);
5827 //----------------------------------------------------------------
5828 // Does this data object contain data you can render into text?
5830 // Return values:
5831 // S_OK == Yes, S_FALSE = No
5832 //----------------------------------------------------------------
5833 HRESULT IsTextData(
5834 [in] IDataObject *pDO);
5836 //----------------------------------------------------------------
5837 // Render this data object to text
5838 //----------------------------------------------------------------
5839 HRESULT TextFromData(
5840 [in] IVsTextLayer *pTextLayer,
5841 [in] IDataObject *pDO,
5842 [out] LTE_TEXTDATAFLAGS *ptdfFlags,
5843 [out, retval] BSTR *pbstrText);
5845 HRESULT DataObjectRendered(
5846 [in] IVsTextLines *pTextLines, // the buffer in question
5847 [in] DWORD dwHint, // see DATA_OBJECT_RENDER_HINT values
5848 [in] TextSpan *ptsInsertedText); // text span in buffer coordinates of the newly inserted text
5851 enum _QuerySendCommitFlags
5853 QSCF_DO_SEND_ENTER_COMMIT = 0x00000000,
5854 QSCF_DO_NOT_SEND_ENTER_COMMIT = 0x00000001
5856 typedef DWORD QuerySendCommitFlags;
5858 // IVsQueryLineChangeCommit
5860 // This is an optional interface that should be implemented by the IVsTextViewFilter to determine wether an CCG_CARET_ON_NEW_BUFFER_LINE
5861 // committ event should be fired. This only needs to happen if you don't always want this commit event on a Carriage Return/Line feed and if you listen to
5862 // IVsFinalTextChangeCommitEvents or IVsPreliminaryTextChangeCommitEvents
5866 uuid(uuid_IVsQueryLineChangeCommit)
5868 interface IVsQueryLineChangeCommit : IUnknown
5871 HRESULT QuerySendEnterLineCommit(
5872 [in] DWORD dwReserved,
5873 [in] long iLineStart,
5874 [in] long iLineEnd,
5875 [out, retval] QuerySendCommitFlags *dwQuerySendCommitFlags);
5879 // IVsCodeWindowEvents
5880 // This is an optional interfce that can be QI'd from the IVsCodeWindow interface. It sends code window type events to someone who doesn't have an IVsCodeWindowManager
5882 uuid(uuid_IVsCodeWindowEvents)
5884 interface IVsCodeWindowEvents : IUnknown
5886 HRESULT OnNewView ([in] IVsTextView *pView);
5887 HRESULT OnCloseView ([in] IVsTextView *pView);
5890 //----------------------------------------------------------------------------
5891 // IVsFileBackup interface
5893 // IVsFileBackup should be supported by components interested in being
5894 // backed up. Visual Studio File Recovery backs up all objects in the Running
5895 // Document Table that support IVsFileBackup and have unsaved changes.
5896 //----------------------------------------------------------------------------
5899 uuid(uuid_IVsFileBackup),
5900 version(1.0),
5901 pointer_default(unique)
5905 interface IVsFileBackup : IUnknown
5907 //----------------------------------------------------------------------------
5908 // BackupFile() persists the object to a single file. It must not
5909 // modify any internal state, but should clear the secondary dirty bit.
5910 // BackupFile() must return either E_STG_S_DATALOSS or STG_E_INVALIDCODEPAGE
5911 // if there is no way to persist to a file without data loss.
5912 //----------------------------------------------------------------------------
5914 HRESULT BackupFile([in] LPCOLESTR pszBackupFileName);
5916 //----------------------------------------------------------------------------
5917 // IVsFileBackup needs to keep track of a secondary dirty bit for the backup in
5918 // order to avoid extra backups for cases where the file is dirty, but the
5919 // backup matches the current state of the object. This bit should be set when
5920 // the object is modified and cleared on calls to BackupFile() and any Save()
5921 // method. IsBackupFileObosolete() returns true if this bit is set, FALSE otherwise.
5922 //----------------------------------------------------------------------------
5924 HRESULT IsBackupFileObsolete([out] BOOL *pbObsolete);
5928 uuid(uuid_IVsLineAttributes),
5929 version(1.0),
5930 pointer_default(unique)
5932 interface IVsLineAttributes : IUnknown
5934 HRESULT SetLineSeparator([in] long *rgLines, [in] long cLines, [in]BOOL fRemoveAll);