This commit is contained in:
locka%iol.ie 1999-11-28 16:39:50 +00:00
Родитель 6c79eca1ca
Коммит 3f562a6d09
53 изменённых файлов: 15266 добавлений и 0 удалений

Просмотреть файл

Просмотреть файл

@ -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 <sys/types.h>
#include <sys/stat.h>
#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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>,
public IActiveScriptSite
{
// Pointer to owned script engine
CComQIPtr<IActiveScript, &IID_IActiveScript> 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<CActiveScriptSite> CActiveScriptSiteInstance;
#endif

Просмотреть файл

@ -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 <vector>
#include <map>
// STL based class for handling TCHAR strings
typedef std::basic_string<TCHAR> tstring;
// IUnknown smart pointer
typedef CComPtr<IUnknown> CIUnkPtr;
// Smart pointer macro for CComQIPtr
#define CIPtr(iface) CComQIPtr< iface, &IID_ ## iface >
typedef std::vector<CIUnkPtr> CObjectList;
typedef std::map<tstring, CIUnkPtr> CNamedObjectList;
#endif

Просмотреть файл

@ -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 <assert.h>
# 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

Просмотреть файл

@ -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 T>
class CProxyDWebBrowserEvents : public IConnectionPointImpl<T, &DIID_DWebBrowserEvents, CComDynamicUnkArray>
{
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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*pp);
pDispatch->Invoke(0x70, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
pp++;
}
pT->Unlock();
delete[] pvars;
}
};
//////////////////////////////////////////////////////////////////////////////
// CProxyDWebBrowserEvents2
template <class T>
class CProxyDWebBrowserEvents2 : public IConnectionPointImpl<T, &DIID_DWebBrowserEvents2, CComDynamicUnkArray>
{
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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*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<IDispatch*>(*pp);
pDispatch->Invoke(0x104, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
pp++;
}
pT->Unlock();
delete[] pvars;
}
};
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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<CComSingleThreadModel>,
public IOleClientSite,
public IOleInPlaceSiteWindowless,
public IOleControlSite,
public IAdviseSinkEx,
public IDispatch,
public IOleCommandTargetImpl<CControlSite>
{
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<IUnknown> m_spObject;
// Pointer to objects IViewObject interface
CComQIPtr<IViewObject, &IID_IViewObject> m_spIViewObject;
// Pointer to object's IOleObject interface
CComQIPtr<IOleObject, &IID_IOleObject> m_spIOleObject;
// Pointer to object's IOleInPlaceObject interface
CComQIPtr<IOleInPlaceObject, &IID_IOleInPlaceObject> m_spIOleInPlaceObject;
// Pointer to object's IOleInPlaceObjectWindowless interface
CComQIPtr<IOleInPlaceObjectWindowless, &IID_IOleInPlaceObjectWindowless> 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<CControlSite *> 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<CControlSite> CControlSiteInstance;
#endif

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>,
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<CControlSiteIPFrame> CControlSiteIPFrameInstance;
#endif

Просмотреть файл

@ -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

Просмотреть файл

@ -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 <intshcut.h>
#include <shlobj.h>
#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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>,
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<CDropTarget> CDropTargetInstance;
#endif

Просмотреть файл

@ -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 <stack>
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;
}

Просмотреть файл

