[gnumeric] In ODF import ignored mentioned but not included sheets. [#698388]



commit e428e2bd0214c233896bbbc285572cf37526c224
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Jun 13 19:12:57 2013 -0600

    In ODF import ignored mentioned but not included sheets. [#698388]
    
    2013-06-13  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (openoffice_file_open): delete any tables that
        were referred to but not included in the file.

 NEWS                                 |    1 +
 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   24 ++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4264132..4039b81 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ Andreas:
        * Use the pagesetup setting to determine the landscape option in LaTeX
          export [#702169]
        * Fix ODF crash. [#702197]
+       * In ODF import ignored mentioned but not included sheets. [#698388]
 
 Darrell Tangman:
        * Update documentation for Edit and Insert menus. [#700596]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index cff3336..74f8242 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2013-06-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (openoffice_file_open): delete any tables that
+       were referred to but not included in the file.
+
+2013-06-13  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (od_draw_object): We do not parse tables
        inside charts! So no need to worry about them!
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index ed6ab59..17455cf 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -12033,6 +12033,30 @@ openoffice_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_cont
                 * created out of order implictly) */
                state.sheet_order = g_slist_reverse (state.sheet_order);
 
+               if (g_slist_length (state.sheet_order) < (guint) workbook_sheet_count (state.pos.wb)) {
+                       /* We have seen instances of ODF files generated by   */
+                       /* Libreoffice referring internally to table included */
+                       /* inside charts. Those tables defacto don't exist    */
+                       /* but we have to assume their existence to resolve   */
+                       /* the references. We need to delete tehm now. See    */
+                       /* https://bugzilla.gnome.org/show_bug.cgi?id=698388  */
+                       GSList *to_be_deleted = NULL;
+                       GSList *l;
+
+                       WORKBOOK_FOREACH_SHEET
+                               (state.pos.wb, sheet,
+                                {
+                                        if (NULL == g_slist_find (state.sheet_order, sheet))
+                                                to_be_deleted = g_slist_prepend (to_be_deleted, sheet);      
   
+                                });
+                       l = to_be_deleted;
+                       while (l) {
+                               workbook_sheet_delete (l->data);
+                               l = l->next;
+                       }
+                       g_slist_free (to_be_deleted);
+               }
+
                if (state.debug) {
                        GSList *l, *sheets;
                        g_printerr ("Order we desire:\n");


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