Back to index

lightning-sunbird  0.9+nobinonly
IEHtmlButtonElement.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Alexandre Trémon <atremon@elansoftware.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "stdafx.h"
00040 #include "IEHTMLButtonElement.h"
00041 #include "IEHtmlElement.h"
00042 #include "nsIDOMHTMLButtonElement.h"
00043 
00044 HRESULT CIEHtmlButtonElement::FinalConstruct( )
00045 {
00046     return CComCreator<CComAggObject<CIEHtmlElement> >::CreateInstance(GetControllingUnknown(),
00047         IID_IUnknown, reinterpret_cast<void**>(&m_pHtmlElementAgg));
00048 }
00049 
00050 HRESULT CIEHtmlButtonElement::GetHtmlElement(CIEHtmlElement **ppHtmlElement)
00051 {
00052     if (ppHtmlElement == NULL)
00053         return E_FAIL;
00054     *ppHtmlElement = NULL;
00055     IHTMLElement* pHtmlElement = NULL;
00056     // This causes an AddRef on outer unknown:
00057     HRESULT hr = m_pHtmlElementAgg->QueryInterface(IID_IHTMLElement, (void**)&pHtmlElement);
00058     *ppHtmlElement = (CIEHtmlElement*)pHtmlElement;
00059     return hr;
00060 }
00061 
00062 HRESULT CIEHtmlButtonElement::SetDOMNode(nsIDOMNode *pDomNode)
00063 {
00064     mDOMNode = pDomNode;
00065     //Forward to aggregated object:
00066     CIEHtmlElement *pHtmlElement;
00067     GetHtmlElement(&pHtmlElement);
00068     HRESULT hr = pHtmlElement->SetDOMNode(pDomNode);
00069     // Release on outer unknown because GetHtmlDomNode does AddRef on it:
00070     GetControllingUnknown()->Release();
00071     return hr;
00072 }
00073 
00074 HRESULT CIEHtmlButtonElement::SetParent(CNode *pParent)
00075 {
00076     CNode::SetParent(pParent);
00077     //Forward to aggregated object:
00078     CIEHtmlElement *pHtmlElement;
00079     GetHtmlElement(&pHtmlElement);
00080     HRESULT hr = pHtmlElement->SetParent(pParent);
00081     // Release on outer unknown because GetHtmlDomNode does AddRef on it:
00082     GetControllingUnknown()->Release();
00083     return hr;
00084 }
00085 
00086 // -----------------------------------------------------------------------
00087 // IHTMLButtonElement Implementation
00088 // -----------------------------------------------------------------------
00089 
00090 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_type(BSTR __RPC_FAR *p)
00091 {
00092     return E_NOTIMPL;
00093 }
00094 
00095 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_value(BSTR v)
00096 {
00097     return E_NOTIMPL;
00098 }
00099 
00100 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_value(BSTR __RPC_FAR *p)
00101 {
00102     if (p == NULL)
00103         return E_INVALIDARG;
00104 
00105     *p = NULL;
00106     nsCOMPtr<nsIDOMHTMLButtonElement> domHtmlButtonElement = do_QueryInterface(mDOMNode);
00107     if (!domHtmlButtonElement)
00108         return E_UNEXPECTED;
00109     nsAutoString strValue;
00110     domHtmlButtonElement->GetValue(strValue);
00111     *p = SysAllocString(strValue.get());
00112     if (!*p)
00113         return E_OUTOFMEMORY;
00114     return S_OK;
00115 }
00116 
00117 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_name(BSTR v)
00118 {
00119     return E_NOTIMPL;
00120 }
00121 
00122 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_name(BSTR __RPC_FAR *p)
00123 {
00124     return E_NOTIMPL;
00125 }
00126 
00127 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_status(VARIANT v)
00128 {
00129     return E_NOTIMPL;
00130 }
00131 
00132 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_status(VARIANT __RPC_FAR *p)
00133 {
00134     return E_NOTIMPL;
00135 }
00136 
00137 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::put_disabled(VARIANT_BOOL v)
00138 {
00139     return E_NOTIMPL;
00140 }
00141 
00142 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_disabled(VARIANT_BOOL __RPC_FAR *p)
00143 {
00144     return E_NOTIMPL;
00145 }
00146 
00147 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::get_form(IHTMLFormElement __RPC_FAR *__RPC_FAR *p)
00148 {
00149     return E_NOTIMPL;
00150 }
00151 
00152 HRESULT STDMETHODCALLTYPE CIEHtmlButtonElement::createTextRange(IHTMLTxtRange __RPC_FAR *__RPC_FAR *range)
00153 {
00154     return E_NOTIMPL;
00155 }