[gnumeric] Load meta data from gnumeric files [#578607]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Load meta data from gnumeric files [#578607]
- Date: Wed, 6 May 2009 17:42:42 -0400 (EDT)
commit e11e56f25c669af0e76a36861bfc97d1d67ef085
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Wed May 6 15:41:49 2009 -0600
Load meta data from gnumeric files [#578607]
2009-05-06 Andreas J. Guelzow <aguelzow pyrshep ca>
* configure.in: (libgsf) require 1.14.13 since the
gsf_opendoc_metadata_subtree in previous versions will crash!
* src/xml-sax-read.c (xml_sax_document_meta): new
(content_ns): added name spaces
(gnumeric_1_0_dtd): hook up xml_sax_document_meta
---
ChangeLog | 8 ++++++++
NEWS | 1 +
configure.in | 2 +-
src/xml-sax-read.c | 28 +++++++++++++++++++++++-----
4 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ed16b53..0a90085 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-05-06 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * configure.in: (libgsf) require 1.14.13 since the
+ gsf_opendoc_metadata_subtree in previous versions will crash!
+ * src/xml-sax-read.c (xml_sax_document_meta): new
+ (content_ns): added name spaces
+ (gnumeric_1_0_dtd): hook up xml_sax_document_meta
+
2009-05-06 Morten Welinder <terra gnome org>
* src/gnm-so-polygon.c (gnm_so_polygon_write_xml_sax): Implement.
diff --git a/NEWS b/NEWS
index 67bc9ac..af22d8d 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Andreas:
dialog and the label itself.
* Add interface to format cell comments
* Fix printing of sheet objects whose text intersects with markup. [#581125]
+ * Load meta data from gnumeric files [#578607]
Jean:
* Do not crash in rendr_value for NULL values. [#581120]
diff --git a/configure.in b/configure.in
index 7c6190f..c3f81f3 100644
--- a/configure.in
+++ b/configure.in
@@ -142,7 +142,7 @@ PKG_PROG_PKG_CONFIG(0.18)
dnl *****************************
libspreadsheet_reqs="
libgoffice-${GOFFICE_API_VER} >= 0.7.6
- libgsf-1 >= 1.14.11
+ libgsf-1 >= 1.14.13
libxml-2.0 >= 2.4.12
"
gnumeric_reqs="$libspreadsheet_reqs
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 7ab065b..e554769 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -72,6 +72,7 @@
#include <gsf/gsf-input.h>
#include <gsf/gsf-input-memory.h>
#include <gsf/gsf-input-gzip.h>
+#include <gsf/gsf-opendoc-utils.h>
#include <glib/gi18n-lib.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -445,6 +446,16 @@ xml_sax_wb (GsfXMLIn *xin, xmlChar const **attrs)
}
static void
+xml_sax_document_meta (GsfXMLIn *xin, xmlChar const **attrs)
+{
+ XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
+
+ gsf_opendoc_metadata_subtree (xin, go_doc_get_meta_data (GO_DOC (state->wb)));
+}
+
+
+
+static void
xml_sax_version (GsfXMLIn *xin, xmlChar const **attrs)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
@@ -2360,8 +2371,8 @@ xml_sax_go_doc (GsfXMLIn *xin, xmlChar const **attrs)
/****************************************************************************/
-#define GNM 0
-#define SCHEMA_NS 1
+/* libgsf defines OO_NS_OFFICE to be 0, so we need to take something different for GNM */
+#define GNM 100
static GsfXMLInNS const content_ns[] = {
GSF_XML_IN_NS (GNM, "http://www.gnumeric.org/v10.dtd"),
@@ -2374,13 +2385,19 @@ static GsfXMLInNS const content_ns[] = {
GSF_XML_IN_NS (GNM, "http://www.gnome.org/gnumeric/v3"),
GSF_XML_IN_NS (GNM, "http://www.gnome.org/gnumeric/v2"),
GSF_XML_IN_NS (GNM, "http://www.gnome.org/gnumeric/"),
- GSF_XML_IN_NS (SCHEMA_NS, "http://www.w3.org/2001/XMLSchema-instance"),
- { NULL }
+/* The next items are from libgsf, there is no obvious way of adding them automatically */
+ GSF_XML_IN_NS (OO_NS_XSI, "http://www.w3.org/2001/XMLSchema-instance"),
+ GSF_XML_IN_NS (OO_NS_OFFICE, "urn:oasis:names:tc:opendocument:xmlns:office:1.0"),
+ GSF_XML_IN_NS (OO_NS_OOO, "http://openoffice.org/2004/office"),
+ GSF_XML_IN_NS (OO_NS_DC, "http://purl.org/dc/elements/1.1/"),
+ GSF_XML_IN_NS (OO_NS_XLINK, "http://www.w3.org/1999/xlink"),
+ GSF_XML_IN_NS (OO_NS_META, "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"),
+ GSF_XML_IN_NS_END
};
static GsfXMLInNode gnumeric_1_0_dtd[] = {
GSF_XML_IN_NODE_FULL (START, START, -1, NULL, GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
-GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, FALSE, &xml_sax_wb, NULL, 0),
+GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, TRUE, &xml_sax_wb, NULL, 0),
GSF_XML_IN_NODE (WB, WB_VERSION, GNM, "Version", GSF_XML_NO_CONTENT, &xml_sax_version, NULL),
GSF_XML_IN_NODE (WB, WB_ATTRIBUTES, GNM, "Attributes", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (WB_ATTRIBUTES, WB_ATTRIBUTE, GNM, "Attribute", GSF_XML_NO_CONTENT, NULL, &xml_sax_finish_parse_wb_attr),
@@ -2539,6 +2556,7 @@ GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, FALS
GSF_XML_IN_NODE (WB, WB_CALC, GNM, "Calculation", GSF_XML_NO_CONTENT, &xml_sax_calculation, NULL),
GSF_XML_IN_NODE (WB, WB_DATE, GNM, "DateConvention", GSF_XML_CONTENT, NULL, &xml_sax_old_dateconvention),
GSF_XML_IN_NODE (WB, GODOC, -1, "GODoc", GSF_XML_NO_CONTENT, &xml_sax_go_doc, NULL),
+ GSF_XML_IN_NODE (WB, DOCUMENTMETA, OO_NS_OFFICE, "document-meta", GSF_XML_NO_CONTENT, &xml_sax_document_meta, NULL),
{ NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]