1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is mozilla.org code.
17
* The Initial Developer of the Original Code is
18
* Christopher Blizzard.
19
* Portions created by the Initial Developer are Copyright (C) 2000
20
* the Initial Developer. All Rights Reserved.
23
* Christopher Blizzzard <blizzard@mozilla.org>
25
* Alternatively, the contents of this file may be used under the terms of
26
* either of the GNU General Public License Version 2 or later (the "GPL"),
27
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
* in which case the provisions of the GPL or the LGPL are applicable instead
29
* of those above. If you wish to allow use of your version of this file only
30
* under the terms of either the GPL or the LGPL, and not to allow others to
31
* use your version of this file under the terms of the MPL, indicate your
32
* decision by deleting the provisions above and replace them with the notice
33
* and other provisions required by the GPL or the LGPL. If you do not delete
34
* the provisions above, a recipient may use your version of this file under
35
* the terms of any one of the MPL, the GPL or the LGPL.
37
* ***** END LICENSE BLOCK ***** */
39
#include "nsIGenericFactory.h"
40
#include "nsIModule.h"
42
#include "nsGfxCIID.h"
44
#include "nsBlender.h"
45
#include "nsFontMetricsPh.h"
46
#include "nsRenderingContextPh.h"
47
#include "nsDeviceContextSpecPh.h"
48
#include "nsScreenManagerPh.h"
49
#include "nsScriptableRegion.h"
50
#include "nsDeviceContextPh.h"
51
#include "nsPrintOptionsPh.h"
52
#include "nsPrintSession.h"
53
#include "gfxImageFrame.h"
55
// objects that just require generic constructors
57
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontMetricsPh)
58
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextPh)
59
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRenderingContextPh)
60
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImagePh)
61
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
62
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionPh)
63
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecPh)
64
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorPh)
65
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerPh)
66
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorPh)
67
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsPh, Init)
68
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
69
NS_GENERIC_FACTORY_CONSTRUCTOR(gfxImageFrame)
71
// our custom constructors
73
static nsresult nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
77
nsIScriptableRegion *inst;
79
if ( NULL == aResult )
81
rv = NS_ERROR_NULL_POINTER;
87
rv = NS_ERROR_NO_AGGREGATION;
90
// create an nsRegionPh and get the scriptable region from it
91
nsCOMPtr <nsIRegion> rgn;
92
NS_NEWXPCOM(rgn, nsRegionPh);
93
nsCOMPtr<nsIScriptableRegion> scriptableRgn;
96
scriptableRgn = new nsScriptableRegion(rgn);
101
rv = NS_ERROR_OUT_OF_MEMORY;
105
// release our variable above now that we have created our owning
106
// reference - we don't want this to go out of scope early!
107
scriptableRgn = nsnull;
108
rv = inst->QueryInterface(aIID, aResult);
114
static const nsModuleComponentInfo components[] =
118
"@mozilla.org/gfx/fontmetrics;1",
119
nsFontMetricsPhConstructor },
121
{ "Ph Device Context",
122
NS_DEVICE_CONTEXT_CID,
123
"@mozilla.org/gfx/devicecontext;1",
124
nsDeviceContextPhConstructor },
126
{ "Ph Rendering Context",
127
NS_RENDERING_CONTEXT_CID,
128
"@mozilla.org/gfx/renderingcontext;1",
129
nsRenderingContextPhConstructor },
133
"@mozilla.org/gfx/image;1",
134
nsImagePhConstructor },
138
"@mozilla.org/gfx/region/Ph;1",
139
nsRegionPhConstructor },
141
{ "Scriptable Region",
142
NS_SCRIPTABLE_REGION_CID,
143
"@mozilla.org/gfx/region;1",
144
nsScriptableRegionConstructor },
148
"@mozilla.org/gfx/blender;1",
149
nsBlenderConstructor },
151
{ "Ph Device Context Spec",
152
NS_DEVICE_CONTEXT_SPEC_CID,
153
"@mozilla.org/gfx/devicecontextspec;1",
154
nsDeviceContextSpecPhConstructor },
156
{ "PrintSettings Service",
157
NS_PRINTSETTINGSSERVICE_CID,
158
"@mozilla.org/gfx/printsettings-service;1",
159
nsPrintOptionsPhConstructor },
161
{ "Ph Font Enumerator",
162
NS_FONT_ENUMERATOR_CID,
163
"@mozilla.org/gfx/fontenumerator;1",
164
nsFontEnumeratorPhConstructor },
166
{ "Ph Screen Manager",
167
NS_SCREENMANAGER_CID,
168
"@mozilla.org/gfx/screenmanager;1",
169
nsScreenManagerPhConstructor },
171
{ "Ph Printer Enumerator",
172
NS_PRINTER_ENUMERATOR_CID,
173
"@mozilla.org/gfx/printerenumerator;1",
174
nsPrinterEnumeratorPhConstructor },
178
"@mozilla.org/gfx/printsession;1",
179
nsPrintSessionConstructor },
181
{ "windows image frame",
183
"@mozilla.org/gfx/image/frame;2",
184
gfxImageFrameConstructor, },
187
NS_IMPL_NSGETMODULE(nsGfxPhModule, components)