nsIDocumentViewerPrint.h (2443B)
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/. */ 6 7 #ifndef nsIDocumentViewerPrint_h___ 8 #define nsIDocumentViewerPrint_h___ 9 10 #include "nsISupports.h" 11 12 namespace mozilla { 13 class PresShell; 14 class ServoStyleSet; 15 } // namespace mozilla 16 class nsPresContext; 17 class nsViewManager; 18 19 // {c6f255cf-cadd-4382-b57f-cd2a9874169b} 20 #define NS_IDOCUMENT_VIEWER_PRINT_IID \ 21 {0xc6f255cf, 0xcadd, 0x4382, {0xb5, 0x7f, 0xcd, 0x2a, 0x98, 0x74, 0x16, 0x9b}} 22 23 /** 24 * A DocumentViewerPrint is an INTERNAL Interface used for interaction 25 * between the DocumentViewer and nsPrintJob. 26 */ 27 class nsIDocumentViewerPrint : public nsISupports { 28 public: 29 NS_INLINE_DECL_STATIC_IID(NS_IDOCUMENT_VIEWER_PRINT_IID) 30 31 virtual bool GetIsPrinting() const = 0; 32 33 virtual void SetIsPrintPreview(bool aIsPrintPreview) = 0; 34 virtual bool GetIsPrintPreview() const = 0; 35 36 /** 37 * This is used by nsPagePrintTimer to make nsDocumentViewer::Destroy() 38 * a no-op until printing is finished. That prevents the nsDocumentViewer 39 * and its document, presshell and prescontext from going away. 40 */ 41 virtual void IncrementDestroyBlockedCount() = 0; 42 virtual void DecrementDestroyBlockedCount() = 0; 43 44 virtual void OnDonePrinting() = 0; 45 46 /** 47 * Replaces the current presentation with print preview presentation. 48 */ 49 virtual void SetPrintPreviewPresentation(nsPresContext* aPresContext, 50 mozilla::PresShell* aPresShell) = 0; 51 }; 52 53 /* Use this macro when declaring classes that implement this interface. */ 54 #define NS_DECL_NSIDOCUMENTVIEWERPRINT \ 55 bool GetIsPrinting() const override; \ 56 void SetIsPrintPreview(bool aIsPrintPreview) override; \ 57 bool GetIsPrintPreview() const override; \ 58 void IncrementDestroyBlockedCount() override; \ 59 void DecrementDestroyBlockedCount() override; \ 60 void OnDonePrinting() override; \ 61 void SetPrintPreviewPresentation(nsPresContext* aPresContext, \ 62 mozilla::PresShell* aPresShell) override; 63 64 #endif /* nsIDocumentViewerPrint_h___ */