////////////////////////////////////////////////////////////////////////////////
//
// SelectMngEvent  -      
//
////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "eventsAuto.h"

#ifndef _SELECTMNGEVENT_H
#include "SelectMngEvent.h"
#endif

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

////////////////////////////////////////////////////////////////////////////////
//
// SelectMngEvent  -      
//
////////////////////////////////////////////////////////////////////////////////

//-------------------------------------------------------------------------------
//
// ---
SelectMngEvent::SelectMngEvent( LPUNKNOWN pObject, LPDISPATCH doc, bool selfAdvise /*true*/ )
: BaseEvent( pObject, DIID_ksSelectionMngNotify, doc, -1, NULL, selfAdvise )
{
}


//-------------------------------------------------------------------------------
//
// ---
SelectMngEvent::~SelectMngEvent()
{
}


//-------------------------------------------------------------------------------
//
// ---
BEGIN_EVENTSINK_MAP(SelectMngEvent, BaseEvent)
	ON_EVENT (SelectMngEvent, (unsigned int)-1, ksmSelect,      Select,      VTS_VARIANT)
	ON_EVENT (SelectMngEvent, (unsigned int)-1, ksmUnselect,    Unselect,    VTS_VARIANT)
	ON_EVENT (SelectMngEvent, (unsigned int)-1, ksmUnselectAll, UnselectAll, VTS_NONE)
END_EVENTSINK_MAP()


//-------------------------------------------------------------------------------
// ksmSelect      -  
// ---
VARIANT_BOOL SelectMngEvent::Select( LPVARIANT obj ) 
{ 
  if ( IsSelfAdvise() && theApp.m_mes_SELECT )
  {
    CString str;
    str.Format( "%s --> SelectMngEvent::Select\nobj = %i", m_libName, obj );
    str += "\n  = " + GetDocName();
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}


//-------------------------------------------------------------------------------
// ksmUnselect    -  
// ---
VARIANT_BOOL SelectMngEvent::Unselect( LPVARIANT obj )
{
  if ( IsSelfAdvise() && theApp.m_mes_SELECT )
  {
    CString str;
    str.Format( "%s --> SelectMngEvent::Unselect\nobj = %i", m_libName, obj );
    str += "\n  = " + GetDocName();
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}


//-------------------------------------------------------------------------------
// ksmUnselectAll -   
// ---
VARIANT_BOOL SelectMngEvent::UnselectAll() 
{
  if ( IsSelfAdvise() && theApp.m_mes_SELECT )
  {
    CString str( m_libName + " --> SelectMngEvent::UnselectAll" );
    str += "\n  = " + GetDocName();
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}