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

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