/////////////////////////////////////////////////////////////////////////////
//
// EventsList -  
// CBaseEvent -       
// 
////////////////////////////////////////////////////////////////////////////
#ifndef _CBaseEvent_H
#define _CBaseEvent_H


/////////////////////////////////////////////////////////////////////////////
//
//       
//
/////////////////////////////////////////////////////////////////////////////
class CBaseEvent : public CCmdTarget
{
protected:
  static CObList&           m_EventList;  //   
  DWORD                     m_dwCookie;   //  
  NotifyConnectionParam     m_params;     //  
	reference                 refDoc;       //       
	
public:
	          CBaseEvent( int       ifType     = 0, 
                        reference p          = 0, 
                        long      objType    = 0, 
                        reference doc        = 0 );
	          
            CBaseEvent( int       ifType, 
                        LPUNKNOWN iContainer = NULL,
                        long      objType    = 0, 
                        LPUNKNOWN iObj       = NULL, 
                        reference doc        = 0 );
  virtual  ~CBaseEvent();

            bool Advise         ();                            //    
            void Unadvise       ();                            //    
            void Disconnect     ();                            //      

  static    void TerminateEvents( void );                      //   
  static    void DestroyList    ();                            //        
            int  GetType        () { return m_params.ifType; } //  

  static    void         TerminateEvents( long      eventType, 
                                          reference doc = 0, 
                                          int       objType = -1, 
                                          LPUNKNOWN iObj = NULL );  
  static    CBaseEvent * FindEvents     ( long      eventType, 
                                          reference doc = 0, 
                                          int       objType = -1, 
                                          LPUNKNOWN iObj = NULL );  
          
            long      GetDocReference() { return refDoc; }
  virtual   LPUNKNOWN GetUnknown     () = 0;

protected:
            void RemoveThis();                                 //       
  virtual   void Clear     ();                                 //     
};

//    
void AdviseDoc       ( long pDoc );
//      
void AdviseDocuments();

////////////////////////////////////////////////////////////////////////////////
#endif 
