118890 r=rods sr=attinasi a=asa. Fixed printing in print preview

This commit is contained in:
dcone%netscape.com 2006-02-10 22:49:28 +00:00
Родитель 08e5e40527
Коммит 44eef2aeed
1 изменённых файлов: 19 добавлений и 2 удалений

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

@ -46,6 +46,7 @@
#include "nsIServiceManager.h"
#include "nsIPrintOptions.h"
#include "CoreServices.h"
/** -------------------------------------------------------
* Construct the nsDeviceContextSpecX
@ -79,12 +80,21 @@ NS_IMPL_ISUPPORTS2(nsDeviceContextSpecX, nsIDeviceContextSpec, nsIPrintingContex
NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIPrintSettings* aPS, PRBool aQuiet)
{
nsresult rv;
OSStatus status;
nsCOMPtr<nsIPrintOptions> printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1", &rv);
if (NS_FAILED(rv)) return rv;
// are we doing a printpreview.. then don't start setting up for the printing
PRBool doingPrintPreview;
aPS->GetIsPrintPreview(&doingPrintPreview);
// Because page setup can get called at any time, we can't use the session APIs here.
OSStatus status = ::PMBegin();
if (status != noErr) return NS_ERROR_FAILURE;
if(!doingPrintPreview) {
status = ::PMBegin();
if (status != noErr) return NS_ERROR_FAILURE;
}
mBeganPrinting = PR_TRUE;
@ -118,6 +128,13 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIPrintSettings* aPS, PRBool aQuiet)
{
::InitCursor();
//CFStringRef pathRef = CFStringCreateWithCString(NULL,"file://Macintosh HD/Developer/Examples/Printing/App/build/PrintDialogPDE.plugin",kCFStringEncodingUTF8);
CFStringRef pathRef = CFStringCreateWithCString(NULL,"Developer:Examples:Printing:App:build:PrintDialogPDE.plugin",kCFStringEncodingUTF8);
if(pathRef){
CFURLRef bundleURL=CFURLCreateWithFileSystemPath(NULL,pathRef,kCFURLPOSIXPathStyle,false);
CFPlugInRef plugin = ::CFPlugInCreate(NULL,bundleURL);
}
Boolean accepted = false;
status = ::PMPrintDialog(mPrintSettings, mPageFormat, &accepted);
if (! accepted)