put unicode mods back in

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-07-11 17:55:47 +00:00
parent 83a732882a
commit 811712d820
3 changed files with 92 additions and 72 deletions

View File

@ -35,23 +35,23 @@ private:
public:
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
~FS_DWebBrowserEvents2()
~FS_DWebBrowserEvents2()
{
}
//IDispatch
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
{
{
return E_NOTIMPL;
};
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
{
{
return E_NOTIMPL;
};
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
{
{
return E_NOTIMPL;
};
@ -114,7 +114,7 @@ public:
WORD wFlags, DISPPARAMS * pDispParams,
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
unsigned int * puArgErr)
{
{
if (wFlags & DISPATCH_PROPERTYGET)
return E_NOTIMPL;
@ -123,21 +123,21 @@ public:
case DISPID_BEFORENAVIGATE2:
if (Process(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, STR_ARG(5)))
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
else
else
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
break;
case DISPID_NEWWINDOW2:
if (Process(wxEVT_COMMAND_MSHTML_NEWWINDOW2))
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
else
else
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
break;
case DISPID_PROGRESSCHANGE:
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, "", LONG_ARG(1), LONG_ARG(0));
break;
case DISPID_DOCUMENTCOMPLETE:
Post(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, STR_ARG(0));
break;
@ -181,7 +181,7 @@ wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name) :
const wxString& name) :
wxActiveX(parent, PROGID, id, pos, size, style, name)
{
SetupBrowser();
@ -242,7 +242,7 @@ void wxIEHtmlWin::SetCharset(wxString charset)
{
wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
if (doc.Ok())
doc->put_charset((BSTR) wxConvUTF8.cMB2WC(charset).data());
doc->put_charset((BSTR) (const wchar_t*)charset.wc_str(wxConvUTF8));
};
};
@ -284,12 +284,12 @@ private:
istream *m_is;
public:
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
{
wxASSERT(m_is != NULL);
}
~IStreamAdaptor()
~IStreamAdaptor()
{
delete m_is;
}
@ -309,7 +309,7 @@ public:
void wxIEHtmlWin::LoadUrl(const wxString& url)
{
VARIANTARG navFlag, targetFrame, postData, headers;
navFlag.vt = VT_EMPTY;
navFlag.vt = VT_EMPTY;
navFlag.vt = VT_I2;
navFlag.iVal = navNoReadFromCache;
targetFrame.vt = VT_EMPTY;
@ -317,14 +317,14 @@ void wxIEHtmlWin::LoadUrl(const wxString& url)
headers.vt = VT_EMPTY;
HRESULT hret = 0;
hret = m_webBrowser->Navigate((BSTR) wxConvUTF8.cMB2WC(url).data(),
&navFlag, &targetFrame, &postData, &headers);
hret = m_webBrowser->Navigate((BSTR) (const wchar_t*)url.wc_str(wxConvUTF8),
&navFlag, &targetFrame, &postData, &headers);
};
bool wxIEHtmlWin::LoadString(wxString html)
{
string s = html.c_str();
string s = html.mb_str(wxConvUTF8);
istringstream *is = new istringstream(s);
return LoadStream(is);
};
@ -466,7 +466,7 @@ wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
BSTR text = NULL;
HRESULT hr = E_FAIL;
if (asHTML)
hr = tr->get_htmlText(&text);
else
@ -508,7 +508,7 @@ wxString wxIEHtmlWin::GetText(bool asHTML)
// get inner text
BSTR text = NULL;
hr = E_FAIL;
if (asHTML)
hr = body->get_innerHTML(&text);
else
@ -519,5 +519,5 @@ wxString wxIEHtmlWin::GetText(bool asHTML)
wxString s = text;
SysFreeString(text);
return s;
};
return s;
};

View File

@ -30,7 +30,14 @@ Source Files:
Event Handling:
---------------
- None currently
- EVT_ACTIVEX(id, eventName, handler) (handler = void OnActiveX(wxActiveXEvent& event))
class wxActiveXEvent : public wxNotifyEvent
int ParamCount() const;
wxVariant operator[] (int idx) const; // parameter by index
wxVariant& operator[] (int idx);
wxVariant operator[] (wxString name) const; // named parameters
wxVariant& operator[] (wxString name);
Members:
--------
@ -60,6 +67,19 @@ e.g.
delete events;
Sample Events:
--------------
EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
void wxIEFrame::OnMSHTMLBeforeNavigate2X(wxActiveXEvent& event)
{
wxString url = event["Url"];
int rc = wxMessageBox(url, "Allow open url ?", wxYES_NO);
if (rc != wxYES)
event["Cancel"] = true;
};
wxIEHtmlWin:

