home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
OLECTNRS.INT
< prev
next >
Wrap
Text File
|
1997-02-28
|
9KB
|
232 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1996 Borland International }
{ }
{*******************************************************}
unit OleCtnrs;
interface
uses Windows, Messages, CommCtrl, Ole2, OleDlg, SysUtils, Classes,
Controls, Forms, Menus, Graphics, OleAuto;
const
ovShow = -1;
ovOpen = -2;
ovHide = -3;
ovUIActivate = -4;
ovInPlaceActivate = -5;
ovDiscardUndoState = -6;
ovPrimary = -65536;
type
TOleContainer = class;
TOleForm = class;
TOleClientSite = class(IOleClientSite)
public
constructor Create(Container: TOleContainer);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function SaveObject: HResult; override;
function GetMoniker(dwAssign: Longint; dwWhichMoniker: Longint;
var mk: IMoniker): HResult; override;
function GetContainer(var container: IOleContainer): HResult; override;
function ShowObject: HResult; override;
function OnShowWindow(fShow: BOOL): HResult; override;
function RequestNewObjectLayout: HResult; override;
end;
TOleInPlaceSite = class(IOleInPlaceSite)
public
constructor Create(Container: TOleContainer);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function GetWindow(var wnd: HWnd): HResult; override;
function ContextSensitiveHelp(fEnterMode: BOOL): HResult; override;
function CanInPlaceActivate: HResult; override;
function OnInPlaceActivate: HResult; override;
function OnUIActivate: HResult; override;
function GetWindowContext(var frame: IOleInPlaceFrame;
var doc: IOleInPlaceUIWindow; var rcPosRect: TRect;
var rcClipRect: TRect; var frameInfo: TOleInPlaceFrameInfo): HResult;
override;
function Scroll(const scrollExtent: TPoint): HResult; override;
function OnUIDeactivate(fUndoable: BOOL): HResult; override;
function OnInPlaceDeactivate: HResult; override;
function DiscardUndoState: HResult; override;
function DeactivateAndUndo: HResult; override;
function OnPosRectChange(const rcPosRect: TRect): HResult; override;
end;
TAdviseSink = class(IAdviseSink)
public
constructor Create(Container: TOleContainer);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
procedure OnDataChange(var formatetc: TFormatEtc; var stgmed: TStgMedium); override;
procedure OnViewChange(dwAspect: Longint; lindex: Longint); override;
procedure OnRename(mk: IMoniker); override;
procedure OnSave; override;
procedure OnClose; override;
end;
TAutoActivate = (aaManual, aaGetFocus, aaDoubleClick);
TSizeMode = (smClip, smCenter, smScale, smStretch, smAutoSize);
TObjectState = (osEmpty, osLoaded, osRunning, osOpen, osInPlaceActive,
osUIActive);
TCreateType = (ctNewObject, ctFromFile, ctLinkToFile, ctFromData,
ctLinkFromData);
TCreateInfo = record
CreateType: TCreateType;
ShowAsIcon: Boolean;
IconMetaPict: HGlobal;
ClassID: TCLSID;
FileName: string;
DataObject: IDataObject;
end;
TVerbInfo = record
Verb: Smallint;
Flags: Word;
end;
TObjectMoveEvent = procedure(OleContainer: TOleContainer;
const Bounds: TRect) of object;
TOleContainer = class(TCustomControl)
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure DblClick; override;
procedure DefineProperties(Filer: TFiler); override;
procedure DoEnter; override;
function GetPopupMenu: TPopupMenu; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function ChangeIconDialog: Boolean;
procedure Close;
procedure Copy;
procedure CreateLinkToFile(const FileName: string; Iconic: Boolean);
procedure CreateObject(const OleClassName: string; Iconic: Boolean);
procedure CreateObjectFromFile(const FileName: string; Iconic: Boolean);
procedure CreateObjectFromInfo(const CreateInfo: TCreateInfo);
procedure DestroyObject;
procedure DoVerb(Verb: Integer);
function GetIconMetaPict: HGlobal;
function InsertObjectDialog: Boolean;
procedure LoadFromFile(const FileName: string);
procedure LoadFromStream(Stream: TStream);
function ObjectPropertiesDialog: Boolean;
procedure Paste;
function PasteSpecialDialog: Boolean;
procedure Run;
procedure SaveToFile(const FileName: string);
procedure SaveToStream(Stream: TStream);
procedure UpdateObject;
procedure UpdateVerbs;
property CanPaste: Boolean;
property Linked: Boolean;
property Modified: Boolean;
property NewInserted: Boolean;
property ObjectVerbs: TStrings;
property OleClassName: string;
property OleObject: Variant;
property OleObjectInterface: IOleObject;
property PrimaryVerb: Integer;
property SourceDoc: string;
property State: TObjectState;
property StorageInterface: IStorage;
published
property AllowInPlace: Boolean default True;
property AutoActivate: TAutoActivate default aaDoubleClick;
property AutoVerbMenu: Boolean default True;
property Align;
property BorderStyle: TBorderStyle default bsSingle;
property Caption;
property Color;
property CopyOnSave: Boolean default True;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property Iconic: Boolean;
property OldStreamFormat: Boolean default False;
property ParentColor default False;
property ParentCtl3D;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property SizeMode: TSizeMode default smClip;
property TabOrder;
property TabStop default True;
property Visible;
property OnActivate: TNotifyEvent;
property OnDeactivate: TNotifyEvent;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnObjectMove: TObjectMoveEvent;
property OnResize: TNotifyEvent;
property OnStartDrag;
end;
TOleInPlaceFrame = class(IOleInPlaceFrame)
public
constructor Create(OleForm: TOleForm);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function GetWindow(var wnd: HWnd): HResult; override;
function ContextSensitiveHelp(fEnterMode: BOOL): HResult; override;
function GetBorder(var rectBorder: TRect): HResult; override;
function RequestBorderSpace(const borderwidths: TRect): HResult; override;
function SetBorderSpace(pborderwidths: PRect): HResult; override;
function SetActiveObject(activeObject: IOleInPlaceActiveObject;
pszObjName: POleStr): HResult; override;
function InsertMenus(hmenuShared: HMenu;
var menuWidths: TOleMenuGroupWidths): HResult; override;
function SetMenu(hmenuShared: HMenu; holemenu: HMenu;
hwndActiveObject: HWnd): HResult; override;
function RemoveMenus(hmenuShared: HMenu): HResult; override;
function SetStatusText(pszStatusText: POleStr): HResult; override;
function EnableModeless(fEnable: BOOL): HResult; override;
function TranslateAccelerator(var msg: TMsg; wID: Word): HResult; override;
end;
TOleForm = class(TOleFormObject)
protected
procedure OnDestroy; override;
procedure OnResize; override;
public
constructor Create(Form: TForm);
destructor Destroy; override;
end;
procedure DestroyMetaPict(MetaPict: HGlobal);
implementation