зеркало из https://github.com/mozilla/pjs.git
This does two things:
1) When the it returns from the Print Dialog it checks to see if the PD_PRINTTOFILE flags is set then then set the the info into the PrintSettings 2) IF we are printing to a file, but not a file driver, then check to see if the file name is the special "FILE:" (as per the MS documentation) Bug 170332 r=dcone sr=alecf
This commit is contained in:
Родитель
cc4998f553
Коммит
3679690eaa
|
@ -976,6 +976,25 @@ ShowNativePrintDialog(HWND aHWnd,
|
|||
char* device = &(((char *)devnames)[devnames->wDeviceOffset]);
|
||||
char* driver = &(((char *)devnames)[devnames->wDriverOffset]);
|
||||
|
||||
// Check to see if the "Print To File" control is checked
|
||||
// then take the name from devNames and set it in the PrintSettings
|
||||
//
|
||||
// NOTE:
|
||||
// As per Microsoft SDK documentation the returned value offset from
|
||||
// devnames->wOutputOffset is either "FILE:" or NULL
|
||||
// if the "Print To File" checkbox is checked it MUST be "FILE:"
|
||||
// We assert as an extra safety check.
|
||||
if (prntdlg.Flags & PD_PRINTTOFILE) {
|
||||
char* fileName = &(((char *)devnames)[devnames->wOutputOffset]);
|
||||
NS_ASSERTION(strcmp(fileName, "FILE:") == 0, "FileName must be `FILE:`");
|
||||
aPrintSettings->SetToFileName(NS_ConvertASCIItoUCS2(fileName).get());
|
||||
aPrintSettings->SetPrintToFile(PR_TRUE);
|
||||
} else {
|
||||
// clear "print to file" info
|
||||
aPrintSettings->SetPrintToFile(PR_FALSE);
|
||||
aPrintSettings->SetToFileName(nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsWin> psWin(do_QueryInterface(aPrintSettings));
|
||||
// Setup local Data members
|
||||
psWin->SetDeviceName(device);
|
||||
|
@ -1294,6 +1313,25 @@ ShowNativePrintDialogEx(HWND aHWnd,
|
|||
char* device = &(((char *)devnames)[devnames->wDeviceOffset]);
|
||||
char* driver = &(((char *)devnames)[devnames->wDriverOffset]);
|
||||
|
||||
// Check to see if the "Print To File" control is checked
|
||||
// then take the name from devNames and set it in the PrintSettings
|
||||
//
|
||||
// NOTE:
|
||||
// As per Microsoft SDK documentation the returned value offset from
|
||||
// devnames->wOutputOffset is either "FILE:" or NULL
|
||||
// if the "Print To File" checkbox is checked it MUST be "FILE:"
|
||||
// We assert as an extra safety check.
|
||||
if (prntdlg.Flags & PD_PRINTTOFILE) {
|
||||
char* fileName = &(((char *)devnames)[devnames->wOutputOffset]);
|
||||
NS_ASSERTION(strcmp(fileName, "FILE:") == 0, "FileName must be `FILE:`");
|
||||
aPrintSettings->SetToFileName(NS_ConvertASCIItoUCS2(fileName).get());
|
||||
aPrintSettings->SetPrintToFile(PR_TRUE);
|
||||
} else {
|
||||
// clear "print to file" info
|
||||
aPrintSettings->SetPrintToFile(PR_FALSE);
|
||||
aPrintSettings->SetToFileName(nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsWin> psWin(do_QueryInterface(aPrintSettings));
|
||||
// Setup local Data members
|
||||
psWin->SetDeviceName(device);
|
||||
|
|
|
@ -372,6 +372,21 @@ CheckForPrintToFile(nsIPrintSettings* aPS, LPTSTR aPrinterName, PRUnichar* aUPri
|
|||
CheckForPrintToFileWithName((char*)NS_ConvertUCS2toUTF8(aUPrinterName).get(), toFile);
|
||||
}
|
||||
#endif
|
||||
// Since the driver wasn't a "Print To File" Driver, check to see
|
||||
// if the name of the file has been set to the special "FILE:"
|
||||
if (!toFile) {
|
||||
nsXPIDLString toFileName;
|
||||
aPS->GetToFileName(getter_Copies(toFileName));
|
||||
if (toFileName) {
|
||||
if (*toFileName) {
|
||||
if (toFileName.Equals(NS_LITERAL_STRING("FILE:"))) {
|
||||
// this skips the setting of the "print to file" info below
|
||||
// which we don't want to do.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
aPS->SetPrintToFile(toFile);
|
||||
if (toFile) {
|
||||
rv = GetFileNameForPrintSettings(aPS);
|
||||
|
|
Загрузка…
Ссылка в новой задаче