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

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1991, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.9  $
  6. //
  7. //  Declares the application-level object for "global" stuff. You should have 
  8. //  one service object per Bolero connection.
  9. //----------------------------------------------------------------------------
  10. #ifndef _BOLESVC_H
  11. #define _BOLESVC_H 
  12.  
  13. #include <stdlib.h>
  14. #include "BOleComp.h"
  15. #include "BOleSite.h"
  16.  
  17. extern "C" {
  18. #include "ole2ui.h" // for OLEUIPASTEENTRY - also includes oledlg.h
  19. }
  20.  
  21. class _ICLASS BOleDocument;
  22. class _ICLASS BOleFact;
  23.  
  24. struct BOleFactNode;
  25.  
  26. class _ICLASS BOleService : public BOleComponent,
  27.                             public IBService2,
  28.                             public IOleInPlaceFrame
  29. {
  30.  
  31. protected:
  32.  
  33.   IBApplication  *pApp;
  34.   POINTL          dragLastPt;
  35.   BOleHelp        helpMode;
  36.   BOleFactNode   *pFirstFactNode;
  37.  
  38.   TCHAR           dynamicScopePath[_MAX_PATH];
  39.   CLSID           dynamicScopeClsid;
  40.   IDataObject    *pClipboardData;
  41.   PIBWindow       pSubclassedWindow;
  42.  
  43.   HWND            helpWnd;
  44. public:
  45.   WNDPROC         lpfnHelpWndProc;
  46.  
  47. public:
  48.  
  49.   // BOleService methods
  50.   //
  51.   BOleDocument   *pActiveDoc;
  52.   BOleSite       *pFocusedSite;
  53.  
  54.   virtual  void _IFUNC SetActiveDoc (BOleDocument FAR *pD);
  55.   virtual  BOleDocument FAR* _IFUNC GetActiveDoc ();
  56.   void     _IFUNC SetHelpMode (BOOL);
  57.   IBApplication *GetApplication () {return pApp;}
  58.   virtual void SetFocusedSite( BOleSite *pSite ){ pFocusedSite = pSite; }
  59.  
  60.   static POINT    pixPerIn;
  61.  
  62.   // Factory accessors
  63.  
  64.   HRESULT AddClassFactory(IBClass *pF);
  65.   HRESULT RemoveClassFactory(REFCLSID cid);
  66.   HRESULT RemoveClassFactory(LPCOLESTR szProgId);
  67.   HRESULT FindClassFactory(REFCLSID cid, IBClass **pF);
  68.   HRESULT FindClassFactory(LPCOLESTR szProgId, IBClass **pF);
  69.  
  70.   // For clip format negotiation in drag/drop and cut/copy
  71.   //
  72.   LPFORMATETC  clipList;
  73.   UINT         clipCount;
  74.   BOOL         clipOkToLink;
  75.   BOOL         clipOkToEmbed;
  76.  
  77.   LPFORMATETC  dropList;
  78.   UINT         dropCount;
  79.   BOOL         dropOkToLink;
  80.   BOOL         dropOkToEmbed;
  81.  
  82.   BOOL         fUseDropList;
  83.  
  84. public:
  85.  
  86.   BOleService (BOleClassManager *pF, IBUnknownMain * pOuter);
  87.   ~BOleService ();
  88.   HGLOBAL _IFUNC GetDataFromDataObject (LPDATAOBJECT, CLIPFORMAT, 
  89.                      DVTARGETDEVICE FAR*, DWORD, LPSTGMEDIUM);
  90.   void  EnterBOleDialog (HWND , HHOOK *, HTASK *);
  91.   void  ExitBOleDialog ();
  92.   virtual UINT _IFUNC ExcludeOurselves (LPCLSID FAR*);
  93.   void FlushClipboardData(BOOL bCheck = TRUE);
  94.   BOOL IsOnClipboard(IDataObject *);
  95.   BOOL _IFUNC ShowHelpButton (BOleDialogHelp);
  96.  
  97. public:
  98.  
  99.   DEFINE_IUNKNOWN(pObjOuter)
  100.  
  101.   // IUnknownMain methods
  102.   //
  103.   virtual HRESULT _IFUNC QueryInterfaceMain(REFIID iid, LPVOID FAR* pif);
  104.  
  105.   // IService methods
  106.   //
  107.   virtual HRESULT _IFUNC Init(PIBApplication pApp );
  108.   virtual HRESULT _IFUNC RegisterClass (LPCOLESTR szProgId, IBClassMgr *pCM, BCID regId, BOOL, BOOL);
  109.   virtual HRESULT _IFUNC UnregisterClass (LPCOLESTR);
  110.   virtual HRESULT _IFUNC RegisterControlClass (LPCOLESTR szProgId, IBClassMgr *pCM, BCID regId, BOOL, BOOL);
  111.   virtual HRESULT _IFUNC UnregisterControlClass (LPCOLESTR);
  112.   virtual void    _IFUNC OnResize ();
  113.   virtual void    _IFUNC OnActivate (BOOL fActivate);
  114.   virtual HRESULT _IFUNC OnModalDialog (BOOL);
  115.   virtual HRESULT _IFUNC OnSetFocus(BOOL);
  116.   virtual HRESULT _IFUNC TranslateAccel (LPMSG);
  117.   virtual BOleHelp _IFUNC HelpMode (BOleHelp);
  118.   virtual HRESULT _IFUNC CanClose();
  119.  
  120.   virtual HRESULT _IFUNC Browse (BOleInitInfo*);
  121.   virtual HRESULT _IFUNC BrowseControls (BOleInitInfo*);
  122.   virtual HRESULT _IFUNC BrowseClipboard (BOleInitInfo FAR*);
  123.   virtual HRESULT _IFUNC Paste (BOleInitInfo FAR*);
  124.   virtual HRESULT _IFUNC Clip (PIBDataProvider, BOOL, BOOL, BOOL);
  125.   virtual HRESULT _IFUNC Drag (PIBDataProvider, BOleDropAction, BOleDropAction FAR*);
  126.  
  127.   virtual HMETAFILE _IFUNC GetPasteIcon (LPDATAOBJECT);
  128.  
  129.   virtual BOOL _IFUNC PasteHelper (BOleInitInfo FAR*, BOOL);
  130.   virtual BOOL _IFUNC FormatHelper (LPFORMATETC FAR*, UINT FAR*, BOOL&,
  131.                                                                               BOOL&, PIBDataProvider);
  132.   void _IFUNC RemoveLinkFromClipList();
  133.   void NotifyClipboardEmptied();
  134.  
  135.   virtual LPSTORAGE _IFUNC CreateStorageOnFile (LPCOLESTR, BOOL);
  136.   virtual HRESULT   _IFUNC ConvertUI (PIBPart, BOOL, BOleConvertInfo FAR*);
  137.   virtual HRESULT   _IFUNC ConvertGuts (PIBPart, BOOL, BOleConvertInfo FAR*);
  138.   virtual BOleMenuEnable _IFUNC EnableEditMenu (BOleMenuEnable, PIBDataConsumer);
  139.  
  140.   // Implementation methods
  141.   //
  142.   virtual CLIPFORMAT _IFUNC MatchPriorityClipFormat(LPDATAOBJECT,
  143.     LPOLEUIPASTEENTRY, int);
  144.   virtual void _IFUNC MarkPasteEntries(LPDATAOBJECT,LPOLEUIPASTEENTRY,int);
  145.   virtual void _IFUNC UnloadObjects (REFCLSID);
  146.  
  147. public:
  148.  
  149.   // IOleWindow methods, base of IOleInPlaceUIWindow and IOleInPlaceFrame
  150.   //
  151.   HRESULT _IFUNC GetWindow(HWND FAR* lphwnd);
  152.   HRESULT _IFUNC ContextSensitiveHelp(BOOL fEnterMode);
  153.  
  154.   // IOleInPlaceUIWindow methods, base of IOleInPlaceFrame
  155.   //
  156.   HRESULT _IFUNC GetBorder(LPRECT lprectBorder);
  157.   HRESULT _IFUNC RequestBorderSpace(LPCRECT lprectWidths);
  158.   HRESULT _IFUNC SetBorderSpace(LPCBORDERWIDTHS lpborderwidths);
  159.   HRESULT _IFUNC SetActiveObject(IOleInPlaceActiveObject* lpActiveObject,
  160.            LPCOLESTR lpszObjName);
  161.  
  162.   // IOleInPlaceFrame methods
  163.   //
  164.   HRESULT _IFUNC InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidts);
  165.   HRESULT _IFUNC SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  166.   HRESULT _IFUNC RemoveMenus(HMENU hmenuShared);
  167.   HRESULT _IFUNC SetStatusText(LPCOLESTR lpszStatusText);
  168.   HRESULT _IFUNC EnableModeless(BOOL fEnable);
  169.   HRESULT _IFUNC TranslateAccelerator(LPMSG lpmsg, WORD wID);
  170.  
  171. };
  172.  
  173. // solves a casting in a ternary issue
  174. //
  175. inline IBWindow * getNegotiator(IBApplication *pApp, IBWindow *pContainer)
  176. {
  177.   return (GetScode(pApp->IsMDI()) == S_OK) ?      pApp : pContainer;
  178. }
  179.  
  180. #endif
  181.