View File

@ -31,7 +31,7 @@ END_EVENT_TABLE()
class wxActiveX;
class FrameSite :
class FrameSite :
public IOleClientSite,
public IOleInPlaceSiteEx,
public IOleInPlaceFrame,
@ -58,7 +58,7 @@ public:
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS);
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS);
STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject*, LPCOLESTR);
//IOleInPlaceFrame
STDMETHODIMP InsertMenus(HMENU, LPOLEMENUGROUPWIDTHS);
STDMETHODIMP SetMenu(HMENU, HOLEMENU, HWND);
@ -71,7 +71,7 @@ public:
STDMETHODIMP CanInPlaceActivate();
STDMETHODIMP OnInPlaceActivate();
STDMETHODIMP OnUIActivate();
STDMETHODIMP GetWindowContext(IOleInPlaceFrame**, IOleInPlaceUIWindow**,
STDMETHODIMP GetWindowContext(IOleInPlaceFrame**, IOleInPlaceUIWindow**,
LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
STDMETHODIMP Scroll(SIZE);
STDMETHODIMP OnUIDeactivate(BOOL);
@ -117,7 +117,7 @@ public:
STDMETHODIMP GetObject(LPOLESTR, DWORD, IBindCtx*, REFIID, void**);
STDMETHODIMP GetObjectStorage(LPOLESTR, IBindCtx*, REFIID, void**);
STDMETHODIMP IsRunning(LPOLESTR);
//IDispatch
STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR**, unsigned int, LCID, DISPID*);
STDMETHODIMP GetTypeInfo(unsigned int, LCID, ITypeInfo**);
@ -146,7 +146,7 @@ protected:
bool m_bInPlaceActive;
bool m_bUIActive;
bool m_bWindowless;
LCID m_nAmbientLocale;
@ -207,7 +207,7 @@ wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id,
{
m_bAmbientUserMode = true;
m_docAdviseCookie = 0;
CreateActiveX((LPOLESTR) wxConvUTF8.cMB2WC(progId).data());
CreateActiveX((LPOLESTR) (const wchar_t*)progId.wc_str(wxConvUTF8));
}
wxActiveX::~wxActiveX()
@ -223,14 +223,14 @@ wxActiveX::~wxActiveX()
};
m_connections.clear();
if (m_oleInPlaceObject.Ok())
if (m_oleInPlaceObject.Ok())
{
m_oleInPlaceObject->InPlaceDeactivate();
m_oleInPlaceObject->UIDeactivate();
}
if (m_oleObject.Ok())
if (m_oleObject.Ok())
{
if (m_docAdviseCookie != 0)
m_oleObject->Unadvise(m_docAdviseCookie);
@ -266,7 +266,7 @@ void wxActiveX::CreateActiveX(REFCLSID clsid)
GetTypeInfo();
// Get IOleObject interface
hret = m_oleObject.QueryInterface(IID_IOleObject, m_ActiveX);
hret = m_oleObject.QueryInterface(IID_IOleObject, m_ActiveX);
wxASSERT(SUCCEEDED(hret));
// Get IOleInPlaceObject interface
hret = m_oleInPlaceObject.QueryInterface(IID_IOleInPlaceObject, m_ActiveX);
@ -479,23 +479,23 @@ private:
public:
wxActiveXEvents(wxActiveX *ax) : m_activeX(ax) {}
~wxActiveXEvents()
~wxActiveXEvents()
{
}
//IDispatch
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
{
{
return E_NOTIMPL;
};
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
{
{
return E_NOTIMPL;
};
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
{
{
return E_NOTIMPL;
};
@ -505,7 +505,7 @@ public:
WORD wFlags, DISPPARAMS * pDispParams,
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
unsigned int * puArgErr)
{
{
if (wFlags & (DISPATCH_PROPERTYGET | DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYPUTREF))
return E_NOTIMPL;
@ -516,7 +516,7 @@ public:
int idx = mid->second;
wxActiveX::FuncX &func = m_activeX->m_events[idx];
ActiveXEventMap::iterator it = sg_eventMap.find(func.name);
@ -555,7 +555,7 @@ public:
if (px.IsOut())
{
wxVariant& vx = event.m_params[pDispParams->cArgs - i - 1];
VariantToMSWVariant(vx, va);
};
};
@ -622,15 +622,15 @@ wxVariant& wxActiveXEvent::operator[] (wxString name)
void wxActiveX::GetTypeInfo()
{
/*
We are currently only interested in the IDispatch interface
We are currently only interested in the IDispatch interface
to the control. For dual interfaces (TypeKind = TKIND_INTERFACE)
we should drill down through the inheritance
we should drill down through the inheritance
(using TYPEATTR->cImplTypes) and GetRefTypeOfImplType(n)
and retrieve all the func names etc that way, then generate a C++
and retrieve all the func names etc that way, then generate a C++
header file for it.
But we don't do this and probably never will, so if we have a DUAL
interface then we query for the IDispatch
But we don't do this and probably never will, so if we have a DUAL
interface then we query for the IDispatch
via GetRefTypeOfImplType(-1).
*/
@ -792,11 +792,11 @@ HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *events)
wxAutoOleInterface<IConnectionPointContainer> cpContainer(IID_IConnectionPointContainer, m_ActiveX);
if (! cpContainer.Ok())
return E_FAIL;
HRESULT hret = cpContainer->FindConnectionPoint(riid, cp.GetRef());
if (! SUCCEEDED(hret))
return hret;
hret = cp->Advise(events, &adviseCookie);
if (SUCCEEDED(hret))
@ -857,7 +857,7 @@ void wxActiveX::OnSize(wxSizeEvent& event)
if (w <= 0 && h <= 0)
return;
if (m_oleInPlaceObject)
if (m_oleInPlaceObject)
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
// extents are in HIMETRIC units
@ -872,13 +872,13 @@ void wxActiveX::OnSize(wxSizeEvent& event)
void wxActiveX::OnSetFocus(wxFocusEvent& event)
{
if (m_oleInPlaceActiveObject.Ok())
if (m_oleInPlaceActiveObject.Ok())
m_oleInPlaceActiveObject->OnFrameWindowActivate(TRUE);
}
void wxActiveX::OnKillFocus(wxFocusEvent& event)
{
if (m_oleInPlaceActiveObject.Ok())
if (m_oleInPlaceActiveObject.Ok())
m_oleInPlaceActiveObject->OnFrameWindowActivate(FALSE);
}
@ -898,7 +898,7 @@ FrameSite::FrameSite(wxActiveX * win)
m_bAmbientShowHatching = true;
m_bAmbientShowGrabHandles = true;
m_bAmbientAppearance = true;
m_hDCBuffer = NULL;
m_hWndParent = (HWND)m_window->GetHWND();
}
@ -941,7 +941,7 @@ HRESULT FrameSite::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
HRESULT hr;
if (pVarResult == NULL)
if (pVarResult == NULL)
return E_INVALIDARG;
//The most common case is boolean, use as an initial type
@ -1017,7 +1017,7 @@ HRESULT FrameSite::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
HRESULT FrameSite::GetWindow(HWND * phwnd)
{
WXOLE_TRACE("IOleWindow::GetWindow");
if (phwnd == NULL)
if (phwnd == NULL)
return E_INVALIDARG;
(*phwnd) = m_hWndParent;
return S_OK;
@ -1034,7 +1034,7 @@ HRESULT FrameSite::ContextSensitiveHelp(BOOL fEnterMode)
HRESULT FrameSite::GetBorder(LPRECT lprectBorder)
{
WXOLE_TRACE("IOleInPlaceUIWindow::GetBorder");
if (lprectBorder == NULL)
if (lprectBorder == NULL)
return E_INVALIDARG;
return INPLACE_E_NOTOOLSPACE;
}
@ -1042,7 +1042,7 @@ HRESULT FrameSite::GetBorder(LPRECT lprectBorder)
HRESULT FrameSite::RequestBorderSpace(LPCBORDERWIDTHS pborderwidths)
{
WXOLE_TRACE("IOleInPlaceUIWindow::RequestBorderSpace");
if (pborderwidths == NULL)
if (pborderwidths == NULL)
return E_INVALIDARG;
return INPLACE_E_NOTOOLSPACE;
}
@ -1139,9 +1139,9 @@ HRESULT FrameSite::GetWindowContext(IOleInPlaceFrame **ppFrame,
if (ppFrame == NULL || ppDoc == NULL || lprcPosRect == NULL ||
lprcClipRect == NULL || lpFrameInfo == NULL)
{
if (ppFrame != NULL)
if (ppFrame != NULL)
(*ppFrame) = NULL;
if (ppDoc != NULL)
if (ppDoc != NULL)
(*ppDoc) = NULL;
return E_INVALIDARG;
}
@ -1231,7 +1231,7 @@ HRESULT FrameSite::OnInPlaceActivateEx(BOOL * pfNoRedraw, DWORD dwFlags)
{
WXOLE_TRACE("IOleInPlaceSiteEx::OnInPlaceActivateEx");
OleLockRunning(m_window->m_ActiveX, TRUE, FALSE);
if (pfNoRedraw)
if (pfNoRedraw)
(*pfNoRedraw) = FALSE;
return S_OK;
}
@ -1268,9 +1268,9 @@ HRESULT FrameSite::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
HRESULT FrameSite::GetContainer(LPOLECONTAINER * ppContainer)
{
WXOLE_TRACE("IOleClientSite::GetContainer");
if (ppContainer == NULL)
if (ppContainer == NULL)
return E_INVALIDARG;
HRESULT hr = QueryInterface(IID_IOleContainer, (void**)(ppContainer));
wxASSERT(SUCCEEDED(hr));
@ -1323,26 +1323,26 @@ HRESULT FrameSite::LockContainer(BOOL fLock)
//IOleItemContainer
HRESULT FrameSite::GetObject(LPOLESTR pszItem, DWORD dwSpeedNeeded,
HRESULT FrameSite::GetObject(LPOLESTR pszItem, DWORD dwSpeedNeeded,
IBindCtx * pbc, REFIID riid, void ** ppvObject)
{
WXOLE_TRACE("IOleItemContainer::GetObject");
if (pszItem == NULL)
if (pszItem == NULL)
return E_INVALIDARG;
if (ppvObject == NULL)
if (ppvObject == NULL)
return E_INVALIDARG;
*ppvObject = NULL;
return MK_E_NOOBJECT;
}
HRESULT FrameSite::GetObjectStorage(LPOLESTR pszItem, IBindCtx * pbc,
HRESULT FrameSite::GetObjectStorage(LPOLESTR pszItem, IBindCtx * pbc,
REFIID riid, void ** ppvStorage)
{
WXOLE_TRACE("IOleItemContainer::GetObjectStorage");
if (pszItem == NULL)
if (pszItem == NULL)
return E_INVALIDARG;
if (ppvStorage == NULL)
if (ppvStorage == NULL)
return E_INVALIDARG;
*ppvStorage = NULL;
@ -1352,7 +1352,7 @@ HRESULT FrameSite::GetObjectStorage(LPOLESTR pszItem, IBindCtx * pbc,
HRESULT FrameSite::IsRunning(LPOLESTR pszItem)
{
WXOLE_TRACE("IOleItemContainer::IsRunning");
if (pszItem == NULL)
if (pszItem == NULL)
return E_INVALIDARG;
return MK_E_NOOBJECT;
@ -1417,7 +1417,7 @@ HRESULT FrameSite::ShowPropertyFrame()
//IOleCommandTarget
HRESULT FrameSite::QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds,
HRESULT FrameSite::QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds,
OLECMD * prgCmds, OLECMDTEXT * pCmdTet)
{
WXOLE_TRACE("IOleCommandTarget::QueryStatus");
@ -1436,8 +1436,8 @@ HRESULT FrameSite::QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds,
return S_OK;
}
HRESULT FrameSite::Exec(const GUID * pguidCmdGroup, DWORD nCmdID,
DWORD nCmdExecOpt, VARIANTARG * pVaIn,
HRESULT FrameSite::Exec(const GUID * pguidCmdGroup, DWORD nCmdID,
DWORD nCmdExecOpt, VARIANTARG * pVaIn,
VARIANTARG * pVaOut)
{
WXOLE_TRACE("IOleCommandTarget::Exec");
@ -1592,7 +1592,7 @@ wxString OLEHResultToString(HRESULT hr)
wxString GetIIDName(REFIID riid)
{
// an association between symbolic name and numeric value of an IID
struct KNOWN_IID
struct KNOWN_IID
{
const IID *pIid;
const wxChar *szName;
@ -1602,7 +1602,7 @@ wxString GetIIDName(REFIID riid)
#define ADD_KNOWN_IID(name) { &IID_I##name, _T(#name) }
#define ADD_KNOWN_GUID(name) { &name, _T(#name) }
static const KNOWN_IID aKnownIids[] =
static const KNOWN_IID aKnownIids[] =
{
ADD_KNOWN_IID(AdviseSink),
ADD_KNOWN_IID(AdviseSink2),
@ -1696,9 +1696,9 @@ wxString GetIIDName(REFIID riid)
#undef ADD_KNOWN_GUID
// try to find the interface in the table
for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ )
for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ )
{
if ( riid == *aKnownIids[ui].pIid )
if ( riid == *aKnownIids[ui].pIid )
{
return aKnownIids[ui].szName;
}