MyOle ver. 0.91 Author: Matej Trampus, Slovenija E-MAIL: - Matej.Trampus@kiss.uni-lj.si See readme.txt for details. //
IRichEditOle - The following to interfaces (to interfaces) was created by me.
IRichEditOleCallback -
TMyRichEditOleCallBack -
TReDropSource -
TRichEditWithOle -
TRichEditWithOleClass -
iid2String -
Register -
PReObject
TGetOleFromDragSourceEvent
TQueryInsertDelphiObjectEvent
TQueryInsertObjectEvent
TReObject
DVASPECT_CONTENT
EM_GETOLEINTERFACE
EM_SETOLECALLBACK
EM_SETOLEINTERFACE
RECO_COPY
RECO_CUT
RECO_DRAG
RECO_DROP
RECO_PASTE
REO_BELOWBASELINE
REO_BLANK
REO_DYNAMICSIZE
REO_GETMETAFILE
REO_GETOBJ_ALL_INTERFACES
REO_GETOBJ_NO_INTERFACES
REO_GETOBJ_POLEOBJ
REO_GETOBJ_POLESITE
REO_GETOBJ_PSTG
REO_HILITED
REO_INPLACEACTIVE
REO_INVERTEDSELECT
REO_LINK
REO_LINKAVAILABLE
REO_NULL
REO_OPEN
REO_READWRITEMASK
REO_RESIZABLE
REO_SELECTED
REO_STATIC
function iid2String(const iid:TGUid):string;
procedure Register;
PReObject=^TreObject
TGetOleFromDragSourceEvent=procedure(sender:TObject;source:TObject;var oleObject:TDelphiOle) of object
TQueryInsertDelphiObjectEvent=procedure(Sender:TObject;classRef:TDelphiOleClass;cp:Longint;var canInsert:boolean) of Object
TQueryInsertObjectEvent=procedure(Sender:TObject;const clsid:TCLSID;cp:Longint;var canInsert:boolean) of object
TReObject = record
cbStruct : DWORD;
xp : longint;
clsid : TCLSID ;
poleobj : IOleObject;
pstg : Istorage;
polesite : IOleClientSite;
sizel : Tsize;
dvaspect : dword;
dwFlags : dword;
dwUser : dword;
end;
DVASPECT_CONTENT = 1
drag
EM_GETOLEINTERFACE = (WM_USER + 60)
About controlling reObject.dwFlags flags when data is dropped: When IOleObject is dropped on RichEdit control, RichEdit sets reObject.dwFlags to default values. The only way to set this flags to non-default value is to provide RIHCHEDIT (or RichEditWithObjects) clipboard format. Because I could not find specification for this format, I create an invisible RichEdit control, insert the object and then query this RichEdit control for RICHEDIT format. This behaviour is currenly only implemented for VCL drag'n'drop operation (which is started with BehinDrag). Data dropped from another application has default reObject.dwFlags flags. Anyone know the solution? About destroyin RichEdit window" Delphi destroys controls within a main form without calling DestroyWindowHandle procedure. So we do not know, when out RichEdit control gets destroyed. I browsed through controls.pas and discovered, that the only point, where the window handle is actually set to 0 is in TWinControl.WMNCDestroy. We intercept this message (TRichEditWithOle.WMNCDestroy) and release the riche edit's interface. Alternate solution would be to check if handle is still allocated in. Destroy method and call Release only when we would have a valid handle. But... Who knows what happens if we have a refrence to IRichEditOle and RichEdit window gets destroyed. My guess is, that interface is released too, and we get a pointer, which points to already freed interface If someone knows more about this problem, please, let me know... BUGS: - Calling Debug() during drag and drop of OLE object [with text] cauese form to repaint after text has been dropped. I have no idea why (must be something with changes in _debugMemo) - I do not know, what is the value of IID_IRichEditOleCallBack, so I was not able to correctly implement TMyRichEditOleCallBack.QueryInterface // // History: --- ver 0.91: 26.10.1996 Added support for Delphi drag and drop. When TRichEditWithOle need data, OnGetOleDragFromSource gets called. If there is no OleData normal Delphi drag'n'drop events are called 25.10.1996 Added TRichEditWithOle: OnQueryInsertDelphiObject OnQueryInsertObject, BUGFIX: TRichEditWithOle.GetReObject TReObject.cbStruct was not set BUGFIX: EnumFormats now handle also nil enumerator object BUGFIX: TMyRichEditOleCallBack.GetNewStorage: LockBytes.release was missing --- ver 0.90: 23.10.1996 BUGFIX: EnumFormats enum.release was missing
EM_SETOLECALLBACK = (WM_USER + 70)
EM_SETOLEINTERFACE = EM_SETOLECALLBACK
LUCKY GUESS???
RECO_COPY = 2
drop
RECO_CUT = 3
copy to the clipboard
RECO_DRAG = 4
cut to the clipboard
RECO_DROP = 1
paste from clipboard
RECO_PASTE = 0
Object requires metafile (RO
REO_BELOWBASELINE = $2
Object drawn all inverted if sel
REO_BLANK = $10
Mask out RO bits
REO_DYNAMICSIZE = $8
Object is blank
REO_GETMETAFILE = $00400000
Link believed available (RO
REO_GETOBJ_ALL_INTERFACES = 7
REO_GETOBJ_NO_INTERFACES = 0
REO_GETOBJ_POLEOBJ = 1
REO_GETOBJ_POLESITE = 4
REO_GETOBJ_PSTG = 2
REO_HILITED = $01000000
Object in place active (RO
REO_INPLACEACTIVE = $02000000
Object open in its server (RO
REO_INVERTEDSELECT = $4
Object defines size always
REO_LINK = $80000000
Object may be resized
REO_LINKAVAILABLE = $00800000
Object is to be hilited (RO
REO_NULL = 0
REO_OPEN = $04000000
Object selected (RO
REO_READWRITEMASK = $1F
No flags
REO_RESIZABLE = $1
Object sits below the baseline
REO_SELECTED = $08000000
Object is static (RO
REO_STATIC = $40000000
Object is a link (RO