2006-02-07 01:12:56 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-02-18 22:35:11 +00:00
|
|
|
*
|
2006-02-07 01:12:56 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-02-18 22:35:11 +00:00
|
|
|
*
|
2006-02-07 01:12:56 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-02-18 22:35:11 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2006-02-07 01:12:56 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:43:54 +00:00
|
|
|
*
|
2006-02-07 01:12:41 +00:00
|
|
|
* Contributor(s):
|
2006-02-07 01:12:44 +00:00
|
|
|
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
2006-02-07 01:12:41 +00:00
|
|
|
*
|
2006-02-07 01:12:56 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-02-18 22:35:11 +00:00
|
|
|
|
|
|
|
#include "nsDeviceContextSpecG.h"
|
2006-02-07 01:12:11 +00:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2006-02-07 01:12:18 +00:00
|
|
|
#include "nsIPrintOptions.h"
|
|
|
|
#include "nsGfxCIID.h"
|
2006-02-07 01:12:11 +00:00
|
|
|
|
|
|
|
#include "nsIPref.h"
|
1999-03-31 22:55:29 +00:00
|
|
|
#include "prenv.h" /* for PR_GetEnv */
|
1999-03-31 20:17:01 +00:00
|
|
|
|
2006-02-07 01:12:23 +00:00
|
|
|
#include "nsIDOMWindow.h"
|
2006-02-07 01:12:15 +00:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIDialogParamBlock.h"
|
2006-02-07 01:12:23 +00:00
|
|
|
#include "nsISupportsPrimitives.h"
|
|
|
|
#include "nsIWindowWatcher.h"
|
2006-02-07 01:12:48 +00:00
|
|
|
#include "nsIDOMWindowInternal.h"
|
2006-02-07 01:12:15 +00:00
|
|
|
|
2006-02-07 01:12:18 +00:00
|
|
|
static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
|
2006-02-07 01:12:15 +00:00
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
/** -------------------------------------------------------
|
1999-03-13 03:21:16 +00:00
|
|
|
* Construct the nsDeviceContextSpecGTK
|
1999-02-18 22:35:11 +00:00
|
|
|
* @update dc 12/02/98
|
|
|
|
*/
|
|
|
|
nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK()
|
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** -------------------------------------------------------
|
1999-03-13 03:21:16 +00:00
|
|
|
* Destroy the nsDeviceContextSpecGTK
|
1999-02-18 22:35:11 +00:00
|
|
|
* @update dc 2/15/98
|
|
|
|
*/
|
|
|
|
nsDeviceContextSpecGTK :: ~nsDeviceContextSpecGTK()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1999-03-22 21:45:00 +00:00
|
|
|
static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID);
|
|
|
|
static NS_DEFINE_IID(kIDeviceContextSpecPSIID, NS_IDEVICE_CONTEXT_SPEC_PS_IID);
|
2006-02-07 01:12:13 +00:00
|
|
|
#ifdef USE_XPRINT
|
|
|
|
static NS_DEFINE_IID(kIDeviceContextSpecXPIID, NS_IDEVICE_CONTEXT_SPEC_XP_IID);
|
|
|
|
#endif
|
1999-02-18 22:35:11 +00:00
|
|
|
|
1999-03-22 21:45:00 +00:00
|
|
|
#if 0
|
2006-02-07 01:12:47 +00:00
|
|
|
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK, nsIDeviceContextSpec)
|
1999-03-22 21:45:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
if (nsnull == aInstancePtr)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
if (aIID.Equals(kIDeviceContextSpecIID))
|
|
|
|
{
|
|
|
|
nsIDeviceContextSpec* tmp = this;
|
|
|
|
*aInstancePtr = (void*) tmp;
|
|
|
|
NS_ADDREF_THIS();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aIID.Equals(kIDeviceContextSpecPSIID))
|
|
|
|
{
|
|
|
|
nsIDeviceContextSpecPS* tmp = this;
|
|
|
|
*aInstancePtr = (void*) tmp;
|
|
|
|
NS_ADDREF_THIS();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:12:13 +00:00
|
|
|
#ifdef USE_XPRINT
|
|
|
|
if (aIID.Equals(kIDeviceContextSpecXPIID))
|
|
|
|
{
|
2006-02-07 01:12:41 +00:00
|
|
|
nsIDeviceContextSpecXp *tmp = this;
|
|
|
|
*aInstancePtr = (void*) tmp;
|
2006-02-07 01:12:13 +00:00
|
|
|
NS_ADDREF_THIS();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2006-02-07 01:12:41 +00:00
|
|
|
#endif /* USE_XPRINT */
|
2006-02-07 01:12:13 +00:00
|
|
|
|
1999-03-22 21:45:00 +00:00
|
|
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|
|
|
|
|
|
|
if (aIID.Equals(kISupportsIID))
|
|
|
|
{
|
|
|
|
nsIDeviceContextSpec* tmp = this;
|
|
|
|
nsISupports* tmp2 = tmp;
|
|
|
|
*aInstancePtr = (void*) tmp2;
|
|
|
|
NS_ADDREF_THIS();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
NS_IMPL_ADDREF(nsDeviceContextSpecGTK)
|
|
|
|
NS_IMPL_RELEASE(nsDeviceContextSpecGTK)
|
|
|
|
|
|
|
|
/** -------------------------------------------------------
|
|
|
|
* Initialize the nsDeviceContextSpecGTK
|
|
|
|
* @update dc 2/15/98
|
1999-03-13 03:21:16 +00:00
|
|
|
* @update syd 3/2/99
|
2006-02-07 01:12:41 +00:00
|
|
|
*
|
|
|
|
* gisburn: Please note that this function exists as 1:1 copy in other
|
|
|
|
* toolkits including:
|
|
|
|
* - GTK+-toolkit:
|
|
|
|
* file: mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp
|
|
|
|
* function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet)
|
|
|
|
* - Xlib-toolkit:
|
|
|
|
* file: mozilla/gfx/src/xlib/nsDeviceContextSpecXlib.cpp
|
|
|
|
* function: NS_IMETHODIMP nsDeviceContextSpecXlib::Init(PRBool aQuiet)
|
|
|
|
* - Qt-toolkit:
|
|
|
|
* file: mozilla/gfx/src/qt/nsDeviceContextSpecQT.cpp
|
|
|
|
* function: NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aQuiet)
|
|
|
|
*
|
|
|
|
* ** Please update the other toolkits when changing this function.
|
1999-02-18 22:35:11 +00:00
|
|
|
*/
|
2006-02-07 01:12:41 +00:00
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet)
|
1999-02-18 22:35:11 +00:00
|
|
|
{
|
2006-02-07 01:12:41 +00:00
|
|
|
nsresult rv = NS_ERROR_FAILURE;
|
2006-02-07 01:12:18 +00:00
|
|
|
|
2006-02-07 01:12:41 +00:00
|
|
|
nsCOMPtr<nsIPrintOptions> printService(do_GetService(kPrintOptionsCID, &rv));
|
|
|
|
NS_ASSERTION(nsnull != printService, "No print service.");
|
|
|
|
|
2006-02-07 01:12:18 +00:00
|
|
|
// if there is a current selection then enable the "Selection" radio button
|
|
|
|
if (NS_SUCCEEDED(rv) && printService) {
|
|
|
|
PRBool isOn;
|
2006-02-07 01:12:20 +00:00
|
|
|
printService->GetPrintOptions(nsIPrintOptions::kPrintOptionsEnableSelectionRB, &isOn);
|
2006-02-07 01:12:18 +00:00
|
|
|
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
|
|
|
if (NS_SUCCEEDED(rv) && pPrefs) {
|
|
|
|
(void) pPrefs->SetBoolPref("print.selection_radio_enabled", isOn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:12:41 +00:00
|
|
|
char *path;
|
2006-02-07 01:12:24 +00:00
|
|
|
PRBool canPrint = PR_FALSE;
|
2006-02-07 01:12:20 +00:00
|
|
|
PRBool reversed = PR_FALSE;
|
|
|
|
PRBool color = PR_FALSE;
|
|
|
|
PRBool tofile = PR_FALSE;
|
|
|
|
PRInt16 printRange = nsIPrintOptions::kRangeAllPages;
|
|
|
|
PRInt32 paper_size = NS_LETTER_SIZE;
|
2006-02-07 01:12:51 +00:00
|
|
|
PRInt32 orientation = NS_PORTRAIT;
|
2006-02-07 01:12:20 +00:00
|
|
|
PRInt32 fromPage = 1;
|
|
|
|
PRInt32 toPage = 1;
|
|
|
|
PRUnichar *command = nsnull;
|
|
|
|
PRUnichar *printfile = nsnull;
|
|
|
|
double dleft = 0.5;
|
|
|
|
double dright = 0.5;
|
|
|
|
double dtop = 0.5;
|
|
|
|
double dbottom = 0.5;
|
2006-02-07 01:12:15 +00:00
|
|
|
|
2006-02-07 01:12:24 +00:00
|
|
|
if (PR_FALSE == aQuiet ) {
|
|
|
|
rv = NS_ERROR_FAILURE;
|
|
|
|
nsCOMPtr<nsIDialogParamBlock> ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1"));
|
2006-02-07 01:12:23 +00:00
|
|
|
|
2006-02-07 01:12:24 +00:00
|
|
|
nsCOMPtr<nsISupportsInterfacePointer> paramBlockWrapper;
|
|
|
|
if (ioParamBlock)
|
|
|
|
paramBlockWrapper = do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID);
|
2006-02-07 01:12:23 +00:00
|
|
|
|
2006-02-07 01:12:24 +00:00
|
|
|
if (paramBlockWrapper) {
|
|
|
|
paramBlockWrapper->SetData(ioParamBlock);
|
|
|
|
paramBlockWrapper->SetDataIID(&NS_GET_IID(nsIDialogParamBlock));
|
|
|
|
|
|
|
|
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
|
|
|
if (wwatch) {
|
2006-02-07 01:12:48 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMWindowInternal> parent;
|
|
|
|
nsCOMPtr<nsIDOMWindow> active;
|
|
|
|
wwatch->GetActiveWindow(getter_AddRefs(active));
|
|
|
|
if (active) {
|
|
|
|
active->QueryInterface(NS_GET_IID(nsIDOMWindowInternal), getter_AddRefs(parent));
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:12:24 +00:00
|
|
|
nsCOMPtr<nsIDOMWindow> newWindow;
|
2006-02-07 01:12:48 +00:00
|
|
|
rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul",
|
2006-02-07 01:12:41 +00:00
|
|
|
"_blank", "chrome,modal", paramBlockWrapper,
|
|
|
|
getter_AddRefs(newWindow));
|
2006-02-07 01:12:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
PRInt32 buttonPressed = 0;
|
|
|
|
ioParamBlock->GetInt(0, &buttonPressed);
|
|
|
|
if (buttonPressed == 0) {
|
|
|
|
canPrint = PR_TRUE;
|
|
|
|
}
|
2006-02-07 01:12:23 +00:00
|
|
|
}
|
2006-02-07 01:12:24 +00:00
|
|
|
} else {
|
|
|
|
canPrint = PR_TRUE;
|
2006-02-07 01:12:23 +00:00
|
|
|
}
|
2006-02-07 01:12:15 +00:00
|
|
|
|
2006-02-07 01:12:24 +00:00
|
|
|
if (canPrint) {
|
|
|
|
if (printService) {
|
|
|
|
printService->GetPrintReversed(&reversed);
|
|
|
|
printService->GetPrintInColor(&color);
|
|
|
|
printService->GetPaperSize(&paper_size);
|
2006-02-07 01:12:51 +00:00
|
|
|
printService->GetOrientation(&orientation);
|
2006-02-07 01:12:24 +00:00
|
|
|
printService->GetPrintCommand(&command);
|
|
|
|
printService->GetPrintRange(&printRange);
|
|
|
|
printService->GetToFileName(&printfile);
|
|
|
|
printService->GetPrintToFile(&tofile);
|
|
|
|
printService->GetStartPageRange(&fromPage);
|
|
|
|
printService->GetEndPageRange(&toPage);
|
|
|
|
printService->GetMarginTop(&dtop);
|
|
|
|
printService->GetMarginLeft(&dleft);
|
|
|
|
printService->GetMarginBottom(&dbottom);
|
|
|
|
printService->GetMarginRight(&dright);
|
|
|
|
|
|
|
|
if (command != nsnull && printfile != nsnull) {
|
2006-02-07 01:12:41 +00:00
|
|
|
// ToDo: Use LocalEncoding instead of UTF-8 (see bug 73446)
|
|
|
|
strcpy(mPrData.command, NS_ConvertUCS2toUTF8(command).get());
|
|
|
|
strcpy(mPrData.path, NS_ConvertUCS2toUTF8(printfile).get());
|
2006-02-07 01:12:24 +00:00
|
|
|
}
|
2006-02-07 01:12:18 +00:00
|
|
|
#ifdef DEBUG_rods
|
2006-02-07 01:12:41 +00:00
|
|
|
printf("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright);
|
|
|
|
printf("printRange %d\n", printRange);
|
|
|
|
printf("fromPage %d\n", fromPage);
|
|
|
|
printf("toPage %d\n", toPage);
|
|
|
|
#endif /* DEBUG_rods */
|
|
|
|
} else {
|
|
|
|
#ifdef VMS
|
|
|
|
// Note to whoever puts the "lpr" into the prefs file. Please contact me
|
|
|
|
// as I need to make the default be "print" instead of "lpr" for OpenVMS.
|
|
|
|
strcpy(mPrData.command, "print");
|
1999-12-01 11:58:21 +00:00
|
|
|
#else
|
2006-02-07 01:12:41 +00:00
|
|
|
strcpy(mPrData.command, "lpr");
|
|
|
|
#endif /* VMS */
|
|
|
|
}
|
|
|
|
|
|
|
|
mPrData.top = dtop;
|
|
|
|
mPrData.bottom = dbottom;
|
|
|
|
mPrData.left = dleft;
|
|
|
|
mPrData.right = dright;
|
|
|
|
mPrData.fpf = !reversed;
|
|
|
|
mPrData.grayscale = !color;
|
|
|
|
mPrData.size = paper_size;
|
2006-02-07 01:12:51 +00:00
|
|
|
mPrData.orientation = orientation;
|
2006-02-07 01:12:41 +00:00
|
|
|
mPrData.toPrinter = !tofile;
|
|
|
|
|
|
|
|
// PWD, HOME, or fail
|
2006-02-07 01:12:23 +00:00
|
|
|
|
2006-02-07 01:12:41 +00:00
|
|
|
if (!printfile) {
|
|
|
|
if ( ( path = PR_GetEnv( "PWD" ) ) == (char *) nsnull )
|
|
|
|
if ( ( path = PR_GetEnv( "HOME" ) ) == (char *) nsnull )
|
|
|
|
strcpy(mPrData.path, "mozilla.ps");
|
|
|
|
|
|
|
|
if ( path != (char *) nsnull )
|
|
|
|
sprintf(mPrData.path, "%s/mozilla.ps", path);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
if (command != nsnull) {
|
|
|
|
nsMemory::Free(command);
|
|
|
|
}
|
|
|
|
if (printfile != nsnull) {
|
|
|
|
nsMemory::Free(printfile);
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:12:24 +00:00
|
|
|
return NS_OK;
|
2006-02-07 01:12:11 +00:00
|
|
|
}
|
2006-02-07 01:12:41 +00:00
|
|
|
|
2006-02-07 01:12:15 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
1999-02-18 22:35:11 +00:00
|
|
|
}
|
|
|
|
|
1999-03-22 21:45:00 +00:00
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetToPrinter( PRBool &aToPrinter )
|
|
|
|
{
|
|
|
|
aToPrinter = mPrData.toPrinter;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetFirstPageFirst ( PRBool &aFpf )
|
|
|
|
{
|
|
|
|
aFpf = mPrData.fpf;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetGrayscale ( PRBool &aGrayscale )
|
|
|
|
{
|
|
|
|
aGrayscale = mPrData.grayscale;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetSize ( int &aSize )
|
|
|
|
{
|
|
|
|
aSize = mPrData.size;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-12-14 02:16:17 +00:00
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetPageDimensions ( float &aWidth, float &aHeight )
|
|
|
|
{
|
|
|
|
if ( mPrData.size == NS_LETTER_SIZE ) {
|
|
|
|
aWidth = 8.5;
|
|
|
|
aHeight = 11.0;
|
|
|
|
} else if ( mPrData.size == NS_LEGAL_SIZE ) {
|
|
|
|
aWidth = 8.5;
|
|
|
|
aHeight = 14.0;
|
|
|
|
} else if ( mPrData.size == NS_EXECUTIVE_SIZE ) {
|
|
|
|
aWidth = 7.5;
|
|
|
|
aHeight = 10.0;
|
|
|
|
} else if ( mPrData.size == NS_A4_SIZE ) {
|
|
|
|
// 210mm X 297mm == 8.27in X 11.69in
|
|
|
|
aWidth = 8.27;
|
|
|
|
aHeight = 11.69;
|
2006-02-07 01:12:42 +00:00
|
|
|
} else if ( mPrData.size == NS_A3_SIZE ) {
|
|
|
|
// 297mm X 420mm == 11.69in X 16.53in
|
|
|
|
aWidth = 11.69;
|
|
|
|
aHeight = 16.53; }
|
2006-02-07 01:12:51 +00:00
|
|
|
|
|
|
|
if (mPrData.orientation == NS_LANDSCAPE) {
|
|
|
|
float temp;
|
|
|
|
temp = aWidth;
|
|
|
|
aWidth = aHeight;
|
|
|
|
aHeight = temp;
|
|
|
|
}
|
|
|
|
|
1999-12-14 02:16:17 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:12:51 +00:00
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetLandscape ( PRBool &landscape )
|
|
|
|
{
|
|
|
|
landscape = (mPrData.orientation == NS_LANDSCAPE);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-03-22 21:45:00 +00:00
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetTopMargin ( float &value )
|
|
|
|
{
|
|
|
|
value = mPrData.top;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetBottomMargin ( float &value )
|
|
|
|
{
|
|
|
|
value = mPrData.bottom;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetRightMargin ( float &value )
|
|
|
|
{
|
|
|
|
value = mPrData.right;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetLeftMargin ( float &value )
|
|
|
|
{
|
|
|
|
value = mPrData.left;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetCommand ( char **aCommand )
|
|
|
|
{
|
|
|
|
*aCommand = &mPrData.command[0];
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetPath ( char **aPath )
|
|
|
|
{
|
|
|
|
*aPath = &mPrData.path[0];
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: GetUserCancelled( PRBool &aCancel )
|
|
|
|
{
|
|
|
|
aCancel = mPrData.cancel;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-02-07 01:12:44 +00:00
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK::GetPrintMethod(PrintMethod &aMethod)
|
2006-02-07 01:12:13 +00:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2006-02-07 01:12:17 +00:00
|
|
|
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
2006-02-07 01:12:13 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && pPrefs) {
|
2006-02-07 01:12:44 +00:00
|
|
|
PRInt32 method = (PRInt32)pmAuto;
|
2006-02-07 01:12:13 +00:00
|
|
|
(void) pPrefs->GetIntPref("print.print_method", &method);
|
2006-02-07 01:12:44 +00:00
|
|
|
aMethod = (PrintMethod)method;
|
|
|
|
if (aMethod == pmAuto)
|
|
|
|
aMethod = NS_DEFAULT_PRINT_METHOD;
|
2006-02-07 01:12:13 +00:00
|
|
|
} else {
|
2006-02-07 01:12:25 +00:00
|
|
|
aMethod = NS_DEFAULT_PRINT_METHOD;
|
2006-02-07 01:12:13 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-02-18 22:35:11 +00:00
|
|
|
/** -------------------------------------------------------
|
|
|
|
* Closes the printmanager if it is open.
|
|
|
|
* @update dc 2/15/98
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsDeviceContextSpecGTK :: ClosePrintManager()
|
|
|
|
{
|
2006-02-07 01:12:41 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|