[gnumeric] Import repeating rows and cols from ODF
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Import repeating rows and cols from ODF
- Date: Wed, 22 Jun 2011 21:40:13 +0000 (UTC)
commit d634b2ce5df1b1f843d15615746ffb7b5b3914c2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Jun 22 15:38:49 2011 -0600
Import repeating rows and cols from ODF
2011-06-22 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (OOParseState): add fields
(oo_table_start): initialize repeating rows/cols fields
(oo_table_end): save repeating rows/cols data
(odf_table_header_rows): new
(odf_table_header_rows_end): new
(odf_table_header_cols): new
(odf_table_header_cols_end): new
(opendoc_content_dtd): connect the last four
NEWS | 2 +-
plugins/openoffice/ChangeLog | 13 +++++++-
plugins/openoffice/openoffice-read.c | 61 ++++++++++++++++++++++++++++++++-
3 files changed, 72 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 66d76cb..f71a06d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@ Gnumeric 1.10.17
Andreas:
* Fix some style import from ODF. [#652492]
- * Import/Export print formatting from/to ODF. [Part of #653186]
+ * Import/Export print formatting from/to ODF. [#653186]
Morten:
* Fix --with-gnome compilation: [#652802]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 66153dc..ce324cf 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,8 +1,19 @@
2011-06-22 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (OOParseState): add fields
+ (oo_table_start): initialize repeating rows/cols fields
+ (oo_table_end): save repeating rows/cols data
+ (odf_table_header_rows): new
+ (odf_table_header_rows_end): new
+ (odf_table_header_cols): new
+ (odf_table_header_cols_end): new
+ (opendoc_content_dtd): connect the last four
+
+2011-06-22 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (OOParseState): group print items into a struct and
change references throughout the file
-
+
2011-06-22 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (opendoc_content_dtd): add more items
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 293696c..87e0752 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -371,6 +371,10 @@ typedef struct {
PrintInformation *cur_pi;
PrintHF *cur_hf;
char **cur_hf_format;
+ int rep_rows_from;
+ int rep_rows_to;
+ int rep_cols_from;
+ int rep_cols_to;
} print;
char const *object_name;
@@ -1728,6 +1732,10 @@ oo_table_start (GsfXMLIn *xin, xmlChar const **attrs)
state->pos.eval.row = 0;
state->extent_data.col = state->extent_style.col = 0;
state->extent_data.row = state->extent_style.row = 0;
+ state->print.rep_rows_from = -1;
+ state->print.rep_rows_to = -1;
+ state->print.rep_cols_from = -1;
+ state->print.rep_cols_to = -1;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_TABLE, "name")) {
@@ -2268,6 +2276,21 @@ oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
max_cols = gnm_sheet_get_max_cols (state->pos.sheet);
max_rows = gnm_sheet_get_max_rows (state->pos.sheet);
+ if (state->print.rep_rows_from >= 0) {
+ if (state->print.rep_rows_to < 0)
+ state->print.rep_rows_to = max_rows - 1;
+ if (state->print.rep_cols_to < 0)
+ state->print.rep_cols_to = max_cols - 1;
+ g_free (state->pos.sheet->print_info->repeat_top);
+ state->pos.sheet->print_info->repeat_top
+ = g_strdup (rows_name (state->print.rep_rows_from,
+ state->print.rep_rows_to));
+ g_free (state->pos.sheet->print_info->repeat_left);
+ state->pos.sheet->print_info->repeat_left
+ = g_strdup (cols_name (state->print.rep_cols_from,
+ state->print.rep_cols_to));
+ }
+
/* default cell styles are applied only to cells that are specified
* which is a performance nightmare. Instead we apply the styles to
* the entire column or row and clear the area beyond the extent here. */
@@ -2461,6 +2484,40 @@ oo_col_start (GsfXMLIn *xin, xmlChar const **attrs)
state->pos.eval.col += repeat_count;
}
+static void
+odf_table_header_rows (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
+{
+ OOParseState *state = (OOParseState *)xin->user_state;
+
+ if (state->print.rep_rows_from < 0)
+ state->print.rep_rows_from = state->pos.eval.row;
+ /* otherwise we are continuing an existing range */
+}
+static void
+odf_table_header_rows_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
+{
+ OOParseState *state = (OOParseState *)xin->user_state;
+
+ state->print.rep_rows_to = state->pos.eval.row - 1;
+}
+
+static void
+odf_table_header_cols (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
+{
+ OOParseState *state = (OOParseState *)xin->user_state;
+
+ if (state->print.rep_cols_from < 0)
+ state->print.rep_cols_from = state->pos.eval.col;
+ /* otherwise we are continuing an existing range */
+}
+static void
+odf_table_header_cols_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
+{
+ OOParseState *state = (OOParseState *)xin->user_state;
+
+ state->print.rep_cols_to = state->pos.eval.col - 1;
+}
+
static int
oo_extent_sheet_rows (Sheet *sheet, int rows)
{
@@ -8927,10 +8984,10 @@ static GsfXMLInNode const opendoc_content_dtd [] =
GSF_XML_IN_NODE (FORM, FORM_GENERIC, OO_NS_FORM, "generic-control", GSF_XML_NO_CONTENT, &odf_form_generic, &odf_form_control_end),
GSF_XML_IN_NODE (FORM_GENERIC, FORM_PROPERTIES, OO_NS_FORM, "properties", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE (TABLE, TABLE_ROWS, OO_NS_TABLE, "table-rows", GSF_XML_NO_CONTENT, NULL, NULL),
- GSF_XML_IN_NODE (TABLE, TABLE_H_ROWS, OO_NS_TABLE, "table-header-rows", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (TABLE, TABLE_H_ROWS, OO_NS_TABLE, "table-header-rows", GSF_XML_NO_CONTENT, &odf_table_header_rows, &odf_table_header_rows_end),
GSF_XML_IN_NODE (TABLE, TABLE_COL, OO_NS_TABLE, "table-column", GSF_XML_NO_CONTENT, &oo_col_start, NULL),
GSF_XML_IN_NODE (TABLE, TABLE_COLS, OO_NS_TABLE, "table-columns", GSF_XML_NO_CONTENT, NULL, NULL),
- GSF_XML_IN_NODE (TABLE, TABLE_H_COLS, OO_NS_TABLE, "table-header-columns", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (TABLE, TABLE_H_COLS, OO_NS_TABLE, "table-header-columns", GSF_XML_NO_CONTENT, &odf_table_header_cols, &odf_table_header_cols_end),
GSF_XML_IN_NODE (TABLE_H_COLS, TABLE_COL, OO_NS_TABLE, "table-column", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE_COLS, TABLE_COL, OO_NS_TABLE, "table-column", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE, TABLE_ROW, OO_NS_TABLE, "table-row", GSF_XML_NO_CONTENT, &oo_row_start, &oo_row_end),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]