Fix bug 302958: specify a name for the print job on Mac, getting it from the title passed to the BeginDocument() call. r=jhpedemonte, sr=bryner, a=asa

This commit is contained in:
smfr%smfr.org 2006-02-10 22:50:14 +00:00
Родитель 50442a83d2
Коммит 165bd5ae80
4 изменённых файлов: 21 добавлений и 7 удалений

Просмотреть файл

@ -45,8 +45,8 @@ class nsIPrintSettings;
// 3d5917da-1dd2-11b2-bc7b-aa83823362e0
#define NS_IPRINTING_CONTEXT_IID \
{ 0x3d5917da, 0x1dd2, 0x11b2, \
{ 0xbc, 0x7b, 0xaa, 0x83, 0x82, 0x33, 0x62, 0xe0 } }
{ 0xD9853908, 0xA34D, 0x4D8B, \
{ 0xB4, 0xD6, 0x5D, 0xC3, 0x6E, 0x21, 0x1B, 0xDD } }
class nsIPrintingContext : public nsISupports {
public:
@ -73,7 +73,9 @@ public:
*/
NS_IMETHOD ClosePrintManager() = 0;
NS_IMETHOD BeginDocument(PRInt32 aStartPage,
NS_IMETHOD BeginDocument(PRUnichar* aTitle,
PRUnichar* aPrintToFileName,
PRInt32 aStartPage,
PRInt32 aEndPage) = 0;
NS_IMETHOD EndDocument() = 0;

Просмотреть файл

@ -682,7 +682,7 @@ NS_IMETHODIMP nsDeviceContextMac::BeginDocument(PRUnichar * aTitle,
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
if (printingContext)
rv = printingContext->BeginDocument(aStartPage, aEndPage);
rv = printingContext->BeginDocument(aTitle, aPrintToFileName, aStartPage, aEndPage);
return rv;
}

Просмотреть файл

@ -42,6 +42,7 @@
#include "prmem.h"
#include "plstr.h"
#include "nsCRT.h"
#include "nsIServiceManager.h"
#include "nsIPrintOptions.h"
@ -111,11 +112,20 @@ NS_IMETHODIMP nsDeviceContextSpecX::ClosePrintManager()
return NS_OK;
}
NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(PRInt32 aStartPage,
NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(PRUnichar* aTitle,
PRUnichar* aPrintToFileName,
PRInt32 aStartPage,
PRInt32 aEndPage)
{
if (aTitle) {
CFStringRef cfString = ::CFStringCreateWithCharacters(NULL, aTitle, nsCRT::strlen(aTitle));
if (cfString) {
::PMSetJobNameCFString(mPrintSettings, cfString);
::CFRelease(cfString);
}
}
OSStatus status;
status = ::PMSetFirstPage(mPrintSettings, aStartPage, false);
NS_ASSERTION(status == noErr, "PMSetFirstPage failed");
status = ::PMSetLastPage(mPrintSettings, aEndPage, false);

Просмотреть файл

@ -79,7 +79,9 @@ public:
*/
NS_IMETHOD ClosePrintManager();
NS_IMETHOD BeginDocument(PRInt32 aStartPage,
NS_IMETHOD BeginDocument(PRUnichar* aTitle,
PRUnichar* aPrintToFileName,
PRInt32 aStartPage,
PRInt32 aEndPage);
NS_IMETHOD EndDocument();