home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WOleObject -- Ole Object class
- *
- *
- * Events:
- *
- * Click -- the user clicked on the object
- *
- * ContextMenu -- the context menu event
- *
- * LeftButtonDown -- the left mouse button has been depressed
- *
- * LeftButtonDouble -- the left mouse button double clicked
- *
- * LeftButtonUp -- the left mouse button has been released
- *
- * MiddleButtonDown -- the middle mouse button has been depressed
- *
- * MiddleButtonDouble -- the middle mouse button double clicked
- *
- * MiddleButtonUp -- the middle mouse button has been released
- *
- * RightButtonDown -- the right mouse button has been depressed
- *
- * RightButtonDouble -- the right mouse button double clicked
- *
- * RightButtonUp -- the right mouse button has been released
- *
- * PropertyRequestEdit -- a property is asking if it may be changed
- *
- * PropertyChanged -- a property has changed
- *
- * InplaceActivate -- the object has been inplace activated
- *
- * InplaceDeactivate -- the object has been inplace deactivated
- *
- * UIActivate -- the object has been UI activated
- *
- * UIDeactivate -- the object has been UI deactivated
- *
- * PosRectChange -- the position of the inplace window is
- * changing
- *
- * ViewChange -- the visible representation of the object
- * has changed
- *
- * UpdateExtents -- the objects extents ( size ) have changed
- *
- * DragStart -- a drag drop operation has been initiated
- * on this object
- *
- * DragEnd -- a drag drop operation has ended
- * on this object
- *
- * DragContinue -- drag continue notification
- *
- * DragFeedback -- drag feedback notification
- *
- * SimpleFramePreMessageFilter -- OLE simple frame pre-message filter
- *
- * SimpleFramePostMessageFilter -- OLE simple frame post-message filter
- *
- * DataClose -- Data source event
- *
- * DataOpen -- Data source event
- *
- * DataAvailable -- Data source event
- *
- * DataRequest -- Data source event
- *
- * ShowWindow -- the object is showing/hiding its
- * application window
- *
- *************************************************************************/
-
- #ifndef _WOLEOBJ_HPP_INCLUDED
- #define _WOLEOBJ_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WOLEAUTO_HPP_INCLUDED
- # include "woleauto.hpp"
- #endif
-
- #ifndef _WDEF_HPP_INCLUDED
- # include "wdef.hpp"
- #endif
- #ifndef _WWINDOW_HPP_INCLUDED
- # include "wwindow.hpp"
- #endif
- #ifndef _WOLEDEF_HPP_INCLUDED
- # include "woledef.hpp"
- #endif
- #ifndef _WDSPHLPR_HPP_INCLUDED
- # include "wdsphlpr.hpp"
- #endif
- #ifndef _WOLEPARM_HPP_INCLUDED
- # include "woleparm.hpp"
- #endif
- #ifndef _WPOINT_HPP_INCLUDED
- # include "wpoint.hpp"
- #endif
- #ifndef _WRECT_HPP_INCLUDED
- # include "wrect.hpp"
- #endif
- #ifndef _WSTRING_HPP_INCLUDED
- # include "wstring.hpp"
- #endif
- #ifndef _WDRAG_HPP_INCLUDED
- # include "wdrag.hpp"
- #endif
- #ifndef _WDATATRG_HPP_INCLUDED
- # include "wdatatrg.hpp"
- #endif
-
- // forward class declarations
- class WDataSource;
- class WCMCLASS wllist_header;
-
- class WCMCLASS WOleEmbeddedObject;
- class WCMCLASS WOleContainer;
- class WCMCLASS WMenu;
-
- // property notification event data structure
- struct WPropertyEventData : public WEventData {
- WDispID property;
- };
-
- struct WPosRectChangeEventData : public WEventData {
- WRect newPosition;
- };
-
- struct WExtentsEventData : public WEventData {
- WLong cx;
- WLong cy;
- };
-
- struct WSimpleFrameSiteEventData : public WMessageEventData {
- WULong cookie;
- };
-
- struct WShowWindowEventData : public WMessageEventData {
- WBool open;
- };
-
- // event notification callback type
-
- typedef void WCMDEF (WObject::*WControlEventHandler)( WDispIndex, WDispID, WVariant *, WInt );
-
- /* Draw Modes */
- enum WOleDrawMode {
- WOleDrawMode_Stretch = 0,
- WOleDrawMode_Clip = 1,
- };
-
- /* Predefined Activation Verbs */
- enum WOleObjectVerb {
- WOleVerb_PRIMARY = (0),
- WOleVerb_SHOW = (-1),
- WOleVerb_OPEN = (-2),
- WOleVerb_HIDE = (-3),
- WOleVerb_UIACTIVATE = (-4),
- WOleVerb_INPLACEACTIVATE = (-5),
- WOleVerb_DISCARDUNDOSTATE = (-6),
- WOleVerb_PROPERTIES = (-7)
- };
-
- /* Predefined User Types */
- enum WOleUserType {
- WUserType_FULL = 1,
- WUserType_SHORT = 2,
- WUserType_APPNAME = 3
- };
-
- /* Predefined Automatic Activation Actions */
- enum WOleAutoActivateAction {
- WOleAutoActivate_Manual = 0,
- WOleAutoActivate_Click = 1,
- WOleAutoActivate_DoubleClick = 2,
- };
-
- // **** to be removed
- #define WOleObjectVerb_PRIMARY ((WOleObjectVerb)0L)
- #define WOleObjectVerb_SHOW ((WOleObjectVerb)-1L)
- #define WOleObjectVerb_OPEN ((WOleObjectVerb)-2L)
- #define WOleObjectVerb_HIDE ((WOleObjectVerb)-3L)
- #define WOleObjectVerb_UIACTIVATE ((WOleObjectVerb)-4L)
- #define WOleObjectVerb_INPLACEACTIVATE ((WOleObjectVerb)-5L)
- #define WOleObjectVerb_DISCARDUNDOSTATE ((WOleObjectVerb)-6L)
- #define WOleObjectVerb_PROPERTIES ((WOleObjectVerb)-7L)
-
- #define WOLEDEF_FIRSTVERBID 20000
- #define WOLEDEF_LASTVERBID 20099
-
- // the following is definitions of WOleObject
-
- class WCMCLASS WOleObject : public WEventGenerator {
- WDeclareSubclass( WOleObject, WEventGenerator );
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WOleObject();
-
- virtual ~WOleObject();
-
- public:
-
- /**************************************************************
- * Properties
- **************************************************************/
-
- // Class
- WBool SetClass( const WString & cls, WOleContainer *parent=NULL );
- WString GetClass() const;
-
- // Display Name
- WBool SetDisplayName( const WString & displayName );
- WString GetDisplayName() const;
-
- // Display As Default
- WBool SetDisplayAsDefault( WBool set );
- WBool GetDisplayAsDefault() const;
-
- // Inplace Active
- WBool SetAllowInplaceActive( WBool inplaceActive );
- WBool GetAllowInplaceActive() const;
-
- // Use Iconic Aspect
- WBool SetUseIconicAspect( WBool use );
- WBool GetUseIconicAspect() const;
-
- // Iconic Aspect
- WBool SetIconicAspect( const WIcon icon );
- WIcon GetIconicAspect() const;
-
- // Draw Select Handles
- WBool SetDrawSelectHandles( WBool set );
- WBool GetDrawSelectHandles() const;
-
- // Draggable
- WBool SetDraggable( WBool set );
- WBool GetDraggable() const;
-
- // Clippable
- WBool SetClippable( WBool set );
- WBool GetClippable() const;
-
- // Visible
- WBool SetVisible( WBool set );
- WBool GetVisible() const;
-
- // Use Object Extents
- WBool SetUseObjectExtents( WBool set );
- WBool GetUseObjectExtents() const;
-
- // AutoVerbMenu
- WBool SetAutoVerbMenu( WBool set );
- WBool GetAutoVerbMenu() const;
-
- // Rectangle
- WBool SetRectangle( const WRect & r );
- WRect GetRectangle( WBool absolute=FALSE ) const;
-
- // Size
- WBool SetSize( const WPoint & p );
- WPoint GetSize() const;
-
- // Hot Link
- WBool SetHotLink( WBool set );
- WBool GetHotLink() const;
-
- // Active
- WBool SetActive( WBool set );
- WBool GetActive() const;
-
- // Auto Activate Action
- WBool SetAutoActivateAction( WOleAutoActivateAction action );
- WOleAutoActivateAction GetAutoActivateAction() const;
-
- // Auto Activate Verb
- WBool SetAutoActivateVerb( WOleObjectVerb verb );
- WOleObjectVerb GetAutoActivateVerb() const;
-
- // Default bound property
- WBool SetDefaultBoundProperty( const WString & prop );
- WString GetDefaultBoundProperty( void ) const;
-
- // DataColumns
- WString GetDataColumns() const;
- WBool SetDataColumns( const WString & cols );
-
- // DataSource
- WDataSource *GetDataSource() const;
- WBool SetDataSource( WDataSource *source );
-
- // ResizePercentages
- WRect GetResizePercentages() const;
- WBool SetResizePercentages( const WRect & resizePercentages );
-
- // DrawMode
- WBool SetDrawMode( WOleDrawMode mode );
- WOleDrawMode GetDrawMode() const;
-
- // TabGroup
- WBool SetTabGroup( WBool tabGroup );
- WBool GetTabGroup() const;
-
- // TabStop
- WBool SetTabStop( WBool tabStop );
- WBool GetTabStop() const;
-
- // Focus
- WBool SetFocus( WBool focus );
- WBool GetFocus() const;
-
- // Remote Host
- WBool SetRemoteHost( const WString & remoteHost );
- WString GetRemoteHost() const;
-
- // read-only properties
- WOleContainer *GetOleContainer() const;
- WWindowHandle GetInplaceWindowHandle() const;
- WBool GetSelected() const;
- WBool GetOleControl() const;
- WBool GetInsideOut() const;
- WBool GetActivateWhenVisible() const;
- WBool GetUsingAutomation() const;
-
- WPICursor GetICursor( void ) const;
- WBool GetHasICursor( void ) const;
-
- WBool GetOpened() const;
- WBool GetModified() const;
- WBool GetLinked() const;
- WBool GetInvisibleAtRuntime() const;
- WBool GetActsLikeButton() const;
- WBool GetActsLikeLabel() const;
- WBool GetNoUIActivate() const;
- WBool GetAlignable() const;
- WBool GetSimpleFrame() const;
- WBool GetIMEMode() const;
-
- WPIUnknown GetObjectInterface() const;
- WPoint GetObjectExtent() const;
- WString GetObjectClassID() const;
- WULong GetObjectID();
- WString GetUserType( WOleUserType type = WUserType_SHORT ) const;
-
- // read-only Licensing properties
- WBool GetLicenseVerified() const;
- WBool GetRuntimeKeyAvailable() const;
- WBString GetRuntimeLicenseKey() const;
-
- // read-only Automation properties
- WOleAutomationErrorInfo GetErrorInfo( void ) const;
- WVariant GetLastResult( void ) const;
- WVarType GetLastResultType( void ) const;
-
- // complex bound control properties
- WBool SetBoundProperty( WDispID dispID, WObject *object );
- WObject * GetBoundProperty( WDispID dispID );
-
- // event notification method
- WBool SetOleEventHandler( WObject *source, WDispIndex disp_index,
- WDispID disp_id,
- WControlEventHandler handler );
-
- /**************************************************************
- * Methods
- **************************************************************/
-
- // creation, initialization and destruction functions
- WBool Create( WOleContainer *parent, WString const & clsid,
- const WRect * r = NULL, const WBString *license=NULL );
- WBool Create( WOleContainer *parent, const WRect * r = NULL,
- const WBString *license=NULL );
- WBool CreateLink( WOleContainer *parent, WString const & linkSrc,
- const WRect * r = NULL,
- const WBString *license=NULL );
- WBool CreateFromFile( WOleContainer *parent, WString const & filename,
- const WRect * r = NULL,
- const WBString *license=NULL );
-
- WBool Save( const WString *object_file=NULL );
- WBool Load( WOleContainer *parent, const WString & object_file,
- WBool restoreProperties=TRUE );
- WBool Load( WOleContainer *parent, const WResourceID & id,
- const WModule *module=NULL,
- WBool restoreProperties=TRUE );
-
- WBool Load( WOleContainer *parent, WPIStorage stg,
- const WString & stgName );
- WBool Save( WPIStorage stg, WString & stgName );
-
- WBool Destroy();
-
- // Automation methods
-
- // the following will not cause ITypeInfo lookups
- WBool Invoke( WMemberID memberID,
- WDispatchFlag flag, WUInt cvtParms,
- WVarType *vtParms, WVarType vtRet,
- void *result, ... );
-
- WBool Method( WMemberID memberID,
- WUInt cvtParms, WVarType *vtParms,
- WVarType vtRet, void *result, ... );
-
- WBool PropertyGet( WMemberID memberID, WVarType vtRet, void *result );
- WBool PropertyPut( WMemberID memberID, WVarType vt, ... );
- WBool PropertyPutRef( WMemberID memberID, WVarType vt, ... );
-
- WBool IDofName( const WString & name, WMemberID & id );
-
- WBool ClearDefaultBoundProperty( void );
- WBool DefaultBoundPropertyPut( const WVariant & val );
- WVariant DefaultBoundPropertyGet( void );
- WBool DataSourceChanged( WDispID dispID );
- WBool AllDataSourcesChanged( void );
-
- // the following may cause ITypeInfo lookups
- WBool Invoke( WMemberID memberID,
- WDispatchFlag flag, WVarType vtRet,
- void *result, const WOleParmList & parmlist );
-
- // object linking methods
- WBool BreakLink( void );
- WBool UpdateLink( void );
-
- // drag drop methods
- WBool StartDrag( WULong whichButton=WMK_LBUTTON,
- WDragInfo *draginfo=0, WBool sourceDragOver=FALSE,
- WBool targetDragOver=TRUE );
-
- // other methods
- WBool AppendVerbMenu( WMenu *menu,
- WUShort firstVerbID=WOLEDEF_FIRSTVERBID,
- WUShort lastVerbID=WOLEDEF_LASTVERBID,
- WBool selfDelete=TRUE,
- WBool addConvertMenu=TRUE );
-
- WBool FreezeControlEvents( WBool freeze );
-
- WBool ConvertObject( void );
-
- WBool Select( WBool select );
- WBool Repaint();
- WBool Invalidate( WBool erasebk = TRUE );
- WBool DoVerb( WOleObjectVerb verb );
- WBool DeactivateInplaceObject( WBool ignoreActivateWhenVisible=FALSE );
- WBool Move( const WPoint & p );
-
- WBool DoAutoActivate( WMouseEventData *ev=NULL );
- WBool DoContextMenu( WContextMenuEventData & ev );
-
- WBool Clip( WBool cut );
-
- /**************************************************************
- * Operators
- **************************************************************/
-
- operator WPIUnknown() const;
- operator WPIDispatch() const;
-
- /**************************************************************
- * Internal Methods
- **************************************************************/
-
- WBool DataOpenHandler( WOleObject *, WDataOpenEventData *ev );
- WBool DataCloseHandler( WOleObject *, WDataCloseEventData *ev );
- WBool DataAvailableHandler( WOleObject *, WDataAvailableEventData *ev );
- WBool DataRequestHandler( WOleObject *, WDataRequestEventData *ev );
- WBool OnPropertyChanged( WOleObject *, WPropertyEventData *ev );
- WBool OnPropertyRequestEdit( WObject *, WPropertyEventData *ev );
-
- WOleEmbeddedObject *EObject();
-
- WRect GetPendingResizePercentages() const;
- WBool SetPendingResizePercentages( const WRect & pendingResizePercentages );
-
- WBool SetLicenseVerified( WBool set );
- WBool SetRuntimeKeyAvailable( WBool set );
- WBool SetRuntimeLicenseKey( WBStr license );
-
- private:
-
- virtual const WChar * GetRegisteredClass();
-
- protected:
-
- WBool AllocDTCell();
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- protected:
- WOleContainer *_oleContainer;
- WOleEmbeddedObject *_eobject; // embedded object
- WDataTargetCell *_dataTarget;
- WBool _dataTargetRO;
- WBool _eatOnProp;
- WBool _displayAsDefault;
- WString _displayName;
- wllist_header *_boundPropList;
- WRect _resizePercentages;
- WRect _pendingResizePercentages;
- WBool _runTimeKeyAvail;
- WBool _licVerified;
- WBStr _licenseKey;
- WOleDrawMode _drawMode;
- WBool _tabGroup;
- WBool _tabStop;
- WString _remoteHost;
-
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WOLEOBJ_HPP_INCLUDED
-
-