Back to index

lightning-sunbird  0.9+nobinonly
MozillaBrowser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Adam Lock <adamlock@eircom.net>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 // MozillaBrowser.h : Declaration of the CMozillaBrowser
00039 
00040 #ifndef __MOZILLABROWSER_H_
00041 #define __MOZILLABROWSER_H_
00042 
00043 #include "IWebBrowserImpl.h"
00044 
00045 // Commands sent via WM_COMMAND
00046 enum {
00047     ID_PRINT = 1,
00048     ID_PAGESETUP,
00049     ID_VIEWSOURCE,
00050     ID_SAVEAS,
00051     ID_PROPERTIES,
00052     ID_CUT,
00053     ID_COPY,
00054     ID_PASTE,
00055     ID_SELECTALL
00056 };
00057 
00058 // Command group and IDs exposed through IOleCommandTarget
00059 extern GUID CGID_IWebBrowser_Moz;
00060 extern GUID CGID_MSHTML_Moz;
00061 
00062 enum {
00063     HTMLID_FIND = 1,
00064     HTMLID_VIEWSOURCE,
00065     HTMLID_OPTIONS
00066 };
00067 
00068 // A list of objects
00069 typedef CComPtr<IUnknown> CComUnkPtr;
00070 
00071 class CWebBrowserContainer;
00072 class CPromptService;
00073 
00075 // CMozillaBrowser
00076 class ATL_NO_VTABLE CMozillaBrowser : 
00077     public CComObjectRootEx<CComMultiThreadModel>,
00078     public CComCoClass<CMozillaBrowser, &CLSID_MozillaBrowser>,
00079     public CComControl<CMozillaBrowser>,
00080     public IPropertyNotifySinkCP<CMozillaBrowser>,
00081     public IWebBrowserImpl<CMozillaBrowser, &CLSID_MozillaBrowser, &LIBID_MOZILLACONTROLLib>,
00082     public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents2, &LIBID_MOZILLACONTROLLib>,
00083     public IPersistStreamInitImpl<CMozillaBrowser>,
00084     public IPersistStorageImpl<CMozillaBrowser>,
00085     public IQuickActivateImpl<CMozillaBrowser>,
00086     public IOleControlImpl<CMozillaBrowser>,
00087     public IOleObjectImpl<CMozillaBrowser>,
00088     public IOleInPlaceActiveObjectImpl<CMozillaBrowser>,
00089     public IViewObjectExImpl<CMozillaBrowser>,
00090     public IOleInPlaceObjectWindowlessImpl<CMozillaBrowser>,
00091     public IDataObjectImpl<CMozillaBrowser>,
00092     public ISupportErrorInfo,
00093     public IOleCommandTargetImpl<CMozillaBrowser>,
00094     public IConnectionPointContainerImpl<CMozillaBrowser>,
00095     public ISpecifyPropertyPagesImpl<CMozillaBrowser>,
00096     public IMozControlBridge
00097 {
00098     friend CWebBrowserContainer;
00099     friend CPromptService;
00100 
00101 public:
00102     CMozillaBrowser();
00103     virtual ~CMozillaBrowser();
00104 
00105 DECLARE_REGISTRY_RESOURCEID(IDR_MOZILLABROWSER)
00106 
00107 BEGIN_COM_MAP(CMozillaBrowser)
00108     // Mozilla control interfaces
00109     COM_INTERFACE_ENTRY(IMozControlBridge)
00110     // IE web browser interface
00111     COM_INTERFACE_ENTRY(IWebBrowser2)
00112     COM_INTERFACE_ENTRY_IID(IID_IDispatch, IWebBrowser2)
00113     COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser2)
00114     COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowser2)
00115     // Outgoing IE event interfaces
00116     COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents,
00117             CProxyDWebBrowserEvents<CMozillaBrowser>)
00118     COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2,
00119             CProxyDWebBrowserEvents2<CMozillaBrowser>)
00120     // Other ActiveX/OLE interfaces
00121     COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
00122     COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
00123     COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
00124     COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
00125     COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
00126     COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
00127     COM_INTERFACE_ENTRY_IMPL(IOleControl)
00128     COM_INTERFACE_ENTRY_IMPL(IOleObject)
00129     COM_INTERFACE_ENTRY_IMPL(IQuickActivate) // This causes size assertion in ATL
00130     COM_INTERFACE_ENTRY_IMPL(IPersistStorage)
00131     COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
00132     COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages)
00133     COM_INTERFACE_ENTRY_IMPL(IDataObject)
00134     COM_INTERFACE_ENTRY(IOleCommandTarget)
00135     COM_INTERFACE_ENTRY(IProvideClassInfo)
00136     COM_INTERFACE_ENTRY(IProvideClassInfo2)
00137     COM_INTERFACE_ENTRY(ISupportErrorInfo)
00138     COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
00139 END_COM_MAP()
00140 
00141 // Properties supported by the control that map onto property
00142 // pages that the user may be able to configure from tools like VB.
00143 
00144 BEGIN_PROPERTY_MAP(CMozillaBrowser)
00145     // Example entries
00146     // PROP_ENTRY("Property Description", dispid, clsid)
00147     PROP_PAGE(CLSID_StockColorPage)
00148 END_PROPERTY_MAP()
00149 
00150 // Table of outgoing connection points. Anyone subscribing
00151 // to events from the control should do so through one of these
00152 // connect points.
00153 
00154 BEGIN_CONNECTION_POINT_MAP(CMozillaBrowser)
00155     CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
00156     // Fires IE events
00157     CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2)
00158     CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
00159 END_CONNECTION_POINT_MAP()
00160 
00161 // Table of window messages and their associate handlers
00162 
00163 BEGIN_MSG_MAP(CMozillaBrowser)
00164     MESSAGE_HANDLER(WM_CREATE, OnCreate)
00165     MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
00166     MESSAGE_HANDLER(WM_SIZE, OnSize)
00167     MESSAGE_HANDLER(WM_PAINT, OnPaint)
00168     MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
00169     MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
00170     MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode)
00171     MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
00172     COMMAND_ID_HANDLER(ID_PRINT, OnPrint)
00173     COMMAND_ID_HANDLER(ID_PAGESETUP, OnPageSetup)
00174     COMMAND_ID_HANDLER(ID_SAVEAS, OnSaveAs)
00175     COMMAND_ID_HANDLER(ID_PROPERTIES, OnProperties)
00176     COMMAND_ID_HANDLER(ID_CUT, OnCut)
00177     COMMAND_ID_HANDLER(ID_COPY, OnCopy)
00178     COMMAND_ID_HANDLER(ID_PASTE, OnPaste)
00179     COMMAND_ID_HANDLER(ID_SELECTALL, OnSelectAll)
00180     COMMAND_ID_HANDLER(ID_DOCUMENT_BACK, OnDocumentBack)
00181     COMMAND_ID_HANDLER(ID_DOCUMENT_FORWARD, OnDocumentForward)
00182     COMMAND_ID_HANDLER(ID_DOCUMENT_PRINT, OnDocumentPrint)
00183     COMMAND_ID_HANDLER(ID_DOCUMENT_REFRESH, OnDocumentRefresh)
00184     COMMAND_ID_HANDLER(ID_DOCUMENT_PROPERTIES, OnDocumentProperties)
00185     COMMAND_ID_HANDLER(ID_DOCUMENT_VIEWSOURCE, OnViewSource)
00186     COMMAND_ID_HANDLER(ID_LINK_OPEN, OnLinkOpen)
00187     COMMAND_ID_HANDLER(ID_LINK_OPENINNEWWINDOW, OnLinkOpenInNewWindow)
00188     COMMAND_ID_HANDLER(ID_LINK_COPYSHORTCUT, OnLinkCopyShortcut)
00189     COMMAND_ID_HANDLER(ID_LINK_PROPERTIES, OnLinkProperties)
00190 END_MSG_MAP()
00191 
00192     static HRESULT _stdcall PrintHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
00193     static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
00194     static HRESULT _stdcall EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
00195 
00196 // Table of OLE commands (invoked through IOleCommandTarget and their
00197 // associated command groups and command handlers.
00198 
00199 BEGIN_OLECOMMAND_TABLE()
00200     // Standard "common" commands
00201     OLECOMMAND_HANDLER(OLECMDID_PRINT, NULL, PrintHandler, L"Print", L"Print the page")
00202     OLECOMMAND_MESSAGE(OLECMDID_PAGESETUP, NULL, ID_PAGESETUP, L"Page Setup", L"Page Setup")
00203     OLECOMMAND_MESSAGE(OLECMDID_UNDO, NULL, 0, L"Undo", L"Undo")
00204     OLECOMMAND_MESSAGE(OLECMDID_REDO, NULL, 0, L"Redo", L"Redo")
00205     OLECOMMAND_MESSAGE(OLECMDID_REFRESH, NULL, 0, L"Refresh", L"Refresh")
00206     OLECOMMAND_MESSAGE(OLECMDID_STOP, NULL, 0, L"Stop", L"Stop")
00207     OLECOMMAND_MESSAGE(OLECMDID_ONUNLOAD, NULL, 0, L"OnUnload", L"OnUnload")
00208     OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, ID_SAVEAS, L"SaveAs", L"Save the page")
00209     OLECOMMAND_MESSAGE(OLECMDID_CUT, NULL, ID_CUT, L"Cut", L"Cut selection")
00210     OLECOMMAND_MESSAGE(OLECMDID_COPY, NULL, ID_COPY, L"Copy", L"Copy selection")
00211     OLECOMMAND_MESSAGE(OLECMDID_PASTE, NULL, ID_PASTE, L"Paste", L"Paste as selection")
00212     OLECOMMAND_MESSAGE(OLECMDID_SELECTALL, NULL, ID_SELECTALL, L"SelectAll", L"Select all")
00213     OLECOMMAND_MESSAGE(OLECMDID_PROPERTIES, NULL, ID_PROPERTIES, L"Properties", L"Show page properties")
00214     // Unsupported IE 4.x command group
00215     OLECOMMAND_MESSAGE(HTMLID_FIND, &CGID_IWebBrowser_Moz, 0, L"Find", L"Find")
00216     OLECOMMAND_MESSAGE(HTMLID_VIEWSOURCE, &CGID_IWebBrowser_Moz, ID_VIEWSOURCE, L"ViewSource", L"View Source")
00217     OLECOMMAND_MESSAGE(HTMLID_OPTIONS, &CGID_IWebBrowser_Moz, 0, L"Options", L"Options")
00218     // DHTML editor command group
00219     OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML_Moz, EditModeHandler, L"EditMode", L"Switch to edit mode")
00220     OLECOMMAND_HANDLER(IDM_BROWSEMODE, &CGID_MSHTML_Moz, EditModeHandler, L"UserMode", L"Switch to user mode")
00221     OLECOMMAND_HANDLER(IDM_BOLD, &CGID_MSHTML_Moz, EditCommandHandler, L"Bold", L"Toggle Bold")
00222     OLECOMMAND_HANDLER(IDM_ITALIC, &CGID_MSHTML_Moz, EditCommandHandler, L"Italic", L"Toggle Italic")
00223     OLECOMMAND_HANDLER(IDM_UNDERLINE, &CGID_MSHTML_Moz, EditCommandHandler, L"Underline", L"Toggle Underline")
00224     OLECOMMAND_HANDLER(IDM_UNKNOWN, &CGID_MSHTML_Moz, NULL, L"", L"")
00225     OLECOMMAND_HANDLER(IDM_ALIGNBOTTOM, &CGID_MSHTML_Moz, NULL, L"", L"")
00226     OLECOMMAND_HANDLER(IDM_ALIGNHORIZONTALCENTERS, &CGID_MSHTML_Moz, NULL, L"", L"")
00227     OLECOMMAND_HANDLER(IDM_ALIGNLEFT, &CGID_MSHTML_Moz, NULL, L"", L"")
00228     OLECOMMAND_HANDLER(IDM_ALIGNRIGHT, &CGID_MSHTML_Moz, NULL, L"", L"")
00229     OLECOMMAND_HANDLER(IDM_ALIGNTOGRID, &CGID_MSHTML_Moz, NULL, L"", L"")
00230     OLECOMMAND_HANDLER(IDM_ALIGNTOP, &CGID_MSHTML_Moz, NULL, L"", L"")
00231     OLECOMMAND_HANDLER(IDM_ALIGNVERTICALCENTERS, &CGID_MSHTML_Moz, NULL, L"", L"")
00232     OLECOMMAND_HANDLER(IDM_ARRANGEBOTTOM, &CGID_MSHTML_Moz, NULL, L"", L"")
00233     OLECOMMAND_HANDLER(IDM_ARRANGERIGHT, &CGID_MSHTML_Moz, NULL, L"", L"")
00234     OLECOMMAND_HANDLER(IDM_BRINGFORWARD, &CGID_MSHTML_Moz, NULL, L"", L"")
00235     OLECOMMAND_HANDLER(IDM_BRINGTOFRONT, &CGID_MSHTML_Moz, NULL, L"", L"")
00236     OLECOMMAND_HANDLER(IDM_CENTERHORIZONTALLY, &CGID_MSHTML_Moz, NULL, L"", L"")
00237     OLECOMMAND_HANDLER(IDM_CENTERVERTICALLY, &CGID_MSHTML_Moz, NULL, L"", L"")
00238     OLECOMMAND_HANDLER(IDM_CODE, &CGID_MSHTML_Moz, NULL, L"", L"")
00239     OLECOMMAND_HANDLER(IDM_DELETE, &CGID_MSHTML_Moz, NULL, L"", L"")
00240     OLECOMMAND_HANDLER(IDM_FONTNAME, &CGID_MSHTML_Moz, NULL, L"", L"")
00241     OLECOMMAND_HANDLER(IDM_FONTSIZE, &CGID_MSHTML_Moz, NULL, L"", L"")
00242     OLECOMMAND_HANDLER(IDM_GROUP, &CGID_MSHTML_Moz, NULL, L"", L"")
00243     OLECOMMAND_HANDLER(IDM_HORIZSPACECONCATENATE, &CGID_MSHTML_Moz, NULL, L"", L"")
00244     OLECOMMAND_HANDLER(IDM_HORIZSPACEDECREASE, &CGID_MSHTML_Moz, NULL, L"", L"")
00245     OLECOMMAND_HANDLER(IDM_HORIZSPACEINCREASE, &CGID_MSHTML_Moz, NULL, L"", L"")
00246     OLECOMMAND_HANDLER(IDM_HORIZSPACEMAKEEQUAL, &CGID_MSHTML_Moz, NULL, L"", L"")
00247     OLECOMMAND_HANDLER(IDM_INSERTOBJECT, &CGID_MSHTML_Moz, NULL, L"", L"")
00248     OLECOMMAND_HANDLER(IDM_MULTILEVELREDO, &CGID_MSHTML_Moz, NULL, L"", L"")
00249     OLECOMMAND_HANDLER(IDM_SENDBACKWARD, &CGID_MSHTML_Moz, NULL, L"", L"")
00250     OLECOMMAND_HANDLER(IDM_SENDTOBACK, &CGID_MSHTML_Moz, NULL, L"", L"")
00251     OLECOMMAND_HANDLER(IDM_SHOWTABLE, &CGID_MSHTML_Moz, NULL, L"", L"")
00252     OLECOMMAND_HANDLER(IDM_SIZETOCONTROL, &CGID_MSHTML_Moz, NULL, L"", L"")
00253     OLECOMMAND_HANDLER(IDM_SIZETOCONTROLHEIGHT, &CGID_MSHTML_Moz, NULL, L"", L"")
00254     OLECOMMAND_HANDLER(IDM_SIZETOCONTROLWIDTH, &CGID_MSHTML_Moz, NULL, L"", L"")
00255     OLECOMMAND_HANDLER(IDM_SIZETOFIT, &CGID_MSHTML_Moz, NULL, L"", L"")
00256     OLECOMMAND_HANDLER(IDM_SIZETOGRID, &CGID_MSHTML_Moz, NULL, L"", L"")
00257     OLECOMMAND_HANDLER(IDM_SNAPTOGRID, &CGID_MSHTML_Moz, NULL, L"", L"")
00258     OLECOMMAND_HANDLER(IDM_TABORDER, &CGID_MSHTML_Moz, NULL, L"", L"")
00259     OLECOMMAND_HANDLER(IDM_TOOLBOX, &CGID_MSHTML_Moz, NULL, L"", L"")
00260     OLECOMMAND_HANDLER(IDM_MULTILEVELUNDO, &CGID_MSHTML_Moz, NULL, L"", L"")
00261     OLECOMMAND_HANDLER(IDM_UNGROUP, &CGID_MSHTML_Moz, NULL, L"", L"")
00262     OLECOMMAND_HANDLER(IDM_VERTSPACECONCATENATE, &CGID_MSHTML_Moz, NULL, L"", L"")
00263     OLECOMMAND_HANDLER(IDM_VERTSPACEDECREASE, &CGID_MSHTML_Moz, NULL, L"", L"")
00264     OLECOMMAND_HANDLER(IDM_VERTSPACEINCREASE, &CGID_MSHTML_Moz, NULL, L"", L"")
00265     OLECOMMAND_HANDLER(IDM_VERTSPACEMAKEEQUAL, &CGID_MSHTML_Moz, NULL, L"", L"")
00266     OLECOMMAND_HANDLER(IDM_JUSTIFYFULL, &CGID_MSHTML_Moz, NULL, L"", L"")
00267     OLECOMMAND_HANDLER(IDM_BACKCOLOR, &CGID_MSHTML_Moz, NULL, L"", L"")
00268     OLECOMMAND_HANDLER(IDM_BORDERCOLOR, &CGID_MSHTML_Moz, NULL, L"", L"")
00269     OLECOMMAND_HANDLER(IDM_FLAT, &CGID_MSHTML_Moz, NULL, L"", L"")
00270     OLECOMMAND_HANDLER(IDM_FORECOLOR, &CGID_MSHTML_Moz, NULL, L"", L"")
00271     OLECOMMAND_HANDLER(IDM_JUSTIFYCENTER, &CGID_MSHTML_Moz, NULL, L"", L"")
00272     OLECOMMAND_HANDLER(IDM_JUSTIFYGENERAL, &CGID_MSHTML_Moz, NULL, L"", L"")
00273     OLECOMMAND_HANDLER(IDM_JUSTIFYLEFT, &CGID_MSHTML_Moz, NULL, L"", L"")
00274     OLECOMMAND_HANDLER(IDM_JUSTIFYRIGHT, &CGID_MSHTML_Moz, NULL, L"", L"")
00275     OLECOMMAND_HANDLER(IDM_RAISED, &CGID_MSHTML_Moz, NULL, L"", L"")
00276     OLECOMMAND_HANDLER(IDM_SUNKEN, &CGID_MSHTML_Moz, NULL, L"", L"")
00277     OLECOMMAND_HANDLER(IDM_CHISELED, &CGID_MSHTML_Moz, NULL, L"", L"")
00278     OLECOMMAND_HANDLER(IDM_ETCHED, &CGID_MSHTML_Moz, NULL, L"", L"")
00279     OLECOMMAND_HANDLER(IDM_SHADOWED, &CGID_MSHTML_Moz, NULL, L"", L"")
00280     OLECOMMAND_HANDLER(IDM_FIND, &CGID_MSHTML_Moz, NULL, L"", L"")
00281     OLECOMMAND_HANDLER(IDM_SHOWGRID, &CGID_MSHTML_Moz, NULL, L"", L"")
00282     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST0, &CGID_MSHTML_Moz, NULL, L"", L"")
00283     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST1, &CGID_MSHTML_Moz, NULL, L"", L"")
00284     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST2, &CGID_MSHTML_Moz, NULL, L"", L"")
00285     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST3, &CGID_MSHTML_Moz, NULL, L"", L"")
00286     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST4, &CGID_MSHTML_Moz, NULL, L"", L"")
00287     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST5, &CGID_MSHTML_Moz, NULL, L"", L"")
00288     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST6, &CGID_MSHTML_Moz, NULL, L"", L"")
00289     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST7, &CGID_MSHTML_Moz, NULL, L"", L"")
00290     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST8, &CGID_MSHTML_Moz, NULL, L"", L"")
00291     OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST9, &CGID_MSHTML_Moz, NULL, L"", L"")
00292     OLECOMMAND_HANDLER(IDM_OBJECTVERBLISTLAST, &CGID_MSHTML_Moz, NULL, L"", L"")
00293     OLECOMMAND_HANDLER(IDM_CONVERTOBJECT, &CGID_MSHTML_Moz, NULL, L"", L"")
00294     OLECOMMAND_HANDLER(IDM_CUSTOMCONTROL, &CGID_MSHTML_Moz, NULL, L"", L"")
00295     OLECOMMAND_HANDLER(IDM_CUSTOMIZEITEM, &CGID_MSHTML_Moz, NULL, L"", L"")
00296     OLECOMMAND_HANDLER(IDM_RENAME, &CGID_MSHTML_Moz, NULL, L"", L"")
00297     OLECOMMAND_HANDLER(IDM_IMPORT, &CGID_MSHTML_Moz, NULL, L"", L"")
00298     OLECOMMAND_HANDLER(IDM_NEWPAGE, &CGID_MSHTML_Moz, NULL, L"", L"")
00299     OLECOMMAND_HANDLER(IDM_MOVE, &CGID_MSHTML_Moz, NULL, L"", L"")
00300     OLECOMMAND_HANDLER(IDM_CANCEL, &CGID_MSHTML_Moz, NULL, L"", L"")
00301     OLECOMMAND_HANDLER(IDM_FONT, &CGID_MSHTML_Moz, NULL, L"", L"")
00302     OLECOMMAND_HANDLER(IDM_STRIKETHROUGH, &CGID_MSHTML_Moz, NULL, L"", L"")
00303     OLECOMMAND_HANDLER(IDM_DELETEWORD, &CGID_MSHTML_Moz, NULL, L"", L"")
00304     OLECOMMAND_HANDLER(IDM_EXECPRINT, &CGID_MSHTML_Moz, NULL, L"", L"")
00305     OLECOMMAND_HANDLER(IDM_JUSTIFYNONE, &CGID_MSHTML_Moz, NULL, L"", L"")
00306 END_OLECOMMAND_TABLE()
00307 
00308     HWND GetCommandTargetWindow() const
00309     {
00310         return m_hWnd;
00311     }
00312 
00313 // Windows message handlers
00314     LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00315     LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00316     LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00317     LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00318     LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00319     LRESULT OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00320     LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00321 
00322     LRESULT OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00323     LRESULT OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00324     LRESULT OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00325 
00326     LRESULT OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00327     LRESULT OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00328     LRESULT OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00329     LRESULT OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00330     LRESULT OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00331     LRESULT OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00332 
00333     LRESULT OnDocumentBack(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00334     LRESULT OnDocumentForward(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00335     LRESULT OnDocumentPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00336     LRESULT OnDocumentRefresh(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00337     LRESULT OnDocumentProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00338     
00339     LRESULT OnLinkOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00340     LRESULT OnLinkOpenInNewWindow(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00341     LRESULT OnLinkCopyShortcut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00342     LRESULT OnLinkProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
00343 
00344 // ISupportsErrorInfo
00345     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
00346 
00347 // IViewObjectEx
00348     STDMETHOD(GetViewStatus)(DWORD* pdwStatus)
00349     {
00350         ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
00351         *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE;
00352         return S_OK;
00353     }
00354 
00355 // Protected members
00356 protected:
00357 
00358     // List of browsers
00359     static nsVoidArray sBrowserList;
00360 
00361     // Name of profile to use
00362     nsString mProfileName;
00363 
00364     // Pointer to web browser manager
00365     CWebBrowserContainer    * mWebBrowserContainer;
00366     // CComObject to IHTMLDocument implementer
00367     CIEHtmlDocumentInstance * mIERootDocument;
00368 
00369     // Mozilla interfaces
00370     nsCOMPtr<nsIWebBrowser> mWebBrowser;
00371     nsCOMPtr<nsIBaseWindow> mWebBrowserAsWin;
00372     nsCOMPtr<nsIEditingSession> mEditingSession;
00373     nsCOMPtr<nsICommandManager> mCommandManager;
00374 
00375     // Context menu
00376     nsCOMPtr<nsIDOMNode>    mContextNode;
00377     
00378     // Prefs service
00379     nsCOMPtr<nsIPrefBranch> mPrefBranch;
00380 
00381     // Flag to indicate if browser is created or not
00382     BOOL                    mValidBrowserFlag;
00383     // Flag to indicate if browser is in edit mode or not
00384     BOOL                    mEditModeFlag;
00385     // Flag to indicate if the browser has a drop target
00386     BOOL                    mHaveDropTargetFlag;
00387     // Contains an error message if startup went wrong
00388     tstring                 mStartupErrorMessage;
00389     // List of registered browser helper objects
00390     CComUnkPtr             *mBrowserHelperList;
00391     ULONG                   mBrowserHelperListCount;
00392 
00393     virtual HRESULT Initialize();
00394     virtual HRESULT Terminate();
00395     virtual HRESULT CreateBrowser();
00396     virtual HRESULT DestroyBrowser();
00397     virtual HRESULT SetStartupErrorMessage(UINT nStringID);
00398     virtual HRESULT GetDOMDocument(nsIDOMDocument **pDocument);
00399     virtual HRESULT SetEditorMode(BOOL bEnabled);
00400     virtual HRESULT OnEditorCommand(DWORD nCmdID);
00401     virtual HRESULT PrintDocument(BOOL promptUser);
00402 
00403     virtual HRESULT LoadBrowserHelpers();
00404     virtual HRESULT UnloadBrowserHelpers();
00405 
00406     // User interface methods
00407     virtual int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = _T(""), UINT nType = MB_OK);
00408     virtual void ShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
00409     virtual void ShowURIPropertyDlg(const nsAString &aURI, const nsAString &aContentType);
00410     virtual void NextDlgControl();
00411     virtual void PrevDlgControl();
00412 
00413 public:
00414 // IOleObjectImpl overrides
00415     HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect);
00416 
00417 // IOleObject overrides
00418     virtual HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite);
00419 
00420 // IMozControlBridge implementation
00421     virtual HRESULT STDMETHODCALLTYPE GetWebBrowser(/* [out] */ void __RPC_FAR *__RPC_FAR *aBrowser);
00422 
00423 // IWebBrowserImpl overrides
00424     virtual nsresult GetWebNavigation(nsIWebNavigation **aWebNav);
00425     virtual nsresult GetDOMWindow(nsIDOMWindow **aDOMWindow);
00426     virtual nsresult GetPrefs(nsIPrefBranch **aPrefBranch);
00427     virtual PRBool BrowserIsValid();
00428     // IWebBrowser
00429     virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
00430     virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
00431     virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister);
00432     virtual HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(VARIANT_BOOL bRegister);
00433 
00434 public:
00435     HRESULT OnDraw(ATL_DRAWINFO& di);
00436 
00437 };
00438 
00439 #endif //__MOZILLABROWSER_H_