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

From: Hal Ashburner <hal_ashburner@yahoo.co.uk> massive rewrite.


2002-10-08  Jody Goldberg <jody@gnome.org>

	From: Hal Ashburner <hal_ashburner@yahoo.co.uk>
	* options.c : massive rewrite.

2002-10-08  Jody Goldberg <jody@gnome.org>

	Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
	* src/formats.c : regexp for accounting too.

2002-10-08  Jody Goldberg <jody@gnome.org>

	* openoffice-read.c (oo_style) : correctly layer parent styles but
	  lose the relationship because we have no similar structure.
	  Put the frame work in place to start supporting number formats but
	  do not implement it yet.

2002-10-08  Jody Goldberg <jody@gnome.org>

	* src/parse-util.c (rangeref_parse) : handle relative full col/row
	  references.
parent d98414d4
......@@ -49,15 +49,14 @@ UTF-8 :
Pending Patches
---------------
- regexp bases format characterization
- regexp based accounting format characterization
- ?? more work on D&D based sheet reorg ?
- New derivatives functions
Probably Post 1.2 Targets
-------------------------
- conditional formats : could be done if someone wanted to work on the dialog
- pivots and scripting
- undo/redo transaction log
- undo/redo transaction file
- load/save of external references
Misc stuff that should be fixed
......
......@@ -5,6 +5,16 @@
* src/gutils.c (gnumeric_valid_filename): New function.
2002-10-08 Jody Goldberg <jody@gnome.org>
Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
* src/formats.c : regexp for accounting too.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/parse-util.c (rangeref_parse) : handle relative full col/row
references.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/parser.y (parser_lookup_name) : default the placeholder to be at
......@@ -47,9 +57,8 @@
2002-10-06 Jody Goldberg <jody@gnome.org>
Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
* src/formats.c : replace the currency and accounting format
classification engines with a cleaner, more accurate regexp based
approach.
* src/formats.c : replace the currency format classification engines
with a cleaner, more accurate regexp based approach.
2002-10-04 Jody Goldberg <jody@gnome.org>
......
......@@ -34,6 +34,7 @@ Jody:
* Handle encryption from 'Tools -> Protection -> Workbook Protected'
* Remove implicit conversion of unquoted strings that are not names
* Import named expressions, arrays and merged regions from OpenCalc
* More cleanup after the big parser rework
Morten:
* Port search center from gal's e-table to gtk's treeview.
......@@ -45,6 +46,12 @@ Morten:
dorami@bu.iij4u.or.jp:
* Add InputMethod support for better international key support
Hal Ashburner:
* Rework derivative valuation routines
Nicolas Peninguy:
* Use regexps to classify currency and accounting formats
--------------------------------------------------------------------------
Gnumeric 1.1.9
......
......@@ -5,6 +5,16 @@
* src/gutils.c (gnumeric_valid_filename): New function.
2002-10-08 Jody Goldberg <jody@gnome.org>
Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
* src/formats.c : regexp for accounting too.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/parse-util.c (rangeref_parse) : handle relative full col/row
references.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/parser.y (parser_lookup_name) : default the placeholder to be at
......@@ -47,9 +57,8 @@
2002-10-06 Jody Goldberg <jody@gnome.org>
Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
* src/formats.c : replace the currency and accounting format
classification engines with a cleaner, more accurate regexp based
approach.
* src/formats.c : replace the currency format classification engines
with a cleaner, more accurate regexp based approach.
2002-10-04 Jody Goldberg <jody@gnome.org>
......
......@@ -5,6 +5,16 @@
* src/gutils.c (gnumeric_valid_filename): New function.
2002-10-08 Jody Goldberg <jody@gnome.org>
Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
* src/formats.c : regexp for accounting too.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/parse-util.c (rangeref_parse) : handle relative full col/row
references.
2002-10-08 Jody Goldberg <jody@gnome.org>
* src/parser.y (parser_lookup_name) : default the placeholder to be at
......@@ -47,9 +57,8 @@
2002-10-06 Jody Goldberg <jody@gnome.org>
Patch from peninguy.nicolas@wanadoo.fr (Nicolas Peninguy)
* src/formats.c : replace the currency and accounting format
classification engines with a cleaner, more accurate regexp based
approach.
* src/formats.c : replace the currency format classification engines
with a cleaner, more accurate regexp based approach.
2002-10-04 Jody Goldberg <jody@gnome.org>
......
2002-10-08 Jody Goldberg <jody@gnome.org>
From: Hal Ashburner <hal_ashburner@yahoo.co.uk>
* options.c : massive rewrite.
2002-09-30 Jody Goldberg <jody@gnome.org>
* Release 1.1.9
......
This diff is collapsed.
......@@ -11,16 +11,28 @@
<service type="function_group" id="derivatives">
<_category>Financial</_category>
<functions>
<function name="opt_bs_call"/>
<function name="opt_bs_call_delta"/>
<function name="opt_bs_call_rho"/>
<function name="opt_bs_call_theta"/>
<function name="opt_bs_put"/>
<function name="opt_bs_put_delta"/>
<function name="opt_bs_put_rho"/>
<function name="opt_bs_put_theta"/>
<function name="cum_biv_norm_dist"/>
<function name="opt_bs"/>
<function name="opt_bs_delta"/>
<function name="opt_bs_rho"/>
<function name="opt_bs_theta"/>
<function name="opt_bs_gamma"/>
<function name="opt_bs_vega"/>
<function name="opt_bs_carrycost"/>
<function name="opt_garman_kohlhagen"/>
<function name="opt_french"/>
<function name="opt_jump_diff"/>
<function name="opt_bjerStens"/>
<function name="opt_BAW_amer"/>
<function name="opt_exec"/>
<function name="opt_miltersen_schwartz"/>
<function name="opt_rgw"/>
<function name="opt_forward_start"/>
<function name="opt_time_switch"/>
<function name="opt_simple_chooser"/>
<function name="opt_complex_chooser"/>
<function name="opt_on_options"/>
<function name="opt_extendible_writer"/>
</functions>
</service>
</services>
......
2002-10-08 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (write_names) : Fix leak by not inserting copies of
of the name string.
1) no need to copy
2) no need to do a string compare
2002-10-07 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (ms_excel_read_workbook) : handle workbook protected
......
......@@ -16,19 +16,20 @@
#include "ms-container.h"
#include <expr.h>
typedef struct _ExcelSheet
{
typedef struct _ExcelWorkbook ExcelWorkbook;
typedef struct _ExcelSheet ExcelSheet;
struct _ExcelSheet {
MSContainer container;
Sheet *gnum_sheet;
struct _ExcelWorkbook *wb;
GHashTable *shared_formulae, *tables;
Sheet *gnum_sheet;
ExcelWorkbook *wb;
GHashTable *shared_formulae, *tables;
gboolean freeze_panes : 1;
} ExcelSheet;
};
typedef struct _BiffBoundsheetData
{
typedef struct _BiffBoundsheetData {
guint16 index;
guint32 streamStartPos;
MsBiffFileType type;
......@@ -88,8 +89,7 @@ typedef struct _BiffFormatData {
char *name;
} BiffFormatData;
typedef struct _ExcelWorkbook
{
struct _ExcelWorkbook {
MSContainer container;
IOContext *context;
WorkbookView *wbv;
......@@ -113,11 +113,8 @@ typedef struct _ExcelWorkbook
ExprTreeSharer *expr_sharer;
/**
* Gnumeric parallel workbook
**/
Workbook *gnum_wb;
} ExcelWorkbook;
};
char *biff_get_text (guint8 const *ptr, guint32 length, guint32 *byte_length);
char const *biff_get_error_text (guint8 err);
......
......@@ -610,17 +610,17 @@ write_names (BiffPut *bp, ExcelWorkbook *wb)
guint16 len, name_len;
char *text;
GnmNamedExpr const *expr_name = names->data;
GnmNamedExpr const *nexpr = names->data;
g_return_if_fail (expr_name != NULL);
g_return_if_fail (nexpr != NULL);
if (wb->ver >= MS_BIFF_V8)
ms_biff_put_var_next (bp, 0x200 | BIFF_NAME);
else
ms_biff_put_var_next (bp, BIFF_NAME);
text = expr_name->name->str;
name_len = strlen (expr_name->name->str);
text = nexpr->name->str;
name_len = strlen (nexpr->name->str);
memset (data0, 0, sizeof (data0));
GSF_LE_SET_GUINT8 (data0 + 3, name_len); /* name_len */
......@@ -631,7 +631,7 @@ write_names (BiffPut *bp, ExcelWorkbook *wb)
g_free(text);
ms_biff_put_var_seekto (bp, 14 + name_len);
len = ms_excel_write_formula (bp, esheet,
expr_name->t.expr_tree, 0, 0, 0);
nexpr->t.expr_tree, 0, 0, 0);
g_return_if_fail (len <= 0xffff);
......@@ -640,7 +640,7 @@ write_names (BiffPut *bp, ExcelWorkbook *wb)
ms_biff_put_var_write (bp, data1, 2);
ms_biff_put_commit (bp);
g_ptr_array_add (wb->names, g_strdup(text));
g_ptr_array_add (wb->names, (gpointer)nexpr);
}
}
......
......@@ -738,7 +738,8 @@ ms_excel_parse_formula (ExcelWorkbook const *ewb,
g_return_val_if_fail (ewb != NULL, NULL);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_formula_debug > 0 && esheet != NULL) {
if (ms_excel_formula_debug > 0) {
printf ("len = %d\n", length);
ms_excel_dump_cellname (ewb, esheet, fn_col, fn_row);
if (ms_excel_formula_debug > 2)
gsf_mem_dump (mem, length);
......
......@@ -705,19 +705,23 @@ write_node (PolishData *pd, GnmExpr const *tree, int paren_level)
break;
case GNM_EXPR_OP_NAME : {
GnmNamedExpr const *n = tree->name.name;
guint8 data[14];
guint16 idx;
for (idx = 0; idx <14; idx++) data[idx] = 0;
unsigned i;
for (idx = 0; idx < pd->sheet->wb->names->len; idx++)
if (!strcmp(tree->name.name->name->str,
(char *) g_ptr_array_index (pd->sheet->wb->names, idx))) {
memset (data, 0, sizeof (data));
GSF_LE_SET_GUINT8 (data + 0, FORMULA_PTG_NAME);
GSF_LE_SET_GUINT16 (data + 1, idx + 1);
ms_biff_put_var_write (pd->bp, data, 15);
return;
}
for (i = 0; i < pd->sheet->wb->names->len; i++)
if (n == g_ptr_array_index (pd->sheet->wb->names, i))
break;
if (i < pd->sheet->wb->names->len) {
GSF_LE_SET_GUINT8 (data + 0, FORMULA_PTG_NAME);
GSF_LE_SET_GUINT16 (data + 1, i + 1);
ms_biff_put_var_write (pd->bp, data, 15);
} else {
g_warning ("This entire mechanism is bogus. It does not handle sheet local names");
}
break;
}
......
2002-10-08 Jody Goldberg <jody@gnome.org>
* openoffice-read.c (oo_style) : correctly layer parent styles but
lose the relationship because we have no similar structure.
Put the frame work in place to start supporting number formats but
do not implement it yet.
2002-10-08 Jody Goldberg <jody@gnome.org>
* openoffice-read.c (oo_named_expr) : support named expressions.
......
......@@ -39,6 +39,7 @@
#include <style-color.h>
#include <sheet-style.h>
#include <mstyle.h>
#include <format.h>
#include <command-context.h>
#include <io-context.h>
......@@ -64,6 +65,7 @@ typedef struct {
gboolean simple_content : 1;
gboolean error_content : 1;
GHashTable *styles;
GHashTable *formats;
MStyle *style;
MStyle *col_default_styles[SHEET_MAX_COLS];
GSList *sheet_order;
......@@ -504,15 +506,34 @@ static void
oo_style (GsfXmlSAXState *gsf_state, xmlChar const **attrs)
{
OOParseState *state = (OOParseState *)gsf_state;
state->style = mstyle_new_default ();
xmlChar const *name = NULL;
MStyle *parent = NULL;
StyleFormat *fmt = NULL;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (!strcmp (attrs[0], "style:name")) {
g_hash_table_replace (state->styles,
g_strdup (attrs[1]),
state->style = mstyle_new_default ());
return;
/* ignore style:family the names seem unique enough */
if (!strcmp (attrs[0], "style:name"))
name = attrs[1];
else if (!strcmp (attrs[0], "style:parent-style-name")) {
MStyle *tmp = g_hash_table_lookup (state->styles, attrs[1]);
if (tmp != NULL)
parent = tmp;
} else if (!strcmp (attrs[0], "style:data-style-name")) {
StyleFormat *tmp = g_hash_table_lookup (state->formats, attrs[1]);
if (tmp != NULL)
fmt = tmp;
}
if (name != NULL) {
state->style = (parent != NULL)
? mstyle_copy (parent) : mstyle_new_default ();
if (fmt != NULL)
mstyle_set_format (state->style, fmt);
g_hash_table_replace (state->styles,
g_strdup (name), state->style);
}
}
static void
......@@ -657,6 +678,7 @@ GSF_XML_SAX_NODE (START, OFFICE, "office:document-content", FALSE, NULL, NULL, 0
GSF_XML_SAX_NODE (OFFICE, OFFICE_STYLES, "office:automatic-styles", FALSE, NULL, NULL, 0),
GSF_XML_SAX_NODE (OFFICE_STYLES, STYLE, "style:style", FALSE, &oo_style, &oo_style_end, 0),
GSF_XML_SAX_NODE (STYLE, STYLE_PROP, "style:properties", FALSE, &oo_style_prop, NULL, 0),
GSF_XML_SAX_NODE (OFFICE_STYLES, NUMBER_STYLE, "number:number-style", FALSE, NULL, NULL, 0),
GSF_XML_SAX_NODE (NUMBER_STYLE, NUMBER_STYLE_PROP, "number:number", FALSE, NULL, NULL, 0),
GSF_XML_SAX_NODE (NUMBER_STYLE, NUMBER_STYLE_FRACTION, "number:fraction", FALSE, NULL, NULL, 0),
......@@ -753,6 +775,9 @@ openoffice_file_open (GnumFileOpener const *fo, IOContext *io_context,
state.styles = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) mstyle_unref);
state.formats = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) style_format_unref);
state.style = NULL;
state.sheet_order = NULL;
......
......@@ -165,6 +165,7 @@ cell_formats [] = {
/* The compiled regexp for cell_format_classify */
static regex_t re_number_currency;
static regex_t re_percent_science;
static regex_t re_account;
void
currency_date_format_init (void)
......@@ -201,12 +202,18 @@ currency_date_format_init (void)
/* This one is for FMT_PERCENT and FMT_SCIENCE */
char const *pattern_percent_science = "^0\\(.0\\{1,30\\}\\)\\?\\(%\\|E+00\\)$";
/* This one is for FMT_ACCOUNT */
char const *pattern_account = "^_(\\(\\(\\(\\$\\\\\\|€\\|\\|\\[\\$[A-Z][A-Z][A-Z]\\]\\)\\*\\\\\\? \\?\\)\\?\\)\\(#,##0\\(\\.0\\{1,30\\}\\)\\?\\)\\(\\(\\*\\\\\\? \\?\\(\\$\\\\\\|€\\|\\[\\$[A-Z][A-Z][A-Z]\\]\\)\\)\\?\\)_);_(\\1(\\4)\\6;_(\\1\"-\"?\\{0,30\\}\\6_);_(@_)$";
if ((regcomp(&re_number_currency, pattern_number_currency, 0)) != 0)
fprintf(stderr, "Error in regcomp()\n");
if ((regcomp(&re_percent_science, pattern_percent_science, 0)) != 0)
fprintf(stderr, "Error in regcomp()\n");
if ((regcomp(&re_account, pattern_account, 0)) != 0)
fprintf(stderr, "Error in regcomp()\n");
if (precedes) {
post_rep = post = (char *)"";
pre_rep = (char *)"* ";
......@@ -553,6 +560,37 @@ cell_format_is_number (char const * const fmt, FormatCharacteristics *info)
return FMT_SCIENCE;
}
/* FMT_ACCOUNT */
if (regexec(&re_account, fmt, MATCH_SIZE, match, 0) == 0) {
info->num_decimals = 0;
if (match[5].rm_eo != -1)
info->num_decimals = match[5].rm_eo -
match[5].rm_so - 1;
if (match[1].rm_eo == -1 && match[6].rm_eo == -1)
return FMT_UNKNOWN;
else {
if (match[8].rm_eo == -1)
cur = find_currency(ptr + match[3].rm_so,
match[3].rm_eo
- match[3].rm_so);
else if (match[3].rm_eo == -1)
cur = find_currency(ptr + match[8].rm_so,
match[8].rm_eo
- match[8].rm_so);
else
return FMT_UNKNOWN;
}
if (cur == -1)
return FMT_UNKNOWN;
info->currency_symbol_index = cur;
return FMT_ACCOUNT;
}
return FMT_UNKNOWN;
}
......
......@@ -858,6 +858,10 @@ rangeref_parse (RangeRef *res, char const *start, ParsePos const *pp)
return start;
res->a.col_relative = res->b.col_relative = FALSE;
res->a.col = 0; res->b.col = SHEET_MAX_COLS-1;
if (res->a.row_relative)
res->a.row -= pp->eval.row;
if (res->b.row_relative)
res->b.row -= pp->eval.row;
return tmp2;
}
......@@ -870,6 +874,10 @@ rangeref_parse (RangeRef *res, char const *start, ParsePos const *pp)
return start;
res->a.row_relative = res->b.row_relative = FALSE;
res->a.row = 0; res->b.row = SHEET_MAX_ROWS-1;
if (res->a.col_relative)
res->a.col -= pp->eval.col;
if (res->b.col_relative)
res->b.col -= pp->eval.col;
return tmp2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment