int col_span;
- struct sheet_detail *sheets;
- int n_allocated_sheets;
};
struct ods_reader
int stop_row;
int stop_col;
+ struct sheet_detail *sheets;
+ int n_allocated_sheets;
struct caseproto *proto;
struct dictionary *dict;
}
-static void process_node (struct foo *r);
+static void process_node (struct ods_reader *or, struct foo *r);
const char *
ods_get_sheet_name (struct spreadsheet *s, int n)
{
- struct foo *or = &((struct ods_reader *) s)->foo;
-
+ struct ods_reader *r = (struct ods_reader *) s;
+ struct foo *or = &r->foo;
+
assert (n < s->n_sheets);
while (
- (or->n_allocated_sheets <= n)
+ (r->n_allocated_sheets <= n)
|| or->state != STATE_SPREADSHEET
)
{
if ( ret != 1)
break;
- process_node (or);
+ process_node (r, or);
}
- return or->sheets[n].name;
+ return r->sheets[n].name;
}
char *
ods_get_sheet_range (struct spreadsheet *s, int n)
{
- struct foo *or = &((struct ods_reader *) s)->foo;
+ struct ods_reader *r = (struct ods_reader *) s;
+ struct foo *or = &r->foo;
assert (n < s->n_sheets);
while (
- (or->n_allocated_sheets <= n)
- || (or->sheets[n].stop_row == -1)
+ (r->n_allocated_sheets <= n)
+ || (r->sheets[n].stop_row == -1)
|| or->state != STATE_SPREADSHEET
)
{
if ( ret != 1)
break;
- process_node (or);
+ process_node (r, or);
}
return create_cell_ref (
- or->sheets[n].start_col,
- or->sheets[n].start_row,
- or->sheets[n].stop_col,
- or->sheets[n].stop_row);
+ r->sheets[n].start_col,
+ r->sheets[n].start_row,
+ r->sheets[n].stop_col,
+ r->sheets[n].stop_row);
}
static void
-process_node (struct foo *r)
+process_node (struct ods_reader *or, struct foo *r)
{
xmlChar *name = xmlTextReaderName (r->xtr);
if (name == NULL)
++r->current_sheet;
- if (r->current_sheet >= r->n_allocated_sheets)
+ if (r->current_sheet >= or->n_allocated_sheets)
{
- assert (r->current_sheet == r->n_allocated_sheets);
- r->sheets = xrealloc (r->sheets, sizeof (*r->sheets) * ++r->n_allocated_sheets);
- r->sheets[r->n_allocated_sheets - 1].start_col = -1;
- r->sheets[r->n_allocated_sheets - 1].stop_col = -1;
- r->sheets[r->n_allocated_sheets - 1].start_row = -1;
- r->sheets[r->n_allocated_sheets - 1].stop_row = -1;
- r->sheets[r->n_allocated_sheets - 1].name = CHAR_CAST (char *, xmlStrdup (r->current_sheet_name));
+ assert (r->current_sheet == or->n_allocated_sheets);
+ or->sheets = xrealloc (or->sheets, sizeof (*or->sheets) * ++or->n_allocated_sheets);
+ or->sheets[or->n_allocated_sheets - 1].start_col = -1;
+ or->sheets[or->n_allocated_sheets - 1].stop_col = -1;
+ or->sheets[or->n_allocated_sheets - 1].start_row = -1;
+ or->sheets[or->n_allocated_sheets - 1].stop_row = -1;
+ or->sheets[or->n_allocated_sheets - 1].name = CHAR_CAST (char *, xmlStrdup (r->current_sheet_name));
}
r->col = 0;
break;
case STATE_CELL_CONTENT:
assert (r->current_sheet >= 0);
- assert (r->current_sheet < r->n_allocated_sheets);
+ assert (r->current_sheet < or->n_allocated_sheets);
- if (r->sheets[r->current_sheet].start_row == -1)
- r->sheets[r->current_sheet].start_row = r->row - 1;
+ if (or->sheets[r->current_sheet].start_row == -1)
+ or->sheets[r->current_sheet].start_row = r->row - 1;
if (
- (r->sheets[r->current_sheet].start_col == -1)
+ (or->sheets[r->current_sheet].start_col == -1)
||
- (r->sheets[r->current_sheet].start_col >= r->col - 1)
+ (or->sheets[r->current_sheet].start_col >= r->col - 1)
)
- r->sheets[r->current_sheet].start_col = r->col - 1;
+ or->sheets[r->current_sheet].start_col = r->col - 1;
- r->sheets[r->current_sheet].stop_row = r->row - 1;
+ or->sheets[r->current_sheet].stop_row = r->row - 1;
- if ( r->sheets[r->current_sheet].stop_col < r->col - 1)
- r->sheets[r->current_sheet].stop_col = r->col - 1;
+ if ( or->sheets[r->current_sheet].stop_col < r->col - 1)
+ or->sheets[r->current_sheet].stop_col = r->col - 1;
if (XML_READER_TYPE_END_ELEMENT == r->node_type)
r->state = STATE_CELL;
}
r->spreadsheet.n_sheets = sheet_count;
- r->foo.n_allocated_sheets = 0;
- r->foo.sheets = NULL;
+ r->n_allocated_sheets = 0;
+ r->sheets = NULL;
ds_destroy (&errs);
if (1 != (ret = xmlTextReaderRead (r->foo.xtr)))
break;
- process_node (&r->foo);
+ process_node (r, &r->foo);
}
if (ret < 1)
{
int idx;
- process_node (&r->foo);
+ process_node (r, &r->foo);
/* If the row is finished then stop for now */
if (r->foo.state == STATE_TABLE && r->foo.row > r->start_row)
while (1 == xmlTextReaderRead (r->foo.xtr))
{
int idx;
- process_node (&r->foo);
+ process_node (r, &r->foo);
if ( ! reading_target_sheet (r) )
break;
/* Read in the first row of data */
while (1 == xmlTextReaderRead (r->foo.xtr))
{
- process_node (&r->foo);
+ process_node (r, &r->foo);
if (r->foo.state == STATE_ROW)
break;
&& 1 == xmlTextReaderRead (r->foo.xtr)
)
{
- process_node (&r->foo);
+ process_node (r, &r->foo);
}
while (1 == xmlTextReaderRead (r->foo.xtr))
{
- process_node (&r->foo);
+ process_node (r, &r->foo);
if ( r->stop_row != -1 && r->foo.row > r->stop_row + 1)
break;