Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions
nsPrinterEnumeratorPh Class Reference

#include <nsDeviceContextSpecPh.h>

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

List of all members.

Public Member Functions

 nsPrinterEnumeratorPh ()
 ~nsPrinterEnumeratorPh ()
void initPrintSettingsFromPrinter (in wstring aPrinterName, in nsIPrintSettings aPrintSettings)
 Initializes certain settings from the native printer into the PrintSettings These settings include, but are not limited to: Page Orientation Page Size Number of Copies.
void enumeratePrinters (out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult)
 Returns an array of the names of all installed printers.
void displayPropertiesDlg (in wstring aPrinter, in nsIPrintSettings aPrintSettings)

Public Attributes

readonly attribute wstring defaultPrinterName
 The name of the default printer This name must be in the list of printer names returned by "availablePrinters".

Private Member Functions

nsresult DoEnumeratePrinters (PRBool aDoExtended, PRUint32 *aCount, PRUnichar ***aResult)

Detailed Description

Definition at line 64 of file nsDeviceContextSpecPh.h.


Constructor & Destructor Documentation

Definition at line 230 of file nsDeviceContextSpecPh.cpp.

{
}

Definition at line 234 of file nsDeviceContextSpecPh.cpp.

{
}

Member Function Documentation

void nsIPrinterEnumerator::displayPropertiesDlg ( in wstring  aPrinter,
in nsIPrintSettings  aPrintSettings 
) [inherited]
nsresult nsPrinterEnumeratorPh::DoEnumeratePrinters ( PRBool  aDoExtended,
PRUint32 aCount,
PRUnichar ***  aResult 
) [private]

Definition at line 296 of file nsDeviceContextSpecPh.cpp.

{
       NS_ENSURE_ARG(aCount);
       NS_ENSURE_ARG_POINTER(aResult);

       char   **plist = NULL;
       int           pcount = 0, count = 0;

       if (!(plist = PpLoadPrinterList()))
              return NS_ERROR_FAILURE;

       for (pcount = 0; plist[pcount] != NULL; pcount++);

       /* allow a fake <Preview> printer to do the photon native preview */
       pcount++;

       PRUnichar** array = (PRUnichar**) nsMemory::Alloc(pcount * sizeof(PRUnichar*));
       if (!array)
       {
              PpFreePrinterList(plist);
              return NS_ERROR_OUT_OF_MEMORY;
       }

       while (count < pcount) 
       {
              nsString newName;

              if( count < pcount-1 )
                     newName.AssignWithConversion(plist[count]);
              else newName.AssignWithConversion( "<Preview>" );

              PRUnichar *str = ToNewUnicode(newName);
              if (!str) 
              {
                     CleanupArray(array, count);
                     PpFreePrinterList(plist);
                     return NS_ERROR_OUT_OF_MEMORY;
              }
              array[count++] = str;
       }

       *aCount  = count;
       *aResult = array;

       return NS_OK;
}

Here is the call graph for this function:

void nsIPrinterEnumerator::enumeratePrinters ( out PRUint32  aCount,
[retval, array, size_is(aCount)] out wstring  aResult 
) [inherited]

Returns an array of the names of all installed printers.

Parameters:
aCountreturns number of printers returned
aResultreturns array of names
Returns:
void
void nsIPrinterEnumerator::initPrintSettingsFromPrinter ( in wstring  aPrinterName,
in nsIPrintSettings  aPrintSettings 
) [inherited]

Initializes certain settings from the native printer into the PrintSettings These settings include, but are not limited to: Page Orientation Page Size Number of Copies.


Member Data Documentation

The name of the default printer This name must be in the list of printer names returned by "availablePrinters".

Definition at line 121 of file nsIPrintOptions.idl.


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