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 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2000
20 * the Initial Developer. All Rights Reserved.
23 * Roger B. Sidje <rbs@maths.uq.edu.au>
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 ***** */
43 #include "nsIFactory.h"
44 #include "nsIGenericFactory.h"
45 #include "nsIServiceManager.h"
46 #include "nsICharsetConverterManager.h"
47 #include "nsICategoryManager.h"
48 #include "nsEncoderDecoderUtils.h"
49 #include "nsIModule.h"
50 #include "nsUCvMathCID.h"
51 #include "nsUCvMathDll.h"
54 #include "nsUnicodeToTeXCMRttf.h"
55 #include "nsUnicodeToTeXCMMIttf.h"
56 #include "nsUnicodeToTeXCMSYttf.h"
57 #include "nsUnicodeToTeXCMEXttf.h"
58 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
59 #include "nsUnicodeToTeXCMRt1.h"
60 #include "nsUnicodeToTeXCMMIt1.h"
61 #include "nsUnicodeToTeXCMSYt1.h"
62 #include "nsUnicodeToTeXCMEXt1.h"
64 #include "nsUnicodeToMathematica1.h"
65 #include "nsUnicodeToMathematica2.h"
66 #include "nsUnicodeToMathematica3.h"
67 #include "nsUnicodeToMathematica4.h"
68 #include "nsUnicodeToMathematica5.h"
69 #include "nsUnicodeToMTExtra.h"
71 //----------------------------------------------------------------------------
72 // Global functions and data [declaration]
74 #define DECODER_NAME_BASE "Unicode Decoder-"
75 #define ENCODER_NAME_BASE "Unicode Encoder-"
77 NS_CONVERTER_REGISTRY_START
79 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmr", NS_UNICODETOTEXCMRTTF_CID
)
80 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmmi", NS_UNICODETOTEXCMMITTF_CID
)
81 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmsy", NS_UNICODETOTEXCMSYTTF_CID
)
82 NS_UCONV_REG_UNREG_ENCODER("x-ttf-cmex", NS_UNICODETOTEXCMEXTTF_CID
)
83 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
84 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmr", NS_UNICODETOTEXCMRT1_CID
)
85 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmmi", NS_UNICODETOTEXCMMIT1_CID
)
86 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmsy", NS_UNICODETOTEXCMSYT1_CID
)
87 NS_UCONV_REG_UNREG_ENCODER("x-t1-cmex", NS_UNICODETOTEXCMEXT1_CID
)
89 NS_UCONV_REG_UNREG_ENCODER("x-mathematica1", NS_UNICODETOMATHEMATICA1_CID
)
90 NS_UCONV_REG_UNREG_ENCODER("x-mathematica2", NS_UNICODETOMATHEMATICA2_CID
)
91 NS_UCONV_REG_UNREG_ENCODER("x-mathematica3", NS_UNICODETOMATHEMATICA3_CID
)
92 NS_UCONV_REG_UNREG_ENCODER("x-mathematica4", NS_UNICODETOMATHEMATICA4_CID
)
93 NS_UCONV_REG_UNREG_ENCODER("x-mathematica5", NS_UNICODETOMATHEMATICA5_CID
)
94 NS_UCONV_REG_UNREG_ENCODER("x-mtextra", NS_UNICODETOMTEXTRA_CID
)
96 NS_CONVERTER_REGISTRY_END
98 NS_IMPL_NSUCONVERTERREGSELF
100 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMRttf
)
101 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMMIttf
)
102 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMSYttf
)
103 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMEXttf
)
104 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
105 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMRt1
)
106 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMMIt1
)
107 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMSYt1
)
108 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTeXCMEXt1
)
110 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica1
)
111 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica2
)
112 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica3
)
113 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica4
)
114 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMathematica5
)
115 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToMTExtra
)
117 static const nsModuleComponentInfo components
[] =
120 ENCODER_NAME_BASE
"x-ttf-cmr" , NS_UNICODETOTEXCMRTTF_CID
,
121 NS_UNICODEENCODER_CONTRACTID_BASE
"x-ttf-cmr",
122 nsUnicodeToTeXCMRttfConstructor
,
125 ENCODER_NAME_BASE
"x-ttf-cmmi" , NS_UNICODETOTEXCMMITTF_CID
,
126 NS_UNICODEENCODER_CONTRACTID_BASE
"x-ttf-cmmi",
127 nsUnicodeToTeXCMMIttfConstructor
,
130 ENCODER_NAME_BASE
"x-ttf-cmsy" , NS_UNICODETOTEXCMSYTTF_CID
,
131 NS_UNICODEENCODER_CONTRACTID_BASE
"x-ttf-cmsy",
132 nsUnicodeToTeXCMSYttfConstructor
,
135 ENCODER_NAME_BASE
"x-ttf-cmex" , NS_UNICODETOTEXCMEXTTF_CID
,
136 NS_UNICODEENCODER_CONTRACTID_BASE
"x-ttf-cmex",
137 nsUnicodeToTeXCMEXttfConstructor
,
139 #if !defined(XP_WIN) && !defined(XP_OS2) && !defined(XP_MAC) && !defined(XP_MACOSX)
141 ENCODER_NAME_BASE
"x-t1-cmr" , NS_UNICODETOTEXCMRT1_CID
,
142 NS_UNICODEENCODER_CONTRACTID_BASE
"x-t1-cmr",
143 nsUnicodeToTeXCMRt1Constructor
,
146 ENCODER_NAME_BASE
"x-t1-cmmi" , NS_UNICODETOTEXCMMIT1_CID
,
147 NS_UNICODEENCODER_CONTRACTID_BASE
"x-t1-cmmi",
148 nsUnicodeToTeXCMMIt1Constructor
,
151 ENCODER_NAME_BASE
"x-t1-cmsy" , NS_UNICODETOTEXCMSYT1_CID
,
152 NS_UNICODEENCODER_CONTRACTID_BASE
"x-t1-cmsy",
153 nsUnicodeToTeXCMSYt1Constructor
,
156 ENCODER_NAME_BASE
"x-t1-cmex" , NS_UNICODETOTEXCMEXT1_CID
,
157 NS_UNICODEENCODER_CONTRACTID_BASE
"x-t1-cmex",
158 nsUnicodeToTeXCMEXt1Constructor
,
162 ENCODER_NAME_BASE
"x-mathematica1" , NS_UNICODETOMATHEMATICA1_CID
,
163 NS_UNICODEENCODER_CONTRACTID_BASE
"x-mathematica1",
164 nsUnicodeToMathematica1Constructor
,
165 nsUConverterRegSelf
, nsUConverterUnregSelf
,
168 ENCODER_NAME_BASE
"x-mathematica2" , NS_UNICODETOMATHEMATICA2_CID
,
169 NS_UNICODEENCODER_CONTRACTID_BASE
"x-mathematica2",
170 nsUnicodeToMathematica2Constructor
,
173 ENCODER_NAME_BASE
"x-mathematica3" , NS_UNICODETOMATHEMATICA3_CID
,
174 NS_UNICODEENCODER_CONTRACTID_BASE
"x-mathematica3",
175 nsUnicodeToMathematica3Constructor
,
178 ENCODER_NAME_BASE
"x-mathematica4" , NS_UNICODETOMATHEMATICA4_CID
,
179 NS_UNICODEENCODER_CONTRACTID_BASE
"x-mathematica4",
180 nsUnicodeToMathematica4Constructor
,
183 ENCODER_NAME_BASE
"x-mathematica5" , NS_UNICODETOMATHEMATICA5_CID
,
184 NS_UNICODEENCODER_CONTRACTID_BASE
"x-mathematica5",
185 nsUnicodeToMathematica5Constructor
,
188 ENCODER_NAME_BASE
"x-mtextra" , NS_UNICODETOMTEXTRA_CID
,
189 NS_UNICODEENCODER_CONTRACTID_BASE
"x-mtextra",
190 nsUnicodeToMTExtraConstructor
,
194 NS_IMPL_NSGETMODULE(nsUCvMathModule
, components
)