File: ie_impexp_OpenXML.cpp

package info (click to toggle)
abiword 3.0.8%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,532 kB
  • sloc: cpp: 477,427; ansic: 16,754; makefile: 5,785; xml: 4,014; yacc: 1,818; lex: 1,104; perl: 812; python: 413; php: 183; sh: 169
file content (109 lines) | stat: -rw-r--r-- 2,872 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */

/* AbiSource
 * 
 * Copyright (C) 2007 Philippe Milot <PhilMilot@gmail.com>
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
 * 02110-1301 USA.
 */

// External includes
#include <gsf/gsf-utils.h>
#include <xap_Module.h>

// Internal includes
#include <ie_imp_OpenXML_Sniffer.h>
#include <ie_exp_OpenXML_Sniffer.h>

#ifdef ABI_PLUGIN_BUILTIN
#define abi_plugin_register abipgn_openxml_register
#define abi_plugin_unregister abipgn_openxml_unregister
#define abi_plugin_supports_version abipgn_openxml_supports_version
// dll exports break static linking
#define ABI_BUILTIN_FAR_CALL extern "C"
#else
#define ABI_BUILTIN_FAR_CALL ABI_FAR_CALL
ABI_PLUGIN_DECLARE("OpenXML")
#endif

/*****************************************************************************/
/*****************************************************************************/

// completely generic C-interface code to allow this to be a plugin

static IE_Imp_OpenXML_Sniffer* pImp_sniffer = 0;
static IE_Exp_OpenXML_Sniffer* pExp_sniffer = 0;


/**
 * Register the OpenXML plugin
 */
ABI_BUILTIN_FAR_CALL int abi_plugin_register (XAP_ModuleInfo * mi)
{
    if (!pImp_sniffer) {
        pImp_sniffer = new IE_Imp_OpenXML_Sniffer ();
    }
    
    IE_Imp::registerImporter (pImp_sniffer);

    if (!pExp_sniffer){
        pExp_sniffer = new IE_Exp_OpenXML_Sniffer ();
	}
    
	IE_Exp::registerExporter (pExp_sniffer);

    mi->name    = "Office Open XML Filter";
    mi->desc    = "Import/Export Office Open XML (.docx) files";
    mi->version = ABI_VERSION_STRING;
    mi->author  = "Philippe Milot";
    mi->usage   = "No Usage";
  
    return 1;
}



/**
 * Unregister the OpenXML plugin
 */
ABI_BUILTIN_FAR_CALL int abi_plugin_unregister (XAP_ModuleInfo * mi)
{
  mi->name    = 0;
  mi->desc    = 0;
  mi->version = 0;
  mi->author  = 0;
  mi->usage   = 0;
  
  IE_Imp::unregisterImporter (pImp_sniffer);
  DELETEP(pImp_sniffer);

  IE_Exp::unregisterExporter (pExp_sniffer);
  DELETEP(pExp_sniffer);

  return 1;
}




/**
 * 
 */
ABI_BUILTIN_FAR_CALL int abi_plugin_supports_version (UT_uint32 /*major*/, UT_uint32 /*minor*/, 
                 UT_uint32 /*release*/)
{
  return 1;
}