Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsPrintOptionsImpl.cpp File Reference
#include "nsPrintOptionsImpl.h"
#include "nsCoord.h"
#include "nsUnitConversion.h"
#include "nsReadableUtils.h"
#include "nsPrintSettingsImpl.h"
#include "nsIDOMWindow.h"
#include "nsIServiceManager.h"
#include "nsIDialogParamBlock.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIWindowWatcher.h"
#include "nsIDOMWindowInternal.h"
#include "nsVoidArray.h"
#include "nsSupportsArray.h"
#include "prprf.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsISimpleEnumerator.h"
#include "nsGfxCIID.h"
#include "stdlib.h"
#include "nsAutoPtr.h"

Go to the source code of this file.

Classes

class  nsPrinterListEnumerator

Defines

#define DUMP_STR(_a1, _a2, _a3)
#define DUMP_BOOL(_a1, _a2, _a3)
#define DUMP_INT(_a1, _a2, _a3)
#define DUMP_DBL(_a1, _a2, _a3)
#define GETBOOLPREF(_prefname, _retval)
#define GETSTRPREF(_prefname, _retval)
#define GETINTPREF(_prefname, _retval)
#define GETDBLPREF(_prefname, _retval)

Functions

static NS_DEFINE_IID (kCPrinterEnumerator, NS_PRINTER_ENUMERATOR_CID)
static NS_DEFINE_IID (kPrinterEnumeratorCID, NS_PRINTER_ENUMERATOR_CID)
static nsresult GetAdjustedPrinterName (nsIPrintSettings *aPS, PRBool aUsePNP, nsAString &aPrinterName)
 
Helper function - Returns either the name or sets the length to zero

Variables

static const char kMarginTop [] = "print_margin_top"
static const char kMarginLeft [] = "print_margin_left"
static const char kMarginBottom [] = "print_margin_bottom"
static const char kMarginRight [] = "print_margin_right"
static const char kPrintEvenPages [] = "print_evenpages"
static const char kPrintOddPages [] = "print_oddpages"
static const char kPrintHeaderStrLeft [] = "print_headerleft"
static const char kPrintHeaderStrCenter [] = "print_headercenter"
static const char kPrintHeaderStrRight [] = "print_headerright"
static const char kPrintFooterStrLeft [] = "print_footerleft"
static const char kPrintFooterStrCenter [] = "print_footercenter"
static const char kPrintFooterStrRight [] = "print_footerright"
static const char kPrintPaperSize [] = "print_paper_size"
static const char kPrintReversed [] = "print_reversed"
static const char kPrintInColor [] = "print_in_color"
static const char kPrintPaperName [] = "print_paper_name"
static const char kPrintPlexName [] = "print_plex_name"
static const char kPrintPaperSizeType [] = "print_paper_size_type"
static const char kPrintPaperData [] = "print_paper_data"
static const char kPrintPaperSizeUnit [] = "print_paper_size_unit"
static const char kPrintPaperWidth [] = "print_paper_width"
static const char kPrintPaperHeight [] = "print_paper_height"
static const char kPrintColorspace [] = "print_colorspace"
static const char kPrintResolutionName [] = "print_resolution_name"
static const char kPrintDownloadFonts [] = "print_downloadfonts"
static const char kPrintOrientation [] = "print_orientation"
static const char kPrintCommand [] = "print_command"
static const char kPrinterName [] = "print_printer"
static const char kPrintToFile [] = "print_to_file"
static const char kPrintToFileName [] = "print_to_filename"
static const char kPrintPageDelay [] = "print_pagedelay"
static const char kPrintBGColors [] = "print_bgcolor"
static const char kPrintBGImages [] = "print_bgimages"
static const char kPrintShrinkToFit [] = "print_shrink_to_fit"
static const char kPrintScaling [] = "print_scaling"
static const char kJustLeft [] = "left"
static const char kJustCenter [] = "center"
static const char kJustRight [] = "right"

Define Documentation

#define DUMP_BOOL (   _a1,
  _a2,
  _a3 
)

