[gnumeric] Import ODS-like documents produced by Google-docs. [#660657]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Import ODS-like documents produced by Google-docs. [#660657]
- Date: Sat, 1 Oct 2011 23:46:12 +0000 (UTC)
commit 0e2c9c10c855f7e0ae0d35e29edb1454880d90da
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sat Oct 1 17:44:50 2011 -0600
Import ODS-like documents produced by Google-docs. [#660657]
2011-10-01 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (identified_google_docs): new
(determine_oo_version): call identified_google_docs
NEWS | 1 +
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-read.c | 30 ++++++++++++++++++++++++++++--
3 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index cdeeec0..ac3a48b 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ Andreas:
* Add a print item to the sheet object context menu. [#660248]
* Fix IRR and other functions acting on paired data set when called
with fixed arrays.
+ * Import ODS-like documents produced by Google-docs. [#660657]
Jean:
* Make things build against gtk+-3.0.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index d2f7ac7..cb8e80c 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-01 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (identified_google_docs): new
+ (determine_oo_version): call identified_google_docs
+
2011-09-22 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_date_text_end): avoid duplicate percent signs
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 041facd..babf24e 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -10094,6 +10094,29 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
return gnm_expr_new_funcall (f, args);
}
+static gboolean
+identified_google_docs (GsfInfile *zip)
+{
+ /* As of 2011/10/1 google-docs does not store any generator info so */
+ /* we cannot use that for identification */
+ gboolean google_docs = FALSE;
+ GsfInput *content = gsf_infile_child_by_name
+ (zip, "content.xml");
+ if (content) {
+ /* pick arbitrary size limit of 0.5k for the manifest to avoid
+ * potential of any funny business */
+ size_t size = MIN (gsf_input_size (content), 512);
+ char const *mf = gsf_input_read (content, size, NULL);
+ if (mf)
+ google_docs =
+ (NULL != g_strstr_len
+ (mf, -1,
+ "urn:oasis:names:tc:opendocument:xmlns:office:1.0"));
+ g_object_unref (content);
+ }
+ return google_docs;
+}
+
static OOVer
determine_oo_version (GsfInfile *zip, OOVer def)
{
@@ -10101,8 +10124,11 @@ determine_oo_version (GsfInfile *zip, OOVer def)
size_t size;
GsfInput *mimetype = gsf_infile_child_by_name (zip, "mimetype");
if (!mimetype) {
- /* Really old versions had no mimetype. Allow that, except
- in the probe. */
+ /* Google-docs is the mimetype so we need to check that */
+ if (identified_google_docs (zip))
+ return OOO_VER_OPENDOC;
+ /* Really old versions also had no mimetype. Allow that,
+ except in the probe. */
return def;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]