зеркало из https://github.com/mozilla/gecko-dev.git
All the files have been moved to the unixshaed directory
Bug 115136 r=dcone sr=attainasi
This commit is contained in:
Родитель
dc93c6d65c
Коммит
bb0b2f65ed
|
@ -1,58 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications, Inc. Portions created by Netscape are
|
||||
# Copyright (C) 2001, Mozilla. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = embedcomponents
|
||||
LIBRARY_NAME = printingui_s
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
dom \
|
||||
windowwatcher \
|
||||
widget \
|
||||
gfx \
|
||||
js \
|
||||
xpconnect \
|
||||
caps \
|
||||
content \
|
||||
necko \
|
||||
uriloader \
|
||||
docshell \
|
||||
webbrwsr \
|
||||
embed_base \
|
||||
intl \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsPrintingPromptService.cpp \
|
||||
nsPrintProgressParams.cpp \
|
||||
nsPrintProgress.cpp \
|
||||
$(NULL)
|
||||
|
||||
# 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
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications, Inc. Portions created by Netscape are
|
||||
# Copyright (C) 2001, Mozilla. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..\..
|
||||
|
||||
MODULE=printingui
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
dom \
|
||||
widget \
|
||||
gfx \
|
||||
js \
|
||||
xpconnect \
|
||||
caps \
|
||||
content \
|
||||
necko \
|
||||
uriloader \
|
||||
docshell \
|
||||
webBrowser_core \
|
||||
embed_base \
|
||||
intl \
|
||||
windowwatcher \
|
||||
pref \
|
||||
$(NULL)
|
||||
|
||||
LIBRARY_NAME=printingui_s
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsPrintingPromptService.obj \
|
||||
.\$(OBJDIR)\nsPrintProgressParams.obj \
|
||||
.\$(OBJDIR)\nsPrintProgress.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
|
@ -1,343 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jean-Francois Ducarroz <ducarroz@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsPrintProgress.h"
|
||||
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsISupportsArray.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()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
m_closeProgress = PR_FALSE;
|
||||
m_processCanceled = PR_FALSE;
|
||||
m_pendingStateFlags = -1;
|
||||
m_pendingStateValue = 0;
|
||||
}
|
||||
|
||||
nsPrintProgress::~nsPrintProgress()
|
||||
{
|
||||
(void)ReleaseListeners();
|
||||
}
|
||||
|
||||
/* void openProgressDialog (in nsIDOMWindowInternal parent, in string dialogURL, in nsISupports parameters); */
|
||||
NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindowInternal *parent,
|
||||
const char *dialogURL,
|
||||
nsISupports *parameters,
|
||||
nsIObserver *openDialogObserver,
|
||||
PRBool *notifyOnOpen)
|
||||
{
|
||||
*notifyOnOpen = PR_FALSE;
|
||||
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(NS_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_ConvertASCIItoUCS2(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(PRBool forceClose)
|
||||
{
|
||||
m_closeProgress = PR_TRUE;
|
||||
return OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, forceClose);
|
||||
}
|
||||
|
||||
/* nsIPrompt GetPrompter (); */
|
||||
NS_IMETHODIMP nsPrintProgress::GetPrompter(nsIPrompt **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = nsnull;
|
||||
|
||||
if (! m_closeProgress && m_dialog)
|
||||
return m_dialog->GetPrompter(_retval);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* attribute boolean processCanceledByUser; */
|
||||
NS_IMETHODIMP nsPrintProgress::GetProcessCanceledByUser(PRBool *aProcessCanceledByUser)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aProcessCanceledByUser);
|
||||
*aProcessCanceledByUser = m_processCanceled;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(PRBool aProcessCanceledByUser)
|
||||
{
|
||||
m_processCanceled = aProcessCanceledByUser;
|
||||
OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void RegisterListener (in nsIWebProgressListener listener); */
|
||||
NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (!listener) //Nothing to do with a null listener!
|
||||
return NS_OK;
|
||||
|
||||
if (!m_listenerList)
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(m_listenerList));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && m_listenerList)
|
||||
{
|
||||
m_listenerList->AppendElement(listener);
|
||||
if (m_closeProgress || m_processCanceled)
|
||||
listener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, 0);
|
||||
else
|
||||
{
|
||||
listener->OnStatusChange(nsnull, nsnull, 0, m_pendingStatus.get());
|
||||
if (m_pendingStateFlags != -1)
|
||||
listener->OnStateChange(nsnull, nsnull, m_pendingStateFlags, m_pendingStateValue);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void UnregisterListener (in nsIWebProgressListener listener); */
|
||||
NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listener)
|
||||
{
|
||||
if (m_listenerList && listener)
|
||||
m_listenerList->RemoveElement(listener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in unsigned long aStatus); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
m_pendingStateFlags = aStateFlags;
|
||||
m_pendingStateValue = aStatus;
|
||||
|
||||
if (m_listenerList)
|
||||
{
|
||||
PRUint32 count;
|
||||
PRInt32 i;
|
||||
|
||||
rv = m_listenerList->Count(&count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsISupports> aSupports;
|
||||
nsCOMPtr<nsIWebProgressListener> aProgressListener;
|
||||
for (i = count - 1; i >= 0; i --)
|
||||
{
|
||||
m_listenerList->GetElementAt(i, getter_AddRefs(aSupports));
|
||||
aProgressListener = do_QueryInterface(aSupports);
|
||||
if (aProgressListener)
|
||||
aProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 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, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (m_listenerList)
|
||||
{
|
||||
PRUint32 count;
|
||||
PRInt32 i;
|
||||
|
||||
rv = m_listenerList->Count(&count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsISupports> aSupports;
|
||||
nsCOMPtr<nsIWebProgressListener> aProgressListener;
|
||||
for (i = count - 1; i >= 0; i --)
|
||||
{
|
||||
m_listenerList->GetElementAt(i, getter_AddRefs(aSupports));
|
||||
aProgressListener = do_QueryInterface(aSupports);
|
||||
if (aProgressListener)
|
||||
aProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (aMessage && *aMessage)
|
||||
m_pendingStatus = aMessage;
|
||||
if (m_listenerList)
|
||||
{
|
||||
PRUint32 count;
|
||||
PRInt32 i;
|
||||
|
||||
rv = m_listenerList->Count(&count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsISupports> aSupports;
|
||||
nsCOMPtr<nsIWebProgressListener> aProgressListener;
|
||||
for (i = count - 1; i >= 0; i --)
|
||||
{
|
||||
m_listenerList->GetElementAt(i, getter_AddRefs(aSupports));
|
||||
aProgressListener = do_QueryInterface(aSupports);
|
||||
if (aProgressListener)
|
||||
aProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult nsPrintProgress::ReleaseListeners()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (m_listenerList)
|
||||
{
|
||||
PRUint32 count;
|
||||
PRInt32 i;
|
||||
|
||||
rv = m_listenerList->Count(&count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "m_listenerList->Count() failed");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
for (i = count - 1; i >= 0; i --)
|
||||
m_listenerList->RemoveElementAt(i);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status)
|
||||
{
|
||||
return OnStatusChange(nsnull, nsnull, 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(PRInt32 percent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] void setDocShell (in nsIDocShell shell, in nsIDOMWindowInternal window); */
|
||||
NS_IMETHODIMP nsPrintProgress::SetDocShell(nsIDocShell *shell, nsIDOMWindowInternal *window)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void closeWindow (); */
|
||||
NS_IMETHODIMP nsPrintProgress::CloseWindow()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jean-Francois Ducarroz <ducarroz@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __nsPrintProgress_h
|
||||
#define __nsPrintProgress_h
|
||||
|
||||
#include "nsIPrintProgress.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIPrintStatusFeedback.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(void);
|
||||
|
||||
PRBool m_closeProgress;
|
||||
PRBool m_processCanceled;
|
||||
nsString m_pendingStatus;
|
||||
PRInt32 m_pendingStateFlags;
|
||||
PRInt32 m_pendingStateValue;
|
||||
nsCOMPtr<nsIDOMWindowInternal> m_dialog;
|
||||
nsCOMPtr<nsISupportsArray> m_listenerList;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,83 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsPrintProgressParams.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPrintProgressParams, nsIPrintProgressParams)
|
||||
|
||||
nsPrintProgressParams::nsPrintProgressParams()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#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
|
|
@ -1,325 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsPrintingPromptService.h"
|
||||
|
||||
#include "nsXPComFactory.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"
|
||||
|
||||
static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul";
|
||||
static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul";
|
||||
static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul";
|
||||
static const char *kPrinterPropertiesURL = "chrome://global/content/printjoboptions.xul";
|
||||
|
||||
#define NS_DIALOGPARAMBLOCK_CONTRACTID \
|
||||
"@mozilla.org/embedcomp/dialogparam;1"
|
||||
|
||||
/****************************************************************
|
||||
************************* ParamBlock ***************************
|
||||
****************************************************************/
|
||||
|
||||
class ParamBlock {
|
||||
|
||||
public:
|
||||
ParamBlock()
|
||||
{
|
||||
mBlock = 0;
|
||||
}
|
||||
~ParamBlock()
|
||||
{
|
||||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return nsComponentManager::CreateInstance(
|
||||
NS_DIALOGPARAMBLOCK_CONTRACTID,
|
||||
0, NS_GET_IID(nsIDialogParamBlock),
|
||||
(void**) &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
||||
private:
|
||||
nsIDialogParamBlock *mBlock;
|
||||
};
|
||||
|
||||
/****************************************************************
|
||||
***************** nsPrintingPromptService **********************
|
||||
****************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
|
||||
|
||||
nsPrintingPromptService::nsPrintingPromptService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPrintingPromptService::~nsPrintingPromptService()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintingPromptService::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mWatcher = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &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, out nsIWebProgressListener webProgressListener); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
|
||||
nsIWebBrowserPrint* webBrowserPrint, // ok to be null
|
||||
nsIPrintSettings* printSettings, // ok to be null
|
||||
nsIObserver* openDialogObserver, // ok to be null
|
||||
nsIWebProgressListener** webProgressListener,
|
||||
nsIPrintProgressParams** printProgressParams,
|
||||
PRBool* notifyOnOpen)
|
||||
{
|
||||
NS_ENSURE_ARG(webProgressListener);
|
||||
NS_ENSURE_ARG(printProgressParams);
|
||||
NS_ENSURE_ARG(notifyOnOpen);
|
||||
|
||||
nsPrintProgress* prtProgress = new nsPrintProgress();
|
||||
nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrintProgress));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = prtProgress->QueryInterface(NS_GET_IID(nsIWebProgressListener), (void**)getter_AddRefs(mWebProgressListener));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsPrintProgressParams* prtProgressParams = new nsPrintProgressParams();
|
||||
rv = prtProgressParams->QueryInterface(NS_GET_IID(nsIPrintProgressParams), (void**)printProgressParams);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (printProgressParams)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowInternal> parentDOMIntl(do_QueryInterface(parent));
|
||||
|
||||
if (mWatcher && !parentDOMIntl)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> active;
|
||||
mWatcher->GetActiveWindow(getter_AddRefs(active));
|
||||
parentDOMIntl = do_QueryInterface(active);
|
||||
}
|
||||
|
||||
if (parentDOMIntl)
|
||||
{
|
||||
mPrintProgress->OpenProgressDialog(parentDOMIntl, kPrintProgressDialogURL, *printProgressParams, openDialogObserver, notifyOnOpen);
|
||||
}
|
||||
}
|
||||
|
||||
*webProgressListener = NS_STATIC_CAST(nsIWebProgressListener*, this);
|
||||
NS_ADDREF(*webProgressListener);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings)
|
||||
{
|
||||
NS_ENSURE_ARG(printSettings);
|
||||
|
||||
ParamBlock block;
|
||||
nsresult rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(0, 0);
|
||||
return DoDialog(parent, block, nsnull, printSettings, kPageSetupDialogURL);
|
||||
}
|
||||
|
||||
/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings)
|
||||
{
|
||||
/* fixme: We simply ignore the |aPrinter| argument here
|
||||
* We should get the supported printer attributes from the printer and
|
||||
* populate the print job options dialog with these data instead of using
|
||||
* the "default set" here.
|
||||
* However, this requires changes on all platforms and is another big chunk
|
||||
* of patches ... ;-(
|
||||
*/
|
||||
NS_ENSURE_ARG(printerName);
|
||||
NS_ENSURE_ARG(printSettings);
|
||||
|
||||
ParamBlock block;
|
||||
nsresult rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(0, 0);
|
||||
return DoDialog(parent, block, nsnull, printSettings, kPrinterPropertiesURL);
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
PRInt32 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 long aStateFlags, in unsigned long aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aStateFlags, PRUint32 aStatus)
|
||||
{
|
||||
if (aStateFlags & STATE_STOP) {
|
||||
mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
mPrintProgress->CloseProgressDialog(PR_TRUE);
|
||||
mPrintProgress = nsnull;
|
||||
}
|
||||
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, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
|
||||
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
|
||||
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long state); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state)
|
||||
{
|
||||
return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#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
|
||||
|
Загрузка…
Ссылка в новой задаче