htmltextcont.c 6.86 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright 2006 Jacek Caban for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 */

#include "config.h"

#include <stdarg.h>
#include <stdio.h>

#define COBJMACROS

#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"

#include "wine/debug.h"

#include "mshtml_private.h"

WINE_DEFAULT_DEBUG_CHANNEL(mshtml);

37 38 39 40
static inline HTMLTextContainer *impl_from_IHTMLTextContainer(IHTMLTextContainer *iface)
{
    return CONTAINING_RECORD(iface, HTMLTextContainer, IHTMLTextContainer_iface);
}
41 42 43 44

static HRESULT WINAPI HTMLTextContainer_QueryInterface(IHTMLTextContainer *iface,
                                                       REFIID riid, void **ppv)
{
45
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
46
    return IHTMLElement_QueryInterface(&This->element.IHTMLElement_iface, riid, ppv);
47 48 49 50
}

static ULONG WINAPI HTMLTextContainer_AddRef(IHTMLTextContainer *iface)
{
51
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
52
    return IHTMLElement_AddRef(&This->element.IHTMLElement_iface);
53 54 55 56
}

static ULONG WINAPI HTMLTextContainer_Release(IHTMLTextContainer *iface)
{
57
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
58
    return IHTMLElement_Release(&This->element.IHTMLElement_iface);
59 60 61 62
}

static HRESULT WINAPI HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer *iface, UINT *pctinfo)
{
63
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
64
    return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
65 66 67 68 69
}

static HRESULT WINAPI HTMLTextContainer_GetTypeInfo(IHTMLTextContainer *iface, UINT iTInfo,
                                              LCID lcid, ITypeInfo **ppTInfo)
{
70
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
71 72
    return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
            ppTInfo);
73 74 75 76 77 78
}

static HRESULT WINAPI HTMLTextContainer_GetIDsOfNames(IHTMLTextContainer *iface, REFIID riid,
                                                LPOLESTR *rgszNames, UINT cNames,
                                                LCID lcid, DISPID *rgDispId)
{
79
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
80 81
    return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
            cNames, lcid, rgDispId);
82 83 84 85 86 87
}

static HRESULT WINAPI HTMLTextContainer_Invoke(IHTMLTextContainer *iface, DISPID dispIdMember,
                            REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                            VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
88
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
89 90
    return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
            lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
91 92 93 94 95
}

static HRESULT WINAPI HTMLTextContainer_createControlRange(IHTMLTextContainer *iface,
                                                           IDispatch **range)
{
96
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
97 98 99 100
    FIXME("(%p)->(%p)\n", This, range);
    return E_NOTIMPL;
}

101
static HRESULT WINAPI HTMLTextContainer_get_scrollHeight(IHTMLTextContainer *iface, LONG *p)
102
{
103
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
104 105 106

    TRACE("(%p)->(%p)\n", This, p);

107
    return IHTMLElement2_get_scrollHeight(&This->element.IHTMLElement2_iface, p);
108 109
}

110
static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *iface, LONG *p)
111
{
112
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
113 114 115

    TRACE("(%p)->(%p)\n", This, p);

116
    return IHTMLElement2_get_scrollWidth(&This->element.IHTMLElement2_iface, p);
117 118
}

119
static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface, LONG v)
120
{
121
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
122

123
    TRACE("(%p)->(%d)\n", This, v);
124

125
    return IHTMLElement2_put_scrollTop(&This->element.IHTMLElement2_iface, v);
126 127
}

128
static HRESULT WINAPI HTMLTextContainer_get_scrollTop(IHTMLTextContainer *iface, LONG *p)
129
{
130
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
131 132 133

    TRACE("(%p)->(%p)\n", This, p);

134
    return IHTMLElement2_get_scrollTop(&This->element.IHTMLElement2_iface, p);
135 136
}

137
static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface, LONG v)
138
{
139
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
140

141
    TRACE("(%p)->(%d)\n", This, v);
142

143
    return IHTMLElement2_put_scrollLeft(&This->element.IHTMLElement2_iface, v);
144 145
}

146
static HRESULT WINAPI HTMLTextContainer_get_scrollLeft(IHTMLTextContainer *iface, LONG *p)
147
{
148
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
149 150 151

    TRACE("(%p)->(%p)\n", This, p);

152
    return IHTMLElement2_get_scrollLeft(&This->element.IHTMLElement2_iface, p);
153 154 155 156
}

static HRESULT WINAPI HTMLTextContainer_put_onscroll(IHTMLTextContainer *iface, VARIANT v)
{
157
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
158 159 160 161 162 163
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI HTMLTextContainer_get_onscroll(IHTMLTextContainer *iface, VARIANT *p)
{
164
    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
    FIXME("(%p)->(%p)\n", This, p);
    return E_NOTIMPL;
}

static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
    HTMLTextContainer_QueryInterface,
    HTMLTextContainer_AddRef,
    HTMLTextContainer_Release,
    HTMLTextContainer_GetTypeInfoCount,
    HTMLTextContainer_GetTypeInfo,
    HTMLTextContainer_GetIDsOfNames,
    HTMLTextContainer_Invoke,
    HTMLTextContainer_createControlRange,
    HTMLTextContainer_get_scrollHeight,
    HTMLTextContainer_get_scrollWidth,
    HTMLTextContainer_put_scrollTop,
    HTMLTextContainer_get_scrollTop,
    HTMLTextContainer_put_scrollLeft,
    HTMLTextContainer_get_scrollLeft,
    HTMLTextContainer_put_onscroll,
    HTMLTextContainer_get_onscroll
};

188 189
void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
        dispex_static_data_t *dispex_data)
190
{
191
    This->IHTMLTextContainer_iface.lpVtbl = &HTMLTextContainerVtbl;
192

193
    HTMLElement_Init(&This->element, doc, nselem, dispex_data);
194

195
    ConnectionPoint_Init(&This->cp, &This->element.cp_container, &DIID_HTMLTextContainerEvents, NULL);
196
}