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. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WOleContainer -- Ole Object Container class
- *
- *
- * Events:
- *
- * NewObject -- a new object has been created
- *
- * SetStatusText -- a request to set the app's status bar
- *
- * GetBorder -- object is requesting the rect in which
- * it will perform border negotiation
- *
- * RequestBorderSpace -- the object is asking for border space
- *
- * SetBorderSpace -- the object is informing you how much
- * border space it is actually using
- *
- * DragEnter -- an Ole drag enter event
- *
- * DragLeave -- an Ole drag leave event
- *
- * DragOver -- an Ole drag over event
- *
- * DragDrop -- an Ole drag drop event
- *
- *
- *************************************************************************/
-
- #ifndef _WOLEFORM_HPP_INCLUDED
- #define _WOLEFORM_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WOLEAUTO_HPP_INCLUDED
- # include "woleauto.hpp"
- #endif
- #ifndef _WSTRING_HPP_INCLUDED
- # include "wstring.hpp"
- #endif
- #ifndef _WCOLOR_HPP_INCLUDED
- # include "wcolor.hpp"
- #endif
- #ifndef _WFONT_HPP_INCLUDED
- # include "wfont.hpp"
- #endif
- #ifndef _WOLEDEF_HPP_INCLUDED
- # include "woledef.hpp"
- #endif
- #ifndef _WWINDOW_HPP_INCLUDED
- # include "wwindow.hpp"
- #endif
- #ifndef _WTHREAD_HPP_INCLUDED
- # include "wthread.hpp"
- #endif
-
- // forward declarations
- class WCMCLASS WOleObject;
- class WCMCLASS WOleIContainer;
- class WCMCLASS WForm;
- class WCMCLASS WFont;
- class WCMCLASS WCanvas;
- class WCMCLASS WDisplayCanvas;
- class WCMCLASS WString;
-
- // new object event data structure
- struct WNewObjectEventData : public WEventData {
- WOleObject *newObject;
- };
-
- // set status text event data structure
- struct WSetStatusTextEventData : public WEventData {
- WChar *statusText;
- };
-
- // border negotiation event data structures
- typedef struct WBorderWidths {
- WLong left;
- WLong top;
- WLong right;
- WLong bottom;
- } WBorderWidths;
-
- struct WBorderWidthsEventData : public WEventData {
- WBorderWidths widths;
- };
-
- struct WBorderEventData : public WEventData {
- WRect rect;
- };
-
- class WCMCLASS WOleContainer {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WOleContainer( WForm *form );
-
- virtual ~WOleContainer();
-
- public:
- /**************************************************************
- * Properties
- **************************************************************/
-
- // Show Object Type
- WBool SetShowObjectType( WBool show );
- WBool GetShowObjectType( void ) const;
-
- // Inplace Active
- WBool SetAllowInplaceActive( WBool inplaceActive );
- WBool GetAllowInplaceActive( void ) const;
-
- // Negotiate Menus
- WBool SetNegotiateMenus( WBool negotiate );
- WBool GetNegotiateMenus( void ) const;
-
- // Ambient properties for the container
-
- // Locale ID
- WBool SetLocaleID( WULong lcid );
- WULong GetLocaleID( void ) const;
-
- // Design Mode
- WBool SetDesignMode( WBool set );
- WBool GetDesignMode( void ) const;
-
- // UI dead
- WBool SetUIDead( WBool set );
- WBool GetUIDead( void ) const;
-
- // Show Grab Handles
- WBool SetShowGrabHandles( WBool set );
- WBool GetShowGrabHandles( void ) const;
-
- // Show Hatching
- WBool SetShowHatching( WBool set );
- WBool GetShowHatching( void ) const;
-
- // Document Name
- WBool SetDocumentTitle( const WString & title );
- WString GetDocumentTitle( void ) const;
-
- // Disable Ole Drag Drop
- WBool SetDisableOleDragDrop( WBool disable );
- WBool GetDisableOleDragDrop( void ) const;
-
- // Inplace Frame
- WBool SetInplaceFrame( WOleContainer *frame );
- WOleContainer *GetInplaceFrame( void ) const;
-
- // read-only properties
- WBool GetHasLinks( void ) const;
- WBool GetDirty( void ) const;
- WString GetDocFile( void ) const;
- WString GetActiveObjectName( void ) const;
- WOleObject *GetFirstObject( void );
- WOleObject *GetNextObject( WOleObject * );
- WOleObject *GetCurrentObject( void );
- WBool GetPasteValid( void );
- WBool GetPasteLinkValid( void );
- unsigned int GetOleObjectCount( void ) const;
- WOleObject *GetOleObject( unsigned int index ) const;
-
- WForm *GetForm( void ) const { return( _form ); };
-
- /**************************************************************
- * Methods
- **************************************************************/
-
- // creation and initialization functions
- WBool InitializeContainer( const WString * file=NULL );
- WBool UninitializeContainer( void );
- WBool LoadContainer( const WString & file );
- WBool SaveContainer( const WString * file=NULL );
-
- // ambient properties notifications
- void AmbientsChanged( WAmbientID *ambientIDs, WInt num );
- void AmbientChanged( WAmbientID ambientID );
-
- void DestroyObjects( WBool deleteObjects=FALSE );
- WBool Paste( void );
- WBool PasteLink( void );
- WBool EditLinks( void );
- WBool UpdateLinks( void );
- WBool PasteSpecial( WBool allowLinks=TRUE );
- void RenegotiateBorder( void );
-
- /**********************************************************
- * Internal Members
- *********************************************************/
-
- WOleIContainer *IContainer( void ) const;
-
- // mouse and paint events
- WBool OlePaint( WDisplayCanvas & port );
- WBool OleMouseEvent( WMouseEventData *ev );
- WBool OleContextMenu( WContextMenuEventData *ev );
- WBool OleCharPressEvent( WCharacterPressEventData *ev );
-
- // event handlers
- WBool FormResizeEventHandler( WResizeEventData *ev );
- WBool MessageHookEventHandler( WMessageFilterData *ev );
- WBool InstallMsgFilter( void );
- void UninstallMsgFilter( WBool force = FALSE );
-
- WBool ResizePercentageHandler( WResizeEventData * event );
-
- // This property is obsolete. Usrs should use the DesignMode
- // property instead.
-
- // User Mode
- WBool SetUserMode( WBool set );
- WBool GetUserMode( void ) const;
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- protected:
-
- WRect _lastResizeRect;
-
- protected:
- class WOleContainerEventHandler : public WObject {
-
- public:
- WOleContainerEventHandler( WOleContainer *container );
- ~WOleContainerEventHandler( void );
-
- // event handlers
- WBool Paint( WObject *, WPaintEventData *ev );
- WBool MouseEvent( WObject *, WMouseEventData *ev );
- WBool ContextMenuEvent( WObject *, WContextMenuEventData *ev );
- WBool CharPressEvent( WObject *,WCharacterPressEventData *ev );
- WBool FormResizeEventHandler( WObject *, WResizeEventData *ev );
- WBool MessageHookEventHandler( WMessageFilterData *ev );
-
- WBool InstallMsgFilter( void );
- void UninstallMsgFilter( WBool force );
-
- WOleContainer *_container;
-
- private:
- WUInt _filterInstalled;
- };
-
- protected:
- WForm *_form;
- WOleIContainer *_iform;
-
- WOleContainerEventHandler _eventHandler;
-
- // ambient properties for this object
- WULong _localeID; // locale ID
- WBool _designMode; // design mode?
- WBool _UIDead; // UI dead?
- WBool _showGrabHandles;// show grab handles?
- WBool _showHatching; // show hatching?
-
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WOLEFORM_HPP_INCLUDED
-