@ -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<IHTMLDocument2, &IID_IHTMLDocument2, &LIBID_MSHTML>,
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<CIEHtmlDocument> CIEHtmlDocumentInstance;
#endif

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<IHTMLElement, &IID_IHTMLElement, &LIBID_MSHTML>
{
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<CIEHtmlElement> CIEHtmlElementInstance;
#endif

Просмотреть файл

@ -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 <stack>
#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<CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > > 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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>,
public IDispatchImpl<IHTMLElementCollection, &IID_IHTMLElementCollection, &LIBID_MSHTML>
{
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<CIEHtmlElementCollection> CIEHtmlElementCollectionInstance;
#endif

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>
{
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<CIEHtmlNode> CIEHtmlNodeInstance;
#endif

Просмотреть файл

@ -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<CComMyClass>
// {
// ... 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<T*>(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<T*>(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

Просмотреть файл

@ -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<CComEnumOnSTL<IEnumUnknown, &IID_IEnumUnknown, IUnknown*, _CopyInterface<IUnknown>, 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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>,
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<CItemContainer> CItemContainerInstance;
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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<CMozillaBrowser>
#define CDWebBrowserEvents2 CProxyDWebBrowserEvents2<CMozillaBrowser>
// A list of objects
typedef CComPtr<IUnknown> CComUnkPtr;
typedef std::vector<CComUnkPtr> ObjectList;
class CWebShellContainer;
/////////////////////////////////////////////////////////////////////////////
// CMozillaBrowser
class ATL_NO_VTABLE CMozillaBrowser :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CMozillaBrowser, &CLSID_MozillaBrowser>,
public CComControl<CMozillaBrowser>,
public CDWebBrowserEvents1,
public CDWebBrowserEvents2,
public CStockPropImpl<CMozillaBrowser, IWebBrowser2, &IID_IWebBrowser2, &LIBID_MOZILLACONTROLLib>,
public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents2, &LIBID_MOZILLACONTROLLib>,
public IPersistStreamInitImpl<CMozillaBrowser>,
public IPersistStorageImpl<CMozillaBrowser>,
public IQuickActivateImpl<CMozillaBrowser>,
public IOleControlImpl<CMozillaBrowser>,
public IOleObjectImpl<CMozillaBrowser>,
public IOleInPlaceActiveObjectImpl<CMozillaBrowser>,
public IViewObjectExImpl<CMozillaBrowser>,
public IOleInPlaceObjectWindowlessImpl<CMozillaBrowser>,
public IDataObjectImpl<CMozillaBrowser>,
public ISupportErrorInfo,
public IOleCommandTargetImpl<CMozillaBrowser>,
public IConnectionPointContainerImpl<CMozillaBrowser>,
public ISpecifyPropertyPagesImpl<CMozillaBrowser>
{
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_

Двоичные данные
embedding/browser/activex/src/control/MozillaBrowser.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Просмотреть файл

@ -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'
}
}
}

Просмотреть файл

@ -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;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

Просмотреть файл

@ -0,0 +1,415 @@
#include <olectl.h>
// 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 <exdispid.h>
[
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;
};
};

Просмотреть файл

@ -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

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<CComSingleThreadModel>,
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<CPropertyBag> CPropertyBagInstance;
#endif

Просмотреть файл

@ -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<Property> PropertyList;
// DEVNOTE: These operators are required since the unpatched VC++ 5.0
// generates code even for unreferenced template methods in
// the file <vector> 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

Просмотреть файл

@ -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 <statreg.h>
#include <statreg.cpp>
#endif
#include <atlimpl.cpp>
#include <atlctl.cpp>
#include <atlwin.cpp>

Просмотреть файл

@ -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 <atlbase.h>
//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 <atlcom.h>
#include <atlctl.h>
#include <mshtml.h>
#include <mshtmhst.h>
#include <docobj.h>
#include <winsock2.h>
#ifdef USE_PLUGIN
#include <activscp.h>
#endif
// STL headers
#include <vector>
#include <list>
#include <string>
// 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)

Просмотреть файл

@ -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 <limits.h>
#include <shlobj.h>
#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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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"

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1,7 @@
#!nmake
DEPTH=..\..\..\..
DIRS=control
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -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<char *>(gpszPluginName);
}
else if (variable == nsPluginVariable_DescriptionString)
{
*((char **)value) = const_cast<char *>(gpszPluginDesc);
}
else
{
err = NS_ERROR_FAILURE;
}
return err;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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
// <java class name>.h and <java class name>.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)
{
}

Просмотреть файл

@ -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