diff --git a/mozilla/embedding/browser/activex/makefile.win b/mozilla/embedding/browser/activex/makefile.win new file mode 100644 index 00000000000..ceded181f80 --- /dev/null +++ b/mozilla/embedding/browser/activex/makefile.win @@ -0,0 +1,6 @@ +#!nmake + +DEPTH=..\..\.. +DIRS=src + +include <$(DEPTH)\config\rules.mak> \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/ActiveScriptSite.cpp b/mozilla/embedding/browser/activex/src/control/ActiveScriptSite.cpp new file mode 100644 index 00000000000..6e56b1b2bc2 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ActiveScriptSite.cpp @@ -0,0 +1,384 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" +#include +#include +#include "ActiveScriptSite.h" + + +CActiveScriptSite::CActiveScriptSite() +{ + m_ssScriptState = SCRIPTSTATE_UNINITIALIZED; +} + + +CActiveScriptSite::~CActiveScriptSite() +{ + Detach(); +} + + +HRESULT CActiveScriptSite::Attach(CLSID clsidScriptEngine) +{ + // Detach to anything already attached to + Detach(); + + // Create the new script engine + HRESULT hr = m_spIActiveScript.CoCreateInstance(clsidScriptEngine); + if (FAILED(hr)) + { + return hr; + } + + // Attach the script engine to this site + m_spIActiveScript->SetScriptSite(this); + + // Initialise the script engine + CIPtr(IActiveScriptParse) spActiveScriptParse = m_spIActiveScript; + if (spActiveScriptParse) + { + spActiveScriptParse->InitNew(); + } + else + { + } + + return S_OK; +} + + +HRESULT CActiveScriptSite::Detach() +{ + if (m_spIActiveScript) + { + StopScript(); + m_spIActiveScript->Close(); + m_spIActiveScript.Release(); + } + + return S_OK; +} + + +HRESULT CActiveScriptSite::AttachVBScript() +{ + static const CLSID CLSID_VBScript = + { 0xB54F3741, 0x5B07, 0x11CF, { 0xA4, 0xB0, 0x00, 0xAA, 0x00, 0x4A, 0x55, 0xE8} }; + + return Attach(CLSID_VBScript); +} + + +HRESULT CActiveScriptSite::AttachJScript() +{ + static const CLSID CLSID_JScript = + { 0xF414C260, 0x6AC0, 0x11CF, { 0xB6, 0xD1, 0x00, 0xAA, 0x00, 0xBB, 0xBB, 0x58} }; + + return Attach(CLSID_JScript); +} + + +HRESULT CActiveScriptSite::AddNamedObject(const TCHAR *szName, IUnknown *pObject, BOOL bGlobalMembers) +{ + if (m_spIActiveScript == NULL) + { + return E_UNEXPECTED; + } + + if (pObject == NULL || szName == NULL) + { + return E_INVALIDARG; + } + + // Check for objects of the same name already + CNamedObjectList::iterator i = m_cObjectList.find(szName); + if (i != m_cObjectList.end()) + { + return E_FAIL; + } + + // Add object to the list + m_cObjectList.insert(CNamedObjectList::value_type(szName, pObject)); + + // Tell the script engine about the object + HRESULT hr; + USES_CONVERSION; + DWORD dwFlags = SCRIPTITEM_ISSOURCE | SCRIPTITEM_ISVISIBLE; + if (bGlobalMembers) + { + dwFlags |= SCRIPTITEM_GLOBALMEMBERS; + } + + hr = m_spIActiveScript->AddNamedItem(T2OLE(szName), dwFlags); + + if (FAILED(hr)) + { + m_cObjectList.erase(szName); + return hr; + } + + return S_OK; +} + + +HRESULT CActiveScriptSite::ParseScriptFile(const TCHAR *szFile) +{ + USES_CONVERSION; + const char *pszFileName = T2CA(szFile); + + // Stat the file and get its length; + struct _stat cStat; + _stat(pszFileName, &cStat); + + // Allocate a buffer + size_t nBufSize = cStat.st_size + 1; + char *pBuffer = (char *) malloc(nBufSize); + if (pBuffer == NULL) + { + return E_OUTOFMEMORY; + } + memset(pBuffer, 0, nBufSize); + + // Read the script into the buffer and parse it + HRESULT hr = E_FAIL; + FILE *f = fopen(pszFileName, "rb"); + if (f) + { + fread(pBuffer, 1, nBufSize - 1, f); + hr = ParseScriptText(A2T(pBuffer)); + fclose(f); + } + + free(pBuffer); + + return hr; +} + + +HRESULT CActiveScriptSite::ParseScriptText(const TCHAR *szScript) +{ + if (m_spIActiveScript == NULL) + { + return E_UNEXPECTED; + } + + CIPtr(IActiveScriptParse) spIActiveScriptParse = m_spIActiveScript; + if (spIActiveScriptParse) + { + USES_CONVERSION; + + CComVariant vResult; + DWORD dwCookie = 0; // TODO + DWORD dwFlags = 0; + EXCEPINFO cExcepInfo; + HRESULT hr; + + hr = spIActiveScriptParse->ParseScriptText( + T2OLE(szScript), + NULL, NULL, NULL, dwCookie, 0, dwFlags, + &vResult, &cExcepInfo); + + if (FAILED(hr)) + { + return E_FAIL; + } + } + else + { + CIPtr(IPersistStream) spPersistStream = m_spIActiveScript; + CIPtr(IStream) spStream; + + // Load text into the stream IPersistStream + if (spPersistStream && + SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &spStream))) + { + USES_CONVERSION; + LARGE_INTEGER cPos = { 0, 0 }; + LPOLESTR szText = T2OLE(szScript); + spStream->Write(szText, wcslen(szText) * sizeof(WCHAR), NULL); + spStream->Seek(cPos, STREAM_SEEK_SET, NULL); + spPersistStream->Load(spStream); + } + else + { + return E_UNEXPECTED; + } + } + + return S_OK; +} + + +HRESULT CActiveScriptSite::PlayScript() +{ + if (m_spIActiveScript == NULL) + { + return E_UNEXPECTED; + } + + m_spIActiveScript->SetScriptState(SCRIPTSTATE_CONNECTED); + + return S_OK; +} + + +HRESULT CActiveScriptSite::StopScript() +{ + if (m_spIActiveScript == NULL) + { + return E_UNEXPECTED; + } + + m_spIActiveScript->SetScriptState(SCRIPTSTATE_DISCONNECTED); + + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IActiveScriptSite implementation + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::GetLCID(/* [out] */ LCID __RPC_FAR *plcid) +{ + // Use the system defined locale + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::GetItemInfo(/* [in] */ LPCOLESTR pstrName, /* [in] */ DWORD dwReturnMask, /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppiunkItem, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppti) +{ + if (pstrName == NULL) + { + return E_INVALIDARG; + } + + if (ppiunkItem) + { + *ppiunkItem = NULL; + } + + if (ppti) + { + *ppti = NULL; + } + + USES_CONVERSION; + + // Find object in list + CIUnkPtr spUnkObject; + CNamedObjectList::iterator i = m_cObjectList.find(OLE2T(pstrName)); + if (i != m_cObjectList.end()) + { + spUnkObject = (*i).second; + } + + // Fill in the output values + if (spUnkObject == NULL) + { + return TYPE_E_ELEMENTNOTFOUND; + } + if (dwReturnMask & SCRIPTINFO_IUNKNOWN) + { + spUnkObject->QueryInterface(IID_IUnknown, (void **) ppiunkItem); + } + if (dwReturnMask & SCRIPTINFO_ITYPEINFO) + { + // Return the typeinfo in ptti + CIPtr(IDispatch) spIDispatch = spUnkObject; + if (spIDispatch) + { + HRESULT hr; + hr = spIDispatch->GetTypeInfo(0, GetSystemDefaultLCID(), ppti); + if (FAILED(hr)) + { + *ppti = NULL; + } + } + } + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::GetDocVersionString(/* [out] */ BSTR __RPC_FAR *pbstrVersion) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnScriptTerminate(/* [in] */ const VARIANT __RPC_FAR *pvarResult, /* [in] */ const EXCEPINFO __RPC_FAR *pexcepinfo) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnStateChange(/* [in] */ SCRIPTSTATE ssScriptState) +{ + m_ssScriptState = ssScriptState; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnScriptError(/* [in] */ IActiveScriptError __RPC_FAR *pscripterror) +{ + BSTR bstrSourceLineText = NULL; + DWORD dwSourceContext = 0; + ULONG pulLineNumber = 0; + LONG ichCharPosition = 0; + EXCEPINFO cExcepInfo; + + memset(&cExcepInfo, 0, sizeof(cExcepInfo)); + + // Get error information + pscripterror->GetSourcePosition(&dwSourceContext, &pulLineNumber, &ichCharPosition); + pscripterror->GetSourceLineText(&bstrSourceLineText); + pscripterror->GetExceptionInfo(&cExcepInfo); + + tstring szDescription(_T("(No description)")); + if (cExcepInfo.bstrDescription) + { + // Dump info + USES_CONVERSION; + szDescription = OLE2T(cExcepInfo.bstrDescription); + } + + ATLTRACE(_T("Script Error: %s, code=0x%08x\n"), szDescription.c_str(), cExcepInfo.scode); + + SysFreeString(bstrSourceLineText); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnEnterScript(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CActiveScriptSite::OnLeaveScript(void) +{ + return S_OK; +} + + diff --git a/mozilla/embedding/browser/activex/src/control/ActiveScriptSite.h b/mozilla/embedding/browser/activex/src/control/ActiveScriptSite.h new file mode 100644 index 00000000000..76567640be4 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ActiveScriptSite.h @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef ACTIVESCRIPTSITE_H +#define ACTIVESCRIPTSITE_H + + +class CActiveScriptSite : public CComObjectRootEx, + public IActiveScriptSite +{ + // Pointer to owned script engine + CComQIPtr m_spIActiveScript; + + // List of registered, named objects + CNamedObjectList m_cObjectList; + + // Current script state + SCRIPTSTATE m_ssScriptState; + +public: + CActiveScriptSite(); + virtual ~CActiveScriptSite(); + +BEGIN_COM_MAP(CActiveScriptSite) + COM_INTERFACE_ENTRY(IActiveScriptSite) +END_COM_MAP() + + // Attach to the specified script engine + virtual HRESULT Attach(CLSID clsidScriptEngine); + // Helper to attach to the VBScript engine + virtual HRESULT AttachVBScript(); + // Helper to attach to the JScript engine + virtual HRESULT AttachJScript(); + // Detach from the script engine + virtual HRESULT Detach(); + // Return the current state of the script engine + virtual SCRIPTSTATE GetScriptState() const + { + return m_ssScriptState; + } + + // Parse the specified script + virtual HRESULT ParseScriptText(const TCHAR *szScript); + // Parse the specified script from a file + virtual HRESULT ParseScriptFile(const TCHAR *szFile); + // Add object to script address space + virtual HRESULT AddNamedObject(const TCHAR *szName, IUnknown *pObject, BOOL bGlobalMembers = FALSE); + // Play the script + virtual HRESULT PlayScript(); + // Stop the script + virtual HRESULT StopScript(); + +public: + // IActiveScriptSite + virtual HRESULT STDMETHODCALLTYPE GetLCID(/* [out] */ LCID __RPC_FAR *plcid); + virtual HRESULT STDMETHODCALLTYPE GetItemInfo(/* [in] */ LPCOLESTR pstrName, /* [in] */ DWORD dwReturnMask, /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppiunkItem, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppti); + virtual HRESULT STDMETHODCALLTYPE GetDocVersionString(/* [out] */ BSTR __RPC_FAR *pbstrVersion); + virtual HRESULT STDMETHODCALLTYPE OnScriptTerminate(/* [in] */ const VARIANT __RPC_FAR *pvarResult, /* [in] */ const EXCEPINFO __RPC_FAR *pexcepinfo); + virtual HRESULT STDMETHODCALLTYPE OnStateChange(/* [in] */ SCRIPTSTATE ssScriptState); + virtual HRESULT STDMETHODCALLTYPE OnScriptError(/* [in] */ IActiveScriptError __RPC_FAR *pscripterror); + virtual HRESULT STDMETHODCALLTYPE OnEnterScript(void); + virtual HRESULT STDMETHODCALLTYPE OnLeaveScript(void); +}; + +typedef CComObject CActiveScriptSiteInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/ActiveXTypes.h b/mozilla/embedding/browser/activex/src/control/ActiveXTypes.h new file mode 100644 index 00000000000..da85c2f1b16 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ActiveXTypes.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef ACTIVEXTYPES_H +#define ACTIVEXTYPES_H + +#include +#include + +// STL based class for handling TCHAR strings +typedef std::basic_string tstring; + +// IUnknown smart pointer +typedef CComPtr CIUnkPtr; + +// Smart pointer macro for CComQIPtr +#define CIPtr(iface) CComQIPtr< iface, &IID_ ## iface > + +typedef std::vector CObjectList; +typedef std::map CNamedObjectList; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/BrowserDiagnostics.h b/mozilla/embedding/browser/activex/src/control/BrowserDiagnostics.h new file mode 100644 index 00000000000..711544cef1f --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/BrowserDiagnostics.h @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef BROWSER_DIAGNOSTICS_H +#define BROWSER_DIAGNOSTICS_H + +#ifdef _DEBUG +# include +# define NG_TRACE ATLTRACE +# define NG_TRACE_METHOD(fn) \ + { \ + NG_TRACE(_T("0x%04x %s()\n"), (int) GetCurrentThreadId(), _T(#fn)); \ + } +# define NG_TRACE_METHOD_ARGS(fn, pattern, args) \ + { \ + NG_TRACE(_T("0x%04x %s(") _T(pattern) _T(")\n"), (int) GetCurrentThreadId(), _T(#fn), args); \ + } +# define NG_ASSERT(expr) assert(expr) +# define NG_ASSERT_POINTER(p, type) \ + NG_ASSERT(((p) != NULL) && NgIsValidAddress((p), sizeof(type), FALSE)) +# define NG_ASSERT_NULL_OR_POINTER(p, type) \ + NG_ASSERT(((p) == NULL) || NgIsValidAddress((p), sizeof(type), FALSE)) +#else +# define NG_TRACE ATLTRACE +# define NG_TRACE_METHOD(fn) +# define NG_TRACE_METHOD_ARGS(fn, pattern, args) +# define NG_ASSERT(X) +# define NG_ASSERT_POINTER(p, type) +# define NG_ASSERT_NULL_OR_POINTER(p, type) +#endif + +inline BOOL NgIsValidAddress(const void* lp, UINT nBytes, BOOL bReadWrite = TRUE) +{ + return (lp != NULL && !IsBadReadPtr(lp, nBytes) && + (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes))); +} + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/CPMozillaControl.h b/mozilla/embedding/browser/activex/src/control/CPMozillaControl.h new file mode 100644 index 00000000000..a192697c70f --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/CPMozillaControl.h @@ -0,0 +1,934 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef CPMOZILLACONTROL_H +#define CPMOZILLACONTROL_H + +////////////////////////////////////////////////////////////////////////////// +// CProxyDWebBrowserEvents +template +class CProxyDWebBrowserEvents : public IConnectionPointImpl +{ +public: +//methods: +//DWebBrowserEvents : IDispatch +public: + void Fire_BeforeNavigate( + BSTR URL, + long Flags, + BSTR TargetFrameName, + VARIANT * PostData, + BSTR Headers, + VARIANT_BOOL * Cancel) + { + VARIANTARG* pvars = new VARIANTARG[6]; + for (int i = 0; i < 6; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[5].vt = VT_BSTR; + pvars[5].bstrVal= URL; + pvars[4].vt = VT_I4; + pvars[4].lVal= Flags; + pvars[3].vt = VT_BSTR; + pvars[3].bstrVal= TargetFrameName; + pvars[2].vt = VT_VARIANT | VT_BYREF; + pvars[2].byref= PostData; + pvars[1].vt = VT_BSTR; + pvars[1].bstrVal= Headers; + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Cancel; + DISPPARAMS disp = { pvars, NULL, 6, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x64, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_NavigateComplete( + BSTR URL) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= URL; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x65, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_StatusTextChange( + BSTR Text) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= Text; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x66, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_ProgressChange( + long Progress, + long ProgressMax) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_I4; + pvars[1].lVal= Progress; + pvars[0].vt = VT_I4; + pvars[0].lVal= ProgressMax; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6c, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_DownloadComplete() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x68, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_CommandStateChange( + long Command, + VARIANT_BOOL Enable) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_I4; + pvars[1].lVal= Command; + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= Enable; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x69, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_DownloadBegin() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6a, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_NewWindow( + BSTR URL, + long Flags, + BSTR TargetFrameName, + VARIANT * PostData, + BSTR Headers, + VARIANT_BOOL * Processed) + { + VARIANTARG* pvars = new VARIANTARG[6]; + for (int i = 0; i < 6; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[5].vt = VT_BSTR; + pvars[5].bstrVal= URL; + pvars[4].vt = VT_I4; + pvars[4].lVal= Flags; + pvars[3].vt = VT_BSTR; + pvars[3].bstrVal= TargetFrameName; + pvars[2].vt = VT_VARIANT | VT_BYREF; + pvars[2].byref= PostData; + pvars[1].vt = VT_BSTR; + pvars[1].bstrVal= Headers; + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Processed; + DISPPARAMS disp = { pvars, NULL, 6, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6b, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_TitleChange( + BSTR Text) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= Text; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x71, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_FrameBeforeNavigate( + BSTR URL, + long Flags, + BSTR TargetFrameName, + VARIANT * PostData, + BSTR Headers, + VARIANT_BOOL * Cancel) + { + VARIANTARG* pvars = new VARIANTARG[6]; + for (int i = 0; i < 6; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[5].vt = VT_BSTR; + pvars[5].bstrVal= URL; + pvars[4].vt = VT_I4; + pvars[4].lVal= Flags; + pvars[3].vt = VT_BSTR; + pvars[3].bstrVal= TargetFrameName; + pvars[2].vt = VT_VARIANT | VT_BYREF; + pvars[2].byref= PostData; + pvars[1].vt = VT_BSTR; + pvars[1].bstrVal= Headers; + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Cancel; + DISPPARAMS disp = { pvars, NULL, 6, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xc8, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_FrameNavigateComplete( + BSTR URL) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= URL; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xc9, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_FrameNewWindow( + BSTR URL, + long Flags, + BSTR TargetFrameName, + VARIANT * PostData, + BSTR Headers, + VARIANT_BOOL * Processed) + { + VARIANTARG* pvars = new VARIANTARG[6]; + for (int i = 0; i < 6; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[5].vt = VT_BSTR; + pvars[5].bstrVal= URL; + pvars[4].vt = VT_I4; + pvars[4].lVal= Flags; + pvars[3].vt = VT_BSTR; + pvars[3].bstrVal= TargetFrameName; + pvars[2].vt = VT_VARIANT | VT_BYREF; + pvars[2].byref= PostData; + pvars[1].vt = VT_BSTR; + pvars[1].bstrVal= Headers; + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Processed; + DISPPARAMS disp = { pvars, NULL, 6, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xcc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_Quit( + VARIANT_BOOL * Cancel) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Cancel; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x67, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_WindowMove() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6d, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_WindowResize() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6e, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_WindowActivate() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6f, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_PropertyChange( + BSTR Property) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= Property; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x70, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + +}; + + +////////////////////////////////////////////////////////////////////////////// +// CProxyDWebBrowserEvents2 +template +class CProxyDWebBrowserEvents2 : public IConnectionPointImpl +{ +public: +//methods: +//DWebBrowserEvents2 : IDispatch +public: + void Fire_StatusTextChange( + BSTR Text) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= Text; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x66, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_ProgressChange( + long Progress, + long ProgressMax) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_I4; + pvars[1].lVal= Progress; + pvars[0].vt = VT_I4; + pvars[0].lVal= ProgressMax; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6c, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_CommandStateChange( + long Command, + VARIANT_BOOL Enable) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_I4; + pvars[1].lVal= Command; + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= Enable; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x69, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_DownloadBegin() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x6a, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_DownloadComplete() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x68, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_TitleChange( + BSTR Text) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= Text; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x71, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_PropertyChange( + BSTR szProperty) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BSTR; + pvars[0].bstrVal= szProperty; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x70, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_BeforeNavigate2( + IDispatch * pDisp, + VARIANT * URL, + VARIANT * Flags, + VARIANT * TargetFrameName, + VARIANT * PostData, + VARIANT * Headers, + VARIANT_BOOL * Cancel) + { + VARIANTARG* pvars = new VARIANTARG[7]; + for (int i = 0; i < 7; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[6].vt = VT_DISPATCH; + pvars[6].pdispVal= pDisp; + pvars[5].vt = VT_VARIANT | VT_BYREF; + pvars[5].byref= URL; + pvars[4].vt = VT_VARIANT | VT_BYREF; + pvars[4].byref= Flags; + pvars[3].vt = VT_VARIANT | VT_BYREF; + pvars[3].byref= TargetFrameName; + pvars[2].vt = VT_VARIANT | VT_BYREF; + pvars[2].byref= PostData; + pvars[1].vt = VT_VARIANT | VT_BYREF; + pvars[1].byref= Headers; + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Cancel; + DISPPARAMS disp = { pvars, NULL, 7, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xfa, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_NewWindow2( + IDispatch * * ppDisp, + VARIANT_BOOL * Cancel) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_DISPATCH | VT_BYREF; + pvars[1].byref= ppDisp; + pvars[0].vt = VT_BOOL | VT_BYREF; + pvars[0].byref= Cancel; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xfb, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_NavigateComplete2( + IDispatch * pDisp, + VARIANT * URL) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_DISPATCH; + pvars[1].pdispVal= pDisp; + pvars[0].vt = VT_VARIANT | VT_BYREF; + pvars[0].byref= URL; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xfc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_DocumentComplete( + IDispatch * pDisp, + VARIANT * URL) + { + VARIANTARG* pvars = new VARIANTARG[2]; + for (int i = 0; i < 2; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[1].vt = VT_DISPATCH; + pvars[1].pdispVal= pDisp; + pvars[0].vt = VT_VARIANT | VT_BYREF; + pvars[0].byref= URL; + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x103, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_OnQuit() + { + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + DISPPARAMS disp = { NULL, NULL, 0, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xfd, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + } + void Fire_OnVisible( + VARIANT_BOOL Visible) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= Visible; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xfe, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_OnToolBar( + VARIANT_BOOL ToolBar) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= ToolBar; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0xff, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_OnMenuBar( + VARIANT_BOOL MenuBar) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= MenuBar; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x100, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_OnStatusBar( + VARIANT_BOOL StatusBar) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= StatusBar; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x101, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_OnFullScreen( + VARIANT_BOOL FullScreen) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= FullScreen; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x102, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + void Fire_OnTheaterMode( + VARIANT_BOOL TheaterMode) + { + VARIANTARG* pvars = new VARIANTARG[1]; + for (int i = 0; i < 1; i++) + VariantInit(&pvars[i]); + T* pT = (T*)this; + pT->Lock(); + IUnknown** pp = m_vec.begin(); + while (pp < m_vec.end()) + { + if (*pp != NULL) + { + pvars[0].vt = VT_BOOL; + pvars[0].boolVal= TheaterMode; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + IDispatch* pDispatch = reinterpret_cast(*pp); + pDispatch->Invoke(0x104, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + pp++; + } + pT->Unlock(); + delete[] pvars; + } + +}; + + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/ControlSite.cpp b/mozilla/embedding/browser/activex/src/control/ControlSite.cpp new file mode 100644 index 00000000000..aa762fa0d0d --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ControlSite.cpp @@ -0,0 +1,1028 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "StdAfx.h" + +#include "ControlSite.h" + + +std::list CControlSite::m_cControlList; + +// Constructor +CControlSite::CControlSite() +{ + NG_TRACE_METHOD(CControlSite::CControlSite); + + m_hWndParent = NULL; + m_clsid = CLSID_NULL; + m_bSetClientSiteFirst = FALSE; + m_bVisibleAtRuntime = TRUE; + memset(&m_rcObjectPos, 0, sizeof(m_rcObjectPos)); + + m_bInPlaceActive = FALSE; + m_bUIActive = FALSE; + m_bInPlaceLocked = FALSE; + m_bWindowless = FALSE; + m_bSupportWindowlessActivation = TRUE; + m_bSafeForScriptingObjectsOnly = FALSE; + + // Initialise ambient properties + m_nAmbientLocale = 0; + m_clrAmbientForeColor = ::GetSysColor(COLOR_WINDOWTEXT); + m_clrAmbientBackColor = ::GetSysColor(COLOR_WINDOW); + m_bAmbientUserMode = true; + m_bAmbientShowHatching = true; + m_bAmbientShowGrabHandles = true; + + // Add the control to the list + m_cControlList.push_back(this); +} + + +// Destructor +CControlSite::~CControlSite() +{ + NG_TRACE_METHOD(CControlSite::~CControlSite); + Detach(); + m_cControlList.remove(this); +} + +// Helper method checks whether a class implements a particular category +HRESULT CControlSite::ClassImplementsCategory(const CLSID &clsid, const CATID &catid) +{ + CIPtr(ICatInformation) spCatInfo; + HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatInformation, (LPVOID*) &spCatInfo); + if (spCatInfo == NULL) + { + // Must fail if we can't open the category manager + return E_FAIL; + } + + // See what categories the class implements + CIPtr(IEnumCATID) spEnumCATID; + if (FAILED(spCatInfo->EnumImplCategoriesOfClass(clsid, &spEnumCATID))) + { + // Can't enumerate classes in category so fail + return E_FAIL; + } + + // Search for matching categories + BOOL bFound = FALSE; + CATID catidNext = GUID_NULL; + while (spEnumCATID->Next(1, &catidNext, NULL) == S_OK) + { + if (memcmp(&catid, &catidNext, sizeof(CATID)) == 0) + { + bFound = TRUE; + } + } + if (!bFound) + { + return S_FALSE; + } + + return S_OK; +} + + +#if 0 +// For use when the SDK does not define it (which isn't the case these days) +static const CATID CATID_SafeForScripting = +{ 0x7DD95801, 0x9882, 0x11CF, { 0x9F, 0xA9, 0x00, 0xAA, 0x00, 0x6C, 0x42, 0xC4 } }; +#endif + +// Create the specified control, optionally providing properties to initialise +// it with and a name. +HRESULT CControlSite::Create(REFCLSID clsid, PropertyList &pl, const tstring szName) +{ + NG_TRACE_METHOD_ARGS(CControlSite::Create, "...,...,\"%s\"", szName.c_str()); + + m_clsid = clsid; + m_ParameterList = pl; + m_szName = szName; + + // See if object is script safe + if (m_bSafeForScriptingObjectsOnly && + ClassImplementsCategory(clsid, CATID_SafeForScripting) != S_OK) + { + return E_FAIL; + } + + // Create the object + HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown, (void **) &m_spObject); + if (FAILED(hr)) + { + return E_FAIL; + } + + return S_OK; +} + + +// Attach the created control to a window and activate it +HRESULT CControlSite::Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream) +{ + NG_TRACE_METHOD(CControlSite::Attach); + + if (hwndParent == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + m_hWndParent = hwndParent; + m_rcObjectPos = rcPos; + + // Object must have been created + if (m_spObject == NULL) + { + NG_ASSERT(0); + return E_UNEXPECTED; + } + + m_spIViewObject = m_spObject; + m_spIOleObject = m_spObject; + + if (m_spIOleObject == NULL) + { + return E_FAIL; + } + + DWORD dwMiscStatus; + m_spIOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus); + + if (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) + { + m_bSetClientSiteFirst = TRUE; + } + if (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) + { + m_bVisibleAtRuntime = FALSE; + } + + // Some objects like to have the client site as the first thing + // to be initialised (for ambient properties and so forth) + if (m_bSetClientSiteFirst) + { + m_spIOleObject->SetClientSite(this); + } + + // If there is a parameter list for the object and no init stream then + // create one here. + CPropertyBagInstance *pPropertyBag = NULL; + if (pInitStream == NULL && m_ParameterList.size() >= 1) + { + CPropertyBagInstance::CreateInstance(&pPropertyBag); + pPropertyBag->AddRef(); + for (PropertyList::const_iterator i = m_ParameterList.begin(); i != m_ParameterList.end(); i++) + { + pPropertyBag->Write((*i).szName, (VARIANT *) &(*i).vValue); + } + pInitStream = (IPersistPropertyBag *) pPropertyBag; + } + + // Initialise the control from store if one is provided + if (pInitStream) + { + CComQIPtr spPropertyBag = pInitStream; + CComQIPtr spStream = pInitStream; + CComQIPtr spIPersistStream = m_spIOleObject; + CComQIPtr spIPersistPropertyBag = m_spIOleObject; + + if (spIPersistPropertyBag && spPropertyBag) + { + spIPersistPropertyBag->Load(spPropertyBag, NULL); + } + else if (spIPersistStream && spStream) + { + spIPersistStream->Load(spStream); + } + } + else + { + // Initialise the object if possible + CComQIPtr spIPersistStreamInit = m_spIOleObject; + if (spIPersistStreamInit) + { + spIPersistStreamInit->InitNew(); + } + } + + m_spIOleInPlaceObject = m_spObject; + m_spIOleInPlaceObjectWindowless = m_spObject; + + m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); + + // In-place activate the object + if (m_bVisibleAtRuntime) + { + DoVerb(OLEIVERB_INPLACEACTIVATE); + } + + // For those objects which haven't had their client site set yet, + // it's done here. + if (!m_bSetClientSiteFirst) + { + m_spIOleObject->SetClientSite(this); + } + + return S_OK; +} + + +// Unhook the control from the window and throw it all away +HRESULT CControlSite::Detach() +{ + NG_TRACE_METHOD(CControlSite::Detach); + + if (m_spIOleInPlaceObjectWindowless) + { + m_spIOleInPlaceObjectWindowless.Release(); + } + + if (m_spIOleInPlaceObject) + { + m_spIOleInPlaceObject->InPlaceDeactivate(); + m_spIOleInPlaceObject.Release(); + } + + if (m_spIOleObject) + { + m_spIOleObject->Close(OLECLOSE_NOSAVE); + m_spIOleObject->SetClientSite(NULL); + m_spIOleObject.Release(); + } + + m_spIViewObject.Release(); + m_spObject.Release(); + + return S_OK; +} + + +// Return the IUnknown of the contained control +HRESULT CControlSite::GetControlUnknown(IUnknown **ppObject) +{ + *ppObject = NULL; + if (m_spObject) + { + m_spObject->QueryInterface(IID_IUnknown, (void **) ppObject); + } + return S_OK; +} + + +// Subscribe to an event sink on the control +HRESULT CControlSite::Advise(IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie) +{ + if (m_spObject == NULL) + { + return E_UNEXPECTED; + } + + if (pIUnkSink == NULL || pdwCookie == NULL) + { + return E_INVALIDARG; + } + + return AtlAdvise(m_spObject, pIUnkSink, iid, pdwCookie); +} + + +// Unsubscribe event sink from the control +HRESULT CControlSite::Unadvise(const IID &iid, DWORD dwCookie) +{ + if (m_spObject == NULL) + { + return E_UNEXPECTED; + } + + return AtlUnadvise(m_spObject, iid, dwCookie); +} + + +// Draw the control +HRESULT CControlSite::Draw(HDC hdc) +{ + NG_TRACE_METHOD(CControlSite::Draw); + + // Draw only when control is windowless or deactivated + if (m_spIViewObject) + { + if (m_bWindowless || !m_bInPlaceActive) + { + RECTL *prcBounds = (m_bWindowless) ? NULL : (RECTL *) &m_rcObjectPos; + m_spIViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdc, prcBounds, NULL, NULL, 0); + } + } + else + { + // Draw something to indicate no control is there + HBRUSH hbr = CreateSolidBrush(RGB(200,200,200)); + FillRect(hdc, &m_rcObjectPos, hbr); + DeleteObject(hbr); + } + + return S_OK; +} + + +// Execute the specified verb +HRESULT CControlSite::DoVerb(LONG nVerb, LPMSG lpMsg) +{ + NG_TRACE_METHOD(CControlSite::DoVerb); + + if (m_spIOleObject == NULL) + { + return E_FAIL; + } + + return m_spIOleObject->DoVerb(nVerb, lpMsg, this, 0, m_hWndParent, &m_rcObjectPos); +} + + +// Set the position on the control +HRESULT CControlSite::SetPosition(const RECT &rcPos) +{ + NG_TRACE_METHOD(CControlSite::SetPosition); + m_rcObjectPos = rcPos; + if (m_spIOleInPlaceObject) + { + m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); + } + return S_OK; +} + + +void CControlSite::FireAmbientPropertyChange(DISPID id) +{ + if (m_spObject) + { + CIPtr(IOleControl) spControl = m_spObject; + if (spControl) + { + spControl->OnAmbientPropertyChange(id); + } + } +} + + +void CControlSite::SetAmbientUserMode(BOOL bUserMode) +{ + bool bNewMode = bUserMode ? true : false; + if (m_bAmbientUserMode != bNewMode) + { + m_bAmbientUserMode = bNewMode; + FireAmbientPropertyChange(DISPID_AMBIENT_USERMODE); + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// IDispatch implementation + + +HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr) +{ + if (wFlags & DISPATCH_PROPERTYGET) + { + CComVariant vResult; + + switch (dispIdMember) + { + case DISPID_AMBIENT_FORECOLOR: + vResult = CComVariant((long) m_clrAmbientForeColor); + break; + + case DISPID_AMBIENT_BACKCOLOR: + vResult = CComVariant((long) m_clrAmbientBackColor); + break; + + case DISPID_AMBIENT_LOCALEID: + vResult = CComVariant((long) m_nAmbientLocale); + break; + + case DISPID_AMBIENT_USERMODE: + vResult = CComVariant(m_bAmbientUserMode); + break; + + case DISPID_AMBIENT_SHOWGRABHANDLES: + vResult = CComVariant(m_bAmbientShowGrabHandles); + break; + + case DISPID_AMBIENT_SHOWHATCHING: + vResult = CComVariant(m_bAmbientShowHatching); + break; + + default: + return DISP_E_MEMBERNOTFOUND; + } + + VariantCopy(pVarResult, &vResult); + return S_OK; + } + + return E_FAIL; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IAdviseSink implementation + + +void STDMETHODCALLTYPE CControlSite::OnDataChange(/* [unique][in] */ FORMATETC __RPC_FAR *pFormatetc, /* [unique][in] */ STGMEDIUM __RPC_FAR *pStgmed) +{ +} + + +void STDMETHODCALLTYPE CControlSite::OnViewChange(/* [in] */ DWORD dwAspect, /* [in] */ LONG lindex) +{ + // Redraw the control + InvalidateRect(NULL, FALSE); +} + + +void STDMETHODCALLTYPE CControlSite::OnRename(/* [in] */ IMoniker __RPC_FAR *pmk) +{ +} + + +void STDMETHODCALLTYPE CControlSite::OnSave(void) +{ +} + + +void STDMETHODCALLTYPE CControlSite::OnClose(void) +{ +} + + +/////////////////////////////////////////////////////////////////////////////// +// IAdviseSink2 implementation + + +void STDMETHODCALLTYPE CControlSite::OnLinkSrcChange(/* [unique][in] */ IMoniker __RPC_FAR *pmk) +{ +} + + +/////////////////////////////////////////////////////////////////////////////// +// IAdviseSinkEx implementation + + +void STDMETHODCALLTYPE CControlSite::OnViewStatusChange(/* [in] */ DWORD dwViewStatus) +{ +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleWindow implementation + +HRESULT STDMETHODCALLTYPE CControlSite::GetWindow(/* [out] */ HWND __RPC_FAR *phwnd) +{ + *phwnd = m_hWndParent; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::ContextSensitiveHelp(/* [in] */ BOOL fEnterMode) +{ + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleClientSite implementation + + +HRESULT STDMETHODCALLTYPE CControlSite::SaveObject(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetMoniker(/* [in] */ DWORD dwAssign, /* [in] */ DWORD dwWhichMoniker, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetContainer(/* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer) +{ + return E_NOINTERFACE; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::ShowObject(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnShowWindow(/* [in] */ BOOL fShow) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::RequestNewObjectLayout(void) +{ + return E_NOTIMPL; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleInPlaceSite implementation + + +HRESULT STDMETHODCALLTYPE CControlSite::CanInPlaceActivate(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivate(void) +{ + m_bInPlaceActive = TRUE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnUIActivate(void) +{ + m_bUIActive = TRUE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetWindowContext(/* [out] */ IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, /* [out] */ IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, /* [out] */ LPRECT lprcPosRect, /* [out] */ LPRECT lprcClipRect, /* [out][in] */ LPOLEINPLACEFRAMEINFO lpFrameInfo) +{ + *lprcPosRect = m_rcObjectPos; + *lprcClipRect = m_rcObjectPos; + + CControlSiteIPFrameInstance *pIPFrame = NULL; + CControlSiteIPFrameInstance::CreateInstance(&pIPFrame); + pIPFrame->AddRef(); + + *ppFrame = (IOleInPlaceFrame *) pIPFrame; + *ppDoc = NULL; + + lpFrameInfo->fMDIApp = FALSE; + lpFrameInfo->hwndFrame = NULL; + lpFrameInfo->haccel = NULL; + lpFrameInfo->cAccelEntries = 0; + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::Scroll(/* [in] */ SIZE scrollExtant) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnUIDeactivate(/* [in] */ BOOL fUndoable) +{ + m_bUIActive = FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivate(void) +{ + m_bInPlaceActive = FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::DiscardUndoState(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::DeactivateAndUndo(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnPosRectChange(/* [in] */ LPCRECT lprcPosRect) +{ + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleInPlaceSiteEx implementation + + +HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivateEx(/* [out] */ BOOL __RPC_FAR *pfNoRedraw, /* [in] */ DWORD dwFlags) +{ + m_bInPlaceActive = TRUE; + + if (pfNoRedraw) + { + *pfNoRedraw = FALSE; + } + if (dwFlags & ACTIVATE_WINDOWLESS) + { + // TODO check if control is windowless + } + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivateEx(/* [in] */ BOOL fNoRedraw) +{ + m_bInPlaceActive = FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::RequestUIActivate(void) +{ + return S_FALSE; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleInPlaceSiteWindowless implementation + + +HRESULT STDMETHODCALLTYPE CControlSite::CanWindowlessActivate(void) +{ + // Allow windowless activation? + return (m_bSupportWindowlessActivation) ? S_OK : S_FALSE; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetCapture(void) +{ + // TODO capture the mouse for the object + return S_FALSE; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::SetCapture(/* [in] */ BOOL fCapture) +{ + // TODO capture the mouse for the object + return S_FALSE; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetFocus(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::SetFocus(/* [in] */ BOOL fFocus) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetDC(/* [in] */ LPCRECT pRect, /* [in] */ DWORD grfFlags, /* [out] */ HDC __RPC_FAR *phDC) +{ + if (phDC == NULL) + { + return E_INVALIDARG; + } + + // Can't do nested painting + if (m_hDCBuffer != NULL) + { + return E_UNEXPECTED; + } + + m_rcBuffer = m_rcObjectPos; + if (pRect != NULL) + { + m_rcBuffer = *pRect; + } + + m_hBMBuffer = NULL; + m_dwBufferFlags = grfFlags; + + // See if the control wants a DC that is onscreen or offscreen + + if (m_dwBufferFlags & OLEDC_OFFSCREEN) + { + m_hDCBuffer = CreateCompatibleDC(NULL); + if (m_hDCBuffer == NULL) + { + // Error + return E_OUTOFMEMORY; + } + + long cx = m_rcBuffer.right - m_rcBuffer.left; + long cy = m_rcBuffer.bottom - m_rcBuffer.top; + + m_hBMBuffer = CreateCompatibleBitmap(m_hDCBuffer, cx, cy); + m_hBMBufferOld = (HBITMAP) SelectObject(m_hDCBuffer, m_hBMBuffer); + SetViewportOrgEx(m_hDCBuffer, m_rcBuffer.left, m_rcBuffer.top, NULL); + + // TODO When OLEDC_PAINTBKGND we must draw every site behind this one + } + else + { + // TODO When OLEDC_PAINTBKGND we must draw every site behind this one + + // Get the window DC + m_hDCBuffer = GetWindowDC(m_hWndParent); + if (m_hDCBuffer == NULL) + { + // Error + return E_OUTOFMEMORY; + } + + // Clip the control so it can't trash anywhere it isn't allowed to draw + if (!(m_dwBufferFlags & OLEDC_NODRAW)) + { + m_hRgnBuffer = CreateRectRgnIndirect(&m_rcBuffer); + + // TODO Clip out opaque areas of sites behind this one + + SelectClipRgn(m_hDCBuffer, m_hRgnBuffer); + } + } + + *phDC = m_hDCBuffer; + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::ReleaseDC(/* [in] */ HDC hDC) +{ + // Release the DC + NG_ASSERT(hDC); + if (hDC == NULL || hDC != m_hDCBuffer) + { + return E_INVALIDARG; + } + + // Test if the DC was offscreen or onscreen + if (m_dwBufferFlags & OLEDC_OFFSCREEN) + { + // BitBlt the buffer into the control's object + SetViewportOrgEx(m_hDCBuffer, 0, 0, NULL); + HDC hdc = GetWindowDC(m_hWndParent); + + long cx = m_rcBuffer.right - m_rcBuffer.left; + long cy = m_rcBuffer.bottom - m_rcBuffer.top; + + BitBlt(hdc, m_rcBuffer.left, m_rcBuffer.top, cx, cy, m_hDCBuffer, 0, 0, SRCCOPY); + + ::ReleaseDC(m_hWndParent, hdc); + } + else + { + // TODO If OLEDC_PAINTBKGND is set draw the DVASPECT_CONTENT of every object above this one + } + + // Clean up settings ready for next drawing + + if (m_hRgnBuffer) + { + SelectClipRgn(m_hDCBuffer, NULL); + DeleteObject(m_hRgnBuffer); + m_hRgnBuffer = NULL; + } + + SelectObject(m_hDCBuffer, m_hBMBufferOld); + if (m_hBMBuffer) + { + DeleteObject(m_hBMBuffer); + m_hBMBuffer = NULL; + } + + ::ReleaseDC(m_hWndParent, m_hDCBuffer); + m_hDCBuffer = NULL; + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRect(/* [in] */ LPCRECT pRect, /* [in] */ BOOL fErase) +{ + // Clip the rectangle against the object's size and invalidate it + RECT rcI = { 0, 0, 0, 0 }; + if (pRect == NULL) + { + rcI = m_rcObjectPos; + } + else + { + IntersectRect(&rcI, &m_rcObjectPos, pRect); + } + ::InvalidateRect(m_hWndParent, &rcI, fErase); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRgn(/* [in] */ HRGN hRGN, /* [in] */ BOOL fErase) +{ + if (hRGN == NULL) + { + ::InvalidateRect(m_hWndParent, &m_rcObjectPos, fErase); + } + else + { + // Clip the region with the object's bounding area + HRGN hrgnClip = CreateRectRgnIndirect(&m_rcObjectPos); + if (CombineRgn(hrgnClip, hrgnClip, hRGN, RGN_AND) != ERROR) + { + ::InvalidateRgn(m_hWndParent, hrgnClip, fErase); + } + DeleteObject(hrgnClip); + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CControlSite::ScrollRect(/* [in] */ INT dx, /* [in] */ INT dy, /* [in] */ LPCRECT pRectScroll, /* [in] */ LPCRECT pRectClip) +{ + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CControlSite::AdjustRect(/* [out][in] */ LPRECT prc) +{ + if (prc == NULL) + { + return E_INVALIDARG; + } + + // Clip the rectangle against the object position + RECT rcI = { 0, 0, 0, 0 }; + IntersectRect(&rcI, &m_rcObjectPos, prc); + *prc = rcI; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CControlSite::OnDefWindowMessage(/* [in] */ UINT msg, /* [in] */ WPARAM wParam, /* [in] */ LPARAM lParam, /* [out] */ LRESULT __RPC_FAR *plResult) +{ + if (plResult == NULL) + { + return E_INVALIDARG; + } + + // Pass the message to the windowless control + if (m_bWindowless && m_spIOleInPlaceObjectWindowless) + { + return m_spIOleInPlaceObjectWindowless->OnWindowMessage(msg, wParam, lParam, plResult); + } + + return S_FALSE; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleControlSite implementation + + +HRESULT STDMETHODCALLTYPE CControlSite::OnControlInfoChanged(void) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::LockInPlaceActive(/* [in] */ BOOL fLock) +{ + m_bInPlaceLocked = fLock; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::GetExtendedControl(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords(/* [out][in] */ POINTL __RPC_FAR *pPtlHimetric, /* [out][in] */ POINTF __RPC_FAR *pPtfContainer, /* [in] */ DWORD dwFlags) +{ + HRESULT hr = S_OK; + + if (pPtlHimetric == NULL) + { + return E_INVALIDARG; + } + if (pPtfContainer == NULL) + { + return E_INVALIDARG; + } + + HDC hdc = ::GetDC(m_hWndParent); + ::SetMapMode(hdc, MM_HIMETRIC); + POINT rgptConvert[2]; + rgptConvert[0].x = 0; + rgptConvert[0].y = 0; + + if (dwFlags & XFORMCOORDS_HIMETRICTOCONTAINER) + { + rgptConvert[1].x = pPtlHimetric->x; + rgptConvert[1].y = pPtlHimetric->y; + ::LPtoDP(hdc, rgptConvert, 2); + if (dwFlags & XFORMCOORDS_SIZE) + { + pPtfContainer->x = (float)(rgptConvert[1].x - rgptConvert[0].x); + pPtfContainer->y = (float)(rgptConvert[0].y - rgptConvert[1].y); + } + else if (dwFlags & XFORMCOORDS_POSITION) + { + pPtfContainer->x = (float)rgptConvert[1].x; + pPtfContainer->y = (float)rgptConvert[1].y; + } + else + { + hr = E_INVALIDARG; + } + } + else if (dwFlags & XFORMCOORDS_CONTAINERTOHIMETRIC) + { + rgptConvert[1].x = (int)(pPtfContainer->x); + rgptConvert[1].y = (int)(pPtfContainer->y); + ::DPtoLP(hdc, rgptConvert, 2); + if (dwFlags & XFORMCOORDS_SIZE) + { + pPtlHimetric->x = rgptConvert[1].x - rgptConvert[0].x; + pPtlHimetric->y = rgptConvert[0].y - rgptConvert[1].y; + } + else if (dwFlags & XFORMCOORDS_POSITION) + { + pPtlHimetric->x = rgptConvert[1].x; + pPtlHimetric->y = rgptConvert[1].y; + } + else + { + hr = E_INVALIDARG; + } + } + else + { + hr = E_INVALIDARG; + } + + ::ReleaseDC(m_hWndParent, hdc); + + return hr; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::TranslateAccelerator(/* [in] */ MSG __RPC_FAR *pMsg, /* [in] */ DWORD grfModifiers) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::OnFocus(/* [in] */ BOOL fGotFocus) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSite::ShowPropertyFrame(void) +{ + return E_NOTIMPL; +} + diff --git a/mozilla/embedding/browser/activex/src/control/ControlSite.h b/mozilla/embedding/browser/activex/src/control/ControlSite.h new file mode 100644 index 00000000000..a5ed0725562 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ControlSite.h @@ -0,0 +1,301 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef CONTROLSITE_H +#define CONTROLSITE_H + +#include "IOleCommandTargetImpl.h" + +// If you created a class derived from CControlSite, use the following macro +// in the interface map of the derived class to include all the necessary +// interfaces. +#define CCONTROLSITE_INTERFACES() \ + COM_INTERFACE_ENTRY(IOleWindow) \ + COM_INTERFACE_ENTRY(IOleClientSite) \ + COM_INTERFACE_ENTRY(IOleInPlaceSite) \ + COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSite, IOleInPlaceSiteWindowless) \ + COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteEx, IOleInPlaceSiteWindowless) \ + COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteWindowless, IOleInPlaceSiteWindowless) \ + COM_INTERFACE_ENTRY(IOleControlSite) \ + COM_INTERFACE_ENTRY(IDispatch) \ + COM_INTERFACE_ENTRY_IID(IID_IAdviseSink, IAdviseSinkEx) \ + COM_INTERFACE_ENTRY_IID(IID_IAdviseSink2, IAdviseSinkEx) \ + COM_INTERFACE_ENTRY_IID(IID_IAdviseSinkEx, IAdviseSinkEx) \ + COM_INTERFACE_ENTRY(IOleCommandTarget) + + +// +// Class for hosting an ActiveX control +// +// This class supports both windowed and windowless classes. The normal +// steps to hosting a control are this: +// +// CControlSiteInstance *pSite = NULL; +// CControlSiteInstance::CreateInstance(&pSite); +// pSite->AddRef(); +// pSite->Create(clsidControlToCreate); +// pSite->Attach(hwndParentWindow, rcPosition); +// +// Where propertyList is a named list of values to initialise the new object +// with, hwndParentWindow is the window in which the control is being created, +// and rcPosition is the position in window coordinates where the control will +// be rendered. +// +// Destruction is this: +// +// pSite->Detach(); +// pSite->Release(); +// pSite = NULL; + +class CControlSite : public CComObjectRootEx, + public IOleClientSite, + public IOleInPlaceSiteWindowless, + public IOleControlSite, + public IAdviseSinkEx, + public IDispatch, + public IOleCommandTargetImpl +{ +protected: +// Site management values + // Handle to parent window + HWND m_hWndParent; + // Position of the site and the contained object + RECT m_rcObjectPos; + // Flag indicating if client site should be set early or late + unsigned m_bSetClientSiteFirst:1; + // Flag indicating whether control is visible or not + unsigned m_bVisibleAtRuntime:1; + // Flag indicating if control is in-place active + unsigned m_bInPlaceActive:1; + // Flag indicating if control is UI active + unsigned m_bUIActive:1; + // Flag indicating if control is in-place locked and cannot be deactivated + unsigned m_bInPlaceLocked:1; + // Flag indicating if the site allows windowless controls + unsigned m_bSupportWindowlessActivation:1; + // Flag indicating if control is windowless + unsigned m_bWindowless:1; + // Flag indicating if only safely scriptable controls are allowed + unsigned m_bSafeForScriptingObjectsOnly:1; + +// Pointers to object interfaces + // Raw pointer to the object + CComPtr m_spObject; + // Pointer to objects IViewObject interface + CComQIPtr m_spIViewObject; + // Pointer to object's IOleObject interface + CComQIPtr m_spIOleObject; + // Pointer to object's IOleInPlaceObject interface + CComQIPtr m_spIOleInPlaceObject; + // Pointer to object's IOleInPlaceObjectWindowless interface + CComQIPtr m_spIOleInPlaceObjectWindowless; + // Name of this control + tstring m_szName; + // CLSID of the control + CLSID m_clsid; + // Parameter list + PropertyList m_ParameterList; + +// Double buffer drawing variables used for windowless controls + // Area of buffer + RECT m_rcBuffer; + // Bitmap to buffer + HBITMAP m_hBMBuffer; + // Bitmap to buffer + HBITMAP m_hBMBufferOld; + // Device context + HDC m_hDCBuffer; + // Clipping area of site + HRGN m_hRgnBuffer; + // Flags indicating how the buffer was painted + DWORD m_dwBufferFlags; + +// Ambient properties + // Locale ID + LCID m_nAmbientLocale; + // Foreground colour + COLORREF m_clrAmbientForeColor; + // Background colour + COLORREF m_clrAmbientBackColor; + // Flag indicating if control should hatch itself + bool m_bAmbientShowHatching; + // Flag indicating if control should have grab handles + bool m_bAmbientShowGrabHandles; + // Flag indicating if control is in edit/user mode + bool m_bAmbientUserMode; + +protected: + // Notifies the attached control of a change to an ambient property + virtual void FireAmbientPropertyChange(DISPID id); + +public: +// Construction and destruction + // Constructor + CControlSite(); + // Destructor + virtual ~CControlSite(); + +BEGIN_COM_MAP(CControlSite) + CCONTROLSITE_INTERFACES() +END_COM_MAP() + +BEGIN_OLECOMMAND_TABLE() +END_OLECOMMAND_TABLE() + + // List of controls + static std::list m_cControlList; + + // Helper method + static HRESULT ClassImplementsCategory(const CLSID &clsid, const CATID &catid); + + // Returns the window used when processing ole commands + HWND GetCommandTargetWindow() + { + return NULL; // TODO + } + +// Object creation and management functions + // Creates and initialises an object + virtual HRESULT Create(REFCLSID clsid, PropertyList &pl = PropertyList(), const tstring szName = _T("")); + // Attaches the object to the site + virtual HRESULT Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream = NULL); + // Detaches the object from the site + virtual HRESULT Detach(); + // Returns the IUnknown pointer for the object + virtual HRESULT GetControlUnknown(IUnknown **ppObject); + // Sets the bounding rectangle for the object + virtual HRESULT SetPosition(const RECT &rcPos); + // Draws the object using the provided DC + virtual HRESULT Draw(HDC hdc); + // Performs the specified action on the object + virtual HRESULT DoVerb(LONG nVerb, LPMSG lpMsg = NULL); + // Sets an advise sink up for changes to the object + virtual HRESULT Advise(IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie); + // Removes an advise sink + virtual HRESULT Unadvise(const IID &iid, DWORD dwCookie); + +// Methods to set ambient properties + virtual void SetAmbientUserMode(BOOL bUser); + +// Inline helper methods + // Returns the object's CLSID + virtual const CLSID &GetObjectCLSID() const + { + return m_clsid; + } + // Returns the name of the object + virtual const tstring &GetObjectName() const + { + return m_szName; + } + // Tests if the object is valid or not + virtual BOOL IsObjectValid() const + { + return (m_spObject) ? TRUE : FALSE; + } + // Returns the parent window to this one + virtual HWND GetParentWindow() const + { + return m_hWndParent; + } + // Returns the inplace active state of the object + virtual BOOL IsInPlaceActive() const + { + return m_bInPlaceActive; + } + +// IDispatch + virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo); + virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); + +// IAdviseSink implementation + virtual /* [local] */ void STDMETHODCALLTYPE OnDataChange(/* [unique][in] */ FORMATETC __RPC_FAR *pFormatetc, /* [unique][in] */ STGMEDIUM __RPC_FAR *pStgmed); + virtual /* [local] */ void STDMETHODCALLTYPE OnViewChange(/* [in] */ DWORD dwAspect, /* [in] */ LONG lindex); + virtual /* [local] */ void STDMETHODCALLTYPE OnRename(/* [in] */ IMoniker __RPC_FAR *pmk); + virtual /* [local] */ void STDMETHODCALLTYPE OnSave(void); + virtual /* [local] */ void STDMETHODCALLTYPE OnClose(void); + +// IAdviseSink2 + virtual /* [local] */ void STDMETHODCALLTYPE OnLinkSrcChange(/* [unique][in] */ IMoniker __RPC_FAR *pmk); + +// IAdviseSinkEx implementation + virtual /* [local] */ void STDMETHODCALLTYPE OnViewStatusChange(/* [in] */ DWORD dwViewStatus); + +// IOleWindow implementation + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetWindow(/* [out] */ HWND __RPC_FAR *phwnd); + virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(/* [in] */ BOOL fEnterMode); + +// IOleClientSite implementation + virtual HRESULT STDMETHODCALLTYPE SaveObject(void); + virtual HRESULT STDMETHODCALLTYPE GetMoniker(/* [in] */ DWORD dwAssign, /* [in] */ DWORD dwWhichMoniker, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk); + virtual HRESULT STDMETHODCALLTYPE GetContainer(/* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer); + virtual HRESULT STDMETHODCALLTYPE ShowObject(void); + virtual HRESULT STDMETHODCALLTYPE OnShowWindow(/* [in] */ BOOL fShow); + virtual HRESULT STDMETHODCALLTYPE RequestNewObjectLayout(void); + +// IOleInPlaceSite implementation + virtual HRESULT STDMETHODCALLTYPE CanInPlaceActivate(void); + virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivate(void); + virtual HRESULT STDMETHODCALLTYPE OnUIActivate(void); + virtual HRESULT STDMETHODCALLTYPE GetWindowContext(/* [out] */ IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, /* [out] */ IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, /* [out] */ LPRECT lprcPosRect, /* [out] */ LPRECT lprcClipRect, /* [out][in] */ LPOLEINPLACEFRAMEINFO lpFrameInfo); + virtual HRESULT STDMETHODCALLTYPE Scroll(/* [in] */ SIZE scrollExtant); + virtual HRESULT STDMETHODCALLTYPE OnUIDeactivate(/* [in] */ BOOL fUndoable); + virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivate(void); + virtual HRESULT STDMETHODCALLTYPE DiscardUndoState(void); + virtual HRESULT STDMETHODCALLTYPE DeactivateAndUndo(void); + virtual HRESULT STDMETHODCALLTYPE OnPosRectChange(/* [in] */ LPCRECT lprcPosRect); + +// IOleInPlaceSiteEx implementation + virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivateEx(/* [out] */ BOOL __RPC_FAR *pfNoRedraw, /* [in] */ DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivateEx(/* [in] */ BOOL fNoRedraw); + virtual HRESULT STDMETHODCALLTYPE RequestUIActivate(void); + +// IOleInPlaceSiteWindowless implementation + virtual HRESULT STDMETHODCALLTYPE CanWindowlessActivate(void); + virtual HRESULT STDMETHODCALLTYPE GetCapture(void); + virtual HRESULT STDMETHODCALLTYPE SetCapture(/* [in] */ BOOL fCapture); + virtual HRESULT STDMETHODCALLTYPE GetFocus(void); + virtual HRESULT STDMETHODCALLTYPE SetFocus(/* [in] */ BOOL fFocus); + virtual HRESULT STDMETHODCALLTYPE GetDC(/* [in] */ LPCRECT pRect, /* [in] */ DWORD grfFlags, /* [out] */ HDC __RPC_FAR *phDC); + virtual HRESULT STDMETHODCALLTYPE ReleaseDC(/* [in] */ HDC hDC); + virtual HRESULT STDMETHODCALLTYPE InvalidateRect(/* [in] */ LPCRECT pRect, /* [in] */ BOOL fErase); + virtual HRESULT STDMETHODCALLTYPE InvalidateRgn(/* [in] */ HRGN hRGN, /* [in] */ BOOL fErase); + virtual HRESULT STDMETHODCALLTYPE ScrollRect(/* [in] */ INT dx, /* [in] */ INT dy, /* [in] */ LPCRECT pRectScroll, /* [in] */ LPCRECT pRectClip); + virtual HRESULT STDMETHODCALLTYPE AdjustRect(/* [out][in] */ LPRECT prc); + virtual HRESULT STDMETHODCALLTYPE OnDefWindowMessage(/* [in] */ UINT msg, /* [in] */ WPARAM wParam, /* [in] */ LPARAM lParam, /* [out] */ LRESULT __RPC_FAR *plResult); + +// IOleControlSite implementation + virtual HRESULT STDMETHODCALLTYPE OnControlInfoChanged(void); + virtual HRESULT STDMETHODCALLTYPE LockInPlaceActive(/* [in] */ BOOL fLock); + virtual HRESULT STDMETHODCALLTYPE GetExtendedControl(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + virtual HRESULT STDMETHODCALLTYPE TransformCoords(/* [out][in] */ POINTL __RPC_FAR *pPtlHimetric, /* [out][in] */ POINTF __RPC_FAR *pPtfContainer, /* [in] */ DWORD dwFlags); + virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ MSG __RPC_FAR *pMsg, /* [in] */ DWORD grfModifiers); + virtual HRESULT STDMETHODCALLTYPE OnFocus(/* [in] */ BOOL fGotFocus); + virtual HRESULT STDMETHODCALLTYPE ShowPropertyFrame( void); +}; + +typedef CComObject CControlSiteInstance; + + + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/ControlSiteIPFrame.cpp b/mozilla/embedding/browser/activex/src/control/ControlSiteIPFrame.cpp new file mode 100644 index 00000000000..3fb2f1fa335 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ControlSiteIPFrame.cpp @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" + + +CControlSiteIPFrame::CControlSiteIPFrame() +{ + m_hwndFrame = NULL; +} + + +CControlSiteIPFrame::~CControlSiteIPFrame() +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// IOleWindow implementation + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::GetWindow(/* [out] */ HWND __RPC_FAR *phwnd) +{ + if (phwnd == NULL) + { + return E_INVALIDARG; + } + *phwnd = m_hwndFrame; + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::ContextSensitiveHelp(/* [in] */ BOOL fEnterMode) +{ + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleInPlaceUIWindow implementation + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::GetBorder(/* [out] */ LPRECT lprectBorder) +{ + return INPLACE_E_NOTOOLSPACE; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::RequestBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths) +{ + return INPLACE_E_NOTOOLSPACE; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetActiveObject(/* [unique][in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [unique][string][in] */ LPCOLESTR pszObjName) +{ + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleInPlaceFrame implementation + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::InsertMenus(/* [in] */ HMENU hmenuShared, /* [out][in] */ LPOLEMENUGROUPWIDTHS lpMenuWidths) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetMenu(/* [in] */ HMENU hmenuShared, /* [in] */ HOLEMENU holemenu, /* [in] */ HWND hwndActiveObject) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::RemoveMenus(/* [in] */ HMENU hmenuShared) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetStatusText(/* [in] */ LPCOLESTR pszStatusText) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::EnableModeless(/* [in] */ BOOL fEnable) +{ + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::TranslateAccelerator(/* [in] */ LPMSG lpmsg, /* [in] */ WORD wID) +{ + return E_NOTIMPL; +} + diff --git a/mozilla/embedding/browser/activex/src/control/ControlSiteIPFrame.h b/mozilla/embedding/browser/activex/src/control/ControlSiteIPFrame.h new file mode 100644 index 00000000000..13231f16d03 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ControlSiteIPFrame.h @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef CONTROLSITEIPFRAME_H +#define CONTROLSITEIPFRAME_H + +class CControlSiteIPFrame : public CComObjectRootEx, + public IOleInPlaceFrame +{ +public: + CControlSiteIPFrame(); + virtual ~CControlSiteIPFrame(); + + HWND m_hwndFrame; + +BEGIN_COM_MAP(CControlSiteIPFrame) + COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleInPlaceFrame) + COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceUIWindow, IOleInPlaceFrame) + COM_INTERFACE_ENTRY(IOleInPlaceFrame) +END_COM_MAP() + + // IOleWindow + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetWindow(/* [out] */ HWND __RPC_FAR *phwnd); + virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(/* [in] */ BOOL fEnterMode); + + // IOleInPlaceUIWindow implementation + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetBorder(/* [out] */ LPRECT lprectBorder); + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE RequestBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths); + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths); + virtual HRESULT STDMETHODCALLTYPE SetActiveObject(/* [unique][in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [unique][string][in] */ LPCOLESTR pszObjName); + + // IOleInPlaceFrame implementation + virtual HRESULT STDMETHODCALLTYPE InsertMenus(/* [in] */ HMENU hmenuShared, /* [out][in] */ LPOLEMENUGROUPWIDTHS lpMenuWidths); + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetMenu(/* [in] */ HMENU hmenuShared, /* [in] */ HOLEMENU holemenu, /* [in] */ HWND hwndActiveObject); + virtual HRESULT STDMETHODCALLTYPE RemoveMenus(/* [in] */ HMENU hmenuShared); + virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetStatusText(/* [in] */ LPCOLESTR pszStatusText); + virtual HRESULT STDMETHODCALLTYPE EnableModeless(/* [in] */ BOOL fEnable); + virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ LPMSG lpmsg, /* [in] */ WORD wID); +}; + +typedef CComObject CControlSiteIPFrameInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/DHTMLCmdIds.h b/mozilla/embedding/browser/activex/src/control/DHTMLCmdIds.h new file mode 100644 index 00000000000..6f686a1b664 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/DHTMLCmdIds.h @@ -0,0 +1,97 @@ +#ifndef DHTMLCMDIDS_H +#define DHTMLCMDIDS_H + +#ifndef __mshtmcid_h__ +#define IDM_UNKNOWN 0 +#define IDM_ALIGNBOTTOM 1 +#define IDM_ALIGNHORIZONTALCENTERS 2 +#define IDM_ALIGNLEFT 3 +#define IDM_ALIGNRIGHT 4 +#define IDM_ALIGNTOGRID 5 +#define IDM_ALIGNTOP 6 +#define IDM_ALIGNVERTICALCENTERS 7 +#define IDM_ARRANGEBOTTOM 8 +#define IDM_ARRANGERIGHT 9 +#define IDM_BRINGFORWARD 10 +#define IDM_BRINGTOFRONT 11 +#define IDM_CENTERHORIZONTALLY 12 +#define IDM_CENTERVERTICALLY 13 +#define IDM_CODE 14 +#define IDM_DELETE 17 +#define IDM_FONTNAME 18 +#define IDM_FONTSIZE 19 +#define IDM_GROUP 20 +#define IDM_HORIZSPACECONCATENATE 21 +#define IDM_HORIZSPACEDECREASE 22 +#define IDM_HORIZSPACEINCREASE 23 +#define IDM_HORIZSPACEMAKEEQUAL 24 +#define IDM_INSERTOBJECT 25 +#define IDM_MULTILEVELREDO 30 +#define IDM_SENDBACKWARD 32 +#define IDM_SENDTOBACK 33 +#define IDM_SHOWTABLE 34 +#define IDM_SIZETOCONTROL 35 +#define IDM_SIZETOCONTROLHEIGHT 36 +#define IDM_SIZETOCONTROLWIDTH 37 +#define IDM_SIZETOFIT 38 +#define IDM_SIZETOGRID 39 +#define IDM_SNAPTOGRID 40 +#define IDM_TABORDER 41 +#define IDM_TOOLBOX 42 +#define IDM_MULTILEVELUNDO 44 +#define IDM_UNGROUP 45 +#define IDM_VERTSPACECONCATENATE 46 +#define IDM_VERTSPACEDECREASE 47 +#define IDM_VERTSPACEINCREASE 48 +#define IDM_VERTSPACEMAKEEQUAL 49 +#define IDM_JUSTIFYFULL 50 +#define IDM_BACKCOLOR 51 +#define IDM_BOLD 52 +#define IDM_BORDERCOLOR 53 +#define IDM_FLAT 54 +#define IDM_FORECOLOR 55 +#define IDM_ITALIC 56 +#define IDM_JUSTIFYCENTER 57 +#define IDM_JUSTIFYGENERAL 58 +#define IDM_JUSTIFYLEFT 59 +#define IDM_JUSTIFYRIGHT 60 +#define IDM_RAISED 61 +#define IDM_SUNKEN 62 +#define IDM_UNDERLINE 63 +#define IDM_CHISELED 64 +#define IDM_ETCHED 65 +#define IDM_SHADOWED 66 +#define IDM_FIND 67 +#define IDM_SHOWGRID 69 +#define IDM_OBJECTVERBLIST0 72 +#define IDM_OBJECTVERBLIST1 73 +#define IDM_OBJECTVERBLIST2 74 +#define IDM_OBJECTVERBLIST3 75 +#define IDM_OBJECTVERBLIST4 76 +#define IDM_OBJECTVERBLIST5 77 +#define IDM_OBJECTVERBLIST6 78 +#define IDM_OBJECTVERBLIST7 79 +#define IDM_OBJECTVERBLIST8 80 +#define IDM_OBJECTVERBLIST9 81 +#define IDM_OBJECTVERBLISTLAST IDM_OBJECTVERBLIST9 +#define IDM_CONVERTOBJECT 82 +#define IDM_CUSTOMCONTROL 83 +#define IDM_CUSTOMIZEITEM 84 +#define IDM_RENAME 85 +#define IDM_IMPORT 86 +#define IDM_NEWPAGE 87 +#define IDM_MOVE 88 +#define IDM_CANCEL 89 +#define IDM_FONT 90 +#define IDM_STRIKETHROUGH 91 +#define IDM_DELETEWORD 92 +#define IDM_EXECPRINT 93 +#define IDM_JUSTIFYNONE 94 + +#define IDM_BROWSEMODE 2126 +#define IDM_EDITMODE 2127 + +#endif + + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/DropTarget.cpp b/mozilla/embedding/browser/activex/src/control/DropTarget.cpp new file mode 100644 index 00000000000..ef0c920d8bf --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/DropTarget.cpp @@ -0,0 +1,277 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" + +#include +#include + +#include "DropTarget.h" + +#ifndef CFSTR_SHELLURL +#define CFSTR_SHELLURL _T("UniformResourceLocator") +#endif + +#ifndef CFSTR_FILENAME +#define CFSTR_FILENAME _T("FileName") +#endif + +#ifndef CFSTR_FILENAMEW +#define CFSTR_FILENAMEW _T("FileNameW") +#endif + +static const UINT g_cfURL = RegisterClipboardFormat(CFSTR_SHELLURL); +static const UINT g_cfFileName = RegisterClipboardFormat(CFSTR_FILENAME); +static const UINT g_cfFileNameW = RegisterClipboardFormat(CFSTR_FILENAMEW); + +CDropTarget::CDropTarget() +{ + m_pOwner = NULL; +} + + +CDropTarget::~CDropTarget() +{ +} + + +void CDropTarget::SetOwner(CMozillaBrowser *pOwner) +{ + m_pOwner = pOwner; +} + + +HRESULT CDropTarget::GetURLFromFile(const TCHAR *pszFile, tstring &szURL) +{ + USES_CONVERSION; + CIPtr(IUniformResourceLocator) spUrl; + + // Let's see if the file is an Internet Shortcut... + HRESULT hr = CoCreateInstance (CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, IID_IUniformResourceLocator, (void **) &spUrl); + if (spUrl == NULL) + { + return E_FAIL; + } + + // Get the IPersistFile interface + CIPtr(IPersistFile) spFile = spUrl; + if (spFile == NULL) + { + return E_FAIL; + } + + // Initialise the URL object from the filename + LPSTR lpTemp = NULL; + if (FAILED(spFile->Load(T2OLE(pszFile), STGM_READ)) || + FAILED(spUrl->GetURL(&lpTemp))) + { + return E_FAIL; + } + + // Free the memory + CIPtr(IMalloc) spMalloc; + if (FAILED(SHGetMalloc(&spMalloc))) + { + return E_FAIL; + } + + // Copy the URL & cleanup + szURL = A2T(lpTemp); + spMalloc->Free(lpTemp); + + return S_OK; +} + +/////////////////////////////////////////////////////////////////////////////// +// IDropTarget implementation + +HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect) +{ + if (pdwEffect == NULL || pDataObj == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + if (m_spDataObject != NULL) + { + NG_ASSERT(0); + return E_UNEXPECTED; + } + + // TODO process Internet Shortcuts (*.URL) files + FORMATETC formatetc; + memset(&formatetc, 0, sizeof(formatetc)); + formatetc.dwAspect = DVASPECT_CONTENT; + formatetc.lindex = -1; + formatetc.tymed = TYMED_HGLOBAL; + + // Test if the data object contains a text URL format + formatetc.cfFormat = g_cfURL; + if (pDataObj->QueryGetData(&formatetc) == S_OK) + { + m_spDataObject = pDataObj; + *pdwEffect = DROPEFFECT_LINK; + return S_OK; + } + + // Test if the data object contains a file name + formatetc.cfFormat = g_cfFileName; + if (pDataObj->QueryGetData(&formatetc) == S_OK) + { + m_spDataObject = pDataObj; + *pdwEffect = DROPEFFECT_LINK; + return S_OK; + } + + // Test if the data object contains a wide character file name + formatetc.cfFormat = g_cfFileName; + if (pDataObj->QueryGetData(&formatetc) == S_OK) + { + m_spDataObject = pDataObj; + *pdwEffect = DROPEFFECT_LINK; + return S_OK; + } + + // If we got here, then the format is not supported + *pdwEffect = DROPEFFECT_NONE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(/* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect) +{ + if (pdwEffect == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + *pdwEffect = m_spDataObject ? DROPEFFECT_LINK : DROPEFFECT_NONE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave(void) +{ + if (m_spDataObject) + { + m_spDataObject.Release(); + } + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CDropTarget::Drop(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect) +{ + if (pdwEffect == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + if (m_spDataObject == NULL) + { + *pdwEffect = DROPEFFECT_NONE; + return S_OK; + } + + *pdwEffect = DROPEFFECT_LINK; + + // Get the URL from the data object + BSTR bstrURL = NULL; + FORMATETC formatetc; + STGMEDIUM stgmedium; + memset(&formatetc, 0, sizeof(formatetc)); + memset(&stgmedium, 0, sizeof(formatetc)); + + formatetc.dwAspect = DVASPECT_CONTENT; + formatetc.lindex = -1; + formatetc.tymed = TYMED_HGLOBAL; + + // Does the data object contain a URL? + formatetc.cfFormat = g_cfURL; + if (m_spDataObject->GetData(&formatetc, &stgmedium) == S_OK) + { + NG_ASSERT(stgmedium.tymed == TYMED_HGLOBAL); + NG_ASSERT(stgmedium.hGlobal); + char *pszURL = (char *) GlobalLock(stgmedium.hGlobal); + NG_TRACE("URL \"%s\" dragged over control\n", pszURL); + // Browse to the URL + if (m_pOwner) + { + USES_CONVERSION; + bstrURL = SysAllocString(A2OLE(pszURL)); + } + GlobalUnlock(stgmedium.hGlobal); + goto finish; + } + + // Does the data object point to a file? + formatetc.cfFormat = g_cfFileName; + if (m_spDataObject->GetData(&formatetc, &stgmedium) == S_OK) + { + USES_CONVERSION; + NG_ASSERT(stgmedium.tymed == TYMED_HGLOBAL); + NG_ASSERT(stgmedium.hGlobal); + tstring szURL; + char *pszURLFile = (char *) GlobalLock(stgmedium.hGlobal); + NG_TRACE("File \"%s\" dragged over control\n", pszURLFile); + if (SUCCEEDED(GetURLFromFile(A2T(pszURLFile), szURL))) + { + bstrURL = SysAllocString(T2OLE(szURL.c_str())); + } + GlobalUnlock(stgmedium.hGlobal); + goto finish; + } + + // Does the data object point to a wide character file? + formatetc.cfFormat = g_cfFileName; + if (m_spDataObject->GetData(&formatetc, &stgmedium) == S_OK) + { + USES_CONVERSION; + NG_ASSERT(stgmedium.tymed == TYMED_HGLOBAL); + NG_ASSERT(stgmedium.hGlobal); + tstring szURL; + WCHAR *pszURLFile = (WCHAR *) GlobalLock(stgmedium.hGlobal); + NG_TRACE("File \"%s\" dragged over control\n", W2A(pszURLFile)); + if (SUCCEEDED(GetURLFromFile(W2T(pszURLFile), szURL))) + { + USES_CONVERSION; + bstrURL = SysAllocString(T2OLE(szURL.c_str())); + } + GlobalUnlock(stgmedium.hGlobal); + goto finish; + } + +finish: + // If we got a URL, browse there! + if (bstrURL) + { + m_pOwner->Navigate(bstrURL, NULL, NULL, NULL, NULL); + SysFreeString(bstrURL); + } + + ReleaseStgMedium(&stgmedium); + m_spDataObject.Release(); + + return S_OK; +} + diff --git a/mozilla/embedding/browser/activex/src/control/DropTarget.h b/mozilla/embedding/browser/activex/src/control/DropTarget.h new file mode 100644 index 00000000000..aec6423187a --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/DropTarget.h @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef DROPTARGET_H +#define DROPTARGET_H + +#include "MozillaBrowser.h" + +// Simple drop target implementation + +class CDropTarget : public CComObjectRootEx, + public IDropTarget +{ +public: + CDropTarget(); + virtual ~CDropTarget(); + +BEGIN_COM_MAP(CDropTarget) + COM_INTERFACE_ENTRY(IDropTarget) +END_COM_MAP() + + // Data object currently being dragged + CIPtr(IDataObject) m_spDataObject; + + // Owner of this object + CMozillaBrowser *m_pOwner; + + // Sets the owner of this object + void SetOwner(CMozillaBrowser *pOwner); + // Helper method to extract a URL from an internet shortcut file + HRESULT CDropTarget::GetURLFromFile(const TCHAR *pszFile, tstring &szURL); + +// IDropTarget + virtual HRESULT STDMETHODCALLTYPE DragEnter(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect); + virtual HRESULT STDMETHODCALLTYPE DragOver(/* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect); + virtual HRESULT STDMETHODCALLTYPE DragLeave(void); + virtual HRESULT STDMETHODCALLTYPE Drop(/* [unique][in] */ IDataObject __RPC_FAR *pDataObj, /* [in] */ DWORD grfKeyState, /* [in] */ POINTL pt, /* [out][in] */ DWORD __RPC_FAR *pdwEffect); +}; + +typedef CComObject CDropTargetInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlDocument.cpp b/mozilla/embedding/browser/activex/src/control/IEHtmlDocument.cpp new file mode 100644 index 00000000000..2b7231ccf64 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlDocument.cpp @@ -0,0 +1,810 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" +#include "IEHtmlDocument.h" +#include "IEHtmlElementCollection.h" +#include "MozillaBrowser.h" + +#include + +CIEHtmlDocument::CIEHtmlDocument() +{ + m_pParent = NULL; +} + + +CIEHtmlDocument::~CIEHtmlDocument() +{ +} + + +void CIEHtmlDocument::SetParent(CMozillaBrowser *parent) +{ + m_pParent = parent; +} + + +HRESULT CIEHtmlDocument::GetIDispatch(IDispatch **pDispatch) +{ + if (pDispatch == NULL) + { + return E_INVALIDARG; + } + + IDispatch *pDisp = (IDispatch *) this; + NG_ASSERT(pDisp); + pDisp->AddRef(); + *pDispatch = pDisp; + + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IHTMLDocument methods + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_Script(IDispatch __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + +/////////////////////////////////////////////////////////////////////////////// +// IHTMLDocument2 methods + +struct HtmlPos +{ + CIPtr(IHTMLElementCollection) m_cpCollection; + long m_nPos; + + HtmlPos(IHTMLElementCollection *pCol, long nPos) : + m_cpCollection(pCol), + m_nPos(nPos) + { + } +}; + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_all(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + // Validate parameters + if (p == NULL) + { + return E_INVALIDARG; + } + + *p = NULL; + + std::vector< CIPtr(IDispatch) > cNodeList; + + // Get all elements + CIEHtmlElementCollectionInstance *pCollection = NULL; + CIEHtmlElementCollection::CreateFromParentNode(this, (CIEHtmlElementCollection **) &pCollection, TRUE); + if (pCollection) + { + pCollection->AddRef(); + } + + *p = pCollection; + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_body(IHTMLElement __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_activeElement(IHTMLElement __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_images(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_applets(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_links(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_forms(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_anchors(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_title(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_title(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_scripts(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_designMode(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_designMode(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_selection(IHTMLSelectionObject __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_readyState(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_frames(IHTMLFramesCollection2 __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_embeds(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_plugins(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_alinkColor(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_alinkColor(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_bgColor(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_bgColor(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_fgColor(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fgColor(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_linkColor(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_linkColor(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_vlinkColor(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_vlinkColor(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_referrer(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_location(IHTMLLocation __RPC_FAR *__RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_lastModified(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_URL(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_URL(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_domain(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_domain(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_cookie(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_cookie(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_expando(VARIANT_BOOL v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_expando(VARIANT_BOOL __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_charset(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_charset(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_defaultCharset(BSTR v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_defaultCharset(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_mimeType(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileSize(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileCreatedDate(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileModifiedDate(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_fileUpdatedDate(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_security(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_protocol(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_nameProp(BSTR __RPC_FAR *p) +{ + *p = NULL; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::write(SAFEARRAY __RPC_FAR * psarray) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::writeln(SAFEARRAY __RPC_FAR * psarray) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::open(BSTR url, VARIANT name, VARIANT features, VARIANT replace, IDispatch __RPC_FAR *__RPC_FAR *pomWindowResult) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::close(void) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::clear(void) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::createElement(BSTR eTag, IHTMLElement __RPC_FAR *__RPC_FAR *newElem) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onhelp(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onhelp(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onclick(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onclick(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_ondblclick(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_ondblclick(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onkeyup(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onkeyup(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; + +} + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onkeydown(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onkeydown(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onkeypress(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onkeypress(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmouseup(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmouseup(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmousedown(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmousedown(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmousemove(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmousemove(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmouseout(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmouseout(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onmouseover(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onmouseover(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onreadystatechange(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onreadystatechange(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onafterupdate(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onafterupdate(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onrowexit(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onrowexit(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onrowenter(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onrowenter(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_ondragstart(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_ondragstart(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onselectstart(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onselectstart(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::elementFromPoint(long x, long y, IHTMLElement __RPC_FAR *__RPC_FAR *elementHit) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_parentWindow(IHTMLWindow2 __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_styleSheets(IHTMLStyleSheetsCollection __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onbeforeupdate(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onbeforeupdate(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::put_onerrorupdate(VARIANT v) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::get_onerrorupdate(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::toString(BSTR __RPC_FAR *String) +{ + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::createStyleSheet(BSTR bstrHref, long lIndex, IHTMLStyleSheet __RPC_FAR *__RPC_FAR *ppnewStyleSheet) +{ + return E_NOTIMPL; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleCommandTarget implementation + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText) +{ + HRESULT hr = E_NOTIMPL; + if(m_pParent) + { + hr = m_pParent->QueryStatus(pguidCmdGroup,cCmds,prgCmds,pCmdText); + } + return hr; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlDocument::Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) +{ + HRESULT hr = E_NOTIMPL; + if(m_pParent) + { + hr = m_pParent->Exec(pguidCmdGroup,nCmdID,nCmdexecopt,pvaIn,pvaOut); + } + return hr; +} + diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlDocument.h b/mozilla/embedding/browser/activex/src/control/IEHtmlDocument.h new file mode 100644 index 00000000000..62e7df33db8 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlDocument.h @@ -0,0 +1,172 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef IEHTMLDOCUMENT_H +#define IEHTMLDOCUMENT_H + +#include "IEHtmlNode.h" + +class CMozillaBrowser; + +class CIEHtmlDocument : public CIEHtmlNode, + public IDispatchImpl, + public IOleCommandTarget +{ +public: + CIEHtmlDocument(); +protected: + virtual ~CIEHtmlDocument(); + + // Pointer to browser that owns the document + CMozillaBrowser *m_pParent; +public: + virtual void SetParent(CMozillaBrowser *parent); + +BEGIN_COM_MAP(CIEHtmlDocument) + COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLDocument2) + COM_INTERFACE_ENTRY_IID(IID_IHTMLDocument, IHTMLDocument2) + COM_INTERFACE_ENTRY_IID(IID_IHTMLDocument2, IHTMLDocument2) + COM_INTERFACE_ENTRY(IOleCommandTarget) +END_COM_MAP() + + virtual HRESULT GetIDispatch(IDispatch **pDispatch); + + // IOleCommandTarget methods + virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText); + virtual HRESULT STDMETHODCALLTYPE Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut); + + // IHTMLDocument methods + virtual HRESULT STDMETHODCALLTYPE get_Script(IDispatch __RPC_FAR *__RPC_FAR *p); + + // IHTMLDocument2 methods + virtual HRESULT STDMETHODCALLTYPE get_all(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_body(IHTMLElement __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_activeElement(IHTMLElement __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_images(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_applets(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_links(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_forms(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_anchors(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_title(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_title(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_scripts(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_designMode(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_designMode(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_selection(IHTMLSelectionObject __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_readyState(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_frames(IHTMLFramesCollection2 __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_embeds(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_plugins(IHTMLElementCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_alinkColor(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_alinkColor(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_bgColor(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_bgColor(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_fgColor(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_fgColor(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_linkColor(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_linkColor(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_vlinkColor(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_vlinkColor(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_referrer(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_location(IHTMLLocation __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_lastModified(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_URL(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_URL(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_domain(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_domain(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_cookie(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_cookie(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_expando(VARIANT_BOOL v); + virtual HRESULT STDMETHODCALLTYPE get_expando(VARIANT_BOOL __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_charset(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_charset(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_defaultCharset(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_defaultCharset(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_mimeType(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_fileSize(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_fileCreatedDate(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_fileModifiedDate(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_fileUpdatedDate(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_security(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_protocol(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_nameProp(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE write(SAFEARRAY __RPC_FAR * psarray); + virtual HRESULT STDMETHODCALLTYPE writeln(SAFEARRAY __RPC_FAR * psarray); + virtual HRESULT STDMETHODCALLTYPE open(BSTR url, VARIANT name, VARIANT features, VARIANT replace, IDispatch __RPC_FAR *__RPC_FAR *pomWindowResult); + virtual HRESULT STDMETHODCALLTYPE close(void); + virtual HRESULT STDMETHODCALLTYPE clear(void); + virtual HRESULT STDMETHODCALLTYPE queryCommandSupported(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); + virtual HRESULT STDMETHODCALLTYPE queryCommandEnabled(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); + virtual HRESULT STDMETHODCALLTYPE queryCommandState(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); + virtual HRESULT STDMETHODCALLTYPE queryCommandIndeterm(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); + virtual HRESULT STDMETHODCALLTYPE queryCommandText(BSTR cmdID, BSTR __RPC_FAR *pcmdText); + virtual HRESULT STDMETHODCALLTYPE queryCommandValue(BSTR cmdID, VARIANT __RPC_FAR *pcmdValue); + virtual HRESULT STDMETHODCALLTYPE execCommand(BSTR cmdID, VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL __RPC_FAR *pfRet); + virtual HRESULT STDMETHODCALLTYPE execCommandShowHelp(BSTR cmdID, VARIANT_BOOL __RPC_FAR *pfRet); + virtual HRESULT STDMETHODCALLTYPE createElement(BSTR eTag, IHTMLElement __RPC_FAR *__RPC_FAR *newElem); + virtual HRESULT STDMETHODCALLTYPE put_onhelp(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onhelp(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onclick(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onclick(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondblclick(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondblclick(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onkeyup(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onkeyup(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onkeydown(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onkeydown(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onkeypress(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onkeypress(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmouseup(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmouseup(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmousedown(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmousedown(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmousemove(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmousemove(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmouseout(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmouseout(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmouseover(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmouseover(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onreadystatechange(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onreadystatechange(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onafterupdate(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onafterupdate(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onrowexit(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onrowexit(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onrowenter(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onrowenter(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondragstart(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondragstart(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onselectstart(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onselectstart(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE elementFromPoint(long x, long y, IHTMLElement __RPC_FAR *__RPC_FAR *elementHit); + virtual HRESULT STDMETHODCALLTYPE get_parentWindow(IHTMLWindow2 __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_styleSheets(IHTMLStyleSheetsCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onbeforeupdate(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onbeforeupdate(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onerrorupdate(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onerrorupdate(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String); + virtual HRESULT STDMETHODCALLTYPE createStyleSheet(BSTR bstrHref, long lIndex, IHTMLStyleSheet __RPC_FAR *__RPC_FAR *ppnewStyleSheet); +}; + +typedef CComObject CIEHtmlDocumentInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlElement.cpp b/mozilla/embedding/browser/activex/src/control/IEHtmlElement.cpp new file mode 100644 index 00000000000..8cec4cf5db5 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlElement.cpp @@ -0,0 +1,688 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" + +#include "IEHtmlElement.h" +#include "IEHtmlElementCollection.h" + +CIEHtmlElement::CIEHtmlElement() +{ +} + + +CIEHtmlElement::~CIEHtmlElement() +{ +} + + +HRESULT CIEHtmlElement::GetIDispatch(IDispatch **pDispatch) +{ + if (pDispatch == NULL) + { + return E_INVALIDARG; + } + return QueryInterface(IID_IDispatch, (void **) pDispatch); +} + + +HRESULT CIEHtmlElement::GetChildren(CIEHtmlElementCollectionInstance **ppCollection) +{ + // Validate parameters + if (ppCollection == NULL) + { + return E_INVALIDARG; + } + + *ppCollection = NULL; + + // Create a collection representing the children of this node + CIEHtmlElementCollectionInstance *pCollection = NULL; + CIEHtmlElementCollection::CreateFromParentNode(this, (CIEHtmlElementCollection **) &pCollection); + if (pCollection) + { + pCollection->AddRef(); + *ppCollection = pCollection; + } + + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IHTMLElement implementation + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::setAttribute(BSTR strAttributeName, VARIANT AttributeValue, LONG lFlags) +{ + if (strAttributeName == NULL) + { + return E_INVALIDARG; + } + + // Get the name from the BSTR + USES_CONVERSION; + nsString szName = OLE2W(strAttributeName); + + // Get the value from the variant + CComVariant vValue; + if (FAILED(vValue.ChangeType(VT_BSTR, &AttributeValue))) + { + return E_INVALIDARG; + } + nsString szValue = OLE2W(vValue.bstrVal); + + nsIDOMElement *pIDOMElement = nsnull; + if (FAILED(GetDOMElement(&pIDOMElement))) + { + return E_UNEXPECTED; + } + + // Set the attribute + pIDOMElement->SetAttribute(szName, szValue); + pIDOMElement->Release(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::getAttribute(BSTR strAttributeName, LONG lFlags, VARIANT __RPC_FAR *AttributeValue) +{ + if (strAttributeName == NULL) + { + return E_INVALIDARG; + } + if (AttributeValue == NULL) + { + return E_INVALIDARG; + } + VariantInit(AttributeValue); + + // Get the name from the BSTR + USES_CONVERSION; + nsString szName = OLE2W(strAttributeName); + + nsIDOMElement *pIDOMElement = nsnull; + if (FAILED(GetDOMElement(&pIDOMElement))) + { + return E_UNEXPECTED; + } + + BOOL bCaseSensitive = (lFlags == VARIANT_TRUE) ? TRUE : FALSE; + + nsString szValue; + + // Get the attribute + nsresult nr = pIDOMElement->GetAttribute(szName, szValue); + pIDOMElement->Release(); + + if (nr == NS_OK) + { + USES_CONVERSION; + AttributeValue->vt = VT_BSTR; + AttributeValue->bstrVal = SysAllocString(W2COLE(szValue.GetUnicode())); + return S_OK; + } + else + { + return S_FALSE; + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::removeAttribute(BSTR strAttributeName, LONG lFlags, VARIANT_BOOL __RPC_FAR *pfSuccess) +{ + if (strAttributeName == NULL) + { + return E_INVALIDARG; + } + + nsIDOMElement *pIDOMElement = nsnull; + if (FAILED(GetDOMElement(&pIDOMElement))) + { + return E_UNEXPECTED; + } + + BOOL bCaseSensitive = (lFlags == VARIANT_TRUE) ? TRUE : FALSE; + + // Get the name from the BSTR + USES_CONVERSION; + nsString szName = OLE2W(strAttributeName); + + // Remove the attribute + nsresult nr = pIDOMElement->RemoveAttribute(szName); + BOOL bRemoved = (nr == NS_OK) ? TRUE : FALSE; + pIDOMElement->Release(); + + if (pfSuccess) + { + *pfSuccess = (bRemoved) ? VARIANT_TRUE : VARIANT_FALSE; + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_className(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_className(BSTR __RPC_FAR *p) +{ + if (p == NULL) + { + return E_INVALIDARG; + } + + VARIANT vValue; + VariantInit(&vValue); + BSTR bstrName = SysAllocString(OLESTR("class")); + getAttribute(bstrName, FALSE, &vValue); + SysFreeString(bstrName); + + *p = vValue.bstrVal; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_id(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_id(BSTR __RPC_FAR *p) +{ + if (p == NULL) + { + return E_INVALIDARG; + } + + VARIANT vValue; + VariantInit(&vValue); + BSTR bstrName = SysAllocString(OLESTR("id")); + getAttribute(bstrName, FALSE, &vValue); + SysFreeString(bstrName); + + *p = vValue.bstrVal; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_tagName(BSTR __RPC_FAR *p) +{ + if (p == NULL) + { + return E_INVALIDARG; + } + + nsIDOMElement *pIDOMElement = nsnull; + if (FAILED(GetDOMElement(&pIDOMElement))) + { + return E_UNEXPECTED; + } + + nsString szTagName; + pIDOMElement->GetTagName(szTagName); + pIDOMElement->Release(); + + USES_CONVERSION; + *p = SysAllocString(W2COLE(szTagName.GetUnicode())); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *p) +{ + if (p == NULL) + { + return E_INVALIDARG; + } + + *p = NULL; + if (m_pIDispParent) + { + m_pIDispParent->QueryInterface(IID_IHTMLElement, (void **) p); + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_style(IHTMLStyle __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onhelp(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onhelp(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onclick(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onclick(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondblclick(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondblclick(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onkeydown(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onkeydown(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onkeyup(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onkeyup(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onkeypress(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onkeypress(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmouseout(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmouseout(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmouseover(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmouseover(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmousemove(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmousemove(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmousedown(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmousedown(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onmouseup(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onmouseup(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_document(IDispatch __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_title(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_title(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_language(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_language(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onselectstart(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onselectstart(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::scrollIntoView(VARIANT varargStart) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::contains(IHTMLElement __RPC_FAR *pChild, VARIANT_BOOL __RPC_FAR *pfResult) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_sourceIndex(long __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_recordNumber(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_lang(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_lang(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetLeft(long __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetTop(long __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetWidth(long __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetHeight(long __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetParent(IHTMLElement __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_innerHTML(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_innerHTML(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_innerText(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_innerText(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_outerHTML(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_outerHTML(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_outerText(BSTR v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_outerText(BSTR __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::insertAdjacentHTML(BSTR where, BSTR html) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::insertAdjacentText(BSTR where, BSTR text) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_parentTextEdit(IHTMLElement __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_isTextEdit(VARIANT_BOOL __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::click(void) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_filters(IHTMLFiltersCollection __RPC_FAR *__RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondragstart(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondragstart(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::toString(BSTR __RPC_FAR *String) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onbeforeupdate(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onbeforeupdate(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onafterupdate(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onafterupdate(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onerrorupdate(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onerrorupdate(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onrowexit(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onrowexit(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onrowenter(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onrowenter(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondatasetchanged(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondatasetchanged(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondataavailable(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondataavailable(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_ondatasetcomplete(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_ondatasetcomplete(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_onfilterchange(VARIANT v) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_onfilterchange(VARIANT __RPC_FAR *p) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_children(IDispatch __RPC_FAR *__RPC_FAR *p) +{ + // Validate parameters + if (p == NULL) + { + return E_INVALIDARG; + } + + *p = NULL; + + // Create a collection representing the children of this node + CIEHtmlElementCollectionInstance *pCollection = NULL; + HRESULT hr = GetChildren(&pCollection); + if (SUCCEEDED(hr)) + { + *p = pCollection; + } + + return hr; +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_all(IDispatch __RPC_FAR *__RPC_FAR *p) +{ + // Validate parameters + if (p == NULL) + { + return E_INVALIDARG; + } + + *p = NULL; + + // TODO get ALL contained elements, not just the immediate children + + CIEHtmlElementCollectionInstance *pCollection = NULL; + CIEHtmlElementCollection::CreateFromParentNode(this, (CIEHtmlElementCollection **) &pCollection); + if (pCollection) + { + pCollection->AddRef(); + *p = pCollection; + } + + return S_OK; +} + diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlElement.h b/mozilla/embedding/browser/activex/src/control/IEHtmlElement.h new file mode 100644 index 00000000000..5839067981c --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlElement.h @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef IEHTMLELEMENT_H +#define IEHTMLELEMENT_H + +#include "IEHtmlNode.h" +#include "IEHtmlElementCollection.h" + +class CIEHtmlElement : public CIEHtmlNode, + public IDispatchImpl +{ +public: + CIEHtmlElement(); +protected: + virtual ~CIEHtmlElement(); + +public: + +BEGIN_COM_MAP(CIEHtmlElement) + COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLElement) + COM_INTERFACE_ENTRY_IID(IID_IHTMLElement, IHTMLElement) +END_COM_MAP() + + virtual HRESULT GetIDispatch(IDispatch **pDispatch); + virtual HRESULT GetChildren(CIEHtmlElementCollectionInstance **ppCollection); + + // Implementation of IHTMLElement + virtual HRESULT STDMETHODCALLTYPE setAttribute(BSTR strAttributeName, VARIANT AttributeValue, LONG lFlags); + virtual HRESULT STDMETHODCALLTYPE getAttribute(BSTR strAttributeName, LONG lFlags, VARIANT __RPC_FAR *AttributeValue); + virtual HRESULT STDMETHODCALLTYPE removeAttribute(BSTR strAttributeName, LONG lFlags, VARIANT_BOOL __RPC_FAR *pfSuccess); + virtual HRESULT STDMETHODCALLTYPE put_className(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_className(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_id(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_id(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_tagName(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_style(IHTMLStyle __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onhelp(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onhelp(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onclick(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onclick(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondblclick(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondblclick(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onkeydown(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onkeydown(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onkeyup(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onkeyup(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onkeypress(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onkeypress(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmouseout(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmouseout(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmouseover(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmouseover(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmousemove(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmousemove(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmousedown(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmousedown(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onmouseup(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onmouseup(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_document(IDispatch __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_title(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_title(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_language(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_language(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onselectstart(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onselectstart(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE scrollIntoView(VARIANT varargStart); + virtual HRESULT STDMETHODCALLTYPE contains(IHTMLElement __RPC_FAR *pChild, VARIANT_BOOL __RPC_FAR *pfResult); + virtual HRESULT STDMETHODCALLTYPE get_sourceIndex(long __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_recordNumber(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_lang(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_lang(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_offsetLeft(long __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_offsetTop(long __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_offsetWidth(long __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_offsetHeight(long __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_offsetParent(IHTMLElement __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_innerHTML(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_innerHTML(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_innerText(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_innerText(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_outerHTML(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_outerHTML(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_outerText(BSTR v); + virtual HRESULT STDMETHODCALLTYPE get_outerText(BSTR __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE insertAdjacentHTML(BSTR where, BSTR html); + virtual HRESULT STDMETHODCALLTYPE insertAdjacentText(BSTR where, BSTR text); + virtual HRESULT STDMETHODCALLTYPE get_parentTextEdit(IHTMLElement __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_isTextEdit(VARIANT_BOOL __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE click(void); + virtual HRESULT STDMETHODCALLTYPE get_filters(IHTMLFiltersCollection __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondragstart(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondragstart(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String); + virtual HRESULT STDMETHODCALLTYPE put_onbeforeupdate(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onbeforeupdate(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onafterupdate(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onafterupdate(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onerrorupdate(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onerrorupdate(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onrowexit(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onrowexit(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onrowenter(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onrowenter(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondatasetchanged(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondatasetchanged(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondataavailable(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondataavailable(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_ondatasetcomplete(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_ondatasetcomplete(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE put_onfilterchange(VARIANT v); + virtual HRESULT STDMETHODCALLTYPE get_onfilterchange(VARIANT __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_children(IDispatch __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get_all(IDispatch __RPC_FAR *__RPC_FAR *p); +}; + +#define CIEHTMLELEMENT_INTERFACES \ + COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLElement) \ + COM_INTERFACE_ENTRY_IID(IID_IHTMLElement, IHTMLElement) + +typedef CComObject CIEHtmlElementInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlElementCollection.cpp b/mozilla/embedding/browser/activex/src/control/IEHtmlElementCollection.cpp new file mode 100644 index 00000000000..ab6926bebb8 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlElementCollection.cpp @@ -0,0 +1,356 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" + +#include + +#include "IEHtmlElement.h" +#include "IEHtmlElementCollection.h" + +CIEHtmlElementCollection::CIEHtmlElementCollection() +{ + m_pIDispParent = NULL; +} + +CIEHtmlElementCollection::~CIEHtmlElementCollection() +{ +} + +HRESULT CIEHtmlElementCollection::SetParentNode(IDispatch *pIDispParent) +{ + m_pIDispParent = pIDispParent; + return S_OK; +} + + +struct NodeListPos +{ + nsIDOMNodeList *m_pIDOMNodeList; + PRUint32 m_nListPos; + + NodeListPos(nsIDOMNodeList *pIDOMNodeList, PRUint32 nListPos) : + m_pIDOMNodeList(pIDOMNodeList), + m_nListPos(nListPos) + { + } + + NodeListPos() + { + }; +}; + + +HRESULT CIEHtmlElementCollection::PopulateFromDOMNode(nsIDOMNode *pIDOMNode, BOOL bRecurseChildren) +{ + if (pIDOMNode == nsnull) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + // Get elements from the DOM node + nsIDOMNodeList *pNodeList = nsnull; + pIDOMNode->GetChildNodes(&pNodeList); + if (pNodeList == nsnull) + { + return S_OK; + } + + // Recurse through the children of the node (and the children of that) + // to populate the collection + + std::stack< NodeListPos > cNodeStack; + cNodeStack.push(NodeListPos(pNodeList, 0)); + while (!cNodeStack.empty()) + { + // Pop an item from the stack + NodeListPos pos = cNodeStack.top(); + cNodeStack.pop(); + + // Iterate through items in list + PRUint32 aLength = 0; + pNodeList = pos.m_pIDOMNodeList; + pNodeList->GetLength(&aLength); + for (PRUint32 i = pos.m_nListPos; i < aLength; i++) + { + // Get the next item from the list + nsIDOMNode *pChildNode = nsnull; + pNodeList->Item(i, &pChildNode); + if (pChildNode == nsnull) + { + // Empty node (unexpected, but try and carry on anyway) + NG_ASSERT(0); + continue; + } + + // Create an equivalent IE element + CIEHtmlElementInstance *pElement = NULL; + CIEHtmlElementInstance::CreateInstance(&pElement); + if (pElement) + { + pElement->SetDOMNode(pChildNode); + pElement->SetParentNode(m_pIDispParent); + AddNode(pElement); + } + + if (bRecurseChildren) + { + // Test if the node has children and pop them onto the stack too + nsIDOMNodeList *pChildNodeList = nsnull; + pChildNode->GetChildNodes(&pChildNodeList); + if (pChildNodeList) + { + // Push the child collection onto the stack + cNodeStack.push(NodeListPos(pChildNodeList, 0)); + // Push the current position onto the stack ( if necessary ) + if (i + 1 < aLength) + { + pNodeList->AddRef(); + cNodeStack.push(NodeListPos(pNodeList, i + 1)); + } + break; + } + } + + // Cleanup for next iteration + pChildNode->Release(); + } + + // Cleanup for next iteration + pNodeList->Release(); + } + + return S_OK; +} + + +HRESULT CIEHtmlElementCollection::CreateFromParentNode(CIEHtmlNode *pParentNode, CIEHtmlElementCollection **pInstance, BOOL bRecurseChildren) +{ + if (pInstance == NULL || pParentNode == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + // Get the DOM node from the parent node + nsIDOMNode *pIDOMNode = nsnull; + pParentNode->GetDOMNode(&pIDOMNode); + if (pIDOMNode == nsnull) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + *pInstance = NULL; + + // Create a collection object + CIEHtmlElementCollectionInstance *pCollection = NULL; + CIEHtmlElementCollectionInstance::CreateInstance(&pCollection); + if (pCollection == NULL) + { + NG_ASSERT(0); + return E_OUTOFMEMORY; + } + + // Initialise and populate the collection + CIPtr(IDispatch) cpDispNode; + pParentNode->GetIDispatch(&cpDispNode); + pCollection->SetParentNode(cpDispNode); + pCollection->PopulateFromDOMNode(pIDOMNode, bRecurseChildren); + + pIDOMNode->Release(); + + *pInstance = pCollection; + + return S_OK; +} + + +HRESULT CIEHtmlElementCollection::AddNode(IDispatch *pNode) +{ + if (pNode == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + m_cNodeList.push_back(pNode); + + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IHTMLElementCollection methods + + +HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::toString(BSTR __RPC_FAR *String) +{ + if (String == NULL) + { + return E_INVALIDARG; + } + *String = SysAllocString(OLESTR("ElementCollection")); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::put_length(long v) +{ + // What is the point of this method? + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::get_length(long __RPC_FAR *p) +{ + if (p == NULL) + { + return E_INVALIDARG; + } + + // Return the size of the collection + *p = m_cNodeList.size(); + return S_OK; +} + +typedef CComObject > > CComEnumVARIANT; + +HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p) +{ + if (p == NULL) + { + return E_INVALIDARG; + } + + *p = NULL; + + // Create a new IEnumVARIANT object + CComEnumVARIANT *pEnumVARIANT = NULL; + CComEnumVARIANT::CreateInstance(&pEnumVARIANT); + if (pEnumVARIANT == NULL) + { + NG_ASSERT(0); + return E_OUTOFMEMORY; + } + + int nObject; + int nObjects = m_cNodeList.size(); + + // Create an array of VARIANTs + VARIANT *avObjects = new VARIANT[nObjects]; + if (avObjects == NULL) + { + NG_ASSERT(0); + return E_OUTOFMEMORY; + } + + // Copy the contents of the collection to the array + for (nObject = 0; nObject < nObjects; nObject++) + { + VARIANT *pVariant = &avObjects[nObject]; + IUnknown *pUnkObject = m_cNodeList[nObject]; + VariantInit(pVariant); + pVariant->vt = VT_UNKNOWN; + pVariant->punkVal = pUnkObject; + pUnkObject->AddRef(); + } + + // Copy the variants to the enumeration object + pEnumVARIANT->Init(&avObjects[0], &avObjects[nObjects], NULL, AtlFlagCopy); + + // Cleanup the array + for (nObject = 0; nObject < nObjects; nObject++) + { + VARIANT *pVariant = &avObjects[nObject]; + VariantClear(pVariant); + } + delete []avObjects; + + return pEnumVARIANT->QueryInterface(IID_IUnknown, (void**) p); +} + + +HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::item(VARIANT name, VARIANT index, IDispatch __RPC_FAR *__RPC_FAR *pdisp) +{ + if (pdisp == NULL) + { + return E_INVALIDARG; + } + + *pdisp = NULL; + + // Note: parameter "name" contains the index unless its a string + // in which case index does. Sensible huh? + + CComVariant vIndex; + if (SUCCEEDED(vIndex.ChangeType(VT_I4, &name)) || + SUCCEEDED(vIndex.ChangeType(VT_I4, &index))) + { + // Test for stupid values + int nIndex = vIndex.lVal; + if (nIndex < 0 || nIndex >= m_cNodeList.size()) + { + return E_INVALIDARG; + } + + *pdisp = NULL; + IDispatch *pNode = m_cNodeList[nIndex]; + if (pNode == NULL) + { + NG_ASSERT(0); + return E_UNEXPECTED; + } + + pNode->QueryInterface(IID_IDispatch, (void **) pdisp); + return S_OK; + } + else if (SUCCEEDED(vIndex.ChangeType(VT_BSTR, &index))) + { + // If this parameter contains a string, the method returns + // a collection of objects, where the value of the name or + // id property for each object is equal to the string. + + // TODO all of the above! + return E_NOTIMPL; + } + else + { + return E_INVALIDARG; + } +} + +HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::tags(VARIANT tagName, IDispatch __RPC_FAR *__RPC_FAR *pdisp) +{ + if (pdisp == NULL) + { + return E_INVALIDARG; + } + + *pdisp = NULL; + + // TODO + // iterate through collection looking for elements with matching tags + + return E_NOTIMPL; +} + diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlElementCollection.h b/mozilla/embedding/browser/activex/src/control/IEHtmlElementCollection.h new file mode 100644 index 00000000000..f6de7a4f23d --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlElementCollection.h @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef IEHTMLNODECOLLECTION_H +#define IEHTMLNODECOLLECTION_H + +#include "IEHtmlNode.h" + +class CIEHtmlElement; + + + +class CIEHtmlElementCollection : public CComObjectRootEx, + public IDispatchImpl +{ +public: + typedef std::vector< CIPtr(IDispatch) > ElementList; + +private: + ElementList m_cNodeList; + +public: + CIEHtmlElementCollection(); + +protected: + virtual ~CIEHtmlElementCollection(); + + // Pointer to parent node/document + IDispatch *m_pIDispParent; + +public: + // Adds a node to the collection + virtual HRESULT AddNode(IDispatch *pNode); + + // Sets the parent node of this collection + virtual HRESULT SetParentNode(IDispatch *pIDispParent); + + // Populates the collection with items from the DOM node + virtual HRESULT PopulateFromDOMNode(nsIDOMNode *pIDOMNode, BOOL bRecurseChildren); + + // Helper method creates a collection from a parent node + static HRESULT CreateFromParentNode(CIEHtmlNode *pParentNode, CIEHtmlElementCollection **pInstance, BOOL bRecurseChildren = FALSE); + + + ElementList &GetElements() + { + return m_cNodeList; + } + +BEGIN_COM_MAP(CIEHtmlElementCollection) + COM_INTERFACE_ENTRY_IID(IID_IDispatch, IHTMLElementCollection) + COM_INTERFACE_ENTRY_IID(IID_IHTMLElementCollection, IHTMLElementCollection) +END_COM_MAP() + + // IHTMLElementCollection methods + virtual HRESULT STDMETHODCALLTYPE toString(BSTR __RPC_FAR *String); + virtual HRESULT STDMETHODCALLTYPE put_length(long v); + virtual HRESULT STDMETHODCALLTYPE get_length(long __RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p); + virtual HRESULT STDMETHODCALLTYPE item(VARIANT name, VARIANT index, IDispatch __RPC_FAR *__RPC_FAR *pdisp); + virtual HRESULT STDMETHODCALLTYPE tags(VARIANT tagName, IDispatch __RPC_FAR *__RPC_FAR *pdisp); +}; + +typedef CComObject CIEHtmlElementCollectionInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlNode.cpp b/mozilla/embedding/browser/activex/src/control/IEHtmlNode.cpp new file mode 100644 index 00000000000..ace3d0aef8d --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlNode.cpp @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" +#include "IEHtmlNode.h" + +CIEHtmlNode::CIEHtmlNode() +{ + m_pIDOMNode = nsnull; + m_pIDispParent = NULL; +} + +CIEHtmlNode::~CIEHtmlNode() +{ + SetDOMNode(nsnull); +} + +HRESULT CIEHtmlNode::SetParentNode(IDispatch *pIDispParent) +{ + m_pIDispParent = pIDispParent; + return S_OK; +} + +HRESULT CIEHtmlNode::SetDOMNode(nsIDOMNode *pIDOMNode) +{ + if (m_pIDOMNode) + { + m_pIDOMNode->Release(); + m_pIDOMNode = nsnull; + } + + if (pIDOMNode) + { + m_pIDOMNode = pIDOMNode; + m_pIDOMNode->AddRef(); + } + + return S_OK; +} + +HRESULT CIEHtmlNode::GetDOMNode(nsIDOMNode **pIDOMNode) +{ + if (pIDOMNode == NULL) + { + return E_INVALIDARG; + } + + *pIDOMNode = nsnull; + if (m_pIDOMNode) + { + m_pIDOMNode->AddRef(); + *pIDOMNode = m_pIDOMNode; + } + + return S_OK; +} + +HRESULT CIEHtmlNode::GetDOMElement(nsIDOMElement **pIDOMElement) +{ + if (pIDOMElement == NULL) + { + return E_INVALIDARG; + } + + if (m_pIDOMNode == nsnull) + { + return E_NOINTERFACE; + } + + *pIDOMElement = nsnull; + m_pIDOMNode->QueryInterface(kIDOMElementIID, (void **) pIDOMElement); + return (*pIDOMElement) ? S_OK : E_NOINTERFACE; +} + +HRESULT CIEHtmlNode::GetIDispatch(IDispatch **pDispatch) +{ + if (pDispatch == NULL) + { + return E_INVALIDARG; + } + + *pDispatch = NULL; + return E_NOINTERFACE; +} diff --git a/mozilla/embedding/browser/activex/src/control/IEHtmlNode.h b/mozilla/embedding/browser/activex/src/control/IEHtmlNode.h new file mode 100644 index 00000000000..f94c2e2abd4 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IEHtmlNode.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef IEHTMLNODE_H +#define IEHTMLNODE_H + +class CIEHtmlNode : public CComObjectRootEx +{ +protected: + nsIDOMNode *m_pIDOMNode; + IDispatch *m_pIDispParent; + +public: + CIEHtmlNode(); +protected: + virtual ~CIEHtmlNode(); + +public: + virtual HRESULT SetDOMNode(nsIDOMNode *pIDOMNode); + virtual HRESULT GetDOMNode(nsIDOMNode **pIDOMNode); + virtual HRESULT GetDOMElement(nsIDOMElement **pIDOMElement); + virtual HRESULT SetParentNode(IDispatch *pIDispParent); + virtual HRESULT GetIDispatch(IDispatch **pDispatch); +}; + +typedef CComObject CIEHtmlNodeInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/IOleCommandTargetImpl.h b/mozilla/embedding/browser/activex/src/control/IOleCommandTargetImpl.h new file mode 100644 index 00000000000..f927478125d --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/IOleCommandTargetImpl.h @@ -0,0 +1,272 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef IOLECOMMANDIMPL_H +#define IOLECOMMANDIMPL_H + +// Implementation of the IOleCommandTarget interface. The template is +// reasonably generic and reusable which is a good thing given how needlessly +// complicated this interface is. Blame Microsoft for that and not me. +// +// To use this class, derive your class from it like this: +// +// class CComMyClass : public IOleCommandTargetImpl +// { +// ... Ensure IOleCommandTarget is listed in the interface map ... +// BEGIN_COM_MAP(CComMyClass) +// COM_INTERFACE_ENTRY(IOleCommandTarget) +// // etc. +// END_COM_MAP() +// ... And then later on define the command target table ... +// BEGIN_OLECOMMAND_TABLE() +// OLECOMMAND_MESSAGE(OLECMDID_PRINT, NULL, ID_PRINT, L"Print", L"Print the page") +// OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, 0, L"SaveAs", L"Save the page") +// OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML, EditModeHandler, L"EditMode", L"Switch to edit mode") +// END_OLECOMMAND_TABLE() +// ... Now the window that OLECOMMAND_MESSAGE sends WM_COMMANDs to ... +// HWND GetCommandTargetWindow() const +// { +// return m_hWnd; +// } +// ... Now procedures that OLECOMMAND_HANDLER calls ... +// static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); +// } +// +// The command table defines which commands the object supports. Commands are +// defined by a command id and a command group plus a WM_COMMAND id or procedure, +// and a verb and short description. +// +// Notice that there are two macros for handling Ole Commands. The first, +// OLECOMMAND_MESSAGE sends a WM_COMMAND message to the window returned from +// GetCommandTargetWindow() (that the derived class must implement if it uses +// this macro). +// +// The second, OLECOMMAND_HANDLER calls a static handler procedure that +// conforms to the OleCommandProc typedef. The first parameter, pThis means +// the static handler has access to the methods and variables in the class +// instance. +// +// The OLECOMMAND_HANDLER macro is generally more useful when a command +// takes parameters or needs to return a result to the caller. +// +template< class T > +class IOleCommandTargetImpl : public IOleCommandTarget +{ + struct OleExecData + { + const GUID *pguidCmdGroup; + DWORD nCmdID; + DWORD nCmdexecopt; + VARIANT *pvaIn; + VARIANT *pvaOut; + }; + +public: + typedef HRESULT (_stdcall *OleCommandProc)(T *pT, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); + + struct OleCommandInfo + { + ULONG nCmdID; + const GUID *pCmdGUID; + ULONG nWindowsCmdID; + OleCommandProc pfnCommandProc; + wchar_t *szVerbText; + wchar_t *szStatusText; + }; + + // Query the status of the specified commands (test if is it supported etc.) + virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText) + { + T* pT = static_cast(this); + + if (prgCmds == NULL) + { + return E_INVALIDARG; + } + + OleCommandInfo *pCommands = pT->GetCommandTable(); + NG_ASSERT(pCommands); + + BOOL bCmdGroupFound = FALSE; + BOOL bTextSet = FALSE; + + // Iterate through list of commands and flag them as supported/unsupported + for (ULONG nCmd = 0; nCmd < cCmds; nCmd++) + { + // Unsupported by default + prgCmds[nCmd].cmdf = 0; + + // Search the support command list + for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++) + { + OleCommandInfo *pCI = &pCommands[nSupported]; + + if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0) + { + continue; + } + bCmdGroupFound = TRUE; + + if (pCI->nCmdID != prgCmds[nCmd].cmdID) + { + continue; + } + + // Command is supported so flag it and possibly enable it + prgCmds[nCmd].cmdf = OLECMDF_SUPPORTED; + if (pCI->nWindowsCmdID != 0) + { + prgCmds[nCmd].cmdf |= OLECMDF_ENABLED; + } + + // Copy the status/verb text for the first supported command only + if (!bTextSet && pCmdText) + { + // See what text the caller wants + wchar_t *pszTextToCopy = NULL; + if (pCmdText->cmdtextf & OLECMDTEXTF_NAME) + { + pszTextToCopy = pCI->szVerbText; + } + else if (pCmdText->cmdtextf & OLECMDTEXTF_STATUS) + { + pszTextToCopy = pCI->szStatusText; + } + + // Copy the text + pCmdText->cwActual = 0; + memset(pCmdText->rgwz, 0, pCmdText->cwBuf * sizeof(wchar_t)); + if (pszTextToCopy) + { + // Don't exceed the provided buffer size + int nTextLen = wcslen(pszTextToCopy); + if (nTextLen > pCmdText->cwBuf) + { + nTextLen = pCmdText->cwBuf; + } + + wcsncpy(pCmdText->rgwz, pszTextToCopy, nTextLen); + pCmdText->cwActual = nTextLen; + } + + bTextSet = TRUE; + } + break; + } + } + + // Was the command group found? + if (!bCmdGroupFound) + { + OLECMDERR_E_UNKNOWNGROUP; + } + + return S_OK; + } + + + // Execute the specified command + virtual HRESULT STDMETHODCALLTYPE Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) + { + T* pT = static_cast(this); + BOOL bCmdGroupFound = FALSE; + + OleCommandInfo *pCommands = pT->GetCommandTable(); + NG_ASSERT(pCommands); + + // Search the support command list + for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++) + { + OleCommandInfo *pCI = &pCommands[nSupported]; + + if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0) + { + continue; + } + bCmdGroupFound = TRUE; + + if (pCI->nCmdID != nCmdID) + { + continue; + } + + // Send ourselves a WM_COMMAND windows message with the associated + // identifier and exec data + OleExecData cData; + cData.pguidCmdGroup = pguidCmdGroup; + cData.nCmdID = nCmdID; + cData.nCmdexecopt = nCmdexecopt; + cData.pvaIn = pvaIn; + cData.pvaOut = pvaOut; + + if (pCI->pfnCommandProc) + { + pCI->pfnCommandProc(pT, pCI->pCmdGUID, pCI->nCmdID, nCmdexecopt, pvaIn, pvaOut); + } + else if (pCI->nWindowsCmdID != 0) + { + HWND hwndTarget = pT->GetCommandTargetWindow(); + if (hwndTarget) + { + ::SendMessage(hwndTarget, WM_COMMAND, LOWORD(pCI->nWindowsCmdID), (LPARAM) &cData); + } + } + else + { + // Command supported but not implemented + continue; + } + + return S_OK; + } + + // Was the command group found? + if (!bCmdGroupFound) + { + OLECMDERR_E_UNKNOWNGROUP; + } + + return OLECMDERR_E_NOTSUPPORTED; + } +}; + +// Macros to be placed in any class derived from the IOleCommandTargetImpl +// class. These define what commands are exposed from the object. + +#define BEGIN_OLECOMMAND_TABLE() \ + OleCommandInfo *GetCommandTable() \ + { \ + static OleCommandInfo s_aSupportedCommands[] = \ + { + +#define OLECOMMAND_MESSAGE(id, group, cmd, verb, desc) \ + { id, group, cmd, NULL, verb, desc }, + +#define OLECOMMAND_HANDLER(id, group, handler, verb, desc) \ + { id, group, 0, handler, verb, desc }, + +#define END_OLECOMMAND_TABLE() \ + { 0, &GUID_NULL, 0, NULL, NULL, NULL } \ + }; \ + return s_aSupportedCommands; \ + }; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/ItemContainer.cpp b/mozilla/embedding/browser/activex/src/control/ItemContainer.cpp new file mode 100644 index 00000000000..30db10f20ec --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ItemContainer.cpp @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" + +CItemContainer::CItemContainer() +{ +} + +CItemContainer::~CItemContainer() +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// IParseDisplayName implementation + + +HRESULT STDMETHODCALLTYPE CItemContainer::ParseDisplayName(/* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ LPOLESTR pszDisplayName, /* [out] */ ULONG __RPC_FAR *pchEaten, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmkOut) +{ + // TODO + return E_NOTIMPL; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleContainer implementation + + +HRESULT STDMETHODCALLTYPE CItemContainer::EnumObjects(/* [in] */ DWORD grfFlags, /* [out] */ IEnumUnknown __RPC_FAR *__RPC_FAR *ppenum) +{ + HRESULT hr = E_NOTIMPL; +/* + if (ppenum == NULL) + { + return E_POINTER; + } + + *ppenum = NULL; + typedef CComObject, CNamedObjectList > > enumunk; + enumunk* p = NULL; + p = new enumunk; + if(p == NULL) + { + return E_OUTOFMEMORY; + } + + hr = p->Init(); + if (SUCCEEDED(hr)) + { + hr = p->QueryInterface(IID_IEnumUnknown, (void**) ppenum); + } + if (FAILED(hRes)) + { + delete p; + } +*/ + return hr; +} + + +HRESULT STDMETHODCALLTYPE CItemContainer::LockContainer(/* [in] */ BOOL fLock) +{ + // TODO + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IOleItemContainer implementation + + +HRESULT STDMETHODCALLTYPE CItemContainer::GetObject(/* [in] */ LPOLESTR pszItem, /* [in] */ DWORD dwSpeedNeeded, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) +{ + if (pszItem == NULL) + { + return E_INVALIDARG; + } + if (ppvObject == NULL) + { + return E_INVALIDARG; + } + + *ppvObject = NULL; + + return MK_E_NOOBJECT; +} + + +HRESULT STDMETHODCALLTYPE CItemContainer::GetObjectStorage(/* [in] */ LPOLESTR pszItem, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvStorage) +{ + // TODO + return MK_E_NOOBJECT; +} + + +HRESULT STDMETHODCALLTYPE CItemContainer::IsRunning(/* [in] */ LPOLESTR pszItem) +{ + // TODO + return MK_E_NOOBJECT; +} diff --git a/mozilla/embedding/browser/activex/src/control/ItemContainer.h b/mozilla/embedding/browser/activex/src/control/ItemContainer.h new file mode 100644 index 00000000000..01d7dd6b1f7 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/ItemContainer.h @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#ifndef ITEMCONTAINER_H +#define ITEMCONTAINER_H + +// Class for managing a list of named objects. + +class CItemContainer : public CComObjectRootEx, + public IOleItemContainer +{ + // List of all named objects managed by the container + CNamedObjectList m_cObjectList; +public: + + CItemContainer(); + virtual ~CItemContainer(); + +BEGIN_COM_MAP(CItemContainer) + COM_INTERFACE_ENTRY_IID(IID_IParseDisplayName, IOleItemContainer) + COM_INTERFACE_ENTRY_IID(IID_IOleContainer, IOleItemContainer) + COM_INTERFACE_ENTRY_IID(IID_IOleItemContainer, IOleItemContainer) +END_COM_MAP() + + // IParseDisplayName implementation + virtual HRESULT STDMETHODCALLTYPE ParseDisplayName(/* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ LPOLESTR pszDisplayName, /* [out] */ ULONG __RPC_FAR *pchEaten, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmkOut); + + // IOleContainer implementation + virtual HRESULT STDMETHODCALLTYPE EnumObjects(/* [in] */ DWORD grfFlags, /* [out] */ IEnumUnknown __RPC_FAR *__RPC_FAR *ppenum); + virtual HRESULT STDMETHODCALLTYPE LockContainer(/* [in] */ BOOL fLock); + + // IOleItemContainer implementation + virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetObject(/* [in] */ LPOLESTR pszItem, /* [in] */ DWORD dwSpeedNeeded, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetObjectStorage(/* [in] */ LPOLESTR pszItem, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvStorage); + virtual HRESULT STDMETHODCALLTYPE IsRunning(/* [in] */ LPOLESTR pszItem); +}; + +typedef CComObject CItemContainerInstance; + + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp new file mode 100644 index 00000000000..4cd4532a03c --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -0,0 +1,2651 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" +#include +#include + +#include "MozillaControl.h" +#include "MozillaBrowser.h" +#include "IEHtmlDocument.h" +#include "nsIContentViewerFile.h" + +static const TCHAR *c_szInvalidArg = _T("Invalid parameter"); +static const TCHAR *c_szUninitialized = _T("Method called while control is uninitialized"); + +#define RETURN_ERROR(message, hr) \ + SetErrorInfo(message, hr); \ + return hr; + +#define RETURN_E_INVALIDARG() \ + RETURN_ERROR(c_szInvalidArg, E_INVALIDARG); + +#define RETURN_E_UNEXPECTED() \ + RETURN_ERROR(c_szUninitialized, E_UNEXPECTED); + + +extern "C" void NS_SetupRegistry(); + +static const std::string c_szPrefsHomePage = "browser.startup.homepage"; +static const std::string c_szDefaultPage = "resource:/res/MozillaControl.html"; + +static const tstring c_szHelpKey = _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects"); + +#define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") +#define MOZ_CONTROL_REG_VALUE_DIR _T("Dir") +#define MOZ_CONTROL_REG_VALUE_COMPONENT_PATH _T("ComponentPath") +#define MOZ_CONTROL_REG_VALUE_COMPONENT_FILE _T("ComponentFile") + +BOOL CMozillaBrowser::m_bRegistryInitialized = FALSE; + +const GUID CGID_IWebBrowser = + { 0xED016940L, 0xBD5B, 0x11cf, {0xBA, 0x4E, 0x00, 0xC0, 0x4F, 0xD7, 0x08, 0x16} }; + +// TODO +const GUID CGID_MSHTML = + { 0xED016940L, 0xBD5B, 0x11cf, {0xBA, 0x4E, 0x00, 0xC0, 0x4F, 0xD7, 0x08, 0x16} }; + +///////////////////////////////////////////////////////////////////////////// +// CMozillaBrowser + +CMozillaBrowser::CMozillaBrowser() +{ + NG_TRACE_METHOD(CMozillaBrowser::CMozillaBrowser); + + // ATL flags ensures the control opens with a window + m_bWindowOnly = TRUE; + m_bWndLess = FALSE; + + // Initialize layout interfaces + m_pIWebShell = nsnull; + m_pIPref = nsnull; + m_pIServiceManager = nsnull; + + // Ready state of control + m_nBrowserReadyState = READYSTATE_UNINITIALIZED; + + // Create the container that handles some things for us + m_pWebShellContainer = NULL; + m_pEditor = NULL; + + // Controls starts off unbusy + m_bBusy = FALSE; + + // Control starts off in non-edit mode + m_bEditorMode = FALSE; + + // Control starts off without being a drop target + m_bDropTarget = FALSE; + + // the IHTMLDocument, lazy allocation. + m_pDocument = NULL; + + // Open registry keys + m_SystemKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); + m_UserKey.Create(HKEY_CURRENT_USER, MOZ_CONTROL_REG_KEY); + + // Component path and file + m_pComponentPath = NULL; + m_pComponentFile = NULL; + + // Initialise the web shell + InitWebShell(); +} + + +CMozillaBrowser::~CMozillaBrowser() +{ + NG_TRACE_METHOD(CMozillaBrowser::~CMozillaBrowser); + // Close the web shell + TermWebShell(); + + // Close registry keys + m_SystemKey.Close(); + m_UserKey.Close(); +} + + +STDMETHODIMP CMozillaBrowser::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_IWebBrowser, + &IID_IWebBrowser2, + &IID_IWebBrowserApp + }; + for (int i=0;iShowMessage(m_hWnd, + T2OLE(lpszText), T2OLE(lpszCaption), nType, NULL, 0, &lResult); + if (hr == S_OK) + { + return lResult; + } + } + + // Do the default message box + return CWindow::MessageBox(lpszText, lpszCaption, nType); +} + + +HRESULT CMozillaBrowser::SetErrorInfo(LPCTSTR lpszDesc, HRESULT hr) +{ + USES_CONVERSION; + return AtlSetErrorInfo(GetObjectCLSID(), T2OLE(lpszDesc), 0, NULL, GUID_NULL, hr, NULL); +} + + +/////////////////////////////////////////////////////////////////////////////// +// Message handlers + + +// Handle WM_CREATE windows message +LRESULT CMozillaBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + NG_TRACE_METHOD(CMozillaBrowser::OnCreate); + + // Clip the child windows out of paint operations + SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) | WS_CLIPCHILDREN); + + // Create the NGLayout WebShell + CreateWebShell(); + + // TODO create and register a drop target + + // Control is ready + m_nBrowserReadyState = READYSTATE_LOADED; + + // Load browser helpers + LoadBrowserHelpers(); + + // Browse to a default page - if in design mode + BOOL bUserMode = FALSE; + if (SUCCEEDED(GetAmbientUserMode(bUserMode))) + { + if (!bUserMode) + { + USES_CONVERSION; + Navigate(A2OLE(c_szDefaultPage.c_str()), NULL, NULL, NULL, NULL); + } + } + + return 0; +} + + +// Handle WM_DESTROY window message +LRESULT CMozillaBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + NG_TRACE_METHOD(CMozillaBrowser::OnDestroy); + + // Unload browser helpers + UnloadBrowserHelpers(); + + // TODO unregister drop target + + // Destroy the htmldoc + if (m_pDocument != NULL) + { + m_pDocument->Release(); + m_pDocument = NULL; + } + + // Destroy layout... + if (m_pIWebShell != nsnull) + { + m_pIWebShell->Destroy(); + NS_RELEASE(m_pIWebShell); + } + + if (m_pWebShellContainer) + { + m_pWebShellContainer->Release(); + m_pWebShellContainer = NULL; + } + + if (m_pIPref) + { + NS_RELEASE(m_pIPref); + } + + return 0; +} + + +// Handle WM_SIZE windows message +LRESULT CMozillaBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + NG_TRACE_METHOD(CMozillaBrowser::OnSize); + + // Pass resize information down to the WebShell... + if (m_pIWebShell) + { + m_pIWebShell->SetBounds(0, 0, LOWORD(lParam), HIWORD(lParam)); + } + return 0; +} + + +// Handle WM_PAINT windows message (and IViewObject::Draw) +HRESULT CMozillaBrowser::OnDraw(ATL_DRAWINFO& di) +{ + if (m_pIWebShell == nsnull) + { + RECT& rc = *(RECT*)di.prcBounds; + Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom); + DrawText(di.hdcDraw, m_sErrorMessage.c_str(), -1, &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); + } + + return S_OK; +} + + +// Handle ID_PAGESETUP command +LRESULT CMozillaBrowser::OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + MessageBox(_T("No page setup yet!"), _T("Control Message"), MB_OK); + // TODO show the page setup dialog + return 0; +} + + +// Handle ID_PRINT command +LRESULT CMozillaBrowser::OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + nsresult res; + + // Print the contents + if (m_pIWebShell) + { + nsIContentViewer *pContentViewer = nsnull; + res = m_pIWebShell->GetContentViewer(&pContentViewer); + if ( NS_SUCCEEDED(res) ) + { + nsCOMPtr ContentViewerFile = do_QueryInterface(pContentViewer); + ContentViewerFile->Print(); + NS_RELEASE(pContentViewer); + } + } + + return res; +} + +LRESULT CMozillaBrowser::OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + MessageBox(_T("No Save As Yet!"), _T("Control Message"), MB_OK); + // TODO show the save as dialog + return 0; +} + +LRESULT CMozillaBrowser::OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + MessageBox(_T("No Properties Yet!"), _T("Control Message"), MB_OK); + // TODO show the properties dialog + return 0; +} + +LRESULT CMozillaBrowser::OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + nsresult res; + + nsIPresShell* pIPresShell = nsnull; + res = GetPresShell(&pIPresShell); //Get the presentation shell for the document + if (NS_FAILED(res) || pIPresShell == nsnull) + { + return NS_ERROR_NOT_INITIALIZED; + } + + nsCOMPtr selection; //Get a pointer to the DOM selection + res = pIPresShell->GetSelection(SELECTION_NORMAL, getter_AddRefs(selection)); + if ( NS_FAILED(res) ) return res; + + res = pIPresShell->DoCopy(); //Copy the selection to the clipboard + if ( NS_SUCCEEDED(res) ) + { + res = selection->DeleteFromDocument(); //Delete the selection from the document + } + NS_RELEASE(pIPresShell); + + return res; +} + +LRESULT CMozillaBrowser::OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + nsresult res; + + nsIPresShell* pIPresShell = nsnull; + res = GetPresShell(&pIPresShell); //Get the presentation shell for the document + if (NS_FAILED(res) || pIPresShell == nsnull) + { + return NS_ERROR_NOT_INITIALIZED; + } + + res = pIPresShell->DoCopy(); + NS_RELEASE(pIPresShell); + + return res; +} + +LRESULT CMozillaBrowser::OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + MessageBox(_T("No Paste Yet!"), _T("Control Message"), MB_OK); + // TODO enable pasting + return 0; +} + +LRESULT CMozillaBrowser::OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + MessageBox(_T("No Select All Yet!"), _T("Control Message"), MB_OK); + // TODO enable Select All + return 0; +} + +// Handle ID_VIEWSOURCE command +LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + // Get the url from the web shell + const PRUnichar *pszUrl = nsnull; + PRInt32 aHistoryIndex; + m_pIWebShell->GetHistoryIndex(aHistoryIndex); + m_pIWebShell->GetURL(aHistoryIndex, &pszUrl); + + nsString strUrl(pszUrl); + nsString strTemp(nsString("view-source:") + strUrl); + strUrl = strTemp; + + CIPtr(IDispatch) spDispNew; + VARIANT_BOOL bCancel = VARIANT_FALSE; + Fire_NewWindow2(&spDispNew, &bCancel); + + if ((bCancel == VARIANT_FALSE) && spDispNew) + { + CIPtr(IWebBrowser2) spOther = spDispNew;; + if (spOther) + { + // tack in the viewsource command + BSTR bstrURL = SysAllocString(strUrl.GetUnicode()); + CComVariant vURL(bstrURL); + VARIANT vNull; + vNull.vt = VT_NULL; + + spOther->Navigate2(&vURL, &vNull, &vNull, &vNull, &vNull); + + // when and if we can get the container we should + // be able to tell the other windows container not to show toolbars, menus, etc. + // we would also be able to show the window. one fix would be to + // change the navigate method to set a flag if it's viewing source, and to + // have it's document complete method tell it's container to hide toolbars and menu. + /* + IDispatch *pOtherContainer = NULL; + pOther->get_Container(&pOtherContainer); + if(pOtherContainer != NULL) + { + DWebBrowserEvents2 *pOtherEventSink; + if(SUCCEEDED(pOtherContainer->QueryInterface(IID_IDWebBrowserEvents2,(void**)&pOtherEventSink))) + { + __asm int 3 + + pOtherEventSink->Release(); + } + + pOtherContainer->Release(); + } + */ + + SysFreeString(bstrURL); + } + } + + bHandled = TRUE; + return 0; +} + + +// Test if the browser is in a valid state +BOOL CMozillaBrowser::IsValid() +{ + return (m_pIWebShell == nsnull) ? FALSE : TRUE; +} + + +///////////////////////////////////////////////////////////////////////////// + +static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID); +static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID); +static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID); +static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); + +// Initialises the web shell engine +HRESULT CMozillaBrowser::InitWebShell() +{ + // Initialise XPCOM + TCHAR szComponentPath[MAX_PATH]; + TCHAR szComponentFile[MAX_PATH]; + DWORD dwComponentPath = sizeof(szComponentPath) / sizeof(szComponentPath[0]); + DWORD dwComponentFile = sizeof(szComponentFile) / sizeof(szComponentFile[0]); + + memset(szComponentPath, 0, sizeof(szComponentPath)); + memset(szComponentFile, 0, sizeof(szComponentFile)); + if (m_SystemKey.QueryValue(szComponentPath, MOZ_CONTROL_REG_VALUE_COMPONENT_PATH, &dwComponentPath) == ERROR_SUCCESS && + m_SystemKey.QueryValue(szComponentFile, MOZ_CONTROL_REG_VALUE_COMPONENT_FILE, &dwComponentFile) == ERROR_SUCCESS) + { + USES_CONVERSION; + + m_pComponentPath = new nsFileSpec(T2A(szComponentPath)); + m_pComponentFile = new nsFileSpec(T2A(szComponentFile)); + + NS_InitXPCOM(&m_pIServiceManager, m_pComponentFile, m_pComponentPath); + } + else + { + NS_InitXPCOM(&m_pIServiceManager, nsnull, nsnull); + } + + // Register components + if (!m_bRegistryInitialized) + { + NS_SetupRegistry(); + m_bRegistryInitialized = TRUE; + } + + // Create the Event Queue for the UI thread... + // + // If an event queue already exists for the thread, then + // CreateThreadEventQueue(...) will fail... + nsresult rv; + nsIEventQueueService* eventQService = NULL; + + rv = nsServiceManager::GetService(kEventQueueServiceCID, + kIEventQueueServiceIID, + (nsISupports **)&eventQService); + if (NS_SUCCEEDED(rv)) { + rv = eventQService->CreateThreadEventQueue(); + nsServiceManager::ReleaseService(kEventQueueServiceCID, eventQService); + } + + return S_OK; +} + +// Terminates the web shell engine +HRESULT CMozillaBrowser::TermWebShell() +{ + // XXX: Do not call DestroyThreadEventQueue(...) for now... + + // Terminate XPCOM & cleanup + NS_ShutdownXPCOM(m_pIServiceManager); + m_pIServiceManager = nsnull; + + if (m_pComponentPath) + { + delete m_pComponentPath; + m_pComponentPath = NULL; + } + if (m_pComponentFile) + { + delete m_pComponentFile; + m_pComponentFile = NULL; + } + + return S_OK; +} + +// Create and initialise the web shell +HRESULT CMozillaBrowser::CreateWebShell() +{ + NG_TRACE_METHOD(CMozillaBrowser::CreateWebShell); + + if (m_pIWebShell != nsnull) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + RECT rcLocation; + GetClientRect(&rcLocation); + if (IsRectEmpty(&rcLocation)) + { + rcLocation.bottom++; + rcLocation.top++; + } + + nsresult rv; + + // Load preferences + rv = nsServiceManager::GetService(kPrefCID, + nsIPref::GetIID(), + (nsISupports **)&m_pIPref); + if (NS_FAILED(rv)) + { + NG_ASSERT(0); + NG_TRACE(_T("Could not create preference object rv=%08x\n"), (int) rv); + m_sErrorMessage = _T("Error - could not create preference object"); + return E_FAIL; + } + + // Create the web shell object + rv = nsComponentManager::CreateInstance(kWebShellCID, nsnull, + kIWebShellIID, + (void**)&m_pIWebShell); + if (NS_FAILED(rv)) + { + NG_ASSERT(0); + NG_TRACE(_T("Could not create web shell rv=%08x\n"), (int) rv); + m_sErrorMessage = _T("Error - could not create web shell, check PATH settings"); + return E_FAIL; + } + + // Initialise the web shell, making it fit the control dimensions + + nsRect r; + r.x = 0; + r.y = 0; + r.width = rcLocation.right - rcLocation.left; + r.height = rcLocation.bottom - rcLocation.top; + + PRBool aAllowPlugins = PR_TRUE; + PRBool aIsSunkenBorder = PR_FALSE; + + rv = m_pIWebShell->Init(m_hWnd, + r.x, r.y, + r.width, r.height, + nsScrollPreference_kAuto, + aAllowPlugins, + aIsSunkenBorder); + NG_ASSERT(NS_SUCCEEDED(rv)); + + // Create the container object + m_pWebShellContainer = new CWebShellContainer(this); + m_pWebShellContainer->AddRef(); + + m_pIWebShell->SetPrefs(m_pIPref); + m_pIWebShell->SetContainer((nsIWebShellContainer*) m_pWebShellContainer); +/// m_pIWebShell->SetObserver((nsIStreamObserver*) m_pWebShellContainer); + m_pIWebShell->SetDocLoaderObserver((nsIDocumentLoaderObserver*) m_pWebShellContainer); + m_pIWebShell->SetWebShellType(nsWebShellContent); + + m_pIWebShell->Show(); + + return S_OK; +} + + +// Turns the editor mode on or off +HRESULT CMozillaBrowser::SetEditorMode(BOOL bEnabled) +{ + m_bEditorMode = FALSE; + if (bEnabled && m_pEditor == nsnull) + { + if (m_pIWebShell == nsnull) + { + return E_UNEXPECTED; + } + + nsresult result = nsComponentManager::CreateInstance(kHTMLEditorCID, + nsnull, + nsIEditor::GetIID(), + (void **) &m_pEditor); + if (NS_FAILED(result)) + { + return result; + } + if (!m_pEditor) + { + return E_OUTOFMEMORY; + } + + nsIDOMDocument *pIDOMDocument = nsnull; + if (FAILED(GetDOMDocument(&pIDOMDocument)) || pIDOMDocument == nsnull) + { + return E_UNEXPECTED; + } + + nsIPresShell* pIPresShell = nsnull; + if (FAILED(GetPresShell(&pIPresShell)) || pIPresShell == nsnull) + { + return E_UNEXPECTED; + } + + result = m_pEditor->Init(pIDOMDocument, pIPresShell, 0); + if (NS_SUCCEEDED(result)) + { + m_bEditorMode = TRUE; + } + + NS_RELEASE(pIPresShell); + NS_RELEASE(pIDOMDocument); + } + else + { + if (m_pEditor) + { + m_pEditor->Release(); + m_pEditor = nsnull; + } + } + + return S_OK; +} + + +HRESULT CMozillaBrowser::OnEditorCommand(DWORD nCmdID) +{ + static nsIAtom * propB = NS_NewAtom("b"); + static nsIAtom * propI = NS_NewAtom("i"); + static nsIAtom * propU = NS_NewAtom("u"); + + if (!m_bEditorMode) + { + return E_UNEXPECTED; + } + if (!m_pEditor) + { + NG_ASSERT(0); + return E_UNEXPECTED; + } + + nsCOMPtr pHtmlEditor = do_QueryInterface(m_pEditor); + + bool bToggleInlineProperty = false; + nsIAtom *pInlineProperty = nsnull; + + switch (nCmdID) + { + case IDM_BOLD: + pInlineProperty = propB; + bToggleInlineProperty = true; + break; + case IDM_ITALIC: + pInlineProperty = propI; + bToggleInlineProperty = true; + break; + case IDM_UNDERLINE: + pInlineProperty = propU; + bToggleInlineProperty = true; + break; + + // TODO add the rest! + + default: + // DO NOTHING + break; + } + + // Does the instruction involve toggling something? e.g. B, U, I + if (bToggleInlineProperty) + { + PRBool bFirst = PR_TRUE; + PRBool bAny = PR_TRUE; + PRBool bAll = PR_TRUE; + + // Set or remove + pHtmlEditor->GetInlineProperty(pInlineProperty, nsnull, nsnull, bFirst, bAny, bAll); + if (bAny) + { + pHtmlEditor->RemoveInlineProperty(pInlineProperty, nsnull); + } + else + { + pHtmlEditor->SetInlineProperty(pInlineProperty, nsnull, nsnull); + } + } + + return S_OK; +} + + +// Returns the presentation shell +HRESULT CMozillaBrowser::GetPresShell(nsIPresShell **pPresShell) +{ + NG_TRACE_METHOD(CMozillaBrowser::GetPresShell); + nsresult res; + + // Test for stupid args + if (pPresShell == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + *pPresShell = nsnull; + + if (m_pIWebShell == nsnull) + { + NG_ASSERT(0); + return E_UNEXPECTED; + } + + nsIContentViewer* pIContentViewer = nsnull; + res = m_pIWebShell->GetContentViewer(&pIContentViewer); + if (NS_SUCCEEDED(res) && pIContentViewer) + { + nsIDocumentViewer* pIDocViewer = nsnull; + res = pIContentViewer->QueryInterface(kIDocumentViewerIID, (void**) &pIDocViewer); + if (NS_SUCCEEDED(res) && pIDocViewer) + { + nsIPresContext * pIPresContent = nsnull; + res = pIDocViewer->GetPresContext(pIPresContent); + if (NS_SUCCEEDED(res) && pIPresContent) + { + res = pIPresContent->GetShell(pPresShell); + NS_RELEASE(pIPresContent); + } + NS_RELEASE(pIDocViewer); + } + NS_RELEASE(pIContentViewer); + } + + return res; +} + + +// Return the root DOM document +HRESULT CMozillaBrowser::GetDOMDocument(nsIDOMDocument **pDocument) +{ + NG_TRACE_METHOD(CMozillaBrowser::GetDOMDocument); + nsresult res; + + // Test for stupid args + if (pDocument == NULL) + { + NG_ASSERT(0); + return E_INVALIDARG; + } + + *pDocument = nsnull; + + if (m_pIWebShell == nsnull) + { + NG_ASSERT(0); + return E_UNEXPECTED; + } + + nsIContentViewer * pCViewer = nsnull; + res = m_pIWebShell->GetContentViewer(&pCViewer); + if (NS_SUCCEEDED(res) && pCViewer) + { + nsIDocumentViewer * pDViewer = nsnull; + res = pCViewer->QueryInterface(kIDocumentViewerIID, (void**) &pDViewer); + if (NS_SUCCEEDED(res) && pDViewer) + { + nsIDocument * pDoc = nsnull; + res = pDViewer->GetDocument(pDoc); + if (NS_SUCCEEDED(res) && pDoc) + { + res = pDoc->QueryInterface(kIDOMDocumentIID, (void**) pDocument); + NS_RELEASE(pDoc); + } + NS_RELEASE(pDViewer); + } + NS_RELEASE(pCViewer); + } + + return res; +} + + +// Load any browser helpers +HRESULT CMozillaBrowser::LoadBrowserHelpers() +{ + NG_TRACE_METHOD(CMozillaBrowser::LoadBrowserHelpers); + + // IE loads browser helper objects from a branch of the registry + // Search the branch looking for objects to load with the control. + + CRegKey cKey; + if (cKey.Open(HKEY_LOCAL_MACHINE, c_szHelpKey.c_str(), KEY_ENUMERATE_SUB_KEYS) != ERROR_SUCCESS) + { + NG_TRACE(_T("No browser helper key found\n")); + return S_FALSE; + } + + std::vector cClassList; + + DWORD nKey = 0; + LONG nResult = ERROR_SUCCESS; + while (nResult == ERROR_SUCCESS) + { + TCHAR szCLSID[50]; + DWORD dwCLSID = sizeof(szCLSID) / sizeof(TCHAR); + FILETIME cLastWrite; + + // Read next subkey + nResult = RegEnumKeyEx(cKey, nKey++, szCLSID, &dwCLSID, NULL, NULL, NULL, &cLastWrite); + if (nResult != ERROR_SUCCESS) + { + break; + } + + NG_TRACE(_T("Reading helper object \"%s\"\n"), szCLSID); + + // Turn the key into a CLSID + USES_CONVERSION; + CLSID clsid; + if (CLSIDFromString(T2OLE(szCLSID), &clsid) != NOERROR) + { + continue; + } + + cClassList.push_back(clsid); + } + + // Empty list? + if (cClassList.empty()) + { + NG_TRACE(_T("No browser helper objects found\n")); + return S_FALSE; + } + + // Create each object in turn + for (std::vector::const_iterator i = cClassList.begin(); i != cClassList.end(); i++) + { + CLSID clsid = *i; + HRESULT hr; + CComQIPtr cpObjectWithSite; + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IObjectWithSite, (LPVOID *) &cpObjectWithSite); + if (FAILED(hr)) + { + NG_TRACE(_T("Registered browser helper object cannot be created\n"));; + } + + // Set the object to point at the browser + cpObjectWithSite->SetSite((IWebBrowser2 *) this); + + // Store in the list + CComUnkPtr cpUnk = cpObjectWithSite; + m_cBrowserHelperList.push_back(cpUnk); + } + + return S_OK; +} + +// Release browser helpers +HRESULT CMozillaBrowser::UnloadBrowserHelpers() +{ + NG_TRACE_METHOD(CMozillaBrowser::UnloadBrowserHelpers); + + for (ObjectList::const_iterator i = m_cBrowserHelperList.begin(); i != m_cBrowserHelperList.end(); i++) + { + CComUnkPtr cpUnk = *i; + CComQIPtr cpObjectWithSite = cpUnk; + if (cpObjectWithSite) + { + cpObjectWithSite->SetSite(NULL); + } + } + m_cBrowserHelperList.clear(); + + return S_OK; +} + + +///////////////////////////////////////////////////////////////////////////// +// IOleObject overrides + +// This is an almost verbatim copy of the standard ATL implementation of +// IOleObject::InPlaceActivate but with a few lines commented out. + +HRESULT CMozillaBrowser::InPlaceActivate(LONG iVerb, const RECT* prcPosRect) +{ + HRESULT hr; + + if (m_spClientSite == NULL) + return S_OK; + + CComPtr pIPO; + ControlQueryInterface(IID_IOleInPlaceObject, (void**)&pIPO); + _ASSERTE(pIPO != NULL); + if (prcPosRect != NULL) + pIPO->SetObjectRects(prcPosRect, prcPosRect); + + if (!m_bNegotiatedWnd) + { + if (!m_bWindowOnly) + // Try for windowless site + hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSiteWindowless, (void **)&m_spInPlaceSite); + + if (m_spInPlaceSite) + { + m_bInPlaceSiteEx = TRUE; + m_bWndLess = SUCCEEDED(m_spInPlaceSite->CanWindowlessActivate()); + m_bWasOnceWindowless = TRUE; + } + else + { + m_spClientSite->QueryInterface(IID_IOleInPlaceSiteEx, (void **)&m_spInPlaceSite); + if (m_spInPlaceSite) + m_bInPlaceSiteEx = TRUE; + else + hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSite, (void **)&m_spInPlaceSite); + } + } + + _ASSERTE(m_spInPlaceSite); + if (!m_spInPlaceSite) + return E_FAIL; + + m_bNegotiatedWnd = TRUE; + + if (!m_bInPlaceActive) + { + + BOOL bNoRedraw = FALSE; + if (m_bWndLess) + m_spInPlaceSite->OnInPlaceActivateEx(&bNoRedraw, ACTIVATE_WINDOWLESS); + else + { + if (m_bInPlaceSiteEx) + m_spInPlaceSite->OnInPlaceActivateEx(&bNoRedraw, 0); + else + { + HRESULT hr = m_spInPlaceSite->CanInPlaceActivate(); + if (FAILED(hr)) + return hr; + m_spInPlaceSite->OnInPlaceActivate(); + } + } + } + + m_bInPlaceActive = TRUE; + + // get location in the parent window, + // as well as some information about the parent + // + OLEINPLACEFRAMEINFO frameInfo; + RECT rcPos, rcClip; + CComPtr spInPlaceFrame; + CComPtr spInPlaceUIWindow; + frameInfo.cb = sizeof(OLEINPLACEFRAMEINFO); + HWND hwndParent; + if (m_spInPlaceSite->GetWindow(&hwndParent) == S_OK) + { + m_spInPlaceSite->GetWindowContext(&spInPlaceFrame, + &spInPlaceUIWindow, &rcPos, &rcClip, &frameInfo); + + if (!m_bWndLess) + { + if (m_hWndCD) + { + ::ShowWindow(m_hWndCD, SW_SHOW); + ::SetFocus(m_hWndCD); + } + else + { + HWND h = CreateControlWindow(hwndParent, rcPos); + _ASSERTE(h == m_hWndCD); + } + } + + pIPO->SetObjectRects(&rcPos, &rcClip); + } + + CComPtr spActiveObject; + ControlQueryInterface(IID_IOleInPlaceActiveObject, (void**)&spActiveObject); + + // Gone active by now, take care of UIACTIVATE + if (DoesVerbUIActivate(iVerb)) + { + if (!m_bUIActive) + { + m_bUIActive = TRUE; + hr = m_spInPlaceSite->OnUIActivate(); + if (FAILED(hr)) + return hr; + + SetControlFocus(TRUE); + // set ourselves up in the host. + // + if (spActiveObject) + { + if (spInPlaceFrame) + spInPlaceFrame->SetActiveObject(spActiveObject, NULL); + if (spInPlaceUIWindow) + spInPlaceUIWindow->SetActiveObject(spActiveObject, NULL); + } + +// These lines are deliberately commented out to demonstrate what breaks certain +// control containers. + +// if (spInPlaceFrame) +// spInPlaceFrame->SetBorderSpace(NULL); +// if (spInPlaceUIWindow) +// spInPlaceUIWindow->SetBorderSpace(NULL); + } + } + + m_spClientSite->ShowObject(); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite) +{ + NG_ASSERT(ppClientSite); + + // This fixes a problem in the base class which asserts if the client + // site has not been set when this method is called. + + HRESULT hRes = E_POINTER; + if (ppClientSite != NULL) + { + *ppClientSite = NULL; + if (m_spClientSite == NULL) + { + return S_OK; + } + } + + return IOleObjectImpl::GetClientSite(ppClientSite); +} + + +///////////////////////////////////////////////////////////////////////////// +// IWebBrowser + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoBack(void) +{ + NG_TRACE_METHOD(CMozillaBrowser::GoBack); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (m_pIWebShell->CanBack() == NS_OK) + { + m_pIWebShell->Back(); + } + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoForward(void) +{ + NG_TRACE_METHOD(CMozillaBrowser::GoForward); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (m_pIWebShell->CanForward() == NS_OK) + { + m_pIWebShell->Forward(); + } + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void) +{ + NG_TRACE_METHOD(CMozillaBrowser::GoHome); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + USES_CONVERSION; + + TCHAR * sUrl = _T("http://home.netscape.com"); + + // Find the home page stored in prefs + if (m_pIPref) + { + char *szBuffer; + nsresult rv; + rv = m_pIPref->CopyCharPref(c_szPrefsHomePage.c_str(), &szBuffer); + if (rv == NS_OK) + { + sUrl = A2T(szBuffer); + } + } + + // Navigate to the home page + Navigate(T2OLE(sUrl), NULL, NULL, NULL, NULL); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoSearch(void) +{ + NG_TRACE_METHOD(CMozillaBrowser::GoSearch); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + USES_CONVERSION; + + TCHAR * sUrl = _T("http://search.netscape.com"); + // Find the home page stored in prefs + if (m_pIPref) + { + // TODO find and navigate to the search page stored in prefs + // and not this hard coded address + } + + Navigate(T2OLE(sUrl), NULL, NULL, NULL, NULL); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers) +{ + NG_TRACE_METHOD(CMozillaBrowser::Navigate); + + //Make sure m_pIWebShell is valid + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + // Extract the URL parameter + nsString sCommand("view"); + nsString sUrl; + if (URL == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + else + { + USES_CONVERSION; + sUrl = OLE2A(URL); + } + + // Check for a view-source op - this is a bit kludgy + // TODO + if (sUrl.Compare(L"view-source:", PR_TRUE, 12) == 0) + { + sUrl.Left(sCommand, 11); + sUrl.Cut(0,12); + } + + // Extract the launch flags parameter + LONG lFlags = 0; + if (Flags && + Flags->vt != VT_ERROR && + Flags->vt != VT_EMPTY && + Flags->vt != VT_NULL) + { + CComVariant vFlags; + if (vFlags.ChangeType(VT_I4, Flags) != S_OK) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + lFlags = vFlags.lVal; + } + + + // Extract the target frame parameter + nsString sTargetFrame; + if (TargetFrameName && + TargetFrameName->vt == VT_BSTR) + { + USES_CONVERSION; + sTargetFrame = nsString(OLE2A(TargetFrameName->bstrVal)); + } + + // Extract the post data parameter + nsIPostData *pIPostData = nsnull; + if (PostData && PostData->vt == VT_BSTR) + { + USES_CONVERSION; + char *szPostData = OLE2A(PostData->bstrVal); +#if 0 + // Create post data from string + NS_NewPostData(PR_FALSE, szPostData, &pIPostData); +#endif + } + + // TODO Extract the headers parameter + PRBool bModifyHistory = PR_TRUE; + + // Check the navigation flags + if (lFlags & navOpenInNewWindow) + { + CIPtr(IDispatch) spDispNew; + VARIANT_BOOL bCancel = VARIANT_FALSE; + + // Test if the event sink can give us a new window to navigate into + Fire_NewWindow2(&spDispNew, &bCancel); + + lFlags &= ~(navOpenInNewWindow); + if ((bCancel == VARIANT_FALSE) && spDispNew) + { + CIPtr(IWebBrowser2) spOther = spDispNew;; + if (spOther) + { + CComVariant vURL(URL); + CComVariant vFlags(lFlags); + return spOther->Navigate2(&vURL, &vFlags, TargetFrameName, PostData, Headers); + } + } + + // Can't open a new window without client suppot + return E_NOTIMPL; + } + if (lFlags & navNoHistory) + { + // Disable history + bModifyHistory = PR_FALSE; + } + if (lFlags & navNoReadFromCache) + { + // TODO disable read from cache + } + if (lFlags & navNoWriteToCache) + { + // TODO disable write to cache + } + + // TODO find the correct target frame + + // Load the URL + char *tmpCommand = sCommand.ToNewCString(); + nsresult res = m_pIWebShell->LoadURL(sUrl.GetUnicode()); + +/* , tmpCommand, pIPostData, bModifyHistory); + NS_IMETHOD LoadURL(const PRUnichar *aURLSpec, + nsIInputStream* aPostDataStream=nsnull, + PRBool aModifyHistory=PR_TRUE, + nsLoadFlags aType = nsIChannel::LOAD_NORMAL, + const PRUint32 aLocalIP=0) = 0; +*/ + return res; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh(void) +{ + NG_TRACE_METHOD(CMozillaBrowser::Refresh); + +//Uneccessary since this gets called again in Refresh2 +#if 0 + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } +#endif + + // Reload the page + CComVariant vRefreshType(REFRESH_NORMAL); + return Refresh2(&vRefreshType); +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level) +{ + NG_TRACE_METHOD(CMozillaBrowser::Refresh2); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_NULL_OR_POINTER(Level, VARIANT); + + // Check the requested refresh type + OLECMDID_REFRESHFLAG iRefreshLevel = OLECMDIDF_REFRESH_NORMAL; + if (Level) + { + CComVariant vLevelAsInt; + if (vLevelAsInt.ChangeType(VT_I4, Level) != S_OK) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + iRefreshLevel = (OLECMDID_REFRESHFLAG) vLevelAsInt.iVal; + } + + // Turn the IE refresh type into the nearest NG equivalent + nsLoadFlags type = nsIChannel::LOAD_NORMAL; + switch (iRefreshLevel & OLECMDIDF_REFRESH_LEVELMASK) + { + case OLECMDIDF_REFRESH_NORMAL: + case OLECMDIDF_REFRESH_IFEXPIRED: + case OLECMDIDF_REFRESH_CONTINUE: + case OLECMDIDF_REFRESH_NO_CACHE: + case OLECMDIDF_REFRESH_RELOAD: + type = nsIChannel::LOAD_NORMAL; + break; + case OLECMDIDF_REFRESH_COMPLETELY: + type = nsIHTTPChannel::BYPASS_CACHE | nsIHTTPChannel::BYPASS_PROXY; + break; + default: + // No idea what refresh type this is supposed to be + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + m_pIWebShell->Reload(type); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::Stop() +{ + NG_TRACE_METHOD(CMozillaBrowser::Stop); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + m_pIWebShell->Stop(); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Application(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Application); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (!NgIsValidAddress(ppDisp, sizeof(IDispatch *))) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + // Return a pointer to this controls dispatch interface + *ppDisp = (IDispatch *) this; + (*ppDisp)->AddRef(); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Parent); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (!NgIsValidAddress(ppDisp, sizeof(IDispatch *))) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + // Attempt to get the parent object of this control + HRESULT hr = E_FAIL; + if (m_spClientSite) + { + hr = m_spClientSite->QueryInterface(IID_IDispatch, (void **) ppDisp); + } + + return (SUCCEEDED(hr)) ? S_OK : E_NOINTERFACE; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Container(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Container); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (!NgIsValidAddress(ppDisp, sizeof(IDispatch *))) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Container: Retrieve a pointer to the IDispatch interface of the container. + *ppDisp = NULL; + RETURN_E_UNEXPECTED(); +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Document); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (!NgIsValidAddress(ppDisp, sizeof(IDispatch *))) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + *ppDisp = NULL; + + // Get hold of the DOM document + nsIDOMDocument *pIDOMDocument = nsnull; + if (FAILED(GetDOMDocument(&pIDOMDocument)) || pIDOMDocument == nsnull) + { + RETURN_E_UNEXPECTED(); + } + + if (m_pDocument == NULL) + { + CIEHtmlDocumentInstance::CreateInstance(&m_pDocument); + if (m_pDocument == NULL) + { + RETURN_ERROR(_T("Refresh2: called while browser is invalid"), E_OUTOFMEMORY); + } + + // addref it so it doesn't go away on us. + m_pDocument->AddRef(); + + // give it a pointer to us. note that we shouldn't be addref'd by this call, or it would be + // a circular reference. + m_pDocument->SetParent(this); + } + + m_pDocument->QueryInterface(IID_IDispatch, (void **) ppDisp); + m_pDocument->SetDOMNode(pIDOMDocument); + pIDOMDocument->Release(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_TopLevelContainer(VARIANT_BOOL __RPC_FAR *pBool) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_TopLevelContainer); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (!NgIsValidAddress(pBool, sizeof(VARIANT_BOOL))) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_TopLevelContainer + *pBool = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Type(BSTR __RPC_FAR *Type) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Type); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //NOTE: This code should work in theory, but can't be verified because GetDoctype + // has not been implemented yet. +#if 0 + nsIDOMDocument *pIDOMDocument = nsnull; + if ( SUCCEEDED(GetDOMDocument(&pIDOMDocument)) ) + { + nsIDOMDocumentType *pIDOMDocumentType = nsnull; + if ( SUCCEEDED(pIDOMDocument->GetDoctype(&pIDOMDocumentType)) ) + { + nsString docName; + pIDOMDocumentType->GetName(docName); + //NG_TRACE("pIDOMDocumentType returns: %s", docName); + //Still need to manipulate docName so that it goes into *Type param of this function. + } + } +#endif + + //TODO: Implement get_Type + RETURN_ERROR(_T("get_Type: failed"), E_FAIL); +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Left(long __RPC_FAR *pl) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Left); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pl == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Left - Should return the left position of this control. + *pl = 0; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Left(long Left) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Left); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Top(long __RPC_FAR *pl) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Top); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pl == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Top - Should return the top position of this control. + *pl = 0; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Top(long Top) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Top); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement set_Top - Should set the top position of this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Width(long __RPC_FAR *pl) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Width); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pl == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Width- Should return the width of this control. + *pl = 0; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Width(long Width) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Width); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement put_Width - Should set the width of this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Height(long __RPC_FAR *pl) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Height); + + if (!IsValid()) + { + RETURN_E_UNEXPECTED(); + } + + if (pl == NULL) + { + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Height - Should return the hieght of this control. + *pl = 0; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Height(long Height) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Height); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement put_Height - Should set the height of this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationName(BSTR __RPC_FAR *LocationName) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_LocationName); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (LocationName == NULL) + { + RETURN_E_INVALIDARG(); + } + + // Get the url from the web shell + const PRUnichar *pszLocationName = nsnull; + m_pIWebShell->GetTitle(&pszLocationName); + if (pszLocationName == nsnull) + { + RETURN_E_UNEXPECTED(); + } + + // Convert the string to a BSTR + USES_CONVERSION; + LPOLESTR pszConvertedLocationName = W2OLE(const_cast(pszLocationName)); + *LocationName = SysAllocString(pszConvertedLocationName); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationURL(BSTR __RPC_FAR *LocationURL) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_LocationURL); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (LocationURL == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + // Get the url from the web shell + const PRUnichar *pszUrl = nsnull; + PRInt32 aHistoryIndex; + m_pIWebShell->GetHistoryIndex(aHistoryIndex); + m_pIWebShell->GetURL(aHistoryIndex, &pszUrl); + if (pszUrl == nsnull) + { + return E_FAIL; + } + + // Convert the string to a BSTR + USES_CONVERSION; + LPOLESTR pszConvertedUrl = W2OLE(const_cast(pszUrl)); + *LocationURL = SysAllocString(pszConvertedUrl); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Busy(VARIANT_BOOL __RPC_FAR *pBool) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Busy); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (!NgIsValidAddress(pBool, sizeof(*pBool))) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + *pBool = (m_bBusy) ? VARIANT_TRUE : VARIANT_FALSE; + + return S_OK; +} + + +///////////////////////////////////////////////////////////////////////////// +// IWebBrowserApp + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::Quit(void) +{ + NG_TRACE_METHOD(CMozillaBrowser::Quit); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //This generates an exception in the IE control. + // TODO fire quit event + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::ClientToWindow(int __RPC_FAR *pcx, int __RPC_FAR *pcy) +{ + NG_TRACE_METHOD(CMozillaBrowser::ClientToWindow); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //This generates an exception in the IE control. + // TODO convert points to be relative to browser + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::PutProperty(BSTR szProperty, VARIANT vtValue) +{ + NG_TRACE_METHOD(CMozillaBrowser::PutProperty); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (szProperty == NULL) + { + RETURN_E_INVALIDARG(); + } + PropertyList::iterator i; + for (i = m_PropertyList.begin(); i != m_PropertyList.end(); i++) + { + // Is the property already in the list? + if (wcscmp((*i).szName, szProperty) == 0) + { + // Copy the new value + (*i).vValue = CComVariant(vtValue); + return S_OK; + } + } + + Property p; + p.szName = CComBSTR(szProperty); + p.vValue = vtValue; + + m_PropertyList.push_back(p); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetProperty(BSTR Property, VARIANT __RPC_FAR *pvtValue) +{ + NG_TRACE_METHOD(CMozillaBrowser::GetProperty); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT(Property); + NG_ASSERT_POINTER(pvtValue, VARIANT); + + if (Property == NULL || pvtValue == NULL) + { + RETURN_E_INVALIDARG(); + } + + VariantInit(pvtValue); + PropertyList::iterator i; + for (i = m_PropertyList.begin(); i != m_PropertyList.end(); i++) + { + // Is the property already in the list? + if (wcscmp((*i).szName, Property) == 0) + { + // Copy the new value + VariantCopy(pvtValue, &(*i).vValue); + return S_OK; + } + } + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Name(BSTR __RPC_FAR *Name) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Name); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(Name, BSTR); + if (Name == NULL) + { + RETURN_E_INVALIDARG(); + } + + // TODO: Implement get_Name (get Mozilla's executable name) + *Name = SysAllocString(L"Mozilla Web Browser Control"); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_HWND(long __RPC_FAR *pHWND) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_HWND); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(pHWND, HWND); + if (pHWND == NULL) + { + RETURN_E_INVALIDARG(); + } + + //This generates an exception in the IE control. + *pHWND = NULL; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_FullName(BSTR __RPC_FAR *FullName) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_FullName); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(FullName, BSTR); + if (FullName == NULL) + { + RETURN_E_INVALIDARG(); + } + + // TODO: Implement get_FullName (Return the full path of the executable containing this control) + *FullName = SysAllocString(L""); // TODO get Mozilla's executable name + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Path(BSTR __RPC_FAR *Path) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Path); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(Path, BSTR); + if (Path == NULL) + { + RETURN_E_INVALIDARG(); + } + + // TODO: Implement get_Path (get Mozilla's path) + *Path = SysAllocString(L""); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Visible(VARIANT_BOOL __RPC_FAR *pBool) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Visible); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(pBool, int); + if (pBool == NULL) + { + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Visible + *pBool = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Visible(VARIANT_BOOL Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Visible); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement put_Visible + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_StatusBar(VARIANT_BOOL __RPC_FAR *pBool) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_StatusBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(pBool, int); + if (pBool == NULL) + { + RETURN_E_INVALIDARG(); + } + + //There is no StatusBar in this control. + *pBool = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_StatusBar(VARIANT_BOOL Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_StatusBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //There is no StatusBar in this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_StatusText(BSTR __RPC_FAR *StatusText) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_StatusText); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(StatusText, BSTR); + if (StatusText == NULL) + { + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_StatusText + *StatusText = SysAllocString(L""); + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_StatusText(BSTR StatusText) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_StatusText); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement put_StatusText + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_ToolBar(int __RPC_FAR *Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_ToolBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(Value, int); + if (Value == NULL) + { + RETURN_E_INVALIDARG(); + } + + //There is no ToolBar in this control. + *Value = FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_ToolBar(int Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_ToolBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //There is no ToolBar in this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_MenuBar(VARIANT_BOOL __RPC_FAR *Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_MenuBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(Value, int); + if (Value == NULL) + { + RETURN_E_INVALIDARG(); + } + + //There is no MenuBar in this control. + *Value = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_MenuBar(VARIANT_BOOL Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_MenuBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //There is no MenuBar in this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_FullScreen(VARIANT_BOOL __RPC_FAR *pbFullScreen) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_FullScreen); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + NG_ASSERT_POINTER(pbFullScreen, VARIANT_BOOL); + if (pbFullScreen == NULL) + { + RETURN_E_INVALIDARG(); + } + + //FullScreen mode doesn't really apply to this control. + *pbFullScreen = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_FullScreen(VARIANT_BOOL bFullScreen) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_FullScreen); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //FullScreen mode doesn't really apply to this control. + return S_OK; +} + + + +///////////////////////////////////////////////////////////////////////////// +// IWebBrowser2 + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate2(VARIANT __RPC_FAR *URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers) +{ + NG_TRACE_METHOD(CMozillaBrowser::Navigate2); + +//Redundant code... taken care of in CMozillaBrowser::Navigate +#if 0 + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (URL == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + +#endif + + CComVariant vURLAsString; + if (vURLAsString.ChangeType(VT_BSTR, URL) != S_OK) + { + RETURN_E_INVALIDARG(); + } + + return Navigate(vURLAsString.bstrVal, Flags, TargetFrameName, PostData, Headers); +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::QueryStatusWB(OLECMDID cmdID, OLECMDF __RPC_FAR *pcmdf) +{ + NG_TRACE_METHOD(CMozillaBrowser::QueryStatusWB); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pcmdf == NULL) + { + RETURN_E_INVALIDARG(); + } + + // Call through to IOleCommandTarget::QueryStatus + OLECMD cmd; + HRESULT hr; + + cmd.cmdID = cmdID; + cmd.cmdf = 0; + hr = QueryStatus(NULL, 1, &cmd, NULL); + if (SUCCEEDED(hr)) + { + *pcmdf = (OLECMDF) cmd.cmdf; + } + + return hr; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) +{ + NG_TRACE_METHOD(CMozillaBrowser::ExecWB); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + // Call through to IOleCommandTarget::Exec + HRESULT hr; + hr = Exec(NULL, cmdID, cmdexecopt, pvaIn, pvaOut); + return hr; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::ShowBrowserBar(VARIANT __RPC_FAR *pvaClsid, VARIANT __RPC_FAR *pvarShow, VARIANT __RPC_FAR *pvarSize) +{ + NG_TRACE_METHOD(CMozillaBrowser::ShowBrowserBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_ReadyState(READYSTATE __RPC_FAR *plReadyState) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_ReadyState); + + if (plReadyState == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + *plReadyState = m_nBrowserReadyState; + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Offline(VARIANT_BOOL __RPC_FAR *pbOffline) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Offline); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pbOffline == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_Offline + *pbOffline = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Offline(VARIANT_BOOL bOffline) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Offline); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement get_Offline + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Silent(VARIANT_BOOL __RPC_FAR *pbSilent) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Silent); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pbSilent == NULL) + { + RETURN_E_INVALIDARG(); + } + + //Only really applies to the IE app, not a control + *pbSilent = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Silent(VARIANT_BOOL bSilent) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Silent); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //Only really applies to the IE app, not a control + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_RegisterAsBrowser(VARIANT_BOOL __RPC_FAR *pbRegister) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_RegisterAsBrowser); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pbRegister == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Implement get_RegisterAsBrowser + *pbRegister = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_RegisterAsBrowser(VARIANT_BOOL bRegister) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_RegisterAsBrowser); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Implement put_RegisterAsBrowser + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_RegisterAsDropTarget); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pbRegister == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + *pbRegister = m_bDropTarget ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; +} + + + +static BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) +{ + ::RevokeDragDrop(hwnd); + return TRUE; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_RegisterAsDropTarget(VARIANT_BOOL bRegister) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_RegisterAsDropTarget); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + // Register the window as a drop target + if (bRegister == VARIANT_TRUE) + { + if (!m_bDropTarget) + { + CDropTargetInstance *pDropTarget = NULL; + CDropTargetInstance::CreateInstance(&pDropTarget); + if (pDropTarget) + { + pDropTarget->AddRef(); + pDropTarget->SetOwner(this); + + // Ask the site if it wants to replace this drop target for another one + CIPtr(IDropTarget) spDropTarget; + CIPtr(IDocHostUIHandler) spDocHostUIHandler = m_spClientSite; + if (spDocHostUIHandler) + { + if (spDocHostUIHandler->GetDropTarget(pDropTarget, &spDropTarget) != S_OK) + { + spDropTarget = pDropTarget; + } + } + if (spDropTarget) + { + m_bDropTarget = TRUE; + ::RegisterDragDrop(m_hWnd, spDropTarget); + } + + pDropTarget->Release(); + } + + // Now revoke any child window drop targets and pray they aren't + // reset by the layout engine. + + ::EnumChildWindows(m_hWnd, EnumChildProc, (LPARAM) this); + } + } + else + { + if (m_bDropTarget) + { + m_bDropTarget = FALSE; + ::RevokeDragDrop(m_hWnd); + } + } + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_TheaterMode(VARIANT_BOOL __RPC_FAR *pbRegister) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_TheaterMode); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (pbRegister == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TheaterMode doesn't apply to this control. + *pbRegister = VARIANT_FALSE; + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_TheaterMode(VARIANT_BOOL bRegister) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_TheaterMode); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TheaterMode doesn't apply to this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_AddressBar(VARIANT_BOOL __RPC_FAR *Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_AddressBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (Value == NULL) + { + RETURN_E_INVALIDARG(); + } + + //There is no AddressBar in this control. + *Value = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_AddressBar(VARIANT_BOOL Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_AddressBar); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //There is no AddressBar in this control. + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Resizable(VARIANT_BOOL __RPC_FAR *Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::get_Resizable); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + if (Value == NULL) + { + NG_ASSERT(0); + RETURN_E_INVALIDARG(); + } + + //TODO: Not sure if this should actually be implemented or not. + *Value = VARIANT_FALSE; + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Resizable(VARIANT_BOOL Value) +{ + NG_TRACE_METHOD(CMozillaBrowser::put_Resizable); + + if (!IsValid()) + { + NG_ASSERT(0); + RETURN_E_UNEXPECTED(); + } + + //TODO: Not sure if this should actually be implemented or not. + return S_OK; +} + + +/////////////////////////////////////////////////////////////////////////////// +// Ole Command Handlers + + +HRESULT _stdcall CMozillaBrowser::EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + BOOL bEditorMode = (nCmdID == IDM_EDITMODE) ? TRUE : FALSE; + pThis->SetEditorMode(bEditorMode); + return S_OK; +} + + +HRESULT _stdcall CMozillaBrowser::EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + pThis->OnEditorCommand(nCmdID); + return S_OK; +} diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h new file mode 100644 index 00000000000..26887005787 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h @@ -0,0 +1,431 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +// MozillaBrowser.h : Declaration of the CMozillaBrowser + +#ifndef __MOZILLABROWSER_H_ +#define __MOZILLABROWSER_H_ + +// This file is autogenerated by the ATL proxy wizard +// so don't edit it! +#include "CPMozillaControl.h" + +// Commands sent via WM_COMMAND +#define ID_PRINT 1 +#define ID_PAGESETUP 2 +#define ID_VIEWSOURCE 3 +#define ID_SAVEAS 4 +#define ID_PROPERTIES 5 +#define ID_CUT 6 +#define ID_COPY 7 +#define ID_PASTE 8 +#define ID_SELECTALL 9 + +// Command group and IDs exposed through IOleCommandTarget +extern const GUID CGID_IWebBrowser; +extern const GUID CGID_MSHTML; + +#define HTMLID_FIND 1 +#define HTMLID_VIEWSOURCE 2 +#define HTMLID_OPTIONS 3 + +// Some definitions which are used to make firing events easier +#define CDWebBrowserEvents1 CProxyDWebBrowserEvents +#define CDWebBrowserEvents2 CProxyDWebBrowserEvents2 + +// A list of objects +typedef CComPtr CComUnkPtr; +typedef std::vector ObjectList; + +class CWebShellContainer; + +///////////////////////////////////////////////////////////////////////////// +// CMozillaBrowser +class ATL_NO_VTABLE CMozillaBrowser : + public CComObjectRootEx, + public CComCoClass, + public CComControl, + public CDWebBrowserEvents1, + public CDWebBrowserEvents2, + public CStockPropImpl, + public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents2, &LIBID_MOZILLACONTROLLib>, + public IPersistStreamInitImpl, + public IPersistStorageImpl, + public IQuickActivateImpl, + public IOleControlImpl, + public IOleObjectImpl, + public IOleInPlaceActiveObjectImpl, + public IViewObjectExImpl, + public IOleInPlaceObjectWindowlessImpl, + public IDataObjectImpl, + public ISupportErrorInfo, + public IOleCommandTargetImpl, + public IConnectionPointContainerImpl, + public ISpecifyPropertyPagesImpl +{ + friend CWebShellContainer; +public: + CMozillaBrowser(); + virtual ~CMozillaBrowser(); + +DECLARE_REGISTRY_RESOURCEID(IDR_MOZILLABROWSER) + +BEGIN_COM_MAP(CMozillaBrowser) + // IE web browser interface + COM_INTERFACE_ENTRY(IWebBrowser2) //CMozillaBrowser Derives from IWebBrowser2 + COM_INTERFACE_ENTRY_IID(IID_IDispatch, IWebBrowser2) //Requests to IWebBrowser will actually get the vtable of IWebBrowser2 + COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser2) //ditto + COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowser2) //ditto + COM_INTERFACE_ENTRY_IMPL(IViewObjectEx) //CMozillaBrowser derives from IViewObjectEx + COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx) //Request to IViewObject2 will actually get the vtable of IViewObjectEx + COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx) + COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject) + COM_INTERFACE_ENTRY_IMPL(IOleControl) + COM_INTERFACE_ENTRY_IMPL(IOleObject) +// COM_INTERFACE_ENTRY_IMPL(IQuickActivate) // This causes size assertion in ATL + COM_INTERFACE_ENTRY_IMPL(IPersistStorage) + COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit) + COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages) + COM_INTERFACE_ENTRY_IMPL(IDataObject) + COM_INTERFACE_ENTRY(IOleCommandTarget) + COM_INTERFACE_ENTRY(IProvideClassInfo) + COM_INTERFACE_ENTRY(IProvideClassInfo2) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) + COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents, CDWebBrowserEvents1) //Requests to DWebBrowserEvents will get the vtable of CDWebBrowserEvents1 + COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, CDWebBrowserEvents2) //Requests to DWebBrowserEvents2 will get the vtable of CDWebBrowserEvents2 +END_COM_MAP() + +BEGIN_PROPERTY_MAP(CMozillaBrowser) + // Example entries + // PROP_ENTRY("Property Description", dispid, clsid) + PROP_PAGE(CLSID_StockColorPage) +END_PROPERTY_MAP() + + +BEGIN_CONNECTION_POINT_MAP(CMozillaBrowser) + // Fires IE events + CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2) //Connection points for the client's event sinks + CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents) +END_CONNECTION_POINT_MAP() + + +BEGIN_MSG_MAP(CMozillaBrowser) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) + MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) + COMMAND_ID_HANDLER(ID_PRINT, OnPrint) + COMMAND_ID_HANDLER(ID_PAGESETUP, OnPageSetup) + COMMAND_ID_HANDLER(ID_SAVEAS, OnSaveAs) + COMMAND_ID_HANDLER(ID_PROPERTIES, OnProperties) + COMMAND_ID_HANDLER(ID_CUT, OnCut) + COMMAND_ID_HANDLER(ID_COPY, OnCopy) + COMMAND_ID_HANDLER(ID_PASTE, OnPaste) + COMMAND_ID_HANDLER(ID_SELECTALL, OnSelectAll)\ +END_MSG_MAP() + + static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); + static HRESULT _stdcall EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); + +BEGIN_OLECOMMAND_TABLE() + // Standard "common" commands + OLECOMMAND_MESSAGE(OLECMDID_PRINT, NULL, ID_PRINT, L"Print", L"Print the page") + OLECOMMAND_MESSAGE(OLECMDID_PAGESETUP, NULL, ID_PAGESETUP, L"Page Setup", L"Page Setup") + OLECOMMAND_MESSAGE(OLECMDID_UNDO, NULL, 0, L"Undo", L"Undo") + OLECOMMAND_MESSAGE(OLECMDID_REDO, NULL, 0, L"Redo", L"Redo") + OLECOMMAND_MESSAGE(OLECMDID_REFRESH, NULL, 0, L"Refresh", L"Refresh") + OLECOMMAND_MESSAGE(OLECMDID_STOP, NULL, 0, L"Stop", L"Stop") + OLECOMMAND_MESSAGE(OLECMDID_ONUNLOAD, NULL, 0, L"OnUnload", L"OnUnload") + OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, ID_SAVEAS, L"SaveAs", L"Save the page") + OLECOMMAND_MESSAGE(OLECMDID_CUT, NULL, ID_CUT, L"Cut", L"Cut selection") + OLECOMMAND_MESSAGE(OLECMDID_COPY, NULL, ID_COPY, L"Copy", L"Copy selection") + OLECOMMAND_MESSAGE(OLECMDID_PASTE, NULL, ID_PASTE, L"Paste", L"Paste as selection") + OLECOMMAND_MESSAGE(OLECMDID_SELECTALL, NULL, ID_SELECTALL, L"SelectAll", L"Select all") + OLECOMMAND_MESSAGE(OLECMDID_PROPERTIES, NULL, ID_PROPERTIES, L"Properties", L"Show page properties") + // Unsupported IE 4.x command group + OLECOMMAND_MESSAGE(HTMLID_FIND, &CGID_IWebBrowser, 0, L"Find", L"Find") + OLECOMMAND_MESSAGE(HTMLID_VIEWSOURCE, &CGID_IWebBrowser, 0, L"ViewSource", L"View Source") + OLECOMMAND_MESSAGE(HTMLID_OPTIONS, &CGID_IWebBrowser, 0, L"Options", L"Options") + // DHTML editor command group + OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML, EditModeHandler, L"EditMode", L"Switch to edit mode") + OLECOMMAND_HANDLER(IDM_BROWSEMODE, &CGID_MSHTML, EditModeHandler, L"UserMode", L"Switch to user mode") + OLECOMMAND_HANDLER(IDM_BOLD, &CGID_MSHTML, EditCommandHandler, L"Bold", L"Toggle Bold") + OLECOMMAND_HANDLER(IDM_ITALIC, &CGID_MSHTML, EditCommandHandler, L"Italic", L"Toggle Italic") + OLECOMMAND_HANDLER(IDM_UNDERLINE, &CGID_MSHTML, EditCommandHandler, L"Underline", L"Toggle Underline") + OLECOMMAND_HANDLER(IDM_UNKNOWN, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNBOTTOM, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNHORIZONTALCENTERS, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNLEFT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNRIGHT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNTOGRID, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNTOP, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ALIGNVERTICALCENTERS, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ARRANGEBOTTOM, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ARRANGERIGHT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_BRINGFORWARD, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_BRINGTOFRONT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CENTERHORIZONTALLY, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CENTERVERTICALLY, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CODE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_DELETE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_FONTNAME, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_FONTSIZE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_GROUP, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_HORIZSPACECONCATENATE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_HORIZSPACEDECREASE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_HORIZSPACEINCREASE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_HORIZSPACEMAKEEQUAL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_INSERTOBJECT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_MULTILEVELREDO, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SENDBACKWARD, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SENDTOBACK, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SHOWTABLE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SIZETOCONTROL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SIZETOCONTROLHEIGHT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SIZETOCONTROLWIDTH, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SIZETOFIT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SIZETOGRID, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SNAPTOGRID, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_TABORDER, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_TOOLBOX, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_MULTILEVELUNDO, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_UNGROUP, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_VERTSPACECONCATENATE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_VERTSPACEDECREASE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_VERTSPACEINCREASE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_VERTSPACEMAKEEQUAL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_JUSTIFYFULL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_BACKCOLOR, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_BORDERCOLOR, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_FLAT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_FORECOLOR, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_JUSTIFYCENTER, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_JUSTIFYGENERAL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_JUSTIFYLEFT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_JUSTIFYRIGHT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_RAISED, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SUNKEN, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CHISELED, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_ETCHED, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SHADOWED, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_FIND, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_SHOWGRID, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST0, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST1, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST2, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST3, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST4, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST5, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST6, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST7, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST8, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST9, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_OBJECTVERBLISTLAST, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CONVERTOBJECT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CUSTOMCONTROL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CUSTOMIZEITEM, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_RENAME, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_IMPORT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_NEWPAGE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_MOVE, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_CANCEL, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_FONT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_STRIKETHROUGH, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_DELETEWORD, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_EXECPRINT, &CGID_MSHTML, NULL, L"", L"") + OLECOMMAND_HANDLER(IDM_JUSTIFYNONE, &CGID_MSHTML, NULL, L"", L"") +END_OLECOMMAND_TABLE() + + HWND GetCommandTargetWindow() const + { + return m_hWnd; + } + +// Windows message handlers + LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + LRESULT OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// IViewObjectEx + STDMETHOD(GetViewStatus)(DWORD* pdwStatus) + { + ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n")); + *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE; + return S_OK; + } + +// Protected members +protected: + // Flag to prevent multiple object registrations + static BOOL m_bRegistryInitialized; + + // Pointer to web shell manager + CWebShellContainer * m_pWebShellContainer; + // CComObject to IHTMLDocument implementer + CIEHtmlDocumentInstance * m_pDocument; + + // Mozilla interfaces + nsIWebShell * m_pIWebShell; + nsIPref * m_pIPref; + nsIEditor * m_pEditor; + nsIServiceManager * m_pIServiceManager; + + // System registry key for various control settings + CRegKey m_SystemKey; + // User registry key for various control settings + CRegKey m_UserKey; + // Indicates the browser is busy doing something + BOOL m_bBusy; + // Flag to indicate if browser is in edit mode or not + BOOL m_bEditorMode; + // Flag to indicate if the browser has a drop target + BOOL m_bDropTarget; + // Contains an error message if startup went wrong + tstring m_sErrorMessage; + // Property list + PropertyList m_PropertyList; + // Ready status of control + READYSTATE m_nBrowserReadyState; + // List of registered browser helper objects + ObjectList m_cBrowserHelperList; + + // Pointer to the component folder + nsFileSpec *m_pComponentPath; + // Pointer to the component file + nsFileSpec *m_pComponentFile; + + virtual HRESULT CreateWebShell(); + virtual HRESULT InitWebShell(); + virtual HRESULT TermWebShell(); + virtual HRESULT SetErrorInfo(LPCTSTR lpszDesc, HRESULT hr); + virtual HRESULT GetPresShell(nsIPresShell **pPresShell); + virtual HRESULT GetDOMDocument(nsIDOMDocument **pDocument); + virtual HRESULT SetEditorMode(BOOL bEnabled); + virtual HRESULT OnEditorCommand(DWORD nCmdID); + virtual BOOL IsValid(); + virtual int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = _T(""), UINT nType = MB_OK); + + virtual HRESULT LoadBrowserHelpers(); + virtual HRESULT UnloadBrowserHelpers(); + +public: +// IOleObjectImpl overrides + HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect); + +// IOleObject overrides + virtual HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite); + + +// IWebBrowser implementation + virtual HRESULT STDMETHODCALLTYPE GoBack(void); + virtual HRESULT STDMETHODCALLTYPE GoForward(void); + virtual HRESULT STDMETHODCALLTYPE GoHome(void); + virtual HRESULT STDMETHODCALLTYPE GoSearch(void); + virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers); + virtual HRESULT STDMETHODCALLTYPE Refresh(void); + virtual HRESULT STDMETHODCALLTYPE Refresh2(VARIANT __RPC_FAR *Level); + virtual HRESULT STDMETHODCALLTYPE Stop( void); + virtual HRESULT STDMETHODCALLTYPE get_Application(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + virtual HRESULT STDMETHODCALLTYPE get_Container(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + virtual HRESULT STDMETHODCALLTYPE get_TopLevelContainer(VARIANT_BOOL __RPC_FAR *pBool); + virtual HRESULT STDMETHODCALLTYPE get_Type(BSTR __RPC_FAR *Type); + virtual HRESULT STDMETHODCALLTYPE get_Left(long __RPC_FAR *pl); + virtual HRESULT STDMETHODCALLTYPE put_Left(long Left); + virtual HRESULT STDMETHODCALLTYPE get_Top(long __RPC_FAR *pl); + virtual HRESULT STDMETHODCALLTYPE put_Top(long Top); + virtual HRESULT STDMETHODCALLTYPE get_Width(long __RPC_FAR *pl); + virtual HRESULT STDMETHODCALLTYPE put_Width(long Width); + virtual HRESULT STDMETHODCALLTYPE get_Height(long __RPC_FAR *pl); + virtual HRESULT STDMETHODCALLTYPE put_Height(long Height); + virtual HRESULT STDMETHODCALLTYPE get_LocationName(BSTR __RPC_FAR *LocationName); + virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR __RPC_FAR *LocationURL); + virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL __RPC_FAR *pBool); + +// IWebBrowserApp implementation + virtual HRESULT STDMETHODCALLTYPE Quit(void); + virtual HRESULT STDMETHODCALLTYPE ClientToWindow(int __RPC_FAR *pcx, int __RPC_FAR *pcy); + virtual HRESULT STDMETHODCALLTYPE PutProperty(BSTR Property, VARIANT vtValue); + virtual HRESULT STDMETHODCALLTYPE GetProperty(BSTR Property, VARIANT __RPC_FAR *pvtValue); + virtual HRESULT STDMETHODCALLTYPE get_Name(BSTR __RPC_FAR *Name); + virtual HRESULT STDMETHODCALLTYPE get_HWND(long __RPC_FAR *pHWND); + virtual HRESULT STDMETHODCALLTYPE get_FullName(BSTR __RPC_FAR *FullName); + virtual HRESULT STDMETHODCALLTYPE get_Path(BSTR __RPC_FAR *Path); + virtual HRESULT STDMETHODCALLTYPE get_Visible(VARIANT_BOOL __RPC_FAR *pBool); + virtual HRESULT STDMETHODCALLTYPE put_Visible(VARIANT_BOOL Value); + virtual HRESULT STDMETHODCALLTYPE get_StatusBar(VARIANT_BOOL __RPC_FAR *pBool); + virtual HRESULT STDMETHODCALLTYPE put_StatusBar(VARIANT_BOOL Value); + virtual HRESULT STDMETHODCALLTYPE get_StatusText(BSTR __RPC_FAR *StatusText); + virtual HRESULT STDMETHODCALLTYPE put_StatusText(BSTR StatusText); + virtual HRESULT STDMETHODCALLTYPE get_ToolBar(int __RPC_FAR *Value); + virtual HRESULT STDMETHODCALLTYPE put_ToolBar(int Value); + virtual HRESULT STDMETHODCALLTYPE get_MenuBar(VARIANT_BOOL __RPC_FAR *Value); + virtual HRESULT STDMETHODCALLTYPE put_MenuBar(VARIANT_BOOL Value); + virtual HRESULT STDMETHODCALLTYPE get_FullScreen(VARIANT_BOOL __RPC_FAR *pbFullScreen); + virtual HRESULT STDMETHODCALLTYPE put_FullScreen(VARIANT_BOOL bFullScreen); + +// IWebBrowser2 implementation + virtual HRESULT STDMETHODCALLTYPE Navigate2(VARIANT __RPC_FAR *URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers); + virtual HRESULT STDMETHODCALLTYPE QueryStatusWB(OLECMDID cmdID, OLECMDF __RPC_FAR *pcmdf); + virtual HRESULT STDMETHODCALLTYPE ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut); + virtual HRESULT STDMETHODCALLTYPE ShowBrowserBar(VARIANT __RPC_FAR *pvaClsid, VARIANT __RPC_FAR *pvarShow, VARIANT __RPC_FAR *pvarSize); + virtual HRESULT STDMETHODCALLTYPE get_ReadyState(READYSTATE __RPC_FAR *plReadyState); + virtual HRESULT STDMETHODCALLTYPE get_Offline(VARIANT_BOOL __RPC_FAR *pbOffline); + virtual HRESULT STDMETHODCALLTYPE put_Offline(VARIANT_BOOL bOffline); + virtual HRESULT STDMETHODCALLTYPE get_Silent(VARIANT_BOOL __RPC_FAR *pbSilent); + virtual HRESULT STDMETHODCALLTYPE put_Silent(VARIANT_BOOL bSilent); + virtual HRESULT STDMETHODCALLTYPE get_RegisterAsBrowser(VARIANT_BOOL __RPC_FAR *pbRegister); + virtual HRESULT STDMETHODCALLTYPE put_RegisterAsBrowser(VARIANT_BOOL bRegister); + virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister); + virtual HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(VARIANT_BOOL bRegister); + virtual HRESULT STDMETHODCALLTYPE get_TheaterMode(VARIANT_BOOL __RPC_FAR *pbRegister); + virtual HRESULT STDMETHODCALLTYPE put_TheaterMode(VARIANT_BOOL bRegister); + virtual HRESULT STDMETHODCALLTYPE get_AddressBar(VARIANT_BOOL __RPC_FAR *Value); + virtual HRESULT STDMETHODCALLTYPE put_AddressBar(VARIANT_BOOL Value); + virtual HRESULT STDMETHODCALLTYPE get_Resizable(VARIANT_BOOL __RPC_FAR *Value); + virtual HRESULT STDMETHODCALLTYPE put_Resizable(VARIANT_BOOL Value); + +public: + HRESULT OnDraw(ATL_DRAWINFO& di); + +}; + +#endif //__MOZILLABROWSER_H_ diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.ico b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.ico new file mode 100644 index 00000000000..01c6f785d3e Binary files /dev/null and b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.ico differ diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.rgs b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.rgs new file mode 100644 index 00000000000..4bf4b5113df --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.rgs @@ -0,0 +1,34 @@ +HKCR +{ + Mozilla.Browser.1 = s 'Mozilla Web Browser' + { + CLSID = s '{1339B54C-3453-11D2-93B9-000000000000}' + } + Mozilla.Browser = s 'Mozilla Web Browser' + { + CurVer = s 'Mozilla.Browser.1' + } + NoRemove CLSID + { + ForceRemove {1339B54C-3453-11D2-93B9-000000000000} = s 'MozillaBrowser Class' + { + ProgID = s 'Mozilla.Browser.1' + VersionIndependentProgID = s 'Mozilla.Browser' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + ForceRemove 'Control' + ForceRemove 'Programmable' + ForceRemove 'Insertable' + ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 1' + 'MiscStatus' = s '0' + { + '1' = s '131473' + } + 'TypeLib' = s '{1339B53E-3453-11D2-93B9-000000000000}' + 'Version' = s '1.0' + } + } +} diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.cpp b/mozilla/embedding/browser/activex/src/control/MozillaControl.cpp new file mode 100644 index 00000000000..6c867d27715 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.cpp @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +// MozillaControl.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f MozillaControlps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include "initguid.h" +#include "MozillaControl.h" + +#include "MozillaControl_i.c" +#ifdef USE_CONTROL +#include "MozillaBrowser.h" +#endif + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +#ifdef USE_CONTROL + OBJECT_ENTRY(CLSID_MozillaBrowser, CMozillaBrowser) +#endif +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + NG_TRACE_METHOD(DllMain); + + if (dwReason == DLL_PROCESS_ATTACH) + { + NG_TRACE(_T("Mozilla ActiveX - DLL_PROCESS_ATTACH\n")); + _Module.Init(ObjectMap, hInstance); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + { + NG_TRACE(_T("Mozilla ActiveX - DLL_PROCESS_DETACH\n")); + _Module.Term(); + } + + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + _Module.UnregisterServer(); + return S_OK; +} + + diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.h b/mozilla/embedding/browser/activex/src/control/MozillaControl.h new file mode 100644 index 00000000000..47700fce203 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.h @@ -0,0 +1,2596 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Thu Nov 11 22:06:45 1999 + */ +/* Compiler settings for MozillaControl.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __MozillaControl_h__ +#define __MozillaControl_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __IWebBrowser_FWD_DEFINED__ +#define __IWebBrowser_FWD_DEFINED__ +typedef interface IWebBrowser IWebBrowser; +#endif /* __IWebBrowser_FWD_DEFINED__ */ + + +#ifndef __IWebBrowserApp_FWD_DEFINED__ +#define __IWebBrowserApp_FWD_DEFINED__ +typedef interface IWebBrowserApp IWebBrowserApp; +#endif /* __IWebBrowserApp_FWD_DEFINED__ */ + + +#ifndef __IWebBrowser2_FWD_DEFINED__ +#define __IWebBrowser2_FWD_DEFINED__ +typedef interface IWebBrowser2 IWebBrowser2; +#endif /* __IWebBrowser2_FWD_DEFINED__ */ + + +#ifndef __DWebBrowserEvents_FWD_DEFINED__ +#define __DWebBrowserEvents_FWD_DEFINED__ +typedef interface DWebBrowserEvents DWebBrowserEvents; +#endif /* __DWebBrowserEvents_FWD_DEFINED__ */ + + +#ifndef __DWebBrowserEvents2_FWD_DEFINED__ +#define __DWebBrowserEvents2_FWD_DEFINED__ +typedef interface DWebBrowserEvents2 DWebBrowserEvents2; +#endif /* __DWebBrowserEvents2_FWD_DEFINED__ */ + + +#ifndef __MozillaBrowser_FWD_DEFINED__ +#define __MozillaBrowser_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class MozillaBrowser MozillaBrowser; +#else +typedef struct MozillaBrowser MozillaBrowser; +#endif /* __cplusplus */ + +#endif /* __MozillaBrowser_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "docobj.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + + +#ifndef __MOZILLACONTROLLib_LIBRARY_DEFINED__ +#define __MOZILLACONTROLLib_LIBRARY_DEFINED__ + +/* library MOZILLACONTROLLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_MOZILLACONTROLLib; + +#ifndef __IWebBrowser_INTERFACE_DEFINED__ +#define __IWebBrowser_INTERFACE_DEFINED__ + +/* interface IWebBrowser */ +/* [object][oleautomation][dual][hidden][helpcontext][helpstring][uuid] */ + +typedef /* [helpstring][uuid] */ +enum BrowserNavConstants + { navOpenInNewWindow = 0x1, + navNoHistory = 0x2, + navNoReadFromCache = 0x4, + navNoWriteToCache = 0x8, + navAllowAutosearch = 0x10, + navBrowserBar = 0x20 + } BrowserNavConstants; + +typedef /* [helpstring][uuid] */ +enum RefreshConstants + { REFRESH_NORMAL = 0, + REFRESH_IFEXPIRED = 1, + REFRESH_COMPLETELY = 3 + } RefreshConstants; + + +EXTERN_C const IID IID_IWebBrowser; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B") + IWebBrowser : public IDispatch + { + public: + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoBack( void) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoForward( void) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoHome( void) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoSearch( void) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Navigate( + /* [in] */ BSTR URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Refresh( void) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Refresh2( + /* [optional][in] */ VARIANT __RPC_FAR *Level) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Application( + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Parent( + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Container( + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Document( + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_TopLevelContainer( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ BSTR __RPC_FAR *Type) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Left( + /* [retval][out] */ long __RPC_FAR *pl) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Left( + /* [in] */ long Left) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Top( + /* [retval][out] */ long __RPC_FAR *pl) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Top( + /* [in] */ long Top) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Width( + /* [retval][out] */ long __RPC_FAR *pl) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Width( + /* [in] */ long Width) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Height( + /* [retval][out] */ long __RPC_FAR *pl) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Height( + /* [in] */ long Height) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_LocationName( + /* [retval][out] */ BSTR __RPC_FAR *LocationName) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_LocationURL( + /* [retval][out] */ BSTR __RPC_FAR *LocationURL) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Busy( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool) = 0; + + }; + +#else /* C style interface */ + + typedef struct IWebBrowserVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IWebBrowser __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IWebBrowser __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IWebBrowser __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IWebBrowser __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IWebBrowser __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IWebBrowser __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IWebBrowser __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoBack )( + IWebBrowser __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoForward )( + IWebBrowser __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoHome )( + IWebBrowser __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoSearch )( + IWebBrowser __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Navigate )( + IWebBrowser __RPC_FAR * This, + /* [in] */ BSTR URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Refresh )( + IWebBrowser __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Refresh2 )( + IWebBrowser __RPC_FAR * This, + /* [optional][in] */ VARIANT __RPC_FAR *Level); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Stop )( + IWebBrowser __RPC_FAR * This); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Application )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Parent )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Container )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Document )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_TopLevelContainer )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Type )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Type); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Left )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Left )( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Left); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Top )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Top )( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Top); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Width )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Width )( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Width); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Height )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Height )( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Height); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocationName )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationName); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocationURL )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationURL); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Busy )( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + END_INTERFACE + } IWebBrowserVtbl; + + interface IWebBrowser + { + CONST_VTBL struct IWebBrowserVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IWebBrowser_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IWebBrowser_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IWebBrowser_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IWebBrowser_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IWebBrowser_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IWebBrowser_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IWebBrowser_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IWebBrowser_GoBack(This) \ + (This)->lpVtbl -> GoBack(This) + +#define IWebBrowser_GoForward(This) \ + (This)->lpVtbl -> GoForward(This) + +#define IWebBrowser_GoHome(This) \ + (This)->lpVtbl -> GoHome(This) + +#define IWebBrowser_GoSearch(This) \ + (This)->lpVtbl -> GoSearch(This) + +#define IWebBrowser_Navigate(This,URL,Flags,TargetFrameName,PostData,Headers) \ + (This)->lpVtbl -> Navigate(This,URL,Flags,TargetFrameName,PostData,Headers) + +#define IWebBrowser_Refresh(This) \ + (This)->lpVtbl -> Refresh(This) + +#define IWebBrowser_Refresh2(This,Level) \ + (This)->lpVtbl -> Refresh2(This,Level) + +#define IWebBrowser_Stop(This) \ + (This)->lpVtbl -> Stop(This) + +#define IWebBrowser_get_Application(This,ppDisp) \ + (This)->lpVtbl -> get_Application(This,ppDisp) + +#define IWebBrowser_get_Parent(This,ppDisp) \ + (This)->lpVtbl -> get_Parent(This,ppDisp) + +#define IWebBrowser_get_Container(This,ppDisp) \ + (This)->lpVtbl -> get_Container(This,ppDisp) + +#define IWebBrowser_get_Document(This,ppDisp) \ + (This)->lpVtbl -> get_Document(This,ppDisp) + +#define IWebBrowser_get_TopLevelContainer(This,pBool) \ + (This)->lpVtbl -> get_TopLevelContainer(This,pBool) + +#define IWebBrowser_get_Type(This,Type) \ + (This)->lpVtbl -> get_Type(This,Type) + +#define IWebBrowser_get_Left(This,pl) \ + (This)->lpVtbl -> get_Left(This,pl) + +#define IWebBrowser_put_Left(This,Left) \ + (This)->lpVtbl -> put_Left(This,Left) + +#define IWebBrowser_get_Top(This,pl) \ + (This)->lpVtbl -> get_Top(This,pl) + +#define IWebBrowser_put_Top(This,Top) \ + (This)->lpVtbl -> put_Top(This,Top) + +#define IWebBrowser_get_Width(This,pl) \ + (This)->lpVtbl -> get_Width(This,pl) + +#define IWebBrowser_put_Width(This,Width) \ + (This)->lpVtbl -> put_Width(This,Width) + +#define IWebBrowser_get_Height(This,pl) \ + (This)->lpVtbl -> get_Height(This,pl) + +#define IWebBrowser_put_Height(This,Height) \ + (This)->lpVtbl -> put_Height(This,Height) + +#define IWebBrowser_get_LocationName(This,LocationName) \ + (This)->lpVtbl -> get_LocationName(This,LocationName) + +#define IWebBrowser_get_LocationURL(This,LocationURL) \ + (This)->lpVtbl -> get_LocationURL(This,LocationURL) + +#define IWebBrowser_get_Busy(This,pBool) \ + (This)->lpVtbl -> get_Busy(This,pBool) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_GoBack_Proxy( + IWebBrowser __RPC_FAR * This); + + +void __RPC_STUB IWebBrowser_GoBack_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_GoForward_Proxy( + IWebBrowser __RPC_FAR * This); + + +void __RPC_STUB IWebBrowser_GoForward_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_GoHome_Proxy( + IWebBrowser __RPC_FAR * This); + + +void __RPC_STUB IWebBrowser_GoHome_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_GoSearch_Proxy( + IWebBrowser __RPC_FAR * This); + + +void __RPC_STUB IWebBrowser_GoSearch_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_Navigate_Proxy( + IWebBrowser __RPC_FAR * This, + /* [in] */ BSTR URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers); + + +void __RPC_STUB IWebBrowser_Navigate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_Refresh_Proxy( + IWebBrowser __RPC_FAR * This); + + +void __RPC_STUB IWebBrowser_Refresh_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_Refresh2_Proxy( + IWebBrowser __RPC_FAR * This, + /* [optional][in] */ VARIANT __RPC_FAR *Level); + + +void __RPC_STUB IWebBrowser_Refresh2_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_Stop_Proxy( + IWebBrowser __RPC_FAR * This); + + +void __RPC_STUB IWebBrowser_Stop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Application_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + +void __RPC_STUB IWebBrowser_get_Application_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Parent_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + +void __RPC_STUB IWebBrowser_get_Parent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Container_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + +void __RPC_STUB IWebBrowser_get_Container_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Document_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + +void __RPC_STUB IWebBrowser_get_Document_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_TopLevelContainer_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + +void __RPC_STUB IWebBrowser_get_TopLevelContainer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Type_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Type); + + +void __RPC_STUB IWebBrowser_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Left_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + +void __RPC_STUB IWebBrowser_get_Left_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_put_Left_Proxy( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Left); + + +void __RPC_STUB IWebBrowser_put_Left_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Top_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + +void __RPC_STUB IWebBrowser_get_Top_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_put_Top_Proxy( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Top); + + +void __RPC_STUB IWebBrowser_put_Top_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Width_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + +void __RPC_STUB IWebBrowser_get_Width_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_put_Width_Proxy( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Width); + + +void __RPC_STUB IWebBrowser_put_Width_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Height_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + +void __RPC_STUB IWebBrowser_get_Height_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_put_Height_Proxy( + IWebBrowser __RPC_FAR * This, + /* [in] */ long Height); + + +void __RPC_STUB IWebBrowser_put_Height_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_LocationName_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationName); + + +void __RPC_STUB IWebBrowser_get_LocationName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_LocationURL_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationURL); + + +void __RPC_STUB IWebBrowser_get_LocationURL_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser_get_Busy_Proxy( + IWebBrowser __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + +void __RPC_STUB IWebBrowser_get_Busy_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IWebBrowser_INTERFACE_DEFINED__ */ + + +#ifndef __IWebBrowserApp_INTERFACE_DEFINED__ +#define __IWebBrowserApp_INTERFACE_DEFINED__ + +/* interface IWebBrowserApp */ +/* [object][dual][oleautomation][hidden][helpcontext][helpstring][uuid] */ + + +EXTERN_C const IID IID_IWebBrowserApp; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0002DF05-0000-0000-C000-000000000046") + IWebBrowserApp : public IWebBrowser + { + public: + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Quit( void) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE ClientToWindow( + /* [out][in] */ int __RPC_FAR *pcx, + /* [out][in] */ int __RPC_FAR *pcy) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE PutProperty( + /* [in] */ BSTR Property, + /* [in] */ VARIANT vtValue) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProperty( + /* [in] */ BSTR Property, + /* [retval][out] */ VARIANT __RPC_FAR *pvtValue) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR __RPC_FAR *Name) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_HWND( + /* [retval][out] */ long __RPC_FAR *pHWND) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_FullName( + /* [retval][out] */ BSTR __RPC_FAR *FullName) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Path( + /* [retval][out] */ BSTR __RPC_FAR *Path) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Visible( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Visible( + /* [in] */ VARIANT_BOOL Value) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_StatusBar( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_StatusBar( + /* [in] */ VARIANT_BOOL Value) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_StatusText( + /* [retval][out] */ BSTR __RPC_FAR *StatusText) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_StatusText( + /* [in] */ BSTR StatusText) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ToolBar( + /* [retval][out] */ int __RPC_FAR *Value) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_ToolBar( + /* [in] */ int Value) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_MenuBar( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_MenuBar( + /* [in] */ VARIANT_BOOL Value) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_FullScreen( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbFullScreen) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_FullScreen( + /* [in] */ VARIANT_BOOL bFullScreen) = 0; + + }; + +#else /* C style interface */ + + typedef struct IWebBrowserAppVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IWebBrowserApp __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IWebBrowserApp __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IWebBrowserApp __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoBack )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoForward )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoHome )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoSearch )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Navigate )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Refresh )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Refresh2 )( + IWebBrowserApp __RPC_FAR * This, + /* [optional][in] */ VARIANT __RPC_FAR *Level); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Stop )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Application )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Parent )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Container )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Document )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_TopLevelContainer )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Type )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Type); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Left )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Left )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ long Left); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Top )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Top )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ long Top); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Width )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Width )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ long Width); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Height )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Height )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ long Height); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocationName )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationName); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocationURL )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationURL); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Busy )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Quit )( + IWebBrowserApp __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClientToWindow )( + IWebBrowserApp __RPC_FAR * This, + /* [out][in] */ int __RPC_FAR *pcx, + /* [out][in] */ int __RPC_FAR *pcy); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *PutProperty )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR Property, + /* [in] */ VARIANT vtValue); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProperty )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR Property, + /* [retval][out] */ VARIANT __RPC_FAR *pvtValue); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Name )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Name); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_HWND )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pHWND); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_FullName )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *FullName); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Path )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Path); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Visible )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Visible )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_StatusBar )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_StatusBar )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_StatusText )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *StatusText); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_StatusText )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR StatusText); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_ToolBar )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ int __RPC_FAR *Value); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_ToolBar )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ int Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_MenuBar )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_MenuBar )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_FullScreen )( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbFullScreen); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_FullScreen )( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bFullScreen); + + END_INTERFACE + } IWebBrowserAppVtbl; + + interface IWebBrowserApp + { + CONST_VTBL struct IWebBrowserAppVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IWebBrowserApp_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IWebBrowserApp_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IWebBrowserApp_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IWebBrowserApp_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IWebBrowserApp_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IWebBrowserApp_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IWebBrowserApp_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IWebBrowserApp_GoBack(This) \ + (This)->lpVtbl -> GoBack(This) + +#define IWebBrowserApp_GoForward(This) \ + (This)->lpVtbl -> GoForward(This) + +#define IWebBrowserApp_GoHome(This) \ + (This)->lpVtbl -> GoHome(This) + +#define IWebBrowserApp_GoSearch(This) \ + (This)->lpVtbl -> GoSearch(This) + +#define IWebBrowserApp_Navigate(This,URL,Flags,TargetFrameName,PostData,Headers) \ + (This)->lpVtbl -> Navigate(This,URL,Flags,TargetFrameName,PostData,Headers) + +#define IWebBrowserApp_Refresh(This) \ + (This)->lpVtbl -> Refresh(This) + +#define IWebBrowserApp_Refresh2(This,Level) \ + (This)->lpVtbl -> Refresh2(This,Level) + +#define IWebBrowserApp_Stop(This) \ + (This)->lpVtbl -> Stop(This) + +#define IWebBrowserApp_get_Application(This,ppDisp) \ + (This)->lpVtbl -> get_Application(This,ppDisp) + +#define IWebBrowserApp_get_Parent(This,ppDisp) \ + (This)->lpVtbl -> get_Parent(This,ppDisp) + +#define IWebBrowserApp_get_Container(This,ppDisp) \ + (This)->lpVtbl -> get_Container(This,ppDisp) + +#define IWebBrowserApp_get_Document(This,ppDisp) \ + (This)->lpVtbl -> get_Document(This,ppDisp) + +#define IWebBrowserApp_get_TopLevelContainer(This,pBool) \ + (This)->lpVtbl -> get_TopLevelContainer(This,pBool) + +#define IWebBrowserApp_get_Type(This,Type) \ + (This)->lpVtbl -> get_Type(This,Type) + +#define IWebBrowserApp_get_Left(This,pl) \ + (This)->lpVtbl -> get_Left(This,pl) + +#define IWebBrowserApp_put_Left(This,Left) \ + (This)->lpVtbl -> put_Left(This,Left) + +#define IWebBrowserApp_get_Top(This,pl) \ + (This)->lpVtbl -> get_Top(This,pl) + +#define IWebBrowserApp_put_Top(This,Top) \ + (This)->lpVtbl -> put_Top(This,Top) + +#define IWebBrowserApp_get_Width(This,pl) \ + (This)->lpVtbl -> get_Width(This,pl) + +#define IWebBrowserApp_put_Width(This,Width) \ + (This)->lpVtbl -> put_Width(This,Width) + +#define IWebBrowserApp_get_Height(This,pl) \ + (This)->lpVtbl -> get_Height(This,pl) + +#define IWebBrowserApp_put_Height(This,Height) \ + (This)->lpVtbl -> put_Height(This,Height) + +#define IWebBrowserApp_get_LocationName(This,LocationName) \ + (This)->lpVtbl -> get_LocationName(This,LocationName) + +#define IWebBrowserApp_get_LocationURL(This,LocationURL) \ + (This)->lpVtbl -> get_LocationURL(This,LocationURL) + +#define IWebBrowserApp_get_Busy(This,pBool) \ + (This)->lpVtbl -> get_Busy(This,pBool) + + +#define IWebBrowserApp_Quit(This) \ + (This)->lpVtbl -> Quit(This) + +#define IWebBrowserApp_ClientToWindow(This,pcx,pcy) \ + (This)->lpVtbl -> ClientToWindow(This,pcx,pcy) + +#define IWebBrowserApp_PutProperty(This,Property,vtValue) \ + (This)->lpVtbl -> PutProperty(This,Property,vtValue) + +#define IWebBrowserApp_GetProperty(This,Property,pvtValue) \ + (This)->lpVtbl -> GetProperty(This,Property,pvtValue) + +#define IWebBrowserApp_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define IWebBrowserApp_get_HWND(This,pHWND) \ + (This)->lpVtbl -> get_HWND(This,pHWND) + +#define IWebBrowserApp_get_FullName(This,FullName) \ + (This)->lpVtbl -> get_FullName(This,FullName) + +#define IWebBrowserApp_get_Path(This,Path) \ + (This)->lpVtbl -> get_Path(This,Path) + +#define IWebBrowserApp_get_Visible(This,pBool) \ + (This)->lpVtbl -> get_Visible(This,pBool) + +#define IWebBrowserApp_put_Visible(This,Value) \ + (This)->lpVtbl -> put_Visible(This,Value) + +#define IWebBrowserApp_get_StatusBar(This,pBool) \ + (This)->lpVtbl -> get_StatusBar(This,pBool) + +#define IWebBrowserApp_put_StatusBar(This,Value) \ + (This)->lpVtbl -> put_StatusBar(This,Value) + +#define IWebBrowserApp_get_StatusText(This,StatusText) \ + (This)->lpVtbl -> get_StatusText(This,StatusText) + +#define IWebBrowserApp_put_StatusText(This,StatusText) \ + (This)->lpVtbl -> put_StatusText(This,StatusText) + +#define IWebBrowserApp_get_ToolBar(This,Value) \ + (This)->lpVtbl -> get_ToolBar(This,Value) + +#define IWebBrowserApp_put_ToolBar(This,Value) \ + (This)->lpVtbl -> put_ToolBar(This,Value) + +#define IWebBrowserApp_get_MenuBar(This,Value) \ + (This)->lpVtbl -> get_MenuBar(This,Value) + +#define IWebBrowserApp_put_MenuBar(This,Value) \ + (This)->lpVtbl -> put_MenuBar(This,Value) + +#define IWebBrowserApp_get_FullScreen(This,pbFullScreen) \ + (This)->lpVtbl -> get_FullScreen(This,pbFullScreen) + +#define IWebBrowserApp_put_FullScreen(This,bFullScreen) \ + (This)->lpVtbl -> put_FullScreen(This,bFullScreen) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_Quit_Proxy( + IWebBrowserApp __RPC_FAR * This); + + +void __RPC_STUB IWebBrowserApp_Quit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_ClientToWindow_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [out][in] */ int __RPC_FAR *pcx, + /* [out][in] */ int __RPC_FAR *pcy); + + +void __RPC_STUB IWebBrowserApp_ClientToWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_PutProperty_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR Property, + /* [in] */ VARIANT vtValue); + + +void __RPC_STUB IWebBrowserApp_PutProperty_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_GetProperty_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR Property, + /* [retval][out] */ VARIANT __RPC_FAR *pvtValue); + + +void __RPC_STUB IWebBrowserApp_GetProperty_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_Name_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Name); + + +void __RPC_STUB IWebBrowserApp_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_HWND_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pHWND); + + +void __RPC_STUB IWebBrowserApp_get_HWND_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_FullName_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *FullName); + + +void __RPC_STUB IWebBrowserApp_get_FullName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_Path_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Path); + + +void __RPC_STUB IWebBrowserApp_get_Path_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_Visible_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + +void __RPC_STUB IWebBrowserApp_get_Visible_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_put_Visible_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + +void __RPC_STUB IWebBrowserApp_put_Visible_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_StatusBar_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + +void __RPC_STUB IWebBrowserApp_get_StatusBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_put_StatusBar_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + +void __RPC_STUB IWebBrowserApp_put_StatusBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_StatusText_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *StatusText); + + +void __RPC_STUB IWebBrowserApp_get_StatusText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_put_StatusText_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ BSTR StatusText); + + +void __RPC_STUB IWebBrowserApp_put_StatusText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_ToolBar_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ int __RPC_FAR *Value); + + +void __RPC_STUB IWebBrowserApp_get_ToolBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_put_ToolBar_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ int Value); + + +void __RPC_STUB IWebBrowserApp_put_ToolBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_MenuBar_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + +void __RPC_STUB IWebBrowserApp_get_MenuBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_put_MenuBar_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + +void __RPC_STUB IWebBrowserApp_put_MenuBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_get_FullScreen_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbFullScreen); + + +void __RPC_STUB IWebBrowserApp_get_FullScreen_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowserApp_put_FullScreen_Proxy( + IWebBrowserApp __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bFullScreen); + + +void __RPC_STUB IWebBrowserApp_put_FullScreen_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IWebBrowserApp_INTERFACE_DEFINED__ */ + + +#ifndef __IWebBrowser2_INTERFACE_DEFINED__ +#define __IWebBrowser2_INTERFACE_DEFINED__ + +/* interface IWebBrowser2 */ +/* [object][dual][oleautomation][hidden][helpcontext][helpstring][uuid] */ + + +EXTERN_C const IID IID_IWebBrowser2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D30C1661-CDAF-11d0-8A3E-00C04FC9E26E") + IWebBrowser2 : public IWebBrowserApp + { + public: + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Navigate2( + /* [in] */ VARIANT __RPC_FAR *URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE QueryStatusWB( + /* [in] */ OLECMDID cmdID, + /* [retval][out] */ OLECMDF __RPC_FAR *pcmdf) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE ExecWB( + /* [in] */ OLECMDID cmdID, + /* [in] */ OLECMDEXECOPT cmdexecopt, + /* [optional][in] */ VARIANT __RPC_FAR *pvaIn, + /* [optional][in][out] */ VARIANT __RPC_FAR *pvaOut) = 0; + + virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE ShowBrowserBar( + /* [in] */ VARIANT __RPC_FAR *pvaClsid, + /* [optional][in] */ VARIANT __RPC_FAR *pvarShow, + /* [optional][in] */ VARIANT __RPC_FAR *pvarSize) = 0; + + virtual /* [bindable][propget][id] */ HRESULT STDMETHODCALLTYPE get_ReadyState( + /* [out][retval] */ READYSTATE __RPC_FAR *plReadyState) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Offline( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbOffline) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Offline( + /* [in] */ VARIANT_BOOL bOffline) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Silent( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbSilent) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Silent( + /* [in] */ VARIANT_BOOL bSilent) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_RegisterAsBrowser( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_RegisterAsBrowser( + /* [in] */ VARIANT_BOOL bRegister) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget( + /* [in] */ VARIANT_BOOL bRegister) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_TheaterMode( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_TheaterMode( + /* [in] */ VARIANT_BOOL bRegister) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AddressBar( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AddressBar( + /* [in] */ VARIANT_BOOL Value) = 0; + + virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Resizable( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value) = 0; + + virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Resizable( + /* [in] */ VARIANT_BOOL Value) = 0; + + }; + +#else /* C style interface */ + + typedef struct IWebBrowser2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IWebBrowser2 __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IWebBrowser2 __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IWebBrowser2 __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoBack )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoForward )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoHome )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GoSearch )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Navigate )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ BSTR URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Refresh )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Refresh2 )( + IWebBrowser2 __RPC_FAR * This, + /* [optional][in] */ VARIANT __RPC_FAR *Level); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Stop )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Application )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Parent )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Container )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Document )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_TopLevelContainer )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Type )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Type); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Left )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Left )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ long Left); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Top )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Top )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ long Top); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Width )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Width )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ long Width); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Height )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pl); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Height )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ long Height); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocationName )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationName); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocationURL )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *LocationURL); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Busy )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Quit )( + IWebBrowser2 __RPC_FAR * This); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClientToWindow )( + IWebBrowser2 __RPC_FAR * This, + /* [out][in] */ int __RPC_FAR *pcx, + /* [out][in] */ int __RPC_FAR *pcy); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *PutProperty )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ BSTR Property, + /* [in] */ VARIANT vtValue); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProperty )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ BSTR Property, + /* [retval][out] */ VARIANT __RPC_FAR *pvtValue); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Name )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Name); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_HWND )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pHWND); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_FullName )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *FullName); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Path )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *Path); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Visible )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Visible )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_StatusBar )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pBool); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_StatusBar )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_StatusText )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *StatusText); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_StatusText )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ BSTR StatusText); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_ToolBar )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ int __RPC_FAR *Value); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_ToolBar )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ int Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_MenuBar )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_MenuBar )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_FullScreen )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbFullScreen); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_FullScreen )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bFullScreen); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Navigate2 )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryStatusWB )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ OLECMDID cmdID, + /* [retval][out] */ OLECMDF __RPC_FAR *pcmdf); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ExecWB )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ OLECMDID cmdID, + /* [in] */ OLECMDEXECOPT cmdexecopt, + /* [optional][in] */ VARIANT __RPC_FAR *pvaIn, + /* [optional][in][out] */ VARIANT __RPC_FAR *pvaOut); + + /* [helpcontext][helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowBrowserBar )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pvaClsid, + /* [optional][in] */ VARIANT __RPC_FAR *pvarShow, + /* [optional][in] */ VARIANT __RPC_FAR *pvarSize); + + /* [bindable][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_ReadyState )( + IWebBrowser2 __RPC_FAR * This, + /* [out][retval] */ READYSTATE __RPC_FAR *plReadyState); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Offline )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbOffline); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Offline )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bOffline); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Silent )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbSilent); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Silent )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bSilent); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_RegisterAsBrowser )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_RegisterAsBrowser )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bRegister); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_RegisterAsDropTarget )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_RegisterAsDropTarget )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bRegister); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_TheaterMode )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_TheaterMode )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bRegister); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_AddressBar )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_AddressBar )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + /* [helpcontext][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Resizable )( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + /* [helpcontext][helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Resizable )( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + END_INTERFACE + } IWebBrowser2Vtbl; + + interface IWebBrowser2 + { + CONST_VTBL struct IWebBrowser2Vtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IWebBrowser2_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IWebBrowser2_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IWebBrowser2_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IWebBrowser2_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IWebBrowser2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IWebBrowser2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IWebBrowser2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IWebBrowser2_GoBack(This) \ + (This)->lpVtbl -> GoBack(This) + +#define IWebBrowser2_GoForward(This) \ + (This)->lpVtbl -> GoForward(This) + +#define IWebBrowser2_GoHome(This) \ + (This)->lpVtbl -> GoHome(This) + +#define IWebBrowser2_GoSearch(This) \ + (This)->lpVtbl -> GoSearch(This) + +#define IWebBrowser2_Navigate(This,URL,Flags,TargetFrameName,PostData,Headers) \ + (This)->lpVtbl -> Navigate(This,URL,Flags,TargetFrameName,PostData,Headers) + +#define IWebBrowser2_Refresh(This) \ + (This)->lpVtbl -> Refresh(This) + +#define IWebBrowser2_Refresh2(This,Level) \ + (This)->lpVtbl -> Refresh2(This,Level) + +#define IWebBrowser2_Stop(This) \ + (This)->lpVtbl -> Stop(This) + +#define IWebBrowser2_get_Application(This,ppDisp) \ + (This)->lpVtbl -> get_Application(This,ppDisp) + +#define IWebBrowser2_get_Parent(This,ppDisp) \ + (This)->lpVtbl -> get_Parent(This,ppDisp) + +#define IWebBrowser2_get_Container(This,ppDisp) \ + (This)->lpVtbl -> get_Container(This,ppDisp) + +#define IWebBrowser2_get_Document(This,ppDisp) \ + (This)->lpVtbl -> get_Document(This,ppDisp) + +#define IWebBrowser2_get_TopLevelContainer(This,pBool) \ + (This)->lpVtbl -> get_TopLevelContainer(This,pBool) + +#define IWebBrowser2_get_Type(This,Type) \ + (This)->lpVtbl -> get_Type(This,Type) + +#define IWebBrowser2_get_Left(This,pl) \ + (This)->lpVtbl -> get_Left(This,pl) + +#define IWebBrowser2_put_Left(This,Left) \ + (This)->lpVtbl -> put_Left(This,Left) + +#define IWebBrowser2_get_Top(This,pl) \ + (This)->lpVtbl -> get_Top(This,pl) + +#define IWebBrowser2_put_Top(This,Top) \ + (This)->lpVtbl -> put_Top(This,Top) + +#define IWebBrowser2_get_Width(This,pl) \ + (This)->lpVtbl -> get_Width(This,pl) + +#define IWebBrowser2_put_Width(This,Width) \ + (This)->lpVtbl -> put_Width(This,Width) + +#define IWebBrowser2_get_Height(This,pl) \ + (This)->lpVtbl -> get_Height(This,pl) + +#define IWebBrowser2_put_Height(This,Height) \ + (This)->lpVtbl -> put_Height(This,Height) + +#define IWebBrowser2_get_LocationName(This,LocationName) \ + (This)->lpVtbl -> get_LocationName(This,LocationName) + +#define IWebBrowser2_get_LocationURL(This,LocationURL) \ + (This)->lpVtbl -> get_LocationURL(This,LocationURL) + +#define IWebBrowser2_get_Busy(This,pBool) \ + (This)->lpVtbl -> get_Busy(This,pBool) + + +#define IWebBrowser2_Quit(This) \ + (This)->lpVtbl -> Quit(This) + +#define IWebBrowser2_ClientToWindow(This,pcx,pcy) \ + (This)->lpVtbl -> ClientToWindow(This,pcx,pcy) + +#define IWebBrowser2_PutProperty(This,Property,vtValue) \ + (This)->lpVtbl -> PutProperty(This,Property,vtValue) + +#define IWebBrowser2_GetProperty(This,Property,pvtValue) \ + (This)->lpVtbl -> GetProperty(This,Property,pvtValue) + +#define IWebBrowser2_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define IWebBrowser2_get_HWND(This,pHWND) \ + (This)->lpVtbl -> get_HWND(This,pHWND) + +#define IWebBrowser2_get_FullName(This,FullName) \ + (This)->lpVtbl -> get_FullName(This,FullName) + +#define IWebBrowser2_get_Path(This,Path) \ + (This)->lpVtbl -> get_Path(This,Path) + +#define IWebBrowser2_get_Visible(This,pBool) \ + (This)->lpVtbl -> get_Visible(This,pBool) + +#define IWebBrowser2_put_Visible(This,Value) \ + (This)->lpVtbl -> put_Visible(This,Value) + +#define IWebBrowser2_get_StatusBar(This,pBool) \ + (This)->lpVtbl -> get_StatusBar(This,pBool) + +#define IWebBrowser2_put_StatusBar(This,Value) \ + (This)->lpVtbl -> put_StatusBar(This,Value) + +#define IWebBrowser2_get_StatusText(This,StatusText) \ + (This)->lpVtbl -> get_StatusText(This,StatusText) + +#define IWebBrowser2_put_StatusText(This,StatusText) \ + (This)->lpVtbl -> put_StatusText(This,StatusText) + +#define IWebBrowser2_get_ToolBar(This,Value) \ + (This)->lpVtbl -> get_ToolBar(This,Value) + +#define IWebBrowser2_put_ToolBar(This,Value) \ + (This)->lpVtbl -> put_ToolBar(This,Value) + +#define IWebBrowser2_get_MenuBar(This,Value) \ + (This)->lpVtbl -> get_MenuBar(This,Value) + +#define IWebBrowser2_put_MenuBar(This,Value) \ + (This)->lpVtbl -> put_MenuBar(This,Value) + +#define IWebBrowser2_get_FullScreen(This,pbFullScreen) \ + (This)->lpVtbl -> get_FullScreen(This,pbFullScreen) + +#define IWebBrowser2_put_FullScreen(This,bFullScreen) \ + (This)->lpVtbl -> put_FullScreen(This,bFullScreen) + + +#define IWebBrowser2_Navigate2(This,URL,Flags,TargetFrameName,PostData,Headers) \ + (This)->lpVtbl -> Navigate2(This,URL,Flags,TargetFrameName,PostData,Headers) + +#define IWebBrowser2_QueryStatusWB(This,cmdID,pcmdf) \ + (This)->lpVtbl -> QueryStatusWB(This,cmdID,pcmdf) + +#define IWebBrowser2_ExecWB(This,cmdID,cmdexecopt,pvaIn,pvaOut) \ + (This)->lpVtbl -> ExecWB(This,cmdID,cmdexecopt,pvaIn,pvaOut) + +#define IWebBrowser2_ShowBrowserBar(This,pvaClsid,pvarShow,pvarSize) \ + (This)->lpVtbl -> ShowBrowserBar(This,pvaClsid,pvarShow,pvarSize) + +#define IWebBrowser2_get_ReadyState(This,plReadyState) \ + (This)->lpVtbl -> get_ReadyState(This,plReadyState) + +#define IWebBrowser2_get_Offline(This,pbOffline) \ + (This)->lpVtbl -> get_Offline(This,pbOffline) + +#define IWebBrowser2_put_Offline(This,bOffline) \ + (This)->lpVtbl -> put_Offline(This,bOffline) + +#define IWebBrowser2_get_Silent(This,pbSilent) \ + (This)->lpVtbl -> get_Silent(This,pbSilent) + +#define IWebBrowser2_put_Silent(This,bSilent) \ + (This)->lpVtbl -> put_Silent(This,bSilent) + +#define IWebBrowser2_get_RegisterAsBrowser(This,pbRegister) \ + (This)->lpVtbl -> get_RegisterAsBrowser(This,pbRegister) + +#define IWebBrowser2_put_RegisterAsBrowser(This,bRegister) \ + (This)->lpVtbl -> put_RegisterAsBrowser(This,bRegister) + +#define IWebBrowser2_get_RegisterAsDropTarget(This,pbRegister) \ + (This)->lpVtbl -> get_RegisterAsDropTarget(This,pbRegister) + +#define IWebBrowser2_put_RegisterAsDropTarget(This,bRegister) \ + (This)->lpVtbl -> put_RegisterAsDropTarget(This,bRegister) + +#define IWebBrowser2_get_TheaterMode(This,pbRegister) \ + (This)->lpVtbl -> get_TheaterMode(This,pbRegister) + +#define IWebBrowser2_put_TheaterMode(This,bRegister) \ + (This)->lpVtbl -> put_TheaterMode(This,bRegister) + +#define IWebBrowser2_get_AddressBar(This,Value) \ + (This)->lpVtbl -> get_AddressBar(This,Value) + +#define IWebBrowser2_put_AddressBar(This,Value) \ + (This)->lpVtbl -> put_AddressBar(This,Value) + +#define IWebBrowser2_get_Resizable(This,Value) \ + (This)->lpVtbl -> get_Resizable(This,Value) + +#define IWebBrowser2_put_Resizable(This,Value) \ + (This)->lpVtbl -> put_Resizable(This,Value) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_Navigate2_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *URL, + /* [optional][in] */ VARIANT __RPC_FAR *Flags, + /* [optional][in] */ VARIANT __RPC_FAR *TargetFrameName, + /* [optional][in] */ VARIANT __RPC_FAR *PostData, + /* [optional][in] */ VARIANT __RPC_FAR *Headers); + + +void __RPC_STUB IWebBrowser2_Navigate2_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_QueryStatusWB_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ OLECMDID cmdID, + /* [retval][out] */ OLECMDF __RPC_FAR *pcmdf); + + +void __RPC_STUB IWebBrowser2_QueryStatusWB_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_ExecWB_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ OLECMDID cmdID, + /* [in] */ OLECMDEXECOPT cmdexecopt, + /* [optional][in] */ VARIANT __RPC_FAR *pvaIn, + /* [optional][in][out] */ VARIANT __RPC_FAR *pvaOut); + + +void __RPC_STUB IWebBrowser2_ExecWB_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_ShowBrowserBar_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pvaClsid, + /* [optional][in] */ VARIANT __RPC_FAR *pvarShow, + /* [optional][in] */ VARIANT __RPC_FAR *pvarSize); + + +void __RPC_STUB IWebBrowser2_ShowBrowserBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [bindable][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_ReadyState_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [out][retval] */ READYSTATE __RPC_FAR *plReadyState); + + +void __RPC_STUB IWebBrowser2_get_ReadyState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_Offline_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbOffline); + + +void __RPC_STUB IWebBrowser2_get_Offline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_Offline_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bOffline); + + +void __RPC_STUB IWebBrowser2_put_Offline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_Silent_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbSilent); + + +void __RPC_STUB IWebBrowser2_get_Silent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_Silent_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bSilent); + + +void __RPC_STUB IWebBrowser2_put_Silent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_RegisterAsBrowser_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister); + + +void __RPC_STUB IWebBrowser2_get_RegisterAsBrowser_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_RegisterAsBrowser_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bRegister); + + +void __RPC_STUB IWebBrowser2_put_RegisterAsBrowser_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_RegisterAsDropTarget_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister); + + +void __RPC_STUB IWebBrowser2_get_RegisterAsDropTarget_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_RegisterAsDropTarget_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bRegister); + + +void __RPC_STUB IWebBrowser2_put_RegisterAsDropTarget_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_TheaterMode_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbRegister); + + +void __RPC_STUB IWebBrowser2_get_TheaterMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_TheaterMode_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL bRegister); + + +void __RPC_STUB IWebBrowser2_put_TheaterMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_AddressBar_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + +void __RPC_STUB IWebBrowser2_get_AddressBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_AddressBar_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + +void __RPC_STUB IWebBrowser2_put_AddressBar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_get_Resizable_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *Value); + + +void __RPC_STUB IWebBrowser2_get_Resizable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IWebBrowser2_put_Resizable_Proxy( + IWebBrowser2 __RPC_FAR * This, + /* [in] */ VARIANT_BOOL Value); + + +void __RPC_STUB IWebBrowser2_put_Resizable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IWebBrowser2_INTERFACE_DEFINED__ */ + + +#ifndef __DWebBrowserEvents_DISPINTERFACE_DEFINED__ +#define __DWebBrowserEvents_DISPINTERFACE_DEFINED__ + +/* dispinterface DWebBrowserEvents */ +/* [hidden][helpstring][uuid] */ + + +EXTERN_C const IID DIID_DWebBrowserEvents; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAB22AC2-30C1-11CF-A7EB-0000C05BAE0B") + DWebBrowserEvents : public IDispatch + { + }; + +#else /* C style interface */ + + typedef struct DWebBrowserEventsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + DWebBrowserEvents __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + DWebBrowserEvents __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + DWebBrowserEvents __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + DWebBrowserEvents __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + DWebBrowserEvents __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + DWebBrowserEvents __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + DWebBrowserEvents __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + END_INTERFACE + } DWebBrowserEventsVtbl; + + interface DWebBrowserEvents + { + CONST_VTBL struct DWebBrowserEventsVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define DWebBrowserEvents_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define DWebBrowserEvents_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define DWebBrowserEvents_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define DWebBrowserEvents_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define DWebBrowserEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define DWebBrowserEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define DWebBrowserEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + +#endif /* __DWebBrowserEvents_DISPINTERFACE_DEFINED__ */ + + +#ifndef __DWebBrowserEvents2_DISPINTERFACE_DEFINED__ +#define __DWebBrowserEvents2_DISPINTERFACE_DEFINED__ + +/* dispinterface DWebBrowserEvents2 */ +/* [hidden][helpstring][uuid] */ + + +EXTERN_C const IID DIID_DWebBrowserEvents2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("34A715A0-6587-11D0-924A-0020AFC7AC4D") + DWebBrowserEvents2 : public IDispatch + { + }; + +#else /* C style interface */ + + typedef struct DWebBrowserEvents2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + DWebBrowserEvents2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + DWebBrowserEvents2 __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + DWebBrowserEvents2 __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + DWebBrowserEvents2 __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + DWebBrowserEvents2 __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + DWebBrowserEvents2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + DWebBrowserEvents2 __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + END_INTERFACE + } DWebBrowserEvents2Vtbl; + + interface DWebBrowserEvents2 + { + CONST_VTBL struct DWebBrowserEvents2Vtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define DWebBrowserEvents2_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define DWebBrowserEvents2_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define DWebBrowserEvents2_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define DWebBrowserEvents2_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define DWebBrowserEvents2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define DWebBrowserEvents2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define DWebBrowserEvents2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + +#endif /* __DWebBrowserEvents2_DISPINTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_MozillaBrowser; + +#ifdef __cplusplus + +class DECLSPEC_UUID("1339B54C-3453-11D2-93B9-000000000000") +MozillaBrowser; +#endif +#endif /* __MOZILLACONTROLLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.html b/mozilla/embedding/browser/activex/src/control/MozillaControl.html new file mode 100644 index 00000000000..f5c87fe4712 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.html @@ -0,0 +1,14 @@ + + + + + + + + + + +

Mozilla Control

+ + diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.idl b/mozilla/embedding/browser/activex/src/control/MozillaControl.idl new file mode 100644 index 00000000000..094141bb445 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.idl @@ -0,0 +1,415 @@ +#include +// MozillaControl.idl : IDL source for MozillaControl.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (MozillaControl.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; +import "docobj.idl"; + +// See note below for why IWebBrowser is not imported this way +// import "exdisp.idl"; +#include + +[ + uuid(1339B53E-3453-11D2-93B9-000000000000), + version(1.0), + helpstring("MozillaControl 1.0 Type Library") +] +library MOZILLACONTROLLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + // NOTE: There is a very specific reason for repeating the IWebBrowser + // verbatim rather than import'ing exdisp.idl - it stops MIDL + // failing with a MIDL2020 error! + + [ + uuid(EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B), // IID_IWebBrowser + helpstring("Web Browser interface"), + helpcontext(0x0000), + hidden, + dual, + oleautomation, + odl + ] + interface IWebBrowser : IDispatch + { + [id(100), helpstring("Navigates to the previous item in the history list."), helpcontext(0x0000)] + HRESULT GoBack(); + [id(101), helpstring("Navigates to the next item in the history list."), helpcontext(0x0000)] + HRESULT GoForward(); + [id(102), helpstring("Go home/start page."), helpcontext(0x0000)] + HRESULT GoHome(); + [id(103), helpstring("Go Search Page."), helpcontext(0x0000)] + HRESULT GoSearch(); + + [id(104), helpstring("Navigates to a URL or file."), helpcontext(0x0000)] + HRESULT Navigate([in] BSTR URL, + [in, optional] VARIANT * Flags, + [in, optional] VARIANT * TargetFrameName, + [in, optional] VARIANT * PostData, + [in, optional] VARIANT * Headers); + typedef + [ + uuid(14EE5380-A378-11cf-A731-00A0C9082637), + helpstring("Constants for WebBrowser navigation flags") + ] + enum BrowserNavConstants { + [helpstring("Open in new window")] navOpenInNewWindow = 0x0001, + [helpstring("Exclude from history list")] navNoHistory = 0x0002, + [helpstring("Don't read from cache")] navNoReadFromCache = 0x0004, + [helpstring("Don't write from cache")] navNoWriteToCache = 0x0008, + [helpstring("Try other sites on failure")] navAllowAutosearch = 0x0010, + [helpstring("OpenBrowserBar")] navBrowserBar = 0x0020, + } BrowserNavConstants; + + [id(DISPID_REFRESH), helpstring("Refresh the currently viewed page."), helpcontext(0x0000)] + HRESULT Refresh(); + + // The standard Refresh takes no parameters and we need some... use a new name + [id(105), helpstring("Refresh the currently viewed page."), helpcontext(0x0000)] + HRESULT Refresh2([in,optional] VARIANT * Level); + + typedef + [ + uuid(C317C261-A991-11cf-A731-00A0C9082637), + helpstring("Constants for Refresh") + ] + enum RefreshConstants { // must map to these in sdk\inc\docobj.h + [helpstring("Refresh normal")] REFRESH_NORMAL = 0, //== OLECMDIDF_REFRESH_NORMAL + [helpstring("Refresh if expired")] REFRESH_IFEXPIRED = 1, //== OLECMDIDF_REFRESH_IFEXPIRED + [helpstring("Refresh completely")] REFRESH_COMPLETELY = 3 //== OLECMDIDF_REFRESH_COMPLETELY + } RefreshConstants; + + [id(106), helpstring("Stops opening a file."), helpcontext(0x0000)] + HRESULT Stop(); + + // Automation heirarchy... + [id(200), propget, helpstring("Returns the application automation object if accessible, this automation object otherwise.."), helpcontext(0x0000)] + HRESULT Application([out,retval] IDispatch** ppDisp); + + [id(201), propget, helpstring("Returns the automation object of the container/parent if one exists or this automation object."), helpcontext(0x0000)] + HRESULT Parent([out,retval] IDispatch** ppDisp); + + [id(202), propget, helpstring("Returns the container/parent automation object, if any."), helpcontext(0x0000)] + HRESULT Container([out,retval] IDispatch** ppDisp); + + [id(203), propget, helpstring("Returns the active Document automation object, if any."), helpcontext(0x0000)] + HRESULT Document([out,retval] IDispatch** ppDisp); + + [id(204), propget, helpstring("Returns True if this is the top level object."), helpcontext(0x0000)] + HRESULT TopLevelContainer([out, retval] VARIANT_BOOL* pBool); + + [id(205), propget, helpstring("Returns the type of the contained document object."), helpcontext(0x0000)] + HRESULT Type([out,retval] BSTR* Type); + + // Window stuff... + [id(206), propget, helpstring("The horizontal position (pixels) of the frame window relative to the screen/container."), helpcontext(0x0000)] + HRESULT Left([out, retval] long *pl); + [id(206), propput] + HRESULT Left([in] long Left); + [id(207), propget, helpstring("The vertical position (pixels) of the frame window relative to the screen/container."), helpcontext(0x0000)] + HRESULT Top([out, retval] long *pl); + [id(207), propput] + HRESULT Top([in] long Top); + [id(208), propget, helpstring("The horizontal dimension (pixels) of the frame window/object."), helpcontext(0x0000)] + HRESULT Width([out, retval] long *pl); + [id(208), propput] + HRESULT Width([in] long Width); + [id(209), propget, helpstring("The vertical dimension (pixels) of the frame window/object."), helpcontext(0x0000)] + HRESULT Height([out, retval] long *pl); + [id(209), propput] + HRESULT Height([in] long Height); + + // WebBrowser stuff... + [id(210), propget, helpstring("Gets the short (UI-friendly) name of the URL/file currently viewed."), helpcontext(0x0000)] + HRESULT LocationName([out,retval] BSTR *LocationName); + + [id(211), propget, helpstring("Gets the full URL/path currently viewed."), helpcontext(0x0000)] + HRESULT LocationURL([out,retval] BSTR * LocationURL); + + // Added a property to see if the viewer is currenly busy or not... + [id(212), propget, helpstring("Query to see if something is still in progress."), helpcontext(0x0000)] + HRESULT Busy([out,retval] VARIANT_BOOL *pBool); + } + + [ + uuid(0002DF05-0000-0000-C000-000000000046), // IID_IWebBrowserApp + helpstring("Web Browser Application Interface."), + helpcontext(0x0000), + hidden, + oleautomation, + dual + ] + interface IWebBrowserApp : IWebBrowser + { + [id(300), helpstring("Exits application and closes the open document."), helpcontext(0x0000)] + HRESULT Quit(); + + [id(301), helpstring("Converts client sizes into window sizes."), helpcontext(0x0000)] + HRESULT ClientToWindow([in,out] int* pcx, [in,out] int* pcy); + + [id(302), helpstring("Associates vtValue with the name szProperty in the context of the object."), helpcontext(0x0000)] + HRESULT PutProperty([in] BSTR Property, [in] VARIANT vtValue); + + [id(303), helpstring("Retrieve the Associated value for the property vtValue in the context of the object."), helpcontext(0x0000)] + HRESULT GetProperty([in] BSTR Property, [out, retval] VARIANT *pvtValue); + + [id(0), propget, helpstring("Returns name of the application."), helpcontext(0x0000)] + HRESULT Name([out,retval] BSTR* Name); + + [id(DISPID_HWND), propget, helpstring("Returns the HWND of the current IE window."), helpcontext(0x0000)] + HRESULT HWND([out,retval] long *pHWND); + + [id(400), propget, helpstring("Returns file specification of the application, including path."), helpcontext(0x0000)] + HRESULT FullName([out,retval] BSTR* FullName); + + [id(401), propget, helpstring("Returns the path to the application."), helpcontext(0x0000)] + HRESULT Path([out,retval] BSTR* Path); + + [id(402), propget, helpstring("Determines whether the application is visible or hidden."), helpcontext(0x0000)] + HRESULT Visible([out, retval] VARIANT_BOOL* pBool); + [id(402), propput, helpstring("Determines whether the application is visible or hidden."), helpcontext(0x0000)] + HRESULT Visible([in] VARIANT_BOOL Value); + + [id(403), propget, helpstring("Turn on or off the statusbar."), helpcontext(0x0000)] + HRESULT StatusBar([out, retval] VARIANT_BOOL* pBool); + [id(403), propput, helpstring("Turn on or off the statusbar."), helpcontext(0x0000)] + HRESULT StatusBar([in] VARIANT_BOOL Value); + + [id(404), propget, helpstring("Text of Status window."), helpcontext(0x0000)] + HRESULT StatusText([out, retval] BSTR *StatusText); + [id(404), propput, helpstring("Text of Status window."), helpcontext(0x0000)] + HRESULT StatusText([in] BSTR StatusText); + + [id(405), propget, helpstring("Controls which toolbar is shown."), helpcontext(0x0000)] + HRESULT ToolBar([out, retval] int * Value); + [id(405), propput, helpstring("Controls which toolbar is shown."), helpcontext(0x0000)] + HRESULT ToolBar([in] int Value); + + [id(406), propget, helpstring("Controls whether menubar is shown."), helpcontext(0x0000)] + HRESULT MenuBar([out, retval] VARIANT_BOOL * Value); + [id(406), propput, helpstring("Controls whether menubar is shown."), helpcontext(0x0000)] + HRESULT MenuBar([in] VARIANT_BOOL Value); + + [id(407), propget, helpstring("Maximizes window and turns off statusbar, toolbar, menubar, and titlebar."), helpcontext(0x0000)] + HRESULT FullScreen([out, retval] VARIANT_BOOL * pbFullScreen); + [id(407), propput, helpstring("Maximizes window and turns off statusbar, toolbar, menubar, and titlebar."), helpcontext(0x0000)] + HRESULT FullScreen([in] VARIANT_BOOL bFullScreen); + } + + [ + uuid(D30C1661-CDAF-11d0-8A3E-00C04FC9E26E), // IID_IWebBrowser2 + helpstring("Web Browser Interface for IE4."), + helpcontext(0x0000), + hidden, + oleautomation, + dual + ] + interface IWebBrowser2 : IWebBrowserApp + { + [id(500), helpstring("Navigates to a URL or file or pidl."), helpcontext(0x0000)] + HRESULT Navigate2([in] VARIANT * URL, + [in, optional] VARIANT * Flags, + [in, optional] VARIANT * TargetFrameName, + [in, optional] VARIANT * PostData, + [in, optional] VARIANT * Headers); + + + [id(501), helpstring("IOleCommandTarget::QueryStatus"), helpcontext(0x0000)] + HRESULT QueryStatusWB([in] OLECMDID cmdID, [out, retval] OLECMDF * pcmdf); + [id(502), helpstring("IOleCommandTarget::Exec"), helpcontext(0x0000)] + HRESULT ExecWB([in] OLECMDID cmdID, [in] OLECMDEXECOPT cmdexecopt, [in, optional] VARIANT * pvaIn, [out, in, optional] VARIANT * pvaOut); + [id(503), helpstring("Set BrowserBar to Clsid"), helpcontext(0x0000)] + HRESULT ShowBrowserBar( [in] VARIANT * pvaClsid, + [in, optional] VARIANT * pvarShow, + [in, optional] VARIANT * pvarSize ); + + [id(DISPID_READYSTATE), propget, bindable] + HRESULT ReadyState([retval, out] READYSTATE * plReadyState); + + [id(550), propget, helpstring("Controls if the frame is offline (read from cache)"), helpcontext(0x0000)] + HRESULT Offline([out, retval] VARIANT_BOOL * pbOffline); + [id(550), propput, helpstring("Controls if the frame is offline (read from cache)"), helpcontext(0x0000)] + HRESULT Offline([in] VARIANT_BOOL bOffline); + + [id(551), propget, helpstring("Controls if any dialog boxes can be shown"), helpcontext(0x0000)] + HRESULT Silent([out, retval] VARIANT_BOOL * pbSilent); + [id(551), propput, helpstring("Controls if any dialog boxes can be shown"), helpcontext(0x0000)] + HRESULT Silent([in] VARIANT_BOOL bSilent); + + [id(552), propget, helpstring("Registers OC as a top-level browser (for target name resolution)"), helpcontext(0x0000)] + HRESULT RegisterAsBrowser([out, retval] VARIANT_BOOL * pbRegister); + [id(552), propput, helpstring("Registers OC as a top-level browser (for target name resolution)"), helpcontext(0x0000)] + HRESULT RegisterAsBrowser([in] VARIANT_BOOL bRegister); + + [id(553), propget, helpstring("Registers OC as a drop target for navigation"), helpcontext(0x0000)] + HRESULT RegisterAsDropTarget([out, retval] VARIANT_BOOL * pbRegister); + [id(553), propput, helpstring("Registers OC as a drop target for navigation"), helpcontext(0x0000)] + HRESULT RegisterAsDropTarget([in] VARIANT_BOOL bRegister); + + [id(554), propget, helpstring("Controls if the browser is in theater mode"), helpcontext(0x0000)] + HRESULT TheaterMode([out, retval] VARIANT_BOOL * pbRegister); + [id(554), propput, helpstring("Controls if the browser is in theater mode"), helpcontext(0x0000)] + HRESULT TheaterMode([in] VARIANT_BOOL bRegister); + + [id(555), propget, helpstring("Controls whether address bar is shown"), helpcontext(0x0000)] + HRESULT AddressBar([out, retval] VARIANT_BOOL * Value); + [id(555), propput, helpstring("Controls whether address bar is shown"), helpcontext(0x0000)] + HRESULT AddressBar([in] VARIANT_BOOL Value); + + [id(556), propget, helpstring("Controls whether the window is resizable"), helpcontext(0x0000)] + HRESULT Resizable([out, retval] VARIANT_BOOL * Value); + [id(556), propput, helpstring("Controls whether the window is resizable"), helpcontext(0x0000)] + HRESULT Resizable([in] VARIANT_BOOL Value); + } + + [ + uuid(EAB22AC2-30C1-11CF-A7EB-0000C05BAE0B), // DIID_DWebBrowserEvents + helpstring("Web Browser Control Events (old)"), + hidden + ] + dispinterface DWebBrowserEvents + { + properties: + methods: + [id(DISPID_BEFORENAVIGATE), helpstring("Fired when a new hyperlink is being navigated to."), helpcontext(0x0000)] + void BeforeNavigate([in] BSTR URL, long Flags, BSTR TargetFrameName, VARIANT * PostData, BSTR Headers, [in, out]VARIANT_BOOL * Cancel); + + [id(DISPID_NAVIGATECOMPLETE), helpstring("Fired when the document being navigated to becomes visible and enters the navigation stack."), helpcontext(0x0000)] + void NavigateComplete([in] BSTR URL ); + + [id(DISPID_STATUSTEXTCHANGE), helpstring("Statusbar text changed."), helpcontext(0x0000)] + void StatusTextChange([in]BSTR Text); + + [id(DISPID_PROGRESSCHANGE), helpstring("Fired when download progress is updated."), helpcontext(0x0000)] + void ProgressChange([in] long Progress, [in] long ProgressMax); + + [id(DISPID_DOWNLOADCOMPLETE), helpstring("Download of page complete."), helpcontext(0x0000)] + void DownloadComplete(); + + [id(DISPID_COMMANDSTATECHANGE), helpstring("The enabled state of a command changed"), helpcontext(0x0000)] + void CommandStateChange([in] long Command, [in] VARIANT_BOOL Enable); + + [id(DISPID_DOWNLOADBEGIN), helpstring("Download of a page started."), helpcontext(0x000)] + void DownloadBegin(); + + [id(DISPID_NEWWINDOW), helpstring("Fired when a new window should be created."), helpcontext(0x0000)] + void NewWindow([in] BSTR URL, [in] long Flags, [in] BSTR TargetFrameName, [in] VARIANT * PostData, [in] BSTR Headers, [in,out] VARIANT_BOOL * Processed); + + [id(DISPID_TITLECHANGE), helpstring("Document title changed."), helpcontext(0x0000)] + void TitleChange([in]BSTR Text); + + [id(DISPID_FRAMEBEFORENAVIGATE), helpstring("Fired when a new hyperlink is being navigated to in a frame."), helpcontext(0x0000)] + void FrameBeforeNavigate([in] BSTR URL, long Flags, BSTR TargetFrameName, VARIANT * PostData, BSTR Headers, [in, out]VARIANT_BOOL * Cancel); + + [id(DISPID_FRAMENAVIGATECOMPLETE), helpstring("Fired when a new hyperlink is being navigated to in a frame."), helpcontext(0x0000)] + void FrameNavigateComplete([in] BSTR URL ); + + [id(DISPID_FRAMENEWWINDOW), helpstring("Fired when a new window should be created."), helpcontext(0x0000)] + void FrameNewWindow([in] BSTR URL, [in] long Flags, [in] BSTR TargetFrameName, [in] VARIANT * PostData, [in] BSTR Headers, [in,out] VARIANT_BOOL * Processed); + + // The following are IWebBrowserApp specific: + // + [id(DISPID_QUIT), helpstring("Fired when application is quiting."), helpcontext(0x0000)] + void Quit([in, out] VARIANT_BOOL * Cancel); + + [id(DISPID_WINDOWMOVE), helpstring("Fired when window has been moved."), helpcontext(0x0000)] + void WindowMove(); + + [id(DISPID_WINDOWRESIZE), helpstring("Fired when window has been sized."), helpcontext(0x0000)] + void WindowResize(); + + [id(DISPID_WINDOWACTIVATE), helpstring("Fired when window has been activated."), helpcontext(0x0000)] + void WindowActivate(); + + [id(DISPID_PROPERTYCHANGE), helpstring("Fired when the PutProperty method has been called."), helpcontext(0x0000)] + void PropertyChange([in] BSTR Property); + } + + [ + uuid(34A715A0-6587-11D0-924A-0020AFC7AC4D), // IID_DWebBrowserEvents2 + helpstring("Web Browser Control events interface"), + hidden + ] + dispinterface DWebBrowserEvents2 + { + properties: + methods: + [id(DISPID_STATUSTEXTCHANGE), helpstring("Statusbar text changed."), helpcontext(0x0000)] + void StatusTextChange([in]BSTR Text); + + [id(DISPID_PROGRESSCHANGE), helpstring("Fired when download progress is updated."), helpcontext(0x0000)] + void ProgressChange([in] long Progress, [in] long ProgressMax); + + [id(DISPID_COMMANDSTATECHANGE), helpstring("The enabled state of a command changed."), helpcontext(0x0000)] + void CommandStateChange([in] long Command, [in] VARIANT_BOOL Enable); + + [id(DISPID_DOWNLOADBEGIN), helpstring("Download of a page started."), helpcontext(0x000)] + void DownloadBegin(); + + [id(DISPID_DOWNLOADCOMPLETE), helpstring("Download of page complete."), helpcontext(0x0000)] + void DownloadComplete(); + + [id(DISPID_TITLECHANGE), helpstring("Document title changed."), helpcontext(0x0000)] + void TitleChange([in] BSTR Text); + + [id(DISPID_PROPERTYCHANGE), helpstring("Fired when the PutProperty method has been called."), helpcontext(0x0000)] + void PropertyChange([in] BSTR szProperty); + + // New events for IE40: + // + [id(DISPID_BEFORENAVIGATE2), helpstring("Fired before navigate occurs in the given WebBrowser (window or frameset element). The processing of this navigation may be modified."), helpcontext(0x0000)] + void BeforeNavigate2([in] IDispatch* pDisp, + [in] VARIANT * URL, [in] VARIANT * Flags, [in] VARIANT * TargetFrameName, [in] VARIANT * PostData, [in] VARIANT * Headers, + [in,out] VARIANT_BOOL * Cancel); + + [id(DISPID_NEWWINDOW2), helpstring("A new, hidden, non-navigated WebBrowser window is needed."), helpcontext(0x0000)] + void NewWindow2([in, out] IDispatch** ppDisp, [in, out] VARIANT_BOOL * Cancel); + + [id(DISPID_NAVIGATECOMPLETE2), helpstring("Fired when the document being navigated to becomes visible and enters the navigation stack."), helpcontext(0x0000)] + void NavigateComplete2([in] IDispatch* pDisp, [in] VARIANT * URL ); + + [id(DISPID_DOCUMENTCOMPLETE), helpstring("Fired when the document being navigated to reaches ReadyState_Complete."), helpcontext(0x0000)] + void DocumentComplete([in] IDispatch* pDisp, [in] VARIANT * URL ); + + [id(DISPID_ONQUIT), helpstring("Fired when application is quiting."), helpcontext(0x0000)] + void OnQuit(); + + [id(DISPID_ONVISIBLE), helpstring("Fired when the window should be shown/hidden"), helpcontext(0x0000)] + void OnVisible([in] VARIANT_BOOL Visible); + + [id(DISPID_ONTOOLBAR), helpstring("Fired when the toolbar should be shown/hidden"), helpcontext(0x0000)] + void OnToolBar([in] VARIANT_BOOL ToolBar); + + [id(DISPID_ONMENUBAR), helpstring("Fired when the menubar should be shown/hidden"), helpcontext(0x0000)] + void OnMenuBar([in] VARIANT_BOOL MenuBar); + + [id(DISPID_ONSTATUSBAR), helpstring("Fired when the statusbar should be shown/hidden"), helpcontext(0x0000)] + void OnStatusBar([in] VARIANT_BOOL StatusBar); + + [id(DISPID_ONFULLSCREEN), helpstring("Fired when fullscreen mode should be on/off"), helpcontext(0x0000)] + void OnFullScreen([in] VARIANT_BOOL FullScreen); + + [id(DISPID_ONTHEATERMODE), helpstring("Fired when theater mode should be on/off"), helpcontext(0x0000)] + void OnTheaterMode([in] VARIANT_BOOL TheaterMode); + } + + [ + uuid(1339B54C-3453-11D2-93B9-000000000000), + helpstring("MozillaBrowser Class") + ] + coclass MozillaBrowser + { + [default] interface IWebBrowser2; + interface IWebBrowser; + interface IWebBrowserApp; + interface IDispatch; + [source] dispinterface DWebBrowserEvents; + [default, source] dispinterface DWebBrowserEvents2; + }; +}; diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.rc b/mozilla/embedding/browser/activex/src/control/MozillaControl.rc new file mode 100644 index 00000000000..2c0d23bb2cc --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.rc @@ -0,0 +1,189 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""MozillaControl.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Mozilla ActiveX control and plugin module\0" + VALUE "FileExtents", "*|*|*.axs\0" + VALUE "FileOpenName", "ActiveX (*.*)|ActiveX (*.*)|ActiveScript(*.axs)\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "NPMOZCTL\0" + VALUE "LegalCopyright", "Copyright 1999\0" + VALUE "LegalTrademarks", "\0" + VALUE "MIMEType", "application/x-oleobject|application/oleobject|text/x-activescript\0" + VALUE "OriginalFilename", "NPMOZCTL.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Mozilla ActiveX control and plugin support\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_MOZILLABROWSER REGISTRY DISCARDABLE "MozillaBrowser.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MOZILLABROWSER ICON DISCARDABLE "MozillaBrowser.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_POPUP_PAGE MENU DISCARDABLE +BEGIN + POPUP "Page Popup" + BEGIN + MENUITEM "&Back", ID_BROWSE_BACK + MENUITEM "&Forward", ID_BROWSE_FORWARD + MENUITEM SEPARATOR + MENUITEM "Select &All", ID_EDIT_SELECTALL + MENUITEM "&Paste", ID_EDIT_PASTE + MENUITEM SEPARATOR + MENUITEM "&View Source", ID_FILE_VIEWSOURCE + MENUITEM SEPARATOR + MENUITEM "Pr&int", ID_FILE_PRINT + MENUITEM "&Refresh", ID_FILE_REFRESH + MENUITEM SEPARATOR + MENUITEM "&Properties", ID_PAGE_PROPERTIES + END +END + +IDR_POPUP_LINK MENU DISCARDABLE +BEGIN + POPUP "Link Popup" + BEGIN + MENUITEM "&Open", ID_FILE_OPEN + MENUITEM "Open in &New Window", ID_FILE_OPENINNEWWINDOW + MENUITEM SEPARATOR + MENUITEM "Copy Shor&tcut", ID_EDIT_COPYSHORTCUT + MENUITEM SEPARATOR + MENUITEM "&Properties", ID_LINK_PROPERTIES + END +END + +IDR_POPUP_CLIPBOARD MENU DISCARDABLE +BEGIN + POPUP "Selection Popup" + BEGIN + MENUITEM "Cu&t", ID_EDIT_CUT, GRAYED + MENUITEM "&Copy", ID_EDIT_COPY + MENUITEM "&Paste", ID_EDIT_PASTE, GRAYED + MENUITEM "Select &All", ID_EDIT_SELECTALL + MENUITEM "Print", ID_SELECTIONPOPUP_PRINT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "MozillaControl" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "MozillaControl.tlb" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/embedding/browser/activex/src/control/PropertyBag.cpp b/mozilla/embedding/browser/activex/src/control/PropertyBag.cpp new file mode 100644 index 00000000000..2165593b104 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/PropertyBag.cpp @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "StdAfx.h" + +#include "PropertyBag.h" + + +CPropertyBag::CPropertyBag() +{ +} + + +CPropertyBag::~CPropertyBag() +{ +} + + +/////////////////////////////////////////////////////////////////////////////// +// IPropertyBag implementation + +HRESULT STDMETHODCALLTYPE CPropertyBag::Read(/* [in] */ LPCOLESTR pszPropName, /* [out][in] */ VARIANT __RPC_FAR *pVar, /* [in] */ IErrorLog __RPC_FAR *pErrorLog) +{ + if (pszPropName == NULL) + { + return E_INVALIDARG; + } + if (pVar == NULL) + { + return E_INVALIDARG; + } + + VariantInit(pVar); + PropertyList::iterator i; + for (i = m_PropertyList.begin(); i != m_PropertyList.end(); i++) + { + // Is the property already in the list? + if (wcsicmp((*i).szName, pszPropName) == 0) + { + // Copy the new value + VariantCopy(pVar, &(*i).vValue); + return S_OK; + } + } + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE CPropertyBag::Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar) +{ + if (pszPropName == NULL) + { + return E_INVALIDARG; + } + if (pVar == NULL) + { + return E_INVALIDARG; + } + + PropertyList::iterator i; + for (i = m_PropertyList.begin(); i != m_PropertyList.end(); i++) + { + // Is the property already in the list? + if (wcsicmp((*i).szName, pszPropName) == 0) + { + // Copy the new value + (*i).vValue = CComVariant(*pVar); + return S_OK; + } + } + + Property p; + p.szName = CComBSTR(pszPropName); + p.vValue = *pVar; + + m_PropertyList.push_back(p); + return S_OK; +} + diff --git a/mozilla/embedding/browser/activex/src/control/PropertyBag.h b/mozilla/embedding/browser/activex/src/control/PropertyBag.h new file mode 100644 index 00000000000..1d88c3bda44 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/PropertyBag.h @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef PROPERTYBAG_H +#define PROPERTYBAG_H + + +// Object wrapper for property list. This class can be set up with a +// list of properties and used to initialise a control with them + +class CPropertyBag : public CComObjectRootEx, + public IPropertyBag +{ + // List of properties in the bag + PropertyList m_PropertyList; + +public: + // Constructor + CPropertyBag(); + // Destructor + virtual ~CPropertyBag(); + +BEGIN_COM_MAP(CPropertyBag) + COM_INTERFACE_ENTRY(IPropertyBag) +END_COM_MAP() + +// IPropertyBag methods + virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(/* [in] */ LPCOLESTR pszPropName, /* [out][in] */ VARIANT __RPC_FAR *pVar, /* [in] */ IErrorLog __RPC_FAR *pErrorLog); + virtual HRESULT STDMETHODCALLTYPE Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar); +}; + +typedef CComObject CPropertyBagInstance; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/PropertyList.h b/mozilla/embedding/browser/activex/src/control/PropertyList.h new file mode 100644 index 00000000000..64b9249e8ed --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/PropertyList.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef PROPERTYLIST_H +#define PROPERTYLIST_H + + +// Property is a name,variant pair held by the browser. In IE, properties +// offer a primitive way for DHTML elements to talk back and forth with +// the host app. + +struct Property +{ + CComBSTR szName; + CComVariant vValue; +}; + +// A list of properties +typedef std::vector PropertyList; + + +// DEVNOTE: These operators are required since the unpatched VC++ 5.0 +// generates code even for unreferenced template methods in +// the file and will give compiler errors without +// them. Service Pack 1 and above fixes this problem + +int operator <(const Property&, const Property&); +int operator ==(const Property&, const Property&); + + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/StdAfx.cpp b/mozilla/embedding/browser/activex/src/control/StdAfx.cpp new file mode 100644 index 00000000000..d8ac0f6c46a --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/StdAfx.cpp @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include +#include +#include diff --git a/mozilla/embedding/browser/activex/src/control/StdAfx.h b/mozilla/embedding/browser/activex/src/control/StdAfx.h new file mode 100644 index 00000000000..78996a02cce --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/StdAfx.h @@ -0,0 +1,164 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_) +#define AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define STRICT + +#define _WIN32_WINNT 0x0400 +#define _ATL_APARTMENT_THREADED +#define _ATL_STATIC_REGISTRY + +// Comment these out as appropriate +#ifdef MOZ_ACTIVEX_CONTROL_SUPPORT +#define USE_CONTROL +#endif + +#ifdef MOZ_ACTIVEX_PLUGIN_SUPPORT +#define USE_PLUGIN +#endif + +// ATL headers +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include +#include +#include +#include +#include +#include + +#ifdef USE_PLUGIN +#include +#endif + +// STL headers +#include +#include +#include + +// New winsock2.h doesn't define this anymore +typedef long int32; + +#include "jstypes.h" +#include "prtypes.h" + +// Mozilla headers + +#ifdef USE_CONTROL +#include "xp_core.h" +#include "jscompat.h" + +#include "prthread.h" +#include "prprf.h" +#include "plevent.h" +#include "nsIComponentManager.h" +#include "nsIServiceManager.h" +#include "nsIEventQueueService.h" +#include "nsWidgetsCID.h" +#include "nsGfxCIID.h" +#include "nsViewsCID.h" +#include "nsString.h" +#include "nsCOMPtr.h" + +#include "nsIHTTPChannel.h" + +#include "nsIPref.h" +#include "nsIURL.h" +#include "nsIWebShell.h" +#include "nsIBrowserWindow.h" +#include "nsIContentViewer.h" +#include "nsIPresShell.h" +#include "nsCOMPtr.h" +#include "nsIDOMSelection.h" +#include "nsIPresContext.h" +#include "nsIPresShell.h" + +#include "nsEditorCID.h" +#include "nsIEditor.h" +#include "nsIHtmlEditor.h" + +#include "nsIDocument.h" +#include "nsIDocumentObserver.h" +#include "nsIDocumentLoaderObserver.h" +#include "nsIStreamListener.h" +#include "nsUnitConversion.h" +#include "nsVoidArray.h" +#include "nsCRT.h" + +#include "nsIDocumentViewer.h" +#include "nsIDOMNode.h" +#include "nsIDOMNodeList.h" +#include "nsIDOMDocument.h" +#include "nsIDOMDocumentType.h" +#include "nsIDOMElement.h" +#endif + +// Mozilla control headers +#include "resource.h" + +#include "ActiveXTypes.h" +#include "BrowserDiagnostics.h" +#include "IOleCommandTargetImpl.h" +#include "DHTMLCmdIds.h" + +#include "MozillaControl.h" +#include "PropertyList.h" +#include "PropertyBag.h" +#include "ItemContainer.h" +#include "ControlSite.h" +#include "ControlSiteIPFrame.h" + +#ifdef USE_CONTROL +#include "IEHtmlDocument.h" +#include "CPMozillaControl.h" +#include "MozillaBrowser.h" +#include "WebShellContainer.h" +#include "DropTarget.h" +#include "guids.h" +#endif + +#ifdef USE_PLUGIN +#include "npapi.h" +#include "nsIFactory.h" +#include "nsIPlugin.h" +#include "nsIPluginInstance.h" +#include "ActiveXPlugin.h" +#include "ActiveXPluginInstance.h" +#include "ActiveScriptSite.h" +#endif + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED) diff --git a/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp b/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp new file mode 100644 index 00000000000..17ee080d06e --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp @@ -0,0 +1,555 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" + +#include +#include + +#include "WebShellContainer.h" + +CWebShellContainer::CWebShellContainer(CMozillaBrowser *pOwner) +{ + NS_INIT_REFCNT(); + m_pOwner = pOwner; + m_pEvents1 = m_pOwner; + m_pEvents2 = m_pOwner; +} + + +CWebShellContainer::~CWebShellContainer() +{ +} + + +/////////////////////////////////////////////////////////////////////////////// +// nsISupports implementation + +NS_IMPL_ADDREF(CWebShellContainer) +NS_IMPL_RELEASE(CWebShellContainer) +NS_IMPL_QUERY_HEAD(CWebShellContainer) + NS_IMPL_QUERY_BODY(nsIBrowserWindow) + NS_IMPL_QUERY_BODY(nsIStreamObserver) + NS_IMPL_QUERY_BODY(nsIDocumentLoaderObserver) + NS_IMPL_QUERY_BODY(nsIWebShellContainer) +NS_IMPL_QUERY_TAIL(nsIStreamObserver) + + +/////////////////////////////////////////////////////////////////////////////// +// nsIBrowserWindow implementation + +NS_IMETHODIMP +CWebShellContainer::Init(nsIAppShell* aAppShell, nsIPref* aPrefs, const nsRect& aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins) +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::MoveTo(PRInt32 aX, PRInt32 aY) +{ + NG_TRACE_METHOD(CWebShellContainer::MoveTo); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::SizeTo(PRInt32 aWidth, PRInt32 aHeight) +{ + NG_TRACE_METHOD(CWebShellContainer::SizeTo); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::SizeWindowTo(PRInt32 aWidth, PRInt32 aHeight) +{ + NG_TRACE_METHOD(CWebShellContainer::SizeWindowTo); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::SizeContentTo(PRInt32 aWidth, PRInt32 aHeight) +{ + NG_TRACE_METHOD(CWebShellContainer::SizeContentTo); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetContentBounds(nsRect& aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetContentBounds); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetBounds(nsRect& aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetBounds); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetWindowBounds(nsRect& aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetWindowBounds); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::IsIntrinsicallySized(PRBool& aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::IsIntrinsicallySized); + aResult = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::ShowAfterCreation() +{ + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::Show() +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::Hide() +{ + NG_TRACE_METHOD(CWebShellContainer::Hide); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::Close() +{ + NG_TRACE_METHOD(CWebShellContainer::Close); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::ShowModally(PRBool aPrepare) +{ + NG_TRACE_METHOD(CWebShellContainer::ShowModally); + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::SetChrome(PRUint32 aNewChromeMask) +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetChrome(PRUint32& aChromeMaskResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetChrome); + aChromeMaskResult = 0; + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::SetTitle(const PRUnichar* aTitle) +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetTitle(const PRUnichar** aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetTitle); + *aResult = nsnull; + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::SetStatus(const PRUnichar* aStatus) +{ + NG_TRACE_METHOD(CWebShellContainer::SetStatus); + + BSTR bstrStatus = SysAllocString(W2OLE((PRUnichar *) aStatus)); + m_pEvents1->Fire_StatusTextChange(bstrStatus); + m_pEvents2->Fire_StatusTextChange(bstrStatus); + + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetStatus(const PRUnichar** aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetStatus); + *aResult = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::SetDefaultStatus(const PRUnichar* aStatus) +{ + NG_TRACE_METHOD(CWebShellContainer::SetDefaultStatus); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetDefaultStatus(const PRUnichar** aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetDefaultStatus); + *aResult = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::SetProgress(PRInt32 aProgress, PRInt32 aProgressMax) +{ + NG_TRACE_METHOD(CWebShellContainer::SetProgress); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::ShowMenuBar(PRBool aShow) +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetWebShell(nsIWebShell*& aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetWebShell); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::GetContentWebShell(nsIWebShell **aResult) +{ + NG_TRACE_METHOD(CWebShellContainer::GetContentWebShell); + *aResult = nsnull; + return NS_OK; +} + + + +/////////////////////////////////////////////////////////////////////////////// +// nsIWebShellContainer implementation + + +NS_IMETHODIMP +CWebShellContainer::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::WillLoadURL(..., \"%s\", %d)\n"), W2T(aURL), (int) aReason); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::BeginLoadURL(..., \"%s\")\n"), W2T(aURL)); + + // Fire a DownloadBegin + m_pEvents1->Fire_DownloadBegin(); + m_pEvents2->Fire_DownloadBegin(); + + // Fire a BeforeNavigate event + OLECHAR *pszURL = W2OLE((WCHAR *)aURL); + BSTR bstrURL = SysAllocString(pszURL); + BSTR bstrTargetFrameName = NULL; + BSTR bstrHeaders = NULL; + VARIANT *pvPostData = NULL; + VARIANT_BOOL bCancel = VARIANT_FALSE; + long lFlags = 0; + + m_pEvents1->Fire_BeforeNavigate(bstrURL, lFlags, bstrTargetFrameName, pvPostData, bstrHeaders, &bCancel); + + // Fire a BeforeNavigate2 event + CComVariant vURL(bstrURL); + CComVariant vFlags(lFlags); + CComVariant vTargetFrameName(bstrTargetFrameName); + CComVariant vHeaders(bstrHeaders); + + m_pEvents2->Fire_BeforeNavigate2(m_pOwner, &vURL, &vFlags, &vTargetFrameName, pvPostData, &vHeaders, &bCancel); + + SysFreeString(bstrURL); + SysFreeString(bstrTargetFrameName); + SysFreeString(bstrHeaders); + + if (bCancel == VARIANT_TRUE) + { + return NS_ERROR_ABORT; + } + else + { + m_pOwner->m_bBusy = TRUE; + } + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::ProgressLoadURL(..., \"%s\", %d, %d)\n"), W2T(aURL), (int) aProgress, (int) aProgressMax); + + long nProgress = aProgress; + long nProgressMax = aProgressMax; + + if (nProgress == 0) + { + } + if (nProgressMax == 0) + { + nProgressMax = LONG_MAX; + } + if (nProgress > nProgressMax) + { + nProgress = nProgressMax; // Progress complete + } + + m_pEvents1->Fire_ProgressChange(nProgress, nProgressMax); + m_pEvents2->Fire_ProgressChange(nProgress, nProgressMax); + + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::EndLoadURL(..., \"%s\", %d)\n"), W2T(aURL), (int) aStatus); + + // Fire a NavigateComplete event + OLECHAR *pszURL = W2OLE((WCHAR *) aURL); + BSTR bstrURL = SysAllocString(pszURL); + m_pEvents1->Fire_NavigateComplete(bstrURL); + + // Fire a NavigateComplete2 event + CComVariant vURL(bstrURL); + m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURL); + + // Fire the new NavigateForward state + VARIANT_BOOL bEnableForward = VARIANT_FALSE; + if ( m_pOwner->m_pIWebShell->CanForward() == NS_OK ) + { + bEnableForward = VARIANT_TRUE; + } + + m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward); + + // Fire the new NavigateBack state + VARIANT_BOOL bEnableBack = VARIANT_FALSE; + if ( m_pOwner->m_pIWebShell->CanBack() == NS_OK ) + { + bEnableBack = VARIANT_TRUE; + } + + m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack); + + m_pOwner->m_bBusy = FALSE; + SysFreeString(bstrURL); + + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::NewWebShell(PRUint32 aChromeMask, PRBool aVisible, nsIWebShell *&aNewWebShell) +{ + NG_TRACE_METHOD(CWebShellContainer::NewWebShell); + nsresult rv = NS_ERROR_OUT_OF_MEMORY; + return rv; +} + + +NS_IMETHODIMP +CWebShellContainer::FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::FindWebShellWithName(\"%s\", ...)\n"), W2T(aName)); + + nsresult rv = NS_OK; + + // Zero result (in case we fail). + aResult = nsnull; + + if (m_pOwner->m_pIWebShell != NULL) + { + rv = m_pOwner->m_pIWebShell->FindChildWithName(aName, aResult); + } + + return rv; +} + + +NS_IMETHODIMP +CWebShellContainer::FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken) +{ + NG_TRACE_METHOD(CWebShellContainer::FocusAvailable); + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::ContentShellAdded(nsIWebShell* aWebShell, nsIContent* frameNode) +{ + NG_TRACE_METHOD(CWebShellContainer::ContentShellAdded); + nsresult rv = NS_OK; + return rv; +} + + +NS_IMETHODIMP +CWebShellContainer::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, + PRInt32 aXPos, PRInt32 aYPos, + const nsString& aPopupType, const nsString& anAnchorAlignment, + const nsString& aPopupAlignment, + nsIDOMWindow* aWindow, nsIDOMWindow** outPopup) +{ + NG_TRACE_METHOD(CWebShellContainer::CreatePopup); + HMENU hMenu = ::CreatePopupMenu(); + *outPopup = NULL; + InsertMenu(hMenu, 0, MF_BYPOSITION, 1, _T("TODO")); + TrackPopupMenu(hMenu, TPM_LEFTALIGN, aXPos, aYPos, NULL, NULL, NULL); + return NS_OK; +} + +/////////////////////////////////////////////////////////////////////////////// +// nsIStreamObserver implementation +NS_IMETHODIMP +CWebShellContainer::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::OnStartRequest(...)\n")); + + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::OnStopRequest(..., %d, \"%s\")\n"), (int) aStatus, W2T((PRUnichar *) aMsg)); + + // Fire a DownloadComplete event + m_pEvents1->Fire_DownloadComplete(); + m_pEvents2->Fire_DownloadComplete(); + + return NS_OK; +} + +/////////////////////////////////////////////////////////////////////////////// +// nsIDocumentLoaderObserver implementation + + + +NS_IMETHODIMP +CWebShellContainer::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand) +{ + return NS_OK; +} + +// we need this to fire the document complete +NS_IMETHODIMP +CWebShellContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aChannel, nsresult aStatus, nsIDocumentLoaderObserver * aObserver) +{ + char* aString = nsnull; + nsIURI* uri = nsnull; + + aChannel->GetURI(&uri); + if (uri) { + uri->GetSpec(&aString); + } + if (aString == NULL) + { + return NS_ERROR_NULL_POINTER; + } + + USES_CONVERSION; + BSTR bstrURL = SysAllocString(A2OLE((CHAR *) aString)); + + delete [] aString; // clean up. + + // Fire a DocumentComplete event + CComVariant vURL(bstrURL); + m_pEvents2->Fire_DocumentComplete(m_pOwner, &vURL); + SysFreeString(bstrURL); + + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, nsIContentViewer* aViewer) +{ + return NS_OK; +} + +NS_IMETHODIMP +CWebShellContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, PRUint32 aProgress, PRUint32 aProgressMax) +{ + USES_CONVERSION; + NG_TRACE(_T("CWebShellContainer::OnProgress(..., \"%d\", \"%d\")\n"), (int) aProgress, (int) aProgressMax); + + return NS_OK; +} + +// we don't care about these. +NS_IMETHODIMP +CWebShellContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, nsString& aMsg) +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus) +{ + return NS_OK; +} + + +NS_IMETHODIMP +CWebShellContainer::HandleUnknownContentType(nsIDocumentLoader* loader, nsIChannel *aChannel, const char *aContentType, const char *aCommand ) +{ + return NS_OK; +} + diff --git a/mozilla/embedding/browser/activex/src/control/WebShellContainer.h b/mozilla/embedding/browser/activex/src/control/WebShellContainer.h new file mode 100644 index 00000000000..c5afffb70df --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/WebShellContainer.h @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef WEBSHELLCONTAINER_H +#define WEBSHELLCONTAINER_H + +// This is the class that handles the XPCOM side of things, callback +// interfaces into the web shell and so forth. + +class CWebShellContainer : + public nsIBrowserWindow, + public nsIWebShellContainer, + public nsIStreamObserver, + public nsIDocumentLoaderObserver +{ +public: + CWebShellContainer(CMozillaBrowser *pOwner); + +protected: + virtual ~CWebShellContainer(); + +// Protected members +protected: + nsString m_sTitle; + + CMozillaBrowser *m_pOwner; + CDWebBrowserEvents1 *m_pEvents1; + CDWebBrowserEvents2 *m_pEvents2; + +public: + // nsISupports + NS_DECL_ISUPPORTS + + // nsIBrowserWindow + NS_IMETHOD Init(nsIAppShell* aAppShell, nsIPref* aPrefs, const nsRect& aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins = PR_TRUE); + NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY); + NS_IMETHOD SizeTo(PRInt32 aWidth, PRInt32 aHeight); + NS_IMETHOD GetContentBounds(nsRect& aResult); + NS_IMETHOD GetBounds(nsRect& aResult); + NS_IMETHOD GetWindowBounds(nsRect& aResult); + NS_IMETHOD IsIntrinsicallySized(PRBool& aResult); + NS_IMETHOD SizeWindowTo(PRInt32 aWidth, PRInt32 aHeight); + NS_IMETHOD SizeContentTo(PRInt32 aWidth, PRInt32 aHeight); + NS_IMETHOD ShowAfterCreation(); + NS_IMETHOD Show(); + NS_IMETHOD Hide(); + NS_IMETHOD Close(); + NS_IMETHOD ShowModally(PRBool aPrepare); + NS_IMETHOD SetChrome(PRUint32 aNewChromeMask); + NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult); + NS_IMETHOD SetTitle(const PRUnichar* aTitle); + NS_IMETHOD GetTitle(const PRUnichar** aResult); + NS_IMETHOD SetStatus(const PRUnichar* aStatus); + NS_IMETHOD GetStatus(const PRUnichar** aResult); + NS_IMETHOD SetDefaultStatus(const PRUnichar* aStatus); + NS_IMETHOD GetDefaultStatus(const PRUnichar** aResult); + NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax); + NS_IMETHOD ShowMenuBar(PRBool aShow); + NS_IMETHOD GetWebShell(nsIWebShell*& aResult); + NS_IMETHOD GetContentWebShell(nsIWebShell **aResult); + + // nsIWebShellContainer + NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason); + NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL); + NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax); + NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus); + NS_IMETHOD NewWebShell(PRUint32 aChromeMask, + PRBool aVisible, + nsIWebShell *&aNewWebShell); + NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult); + NS_IMETHOD FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken); + NS_IMETHOD ContentShellAdded(nsIWebShell* aWebShell, nsIContent* frameNode); + NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, + PRInt32 aXPos, PRInt32 aYPos, + const nsString& aPopupType, const nsString& anAnchorAlignment, + const nsString& aPopupAlignment, + nsIDOMWindow* aWindow, nsIDOMWindow** outPopup); + + // nsIStreamObserver + NS_IMETHOD OnStartRequest(nsIChannel* aChannel, nsISupports* aContext); + NS_IMETHOD OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg); + + // nsIDocumentLoaderObserver + NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand); + NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus, nsIDocumentLoaderObserver* aObserver); + NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsIContentViewer* aViewer); + NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, PRUint32 aProgress, PRUint32 aProgressMax); + NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsString& aMsg); + NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus); + NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader, nsIChannel* channel, const char *aContentType,const char *aCommand ); +}; + +#endif diff --git a/mozilla/embedding/browser/activex/src/control/guids.cpp b/mozilla/embedding/browser/activex/src/control/guids.cpp new file mode 100644 index 00000000000..624f187a3bd --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/guids.cpp @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" +#include "guids.h" + +// Class IDs +NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); +NS_DEFINE_IID(kHTMLEditorCID, NS_HTMLEDITOR_CID); + +// Interface IDs +NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID); +NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); +NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); +NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID); +NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID); +NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID); +NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID); +NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID); +NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_IID); +NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); + +#ifdef USE_PLUGIN +NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); +NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID); +NS_DEFINE_IID(kIPluginInstanceIID, NS_IPLUGININSTANCE_IID); +#endif diff --git a/mozilla/embedding/browser/activex/src/control/guids.h b/mozilla/embedding/browser/activex/src/control/guids.h new file mode 100644 index 00000000000..a6e68d588d2 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/guids.h @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef GUIDS_H +#define GUIDS_H + +#define NS_EXTERN_IID(_name) \ + extern const nsIID _name; + +// Class IDs +NS_EXTERN_IID(kEventQueueServiceCID); +NS_EXTERN_IID(kHTMLEditorCID); + +// Interface IDs +NS_EXTERN_IID(kIBrowserWindowIID); +NS_EXTERN_IID(kIEventQueueServiceIID); +NS_EXTERN_IID(kIDocumentViewerIID); +NS_EXTERN_IID(kIDOMDocumentIID); +NS_EXTERN_IID(kIDOMNodeIID); +NS_EXTERN_IID(kIDOMElementIID); +NS_EXTERN_IID(kIWebShellContainerIID); +NS_EXTERN_IID(kIStreamObserverIID); +NS_EXTERN_IID(kIDocumentLoaderObserverIID); +NS_EXTERN_IID(kISupportsIID); + +#ifdef USE_PLUGIN +NS_EXTERN_IID(kIFactoryIID); +NS_EXTERN_IID(kIPluginIID); +NS_EXTERN_IID(kIPluginInstanceIID); +#endif + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/makefile.win b/mozilla/embedding/browser/activex/src/control/makefile.win new file mode 100644 index 00000000000..59f2ec2cb93 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/makefile.win @@ -0,0 +1,145 @@ +#!nmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +!if "$(MSSDK)" == "" +!message This module requires the MS Platform SDK to be installed. +!else + +DLLNAME = mozctl +QUIET = +DEPTH=..\..\..\..\.. + +MAKE_OBJ_TYPE = DLL +DLL=.\$(OBJDIR)\$(DLLNAME).dll +RESFILE = MozillaControl.res +DEFFILE = mozctl.def + +OBJS = \ + .\$(OBJDIR)\StdAfx.obj \ + .\$(OBJDIR)\ControlSite.obj \ + .\$(OBJDIR)\ControlSiteIPFrame.obj \ + .\$(OBJDIR)\ItemContainer.obj \ + .\$(OBJDIR)\PropertyBag.obj \ + .\$(OBJDIR)\MozillaControl.obj \ + .\$(OBJDIR)\nsSetupRegistry.obj \ + .\$(OBJDIR)\MozillaBrowser.obj \ + .\$(OBJDIR)\WebShellContainer.obj \ + .\$(OBJDIR)\IEHtmlNode.obj \ + .\$(OBJDIR)\IEHtmlElementCollection.obj \ + .\$(OBJDIR)\IEHtmlElement.obj \ + .\$(OBJDIR)\IEHtmlDocument.obj \ + .\$(OBJDIR)\DropTarget.obj \ + .\$(OBJDIR)\guids.obj \ + $(NULL) + +# most of these have to be here for nsSetupRegistry.cpp... + +LINCS= \ + -I$(PUBLIC)\raptor \ + -I$(PUBLIC)\xpcom \ + -I$(PUBLIC)\dom \ + -I$(PUBLIC)\js \ + -I$(PUBLIC)\netlib \ + -I$(PUBLIC)\java \ + -I$(PUBLIC)\plugin \ + -I$(PUBLIC)\caps \ + -I$(PUBLIC)\oji \ + -I$(PUBLIC)\editor \ + -I$(PUBLIC)\uconv \ + -I$(PUBLIC)\intl \ + -I$(PUBLIC)\locale \ + -I$(PUBLIC)\lwbrk \ + -I$(PUBLIC)\unicharutil \ + -I$(PUBLIC)\pref \ + -I$(PUBLIC)\wallet \ + -I$(PUBLIC)\rdf \ + -I$(PUBLIC)\profile \ + $(NULL) + +LLIBS= \ +# $(DIST)\lib\gkgfxwin.lib \ +# $(DIST)\lib\gkweb.lib \ + $(DIST)\lib\xpcom.lib \ + $(LIBNSPR) \ + $(NULL) + +WIN_LIBS = \ + comdlg32.lib \ + ole32.lib \ + oleaut32.lib \ + uuid.lib \ + shell32.lib \ + $(NULL) + + +LCFLAGS = /D "WIN32" /GX /FR /U "ClientWallet" +LLFLAGS = -SUBSYSTEM:windows /DLL + +include <$(DEPTH)\config\rules.mak> + +!ifdef MOZ_NO_DEBUG_RTL +LCFLAGS = $(LCFLAGS) -DMOZ_NO_DEBUG_RTL +!endif + +LCFLAGS = $(LCFLAGS) -DMOZ_ACTIVEX_CONTROL_SUPPORT + +install:: $(DLL) + $(MAKE_INSTALL) $(DLL) $(DIST)\bin + $(MAKE_INSTALL) MozillaControl.html $(DIST)\bin\res + regsvr32 /s /c $(DIST)\bin\$(DLLNAME).dll + +$(DEFFILE) : mkctldef.bat + mkctldef.bat $(DEFFILE) + +MozillaControl_i.c MozillaControl.h: MozillaControl.idl + midl /Oicf /h MozillaControl.h /iid MozillaControl_i.c MozillaControl.idl + +ControlSite.cpp \ +ControlSiteIPFrame.cpp \ +PropertyBag.cpp : StdAfx.h PropertyBag.h ControlSite.h ControlSiteIPFrame.h + +ItemContainer.cpp : StdAfx.h ItemContainer.h + +MozillaControl.cpp \ +StdAfx.cpp: StdAfx.h MozillaControl.h MozillaBrowser.h WebShellContainer.h + +IEHtmlNode.cpp : StdAfx.h IEHtmlNode.h + +IEHtmlElementCollection.cpp : StdAfx.h IEHtmlElementCollection.h + +IEHtmlElement.cpp : StdAfx.h IEHtmlNode.h IEHtmlElement.h + +IEHtmlDocument.cpp : StdAfx.h IEHtmlNode.h IEHtmlDocument.h + +DropTarget.cpp: StdAfx.h DropTarget.h + +MozillaControl.cpp \ +MozillaBrowser.cpp \ +WebShellContainer.cpp \ +StdAfx.cpp: StdAfx.h MozillaControl.h MozillaBrowser.h WebShellContainer.h IOleCommandTargetImpl.h + +guids.cpp: StdAfx.h guids.h + +clobber:: + -regsvr32 /s /c /u $(DIST)\bin\$(DLLNAME).dll + -del $(DEFFILE) + +!endif diff --git a/mozilla/embedding/browser/activex/src/control/mkctldef.bat b/mozilla/embedding/browser/activex/src/control/mkctldef.bat new file mode 100755 index 00000000000..6268d32e8b5 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/mkctldef.bat @@ -0,0 +1,30 @@ +@echo off + +REM This script generates the DEF file for the control DLL depending on +REM what has been set to go into it + +echo ; mozctl.def : Declares the module parameters. > %1 +echo ; This file was autogenerated by mkctldef.bat! >> %1 +echo. >> %1 +echo LIBRARY "npmozctl.DLL" >> %1 +echo EXPORTS >> %1 +echo ; ActiveX exports >> %1 +echo DllCanUnloadNow @100 PRIVATE >> %1 +echo DllGetClassObject @101 PRIVATE >> %1 +echo DllRegisterServer @102 PRIVATE >> %1 +echo DllUnregisterServer @103 PRIVATE >> %1 +echo. >> %1 + +:test_plugin +if NOT "%MOZ_ACTIVEX_PLUGIN_SUPPORT%"=="1" goto test_control +echo ; Plugin exports >> %1 +echo NP_GetEntryPoints @1 >> %1 +echo NP_Initialize @2 >> %1 +echo NP_Shutdown @3 >> %1 +echo ; NSGetFactory @10 >> %1 + +:test_control +if NOT "%MOT_ACTIVEX_CONTROL_SUPPORT%"=="1" goto end + + +:end \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/nsSetupRegistry.cpp b/mozilla/embedding/browser/activex/src/control/nsSetupRegistry.cpp new file mode 100644 index 00000000000..a82612e03e6 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/nsSetupRegistry.cpp @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* + * This evil file will go away when the XPCOM registry can be + * externally initialized! + * + * Until then, include the real file to keep everything in sync. + */ +#include "..\..\..\xpfe\bootstrap\nsSetupRegistry.cpp" diff --git a/mozilla/embedding/browser/activex/src/control/resource.h b/mozilla/embedding/browser/activex/src/control/resource.h new file mode 100644 index 00000000000..c687b46ba45 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/resource.h @@ -0,0 +1,36 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by MozillaControl.rc +// +#define IDS_PROJNAME 100 +#define IDR_MOZILLABROWSER 101 +#define IDI_MOZILLABROWSER 201 +#define IDR_POPUP_PAGE 202 +#define IDR_POPUP_LINK 203 +#define IDR_POPUP_CLIPBOARD 204 +#define ID_BROWSE_BACK 32768 +#define ID_BROWSE_FORWARD 32769 +#define ID_FILE_REFRESH 32772 +#define ID_FILE_PRINT 32773 +#define ID_PAGE_PROPERTIES 32774 +#define ID_FILE_VIEWSOURCE 32775 +#define ID_FILE_OPEN 32776 +#define ID_FILE_OPENINNEWWINDOW 32777 +#define ID_EDIT_COPYSHORTCUT 32778 +#define ID_LINK_PROPERTIES 32779 +#define ID_EDIT_CUT 32780 +#define ID_EDIT_COPY 32781 +#define ID_EDIT_PASTE 32782 +#define ID_EDIT_SELECTALL 32783 +#define ID_SELECTIONPOPUP_PRINT 32784 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 205 +#define _APS_NEXT_COMMAND_VALUE 32785 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/mozilla/embedding/browser/activex/src/makefile.win b/mozilla/embedding/browser/activex/src/makefile.win new file mode 100644 index 00000000000..4a8ebbc019e --- /dev/null +++ b/mozilla/embedding/browser/activex/src/makefile.win @@ -0,0 +1,7 @@ +#!nmake + +DEPTH=..\..\..\.. + +DIRS=control + +include <$(DEPTH)\config\rules.mak> \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/plugin/ActiveXPlugin.cpp b/mozilla/embedding/browser/activex/src/plugin/ActiveXPlugin.cpp new file mode 100644 index 00000000000..491b6a93fa9 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/plugin/ActiveXPlugin.cpp @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" + +static CActiveXPlugin *gpFactory = NULL; + +extern "C" NS_EXPORT nsresult +NSGetFactory(nsISupports* serviceMgr, + const nsCID &aClass, + const char *aClassName, + const char *aProgID, + nsIFactory **aFactory) +{ + if (aClass.Equals(kIPluginIID)) + { + if (gpFactory) + { + gpFactory->AddRef(); + *aFactory = (nsIFactory *) gpFactory; + return NS_OK; + } + + CActiveXPlugin *pFactory = new CActiveXPlugin(); + if (pFactory == NULL) + { + return NS_ERROR_OUT_OF_MEMORY; + } + pFactory->AddRef(); + gpFactory = pFactory; + *aFactory = pFactory; + return NS_OK; + } + + return NS_ERROR_FAILURE; +} + +extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr) +{ + return (_Module.GetLockCount() == 0); +} + +/////////////////////////////////////////////////////////////////////////////// + +CActiveXPlugin::CActiveXPlugin() +{ + NS_INIT_REFCNT(); +} + + +CActiveXPlugin::~CActiveXPlugin() +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// nsISupports implementation + + +NS_IMPL_ADDREF(CActiveXPlugin) +NS_IMPL_RELEASE(CActiveXPlugin) + +nsresult CActiveXPlugin::QueryInterface(const nsIID& aIID, void** aInstancePtrResult) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer"); + if (nsnull == aInstancePtrResult) + { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtrResult = NULL; + + if (aIID.Equals(kISupportsIID)) + { + *aInstancePtrResult = (void*) ((nsIPlugin*)this); + AddRef(); + return NS_OK; + } + + if (aIID.Equals(kIFactoryIID)) + { + *aInstancePtrResult = (void*) ((nsIPlugin*)this); + AddRef(); + return NS_OK; + } + + if (aIID.Equals(kIPluginIID)) + { + *aInstancePtrResult = (void*) ((nsIPlugin*)this); + AddRef(); + return NS_OK; + } + + return NS_NOINTERFACE; +} + +/////////////////////////////////////////////////////////////////////////////// +// nsIFactory overrides + +NS_IMETHODIMP CActiveXPlugin::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult) +{ + CActiveXPluginInstance *pInst = new CActiveXPluginInstance(); + if (pInst == NULL) + { + return NS_ERROR_OUT_OF_MEMORY; + } + pInst->AddRef(); + *aResult = pInst; + return NS_OK; +} + +NS_IMETHODIMP CActiveXPlugin::LockFactory(PRBool aLock) +{ + if (aLock) + { + _Module.Lock(); + } + else + { + _Module.Unlock(); + } + return NS_OK; +} + +/////////////////////////////////////////////////////////////////////////////// +// nsIPlugin overrides + +static const char *gpszMime = "application/x-oleobject:smp:Mozilla ActiveX Control Plug-in"; +static const char *gpszPluginName = "Mozilla ActiveX Control Plug-in"; +static const char *gpszPluginDesc = "ActiveX control host"; + +NS_IMETHODIMP CActiveXPlugin::CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType, void **aResult) +{ + return CreateInstance(aOuter, aIID, aResult); +} + +NS_IMETHODIMP CActiveXPlugin::Initialize() +{ + return NS_OK; +} + + +NS_IMETHODIMP CActiveXPlugin::Shutdown(void) +{ + return NS_OK; +} + + +NS_IMETHODIMP CActiveXPlugin::GetMIMEDescription(const char* *resultingDesc) +{ + *resultingDesc = gpszMime; + return NS_OK; +} + + +NS_IMETHODIMP CActiveXPlugin::GetValue(nsPluginVariable variable, void *value) +{ + nsresult err = NS_OK; + if (variable == nsPluginVariable_NameString) + { + *((char **)value) = const_cast(gpszPluginName); + } + else if (variable == nsPluginVariable_DescriptionString) + { + *((char **)value) = const_cast(gpszPluginDesc); + } + else + { + err = NS_ERROR_FAILURE; + } + return err; +} diff --git a/mozilla/embedding/browser/activex/src/plugin/ActiveXPlugin.h b/mozilla/embedding/browser/activex/src/plugin/ActiveXPlugin.h new file mode 100644 index 00000000000..680bf20143a --- /dev/null +++ b/mozilla/embedding/browser/activex/src/plugin/ActiveXPlugin.h @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef ACTIVEXPLUGIN_H +#define ACTIVEXPLUGIN_H + +class CActiveXPlugin : public nsIPlugin +{ +protected: + virtual ~CActiveXPlugin(); + +public: + CActiveXPlugin(); + + // nsISupports overrides + NS_DECL_ISUPPORTS + + // nsIFactory overrides + NS_IMETHOD CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult); + NS_IMETHOD LockFactory(PRBool aLock); + + // nsIPlugin overrides + NS_IMETHOD CreatePluginInstance(nsISupports *aOuter, REFNSIID aIID, const char* aPluginMIMEType, void **aResult); + NS_IMETHOD Initialize(); + NS_IMETHOD Shutdown(void); + NS_IMETHOD GetMIMEDescription(const char* *resultingDesc); + NS_IMETHOD GetValue(nsPluginVariable variable, void *value); +}; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/plugin/ActiveXPluginInstance.cpp b/mozilla/embedding/browser/activex/src/plugin/ActiveXPluginInstance.cpp new file mode 100644 index 00000000000..d22928fe32b --- /dev/null +++ b/mozilla/embedding/browser/activex/src/plugin/ActiveXPluginInstance.cpp @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" + +/////////////////////////////////////////////////////////////////////////////// + +CActiveXPluginInstance::CActiveXPluginInstance() +{ + NS_INIT_REFCNT(); + mControlSite = NULL; +} + + +CActiveXPluginInstance::~CActiveXPluginInstance() +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// nsISupports implementation + +NS_IMPL_ADDREF(CActiveXPluginInstance) +NS_IMPL_RELEASE(CActiveXPluginInstance) + +nsresult CActiveXPluginInstance::QueryInterface(const nsIID& aIID, void** aInstancePtrResult) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer"); + if (nsnull == aInstancePtrResult) + { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtrResult = NULL; + + if (aIID.Equals(kISupportsIID)) + { + *aInstancePtrResult = (void*) ((nsIPluginInstance*)this); + AddRef(); + return NS_OK; + } + + if (aIID.Equals(kIPluginInstanceIID)) + { + *aInstancePtrResult = (void*) ((nsIPluginInstance*)this); + AddRef(); + return NS_OK; + } + + return NS_NOINTERFACE; +} + +/////////////////////////////////////////////////////////////////////////////// +// nsIPluginInstance overrides + +NS_IMETHODIMP CActiveXPluginInstance::Initialize(nsIPluginInstancePeer* peer) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::GetPeer(nsIPluginInstancePeer* *resultingPeer) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::Start(void) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::Stop(void) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::Destroy(void) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::SetWindow(nsPluginWindow* window) +{ + if (window) + { + mPluginWindow = *window; + } + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::NewStream(nsIPluginStreamListener** listener) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::Print(nsPluginPrint* platformPrint) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::GetValue(nsPluginInstanceVariable variable, void *value) +{ + return NS_OK; +} + +NS_IMETHODIMP CActiveXPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* handled) +{ + return NS_OK; +} diff --git a/mozilla/embedding/browser/activex/src/plugin/ActiveXPluginInstance.h b/mozilla/embedding/browser/activex/src/plugin/ActiveXPluginInstance.h new file mode 100644 index 00000000000..b608d03527a --- /dev/null +++ b/mozilla/embedding/browser/activex/src/plugin/ActiveXPluginInstance.h @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef ACTIVEXPLUGININSTANCE_H +#define ACTIVEXPLUGININSTANCE_H + +class CActiveXPluginInstance : public nsIPluginInstance +{ +protected: + virtual ~CActiveXPluginInstance(); + + CControlSite *mControlSite; + nsPluginWindow mPluginWindow; + +public: + CActiveXPluginInstance(); + + // nsISupports overrides + NS_DECL_ISUPPORTS + + // nsIPluginInstance overrides + NS_IMETHOD Initialize(nsIPluginInstancePeer* peer); + NS_IMETHOD GetPeer(nsIPluginInstancePeer* *resultingPeer); + NS_IMETHOD Start(void); + NS_IMETHOD Stop(void); + NS_IMETHOD Destroy(void); + NS_IMETHOD SetWindow(nsPluginWindow* window); + NS_IMETHOD NewStream(nsIPluginStreamListener** listener); + NS_IMETHOD Print(nsPluginPrint* platformPrint); + NS_IMETHOD GetValue(nsPluginInstanceVariable variable, void *value); + NS_IMETHOD HandleEvent(nsPluginEvent* event, PRBool* handled); +}; + + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp b/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp new file mode 100644 index 00000000000..5bdef357287 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/plugin/LegacyPlugin.cpp @@ -0,0 +1,567 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#include "stdafx.h" + +// Plugin types supported +enum PluginInstanceType +{ + itScript, + itControl +}; + +// Data associated with a plugin instance +struct PluginInstanceData { + PluginInstanceType nType; + union + { + CActiveScriptSiteInstance *pScriptSite; + CControlSiteInstance *pControlSite; + }; +}; + + +// NPP_Initialize +// +// Initialize the plugin library. Your DLL global initialization +// should be here +// +NPError NPP_Initialize(void) +{ + NG_TRACE_METHOD(NPP_Initialize); + _Module.Lock(); + return NPERR_NO_ERROR; +} + + +// NPP_Shutdown +// +// shutdown the plugin library. Revert initializition +// +void NPP_Shutdown(void) +{ + NG_TRACE_METHOD(NPP_Shutdown); + _Module.Unlock(); +} + + +// npp_GetJavaClass +// +// Return the Java class representing this plugin +// +jref NPP_GetJavaClass(void) +{ + NG_TRACE_METHOD(NPP_GetJavaClass); + + //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. + // get the Java environment. You need this information pretty much for + // any jri (Java Runtime Interface) call. +// JRIEnv* env = NPN_GetJavaEnv(); + //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. + // init any classes that define native methods, or whose methods we + // are going to use. + // The following functions are generated by javah running on the java + // class(es) representing this plugin. javah generates the files + // .h and .c (same for any additional + // class you may want to use) + // Return the main java class representing this plugin (derives from + // Plugin class on the java side) +// use_netscape_plugin_Plugin(env); +// use_AviObserver(env); +// return (jref)use_AviPlayer(env); + // if no java is used + return NULL; +} + + +#define MIME_OLEOBJECT1 "application/x-oleobject" +#define MIME_OLEOBJECT2 "application/oleobject" +#define MIME_ACTIVESCRIPT "text/x-activescript" + + +NPError NewScript(const char *pluginType, + PluginInstanceData *pData, + uint16 mode, + int16 argc, + char *argn[], + char *argv[]) +{ + CActiveScriptSiteInstance *pScriptSite = NULL; + CActiveScriptSiteInstance::CreateInstance(&pScriptSite); + + // TODO support ActiveScript + MessageBox(NULL, _T("ActiveScript not supported yet!"), NULL, MB_OK); + return NPERR_GENERIC_ERROR; +} + +NPError NewControl(const char *pluginType, + PluginInstanceData *pData, + uint16 mode, + int16 argc, + char *argn[], + char *argv[]) +{ + // Read the parameters + CLSID clsid = CLSID_NULL; + tstring szName; + tstring szCodebase; + PropertyList pl; + + for (int16 i = 0; i < argc; i++) + { + if (stricmp(argn[i], "CLSID") == 0 || + stricmp(argn[i], "CLASSID") == 0) + { + // Accept CLSIDs specified in various ways + // e.g: + // "CLSID:C16DF970-D1BA-11d2-A252-000000000000" + // "C16DF970-D1BA-11d2-A252-000000000000" + // "{C16DF970-D1BA-11d2-A252-000000000000}" + // + // The first example is the proper way + + char szCLSID[256]; + if (strnicmp(argv[i], "CLSID:", 6) == 0) + { + char szTmp[256]; + sscanf(argv[i], "CLSID:%s", szTmp); + sprintf(szCLSID, "{%s}", szTmp); + } + else if(argv[i][0] != '{') + { + sprintf(szCLSID, "{%s}", argv[i]); + } + else + { + strncpy(szCLSID, argv[i], sizeof(szCLSID)); + } + + USES_CONVERSION; + CLSIDFromString(A2OLE(szCLSID), &clsid); + } + else if (stricmp(argn[i], "NAME") == 0) + { + USES_CONVERSION; + szName = tstring(A2T(argv[i])); + } + else if (stricmp(argn[i], "CODEBASE") == 0) + { + szCodebase = tstring(A2T(argv[i])); + } + else if (strnicmp(argn[i], "PARAM_", 6) == 0) + { + USES_CONVERSION; + + std::wstring szName(A2W(argn[i] + 6)); + std::wstring szParam(A2W(argv[i])); + + // Empty parameters are ignored + if (szName.empty()) + { + continue; + } + + // Check for existing params with the same name + BOOL bFound = FALSE; + for (PropertyList::const_iterator i = pl.begin(); i != pl.end(); i++) + { + if (wcscmp((BSTR) (*i).szName, szName.c_str()) == 0) + { + bFound = TRUE; + break; + } + } + // If the parameter already exists, don't add it to the + // list again. + if (bFound) + { + continue; + } + + CComVariant vsValue(szParam.c_str()); + CComVariant vIValue; // Value converted to int + CComVariant vRValue; // Value converted to real + CComVariant &vValue = vsValue; + + // See if the variant can be converted to an integer + if (VariantChangeType(&vIValue, &vsValue, 0, VT_I4) == S_OK) + { + vValue = vIValue; + } + else if (VariantChangeType(&vRValue, &vsValue, 0, VT_R8) == S_OK) + { + vValue = vRValue; + } + + // Add named parameter to list + Property p; + p.szName = szName.c_str(); + p.vValue = vValue; + pl.push_back(p); + } + } + + + // Create the control site + CControlSiteInstance *pSite = NULL; + CControlSiteInstance::CreateInstance(&pSite); + if (pSite == NULL) + { + return NPERR_GENERIC_ERROR; + } + pSite->AddRef(); + + // TODO check the object is installed and at least as recent as + // that specified in szCodebase + + // Create the object + if (FAILED(pSite->Create(clsid, pl, szName))) + { + USES_CONVERSION; + LPOLESTR szClsid; + StringFromCLSID(clsid, &szClsid); + TCHAR szBuffer[256]; + _stprintf(szBuffer, _T("Could not create the control %s. Check that it has been installed on your computer and that this page correctly references it."), OLE2T(szClsid)); + MessageBox(NULL, szBuffer, _T("ActiveX Error"), MB_OK | MB_ICONWARNING); + CoTaskMemFree(szClsid); + + pSite->Release(); + return NPERR_GENERIC_ERROR; + } + + pData->nType = itControl; + pData->pControlSite = pSite; + + return NPERR_NO_ERROR; +} + + +// NPP_New +// +// create a new plugin instance +// handle any instance specific code initialization here +// +NPError NP_LOADDS NPP_New(NPMIMEType pluginType, + NPP instance, + uint16 mode, + int16 argc, + char* argn[], + char* argv[], + NPSavedData* saved) +{ + NG_TRACE_METHOD(NPP_New); + + // trap duff args + if (instance == NULL) + { + return NPERR_INVALID_INSTANCE_ERROR; + } + + PluginInstanceData *pData = new PluginInstanceData; + if (pData == NULL) + { + return NPERR_GENERIC_ERROR; + } + + // Create a plugin according to the mime type + + NPError rv = NPERR_GENERIC_ERROR; + if (strcmp(pluginType, MIME_ACTIVESCRIPT) == 0) + { + rv = NewScript(pluginType, pData, mode, argc, argn, argv); + } + else if (strcmp(pluginType, MIME_OLEOBJECT1) == 0 || + strcmp(pluginType, MIME_OLEOBJECT2) == 0) + { + rv = NewControl(pluginType, pData, mode, argc, argn, argv); + } + else + { + // Unknown MIME type + } + + // Test if plugin creation has succeeded and cleanup if it hasn't + if (rv != NPERR_NO_ERROR) + { + delete pData; + return rv; + } + + instance->pdata = pData; + + return NPERR_NO_ERROR; +} + + +// NPP_Destroy +// +// Deletes a plug-in instance and releases all of its resources. +// +NPError NP_LOADDS +NPP_Destroy(NPP instance, NPSavedData** save) +{ + NG_TRACE_METHOD(NPP_Destroy); + + PluginInstanceData *pData = (PluginInstanceData *) instance->pdata; + if (pData == NULL) + { + return NPERR_INVALID_INSTANCE_ERROR; + } + + if (pData->nType == itControl) + { + // Destroy the site + CControlSiteInstance *pSite = pData->pControlSite; + if (pSite) + { + pSite->Detach(); + pSite->Release(); + } + } + else if (pData->nType == itScript) + { + // TODO + } + + delete pData; + + instance->pdata = 0; + + return NPERR_NO_ERROR; + +} + + +// NPP_SetWindow +// +// Associates a platform specific window handle with a plug-in instance. +// Called multiple times while, e.g., scrolling. Can be called for three +// reasons: +// +// 1. A new window has been created +// 2. A window has been moved or resized +// 3. A window has been destroyed +// +// There is also the degenerate case; that it was called spuriously, and +// the window handle and or coords may have or have not changed, or +// the window handle and or coords may be ZERO. State information +// must be maintained by the plug-in to correctly handle the degenerate +// case. +// +NPError NP_LOADDS +NPP_SetWindow(NPP instance, NPWindow* window) +{ + NG_TRACE_METHOD(NPP_SetWindow); + + // Reject silly parameters + if (!window) + { + return NPERR_GENERIC_ERROR; + } + + PluginInstanceData *pData = (PluginInstanceData *) instance->pdata; + if (pData == NULL) + { + return NPERR_INVALID_INSTANCE_ERROR; + } + + if (pData->nType == itControl) + { + CControlSiteInstance *pSite = pData->pControlSite; + if (pSite == NULL) + { + return NPERR_GENERIC_ERROR; + } + + HWND hwndParent = (HWND) window->window; + if (hwndParent) + { + RECT rcPos; + GetClientRect(hwndParent, &rcPos); + + if (pSite->GetParentWindow() == NULL) + { + pSite->Attach(hwndParent, rcPos, NULL); + } + else + { + pSite->SetPosition(rcPos); + } + } +} + + return NPERR_NO_ERROR; +} + + +// NPP_NewStream +// +// Notifies the plugin of a new data stream. +// The data type of the stream (a MIME name) is provided. +// The stream object indicates whether it is seekable. +// The plugin specifies how it wants to handle the stream. +// +// In this case, I set the streamtype to be NPAsFile. This tells the Navigator +// that the plugin doesn't handle streaming and can only deal with the object as +// a complete disk file. It will still call the write functions but it will also +// pass the filename of the cached file in a later NPE_StreamAsFile call when it +// is done transfering the file. +// +// If a plugin handles the data in a streaming manner, it should set streamtype to +// NPNormal (e.g. *streamtype = NPNormal)...the NPE_StreamAsFile function will +// never be called in this case +// +NPError NP_LOADDS +NPP_NewStream(NPP instance, + NPMIMEType type, + NPStream *stream, + NPBool seekable, + uint16 *stype) +{ + NG_TRACE_METHOD(NPP_NewStream); + + if(!instance) + { + return NPERR_INVALID_INSTANCE_ERROR; + } + + // save the plugin instance object in the stream instance + stream->pdata = instance->pdata; + *stype = NP_ASFILE; + return NPERR_NO_ERROR; +} + + +// NPP_StreamAsFile +// +// The stream is done transferring and here is a pointer to the file in the cache +// This function is only called if the streamtype was set to NPAsFile. +// +void NP_LOADDS +NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) +{ + NG_TRACE_METHOD(NPP_StreamAsFile); + + if(fname == NULL || fname[0] == NULL) + { + return; + } +} + + +// +// These next 2 functions are really only directly relevant +// in a plug-in which handles the data in a streaming manner. +// For a NPAsFile stream, they are still called but can safely +// be ignored. +// +// In a streaming plugin, all data handling would take place here... +// +////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//. +//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\. + +int32 STREAMBUFSIZE = 0X0FFFFFFF; // we are reading from a file in NPAsFile mode + // so we can take any size stream in our write + // call (since we ignore it) + + +// NPP_WriteReady +// +// The number of bytes that a plug-in is willing to accept in a subsequent +// NPO_Write call. +// +int32 NP_LOADDS +NPP_WriteReady(NPP instance, NPStream *stream) +{ + return STREAMBUFSIZE; +} + + +// NPP_Write +// +// Provides len bytes of data. +// +int32 NP_LOADDS +NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) +{ + return len; +} + + +// NPP_DestroyStream +// +// Closes a stream object. +// reason indicates why the stream was closed. Possible reasons are +// that it was complete, because there was some error, or because +// the user aborted it. +// +NPError NP_LOADDS +NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) +{ + // because I am handling the stream as a file, I don't do anything here... + // If I was streaming, I would know that I was done and do anything appropriate + // to the end of the stream... + return NPERR_NO_ERROR; +} + + +// NPP_Print +// +// Printing the plugin (to be continued...) +// +void NP_LOADDS +NPP_Print(NPP instance, NPPrint* printInfo) +{ + if(printInfo == NULL) // trap invalid parm + { + return; + } + +// if (instance != NULL) { +// CPluginWindow* pluginData = (CPluginWindow*) instance->pdata; +// pluginData->Print(printInfo); +// } +} + +/******************************************************************************* +// NPP_URLNotify: +// Notifies the instance of the completion of a URL request. +// +// NPP_URLNotify is called when Netscape completes a NPN_GetURLNotify or +// NPN_PostURLNotify request, to inform the plug-in that the request, +// identified by url, has completed for the reason specified by reason. The most +// common reason code is NPRES_DONE, indicating simply that the request +// completed normally. Other possible reason codes are NPRES_USER_BREAK, +// indicating that the request was halted due to a user action (for example, +// clicking the "Stop" button), and NPRES_NETWORK_ERR, indicating that the +// request could not be completed (for example, because the URL could not be +// found). The complete list of reason codes is found in npapi.h. +// +// The parameter notifyData is the same plug-in-private value passed as an +// argument to the corresponding NPN_GetURLNotify or NPN_PostURLNotify +// call, and can be used by your plug-in to uniquely identify the request. + ******************************************************************************/ + +void +NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData) +{ +} + diff --git a/mozilla/embedding/browser/activex/src/plugin/makefile.win b/mozilla/embedding/browser/activex/src/plugin/makefile.win new file mode 100644 index 00000000000..b0c447ce745 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/plugin/makefile.win @@ -0,0 +1,163 @@ +#!nmake +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): + +!if "$(MSSDK)" == "" +!message This module requires the MS Platform SDK to be installed. +!else + +DLLNAME = npax +QUIET = +DEPTH =..\..\.. + + +# The default is to include control support unless told to do otherwise +!ifndef MOZ_ACTIVEX_NO_CONTROL_SUPPORT +MOZ_ACTIVEX_CONTROL_SUPPORT = 1 +!endif + +!ifndef MOZ_ACTIVEX_NO_PLUGIN_SUPPORT +# MOZ_ACTIVEX_PLUGIN_SUPPORT = 1 +!endif + + +MAKE_OBJ_TYPE = DLL +DLL=.\$(OBJDIR)\$(DLLNAME).dll +RESFILE = MozillaControl.res +DEFFILE = npmozctl.def + +OBJS = \ + .\$(OBJDIR)\StdAfx.obj \ + .\$(OBJDIR)\ControlSite.obj \ + .\$(OBJDIR)\ControlSiteIPFrame.obj \ + .\$(OBJDIR)\ItemContainer.obj \ + .\$(OBJDIR)\PropertyBag.obj \ + .\$(OBJDIR)\MozillaControl.obj \ +# .\$(OBJDIR)\ActiveXPlugin.obj \ +# .\$(OBJDIR)\ActiveXPluginInstance.obj \ + .\$(OBJDIR)\ActiveScriptSite.obj \ + .\$(OBJDIR)\LegacyPlugin.obj \ + .\$(OBJDIR)\npwin.obj \ + $(NULL) + +# most of these have to be here for nsSetupRegistry.cpp... + +LINCS= \ +!ifdef MOZ_ACTIVEX_PLUGIN_SUPPORT + -I$(MOZ_PLUGINSDK)\include \ +!endif + -I$(PUBLIC)\raptor \ + -I$(PUBLIC)\xpcom \ + -I$(PUBLIC)\dom \ + -I$(PUBLIC)\js \ + -I$(PUBLIC)\netlib \ + -I$(PUBLIC)\java \ + -I$(PUBLIC)\plugin \ + -I$(PUBLIC)\caps \ + -I$(PUBLIC)\oji \ + -I$(PUBLIC)\editor \ + -I$(PUBLIC)\uconv \ + -I$(PUBLIC)\intl \ + -I$(PUBLIC)\locale \ + -I$(PUBLIC)\lwbrk \ + -I$(PUBLIC)\unicharutil \ + -I$(PUBLIC)\pref \ + -I$(PUBLIC)\wallet \ + -I$(PUBLIC)\rdf \ + -I$(PUBLIC)\profile \ + $(NULL) + +LLIBS= \ +!ifdef MOZ_ACTIVEX_CONTROL_SUPPORT + $(DIST)\lib\gkgfxwin.lib \ + $(DIST)\lib\gkweb.lib \ + $(DIST)\lib\xpcom.lib \ + $(LIBNSPR) \ +!endif + $(NULL) + +WIN_LIBS = \ + comdlg32.lib \ + ole32.lib \ + oleaut32.lib \ + uuid.lib \ + shell32.lib \ + $(NULL) + + +LCFLAGS = /D "WIN32" /GX /FR /U "ClientWallet" +LLFLAGS = -SUBSYSTEM:windows /DLL + +include <$(DEPTH)\config\rules.mak> + +!ifdef MOZ_NO_DEBUG_RTL +LCFLAGS = $(LCFLAGS) -DMOZ_NO_DEBUG_RTL +!endif + +!ifdef MOZ_ACTIVEX_PLUGIN_SUPPORT +LCFLAGS = $(LCFLAGS) -DMOZ_ACTIVEX_PLUGIN_SUPPORT +!endif + +!ifdef MOZ_ACTIVEX_CONTROL_SUPPORT +LCFLAGS = $(LCFLAGS) -DMOZ_ACTIVEX_CONTROL_SUPPORT +!endif + +install:: $(DLL) + $(MAKE_INSTALL) $(DLL) $(DIST)\bin + $(MAKE_INSTALL) MozillaControl.html $(DIST)\bin\res + regsvr32 /s /c $(DIST)\bin\$(DLLNAME).dll + +$(DEFFILE) : mkctldef.bat + mkctldef.bat $(DEFFILE) + +MozillaControl_i.c MozillaControl.h: MozillaControl.idl + midl /Oicf /h MozillaControl.h /iid MozillaControl_i.c MozillaControl.idl + +ActiveScriptSite.cpp: StdAfx.h ActiveScriptSite.h + +LegacyPlugin.cpp \ +ActiveXPlugin.cpp \ +ActiveXPluginInstance.cpp: StdAfx.h ActiveXPlugin.h ActiveXPluginInstance.h + +npwin.cpp: $(MOZ_PLUGINSDK)/common/npwin.cpp + -cp -f $(MOZ_PLUGINSDK)/common/npwin.cpp . + +ControlSite.cpp \ +ControlSiteIPFrame.cpp \ +PropertyBag.cpp : StdAfx.h PropertyBag.h ControlSite.h ControlSiteIPFrame.h + +ItemContainer.cpp : StdAfx.h ItemContainer.h + +guids.cpp: StdAfx.h guids.h + +control_and_plugin: + nmake /f makefile.win MOZ_ACTIVEX_PLUGIN_SUPPORT=1 MOZ_ACTIVEX_CONTROL_SUPPORT=1 + +plugin_only:: + nmake /f makefile.win MOZ_ACTIVEX_PLUGIN_SUPPORT=1 MOZ_ACTIVEX_NO_CONTROL_SUPPORT=1 + +control_only:: + nmake /f makefile.win MOZ_ACTIVEX_CONTROL_SUPPORT=1 MOZ_ACTIVEX_NO_PLUGIN_SUPPORT=1 + +clobber:: + -regsvr32 /s /c /u $(DIST)\bin\$(DLLNAME).dll + -del $(DEFFILE) + +!endif