Required API functions and interface

With the supplied Visual C++ example "Print and Design Reports (SQL data source)" you will find an executable example for the implementation.

The pseudo code for designer call and print loop shows easily that the set of required API functions differs only slightly from the classic API programming. However, some parts are relocated into the data provider implementation.

In the general initialization part after LlJobOpen, the data provider instance must first be made known and, optionally, the delayed loading must be activated. At this point, you would also register the callbacks for preview and drilldown.

auto pDP = (ILLDataProvider*) new MyDataProviderObject;

::LlSetOption(hJob,LL_OPTION_ILLDATAPROVIDER,(LPARAM)pDP);

::LlSetOption(hJob, LL_OPTION_SUPPORT_DELAYEDFIELDDEFINITION, 1);

To create the data provider instance, you need at least one class that implements the ILLDataProvider interface. In addition, QueryInterface, AddRef and Release from IUnknown must also be implemented. List & Label distinguishes internally between root objects and nodes. This distinction can now be made either across several classes (see example below) or, for simplicity's sake, within one class.

Methods that are not implemented return E_NOTIMPL.

 

#define SMI STDMETHODIMP

class DPBase : public ILLDataProvider

{

 

// From ILLDataProvider

SMI OpenTable(LPCWSTR pszTableName, IUnknown** ppUnkOfNewDP) = 0;

SMI OpenChildTable(LPCWSTR pszRelation, IUnknown** ppUnkOfNewDP) = 0;

SMI GetRowCount(INT* pnRows) = 0;

SMI DefineDelayedInfo(enDefineDelayedInfo nInfo) = 0;

SMI MoveNext() = 0;

SMI DefineRow(enDefineRowMode, const VARIANT* arvRelations) = 0;

SMI Dispose() = 0;

SMI SetUsedIdentifiers(const VARIANT* arvFieldRestriction) = 0;

SMI ApplySortOrder(LPCWSTR pszSortOrder) = 0;

SMI ApplyFilter(const VARIANT* arvFields, const VARIANT* arvValues) = 0;

SMI ApplyAdvancedFilter(LPCWSTR pszFilter, const VARIANT* arvValues) = 0;

SMI SetOption(enOptionIndex nIndex, const VARIANT * vValue) = 0;

SMI GetOption(enOptionIndex nIndex, VARIANT * vValue) = 0;

 

};

class DPRoot : public DPBase{ … };

class DPNode : public DPBase{ … };