2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-12-16 23:42:07 +04:00
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
#ifndef nsPrintData_h___
|
|
|
|
#define nsPrintData_h___
|
|
|
|
|
2011-12-16 23:42:07 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-03-06 11:28:20 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2011-12-16 23:42:07 +04:00
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
// Interfaces
|
2011-04-17 05:22:44 +04:00
|
|
|
#include "nsDeviceContext.h"
|
2002-08-21 16:01:05 +04:00
|
|
|
#include "nsIPrintProgressParams.h"
|
2016-10-28 02:31:14 +03:00
|
|
|
#include "nsIPrintSettings.h"
|
2017-05-09 11:08:20 +03:00
|
|
|
#include "nsISupportsImpl.h"
|
2009-02-03 17:42:18 +03:00
|
|
|
#include "nsTArray.h"
|
2006-12-10 11:05:05 +03:00
|
|
|
#include "nsCOMArray.h"
|
2002-08-21 16:01:05 +04:00
|
|
|
|
|
|
|
// Classes
|
2006-12-10 11:05:05 +03:00
|
|
|
class nsPrintObject;
|
|
|
|
class nsPrintPreviewListener;
|
|
|
|
class nsIWebProgressListener;
|
2002-08-21 16:01:05 +04:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// nsPrintData Class
|
|
|
|
//
|
2017-03-06 10:35:39 +03:00
|
|
|
// mPreparingForPrint - indicates that we have started Printing but
|
|
|
|
// have not gone to the timer to start printing the pages. It gets turned
|
2002-08-21 16:01:05 +04:00
|
|
|
// off right before we go to the timer.
|
|
|
|
//
|
|
|
|
// mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document
|
2017-03-06 10:35:39 +03:00
|
|
|
// while we were prparing to Print. This typically happens if a user starts
|
|
|
|
// to print while a page is still loading. If they start printing and pause
|
|
|
|
// at the print dialog and then the page comes in, we then abort printing
|
2002-08-21 16:01:05 +04:00
|
|
|
// because the document is no longer stable.
|
2017-03-06 10:35:39 +03:00
|
|
|
//
|
2002-08-21 16:01:05 +04:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
class nsPrintData {
|
|
|
|
public:
|
|
|
|
typedef enum { eIsPrinting, eIsPrintPreview } ePrintDataType;
|
|
|
|
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit nsPrintData(ePrintDataType aType);
|
2017-05-09 11:08:20 +03:00
|
|
|
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsPrintData)
|
2002-08-21 16:01:05 +04:00
|
|
|
|
|
|
|
// Listener Helper Methods
|
|
|
|
void OnEndPrinting();
|
|
|
|
void OnStartPrinting();
|
2012-08-22 19:56:38 +04:00
|
|
|
void DoOnProgressChange(int32_t aProgress, int32_t aMaxProgress,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDoStartStop, int32_t aFlag);
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2016-05-16 12:40:54 +03:00
|
|
|
void DoOnStatusChange(nsresult aStatus);
|
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
ePrintDataType mType; // the type of data this is (Printing or Print Preview)
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDeviceContext> mPrintDC;
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2017-03-06 11:28:20 +03:00
|
|
|
mozilla::UniquePtr<nsPrintObject> mPrintObject;
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2006-12-10 11:05:05 +03:00
|
|
|
nsCOMArray<nsIWebProgressListener> mPrintProgressListeners;
|
2002-08-21 16:01:05 +04:00
|
|
|
nsCOMPtr<nsIPrintProgressParams> mPrintProgressParams;
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowOuter>
|
|
|
|
mCurrentFocusWin; // cache a pointer to the currently focused window
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2017-03-06 11:28:20 +03:00
|
|
|
// Array of non-owning pointers to all the nsPrintObjects owned by this
|
|
|
|
// nsPrintData. This includes this->mPrintObject, as well as all of its
|
|
|
|
// mKids (and their mKids, etc.)
|
2009-02-03 17:42:18 +03:00
|
|
|
nsTArray<nsPrintObject*> mPrintDocList;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsIFrameSelected;
|
|
|
|
bool mIsParentAFrameSet;
|
|
|
|
bool mOnStartSent;
|
|
|
|
bool mIsAborted; // tells us the document is being aborted
|
|
|
|
bool mPreparingForPrint; // see comments above
|
|
|
|
bool mDocWasToBeDestroyed; // see comments above
|
|
|
|
bool mShrinkToFit;
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t mPrintFrameType;
|
|
|
|
int32_t mNumPrintablePages;
|
|
|
|
int32_t mNumPagesPrinted;
|
2002-08-21 16:01:05 +04:00
|
|
|
float mShrinkRatio;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
|
|
|
nsPrintPreviewListener* mPPEventListeners;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-08-04 07:40:52 +03:00
|
|
|
nsString mBrandName; // needed as a substitute name for a document
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
private:
|
2015-01-07 02:35:02 +03:00
|
|
|
nsPrintData() = delete;
|
|
|
|
nsPrintData& operator=(const nsPrintData& aOther) = delete;
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2017-05-09 11:08:20 +03:00
|
|
|
~nsPrintData(); // non-virtual
|
2002-08-21 16:01:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPrintData_h___ */
|