// Line.h : Declaration of the CLine
#ifndef __LINE_H_
#define __LINE_H_
#include "resource.h" // main symbols
#define _ATL_DEBUG_QI
#define _ATL_DEBUG_REFCOUNT
#include <atlcom.h>
#include <atlctl.h>
#include <olectl.h>
#include "IPersistStream.h"
/////////////////////////////////////////////////////////////////////////////
// CLine
class /* ATL_NO_VTABLE */ CLine :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CLine, &CLSID_Line>,
public IMyPersistStreamImpl<CLine>,
public ISupportErrorInfo,
public IDispatchImpl<ILine, &IID_ILine, &LIBID_GRAPHOBJLib>
{
private:
typedef struct {
long x1, y1;
long x2, y2;
} LINEDATA;
LINEDATA m_Line;
public:
CLine()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_LINE)
DECLARE_NOT_AGGREGATABLE(CLine)
BEGIN_COM_MAP(CLine)
COM_INTERFACE_ENTRY(ILine)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IPersistStream, IMyPersistStream)
// COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
END_COM_MAP()
// IMyPersistStream
BOOLm_bRequiresSave;
STDMETHOD(IMyPersistStreamImpl_Load)(LPSTREAM pStm);
STDMETHOD(IMyPersistStreamImpl_Save)(LPSTREAM pStm, BOOL fClearDirty);
STDMETHOD(IMyPersistStreamImpl_GetSizeMax)(ULARGE_INTEGER FAR* pcbSize);
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// ILine
public:
STDMETHOD(get_y2)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_y2)(/*[in]*/ long newVal);
STDMETHOD(get_x2)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_x2)(/*[in]*/ long newVal);
STDMETHOD(get_y1)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_y1)(/*[in]*/ long newVal);
STDMETHOD(get_x1)(/*[out, retval]*/ long *pVal);
STDMETHOD(put_x1)(/*[in]*/ long newVal);
};
#endif //__LINE_H_