Beispiel #1
0
static HRESULT domselection_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
        VARIANT *res, EXCEPINFO *ei)
{
    domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );

    TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);

    V_VT(res) = VT_DISPATCH;
    V_DISPATCH(res) = NULL;

    if (id < DISPID_DOM_COLLECTION_BASE || id > DISPID_DOM_COLLECTION_MAX)
        return DISP_E_UNKNOWNNAME;

    switch(flags)
    {
        case INVOKE_PROPERTYGET:
        {
            IXMLDOMNode *disp = NULL;

            IXMLDOMSelection_get_item(&This->IXMLDOMSelection_iface, id - DISPID_DOM_COLLECTION_BASE, &disp);
            V_DISPATCH(res) = (IDispatch*)disp;
            break;
        }
        default:
        {
            FIXME("unimplemented flags %x\n", flags);
            break;
        }
    }

    TRACE("ret %p\n", V_DISPATCH(res));

    return S_OK;
}
Beispiel #2
0
static HRESULT WINAPI enumvariant_Next(
    IEnumVARIANT *iface,
    ULONG celt,
    VARIANT *var,
    ULONG *fetched)
{
    enumvariant *This = impl_from_IEnumVARIANT( iface );
    IXMLDOMNode *node;
    ULONG ret_count = 0;

    TRACE("(%p)->(%u %p %p)\n", This, celt, var, fetched);

    if (fetched) *fetched = 0;

    if (celt && !var) return E_INVALIDARG;

    for (; celt > 0; celt--, var++, This->pos++)
    {
        IDispatch *disp = NULL;
        HRESULT hr;

        node = NULL;
        hr = IXMLDOMSelection_get_item(This->selection, This->pos, &node);
        if (hr != S_OK) break;

        IXMLDOMNode_QueryInterface(node, &IID_IDispatch, (void**)&disp);
        IXMLDOMNode_Release(node);

        V_VT(var) = VT_DISPATCH;
        V_DISPATCH(var) = disp;

        ret_count++;
    }

    if (fetched) (*fetched)++;

    /* we need to advance one step more for some reason */
    if (ret_count)
        IXMLDOMSelection_nextNode(This->selection, &node);

    return celt == 0 ? S_OK : S_FALSE;
}
Beispiel #3
0
static HRESULT selection_get_item(IUnknown *iface, LONG index, VARIANT* item)
{
    V_VT(item) = VT_DISPATCH;
    return IXMLDOMSelection_get_item((IXMLDOMSelection*)iface, index, (IXMLDOMNode**)&V_DISPATCH(item));
}