|
|
|
ISelectionServicesListener Interface |
|
IID_ISelectionServicesListener |
{3050F699-98B5-11CF-BB82-00AA00BDCE0B} |
|
This custom interface provides methods that the editing component of MSHTML calls whenever certain events fire for a selection object that has a registered ISelectionServicesListener interface. This interface provides processing for undo events, for selection type changes, and whenever the mouse pointer exits the scope of an element in the editable selection. An application should supply an implementation of this interface for a selection object so that the editing component of MSHTML can respond to these events.
|
|
Methods in VTable order |
|
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns pointers to supported interfaces. |
|
AddRef |
Increments reference count. |
|
Release |
Decrements reference count. |
|
ISelectionServicesListener Method |
Description |
|
BeginSelectionUndo |
Called by the editor just before processing an undo event that fires on a selection object. |
|
EndSelectionUndo |
Called by the editor just after processing an undo event that fires on a selection object with a registered ISelectionServicesListener interface. |
|
OnSelectedElementExit |
Called by the editor when an element in the current editable selection is removed from the document. |
|
OnChangeType |
Called by the editor when a selection's type changes. |
|
GetTypeDetail |
Called by MSHTML to obtain the name of the selection type. |
|
ISelectionServicesListener interface implementation |
$IID_ISelectionServicesListener = GUID$("{3050F699-98B5-11CF-BB82-00AA00BDCE0B}")
' ****************************************************************************************
' ISelectionServicesListener interface virtual table
' ****************************************************************************************
TYPE ISelectionServicesListenerVtbl
' IUnknown methods
pQueryInterface AS DWORD ' // QueryInterface method
pAddRef AS DWORD ' // AddRef method
pRelease AS DWORD ' // Release method
' ISelectionServicesListener method
pBeginSelectionUndo AS DWORD ' // BeginSelectionUndo method
pEndSelectionUndo AS DWORD ' // EndSelectionUndo method
pOnSelectedElementExit AS DWORD ' // OnSelectedElementExit method
pOnChangeType AS DWORD ' // OnChangeType method
pGetTypeDetail AS DWORD ' // GetTypeDetail method
' Custom data
pVtblAddr AS DWORD ' // Address of the virtual table
cRef AS DWORD ' // Reference count
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the ISelectionServicesListener Virtual Table
' Returns a cookie that is a pointer to a ISelectionServicesListenerVtbl structure.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_BuildVtbl () AS DWORD
LOCAL pVtbl AS ISelectionServicesListenerVtbl PTR
LOCAL pUnk AS ISelectionServicesListenerVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVtbl.pQueryInterface = CODEPTR(ISelectionServicesListener_QueryInterface)
@pVtbl.pAddRef = CODEPTR(ISelectionServicesListener_AddRef)
@pVtbl.pRelease = CODEPTR(ISelectionServicesListener_Release)
@pVtbl.pBeginSelectionUndo = CODEPTR(ISelectionServicesListener_BeginSelectionUndo)
@pVtbl.pEndSelectionUndo = CODEPTR(ISelectionServicesListener_EndSelectionUndo)
@pVtbl.pOnSelectedElementExit = CODEPTR(ISelectionServicesListener_OnSelectedElementExit)
@pVtbl.pOnChangeType = CODEPTR(ISelectionServicesListener_OnChangeType)
@pVtbl.pGetTypeDetail = CODEPTR(ISelectionServicesListener_GetTypeDetail)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.cRef = 1
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ISelectionServicesListener_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_QueryInterface (BYVAL pCookie AS ISelectionServicesListenerVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
IF riid = $IID_ISelectionServicesListener THEN
ppvObj = pCookie
INCR @@pCookie.cRef
FUNCTION = %S_OK
ELSE
FUNCTION = %E_NOINTERFACE
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ISelectionServicesListener_IUnknown_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_AddRef (BYVAL pCookie AS ISelectionServicesListenerVtbl PTR) AS DWORD
INCR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ISelectionServicesListener_IUnknown_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_Release (BYVAL pCookie AS ISelectionServicesListenerVtbl PTR) AS DWORD
DECR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
IF @@pCookie.cRef = 0 THEN
IF ISTRUE @@pCookie.pVtblAddr THEN
HeapFree(GetProcessHeap(), 0, BYVAL @@pCookie.pVtblAddr)
END IF
END IF
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by the editor just before processing an undo event that fires on a selection object.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_BeginSelectionUndo ( _
BYVAL pCookie AS ISelectionServicesListenerVtbl PTR _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by the editor just after processing an undo event that fires on a selection
' object with a registered ISelectionServicesListener interface.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_EndSelectionUndo ( _
BYVAL pCookie AS ISelectionServicesListenerVtbl PTR _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by the editor when an element in the current editable selection is removed from
' the document.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_OnSelectedElementExit ( _
BYVAL pCookie AS ISelectionServicesListenerVtbl PTR _
, BYVAL pIElementStart AS LONG _
, BYVAL pIElementEnd AS DWORD _
, BYVAL pIElementContentStart AS DWORD _
, BYVAL pIElementContentEnd AS DWORD _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by the editor when a selection's type changes.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_OnChangeType ( _
BYVAL pCookie AS ISelectionServicesListenerVtbl PTR _
, BYVAL eType AS LONG _
, BYVAL pIListener AS DWORD _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Called by MSHTML to obtain the name of the selection type.
' ****************************************************************************************
FUNCTION ISelectionServicesListener_GetTypeDetail ( _
BYVAL pCookie AS ISelectionServicesListenerVtbl PTR _
, BYREF pTypeDetail AS STRING _
) AS LONG
' Put your code here
' FUNCTION = %S_OK or an error value
END FUNCTION
' ****************************************************************************************
|
Page last updated on Monday, 03 April 2006 20:04:13 +0200