Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gnumeric
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
375
Issues
375
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gnumeric
Commits
5a51687e
Commit
5a51687e
authored
Sep 20, 1999
by
Jody Goldberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement rudimentary object handling in the escher code.
Enable buttons, and checkboxes. Placement is a bit off.
parent
81cbeb1e
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
640 additions
and
406 deletions
+640
-406
ChangeLog-2000-02-23
ChangeLog-2000-02-23
+20
-1
OChangeLog-2000-02-23
OChangeLog-2000-02-23
+20
-1
plugins/excel/ChangeLog
plugins/excel/ChangeLog
+16
-1
plugins/excel/ms-chart.c
plugins/excel/ms-chart.c
+1
-1
plugins/excel/ms-chart.h
plugins/excel/ms-chart.h
+1
-1
plugins/excel/ms-escher.c
plugins/excel/ms-escher.c
+200
-243
plugins/excel/ms-escher.h
plugins/excel/ms-escher.h
+11
-0
plugins/excel/ms-excel-read.c
plugins/excel/ms-excel-read.c
+33
-23
plugins/excel/ms-excel-read.h
plugins/excel/ms-excel-read.h
+3
-1
plugins/excel/ms-formula-read.c
plugins/excel/ms-formula-read.c
+11
-5
plugins/excel/ms-obj.c
plugins/excel/ms-obj.c
+235
-111
plugins/excel/ms-obj.h
plugins/excel/ms-obj.h
+35
-1
plugins/excel/ms-summary.c
plugins/excel/ms-summary.c
+1
-1
plugins/html/epsf.c
plugins/html/epsf.c
+2
-2
src/sheet-object-container.h
src/sheet-object-container.h
+1
-0
src/sheet-object-graphic.c
src/sheet-object-graphic.c
+2
-2
src/sheet-object.c
src/sheet-object.c
+26
-2
src/sheet-object.h
src/sheet-object.h
+13
-2
src/value.c
src/value.c
+3
-2
src/xml-io.c
src/xml-io.c
+6
-6
No files found.
ChangeLog-2000-02-23
View file @
5a51687e
1999-09-19 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_release) : Releasing value_terminate should not
generate an error.
* src/sheet-object-container.h : Add include
<bonobo/gnome-client-site.h>.
1999-09-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.h : Make SheetObjectType names
constistant with SheetModeType names, and add
GRAPHIC, BUTTON, and CHECKBOX.
* plugins/html/epsf.c (epsf_write_wb) : RECTANGLE -> BOX.
ELLIPSE -> OVAL.
* src/sheet-object.c (create_object) : Ditto.
* src/xml-io.c (xml_read_sheet_object) : Ditto.
1999-09-18 Miguel de Icaza <miguel@gnu.org>
* src/dialogs/dialog-simple-input.c (dialog_get_sheet_name): use
...
...
@@ -16,7 +35,7 @@
terminate.
* src/workbook-cmd-format.c (do_apply_style_to_selection): set
she
t
t dirty.
she
e
t dirty.
(workbook_cmd_format_column_auto_fit): ditto.
(workbook_cmd_format_column_width): ditto.
(workbook_cmd_format_row_auto_fit): ditto.
...
...
OChangeLog-2000-02-23
View file @
5a51687e
1999-09-19 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_release) : Releasing value_terminate should not
generate an error.
* src/sheet-object-container.h : Add include
<bonobo/gnome-client-site.h>.
1999-09-18 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.h : Make SheetObjectType names
constistant with SheetModeType names, and add
GRAPHIC, BUTTON, and CHECKBOX.
* plugins/html/epsf.c (epsf_write_wb) : RECTANGLE -> BOX.
ELLIPSE -> OVAL.
* src/sheet-object.c (create_object) : Ditto.
* src/xml-io.c (xml_read_sheet_object) : Ditto.
1999-09-18 Miguel de Icaza <miguel@gnu.org>
* src/dialogs/dialog-simple-input.c (dialog_get_sheet_name): use
...
...
@@ -16,7 +35,7 @@
terminate.
* src/workbook-cmd-format.c (do_apply_style_to_selection): set
she
t
t dirty.
she
e
t dirty.
(workbook_cmd_format_column_auto_fit): ditto.
(workbook_cmd_format_column_width): ditto.
(workbook_cmd_format_row_auto_fit): ditto.
...
...
plugins/excel/ChangeLog
View file @
5a51687e
1999-09-19 Jody Goldberg <jgoldberg@home.com>
* ms-summary.c (set_summary_item) : Made static.
* ms-obj.c (ms_obj_realize) : New function.
(ms_parse_object_anchor) : Ditto.
* ms-excel-read.c (ms_excel_read_workbook) : Use
ms_obj_realize.
(ms_excel_read_sheet) : Ditto.
(ms_excel_read_formula) : Make reading a string more
robust, and support length = 0 as a valid string.
1999-09-19 Michael Meeks <michael@nuclecu.unam.mx>
* Makefile.am: comment out ole.
...
...
@@ -30,8 +43,10 @@
* ms-escher.c : More radical changes to support just in time
merging. This seems to solve the last of the problems of which
records to merge and which not. Everything seems to add up.
(ms_escher_parse) : Enable by default.
* ms-escher.c (ms_escher_parse) : Enable by default.
* ms-excel-read.c (ms_excel_workbook_destroy) : Release blips on
exit.
1999-09-17 Jody Goldberg <jgoldberg@home.com>
...
...
plugins/excel/ms-chart.c
View file @
5a51687e
...
...
@@ -2015,7 +2015,7 @@ ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb, BIFF_BOF_DATA *bof)
}
void
ms_excel_read_chart
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
,
int
obj_id
)
ms_excel_read_chart
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
)
{
BIFF_BOF_DATA
*
bof
;
...
...
plugins/excel/ms-chart.h
View file @
5a51687e
...
...
@@ -15,7 +15,7 @@ extern void ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb,
BIFF_BOF_DATA
*
bof
);
/* A wrapper which reads and checks the BOF record then calls ms_excel_chart */
extern
void
ms_excel_read_chart
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
,
int
id
);
extern
void
ms_excel_read_chart
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
);
extern
void
ms_excel_biff_dimensions
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
);
...
...
plugins/excel/ms-escher.c
View file @
5a51687e
This diff is collapsed.
Click to expand it.
plugins/excel/ms-escher.h
View file @
5a51687e
...
...
@@ -9,8 +9,19 @@
**/
#include "ms-excel-read.h"
typedef
struct
{
char
const
*
reproid
;
#ifdef ENABLE_BONOBO
GnomeStream
*
stream
;
#else
guint8
*
raw_data
;
#endif
}
EscherBlip
;
extern
void
ms_escher_parse
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
,
ExcelSheet
*
sheet
);
extern
void
ms_escher_blip_destroy
(
EscherBlip
*
blip
);
#endif
/* GNUMERIC_MS_OFFICE_ESCHER_H */
plugins/excel/ms-excel-read.c
View file @
5a51687e
...
...
@@ -1592,18 +1592,22 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
if
(
is_string
)
{
guint16
code
;
if
(
ms_biff_query_peek_next
(
q
,
&
code
)
&&
code
==
BIFF_STRING
)
{
char
*
v
;
ms_biff_query_next
(
q
);
/*
* NOTE : the Excel developers kit docs are
* WRONG. There is an article that
* clarifies the behaviour to be the std
* unicode format rather than the pure
* length version the docs describe.
*/
v
=
biff_get_text
(
q
->
data
+
2
,
MS_OLE_GET_GUINT16
(
q
->
data
),
NULL
);
char
*
v
=
NULL
;
if
(
ms_biff_query_next
(
q
))
{
/*
* NOTE : the Excel developers kit docs are
* WRONG. There is an article that
* clarifies the behaviour to be the std
* unicode format rather than the pure
* length version the docs describe.
*/
guint16
const
len
=
MS_OLE_GET_GUINT16
(
q
->
data
);
if
(
len
>
0
)
v
=
biff_get_text
(
q
->
data
+
2
,
len
,
NULL
);
else
v
=
g_strdup
(
""
);
/* Pre-Biff8 seems to use len=0 */
}
if
(
v
)
{
val
=
value_new_string
(
v
);
g_free
(
v
);
...
...
@@ -1739,12 +1743,12 @@ ms_excel_workbook_new (eBiff_version ver)
ans
->
excel_sheets
=
g_ptr_array_new
();
ans
->
XF_cell_records
=
g_ptr_array_new
();
ans
->
name_data
=
g_ptr_array_new
();
ans
->
charts
=
NULL
;
/* Init if/when its needed */
ans
->
blips
=
g_ptr_array_new
();
ans
->
charts
=
g_ptr_array_new
();
ans
->
format_data
=
g_hash_table_new
((
GHashFunc
)
biff_guint16_hash
,
(
GCompareFunc
)
biff_guint16_equal
);
ans
->
palette
=
ms_excel_default_palette
();
ans
->
ver
=
ver
;
ans
->
eschers
=
NULL
;
ans
->
global_strings
=
NULL
;
ans
->
global_string_max
=
0
;
ans
->
read_drawing_group
=
0
;
...
...
@@ -1809,13 +1813,15 @@ ms_excel_workbook_destroy (ExcelWorkbook *wb)
biff_name_data_destroy
(
g_ptr_array_index
(
wb
->
name_data
,
lp
));
g_ptr_array_free
(
wb
->
name_data
,
TRUE
);
if
(
wb
->
charts
!=
NULL
)
{
for
(
lp
=
0
;
lp
<
wb
->
charts
->
len
;
lp
++
)
gnumeric_chart_destroy
(
g_ptr_array_index
(
wb
->
charts
,
lp
));
g_ptr_array_free
(
wb
->
charts
,
TRUE
);
wb
->
charts
=
NULL
;
}
for
(
lp
=
0
;
lp
<
wb
->
blips
->
len
;
lp
++
)
ms_escher_blip_destroy
(
g_ptr_array_index
(
wb
->
blips
,
lp
));
g_ptr_array_free
(
wb
->
blips
,
TRUE
);
wb
->
blips
=
NULL
;
for
(
lp
=
0
;
lp
<
wb
->
charts
->
len
;
lp
++
)
gnumeric_chart_destroy
(
g_ptr_array_index
(
wb
->
charts
,
lp
));
g_ptr_array_free
(
wb
->
charts
,
TRUE
);
wb
->
charts
=
NULL
;
g_hash_table_foreach_remove
(
wb
->
font_data
,
(
GHRFunc
)
biff_font_data_destroy
,
...
...
@@ -2424,7 +2430,8 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
break
;
case
BIFF_OBJ
:
/* See: ms-obj.c and S59DAD.HTM */
ms_read_OBJ
(
q
,
wb
);
ms_obj_realize
(
ms_read_OBJ
(
q
,
wb
,
sheet
->
gnum_sheet
),
wb
,
sheet
);
break
;
case
BIFF_SELECTION
:
...
...
@@ -3179,7 +3186,10 @@ ms_excel_read_workbook (Workbook *workbook, MsOle *file)
break
;
case
BIFF_OBJ
:
/* See: ms-obj.c and S59DAD.HTM */
ms_read_OBJ
(
q
,
wb
);
/* FIXME : What does it mean to have an object
* outside a sheet ???? */
ms_obj_realize
(
ms_read_OBJ
(
q
,
wb
,
NULL
),
wb
,
NULL
);
break
;
case
BIFF_SCL
:
...
...
plugins/excel/ms-excel-read.h
View file @
5a51687e
...
...
@@ -94,7 +94,9 @@ typedef struct _ExcelWorkbook
char
**
global_strings
;
int
global_string_max
;
eBiff_version
ver
;
GList
*
eschers
;
/* Indexed in the order they are read */
GPtrArray
*
blips
;
GPtrArray
*
charts
;
/**
...
...
plugins/excel/ms-formula-read.c
View file @
5a51687e
...
...
@@ -679,10 +679,17 @@ make_function (ParseList **stack, int fn_idx, int numargs)
/* FIXME FIXME FIXME : How to handle missing trailing args ?? */
ParseList
*
args
=
parse_list_last_n
(
stack
,
numargs
-
1
);
ExprTree
*
tmp
=
parse_list_pop
(
stack
)
;
char
const
*
f_name
;
if
(
!
tmp
||
tmp
->
oper
!=
OPER_CONSTANT
||
tmp
->
u
.
constant
->
type
!=
VALUE_STRING
)
{
char
const
*
f_name
=
NULL
;
if
(
tmp
!=
NULL
)
{
if
(
tmp
->
oper
==
OPER_CONSTANT
&&
tmp
->
u
.
constant
->
type
==
VALUE_STRING
)
f_name
=
tmp
->
u
.
constant
->
v
.
str
->
str
;
else
if
(
tmp
->
oper
==
OPER_NAME
)
f_name
=
tmp
->
u
.
name
->
name
->
str
;
}
if
(
f_name
==
NULL
)
{
if
(
tmp
)
expr_tree_unref
(
tmp
);
parse_list_free
(
&
args
);
parse_list_push_raw
(
stack
,
...
...
@@ -691,7 +698,6 @@ make_function (ParseList **stack, int fn_idx, int numargs)
printf
(
"So much for that theory.
\n
"
);
return
FALSE
;
}
f_name
=
tmp
->
u
.
constant
->
v
.
str
->
str
;
name
=
symbol_lookup
(
global_symbol_table
,
f_name
);
if
(
!
name
)
...
...
plugins/excel/ms-obj.c
View file @
5a51687e
...
...
@@ -33,41 +33,108 @@ extern int ms_excel_read_debug;
#define GR_CHECKBOX_FORMULA 0x14
#define GR_COMMON_OBJ_DATA 0x15
static
char
*
object_type_names
[]
=
/*
* Attempt to install ab object in supplied work book.
* NOTE : The MSObj is freed by this routine
*/
gboolean
ms_obj_realize
(
MSObj
*
obj
,
ExcelWorkbook
*
wb
,
ExcelSheet
*
sheet
)
{
"Group"
,
/* 0x00 */
"Line"
,
/* 0x01 */
"Rectangle"
,
/* 0x02 */
"Oval"
,
/* 0x03 */
"Arc"
,
/* 0x04 */
"Chart"
,
/* 0x05 */
"TextBox"
,
/* 0x06 */
"Button"
,
/* 0x07 */
"Picture"
,
/* 0x08 */
"Polygon"
,
/* 0x09 */
NULL
,
/* 0x0A */
"CheckBox"
,
/* 0x0B */
"Option"
,
/* 0x0C */
"Edit"
,
/* 0x0D */
"Label"
,
/* 0x0E */
"Dialog"
,
/* 0x0F */
"Spinner"
,
/* 0x10 */
"Scroll"
,
/* 0x11 */
"List"
,
/* 0x12 */
"Group"
,
/* 0x13 */
"Combo"
,
/* 0x14 */
NULL
,
/* 0x15 */
NULL
,
/* 0x16 */
NULL
,
/* 0x17 */
NULL
,
/* 0x18 */
"Comment"
,
/* 0x19 */
NULL
,
/* 0x1A */
NULL
,
/* 0x1B */
NULL
,
/* 0x1C */
NULL
,
/* 0x1D */
"MS Drawing"
/* 0x1E */
};
int
*
anchor
=
NULL
;
if
(
obj
==
NULL
)
return
TRUE
;
anchor
=
obj
->
anchor
;
switch
(
obj
->
gnumeric_type
)
{
case
SHEET_OBJECT_BUTTON
:
sheet_object_create_button
(
sheet
->
gnum_sheet
,
anchor
[
0
],
anchor
[
1
],
anchor
[
2
],
anchor
[
3
]);
break
;
case
SHEET_OBJECT_CHECKBOX
:
sheet_object_create_checkbox
(
sheet
->
gnum_sheet
,
anchor
[
0
],
anchor
[
1
],
anchor
[
2
],
anchor
[
3
]);
break
;
case
SHEET_OBJECT_GRAPHIC
:
/* If this was a picture */
{
int
blip_id
;
GPtrArray
const
*
blips
=
wb
->
blips
;
EscherBlip
*
blip
=
NULL
;
#ifdef ENABLE_BONOBO
SheetObject
*
so
;
#endif
blip_id
=
obj
->
v
.
picture
.
blip_id
;
g_return_val_if_fail
(
blip_id
>=
0
,
FALSE
);
g_return_val_if_fail
(
blip_id
<
blips
->
len
,
FALSE
);
blip
=
g_ptr_array_index
(
blips
,
blip_id
);
g_return_val_if_fail
(
blip
!=
NULL
,
FALSE
);
#ifdef ENABLE_BONOBO
g_return_val_if_fail
(
blip
->
stream
!=
NULL
,
FALSE
);
g_return_val_if_fail
(
blip
->
reproid
!=
NULL
,
FALSE
);
so
=
sheet_object_container_new
(
sheet
->
gnum_sheet
,
anchor
[
0
],
anchor
[
1
],
anchor
[
2
],
anchor
[
3
],
blip
->
reproid
);
if
(
!
sheet_object_container_load
(
so
,
blip
->
stream
,
TRUE
))
g_warning
(
"Failed to load '%s' from stream"
,
blip
->
reproid
);
#endif
}
break
;
default
:
break
;
};
g_free
(
obj
);
return
FALSE
;
}
gboolean
ms_parse_object_anchor
(
int
anchor
[
4
],
Sheet
const
*
sheet
,
guint8
const
*
data
)
{
/* Words 0, 4, 8, 12 : The row/col of the corners */
/* Words 2, 6, 10, 14 : distance from cell edge measured in 1/1024 of an inch */
float
zoom
;
int
i
;
/* FIXME : How to handle objects not in sheets ?? */
g_return_val_if_fail
(
sheet
!=
NULL
,
TRUE
);
zoom
=
sheet
->
last_zoom_factor_used
;
for
(
i
=
0
;
i
<
4
;
++
i
)
{
guint16
const
pos
=
MS_OLE_GET_GUINT16
(
data
+
4
*
i
);
float
margin
=
(
MS_OLE_GET_GUINT16
(
data
+
4
*
i
+
2
)
/
(
1024
.
/
72
.));
/* FIXME : we are slightly off. What about margins ? */
float
const
tmp
=
(
i
&
1
)
/* odds are rows */
?
sheet_row_get_unit_distance
(
sheet
,
0
,
pos
)
:
sheet_col_get_unit_distance
(
sheet
,
0
,
pos
);
margin
+=
tmp
;
margin
*=
zoom
;
anchor
[
i
]
=
(
int
)
margin
;
}
#ifndef NO_DEBUG_EXCEL
if
(
ms_excel_read_debug
>
0
)
printf
(
"In pixels left = %d, top = %d, right = %d, bottom =d %d;
\n
"
,
anchor
[
0
],
anchor
[
1
],
anchor
[
2
],
anchor
[
3
]);
#endif
return
FALSE
;
}
void
ms_read_TXO
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
)
...
...
@@ -157,63 +224,31 @@ ms_obj_dump (guint8 const * const data, int const len, char const * const name)
printf
(
"}; /* %s */
\n
"
,
name
);
}
static
void
ms_obj_read_pre_biff8_obj
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
)
static
gboolean
ms_obj_read_pre_biff8_obj
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
,
Sheet
*
sheet
,
MSObj
*
obj
)
{
static
char
const
*
const
obj_types
[]
=
{
"Group"
,
"Line"
,
"Rectangle"
,
"Oval"
,
"Arc"
,
"Chart"
,
"Text"
,
"Button"
,
"Picture"
,
"Polygon"
,
"Checkbox"
,
"OptionButton"
,
"Edit box"
,
"Label"
,
"Dialog frame"
,
"Spinner"
,
"Listbox"
,
"Group box"
,
"Dropdown"
};
/* TODO : Lots of docs for these things. Write the parser. */
#if 0
guint32 const numObjects = MS_OLE_GET_GUINT
32
(q->data);
guint16 const flags = MS_OLE_GET_GUINT
32
(q->data+8);
guint32 const numObjects = MS_OLE_GET_GUINT
16
(q->data);
guint16 const flags = MS_OLE_GET_GUINT
16
(q->data+8);
#endif
guint16
tmp
=
MS_OLE_GET_GUINT32
(
q
->
data
+
4
);
guint16
const
obj_id
=
MS_OLE_GET_GUINT32
(
q
->
data
+
6
);
guint16
const
left_col
=
MS_OLE_GET_GUINT32
(
q
->
data
+
10
);
guint16
const
top_row
=
MS_OLE_GET_GUINT32
(
q
->
data
+
14
);
guint16
const
right_col
=
MS_OLE_GET_GUINT32
(
q
->
data
+
18
);
guint16
const
bottom_row
=
MS_OLE_GET_GUINT32
(
q
->
data
+
22
);
/* As 1/1024 of cell width */
guint16
const
left_offset
=
MS_OLE_GET_GUINT32
(
q
->
data
+
12
);
guint16
const
top_offset
=
MS_OLE_GET_GUINT32
(
q
->
data
+
16
);
guint16
const
right_offset
=
MS_OLE_GET_GUINT32
(
q
->
data
+
20
);
guint16
const
bottom_offset
=
MS_OLE_GET_GUINT32
(
q
->
data
+
24
);
if
(
tmp
>=
(
sizeof
(
obj_types
)
/
sizeof
(
char
const
*
const
)))
{
printf
(
"EXCEL : invalid object type %d
\n
"
,
tmp
);
return
;
}
obj
->
excel_type
=
MS_OLE_GET_GUINT16
(
q
->
data
+
4
);
obj
->
id
=
MS_OLE_GET_GUINT32
(
q
->
data
+
6
);
if
(
ms_excel_read_debug
>
0
)
{
printf
(
"EXCEL : Found %s @ (%s%d + %f %%, %f %%):(%s%d + %f %%, %f %%)
\n
"
,
obj_types
[
tmp
],
col_name
(
left_col
),
top_row
+
1
,
left_offset
/
1024
.,
top_offset
/
1024
.,
col_name
(
right_col
),
bottom_row
+
1
,
right_offset
/
1024
.,
bottom_offset
/
1024
.);
}
if
(
tmp
==
0x5
)
ms_excel_read_chart
(
q
,
wb
,
obj_id
);
return
ms_parse_object_anchor
(
obj
->
anchor
,
sheet
,
q
->
data
+
10
);
}
static
void
ms_obj_read_biff8_obj
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
)
static
gboolean
ms_obj_read_biff8_obj
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
,
Sheet
*
sheet
,
MSObj
*
obj
)
{
guint8
*
data
;
gint32
data_len_left
;
int
obj_type
=
-
1
;
/* Set to undefined */
int
obj_id
=
-
1
;
gboolean
hit_end
=
FALSE
;
g_return_
if_fail
(
q
);
g_return_
if_fail
(
q
->
ls_op
==
BIFF_OBJ
);
g_return_
val_if_fail
(
q
,
TRUE
);
g_return_
val_if_fail
(
q
->
ls_op
==
BIFF_OBJ
,
TRUE
);
data
=
q
->
data
;
data_len_left
=
q
->
length
;
...
...
@@ -226,12 +261,13 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
guint16
const
len
=
MS_OLE_GET_GUINT16
(
data
+
2
);
/* 1st record must be COMMON_OBJ*/
g_return_if_fail
(
obj_type
>=
0
||
record_type
==
GR_COMMON_OBJ_DATA
);
g_return_val_if_fail
(
obj
->
excel_type
>=
0
||
record_type
==
GR_COMMON_OBJ_DATA
,
TRUE
);
switch
(
record_type
)
{
case
GR_END
:
g_return_
if_fail
(
len
==
0
);
g_return_
val_if_fail
(
len
==
0
,
TRUE
);
hit_end
=
TRUE
;
break
;
...
...
@@ -311,33 +347,26 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
case
GR_COMMON_OBJ_DATA
:
{
char
const
*
type_name
=
NULL
;
guint16
const
options
=
MS_OLE_GET_GUINT16
(
data
+
8
);
/* Multiple objects in 1 record ?? */
g_return_
if_fail
(
obj_type
==
-
1
);
g_return_
val_if_fail
(
obj
->
excel_type
==
-
1
,
-
1
);
obj_type
=
MS_OLE_GET_GUINT16
(
data
+
4
);
obj_id
=
MS_OLE_GET_GUINT16
(
data
+
6
);
if
(
obj_type
<
sizeof
(
object_type_names
)
/
sizeof
(
char
*
))
type_name
=
object_type_names
[
obj_type
];
else
type_name
=
"Unknown"
;
obj
->
excel_type
=
MS_OLE_GET_GUINT16
(
data
+
4
);
obj
->
id
=
MS_OLE_GET_GUINT16
(
data
+
6
);
/* only print when debug is enabled */
if
(
ms_excel_read_debug
==
0
)
break
;
printf
(
"
\n\n
Object (%d) is a '%s'
\n
"
,
obj_id
,
type_name
);
if
(
options
&
0x0001
)
printf
(
"
The %s is Locked
\n
"
,
type_name
);
printf
(
"
Locked;
\n
"
);
if
(
options
&
0x0010
)
printf
(
"
The %s is Printable
\n
"
,
type_name
);
printf
(
"
Printable;
\n
"
);
if
(
options
&
0x2000
)
printf
(
"
The %s is AutoFilled
\n
"
,
type_name
);
printf
(
"
AutoFilled;
\n
"
);
if
(
options
&
0x4000
)
printf
(
"
The %s has AutoLines
\n
"
,
type_name
);
printf
(
"
AutoLines;
\n
"
);
if
((
options
&
0x9fee
)
!=
0
)
printf
(
"WARNING : Why is option not 0 (%x)
\n
"
,
...
...
@@ -346,7 +375,7 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
break
;
default:
printf
(
"
Unknown Obj record 0x%x len 0x%x dll %d
\n
"
,
printf
(
"
ERROR : Unknown Obj record 0x%x len 0x%x dll %d;
\n
"
,
record_type
,
len
,
data_len_left
);
}
data
+=
len
+
4
,
...
...
@@ -354,21 +383,116 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
}
/* The ftEnd record should have been the last */
g_return_
if_fail
(
data_len_left
==
0
);
g_return_
val_if_fail
(
data_len_left
==
0
,
TRUE
);
/* If this was a Chart then there should be a BOF next */
if
(
obj_type
==
0x05
)
ms_excel_read_chart
(
q
,
wb
,
obj_id
);
if
(
ms_excel_read_debug
>
0
)
printf
(
"
\n\n
"
);
return
FALSE
;
}
void
ms_read_OBJ
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
)
MSObj
*
ms_read_OBJ
(
BiffQuery
*
q
,
ExcelWorkbook
*
wb
,
Sheet
*
sheet
)
{
if
(
wb
->
ver
>=
eBiffV8
)
ms_obj_read_biff8_obj
(
q
,
wb
);
else
ms_obj_read_pre_biff8_obj
(
q
,
wb
);
static
char
*
object_type_names
[]
=
{
"Group"
,
/* 0x00 */
"Line"
,
/* 0x01 */
"Rectangle"
,
/* 0x02 */
"Oval"
,
/* 0x03 */
"Arc"
,
/* 0x04 */
"Chart"
,
/* 0x05 */
"TextBox"
,
/* 0x06 */
"Button"
,
/* 0x07 */
"Picture"
,
/* 0x08 */
"Polygon"
,
/* 0x09 */
NULL
,
/* 0x0A */
"CheckBox"
,
/* 0x0B */
"Option"
,
/* 0x0C */
"Edit"
,
/* 0x0D */
"Label"
,
/* 0x0E */
"Dialog"
,
/* 0x0F */
"Spinner"
,
/* 0x10 */
"Scroll"
,
/* 0x11 */
"List"
,
/* 0x12 */
"Group"
,
/* 0x13 */
"Combo"
,
/* 0x14 */
NULL
,
NULL
,
NULL
,
NULL
,
/* 0x15 - 0x18 */
"Comment"
,
/* 0x19 */
NULL
,
NULL
,
NULL
,
NULL
,
/* 0x1A - 0x1D */
"MS Drawing"
/* 0x1E */
};
gboolean
errors
;
SheetObjectType
type
;
MSObj
*
obj
=
g_new
(
MSObj
,
1
);
obj
->
excel_type
=
(
unsigned
)
-
1
;
/* Set to undefined */
obj
->
id
=
-
1
;
obj
->
anchor_set
=
FALSE
;
errors
=
(
wb
->
ver
>=
eBiffV8
)