Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
CPrintProgressDialog Class Reference

#include <PrintProgressDialog.h>

Collaboration diagram for CPrintProgressDialog:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_PRINT_PROGRESS_DIALOG }
enum  { IDD = IDD_PRINT_PROGRESS_DIALOG }

Public Member Functions

 CPrintProgressDialog (nsIWebBrowser *aWebBrowser, nsIPrintSettings *aPrintSettings, CWnd *pParent=NULL)
virtual ~CPrintProgressDialog ()
virtual int DoModal ()
void SetURI (const char *aTitle)
NS_IMETHOD OnStartPrinting (void)
NS_IMETHOD OnProgressPrinting (PRUint32 aProgress, PRUint32 aProgressMax)
NS_IMETHOD OnEndPrinting (PRUint32 aStatus)
 CPrintProgressDialog (CWnd *pParent, BOOL aIsForPrinting, nsIPrintProgressParams *aPPParams, nsIWebBrowserPrint *aWebBrowserPrint, nsIPrintSettings *aPrintSettings)
virtual ~CPrintProgressDialog ()
void SetDocAndURL ()
NS_IMETHOD OnStartPrinting (void)
NS_IMETHOD OnProgressPrinting (PRUint32 aProgress, PRUint32 aProgressMax)
NS_IMETHOD OnEndPrinting (PRUint32 aStatus)

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
virtual void OnCancel ()
virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
virtual void OnCancel ()

Protected Attributes

CProgressCtrl m_wndProgress
CString m_URL
nsIWebBrowserm_WebBrowser
nsCOMPtr< nsIWebProgressListenerm_PrintListener
nsIPrintSettingsm_PrintSettings
BOOL m_InModalMode
nsCOMPtr< nsIWebBrowserPrintm_WebBrowserPrint
nsCOMPtr< nsIPrintProgressParamsm_PPParams
nsCOMPtr< nsIPrintSettingsm_PrintSettings
BOOL m_HasStarted
BOOL m_IsForPrinting

Detailed Description

Definition at line 16 of file PrintProgressDialog.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 35 of file PrintProgressDialog.h.

anonymous enum
Enumerator:
IDD 

Definition at line 40 of file PrintProgressDialog.h.


Constructor & Destructor Documentation

CPrintProgressDialog::CPrintProgressDialog ( nsIWebBrowser aWebBrowser,
nsIPrintSettings aPrintSettings,
CWnd *  pParent = NULL 
)

Definition at line 102 of file PrintProgressDialog.cpp.

       : CDialog(CPrintProgressDialog::IDD, pParent),
  m_WebBrowser(aWebBrowser),
  m_PrintListener(nsnull),
  m_PrintSettings(aPrintSettings),
  m_InModalMode(PR_FALSE)
{
       //{{AFX_DATA_INIT(CPrintProgressDialog)
              // NOTE: the ClassWizard will add member initialization here
       //}}AFX_DATA_INIT
}

Definition at line 116 of file PrintProgressDialog.cpp.

{
  CDlgPrintListener * pl = (CDlgPrintListener*)m_PrintListener.get();
  if (pl) {
    pl->ClearDlg();
  }
}

Here is the call graph for this function:

CPrintProgressDialog::CPrintProgressDialog ( CWnd *  pParent,
BOOL  aIsForPrinting,
nsIPrintProgressParams aPPParams,
nsIWebBrowserPrint aWebBrowserPrint,
nsIPrintSettings aPrintSettings 
)

Definition at line 104 of file PrintProgressDialog.cpp.

       : CDialog(CPrintProgressDialog::IDD, pParent),
  m_WebBrowserPrint(aWebBrowserPrint),
  m_PPParams(aPPParams),
  m_PrintListener(nsnull),
  m_PrintSettings(aPrintSettings),
  m_HasStarted(FALSE),
  m_IsForPrinting(aIsForPrinting)
{
       //{{AFX_DATA_INIT(CPrintProgressDialog)
              // NOTE: the ClassWizard will add member initialization here
       //}}AFX_DATA_INIT
}

Member Function Documentation

void CPrintProgressDialog::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 125 of file PrintProgressDialog.cpp.

{
       CDialog::DoDataExchange(pDX);
       //{{AFX_DATA_MAP(CPrintProgressDialog)
              // NOTE: the ClassWizard will add DDX and DDV calls here
       //}}AFX_DATA_MAP
}
virtual void CPrintProgressDialog::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 188 of file PrintProgressDialog.cpp.

