home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / Java++ / SHAREDIDE / BIN / MFCCLWZ.DLL / SRCDATA / SVRITEM.CPP < prev    next >
Encoding:
Text File  |  1997-01-27  |  3.3 KB  |  138 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // %1
  3.  
  4. IMPLEMENT_DYNCREATE(%1, %2)
  5.  
  6. %1::%1(COleServerDoc* pServerDoc, BOOL bAutoDelete)
  7.         : COleServerItem( pServerDoc, bAutoDelete)
  8. {
  9. $$IF(OLEAUTO)
  10.     EnableAutomation();
  11. $$ENDIF
  12. $$IF(OLECREATE)
  13.     
  14.     // To keep the application running as long as an OLE automation 
  15.     //    object is active, the constructor calls AfxOleLockApp.
  16.     
  17.     AfxOleLockApp();
  18. $$ENDIF
  19. }
  20.  
  21. %1::~%1()
  22. {
  23. $$IF(OLECREATE)
  24.     // To terminate the application when all objects created with
  25.     //     with OLE automation, the destructor calls AfxOleUnlockApp.
  26.     
  27.     AfxOleUnlockApp();
  28. $$ENDIF
  29. }
  30. $$IF(OLEAUTO)
  31.  
  32. void %1::OnFinalRelease()
  33. {
  34.     // When the last reference for an automation object is released
  35.     // OnFinalRelease is called.  The base class will automatically
  36.     // deletes the object.  Add additional cleanup required for your
  37.     // object before calling the base class.
  38.  
  39.     %2::OnFinalRelease();
  40. }
  41. $$ENDIF
  42. $$IF(OLESERVERDOC)
  43.  
  44. COleServerItem* %1::OnGetEmbeddedItem()
  45. {
  46.     // OnGetEmbeddedItem is called by the framework to get the COleServerItem
  47.     //  that is associated with the document.  It is only called when necessary.
  48.  
  49.     // Instead of returning NULL, return a pointer to a new COleServerItem
  50.     //  derived class that is used in conjunction with this document, then
  51.     //  remove the ASSERT(FALSE) below.
  52.     //  (i.e., return new CMyServerItem.)
  53.     ASSERT(FALSE);            // remove this after completing the TODO
  54.     return NULL;
  55. }
  56. $$ENDIF
  57.  
  58.  
  59. BOOL %1::OnDraw(CDC* pDC, CSize& rSize)
  60. {
  61.     // Called by the framework to render the OLE item into a metafile.
  62.     // The metafile representation of the OLE item is used to display the 
  63.     // item in the container application. If the container application was 
  64.     // written with the Microsoft Foundation Class Library, the metafile is 
  65.     // used by the Draw member function of the corresponding COleClientItem object.
  66.     // There is no default implementation. You must override this function to draw
  67.     // the item into the device context specified. 
  68.     ASSERT(FALSE);            // remove this after completing the TODO
  69.     return TRUE;
  70. }
  71.  
  72.  
  73.  
  74.  
  75. BEGIN_MESSAGE_MAP(%1, %2)
  76.     //{{AFX_MSG_MAP(%1)
  77.         // NOTE - the ClassWizard will add and remove mapping macros here.
  78.     //}}AFX_MSG_MAP
  79. END_MESSAGE_MAP()
  80. $$IF(OLEAUTO)
  81.  
  82. BEGIN_DISPATCH_MAP(%1, %2)
  83.     //{{AFX_DISPATCH_MAP(%1)
  84.         // NOTE - the ClassWizard will add and remove mapping macros here.
  85.     //}}AFX_DISPATCH_MAP
  86. END_DISPATCH_MAP()
  87.  
  88. // Note: we add support for IID_I%c to support typesafe binding
  89. //  from VBA.  This IID must match the GUID that is attached to the 
  90. //  dispinterface in the .ODL file.
  91.  
  92. // {%b}
  93. static const IID IID_I%c =
  94. %d;
  95.  
  96. BEGIN_INTERFACE_MAP(%1, %2)
  97.     INTERFACE_PART(%1, IID_I%c, Dispatch)
  98. END_INTERFACE_MAP()
  99. $$ENDIF //OLEAUTO
  100. $$IF(OLECREATE)
  101.  
  102. // {%e}
  103. IMPLEMENT_OLECREATE(%1, "%6", %7)
  104. $$ENDIF //OLECREATE
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // %1 diagnostics
  108.  
  109. #ifdef _DEBUG
  110. void %1::AssertValid() const
  111. {
  112.     %2::AssertValid();
  113. }
  114.  
  115. void %1::Dump(CDumpContext& dc) const
  116. {
  117.     %2::Dump(dc);
  118. }
  119. #endif //_DEBUG
  120.  
  121. /////////////////////////////////////////////////////////////////////////////
  122. // %1 serialization
  123.  
  124. void %1::Serialize(CArchive& ar)
  125. {
  126.     if (ar.IsStoring())
  127.     {
  128.         // TODO: add storing code here
  129.     }
  130.     else
  131.     {
  132.         // TODO: add loading code here
  133.     }
  134. }
  135.  
  136. /////////////////////////////////////////////////////////////////////////////
  137. // %1 commands