|
// FormPropertiesAccessor.cpp : Implementation of CFormPropertiesAccessor
//
// Author : David Shepherd
// Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "DDForms.h"
#include "FormPropertiesAccessor.h"
// begin standard property get implementation block
#define PROPGET_BEGIN(dispid) \
if(m_spFormEditor==NULL) \
{ \
throw CHResult(E_FAIL); \
}
// end standard property get implementation block
#define PROPGET_END(dispid)
// begin standard property put implementation block
#define PROPPUT_BEGIN(dispid) \
if(m_spFormEditor==NULL) \
{ \
throw CHResult(E_FAIL); \
}
// end standard property put implementation block
#define PROPPUT_END(dispid) \
(void)FireOnChanged(GetUnknown(),dispid);
/////////////////////////////////////////////////////////////////////////////
// CFormPropertiesAccessor
STDMETHODIMP CFormPropertiesAccessor::put_FormEditor(IFormEditor *pFormEditor)
{
IMP_BEGIN
// set the form editor
m_spFormEditor=pFormEditor;
IMP_END
return RetVal;
}
STDMETHODIMP CFormPropertiesAccessor::get_BackColor(OLE_COLOR *pVal)
{
IMP_BEGIN
PROPGET_BEGIN(DISPID_BACKCOLOR)
// check parameters
if(pVal==NULL)
{
throw CHResult(E_POINTER);
}
// get the background color
if(!SUCCEEDED(m_spFormEditor->get_FormBackColor(pVal)))
{
throw CHResult(E_FAIL);
}
PROPGET_END(DISPID_BACKCOLOR)
IMP_END
return RetVal;
}
STDMETHODIMP CFormPropertiesAccessor::put_BackColor(OLE_COLOR newVal)
{
IMP_BEGIN
PROPPUT_BEGIN(DISPID_BACKCOLOR)
// set the background color
if(!SUCCEEDED(m_spFormEditor->put_FormBackColor(newVal)))
{
throw CHResult(E_FAIL);
}
PROPPUT_END(DISPID_BACKCOLOR)
IMP_END
return RetVal;
}
STDMETHODIMP CFormPropertiesAccessor::get_ForeColor(OLE_COLOR *pVal)
{
IMP_BEGIN
PROPGET_BEGIN(DISPID_FORECOLOR)
// check parameters
if(pVal==NULL)
{
throw CHResult(E_POINTER);
}
// get the foreground color
if(!SUCCEEDED(m_spFormEditor->get_FormForeColor(pVal)))
{
throw CHResult(E_FAIL);
}
PROPGET_END(DISPID_FORECOLOR)
IMP_END
return RetVal;
}
STDMETHODIMP CFormPropertiesAccessor::put_ForeColor(OLE_COLOR newVal)
{
IMP_BEGIN
PROPPUT_BEGIN(DISPID_FORECOLOR)
// set the foreground color
if(!SUCCEEDED(m_spFormEditor->put_FormForeColor(newVal)))
{
throw CHResult(E_FAIL);
}
PROPPUT_END(DISPID_FORECOLOR)
IMP_END
return RetVal;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.