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

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