Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsPrintData_h___ |
michael@0 | 7 | #define nsPrintData_h___ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | |
michael@0 | 11 | // Interfaces |
michael@0 | 12 | #include "nsIDOMWindow.h" |
michael@0 | 13 | #include "nsDeviceContext.h" |
michael@0 | 14 | #include "nsIPrintProgressParams.h" |
michael@0 | 15 | #include "nsIPrintOptions.h" |
michael@0 | 16 | #include "nsTArray.h" |
michael@0 | 17 | #include "nsCOMArray.h" |
michael@0 | 18 | #include "nsAutoPtr.h" |
michael@0 | 19 | |
michael@0 | 20 | // Classes |
michael@0 | 21 | class nsPrintObject; |
michael@0 | 22 | class nsPrintPreviewListener; |
michael@0 | 23 | class nsIWebProgressListener; |
michael@0 | 24 | |
michael@0 | 25 | //------------------------------------------------------------------------ |
michael@0 | 26 | // nsPrintData Class |
michael@0 | 27 | // |
michael@0 | 28 | // mPreparingForPrint - indicates that we have started Printing but |
michael@0 | 29 | // have not gone to the timer to start printing the pages. It gets turned |
michael@0 | 30 | // off right before we go to the timer. |
michael@0 | 31 | // |
michael@0 | 32 | // mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document |
michael@0 | 33 | // while we were prparing to Print. This typically happens if a user starts |
michael@0 | 34 | // to print while a page is still loading. If they start printing and pause |
michael@0 | 35 | // at the print dialog and then the page comes in, we then abort printing |
michael@0 | 36 | // because the document is no longer stable. |
michael@0 | 37 | // |
michael@0 | 38 | //------------------------------------------------------------------------ |
michael@0 | 39 | class nsPrintData { |
michael@0 | 40 | public: |
michael@0 | 41 | |
michael@0 | 42 | typedef enum {eIsPrinting, eIsPrintPreview } ePrintDataType; |
michael@0 | 43 | |
michael@0 | 44 | nsPrintData(ePrintDataType aType); |
michael@0 | 45 | ~nsPrintData(); // non-virtual |
michael@0 | 46 | |
michael@0 | 47 | // Listener Helper Methods |
michael@0 | 48 | void OnEndPrinting(); |
michael@0 | 49 | void OnStartPrinting(); |
michael@0 | 50 | void DoOnProgressChange(int32_t aProgress, |
michael@0 | 51 | int32_t aMaxProgress, |
michael@0 | 52 | bool aDoStartStop, |
michael@0 | 53 | int32_t aFlag); |
michael@0 | 54 | |
michael@0 | 55 | |
michael@0 | 56 | ePrintDataType mType; // the type of data this is (Printing or Print Preview) |
michael@0 | 57 | nsRefPtr<nsDeviceContext> mPrintDC; |
michael@0 | 58 | FILE *mDebugFilePtr; // a file where information can go to when printing |
michael@0 | 59 | |
michael@0 | 60 | nsPrintObject * mPrintObject; |
michael@0 | 61 | nsPrintObject * mSelectedPO; |
michael@0 | 62 | |
michael@0 | 63 | nsCOMArray<nsIWebProgressListener> mPrintProgressListeners; |
michael@0 | 64 | nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams; |
michael@0 | 65 | |
michael@0 | 66 | nsCOMPtr<nsIDOMWindow> mCurrentFocusWin; // cache a pointer to the currently focused window |
michael@0 | 67 | |
michael@0 | 68 | nsTArray<nsPrintObject*> mPrintDocList; |
michael@0 | 69 | bool mIsIFrameSelected; |
michael@0 | 70 | bool mIsParentAFrameSet; |
michael@0 | 71 | bool mOnStartSent; |
michael@0 | 72 | bool mIsAborted; // tells us the document is being aborted |
michael@0 | 73 | bool mPreparingForPrint; // see comments above |
michael@0 | 74 | bool mDocWasToBeDestroyed; // see comments above |
michael@0 | 75 | bool mShrinkToFit; |
michael@0 | 76 | int16_t mPrintFrameType; |
michael@0 | 77 | int32_t mNumPrintablePages; |
michael@0 | 78 | int32_t mNumPagesPrinted; |
michael@0 | 79 | float mShrinkRatio; |
michael@0 | 80 | float mOrigDCScale; |
michael@0 | 81 | |
michael@0 | 82 | nsCOMPtr<nsIPrintSettings> mPrintSettings; |
michael@0 | 83 | nsPrintPreviewListener* mPPEventListeners; |
michael@0 | 84 | |
michael@0 | 85 | char16_t* mBrandName; // needed as a substitute name for a document |
michael@0 | 86 | |
michael@0 | 87 | private: |
michael@0 | 88 | nsPrintData() MOZ_DELETE; |
michael@0 | 89 | nsPrintData& operator=(const nsPrintData& aOther) MOZ_DELETE; |
michael@0 | 90 | |
michael@0 | 91 | }; |
michael@0 | 92 | |
michael@0 | 93 | #endif /* nsPrintData_h___ */ |
michael@0 | 94 |