home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / source / chap18 / doserver / binditem.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-02  |  2.0 KB  |  86 lines

  1. // binditem.cpp : implementation of the DocObject OLE
  2. //    server item class
  3. //
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1992-1995 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and related
  10. // electronic documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. //BINDER
  15. //  The DocObjectServerItem class implements interfaces that help
  16. // the application  control its activation state.
  17. //BINDER_END
  18.  
  19. #include "stdafx.h"
  20. #include "binditem.h"
  21.  
  22. #ifdef _DEBUG
  23. #undef THIS_FILE
  24. static char BASED_CODE THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CDocObjectServerItem implementation
  29.  
  30. IMPLEMENT_DYNAMIC(CDocObjectServerItem, COleServerItem)
  31.  
  32. CDocObjectServerItem::CDocObjectServerItem(COleServerDoc* pServerDoc, BOOL bAutoDelete)
  33.     : COleServerItem(pServerDoc, bAutoDelete)
  34. {
  35. }
  36.  
  37. CDocObjectServerItem::~CDocObjectServerItem()
  38. {
  39. }
  40.  
  41. void CDocObjectServerItem::OnHide()
  42. {
  43.    CDocObjectServerDoc* pDoc = GetDocument();
  44.    ASSERT_VALID(pDoc);
  45.  
  46.    if (pDoc->IsDocObject())
  47.       AfxThrowOleException(OLEOBJ_E_INVALIDVERB);
  48.    else
  49.       COleServerItem::OnHide();
  50. }
  51.  
  52. void CDocObjectServerItem::OnOpen()
  53. {
  54.    CDocObjectServerDoc* pDoc = GetDocument();
  55.    ASSERT_VALID(pDoc);
  56.  
  57.    if (pDoc->IsDocObject())
  58.       pDoc->ActivateDocObject();
  59.    else
  60.       COleServerItem::OnOpen();
  61. }
  62.  
  63. void CDocObjectServerItem::OnShow()
  64. {
  65.    CDocObjectServerDoc* pDoc = GetDocument();
  66.    ASSERT_VALID(pDoc);
  67.  
  68.    if (pDoc->IsDocObject())
  69.       pDoc->ActivateDocObject();
  70.    else
  71.       COleServerItem::OnShow();
  72. }
  73.  
  74. #ifdef _DEBUG
  75. void CDocObjectServerItem::AssertValid() const
  76. {
  77.     COleServerItem::AssertValid();
  78. }
  79.  
  80. void CDocObjectServerItem::Dump(CDumpContext& dc) const
  81. {
  82.     COleServerItem::Dump(dc);
  83. }
  84. #endif
  85.  
  86.