Commit d5c234b1 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Add new accelerators. <control><alt>Tab : inc indent


2006-11-08  Jody Goldberg <jody@gnome.org>

	* src/wbcg-actions.c  : Add new accelerators.
	    <control><alt>Tab : inc indent
	    <control><alt><shift>Tab : dec indent.
	    <shift><alt>Right : group
	    <shift><alt>Left : ungroup

	* src/GNOME_Gnumeric-gtk.xml.in : Add explicit accelerator entries for
	  the inc/dec indent because they are not in the menu by default, so
	  their accels are not enabled.

	* src/gnumeric-canvas.c (gnm_canvas_key_mode_sheet) : don't eat
	  Alt-left/right.  We want those for accelerators.

2006-11-08  Jody Goldberg <jody@gnome.org>

	* src/gutils.c (gnm_push_C_locale) : new utility to set the C locale
	(gnm_pop_C_locale) : and restore it.  Useful for persistence to avoid
	  problems with decimal points.
	* src/xml-io.c (xml_cellregion_read) : Use it here.
	(xml_workbook_read) : and here.
	* src/xml-sax-read.c (gnm_xml_file_open) : ditto.
	* src/xml-sax-write.c (gnm_xml_file_save) : ditto.
	(gnm_cellregion_to_xml) : ditto.

	* src/sheet-object-graph.c (gnm_sog_write_object) : do not change the
	  locale here.
	* src/sheet-object.c (sheet_object_write_object) : that logic belongs
	  here.  Use the new push/pop C_locale routines.

2006-11-09  Jody Goldberg <jody@gnome.org>

	* xlsx-read.c (xlsx_file_open) : use the new
	  gnm_push_C_locale/gnm_pop_C_locale utils.
	* xlsx-write.c (xlsx_file_save) : ditto.

2006-11-09  Jody Goldberg <jody@gnome.org>

	* openoffice-read.c (openoffice_file_open) : use the new
	  gnm_push_C_locale/gnm_pop_C_locale utils.
	* openoffice-write.c (openoffice_file_save) : ditto.

2006-11-09  Jody Goldberg <jody@gnome.org>

	* sylk.c (slyk_file_open) : use the new
	  gnm_push_C_locale/gnm_pop_C_locale utils.

2006-11-08  Jody Goldberg <jody@gnome.org>

	* dif.c (dif_file_save) : export errors, booleans, and values
	  properly.

2006-11-08  Jody Goldberg <jody@gnome.org>

	* dif.c (dif_parse_sheet) : use the new
	  gnm_push_C_locale/gnm_pop_C_locale utils.
	(dif_file_save) : ditto.
