[gnumeric] Import external references from ODF. [#645580]



commit 341db9d608795aaaf6b6f82b1bf6c90b3c1e629d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri May 27 14:49:01 2011 -0600

    Import external references from ODF. [#645580]
    
    2011-05-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (oo_rangeref_parse): handle foreign workbooks

 NEWS                                 |    1 +
 plugins/openoffice/ChangeLog         |    6 +++++-
 plugins/openoffice/openoffice-read.c |   34 ++++++++++++++++++++++++----------
 3 files changed, 30 insertions(+), 11 deletions(-)
---
diff --git a/NEWS b/NEWS
index ba9c226..9a06985 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Andreas
 	  [#650941]
 	* Change the default widget when rolling up or down the default widget. 
 	  [#651173][#646612]
+	* Import external references from ODF. [#645580]
 
 Morten:
 	* Fix leaks in SHEET.  [#650761]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 365f709..1bf9930 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,9 @@
 2011-05-27  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (oo_rangeref_parse): handle foreign workbooks
+
+2011-05-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (oo_cellref_parse): add argument, change
 	all callers, don't create sheets that are in foreign workbooks
 	(odf_parse_external): new
@@ -10,7 +14,7 @@
 	(oo_col_start): use oo_warning rather than g_warning
 	(odf_clear_conventions): new, use whenever xin changes
 	(opendoc_content_dtd): add table:table-source
-	
+
 2011-05-22  Morten Welinder  <terra gnome org>
 
 	* openoffice-write.c (odf_write_ooo_settings): Plug leak.
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index acb7340..6580bd1 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -1249,16 +1249,30 @@ oo_rangeref_parse (GnmRangeRef *ref, char const *start, GnmParsePos const *pp,
 	if (ref->b.sheet == invalid_sheet)
 		ref->a.sheet = invalid_sheet;
 	if (external != NULL) {
-		ref->a.sheet = invalid_sheet;
-		if (oconv != NULL)
-			oo_warning (oconv->xin, 
-				    _("Ignoring reference to external "
-				      "workbook '%s'"), 
-				    external);
-		else
-			g_warning (_("Ignoring reference to external "
-				     "workbook '%s'"), 
-				    external);
+		Workbook *wb = pp->wb, *ext_wb;
+		Workbook *ref_wb = wb ? wb : pp->sheet->workbook;
+
+		ext_wb = (*convs->input.external_wb) (convs, ref_wb, external);
+		if (ext_wb == NULL) {
+			if (oconv != NULL)
+				oo_warning (oconv->xin, 
+					    _("Ignoring reference to unknown "
+					      "external workbook '%s'"), 
+					    external);
+			ref->a.sheet = invalid_sheet;
+		} else {
+			if (external_sheet_1 != NULL)
+				ref->a.sheet = workbook_sheet_by_name 
+					(ext_wb, external_sheet_1);
+			else 
+				ref->a.sheet = workbook_sheet_by_index
+					(ext_wb, 0);
+			if (external_sheet_2 != NULL)
+				ref->b.sheet = workbook_sheet_by_name 
+					(ext_wb, external_sheet_1);
+			else 
+				ref->b.sheet = NULL;
+		}
 		g_free (external);
 		g_free (external_sheet_1);
 		g_free (external_sheet_2);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]