CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / layout / printing / nsPrintData.h
blob97dfb4f468d84b5096bb54a6a9b9142d95fa92b3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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
13 * License.
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.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 #ifndef nsPrintData_h___
38 #define nsPrintData_h___
40 // Interfaces
41 #include "nsIDOMWindow.h"
42 #include "nsIDeviceContext.h"
43 #include "nsIPrintProgressParams.h"
44 #include "nsIPrintOptions.h"
45 #include "nsTArray.h"
46 #include "nsCOMArray.h"
47 #include "nsAutoPtr.h"
49 // Classes
50 class nsPrintObject;
51 class nsPrintPreviewListener;
52 class nsIWebProgressListener;
54 //------------------------------------------------------------------------
55 // nsPrintData Class
57 // mPreparingForPrint - indicates that we have started Printing but
58 // have not gone to the timer to start printing the pages. It gets turned
59 // off right before we go to the timer.
61 // mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document
62 // while we were prparing to Print. This typically happens if a user starts
63 // to print while a page is still loading. If they start printing and pause
64 // at the print dialog and then the page comes in, we then abort printing
65 // because the document is no longer stable.
66 //
67 //------------------------------------------------------------------------
68 class nsPrintData {
69 public:
71 typedef enum {eIsPrinting, eIsPrintPreview } ePrintDataType;
73 // This enum tells indicates what the default should be for the title
74 // if the title from the document is null
75 enum eDocTitleDefault {
76 eDocTitleDefNone,
77 eDocTitleDefBlank,
78 eDocTitleDefURLDoc
82 nsPrintData(ePrintDataType aType);
83 ~nsPrintData(); // non-virtual
85 // Listener Helper Methods
86 void OnEndPrinting();
87 void OnStartPrinting();
88 void DoOnProgressChange(PRInt32 aProgess,
89 PRInt32 aMaxProgress,
90 PRBool aDoStartStop,
91 PRInt32 aFlag);
94 ePrintDataType mType; // the type of data this is (Printing or Print Preview)
95 nsCOMPtr<nsIDeviceContext> mPrintDC;
96 FILE *mDebugFilePtr; // a file where information can go to when printing
98 nsPrintObject * mPrintObject;
99 nsPrintObject * mSelectedPO;
101 nsCOMArray<nsIWebProgressListener> mPrintProgressListeners;
102 nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams;
104 nsCOMPtr<nsIDOMWindow> mCurrentFocusWin; // cache a pointer to the currently focused window
106 nsTArray<nsPrintObject*> mPrintDocList;
107 PRPackedBool mIsIFrameSelected;
108 PRPackedBool mIsParentAFrameSet;
109 PRPackedBool mOnStartSent;
110 PRPackedBool mIsAborted; // tells us the document is being aborted
111 PRPackedBool mPreparingForPrint; // see comments above
112 PRPackedBool mDocWasToBeDestroyed; // see comments above
113 PRBool mShrinkToFit;
114 PRInt16 mPrintFrameType;
115 PRInt32 mNumPrintablePages;
116 PRInt32 mNumPagesPrinted;
117 float mShrinkRatio;
118 float mOrigDCScale;
120 nsCOMPtr<nsIPrintSettings> mPrintSettings;
121 nsPrintPreviewListener* mPPEventListeners;
123 PRUnichar* mBrandName; // needed as a substitute name for a document
125 private:
126 nsPrintData(); //not implemented
127 nsPrintData& operator=(const nsPrintData& aOther); // not implemented
131 #endif /* nsPrintData_h___ */