nsIPrintingPromptService.idl 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* Doc interface here */
  6. #include "nsISupports.idl"
  7. #include "nsIWebBrowserPrint.idl"
  8. #include "nsIWebProgressListener.idl"
  9. #include "nsIPrintProgressParams.idl"
  10. #include "nsIPrintSettings.idl"
  11. #include "nsIObserver.idl"
  12. interface nsIDOMWindow;
  13. [scriptable, uuid(328daa3e-09e4-455f-bb6f-0a921766042f)]
  14. interface nsIPrintingPromptService : nsISupports
  15. {
  16. /**
  17. * This service enables embedders to implement their own Print and Progress Dialogs.
  18. * Each platform has a "base" or "basckstop" implementation of the service. The
  19. * service is automatically registered at start up.
  20. *
  21. * Historically, platform toolkits with native dialogs have implemented them in the GFX layer
  22. * Usually they were displayed when a new DeviceContextSpec specific to that platform
  23. * was created.
  24. *
  25. * Windows: The GFX layer no longers supports default toolkit behavior for displaying the
  26. * native Print Dialog.
  27. * If an embedder implemented service returns any error code (other than NS_ERROR_ABORT)
  28. * printing will terminate.
  29. *
  30. * Returning NS_OK assumes that the PrintSettings object was correctly filled in and
  31. * if it does not have valid fields for printer name, etc. it may also terminate.
  32. *
  33. * Defaults for platform service:
  34. * showPrintDialog - displays a native dialog
  35. * showPageSetup - displays a XUL dialog
  36. * showProgress - displays a XUL dialog
  37. * showPrinterProperties - n/a
  38. *
  39. * Summary for Windows Embedders:
  40. * Stated once again: There is no "fallback" native platform support in GFX for the
  41. * displaying of the native print dialog. The current default implementation for Windows
  42. * display a native print dialog but a XUL-based progress dialog.
  43. * If you wish to have a native progress dialog on Windows you will have to create and
  44. * register your own service.
  45. *
  46. * Note: The Windows version Mozilla implements this service which is
  47. * automatically built and registered for you. You can use it as an example.
  48. * It is located at "mozilla/embedding/components/printingui/win". That service
  49. * is capable of displaying a native print dialog and a XUL progress dialog.
  50. *
  51. * To fly your own dialog you may:
  52. *
  53. * 1) Implement this service to display at least the Print Dialog and a Print Progress Dialog
  54. * or you may implement just one of the dialogs and pass back NS_ERROR_NOT_IMPLEMENTED
  55. * for any of the others.
  56. *
  57. * 2) For the Print Dialog:
  58. * You may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED.
  59. * You can then fly you own dialog and then properly fill in the PrintSettings object
  60. * before calling nsIWebBrowserPrint's Print method. If you stub out this service
  61. * you MUST set "printSilent" to true, if you do not, Printing will terminate and an
  62. * error dialog will be displayed.
  63. *
  64. * Mac: The GFX layer still supports default toolkit behavior for displaying the Print Dialog.
  65. * If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog"
  66. * The toolkit will display the native print dialog.
  67. *
  68. * Defaults for platform service:
  69. * Mac OS9: showPrintDialog - displays a native dialog
  70. * showPageSetup - displays a native dialog
  71. * showProgress - displays a XUL dialog
  72. * showPrinterProperties - n/a
  73. *
  74. * Mac OSX: showPrintDialog - displays a native dialog
  75. * showPageSetup - displays a native dialog
  76. * showProgress - not implemented (provided by OS)
  77. * showPrinterProperties - n/a
  78. *
  79. * GTK: There are no native dialog for GTK.
  80. *
  81. * Defaults for platform service:
  82. * showPrintDialog - displays a XUL dialog
  83. * showPageSetup - displays a XUL dialog
  84. * showProgress - displays a XUL dialog
  85. * showPrinterProperties - displays a XUL dialog
  86. *
  87. */
  88. /**
  89. * Show the Print Dialog
  90. *
  91. * @param parent - a DOM windows the dialog will be parented to (required)
  92. * @param webBrowserPrint - represents the document to be printed (required)
  93. * @param printSettings - PrintSettings for print "job" (required)
  94. *
  95. */
  96. void showPrintDialog(in mozIDOMWindowProxy parent,
  97. in nsIWebBrowserPrint webBrowserPrint,
  98. in nsIPrintSettings printSettings);
  99. /**
  100. * Shows the print progress dialog
  101. *
  102. * @param parent - a DOM windows the dialog will be parented to
  103. * @param webBrowserPrint - represents the document to be printed
  104. * @param printSettings - PrintSettings for print "job"
  105. * @param openDialogObserver - an observer that will be notifed when the dialog is opened
  106. * @param isForPrinting - true - for printing, false for print preview
  107. * @param webProgressListener - additional listener can be registered for progress notifications
  108. * @param printProgressParams - parameter object for passing progress state
  109. * @param notifyOnOpen - this indicates that the observer will be notified when the progress
  110. * dialog has been opened. If false is returned it means the observer
  111. * (usually the caller) shouldn't wait
  112. * For Print Preview Progress there is intermediate progress
  113. */
  114. void showProgress(in mozIDOMWindowProxy parent,
  115. in nsIWebBrowserPrint webBrowserPrint,
  116. in nsIPrintSettings printSettings,
  117. in nsIObserver openDialogObserver,
  118. in boolean isForPrinting,
  119. out nsIWebProgressListener webProgressListener,
  120. out nsIPrintProgressParams printProgressParams,
  121. out boolean notifyOnOpen);
  122. /**
  123. * Shows the print progress dialog
  124. *
  125. * @param parent - a DOM windows the dialog will be parented to (required)
  126. * @param printSettings - PrintSettings for page setup (required)
  127. * @param aObs - An observer to know if the contents of the Print Settings
  128. * object has changed while the dialog is being shown.
  129. * For example, some platforms may implement an "Apply" button (not required)
  130. */
  131. void showPageSetup(in mozIDOMWindowProxy parent,
  132. in nsIPrintSettings printSettings,
  133. in nsIObserver aObs);
  134. /**
  135. * Sometimes platforms need to bring up a special properties dialog for showing
  136. * print specific properties. Although the PrintSettings has a place to set the
  137. * printer name, here is is an argument to be clear as to what printer is being
  138. * asked to have the properties set for it. The Printer name in the PS is ignored.
  139. *
  140. * @param parent - a DOM windows the dialog will be parented to (required)
  141. * @param printerName - name of printer (required)
  142. * @param printSettings - PrintSettings for page setup (required)
  143. */
  144. void showPrinterProperties(in mozIDOMWindowProxy parent,
  145. in wstring printerName,
  146. in nsIPrintSettings printSettings);
  147. };
  148. %{C++
  149. // {260FEDC5-524D-4aa6-9A41-E829F4C78B92}
  150. #define NS_PRINTINGPROMPTSERVICE_IID \
  151. {0x260fedc5, 0x524d, 0x4aa6, { 0x9a, 0x41, 0xe8, 0x29, 0xf4, 0xc7, 0x8b, 0x92}}
  152. %}