Switch public interfaces from nsIPrintOptions to nsIPrintSettings

Enabling XP Print Dialog for Windows
Enabling XP Print Progress Dialog
Enabling XP Page Setup Dialog
Fixing nsPrintPreviewContext to use nsIPrintPreviewContext
Bug 113917 r=dcone sr=attinasi


git-svn-id: svn://10.0.0.236/trunk@111213 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com
2002-01-01 12:58:53 +00:00
parent ecb2168322
commit ee8a5e4640
142 changed files with 5913 additions and 3957 deletions

View File

@@ -7,6 +7,7 @@
#include "BrowserView.h"
#include "nsIWebBrowser.h"
#include "nsIWebBrowserPrint.h"
#include "nsIWebProgressListener.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -17,14 +18,15 @@ static char THIS_FILE[] = __FILE__;
/////////////////////////////////////////////////////////////////////////////
// CPrintProgressDialog dialog
class CDlgPrintListener : public nsIPrintListener
class CDlgPrintListener : public nsIWebProgressListener
{
// Construction
public:
CDlgPrintListener(CPrintProgressDialog* aDlg);
NS_DECL_ISUPPORTS
NS_DECL_NSIPRINTLISTENER
NS_DECL_NSIWEBPROGRESSLISTENER
void ClearDlg() { m_PrintDlg = NULL; } // weak reference
@@ -37,8 +39,8 @@ NS_IMPL_ADDREF(CDlgPrintListener)
NS_IMPL_RELEASE(CDlgPrintListener)
NS_INTERFACE_MAP_BEGIN(CDlgPrintListener)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintListener)
NS_INTERFACE_MAP_ENTRY(nsIPrintListener)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_END
@@ -49,34 +51,50 @@ CDlgPrintListener::CDlgPrintListener(CPrintProgressDialog* aDlg) :
//NS_ADDREF_THIS();
}
/* void OnStartPrinting (); */
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
NS_IMETHODIMP
CDlgPrintListener::OnStartPrinting()
CDlgPrintListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus)
{
if (m_PrintDlg) {
return m_PrintDlg->OnStartPrinting();
if (aStatus == nsIWebProgressListener::STATE_START) {
return m_PrintDlg->OnStartPrinting();
} else if (aStatus == nsIWebProgressListener::STATE_STOP) {
return m_PrintDlg->OnEndPrinting(aStatus);
}
}
return NS_OK;
}
/* void OnProgressPrinting (in PRUint32 aProgress, in PRUint32 aProgressMax); */
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
NS_IMETHODIMP
CDlgPrintListener::OnProgressPrinting(PRUint32 aProgress, PRUint32 aProgressMax)
CDlgPrintListener::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
{
if (m_PrintDlg) {
return m_PrintDlg->OnProgressPrinting(aProgress, aProgressMax);
return m_PrintDlg->OnProgressPrinting(aCurSelfProgress, aMaxSelfProgress);
}
return NS_OK;
}
/* void OnEndPrinting (in PRUint32 aStatus); */
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
NS_IMETHODIMP
CDlgPrintListener::OnEndPrinting(PRUint32 aStatus)
CDlgPrintListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
{
if (m_PrintDlg) {
return m_PrintDlg->OnEndPrinting(aStatus);
}
return NS_OK;
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
NS_IMETHODIMP
CDlgPrintListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */
NS_IMETHODIMP
CDlgPrintListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/////////////////////////////////////////////////////////////////////////////
@@ -178,7 +196,7 @@ int CPrintProgressDialog::DoModal( )
m_PrintListener = new CDlgPrintListener(this); // constructor addrefs
if (m_PrintListener) {
// doModal will be set to false if the print job was cancelled
doModal = NS_SUCCEEDED(print->Print(m_DOMWin, nsnull, m_PrintListener)) == PR_TRUE;
doModal = NS_SUCCEEDED(print->Print(m_DOMWin, nsnull, nsnull)) == PR_TRUE;
}
}
@@ -190,46 +208,6 @@ int CPrintProgressDialog::DoModal( )
}
/* void OnStartPrinting (); */
NS_IMETHODIMP
CPrintProgressDialog::OnStartPrinting()
{
return NS_OK;
}
/* void OnProgressPrinting (in PRUint32 aProgress, in PRUint32 aProgressMax); */
NS_IMETHODIMP
CPrintProgressDialog::OnProgressPrinting(PRUint32 aProgress, PRUint32 aProgressMax)
{
// Initialize the progress meter we we get the "zero" progress
// which also tells us the max progress
if (aProgress == 0) {
CWnd *pWnd = GetDlgItem(IDC_PPD_DOC_TXT);
if(pWnd)
pWnd->SetWindowText(m_URL);
m_wndProgress.SetRange(0, aProgressMax);
m_wndProgress.SetPos(0);
}
m_wndProgress.SetPos(aProgress);
RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
return NS_OK;
}
/* void OnEndPrinting (in PRUint32 aStatus); */
NS_IMETHODIMP
CPrintProgressDialog::OnEndPrinting(PRUint32 aStatus)
{
// Here we need to know whether we have gone "modal"
// because we could get notified here if the user cancels
// before we ever get a chance to go into the modal loop
if (m_InModalMode) {
EndDialog(1);
}
return NS_OK;
}
void CPrintProgressDialog::OnCancel()
{
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(m_WebBrowser));