|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
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 |
|
6 #include "nsPrintingPromptService.h" |
|
7 |
|
8 #include "nsCOMPtr.h" |
|
9 #include "nsServiceManagerUtils.h" |
|
10 #include "nsObjCExceptions.h" |
|
11 |
|
12 #include "nsIPrintingPromptService.h" |
|
13 #include "nsIFactory.h" |
|
14 #include "nsIPrintDialogService.h" |
|
15 |
|
16 //***************************************************************************** |
|
17 // nsPrintingPromptService |
|
18 //***************************************************************************** |
|
19 |
|
20 NS_IMPL_ISUPPORTS(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener) |
|
21 |
|
22 nsPrintingPromptService::nsPrintingPromptService() |
|
23 { |
|
24 } |
|
25 |
|
26 nsPrintingPromptService::~nsPrintingPromptService() |
|
27 { |
|
28 } |
|
29 |
|
30 nsresult nsPrintingPromptService::Init() |
|
31 { |
|
32 return NS_OK; |
|
33 } |
|
34 |
|
35 //***************************************************************************** |
|
36 // nsPrintingPromptService::nsIPrintingPromptService |
|
37 //***************************************************************************** |
|
38 |
|
39 NS_IMETHODIMP |
|
40 nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings) |
|
41 { |
|
42 NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |
|
43 |
|
44 nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService( |
|
45 NS_PRINTDIALOGSERVICE_CONTRACTID)); |
|
46 if (dlgPrint) |
|
47 return dlgPrint->Show(parent, printSettings, webBrowserPrint); |
|
48 |
|
49 return NS_ERROR_FAILURE; |
|
50 |
|
51 NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |
|
52 } |
|
53 |
|
54 NS_IMETHODIMP |
|
55 nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, |
|
56 nsIWebBrowserPrint* webBrowserPrint, // ok to be null |
|
57 nsIPrintSettings* printSettings, // ok to be null |
|
58 nsIObserver* openDialogObserver, // ok to be null |
|
59 bool isForPrinting, |
|
60 nsIWebProgressListener** webProgressListener, |
|
61 nsIPrintProgressParams** printProgressParams, |
|
62 bool* notifyOnOpen) |
|
63 { |
|
64 return NS_ERROR_NOT_IMPLEMENTED; |
|
65 } |
|
66 |
|
67 NS_IMETHODIMP |
|
68 nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs) |
|
69 { |
|
70 NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |
|
71 nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService( |
|
72 NS_PRINTDIALOGSERVICE_CONTRACTID)); |
|
73 if (dlgPrint) |
|
74 return dlgPrint->ShowPageSetup(parent, printSettings); |
|
75 |
|
76 return NS_ERROR_FAILURE; |
|
77 |
|
78 NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |
|
79 } |
|
80 |
|
81 NS_IMETHODIMP |
|
82 nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings) |
|
83 { |
|
84 return NS_ERROR_NOT_IMPLEMENTED; |
|
85 } |
|
86 |
|
87 |
|
88 //***************************************************************************** |
|
89 // nsPrintingPromptService::nsIWebProgressListener |
|
90 //***************************************************************************** |
|
91 |
|
92 NS_IMETHODIMP |
|
93 nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus) |
|
94 { |
|
95 return NS_OK; |
|
96 } |
|
97 |
|
98 /* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ |
|
99 NS_IMETHODIMP |
|
100 nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress) |
|
101 { |
|
102 return NS_OK; |
|
103 } |
|
104 |
|
105 /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */ |
|
106 NS_IMETHODIMP |
|
107 nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags) |
|
108 { |
|
109 return NS_OK; |
|
110 } |
|
111 |
|
112 /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ |
|
113 NS_IMETHODIMP |
|
114 nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) |
|
115 { |
|
116 return NS_OK; |
|
117 } |
|
118 |
|
119 /* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ |
|
120 NS_IMETHODIMP |
|
121 nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state) |
|
122 { |
|
123 return NS_OK; |
|
124 } |