mshtml: Added IHTMLTxtRange::put_text implementation.

This commit is contained in:
Jacek Caban 2007-08-17 02:38:00 +02:00 committed by Alexandre Julliard
parent cfaf00fa51
commit 77e8a6800d
2 changed files with 34 additions and 2 deletions

View File

@ -50,6 +50,8 @@
#define NS_ELEMENT_NODE 1
#define NS_DOCUMENT_NODE 9
#define MSHTML_E_NODOC 0x800a025c
typedef struct HTMLDOMNode HTMLDOMNode;
typedef struct ConnectionPoint ConnectionPoint;
typedef struct BSCallback BSCallback;

View File

@ -180,8 +180,38 @@ static HRESULT WINAPI HTMLTxtRange_get_htmlText(IHTMLTxtRange *iface, BSTR *p)
static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
{
HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsIDOMDocument *nsdoc;
nsIDOMText *text_node;
nsAString text_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->doc)
return MSHTML_E_NODOC;
nsres = nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &nsdoc);
if(NS_FAILED(nsres)) {
ERR("GetDocument failed: %08x\n", nsres);
return S_OK;
}
nsAString_Init(&text_str, v);
nsres = nsIDOMDocument_CreateTextNode(nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
return S_OK;
}
nsres = nsIDOMRange_DeleteContents(This->nsrange);
if(NS_FAILED(nsres))
ERR("DeleteContents failed: %08x\n", nsres);
nsres = nsIDOMRange_InsertNode(This->nsrange, (nsIDOMNode*)text_node);
if(NS_FAILED(nsres))
ERR("InsertNode failed: %08x\n", nsres);
return S_OK;
}
static HRESULT WINAPI HTMLTxtRange_get_text(IHTMLTxtRange *iface, BSTR *p)