Definition at line 360 of file nsPrintOptionsImpl.cpp.

#define DUMP_DBL (   _a1,
  _a2,
  _a3 
)

Definition at line 362 of file nsPrintOptionsImpl.cpp.

#define DUMP_INT (   _a1,
  _a2,
  _a3 
)

Definition at line 361 of file nsPrintOptionsImpl.cpp.

#define DUMP_STR (   _a1,
  _a2,
  _a3 
)

Definition at line 359 of file nsPrintOptionsImpl.cpp.

#define GETBOOLPREF (   _prefname,
  _retval 
)
Value:
NS_SUCCEEDED(                                         \
    mPrefBranch->GetBoolPref(                           \
      GetPrefName(_prefname, aPrinterName), _retval     \
    )                                                   \
  )
#define GETDBLPREF (   _prefname,
  _retval 
)
Value:
NS_SUCCEEDED(                                         \
    ReadPrefDouble(                                     \
      GetPrefName(_prefname, aPrinterName), _retval     \
    )                                                   \
  )
#define GETINTPREF (   _prefname,
  _retval 
)
Value:
NS_SUCCEEDED(                                         \
    mPrefBranch->GetIntPref(                            \
      GetPrefName(_prefname, aPrinterName), _retval     \
    )                                                   \
  )
#define GETSTRPREF (   _prefname,
  _retval 
)
Value:
NS_SUCCEEDED(                                         \
    ReadPrefString(                                     \
      GetPrefName(_prefname, aPrinterName), _retval     \
    )                                                   \
  )

Function Documentation

static nsresult GetAdjustedPrinterName ( nsIPrintSettings aPS,
PRBool  aUsePNP,
nsAString &  aPrinterName 
) [static]


Helper function - Returns either the name or sets the length to zero

Definition at line 1077 of file nsPrintOptionsImpl.cpp.

{
  NS_ENSURE_ARG_POINTER(aPS);

  aPrinterName.Truncate();
  if (!aUsePNP)
    return NS_OK;

  // Get the Printer Name from the PrintSettings 
  // to use as a prefix for Pref Names
  PRUnichar* prtName = nsnull;

  nsresult rv = aPS->GetPrinterName(&prtName);
  NS_ENSURE_SUCCESS(rv, rv);

  aPrinterName = nsDependentString(prtName);

  // Convert any whitespaces, carriage returns or newlines to _
  // The below algorithm is supposedly faster than using iterators
  NS_NAMED_LITERAL_STRING(replSubstr, "_");
  const char* replaceStr = " \n\r";

  PRInt32 x;
  for (x=0; x < (PRInt32)strlen(replaceStr); x++) {
    PRUnichar uChar = replaceStr[x];

    PRInt32 i = 0;
    while ((i = aPrinterName.FindChar(uChar, i)) != kNotFound) {
      aPrinterName.Replace(i, 1, replSubstr);
      i++;
    }
  }
  return NS_OK;
}
static NS_DEFINE_IID ( kCPrinterEnumerator  ,
NS_PRINTER_ENUMERATOR_CID   
) [static]
static NS_DEFINE_IID ( kPrinterEnumeratorCID  ,
NS_PRINTER_ENUMERATOR_CID   
) [static]

Variable Documentation

const char kJustCenter[] = "center" [static]

Definition at line 115 of file nsPrintOptionsImpl.cpp.

const char kJustLeft[] = "left" [static]

Definition at line 114 of file nsPrintOptionsImpl.cpp.

const char kJustRight[] = "right" [static]

Definition at line 116 of file nsPrintOptionsImpl.cpp.

const char kMarginBottom[] = "print_margin_bottom" [static]

Definition at line 75 of file nsPrintOptionsImpl.cpp.

const char kMarginLeft[] = "print_margin_left" [static]

Definition at line 74 of file nsPrintOptionsImpl.cpp.

const char kMarginRight[] = "print_margin_right" [static]

Definition at line 76 of file nsPrintOptionsImpl.cpp.

