From 461659931d9db718a96b91ae0b1311b1043b6c84 Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Thu, 18 Feb 1999 22:35:11 +0000 Subject: [PATCH] Added the printer support files for GTK git-svn-id: svn://10.0.0.236/trunk@21211 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/gtk/nsDeviceContextSpecFactoryG.cpp | 77 +++++++++++++++++++ .../gfx/src/gtk/nsDeviceContextSpecFactoryG.h | 41 ++++++++++ mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp | 65 ++++++++++++++++ mozilla/gfx/src/gtk/nsDeviceContextSpecG.h | 67 ++++++++++++++++ .../src/gtk2/nsDeviceContextSpecFactoryG.cpp | 77 +++++++++++++++++++ .../src/gtk2/nsDeviceContextSpecFactoryG.h | 41 ++++++++++ .../widget/src/gtk2/nsDeviceContextSpecG.cpp | 65 ++++++++++++++++ .../widget/src/gtk2/nsDeviceContextSpecG.h | 67 ++++++++++++++++ 8 files changed, 500 insertions(+) create mode 100644 mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp create mode 100644 mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.h create mode 100644 mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp create mode 100644 mozilla/gfx/src/gtk/nsDeviceContextSpecG.h create mode 100644 mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp create mode 100644 mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.h create mode 100644 mozilla/widget/src/gtk2/nsDeviceContextSpecG.cpp create mode 100644 mozilla/widget/src/gtk2/nsDeviceContextSpecG.h diff --git a/mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp b/mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp new file mode 100644 index 00000000000..7911e674113 --- /dev/null +++ b/mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsDeviceContextSpecFactoryG.h" +#include "nsDeviceContextSpecG.h" +#include "nsGfxCIID.h" +#include "plstr.h" + +/** ------------------------------------------------------- + * Constructor + * @update dc 2/16/98 + */ +nsDeviceContextSpecFactoryGTK :: nsDeviceContextSpecFactoryGTK() +{ +} + +/** ------------------------------------------------------- + * Destructor + * @update dc 2/16/98 + */ +nsDeviceContextSpecFactoryGTK :: ~nsDeviceContextSpecFactoryGTK() +{ +} + +static NS_DEFINE_IID(kDeviceContextSpecFactoryIID, NS_IDEVICE_CONTEXT_SPEC_FACTORY_IID); +static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); +static NS_DEFINE_IID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); + +NS_IMPL_QUERY_INTERFACE(nsDeviceContextSpecFactoryMac, kDeviceContextSpecFactoryIID) +NS_IMPL_ADDREF(nsDeviceContextSpecFactoryMac) +NS_IMPL_RELEASE(nsDeviceContextSpecFactoryMac) + +/** ------------------------------------------------------- + * Initialize the device context spec factory + * @update dc 2/16/98 + */ +NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: Init(void) +{ + return NS_OK; +} + +/** ------------------------------------------------------- + * Get a device context specification + * @update dc 2/16/98 + */ +NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: CreateDeviceContextSpec(nsIDeviceContextSpec *aOldSpec, + nsIDeviceContextSpec *&aNewSpec, + PRBool aQuiet) +{ +nsresult rv = NS_ERROR_FAILURE; +nsIDeviceContextSpec *devSpec = nsnull; + + nsRepository::CreateInstance(kDeviceContextSpecCID, nsnull, kIDeviceContextSpecIID, (void **)&devSpec); + + if (nsnull != devSpec){ + if (NS_OK == ((nsDeviceContextSpecGTK *)devSpec)->Init(aQuiet)){ + aNewSpec = devSpec; + rv = NS_OK; + } + } + return rv; +} diff --git a/mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.h b/mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.h new file mode 100644 index 00000000000..465f2f54384 --- /dev/null +++ b/mozilla/gfx/src/gtk/nsDeviceContextSpecFactoryG.h @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsDeviceContextSpecFactoryG_h___ +#define nsDeviceContextSpecFactoryG_h___ + +#include "nsIDeviceContextSpecFactory.h" +#include "nsIDeviceContextSpec.h" + +class nsDeviceContextSpecFactoryGTK : public nsIDeviceContextSpecFactory +{ +public: + nsDeviceContextSpecFactoryGTK(); + + NS_DECL_ISUPPORTS + + NS_IMETHOD Init(void); + NS_IMETHOD CreateDeviceContextSpec(nsIDeviceContextSpec *aOldSpec, + nsIDeviceContextSpec *&aNewSpec, + PRBool aQuiet); + +protected: + ~nsDeviceContextSpecFactoryGTK(); +}; + +#endif diff --git a/mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp b/mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp new file mode 100644 index 00000000000..a1c6aadd1ee --- /dev/null +++ b/mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsDeviceContextSpecG.h" +//#include "prmem.h" +//#include "plstr.h" + +/** ------------------------------------------------------- + * Construct the nsDeviceContextSpecMac + * @update dc 12/02/98 + */ +nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK() +{ + NS_INIT_REFCNT(); + +} + +/** ------------------------------------------------------- + * Destroy the nsDeviceContextSpecMac + * @update dc 2/15/98 + */ +nsDeviceContextSpecGTK :: ~nsDeviceContextSpecGTK() +{ + + +} + +static NS_DEFINE_IID(kDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); + +NS_IMPL_QUERY_INTERFACE(nsDeviceContextSpecGTK, kDeviceContextSpecIID) +NS_IMPL_ADDREF(nsDeviceContextSpecGTK) +NS_IMPL_RELEASE(nsDeviceContextSpecGTK) + +/** ------------------------------------------------------- + * Initialize the nsDeviceContextSpecGTK + * @update dc 2/15/98 + */ +NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet) +{ + return NS_OK; +} + +/** ------------------------------------------------------- + * Closes the printmanager if it is open. + * @update dc 2/15/98 + */ +NS_IMETHODIMP nsDeviceContextSpecGTK :: ClosePrintManager() +{ + return NS_OK; +} diff --git a/mozilla/gfx/src/gtk/nsDeviceContextSpecG.h b/mozilla/gfx/src/gtk/nsDeviceContextSpecG.h new file mode 100644 index 00000000000..dedaa716bb1 --- /dev/null +++ b/mozilla/gfx/src/gtk/nsDeviceContextSpecG.h @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsDeviceContextSpecG_h___ +#define nsDeviceContextSpecG_h___ + +#include "nsIDeviceContextSpec.h" +#include "nsDeviceContextG.h" + +class nsDeviceContextSpecGTK : public nsIDeviceContextSpec +{ +public: +/** + * Construct a nsDeviceContextSpecMac, which is an object which contains and manages a mac printrecord + * @update dc 12/02/98 + */ + nsDeviceContextSpecGTK(); + + NS_DECL_ISUPPORTS + +/** + * Initialize the nsDeviceContextSpecMac for use. This will allocate a printrecord for use + * @update dc 2/16/98 + * @param aQuiet if PR_TRUE, prevent the need for user intervention + * in obtaining device context spec. if nsnull is passed in for + * the aOldSpec, this will typically result in getting a device + * context spec for the default output device (i.e. default + * printer). + * @return error status + */ + NS_IMETHOD Init(PRBool aQuiet); + + +/** + * Closes the printmanager if it is open. + * @update dc 2/13/98 + * @return error status + */ + NS_IMETHOD ClosePrintManager(); + +protected: +/** + * Destuct a nsDeviceContextSpecMac, this will release the printrecord + * @update dc 2/16/98 + */ + virtual ~nsDeviceContextSpecGTK(); + +protected: + +}; + +#endif diff --git a/mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp b/mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp new file mode 100644 index 00000000000..7911e674113 --- /dev/null +++ b/mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.cpp @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsDeviceContextSpecFactoryG.h" +#include "nsDeviceContextSpecG.h" +#include "nsGfxCIID.h" +#include "plstr.h" + +/** ------------------------------------------------------- + * Constructor + * @update dc 2/16/98 + */ +nsDeviceContextSpecFactoryGTK :: nsDeviceContextSpecFactoryGTK() +{ +} + +/** ------------------------------------------------------- + * Destructor + * @update dc 2/16/98 + */ +nsDeviceContextSpecFactoryGTK :: ~nsDeviceContextSpecFactoryGTK() +{ +} + +static NS_DEFINE_IID(kDeviceContextSpecFactoryIID, NS_IDEVICE_CONTEXT_SPEC_FACTORY_IID); +static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); +static NS_DEFINE_IID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); + +NS_IMPL_QUERY_INTERFACE(nsDeviceContextSpecFactoryMac, kDeviceContextSpecFactoryIID) +NS_IMPL_ADDREF(nsDeviceContextSpecFactoryMac) +NS_IMPL_RELEASE(nsDeviceContextSpecFactoryMac) + +/** ------------------------------------------------------- + * Initialize the device context spec factory + * @update dc 2/16/98 + */ +NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: Init(void) +{ + return NS_OK; +} + +/** ------------------------------------------------------- + * Get a device context specification + * @update dc 2/16/98 + */ +NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: CreateDeviceContextSpec(nsIDeviceContextSpec *aOldSpec, + nsIDeviceContextSpec *&aNewSpec, + PRBool aQuiet) +{ +nsresult rv = NS_ERROR_FAILURE; +nsIDeviceContextSpec *devSpec = nsnull; + + nsRepository::CreateInstance(kDeviceContextSpecCID, nsnull, kIDeviceContextSpecIID, (void **)&devSpec); + + if (nsnull != devSpec){ + if (NS_OK == ((nsDeviceContextSpecGTK *)devSpec)->Init(aQuiet)){ + aNewSpec = devSpec; + rv = NS_OK; + } + } + return rv; +} diff --git a/mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.h b/mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.h new file mode 100644 index 00000000000..465f2f54384 --- /dev/null +++ b/mozilla/widget/src/gtk2/nsDeviceContextSpecFactoryG.h @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsDeviceContextSpecFactoryG_h___ +#define nsDeviceContextSpecFactoryG_h___ + +#include "nsIDeviceContextSpecFactory.h" +#include "nsIDeviceContextSpec.h" + +class nsDeviceContextSpecFactoryGTK : public nsIDeviceContextSpecFactory +{ +public: + nsDeviceContextSpecFactoryGTK(); + + NS_DECL_ISUPPORTS + + NS_IMETHOD Init(void); + NS_IMETHOD CreateDeviceContextSpec(nsIDeviceContextSpec *aOldSpec, + nsIDeviceContextSpec *&aNewSpec, + PRBool aQuiet); + +protected: + ~nsDeviceContextSpecFactoryGTK(); +}; + +#endif diff --git a/mozilla/widget/src/gtk2/nsDeviceContextSpecG.cpp b/mozilla/widget/src/gtk2/nsDeviceContextSpecG.cpp new file mode 100644 index 00000000000..a1c6aadd1ee --- /dev/null +++ b/mozilla/widget/src/gtk2/nsDeviceContextSpecG.cpp @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsDeviceContextSpecG.h" +//#include "prmem.h" +//#include "plstr.h" + +/** ------------------------------------------------------- + * Construct the nsDeviceContextSpecMac + * @update dc 12/02/98 + */ +nsDeviceContextSpecGTK :: nsDeviceContextSpecGTK() +{ + NS_INIT_REFCNT(); + +} + +/** ------------------------------------------------------- + * Destroy the nsDeviceContextSpecMac + * @update dc 2/15/98 + */ +nsDeviceContextSpecGTK :: ~nsDeviceContextSpecGTK() +{ + + +} + +static NS_DEFINE_IID(kDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); + +NS_IMPL_QUERY_INTERFACE(nsDeviceContextSpecGTK, kDeviceContextSpecIID) +NS_IMPL_ADDREF(nsDeviceContextSpecGTK) +NS_IMPL_RELEASE(nsDeviceContextSpecGTK) + +/** ------------------------------------------------------- + * Initialize the nsDeviceContextSpecGTK + * @update dc 2/15/98 + */ +NS_IMETHODIMP nsDeviceContextSpecGTK :: Init(PRBool aQuiet) +{ + return NS_OK; +} + +/** ------------------------------------------------------- + * Closes the printmanager if it is open. + * @update dc 2/15/98 + */ +NS_IMETHODIMP nsDeviceContextSpecGTK :: ClosePrintManager() +{ + return NS_OK; +} diff --git a/mozilla/widget/src/gtk2/nsDeviceContextSpecG.h b/mozilla/widget/src/gtk2/nsDeviceContextSpecG.h new file mode 100644 index 00000000000..dedaa716bb1 --- /dev/null +++ b/mozilla/widget/src/gtk2/nsDeviceContextSpecG.h @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsDeviceContextSpecG_h___ +#define nsDeviceContextSpecG_h___ + +#include "nsIDeviceContextSpec.h" +#include "nsDeviceContextG.h" + +class nsDeviceContextSpecGTK : public nsIDeviceContextSpec +{ +public: +/** + * Construct a nsDeviceContextSpecMac, which is an object which contains and manages a mac printrecord + * @update dc 12/02/98 + */ + nsDeviceContextSpecGTK(); + + NS_DECL_ISUPPORTS + +/** + * Initialize the nsDeviceContextSpecMac for use. This will allocate a printrecord for use + * @update dc 2/16/98 + * @param aQuiet if PR_TRUE, prevent the need for user intervention + * in obtaining device context spec. if nsnull is passed in for + * the aOldSpec, this will typically result in getting a device + * context spec for the default output device (i.e. default + * printer). + * @return error status + */ + NS_IMETHOD Init(PRBool aQuiet); + + +/** + * Closes the printmanager if it is open. + * @update dc 2/13/98 + * @return error status + */ + NS_IMETHOD ClosePrintManager(); + +protected: +/** + * Destuct a nsDeviceContextSpecMac, this will release the printrecord + * @update dc 2/16/98 + */ + virtual ~nsDeviceContextSpecGTK(); + +protected: + +}; + +#endif