mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-15 03:00:30 +00:00
Move IE DOM classes and other shared classes out of control and into a common dir. b=206901 r=dbradley@netscape.com sr=alecf@netscape.com
This commit is contained in:
parent
85570db892
commit
c6437cebb7
951
embedding/browser/activex/src/common/CPMozillaControl.h
Normal file
951
embedding/browser/activex/src/common/CPMozillaControl.h
Normal file
@ -0,0 +1,951 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#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
|
217
embedding/browser/activex/src/common/ControlEventSink.cpp
Normal file
217
embedding/browser/activex/src/common/ControlEventSink.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ControlEventSink.h"
|
||||
|
||||
CControlEventSink::CControlEventSink() :
|
||||
m_dwEventCookie(0),
|
||||
m_EventIID(GUID_NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CControlEventSink::~CControlEventSink()
|
||||
{
|
||||
UnsubscribeFromEvents();
|
||||
}
|
||||
|
||||
BOOL
|
||||
CControlEventSink::GetEventSinkIID(IUnknown *pControl, IID &iid, ITypeInfo **typeInfo)
|
||||
{
|
||||
iid = GUID_NULL;
|
||||
if (!pControl)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// IProvideClassInfo2 way is easiest
|
||||
// CComQIPtr<IProvideClassInfo2> classInfo2 = pControl;
|
||||
// if (classInfo2)
|
||||
// {
|
||||
// classInfo2->GetGUID(GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid);
|
||||
// if (!::IsEqualIID(iid, GUID_NULL))
|
||||
// {
|
||||
// return TRUE;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Yuck, the hard way
|
||||
CComQIPtr<IProvideClassInfo> classInfo = pControl;
|
||||
if (!classInfo)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Search the class type information for the default source interface
|
||||
// which is the outgoing event sink.
|
||||
|
||||
CComPtr<ITypeInfo> classTypeInfo;
|
||||
classInfo->GetClassInfo(&classTypeInfo);
|
||||
if (!classTypeInfo)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
TYPEATTR *classAttr = NULL;
|
||||
if (FAILED(classTypeInfo->GetTypeAttr(&classAttr)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
INT implFlags = 0;
|
||||
for (UINT i = 0; i < classAttr->cImplTypes; i++)
|
||||
{
|
||||
// Search for the interface with the [default, source] attr
|
||||
if (SUCCEEDED(classTypeInfo->GetImplTypeFlags(i, &implFlags)) &&
|
||||
implFlags == (IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE))
|
||||
{
|
||||
CComPtr<ITypeInfo> eventSinkTypeInfo;
|
||||
HREFTYPE hRefType;
|
||||
if (SUCCEEDED(classTypeInfo->GetRefTypeOfImplType(i, &hRefType)) &&
|
||||
SUCCEEDED(classTypeInfo->GetRefTypeInfo(hRefType, &eventSinkTypeInfo)))
|
||||
{
|
||||
TYPEATTR *eventSinkAttr = NULL;
|
||||
if (SUCCEEDED(eventSinkTypeInfo->GetTypeAttr(&eventSinkAttr)))
|
||||
{
|
||||
iid = eventSinkAttr->guid;
|
||||
if (typeInfo)
|
||||
{
|
||||
*typeInfo = eventSinkTypeInfo.p;
|
||||
(*typeInfo)->AddRef();
|
||||
}
|
||||
eventSinkTypeInfo->ReleaseTypeAttr(eventSinkAttr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
classTypeInfo->ReleaseTypeAttr(classAttr);
|
||||
|
||||
return (!::IsEqualIID(iid, GUID_NULL));
|
||||
}
|
||||
|
||||
void CControlEventSink::UnsubscribeFromEvents()
|
||||
{
|
||||
if (m_spEventCP)
|
||||
{
|
||||
// Unsubscribe and reset
|
||||
m_spEventCP->Unadvise(m_dwEventCookie);
|
||||
m_dwEventCookie = 0;
|
||||
m_spEventCP.Release();
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CControlEventSink::SubscribeToEvents(IUnknown *pControl)
|
||||
{
|
||||
if (!pControl)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Throw away any existing connections
|
||||
UnsubscribeFromEvents();
|
||||
|
||||
// Grab the outgoing event sink IID which will be used to subscribe
|
||||
// to events via the connection point container.
|
||||
|
||||
IID iidEventSink;
|
||||
CComPtr<ITypeInfo> typeInfo;
|
||||
if (!GetEventSinkIID(pControl, iidEventSink, &typeInfo))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Get the connection point
|
||||
CComQIPtr<IConnectionPointContainer> ccp = pControl;
|
||||
CComPtr<IConnectionPoint> cp;
|
||||
if (!ccp)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Custom IID
|
||||
m_EventIID = iidEventSink;
|
||||
DWORD dwCookie = 0;
|
||||
if (!ccp ||
|
||||
FAILED(ccp->FindConnectionPoint(m_EventIID, &cp)) ||
|
||||
FAILED(cp->Advise(this, &m_dwEventCookie)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_spEventCP = cp;
|
||||
m_dwEventCookie = dwCookie;
|
||||
m_spEventSinkTypeInfo = typeInfo;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
CControlEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
// Override me!
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// IDispatch implementation
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CControlEventSink::GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CControlEventSink::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)
|
||||
{
|
||||
return InternalInvoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
}
|
||||
|
||||
|
93
embedding/browser/activex/src/common/ControlEventSink.h
Normal file
93
embedding/browser/activex/src/common/ControlEventSink.h
Normal file
@ -0,0 +1,93 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef CONTROLEVENTSINK_H
|
||||
#define CONTROLEVENTSINK_H
|
||||
|
||||
// This class listens for events from the specified control
|
||||
|
||||
class CControlEventSink :
|
||||
public CComObjectRootEx<CComSingleThreadModel>,
|
||||
public IDispatch
|
||||
{
|
||||
public:
|
||||
CControlEventSink();
|
||||
|
||||
// Current event connection point
|
||||
CComPtr<IConnectionPoint> m_spEventCP;
|
||||
CComPtr<ITypeInfo> m_spEventSinkTypeInfo;
|
||||
DWORD m_dwEventCookie;
|
||||
IID m_EventIID;
|
||||
|
||||
protected:
|
||||
virtual ~CControlEventSink();
|
||||
|
||||
static HRESULT WINAPI SinkQI(void* pv, REFIID riid, LPVOID* ppv, DWORD dw)
|
||||
{
|
||||
CControlEventSink *pThis = (CControlEventSink *) pv;
|
||||
if (!IsEqualIID(pThis->m_EventIID, GUID_NULL) &&
|
||||
IsEqualIID(pThis->m_EventIID, riid))
|
||||
{
|
||||
return pThis->QueryInterface(__uuidof(IDispatch), ppv);
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
BEGIN_COM_MAP(CControlEventSink)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY_FUNC_BLIND(0, SinkQI)
|
||||
END_COM_MAP()
|
||||
|
||||
virtual HRESULT SubscribeToEvents(IUnknown *pControl);
|
||||
virtual void UnsubscribeFromEvents();
|
||||
virtual BOOL GetEventSinkIID(IUnknown *pControl, IID &iid, ITypeInfo **typeInfo);
|
||||
virtual HRESULT InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
||||
|
||||
// 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);
|
||||
};
|
||||
|
||||
typedef CComObject<CControlEventSink> CControlEventSinkInstance;
|
||||
|
||||
#endif
|
1420
embedding/browser/activex/src/common/ControlSite.cpp
Normal file
1420
embedding/browser/activex/src/common/ControlSite.cpp
Normal file
File diff suppressed because it is too large
Load Diff
394
embedding/browser/activex/src/common/ControlSite.h
Normal file
394
embedding/browser/activex/src/common/ControlSite.h
Normal file
@ -0,0 +1,394 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef CONTROLSITE_H
|
||||
#define CONTROLSITE_H
|
||||
|
||||
#include "IOleCommandTargetImpl.h"
|
||||
|
||||
#include "PropertyList.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(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) \
|
||||
COM_INTERFACE_ENTRY(IServiceProvider) \
|
||||
COM_INTERFACE_ENTRY(IBindStatusCallback) \
|
||||
COM_INTERFACE_ENTRY(IWindowForBindingUI)
|
||||
|
||||
// Temoporarily removed by bug 200680. Stops controls misbehaving and calling
|
||||
// windowless methods when they shouldn't.
|
||||
// COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteWindowless, IOleInPlaceSiteWindowless) \
|
||||
|
||||
|
||||
// Class that defines the control's security policy with regards to
|
||||
// what controls it hosts etc.
|
||||
|
||||
class CControlSiteSecurityPolicy
|
||||
{
|
||||
public:
|
||||
// Test if the class is safe to host
|
||||
virtual BOOL IsClassSafeToHost(const CLSID & clsid) = 0;
|
||||
// Test if the specified class is marked safe for scripting
|
||||
virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) = 0;
|
||||
// Test if the instantiated object is safe for scripting on the specified interface
|
||||
virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// 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 CControlSiteSecurityPolicy,
|
||||
public IOleClientSite,
|
||||
public IOleInPlaceSiteWindowless,
|
||||
public IOleControlSite,
|
||||
public IAdviseSinkEx,
|
||||
public IDispatch,
|
||||
public IServiceProvider,
|
||||
public IOleCommandTargetImpl<CControlSite>,
|
||||
public IBindStatusCallback,
|
||||
public IWindowForBindingUI
|
||||
{
|
||||
public:
|
||||
// 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 (after being created)
|
||||
unsigned m_bWindowless:1;
|
||||
// Flag indicating if only safely scriptable controls are allowed
|
||||
unsigned m_bSafeForScriptingObjectsOnly:1;
|
||||
// Pointer to an externally registered service provider
|
||||
CComPtr<IServiceProvider> m_spServiceProvider;
|
||||
// Pointer to the OLE container
|
||||
CComPtr<IOleContainer> m_spContainer;
|
||||
// Return the default security policy object
|
||||
static CControlSiteSecurityPolicy *GetDefaultControlSecurityPolicy();
|
||||
|
||||
protected:
|
||||
// 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;
|
||||
// CLSID of the control
|
||||
CLSID m_CLSID;
|
||||
// Parameter list
|
||||
PropertyList m_ParameterList;
|
||||
// Pointer to the security policy
|
||||
CControlSiteSecurityPolicy *m_pSecurityPolicy;
|
||||
|
||||
// Binding variables
|
||||
// Flag indicating whether binding is in progress
|
||||
unsigned m_bBindingInProgress;
|
||||
// Result from the binding operation
|
||||
HRESULT m_hrBindResult;
|
||||
|
||||
// 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:1;
|
||||
// Flag indicating if control should have grab handles
|
||||
bool m_bAmbientShowGrabHandles:1;
|
||||
// Flag indicating if control is in edit/user mode
|
||||
bool m_bAmbientUserMode:1;
|
||||
// Flag indicating if control has a 3d border or not
|
||||
bool m_bAmbientAppearance:1;
|
||||
|
||||
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()
|
||||
|
||||
// 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(),
|
||||
LPCWSTR szCodebase = NULL, IBindCtx *pBindContext = NULL);
|
||||
// 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);
|
||||
// Register an external service provider object
|
||||
virtual void SetServiceProvider(IServiceProvider *pSP)
|
||||
{
|
||||
m_spServiceProvider = pSP;
|
||||
}
|
||||
virtual void SetContainer(IOleContainer *pContainer)
|
||||
{
|
||||
m_spContainer = pContainer;
|
||||
}
|
||||
// Set the security policy object. Ownership of this object remains with the caller and the security
|
||||
// policy object is meant to exist for as long as it is set here.
|
||||
virtual void SetSecurityPolicy(CControlSiteSecurityPolicy *pSecurityPolicy)
|
||||
{
|
||||
m_pSecurityPolicy = pSecurityPolicy;
|
||||
}
|
||||
virtual CControlSiteSecurityPolicy *GetSecurityPolicy() const
|
||||
{
|
||||
return m_pSecurityPolicy;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
// CControlSiteSecurityPolicy
|
||||
// Test if the class is safe to host
|
||||
virtual BOOL IsClassSafeToHost(const CLSID & clsid);
|
||||
// Test if the specified class is marked safe for scripting
|
||||
virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists);
|
||||
// Test if the instantiated object is safe for scripting on the specified interface
|
||||
virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid);
|
||||
// Test if the instantiated object is safe for scripting on the specified interface
|
||||
virtual BOOL IsObjectSafeForScripting(const IID &iid);
|
||||
|
||||
// IServiceProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void** ppv);
|
||||
|
||||
// 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);
|
||||
|
||||
// IBindStatusCallback
|
||||
virtual HRESULT STDMETHODCALLTYPE OnStartBinding(/* [in] */ DWORD dwReserved, /* [in] */ IBinding __RPC_FAR *pib);
|
||||
virtual HRESULT STDMETHODCALLTYPE GetPriority(/* [out] */ LONG __RPC_FAR *pnPriority);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnLowResource(/* [in] */ DWORD reserved);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnProgress(/* [in] */ ULONG ulProgress, /* [in] */ ULONG ulProgressMax, /* [in] */ ULONG ulStatusCode, /* [in] */ LPCWSTR szStatusText);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnStopBinding(/* [in] */ HRESULT hresult, /* [unique][in] */ LPCWSTR szError);
|
||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetBindInfo( /* [out] */ DWORD __RPC_FAR *grfBINDF, /* [unique][out][in] */ BINDINFO __RPC_FAR *pbindinfo);
|
||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE OnDataAvailable(/* [in] */ DWORD grfBSCF, /* [in] */ DWORD dwSize, /* [in] */ FORMATETC __RPC_FAR *pformatetc, /* [in] */ STGMEDIUM __RPC_FAR *pstgmed);
|
||||
virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(/* [in] */ REFIID riid, /* [iid_is][in] */ IUnknown __RPC_FAR *punk);
|
||||
|
||||
// IWindowForBindingUI
|
||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(/* [in] */ REFGUID rguidReason, /* [out] */ HWND *phwnd);
|
||||
};
|
||||
|
||||
typedef CComObject<CControlSite> CControlSiteInstance;
|
||||
|
||||
|
||||
|
||||
#endif
|
136
embedding/browser/activex/src/common/ControlSiteIPFrame.cpp
Normal file
136
embedding/browser/activex/src/common/ControlSiteIPFrame.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ControlSiteIPFrame.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;
|
||||
}
|
||||
|
78
embedding/browser/activex/src/common/ControlSiteIPFrame.h
Normal file
78
embedding/browser/activex/src/common/ControlSiteIPFrame.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#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
|
761
embedding/browser/activex/src/common/IEHtmlElement.cpp
Normal file
761
embedding/browser/activex/src/common/IEHtmlElement.cpp
Normal file
@ -0,0 +1,761 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "IEHtmlElement.h"
|
||||
#include "IEHtmlElementCollection.h"
|
||||
#include "nsIDOMNSHTMLElement.h"
|
||||
|
||||
CIEHtmlElement::CIEHtmlElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CIEHtmlElement::~CIEHtmlElement()
|
||||
{
|
||||
}
|
||||
|
||||
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, FALSE, (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;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mDOMNode);
|
||||
if (!element)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Get the name from the BSTR
|
||||
USES_CONVERSION;
|
||||
nsAutoString name(OLE2W(strAttributeName));
|
||||
|
||||
// Get the value from the variant
|
||||
CComVariant vValue;
|
||||
if (FAILED(vValue.ChangeType(VT_BSTR, &AttributeValue)))
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Set the attribute
|
||||
nsAutoString value(OLE2W(vValue.bstrVal));
|
||||
element->SetAttribute(name, value);
|
||||
|
||||
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;
|
||||
nsAutoString name(OLE2W(strAttributeName));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mDOMNode);
|
||||
if (!element)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
BOOL bCaseSensitive = (lFlags == VARIANT_TRUE) ? TRUE : FALSE;
|
||||
|
||||
|
||||
// Get the attribute
|
||||
nsAutoString value;
|
||||
nsresult rv = element->GetAttribute(name, value);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
USES_CONVERSION;
|
||||
AttributeValue->vt = VT_BSTR;
|
||||
AttributeValue->bstrVal = SysAllocString(W2COLE(value.get()));
|
||||
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;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mDOMNode);
|
||||
if (!element)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
BOOL bCaseSensitive = (lFlags == VARIANT_TRUE) ? TRUE : FALSE;
|
||||
|
||||
// Get the name from the BSTR
|
||||
USES_CONVERSION;
|
||||
nsAutoString name(OLE2W(strAttributeName));
|
||||
|
||||
// Remove the attribute
|
||||
nsresult nr = element->RemoveAttribute(name);
|
||||
BOOL bRemoved = (nr == NS_OK) ? TRUE : FALSE;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mDOMNode);
|
||||
if (!element)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAutoString tagName;
|
||||
element->GetTagName(tagName);
|
||||
|
||||
USES_CONVERSION;
|
||||
*p = SysAllocString(W2COLE(tagName.get()));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_parentElement(IHTMLElement __RPC_FAR *__RPC_FAR *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*p = NULL;
|
||||
if (mParent)
|
||||
{
|
||||
IDispatch *pDisp = reinterpret_cast<IDispatch *>(mParent);
|
||||
pDisp->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)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> nodeAsHTMLElement = do_QueryInterface(mDOMNode);
|
||||
if (!nodeAsHTMLElement)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
PRInt32 nData;
|
||||
nodeAsHTMLElement->GetOffsetLeft(&nData);
|
||||
*p = nData;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetTop(long __RPC_FAR *p)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> nodeAsHTMLElement = do_QueryInterface(mDOMNode);
|
||||
if (!nodeAsHTMLElement)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
PRInt32 nData;
|
||||
nodeAsHTMLElement->GetOffsetTop(&nData);
|
||||
*p = nData;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetWidth(long __RPC_FAR *p)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> nodeAsHTMLElement = do_QueryInterface(mDOMNode);
|
||||
if (!nodeAsHTMLElement)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
PRInt32 nData;
|
||||
nodeAsHTMLElement->GetOffsetWidth(&nData);
|
||||
*p = nData;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetHeight(long __RPC_FAR *p)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> nodeAsHTMLElement = do_QueryInterface(mDOMNode);
|
||||
if (!nodeAsHTMLElement)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
PRInt32 nData;
|
||||
nodeAsHTMLElement->GetOffsetHeight(&nData);
|
||||
*p = nData;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_offsetParent(IHTMLElement __RPC_FAR *__RPC_FAR *p)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_innerHTML(BSTR v)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> elementHTML = do_QueryInterface(mDOMNode);
|
||||
if (!elementHTML)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
USES_CONVERSION;
|
||||
nsAutoString innerHTML(OLE2W(v));
|
||||
elementHTML->SetInnerHTML(innerHTML);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_innerHTML(BSTR __RPC_FAR *p)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> elementHTML = do_QueryInterface(mDOMNode);
|
||||
if (!elementHTML)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAutoString innerHTML;
|
||||
elementHTML->GetInnerHTML(innerHTML);
|
||||
|
||||
USES_CONVERSION;
|
||||
*p = SysAllocString(W2COLE(innerHTML.get()));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::put_innerText(BSTR v)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> elementHTML = do_QueryInterface(mDOMNode);
|
||||
if (!elementHTML)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
USES_CONVERSION;
|
||||
nsAutoString innerHTML(OLE2W(v));
|
||||
elementHTML->SetInnerHTML(innerHTML);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElement::get_innerText(BSTR __RPC_FAR *p)
|
||||
{
|
||||
return get_innerHTML(p);
|
||||
}
|
||||
|
||||
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, TRUE, (CIEHtmlElementCollection **) &pCollection);
|
||||
if (pCollection)
|
||||
{
|
||||
pCollection->AddRef();
|
||||
*p = pCollection;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
160
embedding/browser/activex/src/common/IEHtmlElement.h
Normal file
160
embedding/browser/activex/src/common/IEHtmlElement.h
Normal file
@ -0,0 +1,160 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#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 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
|
692
embedding/browser/activex/src/common/IEHtmlElementCollection.cpp
Normal file
692
embedding/browser/activex/src/common/IEHtmlElementCollection.cpp
Normal file
@ -0,0 +1,692 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "nsIDOMDocumentTraversal.h"
|
||||
#include "nsIDOMTreeWalker.h"
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHtmlElement.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "IEHtmlElement.h"
|
||||
#include "IEHtmlElementCollection.h"
|
||||
|
||||
CIEHtmlElementCollection::CIEHtmlElementCollection()
|
||||
{
|
||||
mNodeList = NULL;
|
||||
mNodeListCount = 0;
|
||||
mNodeListCapacity = 0;
|
||||
}
|
||||
|
||||
CIEHtmlElementCollection::~CIEHtmlElementCollection()
|
||||
{
|
||||
// Clean the node list
|
||||
if (mNodeList)
|
||||
{
|
||||
for (PRUint32 i = 0; i < mNodeListCount; i++)
|
||||
{
|
||||
IDispatch *pDisp = mNodeList[i];
|
||||
if (pDisp)
|
||||
{
|
||||
pDisp->Release();
|
||||
}
|
||||
}
|
||||
free(mNodeList);
|
||||
mNodeList = NULL;
|
||||
mNodeListCount = 0;
|
||||
mNodeListCapacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CIEHtmlElementCollection::PopulateFromDOMHTMLCollection(nsIDOMHTMLCollection *pNodeList)
|
||||
{
|
||||
if (pNodeList == nsnull)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Recurse through the children of the node (and the children of that)
|
||||
// to populate the collection
|
||||
|
||||
// Iterate through items in list
|
||||
PRUint32 length = 0;
|
||||
pNodeList->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++)
|
||||
{
|
||||
// Get the next item from the list
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
pNodeList->Item(i, getter_AddRefs(childNode));
|
||||
if (!childNode)
|
||||
{
|
||||
// Empty node (unexpected, but try and carry on anyway)
|
||||
NS_ASSERTION(0, "Empty node");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip nodes representing, text, attributes etc.
|
||||
PRUint16 nodeType;
|
||||
childNode->GetNodeType(&nodeType);
|
||||
if (nodeType != nsIDOMNode::ELEMENT_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create an equivalent IE element
|
||||
CIEHtmlNode *pHtmlNode = NULL;
|
||||
CIEHtmlElementInstance *pHtmlElement = NULL;
|
||||
CIEHtmlElementInstance::FindFromDOMNode(childNode, &pHtmlNode);
|
||||
if (!pHtmlNode)
|
||||
{
|
||||
CIEHtmlElementInstance::CreateInstance(&pHtmlElement);
|
||||
if (!pHtmlElement)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create element");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
pHtmlElement->SetDOMNode(childNode);
|
||||
pHtmlElement->SetParent(mParent);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHtmlElement = (CIEHtmlElementInstance *) pHtmlNode;
|
||||
}
|
||||
if (pHtmlElement)
|
||||
{
|
||||
AddNode(pHtmlElement);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CIEHtmlElementCollection::PopulateFromDOMNode(nsIDOMNode *aDOMNode, BOOL bRecurseChildren)
|
||||
{
|
||||
if (aDOMNode == nsnull)
|
||||
{
|
||||
NS_ASSERTION(0, "No dom node");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
PRBool hasChildNodes = PR_FALSE;
|
||||
aDOMNode->HasChildNodes(&hasChildNodes);
|
||||
if (hasChildNodes)
|
||||
{
|
||||
if (bRecurseChildren)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Search through parent nodes, looking for the DOM document
|
||||
nsCOMPtr<nsIDOMNode> docAsNode = aDOMNode;
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aDOMNode);
|
||||
while (!doc) {
|
||||
docAsNode->GetParentNode(getter_AddRefs(docAsNode));
|
||||
if (!docAsNode)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
doc = do_QueryInterface(docAsNode);
|
||||
}
|
||||
|
||||
// Walk the DOM
|
||||
nsCOMPtr<nsIDOMDocumentTraversal> trav = do_QueryInterface(doc, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIDOMTreeWalker> walker;
|
||||
rv = trav->CreateTreeWalker(docAsNode,
|
||||
nsIDOMNodeFilter::SHOW_ELEMENT,
|
||||
nsnull, PR_TRUE, getter_AddRefs(walker));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
// We're not interested in the document node, so we always start
|
||||
// with the next one, walking through them all to make the collection
|
||||
nsCOMPtr<nsIDOMNode> currentNode;
|
||||
walker->NextNode(getter_AddRefs(currentNode));
|
||||
while (currentNode)
|
||||
{
|
||||
// Create an equivalent IE element
|
||||
CIEHtmlNode *pHtmlNode = NULL;
|
||||
CIEHtmlElementInstance *pHtmlElement = NULL;
|
||||
CIEHtmlElementInstance::FindFromDOMNode(currentNode, &pHtmlNode);
|
||||
if (!pHtmlNode)
|
||||
{
|
||||
CIEHtmlElementInstance::CreateInstance(&pHtmlElement);
|
||||
if (!pHtmlElement)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create element");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
pHtmlElement->SetDOMNode(currentNode);
|
||||
pHtmlElement->SetParent(mParent);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHtmlElement = (CIEHtmlElementInstance *) pHtmlNode;
|
||||
}
|
||||
if (pHtmlElement)
|
||||
{
|
||||
AddNode(pHtmlElement);
|
||||
}
|
||||
walker->NextNode(getter_AddRefs(currentNode));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
aDOMNode->GetChildNodes(getter_AddRefs(nodeList));
|
||||
mDOMNodeList = nodeList;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CIEHtmlElementCollection::CreateFromDOMHTMLCollection(CIEHtmlNode *pParentNode, nsIDOMHTMLCollection *pNodeList, CIEHtmlElementCollection **pInstance)
|
||||
{
|
||||
if (pInstance == NULL || pParentNode == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "No instance or parent node");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Get the DOM node from the parent node
|
||||
if (!pParentNode->mDOMNode)
|
||||
{
|
||||
NS_ASSERTION(0, "Parent has no DOM node");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pInstance = NULL;
|
||||
|
||||
// Create a collection object
|
||||
CIEHtmlElementCollectionInstance *pCollection = NULL;
|
||||
CIEHtmlElementCollectionInstance::CreateInstance(&pCollection);
|
||||
if (pCollection == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create collection");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
// Initialise and populate the collection
|
||||
pCollection->SetParent(pParentNode);
|
||||
pCollection->PopulateFromDOMHTMLCollection(pNodeList);
|
||||
|
||||
*pInstance = pCollection;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CIEHtmlElementCollection::CreateFromParentNode(CIEHtmlNode *pParentNode, BOOL bRecurseChildren, CIEHtmlElementCollection **pInstance)
|
||||
{
|
||||
if (pInstance == NULL || pParentNode == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "No instance or parent node");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Get the DOM node from the parent node
|
||||
if (!pParentNode->mDOMNode)
|
||||
{
|
||||
NS_ASSERTION(0, "Parent has no DOM node");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pInstance = NULL;
|
||||
|
||||
// Create a collection object
|
||||
CIEHtmlElementCollectionInstance *pCollection = NULL;
|
||||
CIEHtmlElementCollectionInstance::CreateInstance(&pCollection);
|
||||
if (pCollection == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create collection");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
// Initialise and populate the collection
|
||||
pCollection->SetParent(pParentNode);
|
||||
pCollection->PopulateFromDOMNode(pParentNode->mDOMNode, bRecurseChildren);
|
||||
|
||||
*pInstance = pCollection;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CIEHtmlElementCollection::AddNode(IDispatch *pNode)
|
||||
{
|
||||
if (pNode == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "No node");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
const PRUint32 c_NodeListResizeBy = 100;
|
||||
|
||||
if (mNodeList == NULL)
|
||||
{
|
||||
mNodeListCapacity = c_NodeListResizeBy;
|
||||
mNodeList = (IDispatch **) malloc(sizeof(IDispatch *) * mNodeListCapacity);
|
||||
mNodeListCount = 0;
|
||||
}
|
||||
else if (mNodeListCount == mNodeListCapacity)
|
||||
{
|
||||
mNodeListCapacity += c_NodeListResizeBy;
|
||||
mNodeList = (IDispatch **) realloc(mNodeList, sizeof(IDispatch *) * mNodeListCapacity);
|
||||
}
|
||||
|
||||
if (mNodeList == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not realloc node list");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
pNode->AddRef();
|
||||
mNodeList[mNodeListCount++] = 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
|
||||
if (mDOMNodeList)
|
||||
{
|
||||
// Count the number of elements in the list
|
||||
PRUint32 elementCount = 0;
|
||||
PRUint32 length = 0;
|
||||
mDOMNodeList->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++)
|
||||
{
|
||||
// Get the next item from the list
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
mDOMNodeList->Item(i, getter_AddRefs(childNode));
|
||||
if (!childNode)
|
||||
{
|
||||
// Empty node (unexpected, but try and carry on anyway)
|
||||
NS_ASSERTION(0, "Empty node");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only count elements
|
||||
PRUint16 nodeType;
|
||||
childNode->GetNodeType(&nodeType);
|
||||
if (nodeType == nsIDOMNode::ELEMENT_NODE)
|
||||
{
|
||||
elementCount++;
|
||||
}
|
||||
}
|
||||
*p = elementCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = mNodeListCount;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
typedef CComObject<CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > > CComEnumVARIANT;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CIEHtmlElementCollection::get__newEnum(IUnknown __RPC_FAR *__RPC_FAR *p)
|
||||
{
|
||||
TRACE_METHOD(CIEHtmlElementCollection::get__newEnum);
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*p = NULL;
|
||||
|
||||
// Create a new IEnumVARIANT object
|
||||
CComEnumVARIANT *pEnumVARIANT = NULL;
|
||||
CComEnumVARIANT::CreateInstance(&pEnumVARIANT);
|
||||
if (pEnumVARIANT == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not creat Enum");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int nObject = 0;
|
||||
long nObjects = 0;
|
||||
get_length(&nObjects);
|
||||
|
||||
// Create an array of VARIANTs
|
||||
VARIANT *avObjects = new VARIANT[nObjects];
|
||||
if (avObjects == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create variant array");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (mDOMNodeList)
|
||||
{
|
||||
// Fill the variant array with elements from the DOM node list
|
||||
PRUint32 length = 0;
|
||||
mDOMNodeList->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++)
|
||||
{
|
||||
// Get the next item from the list
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
mDOMNodeList->Item(i, getter_AddRefs(childNode));
|
||||
if (!childNode)
|
||||
{
|
||||
// Empty node (unexpected, but try and carry on anyway)
|
||||
NS_ASSERTION(0, "Could not get node");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip nodes representing, text, attributes etc.
|
||||
PRUint16 nodeType;
|
||||
childNode->GetNodeType(&nodeType);
|
||||
if (nodeType != nsIDOMNode::ELEMENT_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Store the element in the array
|
||||
CIEHtmlNode *pHtmlNode = NULL;
|
||||
CIEHtmlElementInstance *pHtmlElement = NULL;
|
||||
CIEHtmlElementInstance::FindFromDOMNode(childNode, &pHtmlNode);
|
||||
if (!pHtmlNode)
|
||||
{
|
||||
CIEHtmlElementInstance::CreateInstance(&pHtmlElement);
|
||||
if (!pHtmlElement)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create element");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
pHtmlElement->SetDOMNode(childNode);
|
||||
pHtmlElement->SetParent(mParent);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHtmlElement = (CIEHtmlElementInstance *) pHtmlNode;
|
||||
}
|
||||
|
||||
VARIANT *pVariant = &avObjects[nObject++];
|
||||
VariantInit(pVariant);
|
||||
pVariant->vt = VT_UNKNOWN;
|
||||
pHtmlElement->QueryInterface(IID_IUnknown, (void **) &pVariant->punkVal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the contents of the collection to the array
|
||||
for (nObject = 0; nObject < nObjects; nObject++)
|
||||
{
|
||||
VARIANT *pVariant = &avObjects[nObject];
|
||||
IUnknown *pUnkObject = mNodeList[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)
|
||||
{
|
||||
TRACE_METHOD(CIEHtmlElementCollection::item);
|
||||
|
||||
if (pdisp == NULL)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pdisp = NULL;
|
||||
|
||||
// Parameter name is either a string or a number
|
||||
|
||||
PRBool searchForName = PR_FALSE;
|
||||
nsAutoString nameToSearch;
|
||||
PRInt32 idxForSearch = 0;
|
||||
|
||||
if (name.vt == VT_BSTR && name.bstrVal && wcslen(name.bstrVal) > 0)
|
||||
{
|
||||
nameToSearch.Assign(name.bstrVal);
|
||||
searchForName = PR_TRUE;
|
||||
}
|
||||
else switch (name.vt)
|
||||
{
|
||||
case VT_UI1:
|
||||
case VT_UI2:
|
||||
case VT_UI4:
|
||||
case VT_I1:
|
||||
case VT_I2:
|
||||
// Coerce the variant into a long
|
||||
if (FAILED(VariantChangeType(&name, &name, 0, VT_I4)))
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
// Fall through
|
||||
case VT_I4:
|
||||
idxForSearch = name.lVal;
|
||||
if (idxForSearch < 0)
|
||||
return E_INVALIDARG;
|
||||
break;
|
||||
default:
|
||||
// Unknown arg.
|
||||
// As per documentation, no attempt to be lenient with crappy clients
|
||||
// for the time being.
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (mDOMNodeList)
|
||||
{
|
||||
// Search for the Nth element in the list
|
||||
PRUint32 elementCount = 0;
|
||||
PRUint32 length = 0;
|
||||
mDOMNodeList->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++)
|
||||
{
|
||||
// Get the next item from the list
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
mDOMNodeList->Item(i, getter_AddRefs(childNode));
|
||||
if (!childNode)
|
||||
{
|
||||
// Empty node (unexpected, but try and carry on anyway)
|
||||
NS_ASSERTION(0, "Could not get node");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip nodes representing, text, attributes etc.
|
||||
nsCOMPtr<nsIDOMElement> nodeAsElement = do_QueryInterface(childNode);
|
||||
if (!nodeAsElement)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Have we found the element we need?
|
||||
PRBool grabThisNode = PR_FALSE;
|
||||
if (searchForName)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLElement> nodeAsHtmlElement = do_QueryInterface(childNode);
|
||||
if (nodeAsHtmlElement)
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(nameAttr, "name");
|
||||
nsAutoString nodeName;
|
||||
nsAutoString nodeId;
|
||||
nodeAsHtmlElement->GetAttribute(nameAttr, nodeName);
|
||||
nodeAsHtmlElement->GetId(nodeId);
|
||||
if (nodeName.Equals(nameToSearch) || nodeId.Equals(nameToSearch))
|
||||
{
|
||||
grabThisNode = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (elementCount == idxForSearch)
|
||||
{
|
||||
grabThisNode = PR_TRUE;
|
||||
}
|
||||
|
||||
if (grabThisNode)
|
||||
{
|
||||
// TODO for named searches, we should create a collection here
|
||||
// if index > 0, or
|
||||
|
||||
// Return the element
|
||||
CIEHtmlNode *pHtmlNode = NULL;
|
||||
CIEHtmlElementInstance *pHtmlElement = NULL;
|
||||
CIEHtmlElementInstance::FindFromDOMNode(childNode, &pHtmlNode);
|
||||
if (!pHtmlNode)
|
||||
{
|
||||
CIEHtmlElementInstance::CreateInstance(&pHtmlElement);
|
||||
if (!pHtmlElement)
|
||||
{
|
||||
NS_ASSERTION(0, "Could not create element");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
pHtmlElement->SetDOMNode(childNode);
|
||||
pHtmlElement->SetParent(mParent);
|
||||
}
|
||||
else
|
||||
{
|
||||
pHtmlElement = (CIEHtmlElementInstance *) pHtmlNode;
|
||||
}
|
||||
|
||||
// TODO named searches should carry on searching
|
||||
pHtmlElement->QueryInterface(IID_IDispatch, (void **) pdisp);
|
||||
return S_OK;
|
||||
}
|
||||
elementCount++;
|
||||
}
|
||||
// Index must have been out of range
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (searchForName)
|
||||
{
|
||||
for (PRUint32 i = 0; i < mNodeListCount; i++)
|
||||
{
|
||||
CComQIPtr<IHTMLElement> element = mNodeList[i];
|
||||
if (element.p)
|
||||
{
|
||||
CComVariant elementName;
|
||||
CComBSTR elementId;
|
||||
element->get_id(&elementId);
|
||||
element->getAttribute(L"name", 0, &elementName);
|
||||
if ((elementId && wcscmp(elementId, name.bstrVal) == 0) ||
|
||||
(elementName.vt == VT_BSTR && elementName.bstrVal &&
|
||||
wcscmp(elementName.bstrVal, name.bstrVal) == 0))
|
||||
{
|
||||
element->QueryInterface(IID_IDispatch, (void **) pdisp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Test for stupid values
|
||||
if (idxForSearch >= mNodeListCount)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pdisp = NULL;
|
||||
IDispatch *pNode = mNodeList[idxForSearch];
|
||||
if (pNode == NULL)
|
||||
{
|
||||
NS_ASSERTION(0, "No node");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
pNode->QueryInterface(IID_IDispatch, (void **) pdisp);
|
||||
}
|
||||
}
|
||||
|
||||
// Note: As per docs S_OK is fine even if no node is returned
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
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,99 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef IEHTMLNODECOLLECTION_H
|
||||
#define IEHTMLNODECOLLECTION_H
|
||||
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
|
||||
#include "IEHtmlNode.h"
|
||||
|
||||
class CIEHtmlElement;
|
||||
|
||||
class CIEHtmlElementCollection :
|
||||
public CIEHtmlNode,
|
||||
public IDispatchImpl<IHTMLElementCollection, &IID_IHTMLElementCollection, &LIBID_MSHTML>
|
||||
{
|
||||
private:
|
||||
// Hold a DOM node list
|
||||
nsCOMPtr<nsIDOMNodeList> mDOMNodeList;
|
||||
// Or hold a static collection
|
||||
IDispatch **mNodeList;
|
||||
PRUint32 mNodeListCount;
|
||||
PRUint32 mNodeListCapacity;
|
||||
|
||||
public:
|
||||
CIEHtmlElementCollection();
|
||||
|
||||
protected:
|
||||
virtual ~CIEHtmlElementCollection();
|
||||
|
||||
public:
|
||||
// Adds a node to the collection
|
||||
virtual HRESULT AddNode(IDispatch *pNode);
|
||||
|
||||
virtual HRESULT PopulateFromDOMHTMLCollection(nsIDOMHTMLCollection *pNodeList);
|
||||
|
||||
// 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, BOOL bRecurseChildren, CIEHtmlElementCollection **pInstance);
|
||||
|
||||
// Helper method creates a collection from the specified HTML collection
|
||||
static HRESULT CreateFromDOMHTMLCollection(CIEHtmlNode *pParentNode, nsIDOMHTMLCollection *pNodeList, CIEHtmlElementCollection **pInstance);
|
||||
|
||||
|
||||
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
|
125
embedding/browser/activex/src/common/IEHtmlNode.cpp
Normal file
125
embedding/browser/activex/src/common/IEHtmlNode.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "IEHtmlNode.h"
|
||||
|
||||
#include "plhash.h"
|
||||
|
||||
static PLHashTable *g_NodeLookupTable;
|
||||
|
||||
static PLHashNumber PR_CALLBACK HashFunction(const void *key)
|
||||
{
|
||||
return (PRUint32) key;
|
||||
}
|
||||
|
||||
PRIntn PR_CALLBACK HashComparator(const void *v1, const void *v2)
|
||||
{
|
||||
if (v1 == v2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
CIEHtmlNode::CIEHtmlNode() :
|
||||
mParent(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CIEHtmlNode::~CIEHtmlNode()
|
||||
{
|
||||
SetDOMNode(nsnull);
|
||||
}
|
||||
|
||||
|
||||
HRESULT CIEHtmlNode::SetParent(CIEHtmlNode *pParent)
|
||||
{
|
||||
mParent = pParent;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CIEHtmlNode::FindFromDOMNode(nsIDOMNode *pIDOMNode, CIEHtmlNode **pHtmlNode)
|
||||
{
|
||||
if (pIDOMNode == nsnull)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (g_NodeLookupTable == NULL)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> nodeAsSupports = do_QueryInterface(pIDOMNode);
|
||||
*pHtmlNode = (CIEHtmlNode *) PL_HashTableLookup(g_NodeLookupTable, nodeAsSupports);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CIEHtmlNode::SetDOMNode(nsIDOMNode *pIDOMNode)
|
||||
{
|
||||
if (pIDOMNode)
|
||||
{
|
||||
if (g_NodeLookupTable == NULL)
|
||||
{
|
||||
g_NodeLookupTable = PL_NewHashTable(123, HashFunction, HashComparator, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
mDOMNode = pIDOMNode;
|
||||
nsCOMPtr<nsISupports> nodeAsSupports= do_QueryInterface(mDOMNode);
|
||||
PL_HashTableAdd(g_NodeLookupTable, nodeAsSupports, this);
|
||||
}
|
||||
else if (mDOMNode)
|
||||
{
|
||||
// Remove the entry from the hashtable
|
||||
nsCOMPtr<nsISupports> nodeAsSupports = do_QueryInterface(mDOMNode);
|
||||
PL_HashTableRemove(g_NodeLookupTable, nodeAsSupports);
|
||||
mDOMNode = nsnull;
|
||||
|
||||
if (g_NodeLookupTable->nentries == 0)
|
||||
{
|
||||
PL_HashTableDestroy(g_NodeLookupTable);
|
||||
g_NodeLookupTable = NULL;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
64
embedding/browser/activex/src/common/IEHtmlNode.h
Normal file
64
embedding/browser/activex/src/common/IEHtmlNode.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef IEHTMLNODE_H
|
||||
#define IEHTMLNODE_H
|
||||
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
class CIEHtmlNode :
|
||||
public CComObjectRootEx<CComMultiThreadModel>
|
||||
{
|
||||
protected:
|
||||
CIEHtmlNode();
|
||||
virtual ~CIEHtmlNode();
|
||||
|
||||
public:
|
||||
CIEHtmlNode *mParent;
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
|
||||
static HRESULT FindFromDOMNode(nsIDOMNode *pIDOMNode, CIEHtmlNode **pHtmlNode);
|
||||
virtual HRESULT SetParent(CIEHtmlNode *mParent);
|
||||
virtual HRESULT SetDOMNode(nsIDOMNode *pIDOMNode);
|
||||
};
|
||||
|
||||
typedef CComObject<CIEHtmlNode> CIEHtmlNodeInstance;
|
||||
|
||||
#endif
|
187
embedding/browser/activex/src/common/IHTMLLocationImpl.h
Normal file
187
embedding/browser/activex/src/common/IHTMLLocationImpl.h
Normal file
@ -0,0 +1,187 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef IHTMLLOCATIONIMPL_H
|
||||
#define IHTMLLOCATIONIMPL_H
|
||||
|
||||
#include "nsIDOMLocation.h"
|
||||
|
||||
#define IHTMLLOCATION_GET_IMPL(prop) \
|
||||
if (!p) return E_INVALIDARG; \
|
||||
nsCOMPtr<nsIDOMLocation> location; \
|
||||
if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location) \
|
||||
return E_UNEXPECTED; \
|
||||
nsAutoString value; \
|
||||
NS_ENSURE_SUCCESS(location->Get ## prop(value), E_UNEXPECTED); \
|
||||
*p = ::SysAllocString(value.get()); \
|
||||
return (*p) ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
#define IHTMLLOCATION_PUT_IMPL(prop) \
|
||||
return E_NOTIMPL; // For now
|
||||
|
||||
template<class T>
|
||||
class IHTMLLocationImpl :
|
||||
public IDispatchImpl<IHTMLLocation, &__uuidof(IHTMLLocation), &LIBID_MSHTML>
|
||||
{
|
||||
protected:
|
||||
// Methods to be implemented by the derived class
|
||||
virtual nsresult GetDOMLocation(nsIDOMLocation **aLocation) = 0;
|
||||
public:
|
||||
|
||||
// IHTMLLocation
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_href(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Href);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_href(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Href);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_protocol(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Protocol);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_protocol(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Protocol);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_host(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Host);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_host(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Host);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_hostname(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Hostname);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hostname(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Hostname);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_port(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Port);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_port(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Port);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_pathname(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Pathname);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_pathname(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Pathname);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_search(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Search);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_search(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Search);
|
||||
}
|
||||
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_hash(
|
||||
/* [in] */ BSTR v)
|
||||
{
|
||||
IHTMLLOCATION_PUT_IMPL(Hash);
|
||||
}
|
||||
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hash(
|
||||
/* [out][retval] */ BSTR *p)
|
||||
{
|
||||
IHTMLLOCATION_GET_IMPL(Hash);
|
||||
}
|
||||
virtual /* [id] */ HRESULT STDMETHODCALLTYPE reload(
|
||||
/* [in][defaultvalue] */ VARIANT_BOOL flag)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLocation> location;
|
||||
if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location)
|
||||
return E_UNEXPECTED;
|
||||
return NS_SUCCEEDED(location->Reload(flag)) ? S_OK : E_FAIL;
|
||||
}
|
||||
virtual /* [id] */ HRESULT STDMETHODCALLTYPE replace(
|
||||
/* [in] */ BSTR bstr)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLocation> location;
|
||||
if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location)
|
||||
return E_UNEXPECTED;
|
||||
nsAutoString value(bstr);
|
||||
return NS_SUCCEEDED(location->Replace(value)) ? S_OK : E_FAIL;
|
||||
}
|
||||
virtual /* [id] */ HRESULT STDMETHODCALLTYPE assign(
|
||||
/* [in] */ BSTR bstr)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLocation> location;
|
||||
if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location)
|
||||
return E_UNEXPECTED;
|
||||
nsAutoString value(bstr);
|
||||
return NS_SUCCEEDED(location->Assign(value)) ? S_OK : E_FAIL;
|
||||
}
|
||||
virtual /* [id] */ HRESULT STDMETHODCALLTYPE toString(
|
||||
/* [out][retval] */ BSTR *string)
|
||||
{
|
||||
if (!string) return E_INVALIDARG;
|
||||
nsCOMPtr<nsIDOMLocation> location;
|
||||
if (NS_FAILED(GetDOMLocation(getter_AddRefs(location))) || !location)
|
||||
return E_UNEXPECTED;
|
||||
nsAutoString value;
|
||||
NS_ENSURE_SUCCESS(location->ToString(value), E_UNEXPECTED);
|
||||
*string = ::SysAllocString(value.get());
|
||||
return (*string) ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
289
embedding/browser/activex/src/common/IOleCommandTargetImpl.h
Normal file
289
embedding/browser/activex/src/common/IOleCommandTargetImpl.h
Normal file
@ -0,0 +1,289 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#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();
|
||||
ATLASSERT(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
|
||||
size_t 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();
|
||||
ATLASSERT(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 &&
|
||||
!(nCmdexecopt & OLECMDEXECOPT_SHOWHELP))
|
||||
{
|
||||
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
|
1172
embedding/browser/activex/src/common/IWebBrowserImpl.h
Normal file
1172
embedding/browser/activex/src/common/IWebBrowserImpl.h
Normal file
File diff suppressed because it is too large
Load Diff
138
embedding/browser/activex/src/common/ItemContainer.cpp
Normal file
138
embedding/browser/activex/src/common/ItemContainer.cpp
Normal file
@ -0,0 +1,138 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ItemContainer.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;
|
||||
}
|
78
embedding/browser/activex/src/common/ItemContainer.h
Normal file
78
embedding/browser/activex/src/common/ItemContainer.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef ITEMCONTAINER_H
|
||||
#define ITEMCONTAINER_H
|
||||
|
||||
// typedef std::map<tstring, CIUnkPtr> CNamedObjectList;
|
||||
|
||||
// Class for managing a list of named objects.
|
||||
|
||||
class CItemContainer : public CComObjectRootEx<CComSingleThreadModel>,
|
||||
public IOleItemContainer
|
||||
{
|
||||
// CNamedObjectList m_cNamedObjectList;
|
||||
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
|
76
embedding/browser/activex/src/common/Makefile.in
Normal file
76
embedding/browser/activex/src/common/Makefile.in
Normal file
@ -0,0 +1,76 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
# 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 the Mozilla browser.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Christopher
|
||||
# Blizzard. Portions created by Christopher Blizzard
|
||||
# Copyright (C) 1999, Christopher Blizzard. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
MODULE = ax_common
|
||||
LIBRARY_NAME = ax_common_s
|
||||
XPIDL_MODULE = ax_common
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
dom \
|
||||
js \
|
||||
widget \
|
||||
gfx \
|
||||
layout \
|
||||
content \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
IEHtmlNode.cpp \
|
||||
IEHtmlElement.cpp \
|
||||
IEHtmlElementCollection.cpp \
|
||||
ControlSite.cpp \
|
||||
ControlSiteIPFrame.cpp \
|
||||
ControlEventSink.cpp \
|
||||
PropertyBag.cpp \
|
||||
ItemContainer.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
IEHtmlNode.h \
|
||||
IEHtmlElement.h \
|
||||
IEHtmlElementCollection.h \
|
||||
ControlSite.h \
|
||||
ControlSiteIPFrame.h \
|
||||
ControlEventSink.h \
|
||||
PropertyList.h \
|
||||
PropertyBag.h \
|
||||
ItemContainer.h \
|
||||
IOleCommandTargetImpl.h \
|
||||
IWebBrowserImpl.h \
|
||||
IHTMLLocationImpl.h \
|
||||
CPMozillaControl.h
|
||||
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += -GX
|
115
embedding/browser/activex/src/common/PropertyBag.cpp
Normal file
115
embedding/browser/activex/src/common/PropertyBag.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
VARTYPE vt = pVar->vt;
|
||||
VariantInit(pVar);
|
||||
|
||||
for (unsigned long i = 0; i < m_PropertyList.GetSize(); i++)
|
||||
{
|
||||
if (wcsicmp(m_PropertyList.GetNameOf(i), pszPropName) == 0)
|
||||
{
|
||||
const VARIANT *pvSrc = m_PropertyList.GetValueOf(i);
|
||||
if (!pvSrc)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
CComVariant vNew;
|
||||
HRESULT hr = (vt == VT_EMPTY) ?
|
||||
vNew.Copy(pvSrc) : vNew.ChangeType(vt, pvSrc);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
// Copy the new value
|
||||
vNew.Detach(pVar);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Property does not exist in the bag
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CPropertyBag::Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar)
|
||||
{
|
||||
if (pszPropName == NULL)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (pVar == NULL)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
CComBSTR bstrName(pszPropName);
|
||||
m_PropertyList.AddOrReplaceNamedProperty(bstrName, *pVar);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
69
embedding/browser/activex/src/common/PropertyBag.h
Normal file
69
embedding/browser/activex/src/common/PropertyBag.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef PROPERTYBAG_H
|
||||
#define PROPERTYBAG_H
|
||||
|
||||
#include "PropertyList.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
|
158
embedding/browser/activex/src/common/PropertyList.h
Normal file
158
embedding/browser/activex/src/common/PropertyList.h
Normal file
@ -0,0 +1,158 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef PROPERTYLIST_H
|
||||
#define PROPERTYLIST_H
|
||||
|
||||
// A simple array class for managing name/value pairs typically fed to controls
|
||||
// during initialization by IPersistPropertyBag
|
||||
|
||||
class PropertyList
|
||||
{
|
||||
struct Property {
|
||||
BSTR bstrName;
|
||||
VARIANT vValue;
|
||||
} *mProperties;
|
||||
unsigned long mListSize;
|
||||
unsigned long mMaxListSize;
|
||||
|
||||
bool EnsureMoreSpace()
|
||||
{
|
||||
// Ensure enough space exists to accomodate a new item
|
||||
const unsigned long kGrowBy = 10;
|
||||
if (!mProperties)
|
||||
{
|
||||
mProperties = (Property *) malloc(sizeof(Property) * kGrowBy);
|
||||
if (!mProperties)
|
||||
return false;
|
||||
mMaxListSize = kGrowBy;
|
||||
}
|
||||
else if (mListSize == mMaxListSize)
|
||||
{
|
||||
Property *pNewProperties;
|
||||
pNewProperties = (Property *) realloc(mProperties, sizeof(Property) * (mMaxListSize + kGrowBy));
|
||||
if (!pNewProperties)
|
||||
return false;
|
||||
mProperties = pNewProperties;
|
||||
mMaxListSize += kGrowBy;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
PropertyList() :
|
||||
mProperties(NULL),
|
||||
mListSize(0),
|
||||
mMaxListSize(0)
|
||||
{
|
||||
}
|
||||
~PropertyList()
|
||||
{
|
||||
}
|
||||
void Clear()
|
||||
{
|
||||
if (mProperties)
|
||||
{
|
||||
for (unsigned long i = 0; i < mListSize; i++)
|
||||
{
|
||||
SysFreeString(mProperties[i].bstrName); // Safe even if NULL
|
||||
VariantClear(&mProperties[i].vValue);
|
||||
}
|
||||
free(mProperties);
|
||||
mProperties = NULL;
|
||||
}
|
||||
mListSize = 0;
|
||||
mMaxListSize = 0;
|
||||
}
|
||||
unsigned long GetSize() const
|
||||
{
|
||||
return mListSize;
|
||||
}
|
||||
const BSTR GetNameOf(unsigned long nIndex) const
|
||||
{
|
||||
if (nIndex > mListSize)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return mProperties[nIndex].bstrName;
|
||||
}
|
||||
const VARIANT *GetValueOf(unsigned long nIndex) const
|
||||
{
|
||||
if (nIndex > mListSize)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &mProperties[nIndex].vValue;
|
||||
}
|
||||
bool AddOrReplaceNamedProperty(const BSTR bstrName, const VARIANT &vValue)
|
||||
{
|
||||
if (!bstrName)
|
||||
return false;
|
||||
for (unsigned long i = 0; i < GetSize(); i++)
|
||||
{
|
||||
// Case insensitive
|
||||
if (wcsicmp(mProperties[i].bstrName, bstrName) == 0)
|
||||
{
|
||||
return SUCCEEDED(
|
||||
VariantCopy(&mProperties[i].vValue, const_cast<VARIANT *>(&vValue)));
|
||||
}
|
||||
}
|
||||
return AddNamedProperty(bstrName, vValue);
|
||||
}
|
||||
bool AddNamedProperty(const BSTR bstrName, const VARIANT &vValue)
|
||||
{
|
||||
if (!bstrName || !EnsureMoreSpace())
|
||||
return false;
|
||||
Property *pProp = &mProperties[mListSize];
|
||||
pProp->bstrName = ::SysAllocString(bstrName);
|
||||
if (!pProp->bstrName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
VariantInit(&pProp->vValue);
|
||||
if (FAILED(VariantCopy(&pProp->vValue, const_cast<VARIANT *>(&vValue))))
|
||||
{
|
||||
SysFreeString(pProp->bstrName);
|
||||
return false;
|
||||
}
|
||||
mListSize++;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
117
embedding/browser/activex/src/common/StdAfx.h
Normal file
117
embedding/browser/activex/src/common/StdAfx.h
Normal file
@ -0,0 +1,117 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Adam Lock <adamlock@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// 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
|
||||
|
||||
// under MSVC shut off copious warnings about debug symbol too long
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable: 4786 )
|
||||
#endif
|
||||
|
||||
#include "jstypes.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
// Mozilla headers
|
||||
|
||||
#include "jscompat.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "prprf.h"
|
||||
#include "plevent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
#define _ATL_STATIC_REGISTRY
|
||||
// #define _ATL_DEBUG_INTERFACES
|
||||
|
||||
// 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>
|
||||
|
||||
// New winsock2.h doesn't define this anymore
|
||||
typedef long int32;
|
||||
|
||||
// Turn off warnings about debug symbols for templates being too long
|
||||
#pragma warning(disable : 4786)
|
||||
|
||||
#define TRACE_METHOD(fn) \
|
||||
{ \
|
||||
ATLTRACE(_T("0x%04x %s()\n"), (int) GetCurrentThreadId(), _T(#fn)); \
|
||||
}
|
||||
#define TRACE_METHOD_ARGS(fn, pattern, args) \
|
||||
{ \
|
||||
ATLTRACE(_T("0x%04x %s(") _T(pattern) _T(")\n"), (int) GetCurrentThreadId(), _T(#fn), args); \
|
||||
}
|
||||
|
||||
//{{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)
|
Loading…
Reference in New Issue
Block a user