1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/printing/nsPrintData.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsPrintData_h___ 1.10 +#define nsPrintData_h___ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 + 1.14 +// Interfaces 1.15 +#include "nsIDOMWindow.h" 1.16 +#include "nsDeviceContext.h" 1.17 +#include "nsIPrintProgressParams.h" 1.18 +#include "nsIPrintOptions.h" 1.19 +#include "nsTArray.h" 1.20 +#include "nsCOMArray.h" 1.21 +#include "nsAutoPtr.h" 1.22 + 1.23 +// Classes 1.24 +class nsPrintObject; 1.25 +class nsPrintPreviewListener; 1.26 +class nsIWebProgressListener; 1.27 + 1.28 +//------------------------------------------------------------------------ 1.29 +// nsPrintData Class 1.30 +// 1.31 +// mPreparingForPrint - indicates that we have started Printing but 1.32 +// have not gone to the timer to start printing the pages. It gets turned 1.33 +// off right before we go to the timer. 1.34 +// 1.35 +// mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document 1.36 +// while we were prparing to Print. This typically happens if a user starts 1.37 +// to print while a page is still loading. If they start printing and pause 1.38 +// at the print dialog and then the page comes in, we then abort printing 1.39 +// because the document is no longer stable. 1.40 +// 1.41 +//------------------------------------------------------------------------ 1.42 +class nsPrintData { 1.43 +public: 1.44 + 1.45 + typedef enum {eIsPrinting, eIsPrintPreview } ePrintDataType; 1.46 + 1.47 + nsPrintData(ePrintDataType aType); 1.48 + ~nsPrintData(); // non-virtual 1.49 + 1.50 + // Listener Helper Methods 1.51 + void OnEndPrinting(); 1.52 + void OnStartPrinting(); 1.53 + void DoOnProgressChange(int32_t aProgress, 1.54 + int32_t aMaxProgress, 1.55 + bool aDoStartStop, 1.56 + int32_t aFlag); 1.57 + 1.58 + 1.59 + ePrintDataType mType; // the type of data this is (Printing or Print Preview) 1.60 + nsRefPtr<nsDeviceContext> mPrintDC; 1.61 + FILE *mDebugFilePtr; // a file where information can go to when printing 1.62 + 1.63 + nsPrintObject * mPrintObject; 1.64 + nsPrintObject * mSelectedPO; 1.65 + 1.66 + nsCOMArray<nsIWebProgressListener> mPrintProgressListeners; 1.67 + nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams; 1.68 + 1.69 + nsCOMPtr<nsIDOMWindow> mCurrentFocusWin; // cache a pointer to the currently focused window 1.70 + 1.71 + nsTArray<nsPrintObject*> mPrintDocList; 1.72 + bool mIsIFrameSelected; 1.73 + bool mIsParentAFrameSet; 1.74 + bool mOnStartSent; 1.75 + bool mIsAborted; // tells us the document is being aborted 1.76 + bool mPreparingForPrint; // see comments above 1.77 + bool mDocWasToBeDestroyed; // see comments above 1.78 + bool mShrinkToFit; 1.79 + int16_t mPrintFrameType; 1.80 + int32_t mNumPrintablePages; 1.81 + int32_t mNumPagesPrinted; 1.82 + float mShrinkRatio; 1.83 + float mOrigDCScale; 1.84 + 1.85 + nsCOMPtr<nsIPrintSettings> mPrintSettings; 1.86 + nsPrintPreviewListener* mPPEventListeners; 1.87 + 1.88 + char16_t* mBrandName; // needed as a substitute name for a document 1.89 + 1.90 +private: 1.91 + nsPrintData() MOZ_DELETE; 1.92 + nsPrintData& operator=(const nsPrintData& aOther) MOZ_DELETE; 1.93 + 1.94 +}; 1.95 + 1.96 +#endif /* nsPrintData_h___ */ 1.97 +