Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
nsPrintJobFactoryPS Class Reference

#include <nsPrintJobFactoryPS.h>

List of all members.

Static Public Member Functions

static nsresult CreatePrintJob (nsIDeviceContextSpecPS *aSpec, nsIPrintJobPS *&aPrintJob)
 Construct a print job object for the given device context spec.

Detailed Description

Definition at line 51 of file nsPrintJobFactoryPS.h.


Member Function Documentation

Construct a print job object for the given device context spec.

On success, the print job object is owned by the caller and should be destroyed when no longer needed.

Parameters:
aSpecAn nsIDeviceContextSpecPS object for the print job in question.
aPrintJobIf NS_OK is returned, this will be filled in with a pointer to a print job object.
Returns:
NS_OK or a suitable error value.
Parameters:
aSpecAn nsIDeviceContextSpecPS object for the print job in question.
aPrintJobA pointer to a print job object which will handle the print job.
Returns:
NS_OK if all is well, or a suitable error value.

Definition at line 57 of file nsPrintJobFactoryPS.cpp.

{
    NS_PRECONDITION(nsnull != aSpec, "aSpec is NULL");

    nsIPrintJobPS *newPJ;

    PRBool setting;
    aSpec->GetIsPrintPreview(setting);
    if (setting)
        newPJ = new nsPrintJobPreviewPS();
    else {
        aSpec->GetToPrinter(setting);
        if (!setting)
            newPJ = new nsPrintJobFilePS();
        else
#ifdef VMS
            newPJ = new nsPrintJobVMSCmdPS();
#else
        {
            const char *printerName;
            aSpec->GetPrinterName(&printerName);
            if (nsPSPrinterList::kTypeCUPS == nsPSPrinterList::GetPrinterType(
                        nsDependentCString(printerName)))
                newPJ = new nsPrintJobCUPS();
            else
                newPJ = new nsPrintJobPipePS();
        }
#endif
    }
    if (!newPJ)
        return NS_ERROR_OUT_OF_MEMORY;

    nsresult rv = newPJ->Init(aSpec);
    if (NS_FAILED(rv))
        delete newPJ;
    else
        aPrintJob = newPJ;
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: