Commit 777d750e authored by Michael Meeks's avatar Michael Meeks Committed by Michael Meeks
Browse files

Depend on a separate libole2;

2000-05-11  Michael Meeks  <michael@helixcode.com>

	* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.

2000-05-10  Michael Meeks  <michael@helixcode.com>

	* configure.in: Add check for libole2 and add to gnome-config.
parent 8ac83b5c
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* src/Makefile.am (gnumeric_libs): kill libole2 libs kludge.
2000-05-10 Michael Meeks <michael@helixcode.com>
* configure.in: Add check for libole2 and add to gnome-config.
2000-05-10 Karl Eichwalder <ke@suse.de>
* Makefile.am: Typo.
......
......@@ -238,10 +238,7 @@ AC_SUBST(gnumeric_plugindir)
AC_SUBST(gnumeric_gladedir)
AC_SUBST(gnumeric_bonobo_enabled)
dnl ******************************
dnl Kludge for Libole2 virtual link.
dnl ******************************
AM_CONDITIONAL(LIBOLE2_PUBLIC_LIBRARY, false)
AM_PATH_LIBOLE2(0.1.3,, [AC_MSG_ERROR(Can't find libole2 >= 0.1.3)])
dnl ******************************
dnl Check for GB
......@@ -366,8 +363,8 @@ LIBS=$LIBS_save
dnl ***************************************
EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui print libglade $bonobo`
EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui print libglade $bonobo`
EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui print libglade $bonobo libole2`
EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui print libglade $bonobo libole2`
AC_SUBST(EXTRA_GNOME_LIBS)
AC_SUBST(EXTRA_GNOME_CFLAGS)
......@@ -400,7 +397,6 @@ plugins/numtheory/Makefile
plugins/sc/Makefile
plugins/sylk/Makefile
plugins/excel/Makefile
plugins/excel/libole2/Makefile
plugins/gb/Makefile
plugins/lotus-123/Makefile
plugins/oleo/Makefile
......
2000-05-11 Michael Meeks <michael@helixcode.com>
* *.[ch]: update libole2 includes.
* Makefile.am (INCLUDES): kill libole2 kludge.
2000-05-09 Jody Goldberg <jgoldberg@home.com>
* Release 0.53
......
......@@ -2,7 +2,6 @@ INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
-I$(top_srcdir)/src \
-I$(srcdir)/libole2 \
$(GNOME_INCLUDEDIR)
noinst_LIBRARIES = libexcel.a
......@@ -38,5 +37,3 @@ libexcel_a_SOURCES = \
ms-chart.c \
ms-summary.c \
ms-summary.h
SUBDIRS = libole2
......@@ -9,7 +9,7 @@
#ifndef GNUMERIC_EXCEL_H
#define GNUMERIC_EXCEL_H
#include "ms-ole.h"
#include <libole2/ms-ole.h>
#include "sheet.h"
typedef enum _eBiff_version { eBiffV2=2, eBiffV3=3,
......
.deps
Makefile.in
Makefile
.libs
*.lo
*.la
version.c
libole2.h
This diff is collapsed.
libole2_sources = \
ms-ole.c \
ms-ole.h \
ms-ole-summary.c \
ms-ole-summary.h \
ms-ole-vba.c \
ms-ole-vba.h
if LIBOLE2_PUBLIC_LIBRARY
lib_LTLIBRARIES = libole2.la
libole2_la_SOURCES = \
$(libole2_sources) \
version.c
libole2includedir = $(includedir)/libole2
libole2include_HEADERS = \
libole2.h \
ms-ole.h \
ms-ole-summary.h \
ms-ole-vba.h
else
## Following is when libole2-src is compiled from gnumeric
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) \
-I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR) \
-DHAVE_MMAP
## XXX delete HAVE_MMAP when gnumeric's configure.in includes AC_HAVE_MMAP
noinst_LIBRARIES = libole2.a
libole2_a_SOURCES = \
$(libole2_sources)
endif
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
This code is imported into the gnumeric tree via a CVS virtual link,
in order to use the test framework checkout CVS module libole2.
This code was written with grateful thanks to:
Martin Schwartz - Author of Laola, father of free OLE2
Much useful information will be gleaned from the work on wine by.
Marcus Meissner, Francis Beaudet, Sylvain St-Germain
and Thuy Nguyen
The code breaks fairly cleanly into two seperate pieces,
firstly the raw block API whether small or large, and 2ndly the FILE *
style wrapper on top of the block API. Since there are two types of
block, there are two functions per percieved method that are accessed
via the stream's function pointer. This has a lot of good performance
characteristics, despite the percieved overhead of a 'virtual' call.
The exception to this being ms_ole_lseek which is non-staticly linked
for homogeneity.
Further thanks for the summary information code go to
Caolan McNamara - Heroic coding ledgend.
for his port of the Somar Software freeware DLL functions to get
summary info from OLE 2.0 document files, named CPPSUM available from
the Somar Software WWW site at http://www.somar.com.
The summary information code was extensively updated and re -
written by Frank Chiulli incorporating both DocumentSummaryInformation
and SummaryInformation streams, and implementing several new types.
This code has been written and is maintained by the following
people:
Michael Meeks (michael@helixcode.com)
Arturo Tena (arturo@directmail.org)
Frank Chiulli (fc-linux@home.com)
Any patches should be sent to both Arturo and myself,
Michael Meeks.
Optimise non mmaped block storage to allow contiguous ptr passing.
Ref count ms_ole_stream & ms_ole
libvfs integration (?)
write nice simple file handle style macros / wrappers.
Is Makefile.am (INCLUDES) really really needed?
Sort out small streams < 0x1000 bytes; something is duff in the
PPS / chaining ( lots of work with hex editor ).
#include "ms-ole.h"
#include "ms-ole-summary.h"
extern int libole2_major_version;
extern int libole2_minor_version;
extern int libole2_micro_version;
#define LIBOLE2_MAJOR_VERSION @LIBOLE2_MAJOR_VERSION@
#define LIBOLE2_MINOR_VERSION @LIBOLE2_MINOR_VERSION@
#define LIBOLE2_MICRO_VERSION @LIBOLE2_MICRO_VERSION@
This diff is collapsed.
/**
* ms-ole-summary.h: MS Office OLE support
*
* Author:
* Michael Meeks (michael@imaginator.com)
* From work by:
* Caolan McNamara (Caolan.McNamara@ul.ie)
* Built on work by:
* Somar Software's CPPSUM (http://www.somar.com)
**/
#ifndef MS_OLE_SUMMARY_H
#define MS_OLE_SUMMARY_H
#include <time.h>
/*
* MS Ole Property Set IDs
* The SummaryInformation stream contains the SummaryInformation property set.
* The DocumentSummaryInformation stream contains both the
* DocumentSummaryInformation and the UserDefined property sets as sections.
*/
typedef enum {
MS_OLE_PS_SUMMARY_INFO,
MS_OLE_PS_DOCUMENT_SUMMARY_INFO,
MS_OLE_PS_USER_DEFINED_SUMMARY_INFO
} MsOlePropertySetID;
typedef struct {
guint8 class_id[16];
GArray * sections;
GArray * items;
GList * write_items;
gboolean read_mode;
MsOleStream * s;
MsOlePropertySetID ps_id;
} MsOleSummary;
/* Could store the FID, but why bother ? */
typedef struct {
guint32 offset;
guint32 props;
guint32 bytes;
MsOlePropertySetID ps_id;
} MsOleSummarySection;
MsOleSummary *ms_ole_summary_open (MsOle *f);
MsOleSummary *ms_ole_docsummary_open (MsOle *f);
MsOleSummary *ms_ole_summary_open_stream (MsOleStream *stream,
const MsOlePropertySetID psid);
MsOleSummary *ms_ole_summary_create (MsOle *f);
MsOleSummary *ms_ole_docsummary_create (MsOle *f);
MsOleSummary *ms_ole_summary_create_stream (MsOleStream *s,
const MsOlePropertySetID psid);
GArray *ms_ole_summary_get_properties (MsOleSummary *si);
void ms_ole_summary_close (MsOleSummary *si);
/*
* Can be used to interrogate a summary item as to its type
*/
typedef enum {
MS_OLE_SUMMARY_TYPE_STRING = 0x10,
MS_OLE_SUMMARY_TYPE_TIME = 0x20,
MS_OLE_SUMMARY_TYPE_LONG = 0x30,
MS_OLE_SUMMARY_TYPE_SHORT = 0x40,
MS_OLE_SUMMARY_TYPE_BOOLEAN = 0x50,
MS_OLE_SUMMARY_TYPE_OTHER = 0x60
} MsOleSummaryType;
#define MS_OLE_SUMMARY_TYPE(x) ((MsOleSummaryType)((x)>>8))
/* FIXME MS_OLE_SUMMARY_THUMBNAIL is Preview, no Security, isn't it? */
/*
* The MS byte specifies the type, the LS byte is the
* 'standard' MS PID.
*/
typedef enum {
/* SummaryInformation Stream Properties */
/* String properties */
MS_OLE_SUMMARY_TITLE = 0x1002,
MS_OLE_SUMMARY_SUBJECT = 0x1003,
MS_OLE_SUMMARY_AUTHOR = 0x1004,
MS_OLE_SUMMARY_KEYWORDS = 0x1005,
MS_OLE_SUMMARY_COMMENTS = 0x1006,
MS_OLE_SUMMARY_TEMPLATE = 0x1007,
MS_OLE_SUMMARY_LASTAUTHOR = 0x1008,
MS_OLE_SUMMARY_REVNUMBER = 0x1009,
MS_OLE_SUMMARY_APPNAME = 0x1012,
/* Time properties */
MS_OLE_SUMMARY_TOTAL_EDITTIME = 0x200A,
MS_OLE_SUMMARY_LASTPRINTED = 0x200B,
MS_OLE_SUMMARY_CREATED = 0x200C,
MS_OLE_SUMMARY_LASTSAVED = 0x200D,
/* Long integer properties */
MS_OLE_SUMMARY_PAGECOUNT = 0x300E,
MS_OLE_SUMMARY_WORDCOUNT = 0x300F,
MS_OLE_SUMMARY_CHARCOUNT = 0x3010,
MS_OLE_SUMMARY_SECURITY = 0x3013,
/* Short integer properties */
MS_OLE_SUMMARY_CODEPAGE = 0x4001,
/* Security */
MS_OLE_SUMMARY_THUMBNAIL = 0x6011,
/* DocumentSummaryInformation Properties */
/* String properties */
MS_OLE_SUMMARY_CATEGORY = 0x1002,
MS_OLE_SUMMARY_PRESFORMAT = 0x1003,
MS_OLE_SUMMARY_MANAGER = 0x100E,
MS_OLE_SUMMARY_COMPANY = 0x100F,
/* Long integer properties */
MS_OLE_SUMMARY_BYTECOUNT = 0x3004,
MS_OLE_SUMMARY_LINECOUNT = 0x3005,
MS_OLE_SUMMARY_PARCOUNT = 0x3006,
MS_OLE_SUMMARY_SLIDECOUNT = 0x3007,
MS_OLE_SUMMARY_NOTECOUNT = 0x3008,
MS_OLE_SUMMARY_HIDDENCOUNT = 0x3009,
MS_OLE_SUMMARY_MMCLIPCOUNT = 0X300A,
/* Boolean properties */
MS_OLE_SUMMARY_SCALE = 0x500B,
MS_OLE_SUMMARY_LINKSDIRTY = 0x5010
} MsOleSummaryPID;
/* bit masks for security long integer */
#define MsOleSummaryAllSecurityFlagsEqNone 0x00
#define MsOleSummarySecurityPassworded 0x01
#define MsOleSummarySecurityRORecommended 0x02
#define MsOleSummarySecurityRO 0x04
#define MsOleSummarySecurityLockedForAnnotations 0x08
typedef struct {
GTimeVal time;
GDate date;
} MsOleSummaryTime;
typedef struct {
guint32 len;
guint8 *data;
} MsOleSummaryPreview;
gchar * ms_ole_summary_get_string (MsOleSummary *si,
MsOleSummaryPID id,
gboolean *available);
gboolean ms_ole_summary_get_boolean (MsOleSummary *si,
MsOleSummaryPID id,
gboolean *available);
guint16 ms_ole_summary_get_short (MsOleSummary *si,
MsOleSummaryPID id,
gboolean *available);
guint32 ms_ole_summary_get_long (MsOleSummary *si,
MsOleSummaryPID id,
gboolean *available);
GTimeVal ms_ole_summary_get_time (MsOleSummary *si,
MsOleSummaryPID id,
gboolean *available);
MsOleSummaryPreview ms_ole_summary_get_preview (MsOleSummary *si,
MsOleSummaryPID id,
gboolean *available);
void ms_ole_summary_preview_destroy (MsOleSummaryPreview d);
/* FIXME The next comment isn't true, is it?
Return TRUE if write is successful */
void ms_ole_summary_set_string (MsOleSummary *si,
MsOleSummaryPID id,
const gchar *str);
void ms_ole_summary_set_boolean (MsOleSummary *si,
MsOleSummaryPID id,
gboolean bool);
void ms_ole_summary_set_short (MsOleSummary *si,
MsOleSummaryPID id,
guint16 i);
void ms_ole_summary_set_long (MsOleSummary *si,
MsOleSummaryPID id,
guint32 i);
void ms_ole_summary_set_time (MsOleSummary *si,
MsOleSummaryPID id,
GTimeVal time);
void ms_ole_summary_set_preview (MsOleSummary *si,
MsOleSummaryPID id,
const
MsOleSummaryPreview *
preview);
#endif /* MS_OLE_SUMMARY_H */
/**
* ms-ole-vba.c: MS Office VBA support
*
* Author:
* Michael Meeks (michael@imaginator.com)
*
* Copyright 2000 Helix Code, Inc.
**/
#include <config.h>
#include <stdio.h>
#include <ms-ole-vba.h>
#undef VBA_DEBUG
struct _MsOleVba {
MsOleStream *s;
GArray *text;
int pos;
};
inline gboolean
ms_ole_vba_eof (MsOleVba *vba)
{
return !vba || vba->pos >= vba->text->len;
}
char
ms_ole_vba_getc (MsOleVba *vba)
{
g_assert (!ms_ole_vba_eof (vba));
return g_array_index (vba->text, guint8, vba->pos++);
}
char
ms_ole_vba_peek (MsOleVba *vba)
{
g_assert (!ms_ole_vba_eof (vba));
return g_array_index (vba->text, guint8, vba->pos);
}
#if VBA_DEBUG > 1
static void
print_bin (guint16 dt)
{
int i;
printf ("|");
for (i = 15; i >= 0; i--) {
if (dt & (1 << i))
printf ("1");
else
printf ("0");
if (i == 8)
printf ("|");
}
printf ("|");
}
#endif
/*
* lzw, arc like compression.
*/
static void
decompress_vba (MsOleVba *vba, guint8 *data, guint32 len)
{
#define BUF_SIZE 4096 /* a bottleneck */
guint8 buffer[BUF_SIZE];
guint8 *ptr;
guint32 pos;
GArray *ans = g_array_new (FALSE, FALSE, 1);
vba->text = ans;
vba->pos = 0;
for (pos = 0; pos < BUF_SIZE; pos++)
buffer[pos] = ' ';
#if VBA_DEBUG > 0
g_warning ("My compressed stream:\n");
ms_ole_dump (data, len);
#endif
ptr = data;
pos = 0;
while (ptr < data + len) {
guint8 hdr = *ptr++;
int shift;
for (shift = 0x01; shift < 0x100; shift = shift<<1) {
if (pos == 4096) {
#if VBA_DEBUG > 0
printf ("\nSomething extremely odd"
" happens after 4096 bytes 0x%x\n\n",
MS_OLE_GET_GUINT16 (ptr));
ms_ole_dump (ptr, len - (ptr - data));
#endif
ptr+=2;
hdr = *ptr++;
pos = 0;
shift = 0x01;
}
if (hdr & shift) {
guint16 dt = MS_OLE_GET_GUINT16 (ptr);
int i, back, len, shft;
if (pos <= 64)
shft = 10;
else if (pos <= 128)
shft = 9;
else if (pos <= 256)
shft = 8;
else if (pos <= 512)
shft = 7;
else if (pos <= 1024)
shft = 6;
else if (pos <= 2048)
shft = 5;
else
shft = 4;
back = (dt >> shft) + 1;
len = 0;
for (i = 0; i < shft; i++)
len |= dt & (0x1 << i);
len += 3;
#if VBA_DEBUG > 1
printf ("|match 0x%x (%d,%d) >> %d = %d, %d| pos = %d |\n",
dt, (dt>>8), (dt&0xff), shft, back, len, pos);
/* Perhaps dt & SHIFT = dist. to end of run */
print_bin (dt);
printf ("\n");
#endif
for (i = 0; i < len; i++) {
guint8 c;
guint32 srcpos = (BUF_SIZE + (pos%BUF_SIZE)) - back;
if (srcpos >= BUF_SIZE)
srcpos-= BUF_SIZE;
g_assert (srcpos >= 0);
g_assert (srcpos < BUF_SIZE);
c = buffer [srcpos];
buffer [pos++ % BUF_SIZE] = c;
g_array_append_val (ans, c);