diff --git a/gfx/idl/Makefile.in b/gfx/idl/Makefile.in index 6915f404c49..44c830f1939 100644 --- a/gfx/idl/Makefile.in +++ b/gfx/idl/Makefile.in @@ -50,10 +50,6 @@ XPIDLSRCS = \ nsIFontEnumerator.idl \ nsIFontList.idl \ nsIScriptableRegion.idl \ - nsIPrintOptions.idl \ - nsIPrintSettings.idl \ - nsIPrintSettingsService.idl \ - nsIPrintSession.idl \ gfxIFormats.idl \ gfxIImageFrame.idl \ gfxtypes.idl \ @@ -66,19 +62,9 @@ XPIDLSRCS += \ $(NULL) endif -ifneq (,$(filter mac cocoa,$(MOZ_GFX_TOOLKIT))) -XPIDLSRCS += nsIPrintSettingsX.idl \ - nsIPrintSessionX.idl \ - $(NULL) -endif - ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) XPIDLSRCS += nsIQDFlushManager.idl endif -ifeq ($(MOZ_GFX_TOOLKIT),windows) -XPIDLSRCS += nsIPrintSettingsWin.idl -endif - include $(topsrcdir)/config/rules.mk diff --git a/gfx/idl/nsIPrintOptions.idl b/gfx/idl/nsIPrintOptions.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSession.idl b/gfx/idl/nsIPrintSession.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSessionX.idl b/gfx/idl/nsIPrintSessionX.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSettings.idl b/gfx/idl/nsIPrintSettings.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSettingsMac.idl b/gfx/idl/nsIPrintSettingsMac.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSettingsService.idl b/gfx/idl/nsIPrintSettingsService.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSettingsWin.idl b/gfx/idl/nsIPrintSettingsWin.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/idl/nsIPrintSettingsX.idl b/gfx/idl/nsIPrintSettingsX.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/public/Makefile.in b/gfx/public/Makefile.in index 5b9f71cb260..98cfd011334 100644 --- a/gfx/public/Makefile.in +++ b/gfx/public/Makefile.in @@ -65,8 +65,6 @@ EXPORTS = \ nsGfxCIID.h \ nsIRegion.h \ nsDeviceContext.h \ - nsIDeviceContextSpec.h \ - nsIDeviceContextSpecFactory.h \ nsIDrawingSurface.h \ nsITheme.h \ nsThemeConstants.h \ diff --git a/gfx/public/nsGfxCIID.h b/gfx/public/nsGfxCIID.h index 51f023dc110..513743214f1 100644 --- a/gfx/public/nsGfxCIID.h +++ b/gfx/public/nsGfxCIID.h @@ -78,34 +78,10 @@ { 0x6049b264, 0xc1e6, 0x11d1, \ { 0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } -#define NS_DEVICE_CONTEXT_SPEC_CID \ -{ 0xd7193600, 0x78e0, 0x11d2, \ -{ 0xa8, 0x46, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } - -#define NS_DEVICE_CONTEXT_SPEC_FACTORY_CID \ -{ 0xec5bebb0, 0x7b51, 0x11d2, \ -{ 0xa8, 0x48, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } - #define NS_DRAWING_SURFACE_CID \ { 0x199c7040, 0xcab0, 0x11d2, \ { 0xa8, 0x49, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } -#define NS_PRINTSETTINGSSERVICE_CID \ -{ 0x841387c8, 0x72e6, 0x484b, \ -{ 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a } } - -// NOTE: This now has the same CID as NS_PRINTSETTINGSSERVICE_CID -// will go away when Bug 144114 is fixed -#define NS_PRINTOPTIONS_CID NS_PRINTSETTINGSSERVICE_CID - -#define NS_PRINTER_ENUMERATOR_CID \ -{ 0xa6cf9129, 0x15b3, 0x11d2, \ -{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } - -#define NS_PRINTSESSION_CID \ -{ 0x2f977d53, 0x5485, 0x11d4, \ -{ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 } } - #define NS_FONTCATALOGSERVICE_CID \ { 0xa3057187, 0xc40f, 0x4ffa, \ { 0x91, 0x60, 0x2b, 0x16, 0x48, 0x20, 0x53, 0xb1 } } diff --git a/gfx/public/nsIDeviceContextSpec.h b/gfx/public/nsIDeviceContextSpec.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/public/nsIDeviceContextSpecFactory.h b/gfx/public/nsIDeviceContextSpecFactory.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/Makefile.in b/gfx/src/Makefile.in index fca766b6b57..14dee329722 100644 --- a/gfx/src/Makefile.in +++ b/gfx/src/Makefile.in @@ -122,9 +122,6 @@ CPPSRCS = \ nsRegion.cpp \ nsTransform2D.cpp \ nsScriptableRegion.cpp \ - nsPrintOptionsImpl.cpp \ - nsPrintSettingsImpl.cpp \ - nsPrintSession.cpp \ $(NULL) ifeq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT))) diff --git a/gfx/src/nsPrintOptionsImpl.cpp b/gfx/src/nsPrintOptionsImpl.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/nsPrintOptionsImpl.h b/gfx/src/nsPrintOptionsImpl.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/nsPrintSession.cpp b/gfx/src/nsPrintSession.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/nsPrintSession.h b/gfx/src/nsPrintSession.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/nsPrintSettingsImpl.cpp b/gfx/src/nsPrintSettingsImpl.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/nsPrintSettingsImpl.h b/gfx/src/nsPrintSettingsImpl.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/Makefile.in b/gfx/src/windows/Makefile.in index a1107993b33..78826afa9bc 100644 --- a/gfx/src/windows/Makefile.in +++ b/gfx/src/windows/Makefile.in @@ -76,18 +76,10 @@ CPPSRCS = \ nsFontMetricsWin.cpp \ nsImageWin.cpp \ nsRegionWin.cpp \ - nsDeviceContextSpecWin.cpp \ - nsDeviceContextSpecFactoryW.cpp \ nsGfxFactoryWin.cpp \ nsUnicodeRange.cpp \ $(NULL) -ifneq ($(OS_ARCH), WINCE) -CPPSRCS += nsPrintOptionsWin.cpp \ - nsPrintSettingsWin.cpp \ - $(NULL) -endif - EXPORTS = nsIRenderingContextWin.h nsIDrawingSurfaceWin.h EXTRA_DSO_LIBS = gkgfx mozutil_s gfxshared_s @@ -99,7 +91,7 @@ LOCAL_INCLUDES = \ $(NULL) ifndef WINCE -_OS_LIBS = winspool comdlg32 +_OS_LIBS = comdlg32 endif ifdef GNU_CC _OS_LIBS += gdi32 diff --git a/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp b/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsDeviceContextSpecFactoryW.h b/gfx/src/windows/nsDeviceContextSpecFactoryW.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsDeviceContextSpecWin.cpp b/gfx/src/windows/nsDeviceContextSpecWin.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsDeviceContextSpecWin.h b/gfx/src/windows/nsDeviceContextSpecWin.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsGfxFactoryWin.cpp b/gfx/src/windows/nsGfxFactoryWin.cpp index ffc07e525d2..fb391010c6e 100644 --- a/gfx/src/windows/nsGfxFactoryWin.cpp +++ b/gfx/src/windows/nsGfxFactoryWin.cpp @@ -45,13 +45,9 @@ #include "nsDeviceContextWin.h" #include "nsRegionWin.h" #include "nsBlender.h" -#include "nsDeviceContextSpecWin.h" -#include "nsDeviceContextSpecFactoryW.h" #include "nsScriptableRegion.h" -#include "nsPrintOptionsWin.h" #include "nsFontList.h" #include "nsIGenericFactory.h" -#include "nsPrintSession.h" #include "gfxImageFrame.h" @@ -69,12 +65,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList) NS_GENERIC_FACTORY_CONSTRUCTOR(gfxImageFrame) -#ifndef WINCE -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) -#endif - PRBool UseAFunctions() { @@ -216,25 +206,6 @@ static const nsModuleComponentInfo components[] = GFX_IMAGEFRAME_CID, "@mozilla.org/gfx/image/frame;2", gfxImageFrameConstructor, }, - -#ifndef WINCE - { "nsPrintOptionsWin", - NS_PRINTSETTINGSSERVICE_CID, - "@mozilla.org/gfx/printsettings-service;1", - nsPrintOptionsWinConstructor }, - - { "Win Printer Enumerator", - NS_PRINTER_ENUMERATOR_CID, - // "@mozilla.org/gfx/printer_enumerator/win;1", - "@mozilla.org/gfx/printerenumerator;1", - nsPrinterEnumeratorWinConstructor }, - - { "Print Session", - NS_PRINTSESSION_CID, - "@mozilla.org/gfx/printsession;1", - nsPrintSessionConstructor } -#endif - }; NS_IMPL_NSGETMODULE(nsGfxModule, components) diff --git a/gfx/src/windows/nsPrintOptionsWin.cpp b/gfx/src/windows/nsPrintOptionsWin.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsPrintOptionsWin.h b/gfx/src/windows/nsPrintOptionsWin.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsPrintSettingsWin.cpp b/gfx/src/windows/nsPrintSettingsWin.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/windows/nsPrintSettingsWin.h b/gfx/src/windows/nsPrintSettingsWin.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/widget/public/Makefile.in b/widget/public/Makefile.in index 9994b2703aa..fdc6df22300 100644 --- a/widget/public/Makefile.in +++ b/widget/public/Makefile.in @@ -68,6 +68,8 @@ EXPORTS = \ nsIDragSessionBeOS.h \ nsIPluginWidget.h \ nsINativeKeyBindings.h \ + nsIDeviceContextSpec.h \ + nsIDeviceContextSpecFactory.h \ $(NULL) ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) @@ -96,10 +98,20 @@ XPIDLSRCS = \ nsINativeScrollbar.idl \ nsIScreen.idl \ nsIScreenManager.idl \ + nsIPrintSession.idl \ + nsIPrintSettings.idl \ + nsIPrintSettingsService.idl \ + nsIPrintOptions.idl \ $(NULL) +ifeq ($(MOZ_WIDGET_TOOLKIT),windows) +XPIDLSRCS += nsIPrintSettingsWin.idl +endif + ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) -XPIDLSRCS += nsIEventSink.idl +XPIDLSRCS += nsIEventSink.idl \ + nsIPrintSettingsX.idl \ + nsIPrintSessionX.idl endif EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/widget/public/nsIDeviceContextSpec.h b/widget/public/nsIDeviceContextSpec.h index f4d2cb51171..616abc54e63 100644 --- a/widget/public/nsIDeviceContextSpec.h +++ b/widget/public/nsIDeviceContextSpec.h @@ -40,14 +40,22 @@ #include "nsIDeviceContext.h" +#ifdef MOZ_CAIRO_GFX +class gfxASurface; +#endif + #define NS_IDEVICE_CONTEXT_SPEC_IID \ -{ 0x9951f910, 0x78d7, 0x11d2, \ -{ 0xa8, 0x46, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } +{ 0x001eeff2, 0x72f3, 0x4d65, \ +{ 0xb0, 0x92, 0x35, 0x88, 0xb0, 0x1e, 0x48, 0xd2 } } class nsIDeviceContextSpec : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDEVICE_CONTEXT_SPEC_IID) + +#ifdef MOZ_CAIRO_GFX + NS_IMETHOD GetSurfaceForPrinter(gfxASurface **nativeSurface) = 0; +#endif }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDeviceContextSpec, diff --git a/widget/public/nsWidgetsCID.h b/widget/public/nsWidgetsCID.h index 8e19465a89b..7268a082bf7 100644 --- a/widget/public/nsWidgetsCID.h +++ b/widget/public/nsWidgetsCID.h @@ -144,3 +144,31 @@ #define NS_SCREENMANAGER_CID \ { 0xc401eb80, 0xf9ea, 0x11d3, { 0xbb, 0x6f, 0xe7, 0x32, 0xb7, 0x3e, 0xbe, 0x7c } } + +//----------------------------------------------------------- +//Printing +//----------------------------------------------------------- +#define NS_DEVICE_CONTEXT_SPEC_CID \ +{ 0xd7193600, 0x78e0, 0x11d2, \ +{ 0xa8, 0x46, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } + +#define NS_DEVICE_CONTEXT_SPEC_FACTORY_CID \ +{ 0xec5bebb0, 0x7b51, 0x11d2, \ +{ 0xa8, 0x48, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } + +#define NS_PRINTSETTINGSSERVICE_CID \ +{ 0x841387c8, 0x72e6, 0x484b, \ +{ 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a } } + +// NOTE: This now has the same CID as NS_PRINTSETTINGSSERVICE_CID +// will go away when Bug 144114 is fixed +#define NS_PRINTOPTIONS_CID NS_PRINTSETTINGSSERVICE_CID + +#define NS_PRINTER_ENUMERATOR_CID \ +{ 0xa6cf9129, 0x15b3, 0x11d2, \ +{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } + +#define NS_PRINTSESSION_CID \ +{ 0x2f977d53, 0x5485, 0x11d4, \ +{ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 } } + diff --git a/widget/src/build/Makefile.in b/widget/src/build/Makefile.in index 24a12249747..e50e32305cb 100644 --- a/widget/src/build/Makefile.in +++ b/widget/src/build/Makefile.in @@ -76,10 +76,10 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../windows \ $(NULL) -OS_LIBS += $(call EXPAND_LIBNAME, uuid ole32 oleaut32 ) +OS_LIBS += $(call EXPAND_LIBNAME, uuid ole32 oleaut32 Winspool) ifneq ($(OS_ARCH), WINCE) -OS_LIBS += $(call EXPAND_LIBNAME, comctl32 comdlg32 shell32 gdi32 imm32 ) +OS_LIBS += $(call EXPAND_LIBNAME, comctl32 comdlg32 shell32 gdi32 imm32 Winspool ) endif SHARED_LIBRARY_LIBS = \ diff --git a/widget/src/build/nsWinWidgetFactory.cpp b/widget/src/build/nsWinWidgetFactory.cpp index 09bf3a027ec..b4ca5528c57 100644 --- a/widget/src/build/nsWinWidgetFactory.cpp +++ b/widget/src/build/nsWinWidgetFactory.cpp @@ -62,6 +62,12 @@ #include "nsScreenManagerWin.h" #include "nsIGenericFactory.h" +// printing +#include "nsDeviceContextSpecWin.h" +#include "nsDeviceContextSpecFactoryW.h" +#include "nsPrintOptionsWin.h" +#include "nsPrintSession.h" + NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) @@ -83,6 +89,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerWin) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecFactoryWin) + + static const nsModuleComponentInfo components[] = { { "nsWindow", @@ -152,6 +165,26 @@ static const nsModuleComponentInfo components[] = NS_SCREENMANAGER_CID, "@mozilla.org/gfx/screenmanager;1", nsScreenManagerWinConstructor }, + { "nsPrintOptionsWin", + NS_PRINTSETTINGSSERVICE_CID, + "@mozilla.org/gfx/printsettings-service;1", + nsPrintOptionsWinConstructor }, + { "Win Printer Enumerator", + NS_PRINTER_ENUMERATOR_CID, + "@mozilla.org/gfx/printerenumerator;1", + nsPrinterEnumeratorWinConstructor }, + { "Print Session", + NS_PRINTSESSION_CID, + "@mozilla.org/gfx/printsession;1", + nsPrintSessionConstructor }, + { "nsDeviceContextSpecWin", + NS_DEVICE_CONTEXT_SPEC_CID, + "@mozilla.org/gfx/devicecontextspec;1", + nsDeviceContextSpecWinConstructor }, + { "nsDeviceContextSpecFactoryWin", + NS_DEVICE_CONTEXT_SPEC_FACTORY_CID, + "@mozilla.org/gfx/devicecontextspecfactory;1", + nsDeviceContextSpecFactoryWinConstructor }, }; diff --git a/widget/src/windows/Makefile.in b/widget/src/windows/Makefile.in index d458bc07f17..ac6cfb3a6d4 100644 --- a/widget/src/windows/Makefile.in +++ b/widget/src/windows/Makefile.in @@ -86,6 +86,10 @@ CPPSRCS = \ nsFilePicker.cpp \ nsScreenWin.cpp \ nsScreenManagerWin.cpp \ + nsPrintOptionsWin.cpp \ + nsPrintSettingsWin.cpp \ + nsDeviceContextSpecWin.cpp \ + nsDeviceContextSpecFactoryW.cpp \ $(NULL) ifneq ($(OS_ARCH), WINCE) diff --git a/widget/src/windows/nsDeviceContextSpecFactoryW.cpp b/widget/src/windows/nsDeviceContextSpecFactoryW.cpp index b410f7eed79..e69de29bb2d 100644 --- a/widget/src/windows/nsDeviceContextSpecFactoryW.cpp +++ b/widget/src/windows/nsDeviceContextSpecFactoryW.cpp @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla 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/MPL/ - * - * 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. - * - * The Original Code is mozilla.org code. - * - * 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. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of 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 MPL, 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 MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsDeviceContextSpecFactoryW.h" -#include "nsDeviceContextSpecWin.h" -#include "nsGfxCIID.h" - -nsDeviceContextSpecFactoryWin :: nsDeviceContextSpecFactoryWin() -{ -} - -nsDeviceContextSpecFactoryWin :: ~nsDeviceContextSpecFactoryWin() -{ -} - -static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); -static NS_DEFINE_IID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); - -NS_IMPL_ISUPPORTS1(nsDeviceContextSpecFactoryWin, nsIDeviceContextSpecFactory) - - -NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: Init(void) -{ - return NS_OK; -} - -//XXX this method needs to do what the API says... - -NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIWidget *aWidget, - nsIPrintSettings* aPrintSettings, - nsIDeviceContextSpec *&aNewSpec, - PRBool aIsPrintPreview) -{ - NS_ENSURE_ARG_POINTER(aWidget); - - nsresult rv = NS_ERROR_FAILURE; - nsIDeviceContextSpec* devspec = nsnull; - - CallCreateInstance(kDeviceContextSpecCID, &devspec); - - if (nsnull != devspec){ - nsDeviceContextSpecWin* specWin = NS_STATIC_CAST(nsDeviceContextSpecWin*, devspec); - rv = specWin->Init(aWidget, aPrintSettings, aIsPrintPreview); - if (NS_SUCCEEDED(rv)) { - aNewSpec = devspec; - } else { - NS_RELEASE(devspec); - } - } - - return rv; -} diff --git a/widget/src/windows/nsDeviceContextSpecWin.cpp b/widget/src/windows/nsDeviceContextSpecWin.cpp index 5614d432beb..017fb427f20 100644 --- a/widget/src/windows/nsDeviceContextSpecWin.cpp +++ b/widget/src/windows/nsDeviceContextSpecWin.cpp @@ -40,6 +40,8 @@ #include #include +#include "nsIWidget.h" + #include "nsVoidArray.h" #include "nsIPrintSettingsWin.h" @@ -47,8 +49,11 @@ #include "nsCRT.h" #include "nsIServiceManager.h" #include "nsReadableUtils.h" -#include "nsGfxCIID.h" +#ifdef MOZ_CAIRO_GFX +#include "gfxWindowsSurface.h" +#endif +#include "nsUnitConversion.h" #include "nsIWindowWatcher.h" #include "nsIDOMWindow.h" @@ -64,7 +69,7 @@ #include "prlog.h" #ifdef PR_LOGGING -extern PRLogModuleInfo * kGfxPrintingLogMod; +PRLogModuleInfo * kGfxPrintingLogMod = PR_NewLogModule("printing-widget"); #define PR_PL(_p1) PR_LOG(kGfxPrintingLogMod, PR_LOG_DEBUG, _p1) #else #define PR_PL(_p1) @@ -510,6 +515,28 @@ static void CleanAndCopyString(char*& aStr, char* aNewStr) } } +#ifdef MOZ_CAIRO_GFX +NS_IMETHODIMP nsDeviceContextSpecWin::GetSurfaceForPrinter(gfxASurface **surface) +{ + NS_ASSERTION(mDevMode, "DevMode can't be NULL here"); + + if (mDevMode) { + HDC dc = ::CreateDC(mDriverName, mDeviceName, NULL, mDevMode); + + // have this surface take over ownership of this DC + nsRefPtr newSurface = new gfxWindowsSurface(dc, PR_TRUE); + *surface = newSurface; + NS_ADDREF(*surface); + + return NS_OK; + } + + *surface = nsnull; + + return NS_ERROR_FAILURE; +} +#endif + //---------------------------------------------------------------------------------- void nsDeviceContextSpecWin::SetDeviceName(char* aDeviceName) { diff --git a/widget/src/windows/nsDeviceContextSpecWin.h b/widget/src/windows/nsDeviceContextSpecWin.h index ae69f1663e7..c3b8a7237ae 100644 --- a/widget/src/windows/nsDeviceContextSpecWin.h +++ b/widget/src/windows/nsDeviceContextSpecWin.h @@ -42,6 +42,7 @@ #include "nsIDeviceContextSpec.h" #include "nsIPrintOptions.h" // For nsIPrinterEnumerator #include "nsIPrintSettings.h" +#include "nsIWidget.h" #include class nsDeviceContextSpecWin : public nsIDeviceContextSpec @@ -51,6 +52,10 @@ public: NS_DECL_ISUPPORTS +#ifdef MOZ_CAIRO_GFX + NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface); +#endif + NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, PRBool aIsPrintPreview); void GetDriverName(char *&aDriverName) const { aDriverName = mDriverName; } diff --git a/widget/src/windows/nsPrintSettingsWin.h b/widget/src/windows/nsPrintSettingsWin.h index dfc0f218f5c..61b7221722f 100644 --- a/widget/src/windows/nsPrintSettingsWin.h +++ b/widget/src/windows/nsPrintSettingsWin.h @@ -48,7 +48,7 @@ //*** nsPrintSettingsWin //***************************************************************************** class nsPrintSettingsWin : public nsPrintSettings, - public nsIPrintSettingsWin + public nsIPrintSettingsWin { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/widget/src/xpwidgets/Makefile.in b/widget/src/xpwidgets/Makefile.in index 6db222b8810..3b7e412334f 100644 --- a/widget/src/xpwidgets/Makefile.in +++ b/widget/src/xpwidgets/Makefile.in @@ -59,6 +59,7 @@ REQUIRES = xpcom \ uconv \ unicharutil \ view \ + windowwatcher \ $(NULL) ifeq ($(MOZ_ENABLE_CAIRO_GFX),1) @@ -75,6 +76,9 @@ CPPSRCS = \ nsPrimitiveHelpers.cpp \ nsXPLookAndFeel.cpp \ nsClipboardHelper.cpp \ + nsPrintOptionsImpl.cpp \ + nsPrintSettingsImpl.cpp \ + nsPrintSession.cpp \ $(NULL) ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) diff --git a/widget/src/xpwidgets/nsPrintOptionsImpl.cpp b/widget/src/xpwidgets/nsPrintOptionsImpl.cpp index 19fb19aaa3a..4c424f91e10 100644 --- a/widget/src/xpwidgets/nsPrintOptionsImpl.cpp +++ b/widget/src/xpwidgets/nsPrintOptionsImpl.cpp @@ -62,7 +62,7 @@ #include "nsISimpleEnumerator.h" #include "nsISupportsPrimitives.h" -#include "nsGfxCIID.h" +#include "nsWidgetsCID.h" #include "stdlib.h" #include "nsAutoPtr.h" diff --git a/widget/src/xpwidgets/nsPrintOptionsImpl.h b/widget/src/xpwidgets/nsPrintOptionsImpl.h index c615b7c9195..7a0727f077c 100644 --- a/widget/src/xpwidgets/nsPrintOptionsImpl.h +++ b/widget/src/xpwidgets/nsPrintOptionsImpl.h @@ -54,8 +54,8 @@ /** * Class nsPrintOptions */ -class NS_GFX nsPrintOptions : public nsIPrintOptions, public - nsIPrintSettingsService +class nsPrintOptions : public nsIPrintOptions, + public nsIPrintSettingsService { public: NS_DECL_ISUPPORTS diff --git a/widget/src/xpwidgets/nsPrintSession.h b/widget/src/xpwidgets/nsPrintSession.h index 60303beefeb..5659be84954 100644 --- a/widget/src/xpwidgets/nsPrintSession.h +++ b/widget/src/xpwidgets/nsPrintSession.h @@ -50,8 +50,8 @@ #undef IMETHOD_VISIBILITY #define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT -class NS_GFX nsPrintSession : public nsIPrintSession, - public nsSupportsWeakReference +class nsPrintSession : public nsIPrintSession, + public nsSupportsWeakReference { public: NS_DECL_ISUPPORTS diff --git a/widget/src/xpwidgets/nsPrintSettingsImpl.h b/widget/src/xpwidgets/nsPrintSettingsImpl.h index 8fabd2d7e2d..cb95f06183c 100644 --- a/widget/src/xpwidgets/nsPrintSettingsImpl.h +++ b/widget/src/xpwidgets/nsPrintSettingsImpl.h @@ -55,7 +55,7 @@ #undef IMETHOD_VISIBILITY #define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT -class NS_GFX nsPrintSettings : public nsIPrintSettings +class nsPrintSettings : public nsIPrintSettings { public: NS_DECL_ISUPPORTS