Commit d9a0ec3d authored by Jody Goldberg's avatar Jody Goldberg Committed by Arturo Espinosa

Add SplitsArray array exception for array-formula support.

1999-07-12  Jody Goldberg  <jgoldberg@home.com>

	* src/Gnumeric.idl : Add SplitsArray array exception for array-formula
	  support.

	* src/cell.[ch] (cell_set_border) : Const.

	* src/expr.[ch] (value_area_get_width, value_area_get_height) : Const.

	* src/fn-math.c : Added TRANSPOSE.

	* wizards/graphics/*.c : Minor text tweaks so that things come closer
	  to compiling.
parent 1d01132b
1999-07-12 Jody Goldberg <jgoldberg@home.com>
* src/Gnumeric.idl : Add SplitsArray array exception for array-formula
support.
* src/cell.[ch] (cell_set_border) : Const.
* src/expr.[ch] (value_area_get_width, value_area_get_height) : Const.
* src/fn-math.c : Added TRANSPOSE.
* wizards/graphics/*.c : Minor text tweaks so that things come closer
to compiling.
1999-07-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* doc/C/analysis-tools.sgml: Small fixes and additions.
......
1999-07-12 Jody Goldberg <jgoldberg@home.com>
* src/Gnumeric.idl : Add SplitsArray array exception for array-formula
support.
* src/cell.[ch] (cell_set_border) : Const.
* src/expr.[ch] (value_area_get_width, value_area_get_height) : Const.
* src/fn-math.c : Added TRANSPOSE.
* wizards/graphics/*.c : Minor text tweaks so that things come closer
to compiling.
1999-07-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* doc/C/analysis-tools.sgml: Small fixes and additions.
......
......@@ -2314,16 +2314,55 @@ gnumeric_seriessum (FunctionEvalInfo *ei, GList *nodes)
}
static char *help_transpose = {
N_("@FUNCTION=TRANSPOSE\n"
"@SYNTAX=TRANSPOSE(matrix)\n"
"@DESCRIPTION="
"TRANSPOSE function Returns the transpose of the input"
"matrix.\n"
"@SEEALSO=MMULT")
};
static Value *
gnumeric_transpose (FunctionEvalInfo *ei, Value **argv)
{
EvalPosition const * const ep = &ei->pos;
Value const * const matrix = argv[0];
int r, c;
Value *res;
int const cols = value_area_get_width (ep, matrix);
int const rows = value_area_get_height (ep, matrix);
res = g_new (Value, 1);
res->type = VALUE_ARRAY;
res->v.array.x = rows;
res->v.array.y = cols;
res->v.array.vals = g_new (Value **, rows);
for (r = 0; r < rows; ++r){
res->v.array.vals [r] = g_new (Value *, cols);
for (c = 0; c < cols; ++c)
res->v.array.vals[r][c] =
value_duplicate(value_area_get_x_y (ep, matrix, c, r));
}
return res;
}
static char *help_mmult = {
N_("@FUNCTION=MMULT\n"
"@SYNTAX=MMULT(array1,array2)\n"
"@DESCRIPTION="
"SERIESSUM function Returns the matrix product of two arrays. The "
"MMULT function Returns the matrix product of two arrays. The "
"result is an array with the same number of rows as array1 and the "
"same number of columns as array2."
"\n"
"@SEEALSO=SUMPRODUCT")
"@SEEALSO=TRANSPOSE,MINVERSE")
};
......@@ -2401,7 +2440,6 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
if (cols_a != rows_b || !rows_a || !rows_b || !cols_a || !cols_b)
return function_error (ei, gnumeric_err_VALUE);
res = value_array_new (cols_b, rows_a);
res = g_new (Value, 1);
res->type = VALUE_ARRAY;
res->v.array.x = cols_b;
......@@ -2617,4 +2655,5 @@ void math_functions_init()
function_add_args (cat, "trunc", "f|f", "number,digits", &help_trunc, gnumeric_trunc);
function_add_args (cat, "pi", "", "", &help_pi, gnumeric_pi);
function_add_args (cat, "mmult", "AA", "array1,array2", &help_mmult, gnumeric_mmult);
function_add_args (cat, "transpose","A", "array1", &help_transpose, gnumeric_transpose);
}
10/07/99 (rasca)
11/07/99 (rasca)
* merged in miguels changes from gnumeric 0.28
* epsf.c, ps.c: right alignment for text
1999-07-07 Miguel de Icaza <miguel@gnu.org>
10/07/99 (rasca)
* html.c: Split the code in manageable chunks.
* added experimental EPSF support
* html.c: Removed useless pieces of code.
* added PDF support by using groff and ghostscript
* merged in parts of miguels changes from gnumeric 0.28
09/07/99 (rasca)
- export latex2e: added font colors
......@@ -24,6 +26,12 @@
- exporting html: added caption to every table
- exporting latex: fixed a bug which ignoerd empty cells
1999-07-07 Miguel de Icaza <miguel@gnu.org>
* html.c: Split the code in manageable chunks.
* html.c: Removed useless pieces of code.
07/07/99 (rasca)
- added first latex export code
- minor code clean ups
......
......@@ -13,7 +13,7 @@ plugindir = $(libdir)/gnumeric/plugins
plugin_LTLIBRARIES = libhtml.la
libhtml_la_SOURCES = boot.h boot.c html.h html.c latex.h latex.c \
roff.h roff.c font.h font.c
roff.h roff.c font.h font.c epsf.h epsf.c ps.h ps.c
INCLUDES = \
-I$(GNUMERIC_SRC_DIR) \
......
This is a small and simple plugin to export and import HTML files.
It is published under the GNU GPL..
Note: All export functions don't support graphics on the sheet!
Features of the export/import functions:
Features of the export/import HTML functions:
- exporting tables
......@@ -24,13 +25,26 @@ Features of the export/import functions:
created by this plugin!
* while reading the html file the following attributes
are imported:
- bold font setting (does not work since 0.28)
- italic font setting (does not work since 0.28)
- bold font setting
- italic font setting
- horizontal center and right aligment
* the 7bit presentation of "<" and ">" are decoded
There is also an experimental LaTeX mode for exporting tables.
It does not support colors and can not align to the center .. :-(
Features of the export LaTeX functions:
- left and right alignment
- bold, italic and sansserif (only in LaTeX2e)
Features of the export Roff/PS/PDF function:
- PS: you need gnu groff installed
- PDF: you need ghostscript installed
- bold, italic
- left, right and center alignment
Features of the export EPS funtion:
- very experimental
- bold, italic
- left, center and right alignment
- foreground and background colors
Author: rasca (thron@gmx.de)
-
......@@ -26,6 +26,7 @@
#include "latex.h"
#include "roff.h"
#include "file.h"
#include "epsf.h"
/*
* Q: what's that for?
......@@ -50,6 +51,7 @@ html_cleanup_plugin (PluginData *pd)
file_format_unregister_save (html_write_wb_roff_dvi);
file_format_unregister_save (html_write_wb_roff_pdf);
file_format_unregister_save (html_write_wb_roff);
file_format_unregister_save (epsf_write_wb);
file_format_unregister_open (NULL,html_read);
}
......@@ -81,6 +83,9 @@ html_init (void)
file_format_register_save (".me", desc, html_write_wb_roff);
desc = _("PDF file format (via groff/gs)");
file_format_register_save (".pdf", desc, html_write_wb_roff_pdf);
desc = _("EPS file format (*.eps)");
file_format_register_save (".eps", desc, epsf_write_wb);
}
/*
......
......@@ -29,7 +29,7 @@ int html_write_wb_html32 (Workbook *wb, const char *filename);
int html_write_wb_html40 (Workbook *wb, const char *filename);
Workbook *html_read (const char *filename);
#define G_PLUGIN_FOR_HTML "GPFH/0.4"
#define G_PLUGIN_FOR_HTML "GPFH/0.5"
#endif
......@@ -26,6 +26,7 @@ module GNOME {
exception OutOfRange {};
exception ParseError {};
exception InvalidValue {};
exception SplitsArray {};
void cursor_set (in long base_col, in long base_row,
in long start_col, in long start_row,
......@@ -51,20 +52,21 @@ module GNOME {
in long end_row)
raises (OutOfRange);
void selection_copy ();
void selection_cut ();
void selection_cut ()
raises (SplitsArray);
void selection_paste (in long dest_col, in long dest_row,
in long paste_flags)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
//
// Operations on the region
//
void clear_region (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
void clear_region_content (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
void clear_region_comments (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange);
......@@ -77,17 +79,17 @@ module GNOME {
// Cell management
//
void cell_set_value (in long col, in long row, in Value value)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
Value cell_get_value (in long col, in long row)
raises (OutOfRange);
void cell_set_text (in long col, in long row, in string text)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
string cell_get_text (in long col, in long row)
raises (OutOfRange);
void cell_set_formula (in long col, in long row, in string formula)
raises (OutOfRange, ParseError);
raises (OutOfRange, ParseError, SplitsArray);
void cell_set_format (in long col, in long row, in string format)
raises (OutOfRange);
......@@ -148,9 +150,9 @@ module GNOME {
ValueVector range_get_values (in string range)
raises (OutOfRange);
void range_set_text (in string range, in string text)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
void range_set_formula (in string range, in string formula)
raises (OutOfRange);
raises (OutOfRange, SplitsArray);
void range_set_format (in string range, in string format)
raises (OutOfRange);
void range_set_font (in string range, in string font, in short points)
......@@ -174,10 +176,14 @@ module GNOME {
//
// Sheet manipulation
//
void insert_col (in long col, in long count);
void delete_col (in long col, in long count);
void insert_row (in long row, in long count);
void delete_row (in long row, in long count);
void insert_col (in long col, in long count)
raises(SplitsArray);
void delete_col (in long col, in long count)
raises(SplitsArray);
void insert_row (in long row, in long count)
raises(SplitsArray);
void delete_row (in long row, in long count)
raises(SplitsArray);
void shift_rows (in long col,
in long start_row, in long end_row,
in long count);
......
......@@ -33,7 +33,7 @@ dialog_about (Workbook *wb)
N_("Michael Meeks, Excel and OLE2 importing."),
N_("Morten Welinder, Gnumeric hacker."),
N_("Jakub Jelinek, Gnumeric hacker."),
N_("Rasca Gmelch, html, troff exporters."),
N_("Rasca, HTML, troff, LaTeX exporters."),
N_("Sean Atkinson, Functions and X-Base importing."),
N_("Takashi Matsuda, simple text plugin."),
N_("Tom Dyas, Plugin support."),
......
......@@ -503,7 +503,7 @@ cell_set_pattern (Cell *cell, int pattern)
*/
void
cell_set_border (Cell *cell,
StyleBorderType border_type[4],
StyleBorderType const border_type[4],
StyleColor *border_color[4])
{
g_return_if_fail (cell != NULL);
......
......@@ -143,7 +143,7 @@ void cell_set_color_from_style (Cell *cell, StyleColor *foreground,
StyleColor *background);
void cell_set_pattern (Cell *cell, int pattern);
void cell_set_border (Cell *cell,
StyleBorderType border_type [4],
StyleBorderType const border_type [4],
StyleColor *border_color [4]);
void cell_set_alignment (Cell *cell, int halign, int valign,
int orientation, int auto_return);
......
......@@ -33,7 +33,7 @@ dialog_about (Workbook *wb)
N_("Michael Meeks, Excel and OLE2 importing."),
N_("Morten Welinder, Gnumeric hacker."),
N_("Jakub Jelinek, Gnumeric hacker."),
N_("Rasca Gmelch, html, troff exporters."),
N_("Rasca, HTML, troff, LaTeX exporters."),
N_("Sean Atkinson, Functions and X-Base importing."),
N_("Takashi Matsuda, simple text plugin."),
N_("Tom Dyas, Plugin support."),
......
......@@ -926,7 +926,7 @@ value_array_copy_to (Value *v, const Value *src)
}
guint
value_area_get_width (const EvalPosition *ep, Value *v)
value_area_get_width (const EvalPosition *ep, Value const *v)
{
g_return_val_if_fail (v, 0);
g_return_val_if_fail (v->type == VALUE_ARRAY ||
......@@ -946,7 +946,7 @@ value_area_get_width (const EvalPosition *ep, Value *v)
}
guint
value_area_get_height (const EvalPosition *ep, Value *v)
value_area_get_height (const EvalPosition *ep, Value const *v)
{
g_return_val_if_fail (v, 0);
g_return_val_if_fail (v->type == VALUE_ARRAY ||
......
......@@ -326,8 +326,8 @@ void value_dump (const Value *value);
/* Area functions ( works on VALUE_RANGE or VALUE_ARRAY */
/* The EvalPosition provides a Sheet context; this allows
calculation of relative references. 'x','y' give the position */
guint value_area_get_width (const EvalPosition *ep, Value *v);
guint value_area_get_height (const EvalPosition *ep, Value *v);
guint value_area_get_width (const EvalPosition *ep, Value const *v);
guint value_area_get_height (const EvalPosition *ep, Value const *v);
/* Return Value(int 0) if non-existant */
const Value *value_area_fetch_x_y (const EvalPosition *ep, Value const * v,
......
......@@ -2314,16 +2314,55 @@ gnumeric_seriessum (FunctionEvalInfo *ei, GList *nodes)
}
static char *help_transpose = {
N_("@FUNCTION=TRANSPOSE\n"
"@SYNTAX=TRANSPOSE(matrix)\n"
"@DESCRIPTION="
"TRANSPOSE function Returns the transpose of the input"
"matrix.\n"
"@SEEALSO=MMULT")
};
static Value *
gnumeric_transpose (FunctionEvalInfo *ei, Value **argv)
{
EvalPosition const * const ep = &ei->pos;
Value const * const matrix = argv[0];
int r, c;
Value *res;
int const cols = value_area_get_width (ep, matrix);
int const rows = value_area_get_height (ep, matrix);
res = g_new (Value, 1);
res->type = VALUE_ARRAY;
res->v.array.x = rows;
res->v.array.y = cols;
res->v.array.vals = g_new (Value **, rows);
for (r = 0; r < rows; ++r){
res->v.array.vals [r] = g_new (Value *, cols);
for (c = 0; c < cols; ++c)
res->v.array.vals[r][c] =
value_duplicate(value_area_get_x_y (ep, matrix, c, r));
}
return res;
}
static char *help_mmult = {
N_("@FUNCTION=MMULT\n"
"@SYNTAX=MMULT(array1,array2)\n"
"@DESCRIPTION="
"SERIESSUM function Returns the matrix product of two arrays. The "
"MMULT function Returns the matrix product of two arrays. The "
"result is an array with the same number of rows as array1 and the "
"same number of columns as array2."
"\n"
"@SEEALSO=SUMPRODUCT")
"@SEEALSO=TRANSPOSE,MINVERSE")
};
......@@ -2401,7 +2440,6 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
if (cols_a != rows_b || !rows_a || !rows_b || !cols_a || !cols_b)
return function_error (ei, gnumeric_err_VALUE);
res = value_array_new (cols_b, rows_a);
res = g_new (Value, 1);
res->type = VALUE_ARRAY;
res->v.array.x = cols_b;
......@@ -2617,4 +2655,5 @@ void math_functions_init()
function_add_args (cat, "trunc", "f|f", "number,digits", &help_trunc, gnumeric_trunc);
function_add_args (cat, "pi", "", "", &help_pi, gnumeric_pi);
function_add_args (cat, "mmult", "AA", "array1,array2", &help_mmult, gnumeric_mmult);
function_add_args (cat, "transpose","A", "array1", &help_transpose, gnumeric_transpose);
}
......@@ -2314,16 +2314,55 @@ gnumeric_seriessum (FunctionEvalInfo *ei, GList *nodes)
}
static char *help_transpose = {
N_("@FUNCTION=TRANSPOSE\n"
"@SYNTAX=TRANSPOSE(matrix)\n"
"@DESCRIPTION="
"TRANSPOSE function Returns the transpose of the input"
"matrix.\n"
"@SEEALSO=MMULT")
};
static Value *
gnumeric_transpose (FunctionEvalInfo *ei, Value **argv)
{
EvalPosition const * const ep = &ei->pos;
Value const * const matrix = argv[0];
int r, c;
Value *res;
int const cols = value_area_get_width (ep, matrix);
int const rows = value_area_get_height (ep, matrix);
res = g_new (Value, 1);
res->type = VALUE_ARRAY;
res->v.array.x = rows;
res->v.array.y = cols;
res->v.array.vals = g_new (Value **, rows);
for (r = 0; r < rows; ++r){
res->v.array.vals [r] = g_new (Value *, cols);
for (c = 0; c < cols; ++c)
res->v.array.vals[r][c] =
value_duplicate(value_area_get_x_y (ep, matrix, c, r));
}
return res;
}
static char *help_mmult = {
N_("@FUNCTION=MMULT\n"
"@SYNTAX=MMULT(array1,array2)\n"
"@DESCRIPTION="
"SERIESSUM function Returns the matrix product of two arrays. The "
"MMULT function Returns the matrix product of two arrays. The "
"result is an array with the same number of rows as array1 and the "
"same number of columns as array2."
"\n"
"@SEEALSO=SUMPRODUCT")
"@SEEALSO=TRANSPOSE,MINVERSE")
};
......@@ -2401,7 +2440,6 @@ gnumeric_mmult (FunctionEvalInfo *ei, Value **argv)
if (cols_a != rows_b || !rows_a || !rows_b || !cols_a || !cols_b)
return function_error (ei, gnumeric_err_VALUE);
res = value_array_new (cols_b, rows_a);
res = g_new (Value, 1);
res->type = VALUE_ARRAY;
res->v.array.x = cols_b;
......@@ -2617,4 +2655,5 @@ void math_functions_init()
function_add_args (cat, "trunc", "f|f", "number,digits", &help_trunc, gnumeric_trunc);
function_add_args (cat, "pi", "", "", &help_pi, gnumeric_pi);
function_add_args (cat, "mmult", "AA", "array1,array2", &help_mmult, gnumeric_mmult);
function_add_args (cat, "transpose","A", "array1", &help_transpose, gnumeric_transpose);
}
......@@ -25,10 +25,10 @@ launch_guppi (void)
return object_server;
}
GraphicContext *
WizardGraphicContext *
graphic_context_new (Workbook *wb, GladeXML *gui)
{
GraphicContext *gc;
WizardGraphicContext *gc;
GnomeClientSite *client_site;
GnomeContainer *container;
GnomeObjectClient *object_server;
......@@ -63,7 +63,7 @@ graphic_context_new (Workbook *wb, GladeXML *gui)
/*
* Create the graphic context
*/
gc = g_new0 (GraphicContext, 1);
gc = g_new0 (WizardGraphicContext, 1);
gc->workbook = wb;
gc->signature = GC_SIGNATURE;
gc->current_page = 0;
......@@ -78,7 +78,7 @@ graphic_context_new (Workbook *wb, GladeXML *gui)
}
void
graphic_context_destroy (GraphicContext *gc)
graphic_context_destroy (WizardGraphicContext *gc)
{
GList *l;
......@@ -110,7 +110,7 @@ graphic_context_destroy (GraphicContext *gc)
}
void
graphic_context_data_range_add (GraphicContext *gc, DataRange *data_range)
graphic_context_data_range_add (WizardGraphicContext *gc, DataRange *data_range)
{
g_return_if_fail (gc != NULL);
g_return_if_fail (IS_GRAPHIC_CONTEXT (gc));
......@@ -120,7 +120,7 @@ graphic_context_data_range_add (GraphicContext *gc, DataRange *data_range)
}
void
graphic_context_data_range_remove (GraphicContext *gc, const char *range_name)
graphic_context_data_range_remove (WizardGraphicContext *gc, const char *range_name)
{
GList *l;
......@@ -139,7 +139,7 @@ graphic_context_data_range_remove (GraphicContext *gc, const char *range_name)
}
void
graphics_context_data_range_clear (GraphicContext *gc)
graphics_context_data_range_clear (WizardGraphicContext *gc)
{
GList *l;
......@@ -164,9 +164,12 @@ graphics_context_data_range_clear (GraphicContext *gc)
* it guesses the series values using @vertical
*/
void
graphic_context_set_data_range (GraphicContext *gc, const char *data_range_spec, gboolean vertical)
graphic_context_set_data_range (WizardGraphicContext *gc,
const char *data_range_spec,
gboolean vertical)
{
ExprTree *tree;
ExprTree *tree, *args;
gchar * expr;
char *p;
char *error;
......@@ -180,13 +183,13 @@ graphic_context_set_data_range (GraphicContext *gc, const char *data_range_spec,
* parsed arguments.
*/
expr = g_strconcat ("=SELECTION(", data_range_spec, ")", NULL);
tree = expr_parse_string (expr, NULL, 0, 0, 0, &error);
tree = expr_parse_string (expr, NULL, NULL, &error);
g_free (expr);
if (tree == NULL)
return;
assert (tree->oper == OPER_FUNCALL);
g_assert (tree->oper == OPER_FUNCALL);
args = tree->u.function.arg_list;
......
......@@ -46,11 +46,14 @@ typedef struct {
#define GC_SIGNATURE ((('G' << 8) | ('C' << 8)) | 'o')
#define IS_GRAPHIC_CONTEXT(gc) (gc->signature == GC_SIGNATURE)