1 #ifndef _GNM_PLUGIN_H_
2 # define _GNM_PLUGIN_H_
3 
4 #include <gnumeric.h>
5 #include <goffice/goffice.h>
6 #include <goffice/app/module-plugin-defs.h>
7 #include <tools/gnm-solver.h>
8 #include <gmodule.h>
9 
10 G_BEGIN_DECLS
11 
12 #define GNM_PLUGIN_LOADER_MODULE_TYPE (gnm_plugin_loader_module_get_type ())
13 #define GNM_PLUGIN_LOADER_MODULE(o)  (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_LOADER_MODULE_TYPE, GnmPluginLoaderModule))
14 GType gnm_plugin_loader_module_get_type (void);
15 
16 #define GNM_PLUGIN_SERVICE_FUNCTION_GROUP_TYPE  (gnm_plugin_service_function_group_get_type ())
17 #define GNM_PLUGIN_SERVICE_FUNCTION_GROUP(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_SERVICE_FUNCTION_GROUP_TYPE, GnmPluginServiceFunctionGroup))
18 #define GNM_IS_PLUGIN_SERVICE_FUNCTION_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_PLUGIN_SERVICE_FUNCTION_GROUP_TYPE))
19 
20 GType gnm_plugin_service_function_group_get_type (void);
21 typedef struct GnmPluginServiceFunctionGroup_	GnmPluginServiceFunctionGroup;
22 typedef struct {
23 	void (*load_stub) (GOPluginService *service, GnmFunc *func);
24 } GnmPluginServiceFunctionGroupCallbacks;
25 
26 #define GNM_PLUGIN_SERVICE_UI_TYPE  (gnm_plugin_service_ui_get_type ())
27 #define GNM_PLUGIN_SERVICE_UI(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_SERVICE_UI_TYPE, PluginServiceUI))
28 #define GNM_IS_PLUGIN_SERVICE_UI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_PLUGIN_SERVICE_UI_TYPE))
29 
30 GType gnm_plugin_service_ui_get_type (void);
31 typedef struct GnmPluginServiceUI_ PluginServiceUI;
32 typedef struct {
33 	void (*plugin_func_exec_action) (
34 		GOPluginService *service, GnmAction const *action,
35 		WorkbookControl *wbc, GOErrorInfo **ret_error);
36 } GnmPluginServiceUICallbacks;
37 
38 /* This type is intended for use with "ui" service.
39  * Plugins should define arrays of structs of the form:
40  * GnmModulePluginUIActions <service-id>_actions[] = { ... };
41  */
42 typedef struct {
43 	char const *name;
44 	void (*handler) (GnmAction const *action, WorkbookControl *wbc);
45 } GnmModulePluginUIActions;
46 
47 #define GNM_PLUGIN_SERVICE_SOLVER_TYPE  (gnm_plugin_service_solver_get_type ())
48 #define GNM_PLUGIN_SERVICE_SOLVER(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_SERVICE_SOLVER_TYPE, PluginServiceSolver))
49 #define GNM_IS_PLUGIN_SERVICE_SOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_PLUGIN_SERVICE_SOLVER_TYPE))
50 
51 GType gnm_plugin_service_solver_get_type (void);
52 typedef struct GnmPluginServiceSolver_ PluginServiceSolver;
53 typedef struct {
54 	GnmSolverCreator creator;
55 	GnmSolverFactoryFunctional functional;
56 } GnmPluginServiceSolverCallbacks;
57 
58 /**************************************************************************/
59 #define GNM_PLUGIN_MODULE_HEADER					\
60 G_MODULE_EXPORT GOPluginModuleDepend const go_plugin_depends [] = {	\
61 	{ "goffice",	GOFFICE_API_VERSION },				\
62 	{ "gnumeric",	GNM_VERSION_FULL }				\
63 };	\
64 G_MODULE_EXPORT GOPluginModuleHeader const go_plugin_header =		\
65 	{ GOFFICE_MODULE_PLUGIN_MAGIC_NUMBER, G_N_ELEMENTS (go_plugin_depends) }
66 
67 /**************************************************************************/
68 
69 void gnm_plugins_service_init (void);
70 void gnm_plugins_init (GOCmdContext *c);
71 
72 G_END_DECLS
73 
74 #endif /* _GNM_PLUGIN_H_ */
75