diff options
Diffstat (limited to 'embedding')
13 files changed, 1 insertions, 825 deletions
diff --git a/embedding/browser/webBrowser/nsIPrintingPrompt.idl b/embedding/browser/webBrowser/nsIPrintingPrompt.idl index 08b8da6f8..0e346ce59 100644 --- a/embedding/browser/webBrowser/nsIPrintingPrompt.idl +++ b/embedding/browser/webBrowser/nsIPrintingPrompt.idl @@ -92,15 +92,6 @@ interface nsIPrintingPrompt : nsISupports * showProgress - displays a XUL dialog * showPrinterProperties - displays a XUL dialog * - * OS2: - * - * Defaults for platform service: - * showPrintDialog - displays a XUL dialog - * showPageSetup - displays a XUL dialog - * showProgress - displays a XUL dialog - * showPrinterProperties - displays a native dialog - * - * */ diff --git a/embedding/browser/webBrowser/nsIPrintingPromptService.idl b/embedding/browser/webBrowser/nsIPrintingPromptService.idl index 63a7886ab..b97052043 100644 --- a/embedding/browser/webBrowser/nsIPrintingPromptService.idl +++ b/embedding/browser/webBrowser/nsIPrintingPromptService.idl @@ -88,15 +88,6 @@ interface nsIPrintingPromptService : nsISupports * showProgress - displays a XUL dialog * showPrinterProperties - displays a XUL dialog * - * OS2: - * - * Defaults for platform service: - * showPrintDialog - displays a XUL dialog - * showPageSetup - displays a XUL dialog - * showProgress - displays a XUL dialog - * showPrinterProperties - displays a native dialog - * - * */ diff --git a/embedding/components/build/Makefile.in b/embedding/components/build/Makefile.in index aefb05e74..656f38398 100644 --- a/embedding/components/build/Makefile.in +++ b/embedding/components/build/Makefile.in @@ -38,10 +38,6 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../commandhandler/src \ $(NULL) -ifeq ($(MOZ_WIDGET_TOOLKIT),os2) -LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/os2 -endif - ifdef MOZ_PDF_PRINTING LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/unixshared endif diff --git a/embedding/components/printingui/src/moz.build b/embedding/components/printingui/src/moz.build index a7588782f..760fa9a2b 100644 --- a/embedding/components/printingui/src/moz.build +++ b/embedding/components/printingui/src/moz.build @@ -6,9 +6,7 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit == 'os2': - DIRS += ['os2'] -elif toolkit == 'windows': +if toolkit == 'windows': DIRS += ['win'] elif toolkit == 'cocoa': DIRS += ['mac'] diff --git a/embedding/components/printingui/src/os2/Makefile.in b/embedding/components/printingui/src/os2/Makefile.in deleted file mode 100644 index e710e153d..000000000 --- a/embedding/components/printingui/src/os2/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -EXPORT_LIBRARY = .. -LIBXUL_LIBRARY = 1 - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - diff --git a/embedding/components/printingui/src/os2/moz.build b/embedding/components/printingui/src/os2/moz.build deleted file mode 100644 index e1747e7c8..000000000 --- a/embedding/components/printingui/src/os2/moz.build +++ /dev/null @@ -1,16 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -MODULE = 'embedcomponents' - -CPP_SOURCES += [ - 'nsPrintProgress.cpp', - 'nsPrintProgressParams.cpp', - 'nsPrintingPromptService.cpp', -] - -LIBRARY_NAME = 'printingui_s' - diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.cpp b/embedding/components/printingui/src/os2/nsPrintProgress.cpp deleted file mode 100644 index 969a6bf4d..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgress.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintProgress.h" - -#include "nsIBaseWindow.h" -#include "nsISupportsArray.h" -#include "nsXPCOM.h" -#include "nsISupportsPrimitives.h" -#include "nsIComponentManager.h" - -NS_IMPL_THREADSAFE_ADDREF(nsPrintProgress) -NS_IMPL_THREADSAFE_RELEASE(nsPrintProgress) - -NS_INTERFACE_MAP_BEGIN(nsPrintProgress) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback) - NS_INTERFACE_MAP_ENTRY(nsIPrintProgress) - NS_INTERFACE_MAP_ENTRY(nsIPrintStatusFeedback) - NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) -NS_INTERFACE_MAP_END_THREADSAFE - - -nsPrintProgress::nsPrintProgress() -{ - m_closeProgress = false; - m_processCanceled = false; - m_pendingStateFlags = -1; - m_pendingStateValue = 0; -} - -nsPrintProgress::~nsPrintProgress() -{ - (void)ReleaseListeners(); -} - -/* void openProgressDialog (in nsIDOMWindow parent, in string dialogURL, in nsISupports parameters); */ -NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, - const char *dialogURL, - nsISupports *parameters, - nsIObserver *openDialogObserver, - bool *notifyOnOpen) -{ - *notifyOnOpen = true; - m_observer = openDialogObserver; - nsresult rv = NS_ERROR_FAILURE; - - if (m_dialog) - return NS_ERROR_ALREADY_INITIALIZED; - - if (!dialogURL || !*dialogURL) - return NS_ERROR_INVALID_ARG; - - if (parent) - { - // Set up window.arguments[0]... - nsCOMPtr<nsISupportsArray> array; - rv = NS_NewISupportsArray(getter_AddRefs(array)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr<nsISupportsInterfacePointer> ifptr = - do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - ifptr->SetData(static_cast<nsIPrintProgress*>(this)); - ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress)); - - array->AppendElement(ifptr); - - array->AppendElement(parameters); - - // Open the dialog. - nsCOMPtr<nsIDOMWindow> newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); - } - - return rv; -} - -/* void closeProgressDialog (in boolean forceClose); */ -NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose) -{ - m_closeProgress = true; - return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, forceClose); -} - -/* nsIPrompt GetPrompter (); */ -NS_IMETHODIMP nsPrintProgress::GetPrompter(nsIPrompt **_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - *_retval = nullptr; - - if (! m_closeProgress && m_dialog) - return m_dialog->GetPrompter(_retval); - - return NS_ERROR_FAILURE; -} - -/* attribute boolean processCanceledByUser; */ -NS_IMETHODIMP nsPrintProgress::GetProcessCanceledByUser(bool *aProcessCanceledByUser) -{ - NS_ENSURE_ARG_POINTER(aProcessCanceledByUser); - *aProcessCanceledByUser = m_processCanceled; - return NS_OK; -} -NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(bool aProcessCanceledByUser) -{ - m_processCanceled = aProcessCanceledByUser; - OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, false); - return NS_OK; -} - -/* void RegisterListener (in nsIWebProgressListener listener); */ -NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener) -{ - if (!listener) //Nothing to do with a null listener! - return NS_OK; - - m_listenerList.AppendObject(listener); - if (m_closeProgress || m_processCanceled) - listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, 0); - else - { - listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get()); - if (m_pendingStateFlags != -1) - listener->OnStateChange(nullptr, nullptr, m_pendingStateFlags, m_pendingStateValue); - } - - return NS_OK; -} - -/* void UnregisterListener (in nsIWebProgressListener listener); */ -NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listener) -{ - if (listener) - m_listenerList.RemoveObject(listener); - - return NS_OK; -} - -/* void doneIniting (); */ -NS_IMETHODIMP nsPrintProgress::DoneIniting() -{ - if (m_observer) { - m_observer->Observe(nullptr, nullptr, nullptr); - } - return NS_OK; -} - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ -NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus) -{ - m_pendingStateFlags = aStateFlags; - m_pendingStateValue = aStatus; - - uint32_t count = m_listenerList.Count(); - for (uint32_t i = count - 1; i < count; i --) - { - nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i); - if (progressListener) - progressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); - } - - return NS_OK; -} - -/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ -NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress) -{ - uint32_t count = m_listenerList.Count(); - for (uint32_t i = count - 1; i < count; i --) - { - nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.safeObjectAt(i); - if (progressListener) - progressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - } - - return NS_OK; -} - -/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */ -NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags) -{ - return NS_OK; -} - -/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) -{ - if (aMessage && *aMessage) - m_pendingStatus = aMessage; - - uint32_t count = m_listenerList.Count(); - for (uint32_t i = count - 1; i < count; i --) - { - nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i); - if (progressListener) - progressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); - } - - return NS_OK; -} - -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ -NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state) -{ - return NS_OK; -} - -nsresult nsPrintProgress::ReleaseListeners() -{ - m_listenerList.Clear(); - return NS_OK; -} - -NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status) -{ - return OnStatusChange(nullptr, nullptr, NS_OK, status); -} - -/* void startMeteors (); */ -NS_IMETHODIMP nsPrintProgress::StartMeteors() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void stopMeteors (); */ -NS_IMETHODIMP nsPrintProgress::StopMeteors() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void showProgress (in long percent); */ -NS_IMETHODIMP nsPrintProgress::ShowProgress(int32_t percent) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* [noscript] void setDocShell (in nsIDocShell shell, in nsIDOMWindow window); */ -NS_IMETHODIMP nsPrintProgress::SetDocShell(nsIDocShell *shell, nsIDOMWindow *window) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void closeWindow (); */ -NS_IMETHODIMP nsPrintProgress::CloseWindow() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.h b/embedding/components/printingui/src/os2/nsPrintProgress.h deleted file mode 100644 index db698ca04..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgress.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintProgress_h -#define __nsPrintProgress_h - -#include "nsIPrintProgress.h" - -#include "nsCOMArray.h" -#include "nsCOMPtr.h" -#include "nsIDOMWindow.h" -#include "nsIPrintStatusFeedback.h" -#include "nsIObserver.h" -#include "nsString.h" - -class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPRINTPROGRESS - NS_DECL_NSIWEBPROGRESSLISTENER - NS_DECL_NSIPRINTSTATUSFEEDBACK - - nsPrintProgress(); - virtual ~nsPrintProgress(); - -private: - nsresult ReleaseListeners(); - - bool m_closeProgress; - bool m_processCanceled; - nsString m_pendingStatus; - int32_t m_pendingStateFlags; - int32_t m_pendingStateValue; - nsCOMPtr<nsIDOMWindow> m_dialog; - nsCOMArray<nsIWebProgressListener> m_listenerList; - nsCOMPtr<nsIObserver> m_observer; -}; - -#endif diff --git a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp b/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp deleted file mode 100644 index 2b31b1344..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintProgressParams.h" -#include "nsReadableUtils.h" - - -NS_IMPL_ISUPPORTS1(nsPrintProgressParams, nsIPrintProgressParams) - -nsPrintProgressParams::nsPrintProgressParams() -{ -} - -nsPrintProgressParams::~nsPrintProgressParams() -{ -} - -/* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) -{ - NS_ENSURE_ARG(aDocTitle); - - *aDocTitle = ToNewUnicode(mDocTitle); - return NS_OK; -} - -NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const PRUnichar * aDocTitle) -{ - mDocTitle = aDocTitle; - return NS_OK; -} - -/* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) -{ - NS_ENSURE_ARG(aDocURL); - - *aDocURL = ToNewUnicode(mDocURL); - return NS_OK; -} - -NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const PRUnichar * aDocURL) -{ - mDocURL = aDocURL; - return NS_OK; -} - diff --git a/embedding/components/printingui/src/os2/nsPrintProgressParams.h b/embedding/components/printingui/src/os2/nsPrintProgressParams.h deleted file mode 100644 index b041aae8a..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgressParams.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintProgressParams_h -#define __nsPrintProgressParams_h - -#include "nsIPrintProgressParams.h" -#include "nsString.h" - -class nsPrintProgressParams : public nsIPrintProgressParams -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPRINTPROGRESSPARAMS - - nsPrintProgressParams(); - virtual ~nsPrintProgressParams(); - -private: - nsString mDocTitle; - nsString mDocURL; -}; - -#endif diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp deleted file mode 100644 index a2ac83789..000000000 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintingPromptService.h" - -#include "nsIComponentManager.h" -#include "nsIDialogParamBlock.h" -#include "nsIDOMWindow.h" -#include "nsIServiceManager.h" -#include "nsISupportsUtils.h" -#include "nsISupportsArray.h" -#include "nsString.h" - -// Printing Progress Includes -#include "nsPrintProgress.h" -#include "nsPrintProgressParams.h" - -// Print Service Includes -#include "nsIPrintOptions.h" -#include "nsIServiceManager.h" -#include "nsGfxCIID.h" -static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-service;1"; - -static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul"; -static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; -static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; -static const char *kPageSetupDialogURL = "chrome://global/content/printPageSetup.xul"; - -/**************************************************************** - ************************* ParamBlock *************************** - ****************************************************************/ - -class ParamBlock { - -public: - ParamBlock() - { - mBlock = 0; - } - ~ParamBlock() - { - NS_IF_RELEASE(mBlock); - } - nsresult Init() { - return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock); - } - nsIDialogParamBlock * operator->() const { return mBlock; } - operator nsIDialogParamBlock * const () { return mBlock; } - -private: - nsIDialogParamBlock *mBlock; -}; - -/**************************************************************** - ***************** nsPrintingPromptService ********************** - ****************************************************************/ - -NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener) - -nsPrintingPromptService::nsPrintingPromptService() -{ -} - -nsPrintingPromptService::~nsPrintingPromptService() -{ -} - -nsresult -nsPrintingPromptService::Init() -{ - nsresult rv; - mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); - return rv; -} - -/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings) -{ - NS_ENSURE_ARG(webBrowserPrint); - NS_ENSURE_ARG(printSettings); - - ParamBlock block; - nsresult rv = block.Init(); - if (NS_FAILED(rv)) - return rv; - - block->SetInt(0, 0); - return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL); -} - -/* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, - nsIWebBrowserPrint* webBrowserPrint, // ok to be null - nsIPrintSettings* printSettings, // ok to be null - nsIObserver* openDialogObserver, // ok to be null - bool isForPrinting, - nsIWebProgressListener** webProgressListener, - nsIPrintProgressParams** printProgressParams, - bool* notifyOnOpen) -{ - NS_ENSURE_ARG(webProgressListener); - NS_ENSURE_ARG(printProgressParams); - NS_ENSURE_ARG(notifyOnOpen); - - *notifyOnOpen = false; - - nsPrintProgress* prtProgress = new nsPrintProgress(); - mPrintProgress = prtProgress; - mWebProgressListener = prtProgress; - - nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams(); - - nsCOMPtr<nsIDOMWindow> parentWindow = parent; - - if (mWatcher && !parentWindow) { - mWatcher->GetActiveWindow(getter_AddRefs(parentWindow)); - } - - if (parentWindow) { - mPrintProgress->OpenProgressDialog(parentWindow, - isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL, - prtProgressParams, openDialogObserver, notifyOnOpen); - } - - prtProgressParams.forget(printProgressParams); - nsCOMPtr<nsIWebProgressListener> myWebProgressListener = this; - myWebProgressListener.forget(webProgressListener); - - return NS_OK; -} - -/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs) -{ - NS_ENSURE_ARG(printSettings); - - ParamBlock block; - nsresult rv = block.Init(); - if (NS_FAILED(rv)) - return rv; - - block->SetInt(0, 0); - return DoDialog(parent, block, nullptr, printSettings, kPageSetupDialogURL); -} - -/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings) -{ - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr<nsIPrintOptions> printService = do_GetService(sPrintOptionsContractID, &rv); - if (NS_SUCCEEDED(rv)) { - bool displayed; - rv = printService->DisplayJobProperties(printerName, printSettings, &displayed); - } - return rv; -} - -nsresult -nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent, - nsIDialogParamBlock *aParamBlock, - nsIWebBrowserPrint *aWebBrowserPrint, - nsIPrintSettings* aPS, - const char *aChromeURL) -{ - NS_ENSURE_ARG(aParamBlock); - NS_ENSURE_ARG(aPS); - NS_ENSURE_ARG(aChromeURL); - - if (!mWatcher) - return NS_ERROR_FAILURE; - - nsresult rv = NS_OK; - - // get a parent, if at all possible - // (though we'd rather this didn't fail, it's OK if it does. so there's - // no failure or null check.) - nsCOMPtr<nsIDOMWindow> activeParent; // retain ownership for method lifetime - if (!aParent) - { - mWatcher->GetActiveWindow(getter_AddRefs(activeParent)); - aParent = activeParent; - } - - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr<nsISupportsArray> array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; - - nsCOMPtr<nsISupports> psSupports(do_QueryInterface(aPS)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); - - if (aWebBrowserPrint) { - nsCOMPtr<nsISupports> wbpSupports(do_QueryInterface(aWebBrowserPrint)); - NS_ASSERTION(wbpSupports, "nsIWebBrowserPrint must be a supports"); - array->AppendElement(wbpSupports); - } - - nsCOMPtr<nsISupports> blkSupps(do_QueryInterface(aParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - array->AppendElement(blkSupps); - - nsCOMPtr<nsISupports> arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - - nsCOMPtr<nsIDOMWindow> dialog; - rv = mWatcher->OpenWindow(aParent, aChromeURL, "_blank", - "centerscreen,chrome,modal,titlebar", arguments, - getter_AddRefs(dialog)); - - // if aWebBrowserPrint is not null then we are printing - // so we want to pass back NS_ERROR_ABORT on cancel - if (NS_SUCCEEDED(rv) && aWebBrowserPrint) - { - int32_t status; - aParamBlock->GetInt(0, &status); - return status == 0?NS_ERROR_ABORT:NS_OK; - } - - return rv; -} - -////////////////////////////////////////////////////////////////////// -// nsIWebProgressListener -////////////////////////////////////////////////////////////////////// - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ -NS_IMETHODIMP -nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus) -{ - if ((aStateFlags & STATE_STOP) && mWebProgressListener) { - mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); - if (mPrintProgress) { - mPrintProgress->CloseProgressDialog(true); - } - mPrintProgress = nullptr; - mWebProgressListener = nullptr; - } - return NS_OK; -} - -/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ -NS_IMETHODIMP -nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - } - return NS_OK; -} - -/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */ -NS_IMETHODIMP -nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags); - } - return NS_OK; -} - -/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP -nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); - } - return NS_OK; -} - -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ -NS_IMETHODIMP -nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); - } - return NS_OK; -} diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.h b/embedding/components/printingui/src/os2/nsPrintingPromptService.h deleted file mode 100644 index df759d613..000000000 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintingPromptService_h -#define __nsPrintingPromptService_h - -// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF} -#define NS_PRINTINGPROMPTSERVICE_CID \ - {0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}} -#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \ - "@mozilla.org/embedcomp/printingprompt-service;1" - -#include "nsCOMPtr.h" -#include "nsIPrintingPromptService.h" -#include "nsPIPromptService.h" -#include "nsIWindowWatcher.h" - -// Printing Progress Includes -#include "nsPrintProgress.h" -#include "nsPrintProgressParams.h" -#include "nsIWebProgressListener.h" - -class nsIDOMWindow; -class nsIDialogParamBlock; - -class nsPrintingPromptService: public nsIPrintingPromptService, - public nsIWebProgressListener -{ - -public: - - nsPrintingPromptService(); - virtual ~nsPrintingPromptService(); - - nsresult Init(); - - NS_DECL_NSIPRINTINGPROMPTSERVICE - NS_DECL_NSIWEBPROGRESSLISTENER - NS_DECL_ISUPPORTS - -private: - nsresult DoDialog(nsIDOMWindow *aParent, - nsIDialogParamBlock *aParamBlock, - nsIWebBrowserPrint *aWebBrowserPrint, - nsIPrintSettings* aPS, - const char *aChromeURL); - - nsCOMPtr<nsIWindowWatcher> mWatcher; - nsCOMPtr<nsIPrintProgress> mPrintProgress; - nsCOMPtr<nsIWebProgressListener> mWebProgressListener; -}; - -#endif - diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 31d5a3d3d..793b3cc12 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -10,10 +10,6 @@ #include "nsIFileStreams.h" // New Necko file streams #include <algorithm> -#ifdef XP_OS2 -#include "nsILocalFileOS2.h" -#endif - #include "nsNetUtil.h" #include "nsComponentManagerUtils.h" #include "nsIComponentRegistrar.h" @@ -701,29 +697,9 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest( if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(status)) SendErrorStatusChange(true, status, request, data->mFile); -#if defined(XP_OS2) - // delete 'data'; this will close the stream and let - // us tag the file it created with its source URI - nsCOMPtr<nsIURI> uriSource = data->mOriginalLocation; - nsCOMPtr<nsIFile> localFile; - GetLocalFileFromURI(data->mFile, getter_AddRefs(localFile)); - delete data; - mOutputMap.Remove(&key); - if (localFile) - { - nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile); - if (localFileOS2) - { - nsAutoCString url; - uriSource->GetSpec(url); - localFileOS2->SetFileSource(url); - } - } -#else // This will close automatically close the output stream delete data; mOutputMap.Remove(&key); -#endif } else { @@ -1673,16 +1649,6 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal( cleanupData->mIsDirectory = true; mCleanupList.AppendElement(cleanupData); } -#if defined(XP_OS2) - // tag the directory with the URI that originated its contents - nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localDataPath); - if (localFileOS2) - { - nsAutoCString url; - mCurrentBaseURI->GetSpec(url); - localFileOS2->SetFileSource(url); - } -#endif } } @@ -3778,20 +3744,6 @@ nsWebBrowserPersist::SaveDocumentWithFixup( NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); } } -#if defined(XP_OS2) - else - { - // close the stream, then tag the file it created with its source URI - outputStream->Close(); - nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile); - if (localFileOS2) - { - nsAutoCString url; - mCurrentBaseURI->GetSpec(url); - localFileOS2->SetFileSource(url); - } - } -#endif return rv; } |