implement support for returning several elements at once from IEnumFORMATETC (part of patch 649438)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
875c17fa8f
commit
1f1c42109d
@ -187,31 +187,27 @@ wxIEnumFORMATETC::wxIEnumFORMATETC(const wxDataFormat *formats, ULONG nCount)
|
|||||||
|
|
||||||
STDMETHODIMP wxIEnumFORMATETC::Next(ULONG celt,
|
STDMETHODIMP wxIEnumFORMATETC::Next(ULONG celt,
|
||||||
FORMATETC *rgelt,
|
FORMATETC *rgelt,
|
||||||
ULONG *WXUNUSED(pceltFetched))
|
ULONG *pceltFetched)
|
||||||
{
|
{
|
||||||
wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumFORMATETC::Next"));
|
wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumFORMATETC::Next"));
|
||||||
|
|
||||||
if ( celt > 1 ) {
|
ULONG numFetched = 0;
|
||||||
// we only return 1 element at a time - mainly because I'm too lazy to
|
while (m_nCurrent < m_nCount && numFetched < celt) {
|
||||||
// implement something which you're never asked for anyhow
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_nCurrent < m_nCount ) {
|
|
||||||
FORMATETC format;
|
FORMATETC format;
|
||||||
format.cfFormat = m_formats[m_nCurrent++];
|
format.cfFormat = m_formats[m_nCurrent++];
|
||||||
format.ptd = NULL;
|
format.ptd = NULL;
|
||||||
format.dwAspect = DVASPECT_CONTENT;
|
format.dwAspect = DVASPECT_CONTENT;
|
||||||
format.lindex = -1;
|
format.lindex = -1;
|
||||||
format.tymed = TYMED_HGLOBAL;
|
format.tymed = TYMED_HGLOBAL;
|
||||||
*rgelt = format;
|
|
||||||
|
|
||||||
return S_OK;
|
*rgelt++ = format;
|
||||||
}
|
numFetched++;
|
||||||
else {
|
|
||||||
// bad index
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pceltFetched)
|
||||||
|
*pceltFetched = numFetched;
|
||||||
|
|
||||||
|
return numFetched == celt ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP wxIEnumFORMATETC::Skip(ULONG celt)
|
STDMETHODIMP wxIEnumFORMATETC::Skip(ULONG celt)
|
||||||
|
Loading…
Reference in New Issue
Block a user