1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsPrintData_h___
7 #define nsPrintData_h___
9 #include "mozilla/Attributes.h"
12 #include "nsIDOMWindow.h"
13 #include "nsDeviceContext.h"
14 #include "nsIPrintProgressParams.h"
15 #include "nsIPrintOptions.h"
17 #include "nsCOMArray.h"
18 #include "nsAutoPtr.h"
22 class nsPrintPreviewListener
;
23 class nsIWebProgressListener
;
25 //------------------------------------------------------------------------
28 // mPreparingForPrint - indicates that we have started Printing but
29 // have not gone to the timer to start printing the pages. It gets turned
30 // off right before we go to the timer.
32 // mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document
33 // while we were prparing to Print. This typically happens if a user starts
34 // to print while a page is still loading. If they start printing and pause
35 // at the print dialog and then the page comes in, we then abort printing
36 // because the document is no longer stable.
38 //------------------------------------------------------------------------
42 typedef enum {eIsPrinting
, eIsPrintPreview
} ePrintDataType
;
44 explicit nsPrintData(ePrintDataType aType
);
45 ~nsPrintData(); // non-virtual
47 // Listener Helper Methods
49 void OnStartPrinting();
50 void DoOnProgressChange(int32_t aProgress
,
56 ePrintDataType mType
; // the type of data this is (Printing or Print Preview)
57 nsRefPtr
<nsDeviceContext
> mPrintDC
;
58 FILE *mDebugFilePtr
; // a file where information can go to when printing
60 nsPrintObject
* mPrintObject
;
61 nsPrintObject
* mSelectedPO
;
63 nsCOMArray
<nsIWebProgressListener
> mPrintProgressListeners
;
64 nsCOMPtr
<nsIPrintProgressParams
> mPrintProgressParams
;
66 nsCOMPtr
<nsIDOMWindow
> mCurrentFocusWin
; // cache a pointer to the currently focused window
68 nsTArray
<nsPrintObject
*> mPrintDocList
;
69 bool mIsIFrameSelected
;
70 bool mIsParentAFrameSet
;
72 bool mIsAborted
; // tells us the document is being aborted
73 bool mPreparingForPrint
; // see comments above
74 bool mDocWasToBeDestroyed
; // see comments above
76 int16_t mPrintFrameType
;
77 int32_t mNumPrintablePages
;
78 int32_t mNumPagesPrinted
;
82 nsCOMPtr
<nsIPrintSettings
> mPrintSettings
;
83 nsPrintPreviewListener
* mPPEventListeners
;
85 char16_t
* mBrandName
; // needed as a substitute name for a document
88 nsPrintData() MOZ_DELETE
;
89 nsPrintData
& operator=(const nsPrintData
& aOther
) MOZ_DELETE
;
93 #endif /* nsPrintData_h___ */