[gnumeric] in xls export avoid synthesizing the same style several times



commit d39528301f3be4ae677d4d18d9ad5d535dae9ae4
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Aug 21 11:19:58 2011 -0600

    in xls export avoid synthesizing the same style several times
    
    2011-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* ms-excel-write.c (cb_cell_pre_pass): avoid synthesizing the same style several
    	times

 plugins/excel/ChangeLog        |    5 +++++
 plugins/excel/ms-excel-write.c |   10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 7fc017f..bc7ab14 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* ms-excel-write.c (cb_cell_pre_pass): avoid synthesizing the same style several
+	times
+
+2011-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* ms-excel-write.c (cb_cell_pre_pass): synthesize wrap-text style if necessary
 	(build_xf_data): we need to write wrap-text in variant 4
 
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 4340dec..38e2d41 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -2545,12 +2545,16 @@ cb_cell_pre_pass (gpointer ignored, GnmCell const *cell, ExcelWriteState *ewb)
 			ExcelStyleVariant *esv = g_new (ExcelStyleVariant, 1);
 			esv->variant = (quoted ? 1 : 0) | (wrapped ? 4 : 0);
 			esv->style = style;
-			xf = two_way_table_put (ewb->base.xf.two_way_table,
-						esv, FALSE,
-						(AfterPutFunc)after_put_esv, NULL);
 			g_hash_table_insert (ewb->base.xf.cell_style_variant,
 					     (gpointer)cell,
 					     GINT_TO_POINTER (esv->variant));
+			xf = two_way_table_key_to_idx (ewb->base.xf.two_way_table, esv);
+			if (xf < 0)
+				xf = two_way_table_put (ewb->base.xf.two_way_table,
+							esv, FALSE,
+							(AfterPutFunc)after_put_esv, NULL);
+			else
+				g_free (esv);
 		}
 	}
 }



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