Bug 1763869 [wpt PR 33577] - Fix adb command to find webview package, a=testonly
[gecko.git] / layout / printing / nsPrintData.h
blob88ad256ea2658be3c9b42aa5d86301bae9f46850
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsPrintData_h___
8 #define nsPrintData_h___
10 #include "mozilla/Attributes.h"
11 #include "mozilla/UniquePtr.h"
13 // Interfaces
14 #include "nsDeviceContext.h"
15 #include "nsIPrintSettings.h"
16 #include "nsISupportsImpl.h"
17 #include "nsTArray.h"
18 #include "nsCOMArray.h"
20 class nsPrintObject;
21 class nsIWebProgressListener;
23 //------------------------------------------------------------------------
24 // nsPrintData Class
26 // mPreparingForPrint - indicates that we have started Printing but
27 // have not gone to the timer to start printing the pages. It gets turned
28 // off right before we go to the timer.
29 //------------------------------------------------------------------------
30 class nsPrintData {
31 public:
32 typedef enum { eIsPrinting, eIsPrintPreview } ePrintDataType;
34 explicit nsPrintData(ePrintDataType aType);
36 NS_INLINE_DECL_REFCOUNTING(nsPrintData)
38 // Listener Helper Methods
39 void OnEndPrinting();
40 void OnStartPrinting();
41 void DoOnProgressChange(int32_t aProgress, int32_t aMaxProgress,
42 bool aDoStartStop, int32_t aFlag);
44 void DoOnStatusChange(nsresult aStatus);
46 ePrintDataType mType; // the type of data this is (Printing or Print Preview)
47 RefPtr<nsDeviceContext> mPrintDC;
49 mozilla::UniquePtr<nsPrintObject> mPrintObject;
51 nsCOMArray<nsIWebProgressListener> mPrintProgressListeners;
53 // If there is a focused iframe, mSelectionRoot is set to its nsPrintObject.
54 // Otherwise, if there is a selection, it is set to the root nsPrintObject.
55 // Otherwise, it is unset.
56 nsPrintObject* mSelectionRoot = nullptr;
58 // Array of non-owning pointers to all the nsPrintObjects owned by this
59 // nsPrintData. This includes this->mPrintObject, as well as all of its
60 // mKids (and their mKids, etc.)
61 nsTArray<nsPrintObject*> mPrintDocList;
63 bool mIsParentAFrameSet;
64 bool mOnStartSent;
65 bool mIsAborted; // tells us the document is being aborted
66 bool mPreparingForPrint; // see comments above
67 bool mShrinkToFit;
68 int32_t mNumPrintablePages;
69 float mShrinkRatio;
71 nsCOMPtr<nsIPrintSettings> mPrintSettings;
73 private:
74 nsPrintData() = delete;
75 nsPrintData& operator=(const nsPrintData& aOther) = delete;
77 ~nsPrintData(); // non-virtual
80 #endif /* nsPrintData_h___ */