Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gnumeric
Commits
29c06ba6
Commit
29c06ba6
authored
Sep 17, 1999
by
Michael Meeks
Browse files
Frank's summary work,
Fixed summary dialog so Miguel likes it :-)
parent
a985cae2
Changes
12
Hide whitespace changes
Inline
Side-by-side
ChangeLog-2000-02-23
View file @
29c06ba6
1999-09-17 Michael Meeks <michael@nuclecu.unam.mx>
* src/dialogs/dialog-summary.c (dialog_summary_update): Change to
workbook argument, and reparent to toplevel.
* src/dialogs/dialogs.h: ditto.
* src/workbook.c (summary_cmd): ditto.
1999-09-17 Miguel de Icaza <miguel@gnu.org>
* src/widgets/gnumeric-toolbar.c (gnumeric_toolbar_class_init):
...
...
NEWS
View file @
29c06ba6
...
...
@@ -15,7 +15,10 @@ Miguel:
* New format apply buttons for money, percent.
* More commands to format/row/col/sheet
* Bumped row limit to 64k
*
Frank:
* Excel summary info export.
--------------------------------------------------------------------------
Gnumeric 0.33, 0.34, 0.35
...
...
OChangeLog-2000-02-23
View file @
29c06ba6
1999-09-17 Michael Meeks <michael@nuclecu.unam.mx>
* src/dialogs/dialog-summary.c (dialog_summary_update): Change to
workbook argument, and reparent to toplevel.
* src/dialogs/dialogs.h: ditto.
* src/workbook.c (summary_cmd): ditto.
1999-09-17 Miguel de Icaza <miguel@gnu.org>
* src/widgets/gnumeric-toolbar.c (gnumeric_toolbar_class_init):
...
...
plugins/excel/ChangeLog
View file @
29c06ba6
1999-09-15 Frank Chiulli <fchiulli@home.com>
* plugins/excel/boot.c (excel_save): Add a call to ms_summary_write
(ms-summary.c) to write out the SummaryInformation stream.
* plugins/excel/ms-summary.h: Make ms_summary_write public.
* plugins/excel/ms-summary.c (ms_summary_write, sum_name_to_excel,
set_summary_item): New routines to support writing the
SummaryInformation stream.
1999-09-17 Michael Meeks <michael@nuclecu.unam.mx>
* ole.c (main, do_draw, dump_escher): dump raw data.
...
...
plugins/excel/boot.c
View file @
29c06ba6
...
...
@@ -90,6 +90,8 @@ excel_save (Workbook *wb, const char *filename, eBiff_version ver)
ans
=
ms_excel_write_workbook
(
f
,
wb
,
ver
);
ms_summary_write
(
f
,
wb
->
summary_info
);
ms_ole_destroy
(
f
);
if
(
ans
)
printf
(
"Written successfully
\n
"
);
...
...
plugins/excel/libole2/ChangeLog
View file @
29c06ba6
1999-09-17 Michael Meeks <michael@nuclecu.unam.mx>
* ms-ole-summary.c (ms_ole_summary_set_string): Remove verbose
comments; various cleans.
1999-09-15 Frank Chiulli <fchiulli@home.com>
* plugins/excel/libole2/ms-ole-summary.c (write_items): Calculate
offsets correctly - properties must start on a 32-bit (4-byte)
boundary.
(ms_ole_summary_set_string): Strings are null-terminated.
1999-09-08 Michael Meeks <michael@nuclecu.unam.mx>
* ms-ole.c (ms_ole_open, extend_file): Added trap for MAP_FAILED.
...
...
plugins/excel/libole2/ms-ole-summary.c
View file @
29c06ba6
/**
* ms-ole-summary.
h
: MS Office OLE support
* ms-ole-summary.
c
: MS Office OLE support
*
* Author:
* Michael Meeks (michael@imaginator.com)
...
...
@@ -10,6 +10,8 @@
**/
#include
<glib.h>
#include
<stdio.h>
#include
"ms-ole.h"
#include
"ms-ole-summary.h"
...
...
@@ -67,16 +69,26 @@ typedef struct {
guint8
*
data
;
}
write_item_t
;
#define PROPERTY_HDR_LEN 8
#define PROPERTY_DESC_LEN 8
static
void
write_items
(
MsOleSummary
*
si
)
{
MsOlePos
pos
=
48
;
/* magic offset see: _create_stream */
guint32
bytes
=
0
;
guint8
data
[
8
];
MsOlePos
pos
=
48
;
/* magic offset see: _create_stream */
guint8
data
[
PROPERTY_DESC_LEN
];
guint8
fill_data
[]
=
{
0
,
0
,
0
,
0
};
guint32
bytes
=
PROPERTY_HDR_LEN
;
guint32
i
,
num
;
guint32
fill
;
guint32
offset
=
0
;
GList
*
l
;
si
->
s
->
lseek
(
si
->
s
,
pos
+
8
,
MsOleSeekSet
);
/*
* Write out the property descriptors.
* Keep track of the number of properties and number of bytes for the properties.
*/
si
->
s
->
lseek
(
si
->
s
,
pos
+
PROPERTY_HDR_LEN
,
MsOleSeekSet
);
l
=
si
->
write_items
;
num
=
g_list_length
(
l
);
...
...
@@ -84,30 +96,55 @@ write_items (MsOleSummary *si)
while
(
l
)
{
write_item_t
*
w
=
l
->
data
;
g_return_if_fail
(
w
!=
NULL
);
MS_OLE_SET_GUINT32
(
data
+
0
,
w
->
id
&
0xff
);
MS_OLE_SET_GUINT32
(
data
+
4
,
bytes
+
num
*
8
);
si
->
s
->
write
(
si
->
s
,
data
,
8
);
bytes
+=
w
->
len
;
/*
* The offset is calculated from the start of the
* properties header. The offset must be on a
* 4-byte boundary.
*/
offset
=
bytes
+
num
*
PROPERTY_DESC_LEN
;
fill
=
0
;
if
((
offset
&
0x3
)
>
0
)
{
offset
+=
4
-
(
offset
&
0x3
);
fill
=
4
-
(
offset
&
0x3
);
}
MS_OLE_SET_GUINT32
(
data
+
0
,
w
->
id
&
0xff
);
MS_OLE_SET_GUINT32
(
data
+
4
,
offset
);
si
->
s
->
write
(
si
->
s
,
data
,
PROPERTY_DESC_LEN
);
bytes
+=
w
->
len
+
fill
;
i
++
;
l
=
g_list_next
(
l
);
}
g_return_if_fail
(
i
!
=
num
);
g_return_if_fail
(
i
=
=
num
);
/*
* Write out the item descriptors and the section header.
*/
si
->
s
->
lseek
(
si
->
s
,
pos
,
MsOleSeekSet
);
MS_OLE_SET_GUINT32
(
data
+
0
,
bytes
);
MS_OLE_SET_GUINT32
(
data
+
4
,
i
);
si
->
s
->
write
(
si
->
s
,
data
,
8
);
si
->
s
->
write
(
si
->
s
,
data
,
PROPERTY_HDR_LEN
);
si
->
s
->
lseek
(
si
->
s
,
pos
+
8
+
num
*
8
,
MsOleSeekSet
);
/*
* Write out the property values.
*/
si
->
s
->
lseek
(
si
->
s
,
pos
+
PROPERTY_HDR_LEN
+
num
*
PROPERTY_DESC_LEN
,
MsOleSeekSet
);
l
=
si
->
write_items
;
while
(
l
)
{
write_item_t
*
w
=
l
->
data
;
si
->
s
->
write
(
si
->
s
,
w
->
data
,
w
->
len
);
l
=
g_list_next
(
l
);
/*
* Write out any fill.
*/
if
((
w
->
len
&
0x3
)
>
0
)
si
->
s
->
write
(
si
->
s
,
fill_data
,
4
-
(
w
->
len
&
0x3
));
}
}
...
...
@@ -143,7 +180,7 @@ ms_ole_summary_open_stream (MsOleStream *s)
os_version
=
MS_OLE_GET_GUINT32
(
data
+
4
);
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
si
->
class_id
[
i
]
=
data
[
8
+
i
];
sections
=
MS_OLE_GET_GUINT32
(
data
+
24
);
...
...
@@ -157,7 +194,7 @@ ms_ole_summary_open_stream (MsOleStream *s)
for
(
i
=
0
;
i
<
sections
;
i
++
)
{
section_t
sect
;
if
(
!
s
->
read_copy
(
s
,
data
,
16
+
4
))
{
if
(
!
s
->
read_copy
(
s
,
data
,
16
+
4
))
{
ms_ole_summary_close
(
si
);
return
NULL
;
}
...
...
@@ -238,19 +275,39 @@ ms_ole_summary_create_stream (MsOleStream *s)
return
si
;
}
/**
* ms_ole_summary_create
*
* Create a MS SummaryInformation stream.
*
**/
MsOleSummary
*
ms_ole_summary_create
(
MsOle
*
f
)
{
MsOleStream
*
s
;
MsOleDirectory
*
dir
;
MsOleStream
*
s
;
g_return_val_if_fail
(
f
!=
NULL
,
NULL
);
s
=
ms_ole_stream_open_name
(
f
,
"SummaryInformation"
,
'w'
);
if
(
!
s
)
dir
=
ms_ole_directory_create
(
ms_ole_get_root
(
f
),
"SummaryInformation"
,
MsOlePPSStream
);
if
(
!
dir
)
{
printf
(
"ms_ole_summary_create: Can't create stream
\n
"
);
return
NULL
;
}
s
=
ms_ole_stream_open
(
dir
,
'w'
);
if
(
!
s
)
{
printf
(
"ms_ole_summary_create: Can't open stream for writing
\n
"
);
return
NULL
;
}
return
ms_ole_summary_create_stream
(
s
);
}
GArray
*
ms_ole_summary_get_properties
(
MsOleSummary
*
si
)
{
...
...
@@ -584,11 +641,10 @@ ms_ole_summary_set_string (MsOleSummary *si, MsOleSummaryPID id,
g_return_if_fail
(
si
!=
NULL
);
g_return_if_fail
(
str
!=
NULL
);
g_return_if_fail
(
si
->
read_mode
);
g_return_if_fail
(
!
si
->
read_mode
);
w
=
write_item_t_new
(
si
,
id
);
len
=
strlen
(
str
);
len
=
strlen
(
str
)
+
1
;
w
->
len
=
len
+
8
;
w
->
data
=
g_new
(
guint8
,
len
+
8
);
...
...
@@ -597,4 +653,3 @@ ms_ole_summary_set_string (MsOleSummary *si, MsOleSummaryPID id,
memcpy
(
w
->
data
+
8
,
str
,
len
);
}
plugins/excel/ms-summary.c
View file @
29c06ba6
...
...
@@ -13,6 +13,7 @@
#include
"ms-ole-summary.h"
#include
"ms-biff.h"
#include
"ms-summary.h"
#include
"summary.h"
typedef
struct
_MsOleSummaryHeader
MsOleSummaryHeader
;
typedef
struct
_MsOleSummaryRecord
MsOleSummaryRecord
;
...
...
@@ -52,6 +53,40 @@ excel_to_gnumeric (guint32 type)
return SUMMARY_I_MAX;
}*/
/**
* sum_name_to_excel
*
* This function takes as input the name from a SummaryItem record and
* converts it back to an MsOleSummaryPID.
*
**/
MsOleSummaryPID
sum_name_to_excel
(
gchar
*
name
)
{
gint
i
,
j
;
/*
* First find the name in the summary_item_name array.
* The index corresponds to a SummaryItemBuiltin type defined
* in excel_to_gnum_mapping[]. What we want is the corresponding
* MsOleSummaryPID in that same array.
*/
for
(
i
=
0
;
i
<
sizeof
(
summary_item_name
);
i
++
)
{
if
(
g_strcasecmp
(
summary_item_name
[
i
],
name
)
==
0
)
{
for
(
j
=
0
;
j
<
sizeof
(
excel_to_gnum_mapping
)
/
sizeof
(
mapping_t
);
j
++
)
{
if
(
excel_to_gnum_mapping
[
j
].
gnumeric
==
i
)
return
excel_to_gnum_mapping
[
j
].
excel
;
}
g_warning
(
"sum_name_to_excel: gnumeric summary type not found - %d
\n
"
,
i
);
return
(
MsOleSummaryPID
)
-
1
;
}
}
g_warning
(
"sum_name_to_excel: summary name not found - %s
\n
"
,
name
);
return
(
MsOleSummaryPID
)
-
1
;
}
static
void
read_summary_items
(
SummaryInfo
*
sin
,
MsOleSummary
*
si
)
{
...
...
@@ -104,3 +139,70 @@ ms_summary_read (MsOle *f, SummaryInfo *sin)
}
}
void
set_summary_item
(
SummaryItem
*
s_item
,
MsOleSummary
*
ms_sum
)
{
MsOleSummaryPID
pid
;
pid
=
sum_name_to_excel
(
s_item
->
name
);
g_return_if_fail
(
pid
!=
-
1
);
switch
(
s_item
->
type
)
{
case
SUMMARY_STRING
:
ms_ole_summary_set_string
(
ms_sum
,
pid
,
s_item
->
v
.
txt
);
break
;
case
SUMMARY_INT
:
ms_ole_summary_set_long
(
ms_sum
,
pid
,
s_item
->
v
.
i
);
break
;
case
SUMMARY_TIME
:
/* ms_ole_summary_set_time (ms_sum, pid, s_item->v.time); */
break
;
default:
g_warning
(
"Unsupported summary type: %d"
,
s_item
->
type
);
break
;
}
}
void
ms_summary_write
(
MsOle
*
f
,
SummaryInfo
*
sin
)
{
GList
*
si_list
;
MsOleSummary
*
si
;
if
(
f
==
NULL
)
{
g_warning
(
"ms_summary_write: no file to write to.
\n
"
);
return
;
}
if
(
sin
==
NULL
)
{
g_warning
(
"ms_summary_write: no summary information to write.
\n
"
);
return
;
}
si
=
ms_ole_summary_create
(
f
);
if
(
si
==
NULL
)
{
g_warning
(
"ms_summary_write: summary NOT created.
\n
"
);
return
;
}
si_list
=
summary_info_as_list
(
sin
);
if
(
si_list
==
NULL
)
{
g_warning
(
"ms_summary_write: No summary list.
\n
"
);
}
g_list_foreach
(
si_list
,
(
GFunc
)
set_summary_item
,
si
);
ms_ole_summary_close
(
si
);
}
plugins/excel/ms-summary.h
View file @
29c06ba6
...
...
@@ -7,4 +7,6 @@
#include
"summary.h"
extern
void
ms_summary_read
(
MsOle
*
f
,
SummaryInfo
*
sin
);
extern
void
ms_summary_read
(
MsOle
*
f
,
SummaryInfo
*
sin
);
extern
void
ms_summary_write
(
MsOle
*
f
,
SummaryInfo
*
sin
);
src/dialogs/dialog-summary.c
View file @
29c06ba6
...
...
@@ -72,7 +72,7 @@ summary_put (GladeXML *gui, SummaryInfo *sin)
}
void
dialog_summary_update
(
GtkWidget
*
w
,
SummaryInfo
*
sin
)
dialog_summary_update
(
Workbook
*
w
b
,
SummaryInfo
*
sin
)
{
GladeXML
*
gui
=
glade_xml_new
(
GNUMERIC_GLADEDIR
"/summary.glade"
,
NULL
);
GtkWidget
*
dia
;
...
...
@@ -89,6 +89,8 @@ dialog_summary_update (GtkWidget *w, SummaryInfo *sin)
return
;
}
gnome_dialog_set_parent
(
GNOME_DIALOG
(
dia
),
GTK_WINDOW
(
wb
->
toplevel
));
summary_put
(
gui
,
sin
);
v
=
gnome_dialog_run
(
GNOME_DIALOG
(
dia
));
...
...
src/dialogs/dialogs.h
View file @
29c06ba6
...
...
@@ -92,7 +92,7 @@ char *dialog_function_wizard (Workbook *wb, FunctionDefinition *fd);
void
dialog_goal_seek
(
Workbook
*
wb
,
Sheet
*
sheet
);
void
dialog_solver
(
Workbook
*
wb
,
Sheet
*
sheet
);
void
dialog_printer_setup
(
Workbook
*
wb
,
Sheet
*
sheet
);
void
dialog_summary_update
(
GtkWidget
*
w
,
SummaryInfo
*
sin
);
void
dialog_summary_update
(
Workbook
*
w
b
,
SummaryInfo
*
sin
);
void
dialog_data_analysis
(
Workbook
*
wb
,
Sheet
*
sheet
);
char
*
dialog_get_sheet_name
(
Workbook
*
wb
,
const
char
*
name
);
gboolean
dialog_get_number
(
Workbook
*
wb
,
...
...
src/workbook.c
View file @
29c06ba6
...
...
@@ -110,7 +110,7 @@ file_save_as_cmd (GtkWidget *widget, Workbook *wb)
static
void
summary_cmd
(
GtkWidget
*
widget
,
Workbook
*
wb
)
{
dialog_summary_update
(
w
idget
,
wb
->
summary_info
);
dialog_summary_update
(
w
b
,
wb
->
summary_info
);
}
static
void
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment