Back to index

lightning-sunbird  0.9+nobinonly
BrowserView.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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  *   Chak Nanga <chak@netscape.com>
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 
00039 // BrowserView.h : interface of the CBrowserView class
00040 //
00042 
00043 #ifndef _BROWSERVIEW_H
00044 #define _BROWSERVIEW_H
00045 
00046 #if _MSC_VER > 1000
00047        #pragma once
00048 #endif
00049 
00050 #include "IBrowserFrameGlue.h"
00051 #include "nsIPrintSettings.h"
00052 
00054 // CBrowserView window
00055 
00056 class CBrowserFrame;
00057 class CBrowserImpl;
00058 class CFindDialog;
00059 class CPrintProgressDialog;
00060 
00061 class CTests;
00062 //class CNsIRequest;
00063 class CBrowserView : public CWnd
00064 {
00065 public:
00066        CBrowserView();
00067        virtual ~CBrowserView();
00068 
00069        // Some helper methods
00070        HRESULT CreateBrowser();
00071        HRESULT DestroyBrowser();
00072        void OpenURL(const char* pUrl);
00073        void OpenURL(const PRUnichar* pUrl);
00074        CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL, 
00075                                                  PRInt32 x = -1, PRInt32 y = -1, 
00076                                                  PRInt32 cx = -1, PRInt32 cy = -1,
00077                                                  PRBool bShowWindow = PR_TRUE);
00078        void OpenURLInNewWindow(const PRUnichar* pUrl);
00079        void LoadHomePage();
00080 
00081        void GetBrowserWindowTitle(nsCString& title);
00082        
00083        // Called by the CBrowserFrame after it creates the view
00084        // Essentially a back pointer to the BrowserFrame
00085        void SetBrowserFrame(CBrowserFrame* pBrowserFrame);
00086        CBrowserFrame* mpBrowserFrame;
00087 
00088        // Called by the CBrowserFrame after it creates the view
00089        // The view passes this on to the embedded Browser's Impl
00090        // obj
00091        void SetBrowserFrameGlue(PBROWSERFRAMEGLUE pBrowserFrameGlue);
00092        PBROWSERFRAMEGLUE mpBrowserFrameGlue;
00093 
00094        // Pointer to the object which implements
00095        // the inerfaces required by Mozilla embedders
00096        //
00097        CBrowserImpl* mpBrowserImpl;
00098 
00099     CTests *qaTests ;
00100        //CNsIRequest *nsiRequest;
00101 
00102        // Mozilla interfaces
00103        //
00104        nsCOMPtr<nsIWebBrowser> mWebBrowser;
00105        nsCOMPtr<nsIBaseWindow> mBaseWindow;
00106        nsCOMPtr<nsIWebNavigation> mWebNav;       
00107 
00108        typedef void* nsNativeWidget;
00109 
00110        //nsCOMPtr<nsISHistory> mSessionHistory; // de: added in 5/11/01
00111 
00112        void UpdateBusyState(PRBool aBusy);
00113        PRBool mbDocumentLoading;
00114 
00115        void SetCtxMenuLinkUrl(nsAutoString& strLinkUrl);
00116        nsAutoString mCtxMenuLinkUrl;
00117 
00118        void SetCtxMenuImageSrc(nsAutoString& strImgSrc);
00119        nsAutoString mCtxMenuImgSrc;
00120 
00121        inline void ClearFindDialog() { m_pFindDlg = NULL; }
00122        CFindDialog* m_pFindDlg;
00123   CPrintProgressDialog* m_pPrintProgressDlg;
00124     // When set to TRUE...
00125     // indicates that the clipboard operation needs to be 
00126     // performed on the UrlBar rather than on
00127     // the web page content
00128     //
00129     BOOL m_bUrlBarClipOp;
00130 
00131     // indicates whether we are currently printing
00132     BOOL m_bCurrentlyPrinting;
00133 
00134     void Activate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
00135 
00136     BOOL OpenViewSourceWindow(const char* pUrl);
00137     BOOL IsViewSourceUrl(CString& strUrl);
00138 
00139        // Overrides
00140        // ClassWizard generated virtual function overrides
00141        //{{AFX_VIRTUAL(CBrowserView)
00142 
00143               
00144        // de: qa methods
00145        static void WriteToOutputFile(char * strInput);
00146        static char *theUrl;
00147        static void RvTestResult(nsresult rv, char *pLine, int displayMethod=1);
00148        static void QAOutput(char *pLine, int displayMethod=1);
00149 
00150        public:
00151        virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
00152        protected:
00153        virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00154        //}}AFX_VIRTUAL
00155 
00156 
00157        // Generated message map functions
00158 protected:
00159        nsCOMPtr<nsIPrintSettings> m_PrintSettings;
00160 
00161        //{{AFX_MSG(CBrowserView)
00162        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00163        afx_msg void OnDestroy();
00164        afx_msg void OnSize( UINT, int, int );
00165        afx_msg void OnUrlSelectedInUrlBar();
00166        afx_msg void OnNewUrlEnteredInUrlBar();
00167        afx_msg void OnFileOpen();
00168        afx_msg void OnFileSaveAs();
00169        afx_msg void OnViewSource();
00170        afx_msg void OnViewInfo();
00171        afx_msg void OnNavBack();
00172        afx_msg void OnNavForward();
00173        afx_msg void OnNavHome();
00174        afx_msg void OnNavReload();
00175        afx_msg void OnNavStop();
00176        afx_msg void OnCut();
00177        afx_msg void OnCopy();
00178        afx_msg void OnPaste();
00179     afx_msg void OnUndoUrlBarEditOp();
00180        afx_msg void OnSelectAll();
00181        afx_msg void OnSelectNone();
00182        afx_msg void OnCopyLinkLocation();
00183        afx_msg void OnOpenLinkInNewWindow();
00184        afx_msg void OnViewImageInNewWindow();
00185        afx_msg void OnSaveLinkAs();
00186        afx_msg void OnSaveImageAs();
00187        afx_msg void OnShowFindDlg();
00188        afx_msg void OnFilePrint();
00189        afx_msg void OnUpdateFilePrint(CCmdUI* pCmdUI);
00190        afx_msg LRESULT OnFindMsg(WPARAM wParam, LPARAM lParam);
00191        afx_msg void OnUpdateNavBack(CCmdUI* pCmdUI);
00192        afx_msg void OnUpdateNavForward(CCmdUI* pCmdUI);
00193        afx_msg void OnUpdateNavStop(CCmdUI* pCmdUI);
00194        afx_msg void OnUpdateCut(CCmdUI* pCmdUI);
00195        afx_msg void OnUpdateCopy(CCmdUI* pCmdUI);
00196        afx_msg void OnUpdatePaste(CCmdUI* pCmdUI);
00197 
00198        //}}AFX_MSG
00199        DECLARE_MESSAGE_MAP()
00200 };
00201 
00202 #endif //_BROWSERVIEW_H