home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / BOCOLE.PAK / BOLEDOC.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  6KB  |  184 lines

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