mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Changes to fix many bugs including quoting style size - vcard I18N fixes - compose fixes - etc - Bug #: 12505 25610 29806 30048 30744 31207 31589
This commit is contained in:
parent
9488c8b1bf
commit
4e23d61267
@ -241,6 +241,8 @@ protected:
|
||||
nsIView *mPrintView;
|
||||
FILE *mFilePointer; // a file where information can go to when printing
|
||||
|
||||
nsCOMPtr<nsIPrintListener> mPrintListener; // An observer for printing...
|
||||
|
||||
// document management data
|
||||
// these items are specific to markup documents (html and xml)
|
||||
// may consider splitting these out into a subclass
|
||||
@ -280,7 +282,7 @@ DocumentViewerImpl::DocumentViewerImpl()
|
||||
NS_INIT_REFCNT();
|
||||
mEnableRendering = PR_TRUE;
|
||||
mFilePointer = nsnull;
|
||||
|
||||
mPrintListener = nsnull;
|
||||
}
|
||||
|
||||
DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext)
|
||||
@ -373,6 +375,7 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
// Break circular reference (or something)
|
||||
mPresShell->EndObservingDocument();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1010,6 +1013,9 @@ void DocumentViewerImpl::DocumentReadyForPrinting()
|
||||
mIsPrinting = PR_FALSE;
|
||||
|
||||
mPrintPS->EndObservingDocument();
|
||||
|
||||
if (mPrintListener)
|
||||
mPrintListener->OnEndPrinting(NS_OK);
|
||||
|
||||
NS_RELEASE(mPrintPS);
|
||||
NS_RELEASE(mPrintVM);
|
||||
@ -1162,7 +1168,7 @@ static NS_DEFINE_IID(kDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTOR
|
||||
* @update 01/24/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
||||
DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener)
|
||||
{
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
@ -1292,6 +1298,14 @@ PRInt32 width,height;
|
||||
printf(" DeviceDimension w = %d h = %d\n",i1,i2);
|
||||
|
||||
#endif
|
||||
// Print listener setup...
|
||||
if (aPrintListener)
|
||||
{
|
||||
mPrintListener = aPrintListener;
|
||||
mPrintListener->OnStartPrinting();
|
||||
/* RICHIE mPrintListener->OnProgressPrinting(PRUint32 aProgress, PRUint32 aProgressMax); */
|
||||
}
|
||||
|
||||
//
|
||||
// The mIsPrinting flag is set when the ImageGroup observer is
|
||||
// notified that images must be loaded as a result of the
|
||||
@ -1309,7 +1323,7 @@ PRInt32 width,height;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -241,6 +241,8 @@ protected:
|
||||
nsIView *mPrintView;
|
||||
FILE *mFilePointer; // a file where information can go to when printing
|
||||
|
||||
nsCOMPtr<nsIPrintListener> mPrintListener; // An observer for printing...
|
||||
|
||||
// document management data
|
||||
// these items are specific to markup documents (html and xml)
|
||||
// may consider splitting these out into a subclass
|
||||
@ -280,7 +282,7 @@ DocumentViewerImpl::DocumentViewerImpl()
|
||||
NS_INIT_REFCNT();
|
||||
mEnableRendering = PR_TRUE;
|
||||
mFilePointer = nsnull;
|
||||
|
||||
mPrintListener = nsnull;
|
||||
}
|
||||
|
||||
DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext)
|
||||
@ -373,6 +375,7 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
// Break circular reference (or something)
|
||||
mPresShell->EndObservingDocument();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1010,6 +1013,9 @@ void DocumentViewerImpl::DocumentReadyForPrinting()
|
||||
mIsPrinting = PR_FALSE;
|
||||
|
||||
mPrintPS->EndObservingDocument();
|
||||
|
||||
if (mPrintListener)
|
||||
mPrintListener->OnEndPrinting(NS_OK);
|
||||
|
||||
NS_RELEASE(mPrintPS);
|
||||
NS_RELEASE(mPrintVM);
|
||||
@ -1162,7 +1168,7 @@ static NS_DEFINE_IID(kDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTOR
|
||||
* @update 01/24/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
||||
DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener)
|
||||
{
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
@ -1292,6 +1298,14 @@ PRInt32 width,height;
|
||||
printf(" DeviceDimension w = %d h = %d\n",i1,i2);
|
||||
|
||||
#endif
|
||||
// Print listener setup...
|
||||
if (aPrintListener)
|
||||
{
|
||||
mPrintListener = aPrintListener;
|
||||
mPrintListener->OnStartPrinting();
|
||||
/* RICHIE mPrintListener->OnProgressPrinting(PRUint32 aProgress, PRUint32 aProgressMax); */
|
||||
}
|
||||
|
||||
//
|
||||
// The mIsPrinting flag is set when the ImageGroup observer is
|
||||
// notified that images must be loaded as a result of the
|
||||
@ -1309,7 +1323,7 @@ PRInt32 width,height;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -86,6 +86,7 @@ $(NULL)
|
||||
XPIDLSRCS = \
|
||||
nsIChromeEventHandler.idl \
|
||||
nsISelectionController.idl \
|
||||
nsIPrintListener.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
@ -81,6 +81,7 @@ MODULE=raptor
|
||||
XPIDLSRCS= \
|
||||
.\nsIChromeEventHandler.idl \
|
||||
.\nsISelectionController.idl \
|
||||
.\nsIPrintListener.idl \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
@ -241,6 +241,8 @@ protected:
|
||||
nsIView *mPrintView;
|
||||
FILE *mFilePointer; // a file where information can go to when printing
|
||||
|
||||
nsCOMPtr<nsIPrintListener> mPrintListener; // An observer for printing...
|
||||
|
||||
// document management data
|
||||
// these items are specific to markup documents (html and xml)
|
||||
// may consider splitting these out into a subclass
|
||||
@ -280,7 +282,7 @@ DocumentViewerImpl::DocumentViewerImpl()
|
||||
NS_INIT_REFCNT();
|
||||
mEnableRendering = PR_TRUE;
|
||||
mFilePointer = nsnull;
|
||||
|
||||
mPrintListener = nsnull;
|
||||
}
|
||||
|
||||
DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext)
|
||||
@ -373,6 +375,7 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||
// Break circular reference (or something)
|
||||
mPresShell->EndObservingDocument();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1010,6 +1013,9 @@ void DocumentViewerImpl::DocumentReadyForPrinting()
|
||||
mIsPrinting = PR_FALSE;
|
||||
|
||||
mPrintPS->EndObservingDocument();
|
||||
|
||||
if (mPrintListener)
|
||||
mPrintListener->OnEndPrinting(NS_OK);
|
||||
|
||||
NS_RELEASE(mPrintPS);
|
||||
NS_RELEASE(mPrintVM);
|
||||
@ -1162,7 +1168,7 @@ static NS_DEFINE_IID(kDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTOR
|
||||
* @update 01/24/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
||||
DocumentViewerImpl::Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener)
|
||||
{
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
@ -1292,6 +1298,14 @@ PRInt32 width,height;
|
||||
printf(" DeviceDimension w = %d h = %d\n",i1,i2);
|
||||
|
||||
#endif
|
||||
// Print listener setup...
|
||||
if (aPrintListener)
|
||||
{
|
||||
mPrintListener = aPrintListener;
|
||||
mPrintListener->OnStartPrinting();
|
||||
/* RICHIE mPrintListener->OnProgressPrinting(PRUint32 aProgress, PRUint32 aProgressMax); */
|
||||
}
|
||||
|
||||
//
|
||||
// The mIsPrinting flag is set when the ImageGroup observer is
|
||||
// notified that images must be loaded as a result of the
|
||||
@ -1309,7 +1323,7 @@ PRInt32 width,height;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -613,7 +613,7 @@ PluginViewerImpl::GetSaveable(PRBool *aSaveable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
||||
PluginViewerImpl::Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener)
|
||||
{
|
||||
return NS_OK; // XXX: hey, plug in guys! implement me!
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ Rights Reserved.
|
||||
<menuitem id="threadPaneContext-print"
|
||||
value="&contextPrint.label;"
|
||||
accesskey=""
|
||||
oncommand="Print();"/>
|
||||
oncommand="PrintEnginePrint();"/>
|
||||
<menuitem id="threadPaneContext-delete"
|
||||
value="&contextDelete.label;"
|
||||
accesskey=""
|
||||
@ -388,7 +388,7 @@ Rights Reserved.
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_pageSetup"/>
|
||||
<menuitem value="&printPreviewCmd.label;" disabled="true" oncommand="PrintPreview();"/>
|
||||
<menuitem value="&printCmd.label;" oncommand="Print();"/>
|
||||
<menuitem value="&printCmd.label;" oncommand="PrintEnginePrint();"/>
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
@ -818,7 +818,7 @@ Rights Reserved.
|
||||
|
||||
<titledbutton id="button_next" class="other28" align="top" value="&nextButton.label;" onclick="MsgNextUnreadMessage()"/>
|
||||
<titledbutton id="button_delete" class="other28" disabled="true" align="top" value="&deleteButton.label;" onclick="goDoCommand('button_delete')"/>
|
||||
<titledbutton id="button_print" class="other28" align="top" value="&printButton.label;" onclick="Print()"/>
|
||||
<titledbutton id="button_print" class="other28" align="top" value="&printButton.label;" onclick="PrintEnginePrint()"/>
|
||||
<titledbutton id="button_stop" class="other28" align="top" value="&stopButton.label;" onclick="MsgStop();"/>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
|
@ -30,7 +30,6 @@ function OnLoadPrintEngine()
|
||||
{
|
||||
PrintEngineCreateGlobals();
|
||||
InitPrintEngineWindow();
|
||||
printEngine.StartPrintOperation();
|
||||
}
|
||||
|
||||
function OnUnloadPrintEngine()
|
||||
|
@ -18,8 +18,6 @@ Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
screenX="10000"
|
||||
screenY="10000"
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
|
||||
@ -39,8 +37,8 @@ Rights Reserved.
|
||||
align="vertical"
|
||||
width="150"
|
||||
height="250"
|
||||
screenX="0"
|
||||
screenY="500"
|
||||
screenX="10000"
|
||||
screenY="10000"
|
||||
windowtype="mail:printEngine">
|
||||
|
||||
<html:script src="chrome://global/content/strres.js"/>
|
||||
|
@ -45,5 +45,9 @@ HTMLFiles=HTML Files (*.htm, *.html, *.shtml)
|
||||
TextFiles=Text Files (*.txt)
|
||||
EMLFiles=Mail Files (*.eml)
|
||||
SaveMailAs=Save Message As
|
||||
LoadingMessageToPrint=Loading message to print...
|
||||
MessageLoaded=Message loaded...
|
||||
PrintingMessage=Printing message...
|
||||
PrintingComplete=Printing complete.
|
||||
saveAttachmentFailed=Unable to save the attachment. Please check your file name and try again later.
|
||||
saveMessageFailed=Unable to save the message. Please check your file name and try again later.
|
||||
saveMessageFailed=Unable to save the message. Please check your file name and try again later.>>>>>>> 1.6
|
||||
|
@ -343,7 +343,7 @@ nsMessenger::InitializeDisplayCharset()
|
||||
{
|
||||
if (mCharsetInitialized)
|
||||
return;
|
||||
|
||||
|
||||
// libmime always converts to UTF-8 (both HTML and XML)
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mWebShell));
|
||||
if (docShell)
|
||||
@ -357,9 +357,9 @@ nsMessenger::InitializeDisplayCharset()
|
||||
if (muDV) {
|
||||
muDV->SetForceCharacterSet(aForceCharacterSet.GetUnicode());
|
||||
}
|
||||
|
||||
mCharsetInitialized = PR_TRUE;
|
||||
}
|
||||
|
||||
mCharsetInitialized = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "nsIURI.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
@ -36,8 +37,9 @@
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIDocumentLoaderObserver.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgPrintEngine.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIBaseWindow.h"
|
||||
@ -49,24 +51,41 @@
|
||||
// nsMsgPrintEngine implementation
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
nsMsgPrintEngine::nsMsgPrintEngine() :
|
||||
mWebShell(nsnull)
|
||||
mWebShell(nsnull),
|
||||
mWindow(nsnull)
|
||||
{
|
||||
mCurrentlyPrintingURI = -1;
|
||||
mWindow = nsnull;
|
||||
|
||||
// note: it is okay to return a null status feedback and not return an error
|
||||
// it's possible the url really doesn't have status feedback
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
|
||||
mailSession->GetTemporaryMsgWindow(getter_AddRefs(msgWindow));
|
||||
if (msgWindow)
|
||||
msgWindow->GetStatusFeedback(getter_AddRefs(mFeedback));
|
||||
}
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
nsMsgPrintEngine::~nsMsgPrintEngine()
|
||||
{
|
||||
NS_IF_RELEASE(mWindow);
|
||||
}
|
||||
|
||||
// Implement AddRef and Release
|
||||
NS_IMPL_ADDREF(nsMsgPrintEngine)
|
||||
NS_IMPL_RELEASE(nsMsgPrintEngine)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsMsgPrintEngine,nsIMsgPrintEngine, nsIDocumentLoaderObserver);
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE3(nsMsgPrintEngine, nsIMsgPrintEngine, nsIDocumentLoaderObserver, nsIPrintListener);
|
||||
|
||||
nsresult nsMsgPrintEngine::Init()
|
||||
{
|
||||
@ -76,6 +95,11 @@ nsresult nsMsgPrintEngine::Init()
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnStartDocumentLoad(nsIDocumentLoader *aLoader, nsIURI *aURL, const char *aCommand)
|
||||
{
|
||||
// Tell the user we are loading...
|
||||
PRUnichar *msg = GetString(nsString("LoadingMessageToPrint").GetUnicode());
|
||||
SetStatusMessage( msg );
|
||||
PR_FREEIF(msg);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -86,6 +110,11 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
|
||||
// Tell the user the message is loaded...
|
||||
PRUnichar *msg = GetString(nsString("MessageLoaded").GetUnicode());
|
||||
SetStatusMessage( msg );
|
||||
PR_FREEIF(msg);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mWebShell));
|
||||
NS_ASSERTION(docShell,"can't print, there is no webshell");
|
||||
if ( (!docShell) || (!aChannel) )
|
||||
@ -94,12 +123,12 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
|
||||
}
|
||||
|
||||
// Make sure this isn't just "about:blank" finishing....
|
||||
nsIURI *aOriginalURI = nsnull;
|
||||
if (NS_SUCCEEDED(aChannel->GetOriginalURI(&aOriginalURI)))
|
||||
nsCOMPtr<nsIURI> originalURI = nsnull;
|
||||
if (NS_SUCCEEDED(aChannel->GetOriginalURI(getter_AddRefs(originalURI))))
|
||||
{
|
||||
char *spec = nsnull;
|
||||
nsXPIDLCString spec;
|
||||
|
||||
if (NS_SUCCEEDED(aOriginalURI->GetSpec(&spec)) && spec)
|
||||
if (NS_SUCCEEDED(originalURI->GetSpec(getter_Copies(spec))) && spec)
|
||||
{
|
||||
if (!nsCRT::strcasecmp(spec, "about:blank"))
|
||||
{
|
||||
@ -114,11 +143,19 @@ nsMsgPrintEngine::OnEndDocumentLoad(nsIDocumentLoader *loader, nsIChannel *aChan
|
||||
nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
|
||||
if (viewerFile)
|
||||
{
|
||||
rv = viewerFile->Print(PR_FALSE, nsnull);
|
||||
if (mCurrentlyPrintingURI == 0)
|
||||
rv = viewerFile->Print(PR_FALSE, nsnull, (nsIPrintListener *)this);
|
||||
else
|
||||
rv = viewerFile->Print(PR_TRUE, nsnull, (nsIPrintListener *)this);
|
||||
|
||||
// Tell the user we started printing...
|
||||
PRUnichar *msg = GetString(nsString("PrintingMessage").GetUnicode());
|
||||
SetStatusMessage( msg );
|
||||
PR_FREEIF(msg);
|
||||
}
|
||||
}
|
||||
|
||||
return StartNextPrintOperation();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -155,9 +192,8 @@ nsMsgPrintEngine::SetWindow(nsIDOMWindow *aWin)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mWindow);
|
||||
mWindow = aWin;
|
||||
NS_ADDREF(aWin);
|
||||
nsAutoString webShellName("printengine");
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(aWin) );
|
||||
NS_ENSURE_TRUE(globalObj, NS_ERROR_FAILURE);
|
||||
@ -216,20 +252,25 @@ nsMsgPrintEngine::StartNextPrintOperation()
|
||||
if (mCurrentlyPrintingURI == -1)
|
||||
InitializeDisplayCharset();
|
||||
|
||||
// SetupObserver();
|
||||
mCurrentlyPrintingURI++;
|
||||
|
||||
// First, check if we are at the end of this stuff!
|
||||
if ( (mCurrentlyPrintingURI+1) >= mURIArray.Count() )
|
||||
if ( mCurrentlyPrintingURI >= mURIArray.Count() )
|
||||
{
|
||||
// Release();
|
||||
// This is the end...dum, dum, dum....my only friend...the end
|
||||
mWindow->Close();
|
||||
|
||||
// Tell the user we are done...
|
||||
PRUnichar *msg = GetString(nsString("PrintingComplete").GetUnicode());
|
||||
SetStatusMessage( msg );
|
||||
PR_FREEIF(msg);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mCurrentlyPrintingURI++;
|
||||
if (!mWebShell)
|
||||
return StartNextPrintOperation();
|
||||
|
||||
// SetWindow(mWindow);
|
||||
nsString *uri = mURIArray.StringAt(mCurrentlyPrintingURI);
|
||||
rv = FireThatLoadOperation(uri);
|
||||
if (NS_FAILED(rv))
|
||||
@ -293,11 +334,70 @@ nsMsgPrintEngine::SetupObserver()
|
||||
if (!mWebShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocumentLoaderObserver> observer = do_QueryInterface(this);
|
||||
if (observer)
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mWebShell));
|
||||
if (docShell)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mWebShell));
|
||||
docShell->SetDocLoaderObserver(observer);
|
||||
}
|
||||
docShell->SetDocLoaderObserver((nsIDocumentLoaderObserver *)this);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnStartPrinting(void)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnProgressPrinting(PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgPrintEngine::OnEndPrinting(PRUint32 aStatus)
|
||||
{
|
||||
StartNextPrintOperation();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgPrintEngine::SetStatusMessage(PRUnichar *aMsgString)
|
||||
{
|
||||
PRUnichar *progressMsg;
|
||||
|
||||
if ( (!mFeedback) || (!aMsgString) )
|
||||
return NS_OK;
|
||||
|
||||
progressMsg = nsCRT::strdup(aMsgString);
|
||||
mFeedback->ShowStatusString(progressMsg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define MESSENGER_STRING_URL "chrome://messenger/locale/messenger.properties"
|
||||
|
||||
PRUnichar *
|
||||
nsMsgPrintEngine::GetString(const PRUnichar *aStringName)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
PRUnichar *ptrv = nsnull;
|
||||
|
||||
if (!mStringBundle)
|
||||
{
|
||||
char *propertyURL = MESSENGER_STRING_URL;
|
||||
|
||||
NS_WITH_SERVICE(nsIStringBundleService, sBundleService, kStringBundleServiceCID, &res);
|
||||
if (NS_SUCCEEDED(res) && (nsnull != sBundleService))
|
||||
{
|
||||
nsILocale *locale = nsnull;
|
||||
res = sBundleService->CreateBundle(propertyURL, locale, getter_AddRefs(mStringBundle));
|
||||
}
|
||||
}
|
||||
|
||||
if (mStringBundle)
|
||||
res = mStringBundle->GetStringFromName(aStringName, &ptrv);
|
||||
|
||||
if ( NS_SUCCEEDED(res) && (ptrv) )
|
||||
return ptrv;
|
||||
else
|
||||
return nsCRT::strdup(aStringName);
|
||||
}
|
||||
|
@ -32,8 +32,11 @@
|
||||
#include "nsIMsgPrintEngine.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIPrintListener.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
class nsMsgPrintEngine : public nsIMsgPrintEngine {
|
||||
class nsMsgPrintEngine : public nsIMsgPrintEngine, public nsIPrintListener {
|
||||
|
||||
public:
|
||||
nsMsgPrintEngine();
|
||||
@ -50,16 +53,24 @@ public:
|
||||
// For nsIDocumentLoaderObserver...
|
||||
NS_DECL_NSIDOCUMENTLOADEROBSERVER
|
||||
|
||||
// For nIPrintListener
|
||||
NS_DECL_NSIPRINTLISTENER
|
||||
|
||||
protected:
|
||||
|
||||
NS_IMETHOD FireThatLoadOperation(nsString *uri);
|
||||
NS_IMETHOD StartNextPrintOperation();
|
||||
void InitializeDisplayCharset();
|
||||
void SetupObserver();
|
||||
nsresult SetStatusMessage(PRUnichar *aMsgString);
|
||||
PRUnichar *GetString(const PRUnichar *aStringName);
|
||||
|
||||
nsIDOMWindow *mWindow;
|
||||
nsCOMPtr<nsIWebShell> mWebShell;
|
||||
nsCOMPtr<nsIDOMWindow> mWindow;
|
||||
PRInt32 mURICount;
|
||||
nsStringArray mURIArray;
|
||||
PRInt32 mCurrentlyPrintingURI;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle; // String bundles...
|
||||
nsCOMPtr<nsIMsgStatusFeedback> mFeedback; // Tell the user something why don't ya'
|
||||
};
|
||||
|
@ -613,7 +613,7 @@ PluginViewerImpl::GetSaveable(PRBool *aSaveable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
||||
PluginViewerImpl::Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener)
|
||||
{
|
||||
return NS_OK; // XXX: hey, plug in guys! implement me!
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ PluginViewerImpl::GetSaveable(PRBool *aSaveable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::Print(PRBool aSilent,FILE *aFile)
|
||||
PluginViewerImpl::Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener)
|
||||
{
|
||||
return NS_OK; // XXX: hey, plug in guys! implement me!
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsrootidl.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIPrintListener.h"
|
||||
|
||||
/* starting interface: nsIContentViewerFile */
|
||||
|
||||
@ -37,7 +38,7 @@ class nsIContentViewerFile : public nsISupports {
|
||||
* @param aFileName -- a file pointer to output regression tests or print to a file
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD Print(PRBool aSilent,FILE *aFile) = 0;
|
||||
NS_IMETHOD Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener = nsnull) = 0;
|
||||
|
||||
/* [noscript] void PrintContent (in nsIWebShell parent, in nsIDeviceContext DContext); */
|
||||
NS_IMETHOD PrintContent(nsIWebShell * parent, nsIDeviceContext * DContext) = 0;
|
||||
@ -50,7 +51,7 @@ class nsIContentViewerFile : public nsISupports {
|
||||
#define NS_DECL_NSICONTENTVIEWERFILE \
|
||||
NS_IMETHOD Save(void); \
|
||||
NS_IMETHOD GetSaveable(PRBool *aSaveable); \
|
||||
NS_IMETHOD Print(PRBool aSilent,FILE *aFile); \
|
||||
NS_IMETHOD Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener); \
|
||||
NS_IMETHOD PrintContent(nsIWebShell * parent, nsIDeviceContext * DContext); \
|
||||
NS_IMETHOD GetPrintable(PRBool *aPrintable);
|
||||
|
||||
@ -58,7 +59,7 @@ class nsIContentViewerFile : public nsISupports {
|
||||
#define NS_FORWARD_NSICONTENTVIEWERFILE(_to) \
|
||||
NS_IMETHOD Save(void) { return _to ## Save(); } \
|
||||
NS_IMETHOD GetSaveable(PRBool *aSaveable) { return _to ## GetSaveable(aSaveable); } \
|
||||
NS_IMETHOD Print(PRBool aSilent,FILE *aFile) { return _to ## Print(); } \
|
||||
NS_IMETHOD Print(PRBool aSilent,FILE *aFile, nsIPrintListener *aPrintListener) { return _to ## Print(); } \
|
||||
NS_IMETHOD PrintContent(nsIWebShell * parent, nsIDeviceContext * DContext) { return _to ## PrintContent(parent, DContext); } \
|
||||
NS_IMETHOD GetPrintable(PRBool *aPrintable) { return _to ## GetPrintable(aPrintable); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user