1 /* AbiWord
2  * Copyright (C) 2001 AbiSource, Inc.
3  * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301 USA.
19  */
20 
21 /* See bug 1764
22  * "This product is not manufactured, approved, or supported by
23  * Corel Corporation or Corel Corporation Limited."
24  */
25 
26 #ifdef ABI_PLUGIN_BUILTIN
27 #define abi_plugin_register abipgn_wordperfect_register
28 #define abi_plugin_unregister abipgn_wordperfect_unregister
29 #define abi_plugin_supports_version abipgn_wordperfect_supports_version
30 #endif
31 
32 #include "ie_impexp_WordPerfect.h"
33 #include <gsf/gsf-utils.h>
34 
35 ABI_PLUGIN_DECLARE("WordPerfect")
36 
37 static IE_Imp_WordPerfect_Sniffer * m_ImpSniffer = 0;
38 
39 #ifdef HAVE_LIBWPS
40 static IE_Imp_MSWorks_Sniffer * m_MSWorks_ImpSniffer = 0;
41 #endif
42 
43 ABI_FAR_CALL
abi_plugin_register(XAP_ModuleInfo * mi)44 int abi_plugin_register (XAP_ModuleInfo * mi)
45 {
46 	if (!m_ImpSniffer)
47 	{
48 		m_ImpSniffer = new IE_Imp_WordPerfect_Sniffer ();
49 	}
50 
51 	UT_ASSERT (m_ImpSniffer);
52 
53 #ifdef HAVE_LIBWPS
54 	if (!m_MSWorks_ImpSniffer)
55 	{
56 		m_MSWorks_ImpSniffer = new IE_Imp_MSWorks_Sniffer ();
57 	}
58 
59 	UT_ASSERT (m_MSWorks_ImpSniffer);
60 	IE_Imp::registerImporter (m_MSWorks_ImpSniffer);
61 #endif
62 
63 #ifdef HAVE_LIBWPS
64 	mi->name    = "WordPerfect(tm) and Microsoft Works Importer";
65 	mi->desc    = "Import WordPerfect(tm) and Microsoft Works Documents";
66 #else
67 	mi->name    = "WordPerfect(tm) Importer";
68 	mi->desc    = "Import WordPerfect(tm) Documents";
69 #endif
70 	mi->version = ABI_VERSION_STRING;
71 	mi->author  = "Marc Maurer, William Lachance";
72 	mi->usage   = "No Usage";
73 
74 	IE_Imp::registerImporter (m_ImpSniffer);
75 
76 	return 1;
77 }
78 
79 ABI_FAR_CALL
abi_plugin_unregister(XAP_ModuleInfo * mi)80 int abi_plugin_unregister (XAP_ModuleInfo * mi)
81 {
82 	mi->name    = 0;
83 	mi->desc    = 0;
84 	mi->version = 0;
85 	mi->author  = 0;
86 	mi->usage   = 0;
87 
88 	UT_ASSERT (m_ImpSniffer);
89 
90 	IE_Imp::unregisterImporter (m_ImpSniffer);
91 	delete m_ImpSniffer;
92 	m_ImpSniffer = 0;
93 
94 #ifdef HAVE_LIBWPS
95 	IE_Imp::unregisterImporter (m_MSWorks_ImpSniffer);
96 	delete m_MSWorks_ImpSniffer;
97 	m_MSWorks_ImpSniffer = 0;
98 #endif
99 
100 	return 1;
101 }
102 
103 ABI_FAR_CALL
abi_plugin_supports_version(UT_uint32,UT_uint32,UT_uint32)104 int abi_plugin_supports_version (UT_uint32 /*major*/, UT_uint32 /*minor*/,
105 								 UT_uint32 /*release*/)
106 {
107   return 1;
108 }
109