Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Private Attributes | Friends
nsPrintJobFilePS Class Reference

#include <nsPrintJobPS.h>

Inheritance diagram for nsPrintJobFilePS:
Inheritance graph
[legend]
Collaboration diagram for nsPrintJobFilePS:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsPrintJobFilePS ()
 ~nsPrintJobFilePS ()
nsresult StartSubmission (FILE **aHandle)
 Create the final output file and copy the temporary files there.
nsresult FinishSubmission ()
 Finish a print job.
nsresult SetNumCopies (int aNumCopies)
 Set the number of copies for this print job.
virtual void SetJobTitle (const PRUnichar *aTitle)
 Set the print job title.

Protected Member Functions

nsresult Init (nsIDeviceContextSpecPS *)
 Initialize the print-to-file object from the printing spec.
void SetDestHandle (FILE *aHandle)
 Set the destination file handle.
FILEGetDestHandle ()
 Get the current value for the destination file handle.
void SetDestination (const char *aDest)
 Set a string representing the destination.
nsCStringGetDestination ()
 Get the string representing the destination.

Private Attributes

FILEmDestHandle
nsCString mDestination

Friends

class nsPrintJobFactoryPS

Detailed Description

Definition at line 74 of file nsPrintJobPS.h.


Constructor & Destructor Documentation

Definition at line 80 of file nsPrintJobPS.cpp.

Definition at line 83 of file nsPrintJobPS.cpp.

Here is the call graph for this function:


Member Function Documentation

Finish a print job.

See nsIPrintJobPS.h and nsPrintJobPS.h for details.

Implements nsIPrintJobPS.

Reimplemented in nsPrintJobCUPS, and nsPrintJobPipePS.

Definition at line 137 of file nsPrintJobPS.cpp.

{
    NS_PRECONDITION(mDestHandle, "No destination file handle");

    fclose(mDestHandle);
    mDestHandle = nsnull;
    return NS_OK;
}

Here is the call graph for this function:

FILE* nsPrintJobFilePS::GetDestHandle ( ) [inline, protected]

Get the current value for the destination file handle.

Returns:
the current value for the destination file handle.

Definition at line 100 of file nsPrintJobPS.h.

{ return mDestHandle; }

Here is the caller graph for this function:

nsCString& nsPrintJobFilePS::GetDestination ( ) [inline, protected]

Get the string representing the destination.

Returns:
The current value of the destination string.

Definition at line 114 of file nsPrintJobPS.h.

{ return mDestination; }

Here is the caller graph for this function:

nsresult nsPrintJobFilePS::Init ( nsIDeviceContextSpecPS aSpec) [protected, virtual]

Initialize the print-to-file object from the printing spec.

See nsPrintJobPS.h for details.

Implements nsIPrintJobPS.

Reimplemented in nsPrintJobCUPS, and nsPrintJobPipePS.

Definition at line 94 of file nsPrintJobPS.cpp.

{
    NS_PRECONDITION(aSpec, "aSpec must not be NULL");
#ifdef DEBUG
    PRBool toPrinter;
    aSpec->GetToPrinter(toPrinter);
    NS_PRECONDITION(!toPrinter, "This print job is to a printer");
#endif
    const char *path;
    aSpec->GetPath(&path);
    mDestination = path;
    return NS_OK;
}

Here is the call graph for this function:

void nsPrintJobFilePS::SetDestHandle ( FILE aHandle) [inline, protected]

Set the destination file handle.

Parameters:
aHandleNew value for the handle.

Definition at line 94 of file nsPrintJobPS.h.

Here is the caller graph for this function:

void nsPrintJobFilePS::SetDestination ( const char *  aDest) [inline, protected]

Set a string representing the destination.

For print-to-file this is the name of the destination file. Subclasses could store something else here.

Parameters:
aDestDestination filename.

Definition at line 108 of file nsPrintJobPS.h.

Here is the caller graph for this function:

virtual void nsIPrintJobPS::SetJobTitle ( const PRUnichar aTitle) [inline, virtual, inherited]

Set the print job title.

Some printing systems accept a job title which is displayed on a banner page, in a print queue listing, etc.

This must be called after Init() and before StartSubmission(). nsIPrintJobPS provides a stub implementation because most classes do not make use of this information.

Parameters:
aTitleThe job title.

Reimplemented in nsPrintJobCUPS.

Definition at line 92 of file nsIPrintJobPS.h.

{ }

Here is the caller graph for this function:

nsresult nsPrintJobFilePS::SetNumCopies ( int  aNumCopies) [inline, virtual]

Set the number of copies for this print job.

Some printing systems allow setting this out of band, instead of embedding it into the postscript.

Parameters:
aNumCopiesNumber of copies requested. Values <= 1 are interpreted as "do not specify a copy count to the printing system" when possible, or else as one copy.
Returns:
NS_ERROR_NOT_IMPLEMENTED if this print job class doesn't support the specific copy count requested.
NS_OK The print job class will request the specified number of copies when printing the job.

Implements nsIPrintJobPS.

Reimplemented in nsPrintJobCUPS.

Definition at line 83 of file nsPrintJobPS.h.

nsresult nsPrintJobFilePS::StartSubmission ( FILE **  aHandle) [virtual]

Create the final output file and copy the temporary files there.

See nsIPrintJobPS.h and nsPrintJobPS.h for details.

Implements nsIPrintJobPS.

Reimplemented in nsPrintJobCUPS, and nsPrintJobPipePS.

Definition at line 114 of file nsPrintJobPS.cpp.

{
    NS_PRECONDITION(aHandle, "aHandle is NULL");
    NS_PRECONDITION(!mDestination.IsEmpty(), "No destination");
    NS_PRECONDITION(!mDestHandle, "Already have a destination handle");

    nsCOMPtr<nsILocalFile> destFile;
    nsresult rv = NS_NewNativeLocalFile(GetDestination(),
            PR_FALSE, getter_AddRefs(destFile));
    if (NS_SUCCEEDED(rv))
        rv = destFile->OpenANSIFileDesc("w", &mDestHandle);
    NS_ENSURE_SUCCESS(rv, NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE);
    NS_POSTCONDITION(mDestHandle,
            "OpenANSIFileDesc succeeded but no file handle");
    *aHandle = mDestHandle;
    return rv;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class nsPrintJobFactoryPS [friend, inherited]

Definition at line 65 of file nsIPrintJobPS.h.


Member Data Documentation

Definition at line 118 of file nsPrintJobPS.h.

Definition at line 119 of file nsPrintJobPS.h.


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