Back to index

lightning-sunbird  0.9+nobinonly
nsPrintingPromptServiceX.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Rod Spears <rods@netscape.com>
00024  *   Conrad Carlen <ccarlen@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsPrintingPromptService.h"
00041 
00042 #include "nsCOMPtr.h"
00043 
00044 #include "nsIPrintingPromptService.h"
00045 #include "nsIFactory.h"
00046 #include "nsIDOMWindow.h"
00047 #include "nsReadableUtils.h"
00048 #include "nsIEmbeddingSiteWindow.h"
00049 #include "nsIServiceManager.h"
00050 #include "nsIWebBrowserChrome.h"
00051 #include "nsIWindowWatcher.h"
00052 #include "nsIPrintSettingsX.h"
00053 #include "nsIDirectoryService.h"
00054 #include "nsDirectoryServiceDefs.h"
00055 #include "nsAutoBuffer.h"
00056 #include "nsCRT.h"
00057 
00058 #include "nsPDECommon.h"
00059 
00060 // Printing Progress Includes
00061 #include "nsPrintProgress.h"
00062 #include "nsPrintProgressParams.h"
00063 #include "nsIWebProgressListener.h"
00064 
00065 // OS includes
00066 #include <PMApplication.h>
00067 #include <CFPlugIn.h>
00068 
00069 //-----------------------------------------------------------------------------
00070 // Static Helpers
00071 //-----------------------------------------------------------------------------
00072 
00073 static nsresult LoadPDEPlugIn()
00074 {
00075     static CFPlugInRef gPDEPlugIn = nsnull;
00076 
00077     if (!gPDEPlugIn) {
00078 
00079         CFURLRef pluginsURL = ::CFBundleCopyBuiltInPlugInsURL(CFBundleGetMainBundle());
00080         if (pluginsURL) {
00081             CFURLRef thePluginURL = ::CFURLCreateCopyAppendingPathComponent(nsnull,
00082                                                                           pluginsURL,
00083                                                                           CFSTR("PrintPDE.plugin"),
00084                                                                           PR_FALSE);
00085             if (thePluginURL) {
00086                 gPDEPlugIn = ::CFPlugInCreate(nsnull, thePluginURL);
00087                 ::CFRelease(thePluginURL);
00088             }
00089             ::CFRelease(pluginsURL);
00090         }
00091     }
00092     return gPDEPlugIn ? NS_OK : NS_ERROR_FAILURE;
00093 }
00094 
00095 static CFDictionaryRef ExtractCustomSettingsDict(PMPrintSettings nativePrintSettings)
00096 {
00097     CFDictionaryRef resultDict = nsnull;
00098     UInt32 bytesNeeded;
00099     
00100     OSStatus status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kAppPrintDialogAppOnlyKey, &bytesNeeded, NULL);
00101     if (status == noErr) {
00102         nsAutoBuffer<UInt8, 512> dataBuffer;
00103         if (dataBuffer.EnsureElemCapacity(bytesNeeded)) {           
00104             status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kAppPrintDialogAppOnlyKey, &bytesNeeded, dataBuffer.get());
00105             if (status == noErr) {
00106                 CFDataRef xmlData = ::CFDataCreate(kCFAllocatorDefault, dataBuffer.get(), bytesNeeded);
00107                 if (xmlData) {
00108                     resultDict = (CFDictionaryRef)::CFPropertyListCreateFromXMLData(
00109                                                         kCFAllocatorDefault,
00110                                                         xmlData,
00111                                                         kCFPropertyListImmutable,
00112                                                         NULL);
00113                     CFRelease(xmlData);
00114                 }
00115             }
00116         }
00117     }
00118     NS_ASSERTION(resultDict, "Failed to get custom print settings dict");
00119     return resultDict;
00120 }
00121 
00122 static PRBool
00123 GetDictionaryStringValue(CFDictionaryRef aDictionary, CFStringRef aKey, nsAString& aResult)
00124 {
00125     aResult.Truncate();
00126     CFTypeRef dictValue;
00127     if ((dictValue = CFDictionaryGetValue(aDictionary, aKey)) &&
00128         (CFGetTypeID(dictValue) == CFStringGetTypeID()))
00129     {
00130         CFIndex stringLen = CFStringGetLength((CFStringRef)dictValue);
00131 
00132         nsAutoBuffer<UniChar, 256> stringBuffer;
00133         if (stringBuffer.EnsureElemCapacity(stringLen + 1)) {
00134             ::CFStringGetCharacters((CFStringRef)dictValue, CFRangeMake(0, stringLen), stringBuffer.get());
00135             aResult.Assign(stringBuffer.get(), stringLen);
00136             return PR_TRUE;
00137         }
00138     }
00139     return PR_FALSE;
00140 }
00141 
00142 // returns success or failure (not the read value)
00143 static PRBool
00144 GetDictionaryBooleanValue(CFDictionaryRef aDictionary, CFStringRef aKey, PRBool& aResult)
00145 {
00146     aResult = PR_FALSE;
00147     CFTypeRef dictValue;
00148     if ((dictValue = CFDictionaryGetValue(aDictionary, aKey)) &&
00149         (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
00150     {
00151       aResult = CFBooleanGetValue((CFBooleanRef)dictValue);
00152       return PR_TRUE;
00153     }
00154     return PR_FALSE;
00155 }
00156 
00157 static void
00158 SetDictionaryStringValue(CFMutableDictionaryRef aDictionary, CFStringRef aKey, const nsXPIDLString& aValue)
00159 {
00160     CFStringRef cfString = CFStringCreateWithCharacters(NULL, aValue.get(), aValue.Length());
00161     if (cfString) {
00162         CFDictionaryAddValue(aDictionary, aKey, cfString);
00163         CFRelease(cfString);
00164     }
00165 }
00166 
00167 static void
00168 SetDictionaryBooleanvalue(CFMutableDictionaryRef aDictionary, CFStringRef aKey, PRBool aValue)
00169 {
00170     CFDictionaryAddValue(aDictionary, aKey, aValue ? kCFBooleanTrue : kCFBooleanFalse);
00171 }
00172 
00173 //*****************************************************************************
00174 // nsPrintingPromptService
00175 //*****************************************************************************   
00176 
00177 NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
00178 
00179 nsPrintingPromptService::nsPrintingPromptService() :
00180     mWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID))
00181 {
00182 }
00183 
00184 nsPrintingPromptService::~nsPrintingPromptService()
00185 {
00186 }
00187 
00188 nsresult nsPrintingPromptService::Init()
00189 {
00190     return NS_OK;
00191 }
00192 
00193 //*****************************************************************************
00194 // nsPrintingPromptService::nsIPrintingPromptService
00195 //*****************************************************************************   
00196 
00197 NS_IMETHODIMP 
00198 nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
00199 {
00200     nsresult rv;
00201     OSStatus status;
00202       
00203     nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(printSettings));
00204     if (!printSettingsX)
00205         return NS_ERROR_NO_INTERFACE;
00206     
00207     PMPrintSession  printSession;
00208     rv = printSettingsX->GetNativePrintSession(&printSession);
00209     if (NS_FAILED(rv))
00210         return rv;
00211     
00212     PMPageFormat    pageFormat = kPMNoPageFormat;
00213     rv = printSettingsX->GetPMPageFormat(&pageFormat);
00214     if (NS_FAILED(rv))
00215         return rv;
00216 
00217     PMPrintSettings nativePrintSettings = kPMNoPrintSettings;
00218     rv = printSettingsX->GetPMPrintSettings(&nativePrintSettings);
00219     if (NS_FAILED(rv))
00220         return rv;
00221     
00222     status = ::PMSessionValidatePageFormat(printSession, pageFormat, kPMDontWantBoolean);
00223     if (status != noErr)
00224         return NS_ERROR_FAILURE;
00225         
00226     // Reset the print settings to their defaults each time. We don't want to remember
00227     // the last printed page range or whatever. This is expected Mac behavior.
00228     status = ::PMSessionDefaultPrintSettings(printSession, nativePrintSettings);
00229     if (status != noErr)
00230         return NS_ERROR_FAILURE;
00231         
00232     ::InitCursor();
00233         
00234     rv = ::LoadPDEPlugIn();
00235     NS_ASSERTION(NS_SUCCEEDED(rv), "LoadPDEPlugIn() failed");
00236     
00237     // Set the print job title
00238     PRUnichar** docTitles;
00239     PRUint32 titleCount;
00240     webBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles);
00241     if (titleCount > 0) {
00242       CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], nsCRT::strlen(docTitles[0]));
00243       if (cfTitleString) {
00244         ::PMSetJobNameCFString(nativePrintSettings, cfTitleString);
00245         CFRelease(cfTitleString);
00246       }
00247       for (PRInt32 i = titleCount - 1; i >= 0; i--) {
00248         nsMemory::Free(docTitles[i]);
00249       }
00250       nsMemory::Free(docTitles);
00251       docTitles = NULL;
00252       titleCount = 0;
00253     }
00254 
00255     // Create a dictionary and store our settings into it
00256     CFMutableDictionaryRef dictToPDE = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
00257                                     (const CFDictionaryKeyCallBacks *)&kCFTypeDictionaryKeyCallBacks,
00258                                     (const CFDictionaryValueCallBacks *)&kCFTypeDictionaryValueCallBacks);
00259     NS_ASSERTION(dictToPDE, "Failed to create a CFDictionary for print settings");
00260     if (dictToPDE) {
00261         PRBool  isOn;
00262         PRInt16 howToEnableFrameUI;
00263 
00264         printSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn);
00265         SetDictionaryBooleanvalue(dictToPDE, kPDEKeyHaveSelection, isOn);
00266         
00267         printSettings->GetHowToEnableFrameUI(&howToEnableFrameUI);
00268         if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAll) {
00269             CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrames, kCFBooleanTrue);
00270             CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrameSelected, kCFBooleanTrue);
00271         }
00272         else if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAsIsAndEach) {
00273             CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrames, kCFBooleanTrue);
00274             CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrameSelected, kCFBooleanFalse);
00275         }
00276         else {
00277             CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrames, kCFBooleanFalse);
00278             CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrameSelected, kCFBooleanFalse);
00279         }
00280 
00281         // get the boolean values
00282         printSettings->GetShrinkToFit(&isOn);
00283         SetDictionaryBooleanvalue(dictToPDE, kPDEKeyShrinkToFit, isOn);
00284 
00285         printSettings->GetPrintBGColors(&isOn);
00286         SetDictionaryBooleanvalue(dictToPDE, kPDEKeyPrintBGColors, isOn);
00287 
00288         printSettings->GetPrintBGImages(&isOn);
00289         SetDictionaryBooleanvalue(dictToPDE, kPDEKeyPrintBGImages, isOn);
00290 
00291         // read headers
00292         nsXPIDLString tempString;
00293         printSettings->GetHeaderStrRight(getter_Copies(tempString));
00294         SetDictionaryStringValue(dictToPDE, kPDEKeyHeaderRight, tempString);
00295         
00296         printSettings->GetHeaderStrCenter(getter_Copies(tempString));
00297         SetDictionaryStringValue(dictToPDE, kPDEKeyHeaderCenter, tempString);
00298 
00299         printSettings->GetHeaderStrLeft(getter_Copies(tempString));
00300         SetDictionaryStringValue(dictToPDE, kPDEKeyHeaderLeft, tempString);
00301 
00302         // read footers
00303         printSettings->GetFooterStrRight(getter_Copies(tempString));
00304         SetDictionaryStringValue(dictToPDE, kPDEKeyFooterRight, tempString);
00305 
00306         printSettings->GetFooterStrCenter(getter_Copies(tempString));
00307         SetDictionaryStringValue(dictToPDE, kPDEKeyFooterCenter, tempString);
00308 
00309         printSettings->GetFooterStrLeft(getter_Copies(tempString));
00310         SetDictionaryStringValue(dictToPDE, kPDEKeyFooterLeft, tempString);
00311         
00312         CFDataRef xmlData = CFPropertyListCreateXMLData(kCFAllocatorDefault, dictToPDE);
00313         NS_ASSERTION(xmlData, "Could not create print settings CFData from CFDictionary");
00314         if (xmlData) {
00315             status = ::PMSetPrintSettingsExtendedData(nativePrintSettings, kAppPrintDialogAppOnlyKey, CFDataGetLength(xmlData), (void *)CFDataGetBytePtr(xmlData));
00316             NS_ASSERTION(status == noErr, "PMSetPrintSettingsExtendedData() failed");
00317             CFRelease(xmlData);
00318         }
00319         CFRelease(dictToPDE);
00320     }
00321 
00322     Boolean accepted;
00323     status = ::PMSessionPrintDialog(printSession, nativePrintSettings, pageFormat, &accepted);
00324     if (status == noErr && accepted) {
00325         int pageRange = -1;
00326         
00327         CFDictionaryRef dictFromPDE = ExtractCustomSettingsDict(nativePrintSettings);
00328         if (dictFromPDE) {
00329             //CFShow(dictFromPDE);
00330             
00331             PRBool printSelectionOnly;
00332             if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyPrintSelection, printSelectionOnly)) {
00333                 if (printSelectionOnly) {
00334                     printSettings->SetPrintRange(nsIPrintSettings::kRangeSelection);
00335                     pageRange = nsIPrintSettings::kRangeSelection;
00336                 }
00337                 else {
00338                     printSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages);
00339                     pageRange = nsIPrintSettings::kRangeAllPages;
00340                 }
00341             }
00342             
00343             CFTypeRef dictValue;
00344             if ((dictValue = CFDictionaryGetValue(dictFromPDE, kPDEKeyPrintFrameType)) &&
00345                 (CFGetTypeID(dictValue) == CFStringGetTypeID())) {
00346                 if (CFEqual(dictValue, kPDEValueFramesAsIs))
00347                     printSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs);
00348                 else if (CFEqual(dictValue, kPDEValueSelectedFrame))
00349                     printSettings->SetPrintFrameType(nsIPrintSettings::kSelectedFrame);
00350                 else if (CFEqual(dictValue, kPDEValueEachFrameSep))
00351                     printSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep);
00352             }
00353 
00354             PRBool tempBool;
00355             if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyShrinkToFit, tempBool))
00356                 printSettings->SetShrinkToFit(tempBool);
00357             
00358             if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyPrintBGColors, tempBool))
00359                 printSettings->SetPrintBGColors(tempBool);
00360 
00361             if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyPrintBGImages, tempBool))
00362                 printSettings->SetPrintBGImages(tempBool);
00363 
00364             nsAutoString stringFromDict;
00365             
00366             // top headers
00367             if (GetDictionaryStringValue(dictFromPDE, kPDEKeyHeaderLeft, stringFromDict))
00368                 printSettings->SetHeaderStrLeft(stringFromDict.get());
00369 
00370             if (GetDictionaryStringValue(dictFromPDE, kPDEKeyHeaderCenter, stringFromDict))
00371                 printSettings->SetHeaderStrCenter(stringFromDict.get());
00372 
00373             if (GetDictionaryStringValue(dictFromPDE, kPDEKeyHeaderRight, stringFromDict))
00374                 printSettings->SetHeaderStrRight(stringFromDict.get());
00375 
00376             // bottom footers
00377             if (GetDictionaryStringValue(dictFromPDE, kPDEKeyFooterLeft, stringFromDict))
00378                 printSettings->SetFooterStrLeft(stringFromDict.get());
00379 
00380             if (GetDictionaryStringValue(dictFromPDE, kPDEKeyFooterCenter, stringFromDict))
00381                 printSettings->SetFooterStrCenter(stringFromDict.get());
00382 
00383             if (GetDictionaryStringValue(dictFromPDE, kPDEKeyFooterRight, stringFromDict))
00384                 printSettings->SetFooterStrRight(stringFromDict.get());
00385         
00386             CFRelease(dictFromPDE);
00387         }
00388         
00389         if (pageRange == -1) {
00390             printSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages);
00391             pageRange = nsIPrintSettings::kRangeAllPages;
00392         }
00393 
00394         if (pageRange != nsIPrintSettings::kRangeSelection) {
00395             UInt32 firstPage, lastPage;
00396             status = ::PMGetFirstPage(nativePrintSettings, &firstPage);
00397             if (status == noErr) {
00398                 status = ::PMGetLastPage(nativePrintSettings, &lastPage);
00399                 if (status == noErr && lastPage != LONG_MAX) {
00400                     printSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange);
00401                     printSettings->SetStartPageRange(firstPage);
00402                     printSettings->SetEndPageRange(lastPage);
00403                 }
00404             }
00405         }
00406     }
00407         
00408     if (!accepted)
00409         return NS_ERROR_ABORT;
00410 
00411     if (status != noErr)
00412         return NS_ERROR_FAILURE;
00413 
00414     return NS_OK;
00415 }
00416 
00417 NS_IMETHODIMP 
00418 nsPrintingPromptService::ShowProgress(nsIDOMWindow*            parent, 
00419                                       nsIWebBrowserPrint*      webBrowserPrint,    // ok to be null
00420                                       nsIPrintSettings*        printSettings,      // ok to be null
00421                                       nsIObserver*             openDialogObserver, // ok to be null
00422                                       PRBool                   isForPrinting,
00423                                       nsIWebProgressListener** webProgressListener,
00424                                       nsIPrintProgressParams** printProgressParams,
00425                                       PRBool*                  notifyOnOpen)
00426 {
00427   return NS_ERROR_NOT_IMPLEMENTED;
00428 }
00429 
00430 NS_IMETHODIMP 
00431 nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
00432 {
00433   nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(printSettings));
00434   if (!printSettingsX)
00435     return NS_ERROR_NO_INTERFACE;
00436   
00437   OSStatus status;
00438     
00439   PMPrintSession printSession;
00440   status = ::PMCreateSession(&printSession);
00441   if (status != noErr)
00442     return NS_ERROR_FAILURE;
00443     
00444   PMPageFormat pageFormat;
00445   printSettingsX->GetPMPageFormat(&pageFormat);
00446   if (pageFormat == kPMNoPageFormat) {
00447     ::PMRelease(printSession);
00448     return NS_ERROR_FAILURE;
00449   }
00450     
00451   Boolean validated;
00452   ::PMSessionValidatePageFormat(printSession, pageFormat, &validated);
00453 
00454   ::InitCursor();
00455 
00456   Boolean   accepted = false;
00457   status = ::PMSessionPageSetupDialog(printSession, pageFormat, &accepted);
00458   OSStatus tempStatus = ::PMRelease(printSession);
00459   if (status == noErr)
00460     status = tempStatus;
00461     
00462   if (status != noErr)
00463     return NS_ERROR_FAILURE;    
00464   if (!accepted)
00465     return NS_ERROR_ABORT;
00466 
00467   return NS_OK;
00468 }
00469 
00470 NS_IMETHODIMP 
00471 nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings)
00472 {
00473     return NS_ERROR_NOT_IMPLEMENTED;
00474 }
00475 
00476 
00477 //*****************************************************************************
00478 // nsPrintingPromptService::nsIWebProgressListener
00479 //*****************************************************************************   
00480 
00481 NS_IMETHODIMP 
00482 nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus)
00483 {
00484     if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
00485         mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
00486         if (mPrintProgress) 
00487           mPrintProgress->CloseProgressDialog(PR_TRUE);
00488         mPrintProgress       = nsnull;
00489         mWebProgressListener = nsnull;
00490     }
00491     return NS_OK;
00492 }
00493 
00494 /* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
00495 NS_IMETHODIMP 
00496 nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
00497 {
00498     if (mWebProgressListener) {
00499       return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
00500     }
00501     return NS_OK;
00502 }
00503 
00504 /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
00505 NS_IMETHODIMP 
00506 nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
00507 {
00508     if (mWebProgressListener) {
00509         return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location);
00510     }
00511     return NS_OK;
00512 }
00513 
00514 /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
00515 NS_IMETHODIMP 
00516 nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage)
00517 {
00518     if (mWebProgressListener) {
00519         return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
00520     }
00521     return NS_OK;
00522 }
00523 
00524 /* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
00525 NS_IMETHODIMP 
00526 nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state)
00527 {
00528     if (mWebProgressListener) {
00529         return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
00530     }
00531     return NS_OK;
00532 }