' ########################################################################################
' Microsoft Windows
' File: RichOle.inc
' Contents: OLE Extensions to the Rich Text Editor
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_RichOle_PBI)
#DEFINE PBX_RichOle_PBI
%EQUATE `RICHOLE_INC = 1
#INCLUDE ONCE "Legacy/UI/Richedit.inc"
#INCLUDE ONCE "Legacy/COM/OleIdl.inc"
'// Structure passed to GetObject and InsertObject
' // Size = 56 bytes
TYPE REOBJECT DWORD
 cbStruct AS DWORD ' DWORD cbStruct // Size of structure
 cp AS LONG ' LONG cp // Character position of object
 clsid AS GUID ' CLSID clsid // Class ID of object// Class ID of object
 poleobj AS DWORD ' LPOLEOBJECT poleobj // OLE object interface
 pstg AS DWORD ' LPSTORAGE pstg // Associated storage interface
 polesite AS DWORD ' LPOLECLIENTSITE polesite // Associated client site interface
 sizel AS SIZEL ' SIZEL sizel // Size of object (may be 0,0)
 dvaspect AS DWORD ' DWORD dvaspect // Display aspect to use
 dwFlags AS DWORD ' DWORD dwFlags // Object status flags
 dwUser AS DWORD ' DWORD dwUser // Dword for user's use
END TYPE
'// Flags to specify which interfaces should be returned in the structure above
%EQUATE `REO_GETOBJ_NO_INTERFACES = &H00000000
%EQUATE `REO_GETOBJ_POLEOBJ = &H00000001
%EQUATE `REO_GETOBJ_PSTG = &H00000002
%EQUATE `REO_GETOBJ_POLESITE = &H00000004
%EQUATE `REO_GETOBJ_ALL_INTERFACES = &H00000007
' // Note: Although the C++ headers cast REO_CP_SELECTION, REO_IOB_SELECTION and REO_IOB_USE_CP, the
' // target is the cp member of the REOBJECT structure, which is a long, and as struct members are
' // assigned via the FPU and the value is too large to fit, the FPU assigns a masked error value instead.
' // This is the IEEE standard for the FPU.
'// Place object at selection
'%REO_CP_SELECTION = &HFFFFFFFF ' ((ULONG) -1L)
%EQUATE `REO_CP_SELECTION = -1& ' ((ULONG) -1L)
'// Use character position to specify object instead of index
'%REO_IOB_SELECTION = &HFFFFFFFF ' ((ULONG) -1L)
%EQUATE `REO_IOB_SELECTION = -1& ' ((ULONG) -1L)
'%REO_IOB_USE_CP = &HFFFFFFFE ' ((ULONG) -2L)
%EQUATE `REO_IOB_USE_CP = -2& ' ((ULONG) -2L)
'// Object flags
%EQUATE `REO_NULL = &H00000000 ' // No flags
%EQUATE `REO_READWRITEMASK = &H0000003F ' // Mask out RO bits
%EQUATE `REO_DONTNEEDPALETTE = &H00000020 ' // Object doesn't need palette
%EQUATE `REO_BLANK = &H00000010 ' // Object is blank
%EQUATE `REO_DYNAMICSIZE = &H00000008 ' // Object defines size always
%EQUATE `REO_INVERTEDSELECT = &H00000004 ' // Object drawn all inverted if sel
%EQUATE `REO_BELOWBASELINE = &H00000002 ' // Object sits below the baseline
%EQUATE `REO_RESIZABLE = &H00000001 ' // Object may be resized
%EQUATE `REO_LINK = &H80000000 ' // Object is a link (RO)
%EQUATE `REO_STATIC = &H40000000 ' // Object is static (RO)
%EQUATE `REO_SELECTED = &H08000000 ' // Object selected (RO)
%EQUATE `REO_OPEN = &H04000000 ' // Object open in its server (RO)
%EQUATE `REO_INPLACEACTIVE = &H02000000 ' // Object in place active (RO)
%EQUATE `REO_HILITED = &H01000000 ' // Object is to be hilited (RO)
%EQUATE `REO_LINKAVAILABLE = &H00800000 ' // Link believed available (RO)
%EQUATE `REO_GETMETAFILE = &H00400000 ' // Object requires metafile (RO)
'// flags for IRichEditOle::GetClipboardData(),
'// IRichEditOleCallback::GetClipboardData() and
'// IRichEditOleCallback::QueryAcceptData()
%EQUATE `RECO_PASTE = &H00000000 ' // paste from clipboard
%EQUATE `RECO_DROP = &H00000001 ' // drop
%EQUATE `RECO_COPY = &H00000002 ' // copy to the clipboard
%EQUATE `RECO_CUT = &H00000003 ' // cut to the clipboard
%EQUATE `RECO_DRAG = &H00000004 ' // drag
'// RichEdit interface GUIDs
$IID_IRichEditOle = GUID$("{00020D00-0000-0000-C000-000000000046}")
$IID_IRichEditOleCallback = GUID$("{00020D03-0000-0000-C000-000000000046}")
' ########################################################################################
' IRichEditOle interface
' IID = 00020D00-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
'/*
' * IRichEditOle
' *
' * Purpose:
' * Interface used by the client of RichEdit to perform OLE-related
' * operations.
' *
' * //$ REVIEW:
' * The methods herein may just want to be regular Windows messages.
' */
INTERFACE IRichEditOle $IID_IRichEditOle
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetClientSite ( ' VTable offset = 12
 BYREF lplpolesite AS IOleClientSite
 ) AS LONG
 ' =====================================================================================
 METHOD GetObjectCount ( ' VTable offset = 16
 ) AS LONG
 ' =====================================================================================
 METHOD GetLinkCount ( ' VTable offset = 20
 ) AS LONG
 ' =====================================================================================
 METHOD GetObject ( ' VTable offset = 24
 BYVAL iob AS LONG
 , BYREF lpreobject AS REOBJECT
 , BYVAL dwFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD InsertObject ( ' VTable offset = 28
 BYREF lpreobject AS REOBJECT
 ) AS LONG
 ' =====================================================================================
 METHOD ConvertObject ( ' VTable offset = 32
 BYVAL iob AS LONG
 , BYREF rclsidNew AS GUID
 , BYREF lpstrUserTypeNew AS ASCIIZ
 ) AS LONG
 ' =====================================================================================
 METHOD ActivateAs ( ' VTable offset = 36
 BYREF rclsid AS GUID
 , BYREF rclsidAs AS GUID
 ) AS LONG
 ' =====================================================================================
 METHOD SetHostNames ( ' VTable offset = 40
 BYREF lpstrContainerApp AS ASCIIZ
 , BYREF lpstrContainerObj AS ASCIIZ
 ) AS LONG
 ' =====================================================================================
 METHOD SetLinkAvailable ( ' VTable offset = 44
 BYVAL iob AS LONG
 , BYVAL fAvailable AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetDvaspect ( ' VTable offset = 48
 BYVAL iob AS LONG
 , BYVAL dvaspect AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD HandsOffStorage ( ' VTable offset = 52
 BYVAL iob AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SaveCompleted ( ' VTable offset = 56
 BYVAL iob AS LONG
 , BYVAL lpstg AS IStorage
 ) AS LONG
 ' =====================================================================================
 METHOD InPlaceDeactivate ( ' VTable offset = 60
 ) AS LONG
 ' =====================================================================================
 METHOD ContextSensitiveHelp ( ' VTable offset = 64
 BYVAL fEnterMode AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD GetClipboardData ( ' VTable offset = 68
 BYREF lpchrg AS CHARRANGE
 , BYVAL reco AS DWORD
 , BYREF lplpdataobj AS IDataObject
 ) AS LONG
 ' =====================================================================================
 METHOD ImportDataObject ( ' VTable offset = 72
 BYVAL lpdataobj AS IDataObject
 , BYVAL cf AS DWORD
 , BYVAL hMetaPict AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' IRichEditOleCallback interface
' IID = 00020D03-0000-0000-C000-000000000046
' Inherited interface = IUnknown
' ########################################################################################
'/*
' * IRichEditOleCallback
' *
' * Purpose:
' * Interface used by the RichEdit to get OLE-related stuff from the
' * application using RichEdit.
' */
INTERFACE IRichEditOleCallback $IID_IRichEditOleCallback
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetNewStorage ( ' VTable offset = 12
 BYREF lplpstg AS IStorage
 ) AS LONG
 ' =====================================================================================
 METHOD GetInPlaceContext ( ' VTable offset = 16
 BYREF lplpFrame AS IOleInPlaceFrame
 , BYREF lplpDoc AS IOleInPlaceUIWindow
 , BYREF lpFrameInfo AS OLEINPLACEFRAMEINFO
 ) AS LONG
 ' =====================================================================================
 METHOD ShowContainerUI ( ' VTable offset = 20
 BYVAL fShow AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD QueryInsertObject ( ' VTable offset = 24
 BYREF lpclsid AS GUID
 , BYVAL lpstg AS IStorage
 , BYVAL cp AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD DeleteObject ( ' VTable offset = 28
 BYVAL lpoleobj AS IDataObject
 ) AS LONG
 ' =====================================================================================
 METHOD QueryAcceptData ( ' VTable offset = 32
 BYVAL lpdataobj AS IDataObject
 , BYREF lpcfFormat AS DWORD
 , BYVAL reco AS DWORD
 , BYVAL fReally AS LONG
 , BYVAL hMetaPict AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ContextSensitiveHelp ( ' VTable offset = 36
 BYVAL fEnterMode AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD GetClipboardData ( ' VTable offset = 40
 BYREF lpchrg AS CHARRANGE
 , BYVAL reco AS DWORD
 , BYREF lplpdataobj AS IDataObject ' LPDATAOBJECT *lplpdataobj
 ) AS LONG
 ' =====================================================================================
 METHOD GetDragDropEffect ( ' VTable offset = 44
 BYVAL fDrag AS LONG
 , BYVAL grfKeyState AS DWORD
 , BYREF pdwEffect AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetContextMenu ( ' VTable offset = 48
 BYVAL seltype AS WORD
 , BYVAL lpoleobj AS IDataObject
 , BYREF lpchrg AS CHARRANGE
 , BYREF lphmenu AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF
