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

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.2  $
  6. //
  7. //     Implements the Bolero half of the OLE2 in-process server object.
  8. //    BOleInProcSite  overrides some of the default handler implementation
  9. //    for IViewObject and IBSite implementation on the BOleInProcServer
  10. //    taking advantage of the fact that we're in a DLL.
  11. //----------------------------------------------------------------------------
  12. #ifndef _BOLEIPS_H
  13. #define _BOLEIPS_H 
  14.  
  15. #include <BOleSite.h>
  16.  
  17. class _ICLASS BOleService;
  18.  
  19. //
  20. //  class BOleInProcServer
  21. //  ----- --------------
  22. //
  23.  
  24. class _ICLASS BOleInProcServer : public BOleSite,
  25.                                public IViewObject2,
  26.                                public IExternalConnection,
  27.                                public IRunnableObject
  28. {
  29. protected:
  30.     BOleService *pService;
  31.     IUnknown *pDefHandler;
  32.  
  33.     IAdviseSink * pAdviseView;
  34.     DWORD dwAdviseAspects;
  35.     DWORD dwAdviseFlags;
  36.     DWORD exCon;
  37.     BOOL fRunningMode;
  38. public:
  39.  
  40.     BOleInProcServer(BOleClassManager *pFact, IBUnknownMain *pOuter, BOleService*);
  41.     ~BOleInProcServer();
  42.  
  43.     // IUnknown methods
  44.     //
  45.     DEFINE_IUNKNOWN(pObjOuter);
  46.  
  47.     virtual HRESULT _IFUNC QueryInterfaceMain(REFIID iid, LPVOID FAR* pif);
  48.  
  49.     // IViewObject methods
  50.     //
  51.     virtual HRESULT _IFUNC Draw(DWORD dwDrawAspect, LONG lindex,
  52.         void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  53.         HDC hicTargetDev,
  54.         HDC hdcDraw, 
  55.         LPCRECTL lprcBounds, 
  56.         LPCRECTL lprcWBounds,
  57.         BOOL(CALLBACK * pfnContinue)(DWORD), 
  58.         DWORD dwContinue);
  59.  
  60.     virtual HRESULT _IFUNC GetColorSet(DWORD dwDrawAspect, LONG lindex,
  61.         void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  62.         HDC hicTargetDev,
  63.         LPLOGPALETTE FAR* ppColorSet);
  64.  
  65.     virtual HRESULT _IFUNC Freeze(DWORD dwDrawAspect, LONG lindex, 
  66.         void FAR* pvAspect,
  67.         DWORD FAR* pdwFreeze);
  68.     virtual HRESULT _IFUNC Unfreeze(DWORD dwFreeze);
  69.     virtual HRESULT _IFUNC SetAdvise(DWORD aspects, DWORD advf, 
  70.         LPADVISESINK pAdvSink);
  71.     virtual HRESULT _IFUNC GetAdvise(DWORD FAR* pAspects, DWORD FAR* pAdvf,
  72.         LPADVISESINK FAR* ppAdvSink);
  73.  
  74.     virtual HRESULT _IFUNC GetExtent(DWORD dwDrawAspect,
  75.         LONG lindex, DVTARGETDEVICE FAR*ptd, LPSIZEL lpsizel);
  76.  
  77.     // BOleSite overrides
  78.     //
  79.     virtual HRESULT _IFUNC GetExtent(DWORD dwDrawAspect, LPSIZEL lpsizel);
  80.     virtual HRESULT _IFUNC TranslateAccelerator (LPMSG lpmsg);   
  81.     virtual HRESULT _IFUNC EnumVerbs(IEnumOLEVERB* FAR* ppenumOleVerb);
  82.     virtual HRESULT _IFUNC GetUserType(DWORD dwFormOfType, LPOLESTR FAR* pszUserType);
  83.     virtual HRESULT _IFUNC GetMiscStatus(DWORD dwAspect, DWORD FAR* pdwStatus);
  84.     virtual HRESULT _IFUNC SetExtent (DWORD dwDrawAspect, LPSIZEL lpsizel);
  85.     virtual HRESULT _IFUNC Close(DWORD dwSaveOption);
  86.     
  87.     // ISite methods
  88.     //
  89.     virtual void    _IFUNC Invalidate(BOleInvalidate);
  90.     virtual HRESULT _IFUNC Init(PIBDataProvider pP, PIBPart pPart,
  91.         LPCOLESTR psz, BOOL fHatchWnd);
  92.  
  93.     // IExternalConnection
  94.     //
  95.     virtual DWORD _IFUNC AddConnection(DWORD, DWORD);
  96.     virtual DWORD _IFUNC ReleaseConnection(DWORD, DWORD, BOOL);
  97.  
  98.     // IRunnableObject
  99.     //
  100.     virtual HRESULT _IFUNC GetRunningClass(LPCLSID lpClsid);
  101.     virtual HRESULT _IFUNC Run(LPBINDCTX pbc);
  102.     virtual BOOL _IFUNC IsRunning();
  103.     virtual HRESULT _IFUNC LockRunning(BOOL fLock, BOOL fLastCloses);
  104.     virtual HRESULT _IFUNC SetContainedObject(BOOL fContained);
  105.  
  106.     // IPersistStorage overrides
  107.     virtual HRESULT _IFUNC InitNew(IStorage* pStg);
  108.     virtual HRESULT _IFUNC Load(IStorage* pStg);
  109.     virtual HRESULT _IFUNC Save(IStorage* pStgSave,BOOL fSameAsLoad);
  110.     virtual HRESULT _IFUNC SaveCompleted(IStorage* pStgSaved);
  111.     virtual HRESULT _IFUNC HandsOffStorage(); 
  112. };
  113.     
  114. class _ICLASS BOleInProcHandler : public BOleComponent,
  115.                                public IViewObject2,
  116.                                public IOleInPlaceActiveObject,
  117.                                public IBSite
  118. {
  119. protected:
  120.     BOleService *pService;
  121.     IUnknown *pDefHandler;
  122.     IBSite *pDefSite;
  123.     IOleInPlaceActiveObject *pDefIPAO;
  124.     PIBPart pPart;
  125.     PIBDataProvider pProvider;
  126.  
  127.     IAdviseSink * pAdviseView;
  128.     DWORD dwAdviseAspects;
  129.     DWORD dwAdviseFlags;
  130.  
  131. public:
  132.  
  133.     BOleInProcHandler(BOleClassManager *pFact, IBUnknownMain *pOuter, BOleService*);
  134.     ~BOleInProcHandler();
  135.  
  136.     // IUnknown methods
  137.     //
  138.     DEFINE_IUNKNOWN(pObjOuter);
  139.  
  140.     virtual HRESULT _IFUNC QueryInterfaceMain(REFIID iid, LPVOID FAR* pif);
  141.  
  142.     // IViewObject methods
  143.     //
  144.     virtual HRESULT _IFUNC Draw(DWORD dwDrawAspect, LONG lindex,
  145.         void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  146.         HDC hicTargetDev,
  147.         HDC hdcDraw, 
  148.         LPCRECTL lprcBounds, 
  149.         LPCRECTL lprcWBounds,
  150.         BOOL(CALLBACK * pfnContinue)(DWORD), 
  151.         DWORD dwContinue);
  152.  
  153.     virtual HRESULT _IFUNC GetColorSet(DWORD dwDrawAspect, LONG lindex,
  154.         void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  155.         HDC hicTargetDev,
  156.         LPLOGPALETTE FAR* ppColorSet);
  157.  
  158.     virtual HRESULT _IFUNC Freeze(DWORD dwDrawAspect, LONG lindex, 
  159.         void FAR* pvAspect,
  160.         DWORD FAR* pdwFreeze);
  161.     virtual HRESULT _IFUNC Unfreeze(DWORD dwFreeze);
  162.     virtual HRESULT _IFUNC SetAdvise(DWORD aspects, DWORD advf, 
  163.         LPADVISESINK pAdvSink);
  164.     virtual HRESULT _IFUNC GetAdvise(DWORD FAR* pAspects, DWORD FAR* pAdvf,
  165.         LPADVISESINK FAR* ppAdvSink);
  166.  
  167.     virtual HRESULT _IFUNC GetExtent(DWORD dwDrawAspect,
  168.         LONG lindex, DVTARGETDEVICE FAR*ptd, LPSIZEL lpsizel);
  169.  
  170.     // IOleInPlaceActiveObject methods 
  171.     //
  172.     virtual HRESULT _IFUNC GetWindow(HWND FAR *phwnd);
  173.     virtual HRESULT _IFUNC ContextSensitiveHelp(BOOL fEnterMode);
  174.     virtual HRESULT _IFUNC TranslateAccelerator (LPMSG lpmsg);   
  175.     virtual HRESULT _IFUNC OnFrameWindowActivate (BOOL fActivate);           
  176.     virtual HRESULT _IFUNC OnDocWindowActivate (BOOL fActivate);
  177.     virtual HRESULT _IFUNC ResizeBorder (LPCRECT lprectBorder,
  178.         LPOLEINPLACEUIWINDOW lpUIWindow, BOOL fFrameWindow);          
  179.     virtual HRESULT _IFUNC EnableModeless (BOOL fEnable);
  180.     
  181.     // ISite methods
  182.     //
  183.     virtual HRESULT _IFUNC SiteShow(BOOL);
  184.     virtual HRESULT _IFUNC DiscardUndo();
  185.     virtual HRESULT _IFUNC GetSiteRect(LPRECT,LPRECT);
  186.     virtual HRESULT _IFUNC SetSiteRect(LPCRECT);
  187.     virtual HRESULT _IFUNC SetSiteExtent(LPCSIZE);
  188.     virtual void    _IFUNC Invalidate(BOleInvalidate);
  189.     virtual void    _IFUNC OnSetFocus(BOOL);
  190.     virtual HRESULT _IFUNC Init(PIBDataProvider pP, PIBPart pPart,
  191.         LPCOLESTR psz, BOOL fHatchWnd);
  192.     virtual void _IFUNC Disconnect ();
  193.     virtual HRESULT _IFUNC GetZoom( BOleScaleFactor *pScale);
  194.  
  195.     // implementation methods
  196.     //
  197.     IOleInPlaceActiveObject * DefaultIPAO();
  198. };
  199.  
  200. #endif
  201.