parent bfbae5bc
2006-11-08 Jody Goldberg <jody@gnome.org>
* src/wbcg-actions.c : Add new accelerators.
<control><alt>Tab : inc indent
<control><alt><shift>Tab : dec indent.
<shift><alt>Right : group
<shift><alt>Left : ungroup
* src/GNOME_Gnumeric-gtk.xml.in : Add explicit accelerator entries for
the inc/dec indent because they are not in the menu by default, so
their accels are not enabled.
* src/gnumeric-canvas.c (gnm_canvas_key_mode_sheet) : don't eat
Alt-left/right. We want those for accelerators.
2006-11-08 Jody Goldberg <jody@gnome.org>
* src/gutils.c (gnm_push_C_locale) : new utility to set the C locale
(gnm_pop_C_locale) : and restore it. Useful for persistence to avoid
problems with decimal points.
* src/xml-io.c (xml_cellregion_read) : Use it here.
(xml_workbook_read) : and here.
* src/xml-sax-read.c (gnm_xml_file_open) : ditto.
* src/xml-sax-write.c (gnm_xml_file_save) : ditto.
(gnm_cellregion_to_xml) : ditto.
* src/sheet-object-graph.c (gnm_sog_write_object) : do not change the
locale here.
* src/sheet-object.c (sheet_object_write_object) : that logic belongs
here. Use the new push/pop C_locale routines.
2006-11-08 Eduardo Lima <eduardo.lima@indt.org.br>
* configure.in: Make print support optional. #331948
......
......@@ -21,6 +21,8 @@ Jody:
* Rewrite expression relocation logic.
* Add accelerator (Alt-=) for auto-sum.
* Make paytype handler more flexible.
* Fix DIF import/export.
* Add accelerator for group/ungroup and inc/dec indent.
Joseph Pingenot:
* Add more conditional format types.
......
2006-11-08 Jody Goldberg <jody@gnome.org>
Get things partially working. TODO
- More error checking on import
- set locales in i/o
- more value types on export
* dif.c (dif_file_save) : export errors, booleans, and values
properly.
2006-11-08 Jody Goldberg <jody@gnome.org>
* dif.c (dif_parse_sheet) : use the new
gnm_push_C_locale/gnm_pop_C_locale utils.
(dif_file_save) : ditto.
2006-11-08 Jody Goldberg <jody@gnome.org>
Get things partially working.
* dif.c (dif_get_line) : inc the line number so that error messages
are more useful.
(dif_parse_data) : handle quoted strings properly.
......
......@@ -16,6 +16,7 @@
#include <sheet.h>
#include <value.h>
#include <numbers.h>
#include <gutils.h>
#include <goffice/app/io-context.h>
#include <workbook-view.h>
#include <workbook.h>
......@@ -35,7 +36,7 @@ GNM_PLUGIN_MODULE_HEADER;
void dif_file_open (GOFileOpener const *fo, IOContext *io_context,
WorkbookView *wbv, GsfInput *input);
void dif_file_save (GOFileSaver const *fs, IOContext *io_context,
WorkbookView const *wbv, GsfOutput *output);
WorkbookView const *wbv, GsfOutput *out);
typedef struct {
IOContext *io_context;
......@@ -186,11 +187,11 @@ dif_parse_data (DifInputContext *ctxt)
v = value_new_float (num);
} else if (0 == strcmp (ctxt->line, "NA")) { /* NA not available res must be O */
v = value_new_error_NA (NULL);
} else if (0 == strcmp (ctxt->line, "TRUE")) { /* ERROR bool T res must be 1 */
} else if (0 == strcmp (ctxt->line, "TRUE")) { /* TRUE bool T res must be 1 */
v = value_new_bool (TRUE);
} else if (0 == strcmp (ctxt->line, "FALSE")) { /* TRUE bool F res must be O */
} else if (0 == strcmp (ctxt->line, "FALSE")) { /* FALSE bool F res must be O */
v = value_new_bool (TRUE);
} else if (0 == strcmp (ctxt->line, "ERROR")) { /* FALSE err res must be O */
} else if (0 == strcmp (ctxt->line, "ERROR")) { /* ERROR err res must be O */
gnm_io_warning (ctxt->io_context,
_("Unknown value type '%s' at line %d. Ignoring."),
ctxt->line, ctxt->line_no);
......@@ -261,6 +262,8 @@ dif_parse_data (DifInputContext *ctxt)
static void
dif_parse_sheet (DifInputContext *ctxt)
{
GnmLocale *locale = gnm_push_C_locale ();
if (!dif_parse_header (ctxt)) {
gnumeric_io_error_info_set (ctxt->io_context, error_info_new_printf (
_("Unexpected end of file at line %d while reading header."),
......@@ -270,6 +273,8 @@ dif_parse_sheet (DifInputContext *ctxt)
_("Unexpected end of file at line %d while reading data."),
ctxt->line_no));
}
gnm_pop_C_locale (locale);
}
void
......@@ -296,8 +301,9 @@ dif_file_open (GOFileOpener const *fo, IOContext *io_context,
*/
void
dif_file_save (GOFileSaver const *fs, IOContext *io_context,
WorkbookView const *wbv, GsfOutput *output)
WorkbookView const *wbv, GsfOutput *out)
{
GnmLocale *locale;
Sheet *sheet;
GnmRange r;
gint row, col;
......@@ -312,32 +318,49 @@ dif_file_save (GOFileSaver const *fs, IOContext *io_context,
r = sheet_get_extent (sheet, FALSE);
/* Write out the standard headers */
res = gsf_output_puts (output, "TABLE\n" "0,1\n" "\"GNUMERIC\"\n");
if (res) res = gsf_output_printf (output,
"VECTORS\n" "0,%d\n" "\"\"\n",
r.end.row+1);
if (res) res = gsf_output_printf (output,
"TUPLES\n" "0,%d\n" "\"\"\n",
r.end.col+1);
if (res) res= gsf_output_puts (output, "DATA\n0,0\n" "\"\"\n");
gsf_output_puts (out, "TABLE\n" "0,1\n" "\"GNUMERIC\"\n");
gsf_output_printf (out, "VECTORS\n" "0,%d\n" "\"\"\n", r.end.row+1);
gsf_output_printf (out, "TUPLES\n" "0,%d\n" "\"\"\n", r.end.col+1);
gsf_output_puts (out, "DATA\n" "0,0\n" "\"\"\n");
locale = gnm_push_C_locale ();
/* Process all cells */
for (row = r.start.row; res && row <= r.end.row; row++) {
gsf_output_puts (output, "-1,0\n" "BOT\n");
gsf_output_puts (out, "-1,0\n" "BOT\n");
for (col = r.start.col; col <= r.end.col; col++) {
GnmCell *cell = sheet_cell_get (sheet, col, row);
if (cell_is_empty (cell)) {
gsf_output_puts(output, "1,0\n" "\"\"\n");
} else {
gsf_output_puts(out, "1,0\n" "\"\"\n");
} else if (VALUE_IS_BOOLEAN (cell->value)) {
if (value_get_as_checked_bool (cell->value))
gsf_output_puts(out, "0,1\n" "TRUE\n");
else
gsf_output_puts(out, "0,0\n" "FALSE\n");
} else if (VALUE_IS_ERROR (cell->value)) {
if (value_error_classify (cell->value) == GNM_ERROR_NA)
gsf_output_puts(out, "0,0\n" "NA\n");
else
gsf_output_puts(out, "0,0\n" "ERROR\n");
} else if (VALUE_IS_FLOAT (cell->value))
gsf_output_printf (out, "0,%" GNM_FORMAT_g "\n" "V\n",
value_get_as_float (cell->value));
else {
gchar *str = cell_get_rendered_text (cell);
res = gsf_output_printf (output,
res = gsf_output_printf (out,
"1,0\n" "\"%s\"\n",
str);
g_free (str);
}
}
}
gsf_output_puts (output, "-1,0\n" "EOD\n");
/* This BOT is not required as far as I can tel, but MS seems to puts
* one here, and it may be useful to be compatible */
gsf_output_puts (out, "-1,0\n" "BOT\n");
gsf_output_puts (out, "-1,0\n" "EOD\n");
gnm_pop_C_locale (locale);
if (!res)
gnumeric_io_error_string (io_context, _("Error while saving DIF file."));
......
2006-11-09 Jody Goldberg <jody@gnome.org>
* xlsx-read.c (xlsx_file_open) : use the new
gnm_push_C_locale/gnm_pop_C_locale utils.
* xlsx-write.c (xlsx_file_save) : ditto.
2006-10-27 Jon K Hellan <hellan@acm.org>
* ms-excel-read.c (excel_read_MERGECELLS): Accept overlapping
......
......@@ -42,6 +42,7 @@
#include "command-context.h"
#include "workbook-view.h"
#include "workbook.h"
#include "gutils.h"
#include <goffice/app/error-info.h>
#include <goffice/app/io-context.h>
#include <goffice/app/go-plugin.h>
......@@ -58,7 +59,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
/*****************************************************************************/
......@@ -2605,8 +2605,8 @@ void
xlsx_file_open (GOFileOpener const *fo, IOContext *io_context,
WorkbookView *wb_view, GsfInput *input)
{
char *old_num_locale, *old_monetary_locale;
XLSXReadState state;
GnmLocale *locale;
memset (&state, 0, sizeof (XLSXReadState));
state.context = io_context;
......@@ -2622,11 +2622,7 @@ xlsx_file_open (GOFileOpener const *fo, IOContext *io_context,
(GDestroyNotify)g_free, (GDestroyNotify) go_format_unref);
state.expr_convs = xlsx_expr_conv_new ();
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
locale = gnm_push_C_locale ();
if (NULL != (state.zip = gsf_infile_zip_new (input, NULL))) {
/* optional */
......@@ -2649,11 +2645,7 @@ xlsx_file_open (GOFileOpener const *fo, IOContext *io_context,
g_object_unref (G_OBJECT (state.zip));
}
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
gnm_pop_C_locale (locale);
if (NULL != state.sst) {
unsigned i = state.sst->len;
......
......@@ -40,6 +40,7 @@
#include "str.h"
#include "style-color.h"
#include "print-info.h"
#include "gutils.h"
#include <goffice/app/file.h>
#include <goffice/utils/go-format.h>
......@@ -51,7 +52,6 @@
#include <gsf/gsf-libxml.h>
#include <glib/gi18n-lib.h>
#include <gmodule.h>
#include <locale.h>
/*************************************************************/
typedef struct _GsfOutfileOpenPkg GsfOutfileOpenPkg;
......@@ -1008,14 +1008,10 @@ xlsx_file_save (GOFileSaver const *fs, IOContext *io_context,
gconstpointer wb_view, GsfOutput *output)
{
XLSXWriteState state;
char *old_num_locale, *old_monetary_locale;
GsfOutfile *root_part;
GnmLocale *locale;
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
locale = gnm_push_C_locale ();
state.io_context = io_context;
state.wb_view = wb_view;
......@@ -1027,11 +1023,7 @@ xlsx_file_save (GOFileSaver const *fs, IOContext *io_context,
gsf_output_close (GSF_OUTPUT (root_part));
g_object_unref (root_part);
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
gnm_pop_C_locale (locale);
}
/* TODO : (Just about everything)
......
......@@ -532,6 +532,7 @@ gnumeric_choose (FunctionEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
if (argc < 1)
return value_new_error_VALUE (ei->pos);
#warning TODO add array eval
v = gnm_expr_eval (argv[0], ei->pos, GNM_EXPR_EVAL_SCALAR_NON_EMPTY);
if (!v)
return NULL;
......
2006-11-09 Jody Goldberg <jody@gnome.org>
* openoffice-read.c (openoffice_file_open) : use the new
gnm_push_C_locale/gnm_pop_C_locale utils.
* openoffice-write.c (openoffice_file_save) : ditto.
2006-10-17 Jody Goldberg <jody@gnome.org>
* Release 1.7.2
......
......@@ -42,6 +42,7 @@
#include <style-border.h>
#include <gnm-format.h>
#include <command-context.h>
#include <gutils.h>
#include <goffice/app/io-context.h>
#include <goffice/app/go-doc.h>
#include <goffice/utils/go-units.h>
......@@ -57,7 +58,6 @@
#include <glib/gi18n-lib.h>
#include <string.h>
#include <locale.h>
#include <goffice/graph/gog-chart.h>
#include <goffice/graph/gog-plot-impl.h>
......@@ -2356,7 +2356,7 @@ oo_conventions (void)
void
openoffice_file_open (GOFileOpener const *fo, IOContext *io_context,
WorkbookView *wb_view, GsfInput *input);
void
G_MODULE_EXPORT void
openoffice_file_open (GOFileOpener const *fo, IOContext *io_context,
WorkbookView *wb_view, GsfInput *input)
{
......@@ -2366,9 +2366,9 @@ openoffice_file_open (GOFileOpener const *fo, IOContext *io_context,
GsfInput *mimetype = NULL;
GsfDocMetaData *meta_data;
GsfInfile *zip;
GnmLocale *locale;
OOParseState state;
GError *err = NULL;
char *old_num_locale, *old_monetary_locale;
int i;
zip = gsf_infile_zip_new (input, &err);
......@@ -2420,11 +2420,7 @@ openoffice_file_open (GOFileOpener const *fo, IOContext *io_context,
return;
}
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
locale = gnm_push_C_locale ();
/* init */
state.context = io_context;
......@@ -2519,9 +2515,5 @@ openoffice_file_open (GOFileOpener const *fo, IOContext *io_context,
gnm_expr_conventions_free (state.exprconv);
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
gnm_pop_C_locale (locale);
}
......@@ -57,6 +57,7 @@
#include <print-info.h>
#include <parse-util.h>
#include <tools/scenarios.h>
#include <gutils.h>
#include <gsf/gsf-libxml.h>
#include <gsf/gsf-output.h>
......@@ -66,7 +67,6 @@
#include <gsf/gsf-opendoc-utils.h>
#include <glib/gi18n-lib.h>
#include <locale.h>
#define MANIFEST "manifest:"
#define OFFICE "office:"
......@@ -607,17 +607,13 @@ openoffice_file_save (GOFileSaver const *fs, IOContext *ioc,
};
GnmOOExport state;
char *old_num_locale, *old_monetary_locale;
GsfOutfile *outfile = NULL;
GsfOutput *child;
GnmLocale *locale;
GError *err;
unsigned i;
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
locale = gnm_push_C_locale ();
outfile = gsf_outfile_zip_new (output, &err);
......@@ -632,14 +628,10 @@ openoffice_file_save (GOFileSaver const *fs, IOContext *ioc,
g_object_unref (G_OBJECT (child));
}
g_free (state.conv);
gsf_output_close (GSF_OUTPUT (outfile));
g_object_unref (G_OBJECT (outfile));
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
g_free (state.conv);
gnm_pop_C_locale (locale);
}
2006-11-09 Jody Goldberg <jody@gnome.org>
* sylk.c (slyk_file_open) : use the new
gnm_push_C_locale/gnm_pop_C_locale utils.
2006-10-17 Jody Goldberg <jody@gnome.org>
* Release 1.7.2
......
......@@ -29,13 +29,13 @@
#include "style-color.h"
#include "sheet-style.h"
#include "number-match.h"
#include "gutils.h"
#include <goffice/app/error-info.h>
#include <goffice/app/go-plugin.h>
#include <gnm-plugin.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#include <stdlib.h>
#include <gsf/gsf-input-stdio.h>
#include <gsf/gsf-input-textline.h>
......@@ -489,9 +489,9 @@ sylk_file_open (GOFileOpener const *fo,
char const *input_name;
char *base;
int i;
Workbook *book = wb_view_get_workbook (wb_view);
GnmLocale *locale;
Workbook *book = wb_view_get_workbook (wb_view);
ErrorInfo *sheet_error;
char *old_num_locale, *old_monetary_locale;
input_name = gsf_input_name (input);
if (input_name == NULL)
......@@ -510,19 +510,11 @@ sylk_file_open (GOFileOpener const *fo,
workbook_sheet_attach (book, state.sheet);
g_free (base);
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
locale = gnm_push_C_locale ();
sylk_parse_sheet (&state, &sheet_error);
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
gnm_pop_C_locale (locale);
if (sheet_error != NULL)
gnumeric_io_error_info_set (io_context,
......
......@@ -118,6 +118,8 @@
</menu>
<menu name="Format" action="MenuFormat">
<menuitem action="FormatCells"/>
<menuitem action="FormatDecreaseIndent"/>
<menuitem action="FormatIncreaseIndent"/>
<menu name="FormatColumn" action="MenuFormatColumn">
<menuitem action="ColumnSize"/>
<menuitem action="ColumnAutoSize"/>
......@@ -313,4 +315,6 @@
<accelerator name="FormatClearBorders" action="FormatClearBorders"/>
<accelerator name="Repeat" action="Repeat"/>
<accelerator name="EditSelectAllXL" action="EditSelectAllXL"/>
<accelerator name="FormatDecreaseIndent" action="FormatDecreaseIndent"/>
<accelerator name="FormatIncreaseIndent" action="FormatIncreaseIndent"/>
</ui>
......@@ -168,6 +168,9 @@ gnm_canvas_key_mode_sheet (GnmCanvas *gcanvas, GdkEventKey *event,
switch (event->keyval) {
case GDK_KP_Left:
case GDK_Left:
if (event->state & GDK_MOD1_MASK)
return TRUE; /* Alt is used for accelerators */
if (event->state & SCROLL_LOCK_MASK)
scg_set_left_col (scg, gcanvas->first.col - 1);
else if (transition_keys && jump_to_bounds) {
......@@ -182,6 +185,9 @@ gnm_canvas_key_mode_sheet (GnmCanvas *gcanvas, GdkEventKey *event,
case GDK_KP_Right:
case GDK_Right:
if (event->state & GDK_MOD1_MASK)
return TRUE; /* Alt is used for accelerators */
if (event->state & SCROLL_LOCK_MASK)
scg_set_left_col (scg, gcanvas->first.col + 1);
else if (transition_keys && jump_to_bounds) {
......@@ -338,6 +344,9 @@ gnm_canvas_key_mode_sheet (GnmCanvas *gcanvas, GdkEventKey *event,
case GDK_Tab:
case GDK_ISO_Left_Tab:
case GDK_KP_Tab:
if (event->state & GDK_MOD1_MASK)
return TRUE; /* Alt is used for accelerators */
if (gnm_canvas_guru_key (wbcg, event))
break;
......
......@@ -17,6 +17,8 @@
#include "ranges.h"
#include "mathfunc.h"
#include <goffice/utils/go-format.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
......@@ -26,6 +28,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <locale.h>
#include <gsf/gsf-impl-utils.h>
#ifndef G_OS_WIN32
......@@ -192,3 +195,45 @@ gnm_pango_attr_dump (PangoAttrList *list)
#endif
/* ------------------------------------------------------------------------- */
struct _GnmLocale {
char *num_locale;
char *monetary_locale;
};
/**
* gnm_push_C_locale :
*
* Returns the current locale, and sets the locale and the value-format
* engine's locale to 'C'. The caller must call gnm_pop_C_locale to free the
* result and restore the previous locale.
**/
GnmLocale *
gnm_push_C_locale (void)
{
GnmLocale *old = g_new0 (GnmLocale, 1);
old->num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old->monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
return old;
}
/**
* gnm_pop_C_locale :
* @locale : #GnmLocale
*
* Frees the result of gnm_push_C_locale and restores the original locale.
**/
void
gnm_pop_C_locale (GnmLocale *locale)
{
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, locale->monetary_locale);
g_free (locale->monetary_locale);
go_setlocale (LC_NUMERIC, locale->num_locale);
g_free (locale->num_locale);
g_free (locale);
}
......@@ -23,4 +23,9 @@ extern char const *gnumeric_data_dir;
int gnm_regcomp_XL (GORegexp *preg, char const *pattern, int cflags);
/* Locale utilities */
typedef struct _GnmLocale GnmLocale;
GnmLocale *gnm_push_C_locale (void);
void gnm_pop_C_locale (GnmLocale *locale);
#endif /* GNUMERIC_UTILS_H */
......@@ -72,7 +72,6 @@
#include <goffice/cut-n-paste/foocanvas/foo-canvas-text.h>
#include <math.h>
#include <string.h>
#include <locale.h>
static void
so_graph_view_destroy (SheetObjectView *sov)
......@@ -256,33 +255,20 @@ gnm_sog_write_image (SheetObject const *so, char const *format, double resolutio
static void
gnm_sog_write_object (SheetObject const *so, char const *format,
GsfOutput *output, GError **err)
GsfOutput *output, GError **err)
{
SheetObjectGraph *sog = SHEET_OBJECT_GRAPH (so);
GsfXMLOut *xout;
char *old_num_locale, *old_monetary_locale;
GogObject *graph;
g_return_if_fail (strcmp (format, "application/x-goffice-graph") == 0);
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
graph = gog_object_dup (GOG_OBJECT (sog->graph),
NULL, gog_dataset_dup_to_simple);
xout = gsf_xml_out_new (output);
gog_object_write_xml_sax (GOG_OBJECT (graph), xout);
g_object_unref (xout);
g_object_unref (graph);
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
}
static void
......
......@@ -1155,11 +1155,14 @@ void
sheet_object_write_object (SheetObject const *so, char const *format,
GsfOutput *output, GError **err)
{
g_return_if_fail (IS_SHEET_OBJECT_EXPORTABLE (so));
GnmLocale *locale;
SHEET_OBJECT_EXPORTABLE_CLASS (so)->write_object (so, format,
output, err);
g_return_if_fail (IS_SHEET_OBJECT_EXPORTABLE (so));
locale = gnm_push_C_locale ();
SHEET_OBJECT_EXPORTABLE_CLASS (so)->write_object (so, format,
output, err);
gnm_pop_C_locale (locale);
}
/*****************************************************************************/
......
......@@ -1984,10 +1984,10 @@ static GtkActionEntry const actions[] = {
NULL, N_("Uncollapse an outline group"),
G_CALLBACK (cb_data_show_detail) },
{ "DataOutlineGroup", "Gnumeric_Group", N_("_Group..."),
NULL, N_("Add an outline group"),
"<shift><alt>Right", N_("Add an outline group"),
G_CALLBACK (cb_data_group) },
{ "DataOutlineUngroup", "Gnumeric_Ungroup", N_("_Ungroup..."),
NULL, N_("Remove an outline group"),
"<shift><alt>Left", N_("Remove an outline group"),
G_CALLBACK (cb_data_ungroup) },
/* Data -> Filter */
......@@ -2113,10 +2113,10 @@ static GtkActionEntry const actions[] = {
NULL, N_("Decrease the number of decimals displayed"),
G_CALLBACK (cb_format_dec_precision) },
{ "FormatDecreaseIndent", GTK_STOCK_UNINDENT, NULL,
NULL, N_("Decrease the indent, and align the contents to the left"),
"<control><alt><shift>Tab", N_("Decrease the indent, and align the contents to the left"),
G_CALLBACK (cb_format_dec_indent) },
{ "FormatIncreaseIndent", GTK_STOCK_INDENT, NULL,
NULL, N_("Increase the indent, and align the contents to the left"),
"<control><alt>Tab", N_("Increase the indent, and align the contents to the left"),
G_CALLBACK (cb_format_inc_indent) },
/* Unattached */
#warning add descriptions for copy down/right
......
......@@ -55,7 +55,6 @@
#include <gsf/gsf-input.h>
#include <glib/gi18n-lib.h>
#include <glib/gstdio.h>
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
......
......@@ -67,7 +67,6 @@
#include <gsf/gsf-utils.h>
#include <gsf/gsf-input-memory.h>
#include <locale.h>
#include <errno.h>
#include <math.h>
#include <string.h>
......@@ -2088,19 +2087,15 @@ GnmCellRegion *
xml_cellregion_read (WorkbookControl *wbc, Sheet *sheet, guchar const *buffer, int length)
{
XmlParseContext *ctxt;
xmlNode *l, *clipboard;
xmlDoc *doc;
GnmCellRegion *cr = NULL;
xmlNode *l, *clipboard;
xmlDoc *doc;
GnmCellRegion *cr = NULL;
GnmLocale *locale;
int dummy;
char *old_num_locale, *old_monetary_locale;
g_return_val_if_fail (buffer != NULL, NULL);
old_num_locale = g_strdup (go_setlocale (LC_NUMERIC, NULL));
go_setlocale (LC_NUMERIC, "C");
old_monetary_locale = g_strdup (go_setlocale (LC_MONETARY, NULL));
go_setlocale (LC_MONETARY, "C");
go_set_untranslated_bools ();
locale = gnm_push_C_locale ();
doc = xmlParseDoc ((guchar *) buffer);
......@@ -2166,11 +2161,7 @@ xml_cellregion_read (WorkbookControl *wbc, Sheet *sheet, guchar const *buffer, i
xmlFreeDoc (doc);
err:
/* go_setlocale restores bools to locale translation */
go_setlocale (LC_MONETARY, old_monetary_locale);
g_free (old_monetary_locale);
go_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
gnm_pop_C_locale (locale);
return cr;
}
......@@ -2296,9 +2287,9 @@ static gboolean
xml_workbook_read (IOContext *context,