const char kMarginTop[] = "print_margin_top" [static]

Definition at line 73 of file nsPrintOptionsImpl.cpp.

const char kPrintBGColors[] = "print_bgcolor" [static]

Definition at line 109 of file nsPrintOptionsImpl.cpp.

const char kPrintBGImages[] = "print_bgimages" [static]

Definition at line 110 of file nsPrintOptionsImpl.cpp.

const char kPrintColorspace[] = "print_colorspace" [static]

Definition at line 100 of file nsPrintOptionsImpl.cpp.

const char kPrintCommand[] = "print_command" [static]

Definition at line 104 of file nsPrintOptionsImpl.cpp.

const char kPrintDownloadFonts[] = "print_downloadfonts" [static]

Definition at line 102 of file nsPrintOptionsImpl.cpp.

const char kPrinterName[] = "print_printer" [static]

Definition at line 105 of file nsPrintOptionsImpl.cpp.

const char kPrintEvenPages[] = "print_evenpages" [static]

Definition at line 79 of file nsPrintOptionsImpl.cpp.

const char kPrintFooterStrCenter[] = "print_footercenter" [static]

Definition at line 85 of file nsPrintOptionsImpl.cpp.

const char kPrintFooterStrLeft[] = "print_footerleft" [static]

Definition at line 84 of file nsPrintOptionsImpl.cpp.

const char kPrintFooterStrRight[] = "print_footerright" [static]

Definition at line 86 of file nsPrintOptionsImpl.cpp.

const char kPrintHeaderStrCenter[] = "print_headercenter" [static]

Definition at line 82 of file nsPrintOptionsImpl.cpp.

const char kPrintHeaderStrLeft[] = "print_headerleft" [static]

Definition at line 81 of file nsPrintOptionsImpl.cpp.

const char kPrintHeaderStrRight[] = "print_headerright" [static]

Definition at line 83 of file nsPrintOptionsImpl.cpp.

const char kPrintInColor[] = "print_in_color" [static]

Definition at line 92 of file nsPrintOptionsImpl.cpp.

const char kPrintOddPages[] = "print_oddpages" [static]

Definition at line 80 of file nsPrintOptionsImpl.cpp.

const char kPrintOrientation[] = "print_orientation" [static]

Definition at line 103 of file nsPrintOptionsImpl.cpp.

const char kPrintPageDelay[] = "print_pagedelay" [static]

Definition at line 108 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperData[] = "print_paper_data" [static]

Definition at line 96 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperHeight[] = "print_paper_height" [static]

Definition at line 99 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperName[] = "print_paper_name" [static]

Definition at line 93 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperSize[] = "print_paper_size" [static]

Definition at line 89 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperSizeType[] = "print_paper_size_type" [static]

Definition at line 95 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperSizeUnit[] = "print_paper_size_unit" [static]

Definition at line 97 of file nsPrintOptionsImpl.cpp.

const char kPrintPaperWidth[] = "print_paper_width" [static]

Definition at line 98 of file nsPrintOptionsImpl.cpp.

const char kPrintPlexName[] = "print_plex_name" [static]

Definition at line 94 of file nsPrintOptionsImpl.cpp.

const char kPrintResolutionName[] = "print_resolution_name" [static]

Definition at line 101 of file nsPrintOptionsImpl.cpp.

const char kPrintReversed[] = "print_reversed" [static]

Definition at line 91 of file nsPrintOptionsImpl.cpp.

const char kPrintScaling[] = "print_scaling" [static]

Definition at line 112 of file nsPrintOptionsImpl.cpp.

const char kPrintShrinkToFit[] = "print_shrink_to_fit" [static]

Definition at line 111 of file nsPrintOptionsImpl.cpp.

const char kPrintToFile[] = "print_to_file" [static]

Definition at line 106 of file nsPrintOptionsImpl.cpp.

const char kPrintToFileName[] = "print_to_filename" [static]

Definition at line 107 of file nsPrintOptionsImpl.cpp.