nsIWebBrowserPrint.idl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  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. #include "nsISupports.idl"
  7. interface mozIDOMWindowProxy;
  8. interface nsIPrintSettings;
  9. interface nsIWebProgressListener;
  10. /**
  11. * nsIWebBrowserPrint corresponds to the main interface
  12. * for printing an embedded Gecko web browser window/document
  13. */
  14. [scriptable, uuid(c9a934ed-fff1-4971-bfba-6c25ad70e1e6)]
  15. interface nsIWebBrowserPrint : nsISupports
  16. {
  17. /**
  18. * PrintPreview Navigation Constants
  19. */
  20. const short PRINTPREVIEW_GOTO_PAGENUM = 0;
  21. const short PRINTPREVIEW_PREV_PAGE = 1;
  22. const short PRINTPREVIEW_NEXT_PAGE = 2;
  23. const short PRINTPREVIEW_HOME = 3;
  24. const short PRINTPREVIEW_END = 4;
  25. /**
  26. * Returns a "global" PrintSettings object
  27. * Creates a new the first time, if one doesn't exist.
  28. *
  29. * Then returns the same object each time after that.
  30. *
  31. * Initializes the globalPrintSettings from the default printer
  32. */
  33. readonly attribute nsIPrintSettings globalPrintSettings;
  34. /**
  35. * Returns a pointer to the PrintSettings object that
  36. * that was passed into either "print" or "print preview"
  37. *
  38. * This enables any consumers of the interface to have access
  39. * to the "current" PrintSetting at later points in the execution
  40. */
  41. readonly attribute nsIPrintSettings currentPrintSettings;
  42. /**
  43. * Returns a pointer to the current child DOMWindow
  44. * that is being print previewed. (FrameSet Frames)
  45. *
  46. * Returns null if parent document is not a frameset or the entire FrameSet
  47. * document is being print previewed
  48. *
  49. * This enables any consumers of the interface to have access
  50. * to the "current" child DOMWindow at later points in the execution
  51. */
  52. readonly attribute mozIDOMWindowProxy currentChildDOMWindow;
  53. /**
  54. * Returns whether it is in Print mode
  55. */
  56. readonly attribute boolean doingPrint;
  57. /**
  58. * Returns whether it is in Print Preview mode
  59. */
  60. readonly attribute boolean doingPrintPreview;
  61. /**
  62. * This returns whether the current document is a frameset document
  63. */
  64. readonly attribute boolean isFramesetDocument;
  65. /**
  66. * This returns whether the current document is a frameset document
  67. */
  68. readonly attribute boolean isFramesetFrameSelected;
  69. /**
  70. * This returns whether there is an IFrame selected
  71. */
  72. readonly attribute boolean isIFrameSelected;
  73. /**
  74. * This returns whether there is a "range" selection
  75. */
  76. readonly attribute boolean isRangeSelection;
  77. /**
  78. * This returns the total number of pages for the Print Preview
  79. */
  80. readonly attribute long printPreviewNumPages;
  81. /**
  82. * Print the specified DOM window
  83. *
  84. * @param aThePrintSettings - Printer Settings for the print job, if aThePrintSettings is null
  85. * then the global PS will be used.
  86. * @param aWPListener - is updated during the print
  87. * @return void
  88. */
  89. void print(in nsIPrintSettings aThePrintSettings,
  90. in nsIWebProgressListener aWPListener);
  91. /**
  92. * Print Preview the specified DOM window
  93. *
  94. * @param aThePrintSettings - Printer Settings for the print preview, if aThePrintSettings is null
  95. * then the global PS will be used.
  96. * @param aChildDOMWin - DOM Window to be print previewed.
  97. * @param aWPListener - is updated during the printpreview
  98. * @return void
  99. */
  100. void printPreview(in nsIPrintSettings aThePrintSettings,
  101. in mozIDOMWindowProxy aChildDOMWin,
  102. in nsIWebProgressListener aWPListener);
  103. /**
  104. * Print Preview - Navigates within the window
  105. *
  106. * @param aNavType - navigation enum
  107. * @param aPageNum - page num to navigate to when aNavType = ePrintPreviewGoToPageNum
  108. * @return void
  109. */
  110. void printPreviewNavigate(in short aNavType, in long aPageNum);
  111. /**
  112. * Cancels the current print
  113. * @return void
  114. */
  115. void cancel();
  116. /**
  117. * Returns an array of the names of all documents names (Title or URL)
  118. * and sub-documents. This will return a single item if the attr "isFramesetDocument" is false
  119. * and may return any number of items is "isFramesetDocument" is true
  120. *
  121. * @param aCount - returns number of printers returned
  122. * @param aResult - returns array of names
  123. * @return void
  124. */
  125. void enumerateDocumentNames(out uint32_t aCount,[retval, array, size_is(aCount)] out wstring aResult);
  126. /**
  127. * This exists PrintPreview mode and returns browser window to galley mode
  128. * @return void
  129. */
  130. void exitPrintPreview();
  131. };