home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / BOCOLE.PAK / BOLEDOC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.4 KB  |  193 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.7  $
  6. //
  7. // Implements the Bolero half of the document-level object. Provides plumbing 
  8. // for activation of OLE2 objects as document windows become active. 
  9. // Also the main drag/drop and clipboard implementation.
  10. //----------------------------------------------------------------------------
  11. #ifndef _BOLEDOC_H
  12. #define _BOLEDOC_H 
  13.  
  14. #ifndef _BOLECOMP_H
  15. #include "BOleComp.h"
  16. #endif
  17.  
  18. #ifndef _BOLEPART_H
  19. #include "BOlePart.h"
  20. #endif
  21.  
  22. class _ICLASS BOleService;
  23. class _ICLASS BOleControl;
  24.  
  25.  
  26. class _ICLASS BOleDocument : public BOleComponent, public IBDocument,
  27.   public IDropTarget, public IOleUILinkContainer,  public IOleInPlaceFrame,
  28.   public IBOverrideBrowseLinks
  29. {
  30. public:
  31.   static CLIPFORMAT oleEmbdObjClipFmt;
  32.   static CLIPFORMAT oleEmbSrcClipFmt;
  33.   static CLIPFORMAT oleLinkSrcClipFmt;
  34.               
  35.   static CLIPFORMAT oleLinkClipFmt;
  36.   static CLIPFORMAT oleNativeClipFmt;
  37.   static CLIPFORMAT oleOwnerLinkClipFmt;
  38.   static CLIPFORMAT  oleObjectDescFmt;
  39.   static CLIPFORMAT  oleLinkSrcDescFmt;
  40.  
  41.   static UINT dragScrollInset;
  42.   static UINT dragScrollDelay;
  43.   static UINT dragScrollInterval;
  44.  
  45. protected:
  46.  
  47.   friend BOlePart;
  48.   friend BOleService;
  49.  
  50.   IBContainer    * pContainer;
  51.   IBApplication  * pApplication;
  52.   BOleService    * pService;
  53.  
  54.   IOleInPlaceActiveObject  
  55.                  * pActivePart;  // For keeping object's active state in sync with window's
  56.   IOleControl    * pActiveCtrl;  
  57.  
  58.   BOlePart       * pFirstPart;  // For enumerating objects
  59.   BOleControl    * pFirstCtrl;  // For enumerating objects
  60.  
  61.   // For drawing XOR'ed outline rect during drag/drop
  62.   //
  63.   RECT     dndObjPos;     
  64.   SIZE     dndSize;
  65.   POINT    dndLastPos;  
  66.   BOOL     dndInfoAvailable;
  67.   POINT    dndOffset;
  68.   PIBDropDest pDropDest;
  69.   BOOL fDrawn;
  70.  
  71.   BOOL dndLastFeedbackFailed; // so we know what to do when mouse doesn't move
  72.  
  73.   // For scrolling during drag/drop
  74.   //
  75.   RECT  rcScrollTop, rcScrollLeft, rcScrollRight, rcScrollBottom;
  76.   DWORD scrollEnterTime;
  77.   DWORD scrollLastTime;
  78.   BOOL  fScrollDelay;
  79.   
  80.   // For format negotiation during drag/drop
  81.   //
  82.   OLEUIPASTEENTRY *dndFormatList;
  83.   UINT dndFormatCount;
  84.   UINT dndFormat;
  85.   BOOL fCantLink;
  86.  
  87.   // For registering drag/drop
  88.   BOOL fRegistered;
  89.   
  90.   // To prevent BrowseLinks from being re-entrant
  91.   BOOL fInBrowseLinks;
  92.   
  93.   // Private implementation functions 
  94.   //
  95.   short _IFUNC ValidateDrag(DWORD keyState, POINTL *where, DWORD *effect, IDataObject *dataObj = NULL);
  96.   BOleScroll _IFUNC DragScrollReqd (POINTL *where);
  97.   void _IFUNC CacheDragRects (LPRECT);
  98.   void _IFUNC CalculateDndObjPos ();
  99.  
  100. public:
  101.   BOleDocument (BOleClassManager *, IBUnknownMain *, BOleService *);
  102.   ~BOleDocument ();
  103.  
  104.   IBContainer *GetContainer () { return pContainer; }
  105.  
  106.   BOlePart    *GetFirstPart ()    { return pFirstPart; }
  107.   BOleControl *GetFirstControl () { return pFirstCtrl; }
  108.   void         SetFirstPart    (BOlePart*pPart) { pFirstPart = pPart; }
  109.   void         SetFirstControl (BOleControl*pCtrl) { pFirstCtrl = pCtrl; }
  110.   void         OnRemovePart (BOlePart *pPart);
  111.   BOOL _IFUNC  EnableBrowseLinks();
  112.  
  113.   HRESULT      OnModalDialog (BOOL);
  114.   HRESULT      TranslateAccel (LPMSG);
  115.   HRESULT      TranslateControlAccel (LPMSG pMsg);
  116.  
  117.   // IDocument functions 
  118.   //
  119.   virtual HRESULT _IFUNC Init(PIBContainer);
  120.   virtual void    _IFUNC OnResize ();
  121.   virtual void    _IFUNC OnActivate (BOOL fActivate);
  122.   virtual void    _IFUNC OnClose ();
  123.   virtual HRESULT _IFUNC OnSetFocus(BOOL);
  124.   virtual HRESULT _IFUNC EnumLinks (PIBLinkInfo FAR*);
  125.   virtual HRESULT _IFUNC BrowseLinks ();
  126.   virtual HRESULT _IFUNC UpdateLinks ();
  127.  
  128. public:
  129.   
  130.   // IUnknown Methods
  131.   //                delegate aggregator's IUnknownMain
  132.   DEFINE_IUNKNOWN(pObjOuter)
  133.   
  134.   // IUnknownMain methods
  135.   //                
  136.   virtual HRESULT _IFUNC QueryInterfaceMain(REFIID iid, LPVOID FAR* pif);
  137.  
  138. private:
  139.  
  140.   // IOleWindow methods, base of IOleInPlaceUIWindow and IOleInPlaceSite
  141.   //
  142.   HRESULT _IFUNC GetWindow(HWND FAR* lphwnd);
  143.   HRESULT _IFUNC ContextSensitiveHelp(BOOL fEnterMode);
  144.  
  145.   // IOleInPlaceUIWindow methods
  146.   //
  147.   HRESULT _IFUNC GetBorder(LPRECT lprectBorder);
  148.   HRESULT _IFUNC RequestBorderSpace(LPCRECT lprectWidths);
  149.   HRESULT _IFUNC SetBorderSpace(LPCBORDERWIDTHS lpborderwidths);
  150.   HRESULT _IFUNC SetActiveObject(IOleInPlaceActiveObject* lpActiveObject,
  151.                       LPCOLESTR lpszObjName); 
  152.  
  153.   // IDropTarget functions
  154.   //
  155.   HRESULT _IFUNC DragEnter(IDataObject *dataObj, DWORD keyState, POINTL where, LPDWORD effect);
  156.   HRESULT _IFUNC DragOver(DWORD keyState, POINTL where, LPDWORD effect);
  157.   HRESULT _IFUNC DragLeave();
  158.   HRESULT _IFUNC Drop(IDataObject *dataObj, DWORD keyState, POINTL where, LPDWORD effect);
  159.  
  160.   // IOleUILinkContainer functions
  161.   //
  162.   DWORD   _IFUNC GetNextLink (DWORD dwLink);
  163.   HRESULT _IFUNC SetLinkUpdateOptions (DWORD dwLink, DWORD dwUpdateOpt);
  164.   HRESULT _IFUNC GetLinkUpdateOptions (DWORD dwLink, DWORD FAR* lpdwUpdateOpt);
  165.   HRESULT _IFUNC SetLinkSource (DWORD dwLink,
  166.                     TCHAR      *lpszDisplayName,
  167.                     ULONG       lenFileName,
  168.                     ULONG FAR*  pchEaten,
  169.                     BOOL        fValidateSource);
  170.   HRESULT _IFUNC GetLinkSource (DWORD dwLink,
  171.                     TCHAR    FAR* FAR*  lplpszDisplayName,
  172.                     ULONG    FAR*       lplenFileName,
  173.                     TCHAR    FAR* FAR*  lplpszFullLinkType,
  174.                     TCHAR    FAR* FAR*  lplpszShortLinkType, 
  175.                     BOOL     FAR*       lpfSourceAvailable, 
  176.                     BOOL     FAR*       lpfIsSelected);
  177.   HRESULT _IFUNC OpenLinkSource (DWORD dwLink);
  178.   HRESULT _IFUNC UpdateLink(DWORD dwLink, BOOL fErrorMessage,BOOL fErrorAction);
  179.   HRESULT _IFUNC CancelLink (DWORD dwLink);
  180.  
  181.   // IOleInPlaceFrame methods
  182.   //
  183.   HRESULT _IFUNC InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidts);
  184.   HRESULT _IFUNC SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  185.   HRESULT _IFUNC RemoveMenus(HMENU hmenuShared);
  186.   HRESULT _IFUNC SetStatusText(LPCOLESTR lpszStatusText);    
  187.   HRESULT _IFUNC EnableModeless(BOOL fEnable);
  188.   HRESULT _IFUNC TranslateAccelerator(LPMSG lpmsg, WORD wID);
  189. };
  190.  
  191. #endif _BOLEDOC_H
  192.  
  193.