//+-----------------------------------------------------------------------
//
// Simple Tabular Data Object
// Copyright (C) Microsoft Corporation, 1996, 1997
//
// File: SimpData.h
//
// Contents: Declaration of the CSimpleTabularData COM object.
//
//------------------------------------------------------------------------
#include "resource.h" // main symbols
#include "std.h"
//------------------------------------------------------------------------
//
// Class: CSimpleTabularData
//
// Synopsis: This is the STD interface presented to the outside world.
// The calls are passed directly to the attached TDCArr object.
// This allows the CSimpleTabularData interfaces to expire
// independently of the CTDC control.
//
//------------------------------------------------------------------------
class CSimpleTabularData : public OLEDBSimpleProvider
{
public:
CSimpleTabularData();
~CSimpleTabularData();
// This method is used to initialise the object once after construction
void Create(CTDCArr *pTDCArr);
// This method is used to mark the interface as invalid
STDMETHOD(Invalidate)();
// IUnknown
STDMETHOD(QueryInterface) (REFIID, LPVOID FAR*);
STDMETHOD_(ULONG,AddRef) (THIS);
STDMETHOD_(ULONG,Release) (THIS);
// These methods and members implement the ISimpleTabularData interface
//
private:
CTDCArr *m_pTDCArr;
ULONG m_cRef; // interface reference count
public:
// The STD methods are passed directly to the attached TDCArr object
//
inline STDMETHOD(getRowCount)(LONG *pcRows);
inline STDMETHOD(getColumnCount)(LONG *pcColumns);
inline STDMETHOD(getRWStatus)(LONG iRow, LONG iCol, OSPRW *prwStatus);
inline STDMETHOD(getVariant)(LONG iRow, LONG iCol,
OSPFORMAT fmt, VARIANT *pVar);
inline STDMETHOD(setVariant)(LONG iRow, LONG iCol,
OSPFORMAT fmt, VARIANT Var);
inline STDMETHOD(getLocale)(BSTR *pbstrLocale);
inline STDMETHOD(deleteRows)(LONG iRow, LONG cRows, LONG *pcRowsDeleted);
inline STDMETHOD(insertRows)(LONG iRow, LONG cRows, LONG *pcRowsInserted);
// ;begin_internal
inline STDMETHOD(DeleteColumns)(LONG iColumn, LONG cCols,
LONG *pcColsDeleted);
inline STDMETHOD(InsertColumns)(LONG iColumn, LONG cCols,
LONG *pcColsInserted);
// ;end_internal
inline STDMETHOD(find)(LONG iRowStart, LONG iColumn, VARIANT val,
OSPFIND findFlags, OSPCOMP compType, LONG *piRowFound);
inline STDMETHOD(addOLEDBSimpleProviderListener)(OLEDBSimpleProviderListener *pospIListener);
inline STDMETHOD(removeOLEDBSimpleProviderListener)(OLEDBSimpleProviderListener *pospIListener);
inline STDMETHOD(getEstimatedRows)(LONG *pcRows);
inline STDMETHOD(isAsync)(BOOL *pbAsync);
inline STDMETHOD(stopTransfer)();
};
inline STDMETHODIMP
CSimpleTabularData::getRowCount(LONG *pcRows)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->getRowCount(pcRows);
}
inline STDMETHODIMP
CSimpleTabularData::getColumnCount(LONG *pcColumns)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->getColumnCount(pcColumns);
}
inline STDMETHODIMP
CSimpleTabularData::getRWStatus(LONG iRow, LONG iColumn, OSPRW *prwStatus)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->getRWStatus(iRow, iColumn, prwStatus);
}
inline STDMETHODIMP
CSimpleTabularData::getVariant(LONG iRow, LONG iColumn, OSPFORMAT format, VARIANT *pVar)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->getVariant(iRow, iColumn, format, pVar);
}
inline STDMETHODIMP
CSimpleTabularData::setVariant(LONG iRow, LONG iColumn, OSPFORMAT format, VARIANT Var)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->setVariant(iRow, iColumn, format, Var);
}
inline STDMETHODIMP
CSimpleTabularData::getLocale(BSTR *pbstrLocale)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->getLocale(pbstrLocale);
}
inline STDMETHODIMP
CSimpleTabularData::deleteRows(LONG iRow, LONG cRows, LONG *pcRowsDeleted)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->deleteRows(iRow, cRows, pcRowsDeleted);
}
inline STDMETHODIMP
CSimpleTabularData::insertRows(LONG iRow, LONG cRows, LONG *pcRowsInserted)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->insertRows(iRow, cRows, pcRowsInserted);
}
// ;begin_internal
inline STDMETHODIMP
CSimpleTabularData::DeleteColumns(LONG iColumn, LONG cColumns, LONG *pcColumnsDeleted)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->DeleteColumns(iColumn, cColumns, pcColumnsDeleted);
}
inline STDMETHODIMP
CSimpleTabularData::InsertColumns(LONG iColumn, LONG cColumns, LONG *pcColumnsInserted)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->InsertColumns(iColumn, cColumns, pcColumnsInserted);
}
// ;end_internal
inline STDMETHODIMP
CSimpleTabularData::find(LONG iRowStart, LONG iColumn, VARIANT val,
OSPFIND findFlags, OSPCOMP compType, LONG *piRowFound)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->find(iRowStart, iColumn, val,
findFlags, compType, piRowFound);
}
inline STDMETHODIMP
CSimpleTabularData::addOLEDBSimpleProviderListener(OLEDBSimpleProviderListener *pospIListener)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->addOLEDBSimpleProviderListener(pospIListener);
}
inline STDMETHODIMP
CSimpleTabularData::removeOLEDBSimpleProviderListener(OLEDBSimpleProviderListener *pospIListener)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->removeOLEDBSimpleProviderListener(pospIListener);
}
inline STDMETHODIMP
CSimpleTabularData::getEstimatedRows(LONG *pcRows)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->getEstimatedRows(pcRows);
}
inline STDMETHODIMP
CSimpleTabularData::isAsync(BOOL *pbAsync)
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->isAsync(pbAsync);
}
inline STDMETHODIMP
CSimpleTabularData::stopTransfer()
{
return m_pTDCArr == NULL ? E_UNEXPECTED :
m_pTDCArr->stopTransfer();
}
typedef CSimpleTabularData *LPSTD;