{
  PRBool doModal = PR_FALSE;
  nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(m_WebBrowser));
  if(print) 
  {
    m_PrintListener = new CDlgPrintListener(this); // constructor addrefs
    if (m_PrintListener) {
      // doModal will be set to false if the print job was cancelled
      nsIWebProgressListener * wpl = NS_STATIC_CAST(nsIWebProgressListener*, m_PrintListener);
      doModal = NS_SUCCEEDED(print->Print(m_PrintSettings, wpl)) == PR_TRUE;
    }
  }

  if (doModal) {
    m_InModalMode = PR_TRUE;
    return CDialog::DoModal();
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CPrintProgressDialog::OnCancel ( ) [protected, virtual]

Definition at line 252 of file PrintProgressDialog.cpp.

{
  nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(m_WebBrowser));
  if (print) {
    print->Cancel();
  }

       CDialog::OnCancel();
}

Here is the call graph for this function:

virtual void CPrintProgressDialog::OnCancel ( ) [protected, virtual]

Definition at line 241 of file PrintProgressDialog.cpp.

{
  // 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;
}
BOOL CPrintProgressDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 160 of file PrintProgressDialog.cpp.

{
       CDialog::OnInitDialog();
       
       CRect clientRect;
       GetClientRect(&clientRect);

       CRect titleRect;
  GetLocalRect(GetDlgItem(IDC_PPD_DOC_TITLE_STATIC), titleRect, this);

       CRect itemRect;
  GetLocalRect(GetDlgItem(IDC_PPD_DOC_TXT), itemRect, this);

  CRect progRect;
  progRect.left   = titleRect.left;
  progRect.top    = itemRect.top+itemRect.Height()+5;
  progRect.right  = clientRect.Width()-(2*titleRect.left);
  progRect.bottom = progRect.top+titleRect.Height();


       m_wndProgress.Create (WS_CHILD | WS_VISIBLE, progRect, this, -1);
       m_wndProgress.SetPos (0);
       
       return TRUE;  // return TRUE unless you set the focus to a control
                     // EXCEPTION: OCX Property Pages should return FALSE
}

Here is the call graph for this function:

virtual BOOL CPrintProgressDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 219 of file PrintProgressDialog.cpp.

{
  if (m_wndProgress.m_hWnd == NULL) return NS_OK;

  // 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;
}

Definition at line 212 of file PrintProgressDialog.cpp.

{
  return NS_OK;
}

Definition at line 240 of file PrintProgressDialog.cpp.

{
       USES_CONVERSION;

  if (m_PPParams) 
  {
    PRUnichar* docTitle = nsnull;
    PRUnichar* urlStr   = nsnull;
    m_PPParams->GetDocTitle(&docTitle);
    m_PPParams->GetDocURL(&urlStr);

         if (docTitle)
    {
      if (*docTitle && W2T(docTitle))
           {
                  SetWindowText(W2T(docTitle));
           }
      nsMemory::Free(docTitle);
    }

         if (urlStr)
    {
      if (*urlStr && W2T(urlStr))
           {
             CWnd *pWnd = GetDlgItem(IDC_PRINT_PROGRESS_URL_TXT);
             if (pWnd)
        {
                    pWnd->SetWindowText(W2T(urlStr));
             }
      }
      nsMemory::Free(urlStr);
    }
  }
  Invalidate();
  UpdateWindow();
}

Definition at line 262 of file PrintProgressDialog.cpp.

{
  m_URL = _T(aTitle);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 60 of file PrintProgressDialog.h.

Definition at line 54 of file PrintProgressDialog.h.

Definition at line 61 of file PrintProgressDialog.h.

Definition at line 57 of file PrintProgressDialog.h.

Definition at line 52 of file PrintProgressDialog.h.

Definition at line 53 of file PrintProgressDialog.h.

Definition at line 59 of file PrintProgressDialog.h.

CString CPrintProgressDialog::m_URL [protected]

Definition at line 50 of file PrintProgressDialog.h.

Definition at line 51 of file PrintProgressDialog.h.

Definition at line 56 of file PrintProgressDialog.h.

CProgressCtrl CPrintProgressDialog::m_wndProgress [protected]

Definition at line 49 of file PrintProgressDialog.h.


The documentation for this class was generated from the following files: