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/. */
|
2002-08-21 16:01:05 +04:00
|
|
|
#ifndef nsPrintObject_h___
|
|
|
|
#define nsPrintObject_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
|
|
|
|
#include "nsCOMPtr.h"
|
2013-01-05 07:12:24 +04:00
|
|
|
#include "nsViewManager.h"
|
2002-08-21 16:01:05 +04:00
|
|
|
#include "nsIDocShell.h"
|
2010-11-11 00:15:21 +03:00
|
|
|
#include "nsIDocShellTreeOwner.h"
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2013-03-22 04:05:20 +04:00
|
|
|
class nsIContent;
|
2010-04-11 00:10:12 +04:00
|
|
|
class nsPresContext;
|
|
|
|
|
2019-04-16 10:25:10 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class PresShell;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
// nsPrintObject Document Type
|
|
|
|
enum PrintObjectType { eDoc = 0, eFrame = 1, eIFrame = 2, eFrameSet = 3 };
|
|
|
|
|
|
|
|
//---------------------------------------------------
|
|
|
|
//-- nsPrintObject Class
|
|
|
|
//---------------------------------------------------
|
|
|
|
class nsPrintObject {
|
|
|
|
public:
|
|
|
|
nsPrintObject();
|
|
|
|
~nsPrintObject(); // non-virtual
|
|
|
|
|
2019-05-28 14:48:21 +03:00
|
|
|
nsresult InitAsRootObject(nsIDocShell* aDocShell,
|
|
|
|
mozilla::dom::Document* aDoc,
|
|
|
|
bool aForPrintPreview);
|
|
|
|
nsresult InitAsNestedObject(nsIDocShell* aDocShell,
|
|
|
|
mozilla::dom::Document* aDoc,
|
2019-05-28 17:26:59 +03:00
|
|
|
nsPrintObject* aParent);
|
2002-08-21 16:01:05 +04:00
|
|
|
|
|
|
|
void DestroyPresentation();
|
|
|
|
|
2020-05-22 12:57:12 +03:00
|
|
|
/**
|
|
|
|
* Recursively sets all the PO items to be printed
|
|
|
|
* from the given item down into the tree
|
|
|
|
*/
|
|
|
|
void EnablePrinting(bool aEnable);
|
2020-08-03 17:23:56 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Recursively sets all the PO items to be printed if they have a selection.
|
|
|
|
*/
|
|
|
|
void EnablePrintingSelectionOnly();
|
|
|
|
|
2020-05-31 22:00:42 +03:00
|
|
|
bool PrintingIsEnabled() const { return mPrintingIsEnabled; }
|
2020-05-22 12:57:12 +03:00
|
|
|
|
2020-08-13 14:11:35 +03:00
|
|
|
bool HasSelection() const;
|
|
|
|
|
2002-08-21 16:01:05 +04:00
|
|
|
// Data Members
|
|
|
|
nsCOMPtr<nsIDocShell> mDocShell;
|
2010-11-11 00:15:21 +03:00
|
|
|
nsCOMPtr<nsIDocShellTreeOwner> mTreeOwner;
|
2019-01-02 16:05:23 +03:00
|
|
|
RefPtr<mozilla::dom::Document> mDocument;
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPresContext> mPresContext;
|
2019-04-16 10:25:10 +03:00
|
|
|
RefPtr<mozilla::PresShell> mPresShell;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsViewManager> mViewManager;
|
2002-08-21 16:01:05 +04:00
|
|
|
|
2009-12-11 07:02:13 +03:00
|
|
|
nsCOMPtr<nsIContent> mContent;
|
2006-03-30 04:27:42 +04:00
|
|
|
PrintObjectType mFrameType;
|
2017-03-06 10:35:39 +03:00
|
|
|
|
2017-03-06 11:28:20 +03:00
|
|
|
nsTArray<mozilla::UniquePtr<nsPrintObject>> mKids;
|
|
|
|
nsPrintObject* mParent; // This is a non-owning pointer.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasBeenPrinted;
|
|
|
|
bool mInvisible; // Indicates PO is set to not visible by CSS
|
|
|
|
bool mDidCreateDocShell;
|
2002-08-21 16:01:05 +04:00
|
|
|
float mShrinkRatio;
|
2007-02-07 10:46:44 +03:00
|
|
|
float mZoomRatio;
|
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
|
|
|
nsPrintObject& operator=(const nsPrintObject& aOther) = delete;
|
2020-05-31 22:00:42 +03:00
|
|
|
|
|
|
|
bool mPrintingIsEnabled = false;
|
2002-08-21 16:01:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPrintObject_h___ */
|