1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
23 * Chak Nanga <chak@netscape.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 // BrowserView.h : interface of the CBrowserView class
41 /////////////////////////////////////////////////////////////////////////////
43 #ifndef _BROWSERVIEW_H
44 #define _BROWSERVIEW_H
50 #include "IBrowserFrameGlue.h"
51 #include "nsIPrintSettings.h"
53 /////////////////////////////////////////////////////////////////////////////
54 // CBrowserView window
59 class CPrintProgressDialog
;
63 class CBrowserView
: public CWnd
67 virtual ~CBrowserView();
69 // Some helper methods
70 HRESULT
CreateBrowser();
71 HRESULT
DestroyBrowser();
72 void OpenURL(const char* pUrl
);
73 void OpenURL(const PRUnichar
* pUrl
);
74 CBrowserFrame
* CreateNewBrowserFrame(PRUint32 chromeMask
= nsIWebBrowserChrome::CHROME_ALL
,
75 PRInt32 x
= -1, PRInt32 y
= -1,
76 PRInt32 cx
= -1, PRInt32 cy
= -1,
77 PRBool bShowWindow
= PR_TRUE
);
78 void OpenURLInNewWindow(const PRUnichar
* pUrl
);
81 void GetBrowserWindowTitle(nsCString
& title
);
83 // Called by the CBrowserFrame after it creates the view
84 // Essentially a back pointer to the BrowserFrame
85 void SetBrowserFrame(CBrowserFrame
* pBrowserFrame
);
86 CBrowserFrame
* mpBrowserFrame
;
88 // Called by the CBrowserFrame after it creates the view
89 // The view passes this on to the embedded Browser's Impl
91 void SetBrowserFrameGlue(PBROWSERFRAMEGLUE pBrowserFrameGlue
);
92 PBROWSERFRAMEGLUE mpBrowserFrameGlue
;
94 // Pointer to the object which implements
95 // the inerfaces required by Mozilla embedders
97 CBrowserImpl
* mpBrowserImpl
;
100 //CNsIRequest *nsiRequest;
102 // Mozilla interfaces
104 nsCOMPtr
<nsIWebBrowser
> mWebBrowser
;
105 nsCOMPtr
<nsIBaseWindow
> mBaseWindow
;
106 nsCOMPtr
<nsIWebNavigation
> mWebNav
;
108 typedef void* nsNativeWidget
;
110 //nsCOMPtr<nsISHistory> mSessionHistory; // de: added in 5/11/01
112 void UpdateBusyState(PRBool aBusy
);
113 PRBool mbDocumentLoading
;
115 void SetCtxMenuLinkUrl(nsAutoString
& strLinkUrl
);
116 nsAutoString mCtxMenuLinkUrl
;
118 void SetCtxMenuImageSrc(nsAutoString
& strImgSrc
);
119 nsAutoString mCtxMenuImgSrc
;
121 inline void ClearFindDialog() { m_pFindDlg
= NULL
; }
122 CFindDialog
* m_pFindDlg
;
123 CPrintProgressDialog
* m_pPrintProgressDlg
;
124 // When set to TRUE...
125 // indicates that the clipboard operation needs to be
126 // performed on the UrlBar rather than on
127 // the web page content
129 BOOL m_bUrlBarClipOp
;
131 // indicates whether we are currently printing
132 BOOL m_bCurrentlyPrinting
;
134 void Activate(UINT nState
, CWnd
* pWndOther
, BOOL bMinimized
);
136 BOOL
OpenViewSourceWindow(const char* pUrl
);
137 BOOL
IsViewSourceUrl(CString
& strUrl
);
140 // ClassWizard generated virtual function overrides
141 //{{AFX_VIRTUAL(CBrowserView)
145 static void WriteToOutputFile(char * strInput
);
147 static void RvTestResult(nsresult rv
, char *pLine
, int displayMethod
=1);
148 static void QAOutput(char *pLine
, int displayMethod
=1);
151 virtual BOOL
OnCmdMsg(UINT nID
, int nCode
, void* pExtra
, AFX_CMDHANDLERINFO
* pHandlerInfo
);
153 virtual BOOL
PreCreateWindow(CREATESTRUCT
& cs
);
157 // Generated message map functions
159 nsCOMPtr
<nsIPrintSettings
> m_PrintSettings
;
161 //{{AFX_MSG(CBrowserView)
162 afx_msg
int OnCreate(LPCREATESTRUCT lpCreateStruct
);
163 afx_msg
void OnDestroy();
164 afx_msg
void OnSize( UINT
, int, int );
165 afx_msg
void OnUrlSelectedInUrlBar();
166 afx_msg
void OnNewUrlEnteredInUrlBar();
167 afx_msg
void OnFileOpen();
168 afx_msg
void OnFileSaveAs();
169 afx_msg
void OnViewSource();
170 afx_msg
void OnViewInfo();
171 afx_msg
void OnNavBack();
172 afx_msg
void OnNavForward();
173 afx_msg
void OnNavHome();
174 afx_msg
void OnNavReload();
175 afx_msg
void OnNavStop();
176 afx_msg
void OnCut();
177 afx_msg
void OnCopy();
178 afx_msg
void OnPaste();
179 afx_msg
void OnUndoUrlBarEditOp();
180 afx_msg
void OnSelectAll();
181 afx_msg
void OnSelectNone();
182 afx_msg
void OnCopyLinkLocation();
183 afx_msg
void OnOpenLinkInNewWindow();
184 afx_msg
void OnViewImageInNewWindow();
185 afx_msg
void OnSaveLinkAs();
186 afx_msg
void OnSaveImageAs();
187 afx_msg
void OnShowFindDlg();
188 afx_msg
void OnFilePrint();
189 afx_msg
void OnUpdateFilePrint(CCmdUI
* pCmdUI
);
190 afx_msg LRESULT
OnFindMsg(WPARAM wParam
, LPARAM lParam
);
191 afx_msg
void OnUpdateNavBack(CCmdUI
* pCmdUI
);
192 afx_msg
void OnUpdateNavForward(CCmdUI
* pCmdUI
);
193 afx_msg
void OnUpdateNavStop(CCmdUI
* pCmdUI
);
194 afx_msg
void OnUpdateCut(CCmdUI
* pCmdUI
);
195 afx_msg
void OnUpdateCopy(CCmdUI
* pCmdUI
);
196 afx_msg
void OnUpdatePaste(CCmdUI
* pCmdUI
);
199 DECLARE_MESSAGE_MAP()
202 #endif //_BROWSERVIEW_H