Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
Date: 2003-12-21
Initial Package Version: 1.1.0
Origin: holodeck (yep, that's my workstataion hostname)
Description: Allows use of System installed versions for some packages instead of using
the ones included in OpenOffice. Saves space and time :-) Apply the patch and set the
proper env vars to select the system version (it is best to add the vars at the end of
Env file generated by configure). The version in the bracket indicates the version against
which the patch was tested.
* Berkeley DB (Version 4.1.25)
  [Avoid using DB >= 4.1 since the API changed and the patch for that is a hack]
    export SYSTEM_DB=YES
    export SYSTEM_DB_VERSION=4.1
    export SYSTEM_DB_CLASSPATH=/usr/lib/db.jar
* cURL (Version 7.10.8)	
    export SYSTEM_CURL=YES
* expat (Version 1.95.7)
    export SYSTEM_EXPAT=YES
* freetype (Version 2.1.4)
    export SYSTEM_FREETYPE=YES
    export SYSTEM_FREETYPE_INCLUDES=`freetype-config --cflags`
* jpeg (Version 6b) 
  [Not yet stable, results in undefined symbol when linking svtools.]
    export SYSTEM_JPEG=YES
* nas (Version 1.6)
	export SYSTEM_NAS=YES
* python (Version 2.3.2)
  [Not yet complete, do not use unless extending the patch.]
    export SYSTEM_PYTHON=YES
    export SYSTEM_PYTHON_INCLUDES=-I/usr/include/python2.3
* zlib (Version 1.2.1)
    export SYSTEM_ZLIB=YES

WARNING: Note that this patch is not yet complete. It is also not completely
tested. The patch is a work in progress. Use at your own risk.

The patch was made with all packages installed with a prefix of /usr and without
munging any locations where the files are installed. If the header files or libs
are in a location different from the usual directories where gcc or ld search for
them, add the proper flags to the generated Env file before starting compilation.
diff -Nur oo_1.1_src.orig/berkeleydb/makefile.mk oo_1.1_src/berkeleydb/makefile.mk
--- oo_1.1_src.orig/berkeleydb/makefile.mk	2003-06-12 04:50:38.000000000 -0500
+++ oo_1.1_src/berkeleydb/makefile.mk	2003-10-25 20:05:43.000000000 -0500
@@ -65,6 +65,17 @@
 PRJNAME=so_berkeleydb
 TARGET=so_berkeleydb
 
+.IF "$(SYSTEM_DB)" == "YES"
+all:
+	@echo "Using System Installed Berkeley DB..."
+	+$(COPY) $(SYSTEM_DB_CLASSPATH) $(BIN)
+.IF "$(SYSTEM_DB_VERSION)" == "4.1"
+	+$(COPY) ../xmlhelp/source/com/sun/star/help/CreateDb-4.1.java ../xmlhelp/source/com/sun/star/help/CreateDb.java
+	+$(COPY) ../xmlhelp/source/com/sun/star/help/HelpDatabases-4.1.java ../xmlhelp/source/com/sun/star/help/HelpDatabases.java
+	+$(COPY) ../xmlhelp/source/com/sun/star/help/HelpIndexer-4.1.java ../xmlhelp/source/com/sun/star/help/HelpIndexer.java
+.ENDIF
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/curl/makefile.mk oo_1.1_src/curl/makefile.mk
--- oo_1.1_src.orig/curl/makefile.mk	2003-07-16 12:24:06.000000000 -0500
+++ oo_1.1_src/curl/makefile.mk	2003-10-24 21:21:17.000000000 -0500
@@ -65,6 +65,11 @@
 PRJNAME=so_curl
 TARGET=so_curl
 
+.IF "$(SYSTEM_CURL)" == "YES"
+all:
+	@echo "Using System Installed cURL..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/expat/makefile.mk oo_1.1_src/expat/makefile.mk
--- oo_1.1_src.orig/expat/makefile.mk	2002-07-09 07:24:30.000000000 -0500
+++ oo_1.1_src/expat/makefile.mk	2003-10-24 21:23:17.000000000 -0500
@@ -65,6 +65,11 @@
 PRJNAME=so_expat
 TARGET=so_expat
 
+.IF "$(SYSTEM_EXPAT)" == "YES"
+all:
+	@echo "Using System Installed expat..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/filter/source/flash/makefile.mk oo_1.1_src/filter/source/flash/makefile.mk
--- oo_1.1_src.orig/filter/source/flash/makefile.mk	2003-07-09 05:14:43.000000000 -0500
+++ oo_1.1_src/filter/source/flash/makefile.mk	2003-10-26 08:24:26.000000000 -0600
@@ -71,6 +71,10 @@
 
 .INCLUDE :  	settings.mk
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CFLAGS += -DSYSTEM_ZLIB
+.ENDIF
+
 # --- Types -------------------------------------
 
 UNOTYPES=\
diff -Nur oo_1.1_src.orig/filter/source/flash/swfwriter1.cxx oo_1.1_src/filter/source/flash/swfwriter1.cxx
--- oo_1.1_src.orig/filter/source/flash/swfwriter1.cxx	2003-07-11 05:22:41.000000000 -0500
+++ oo_1.1_src/filter/source/flash/swfwriter1.cxx	2003-10-26 08:25:47.000000000 -0600
@@ -88,7 +88,11 @@
 #include <svtools/graphictools.hxx>
 #endif
 
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#else
 #include <external/zlib/zlib.h>
+#endif
 
 #ifndef _SV_SALBTYPE_HXX
 #include <vcl/salbtype.hxx>
diff -Nur oo_1.1_src.orig/freetype/makefile.mk oo_1.1_src/freetype/makefile.mk
--- oo_1.1_src.orig/freetype/makefile.mk	2003-05-28 07:41:19.000000000 -0500
+++ oo_1.1_src/freetype/makefile.mk	2003-10-24 22:26:01.000000000 -0500
@@ -65,6 +65,11 @@
 PRJNAME=so_freetype
 TARGET=so_freetype
 
+.IF "$(SYSTEM_FREETYPE)" == "YES"
+all:
+	@echo "Using System Installed freetype..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/jpeg/makefile.mk oo_1.1_src/jpeg/makefile.mk
--- oo_1.1_src.orig/jpeg/makefile.mk	2003-03-26 06:25:38.000000000 -0600
+++ oo_1.1_src/jpeg/makefile.mk	2003-10-24 22:30:41.000000000 -0500
@@ -65,6 +65,11 @@
 PRJNAME=jpeg
 TARGET=jpeg
 
+.IF "$(SYSTEM_JPEG)" == "YES"
+all:
+    @echo "Using System Installed jpeg..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/nas/makefile.mk oo_1.1_src/nas/makefile.mk
--- oo_1.1_src.orig/nas/makefile.mk	2003-06-12 04:45:13.000000000 -0500
+++ oo_1.1_src/nas/makefile.mk	2003-10-25 00:05:49.000000000 -0500
@@ -65,6 +65,11 @@
 PRJNAME=nas
 TARGET=nas
 
+.IF "$(SYSTEM_NAS)" == "YES"
+all:
+	@echo "Using System Installed nas..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/neon/neon.patch oo_1.1_src/neon/neon.patch
--- oo_1.1_src.orig/neon/neon.patch	2002-10-24 06:50:58.000000000 -0500
+++ oo_1.1_src/neon/neon.patch	2003-10-25 02:30:32.000000000 -0500
@@ -100,10 +100,10 @@
 ! 
 ! /* Define if you have expat */
 ! #define HAVE_EXPAT 1
-! #define HAVE_OLD_EXPAT 1
+! /* #define HAVE_OLD_EXPAT 1 */
 ! 
 ! /* Define to 1 if you have the <xmlparse.h> header file. */
-! #define HAVE_XMLPARSE_H 1
+! /* #define HAVE_XMLPARSE_H 1 */
 ! 
 ! /* Define if you have libxml */
 ! /* #define HAVE_LIBXML */
@@ -139,7 +139,7 @@
 ***************
 *** 1 ****
 ! dummy
---- 1,49 ----
+--- 1,55 ----
 ! PRJ=..$/..$/..$/..$/..
 ! 
 ! PRJNAME=external
@@ -158,6 +158,12 @@
 ! 
 ! CDEFS+=-DHAVE_CONFIG_H
 ! 
+! .IF "$(SYSTEM_EXPAT)"=="YES"
+! CDEFS+=-DHAVE_EXPAT_H
+! .ELSE
+! CDEFS+=-DHAVE_OLD_EXPAT -DHAVE_XMLPARSE_H
+! .ENDIF
+! 
 ! SLOFILES= \
 !         $(SLO)$/ne_207.obj \
 !         $(SLO)$/ne_acl.obj \
diff -Nur oo_1.1_src.orig/package/source/zipapi/Adler32.cxx oo_1.1_src/package/source/zipapi/Adler32.cxx
--- oo_1.1_src.orig/package/source/zipapi/Adler32.cxx	2001-11-15 14:07:35.000000000 -0600
+++ oo_1.1_src/package/source/zipapi/Adler32.cxx	2003-10-25 12:06:12.000000000 -0500
@@ -61,9 +61,13 @@
 #ifndef _ADLER32_HXX
 #include <Adler32.hxx>
 #endif
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#else
 #ifndef _ZLIB_H
 #include <external/zlib/zlib.h>
 #endif
+#endif
 
 /**
  * A class that can be used to compute the Adler-32 checksum of a data
diff -Nur oo_1.1_src.orig/package/source/zipapi/CRC32.cxx oo_1.1_src/package/source/zipapi/CRC32.cxx
--- oo_1.1_src.orig/package/source/zipapi/CRC32.cxx	2001-12-04 11:48:19.000000000 -0600
+++ oo_1.1_src/package/source/zipapi/CRC32.cxx	2003-10-25 12:10:15.000000000 -0500
@@ -61,9 +61,13 @@
 #ifndef _CRC32_HXX
 #include <CRC32.hxx>
 #endif
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#else
 #ifndef _ZLIB_H
 #include <external/zlib/zlib.h>
 #endif
+#endif
 #ifndef _PACKAGE_CONSTANTS_HXX_
 #include <PackageConstants.hxx>
 #endif
diff -Nur oo_1.1_src.orig/package/source/zipapi/Deflater.cxx oo_1.1_src/package/source/zipapi/Deflater.cxx
--- oo_1.1_src.orig/package/source/zipapi/Deflater.cxx	2001-11-15 14:16:11.000000000 -0600
+++ oo_1.1_src/package/source/zipapi/Deflater.cxx	2003-10-25 12:15:54.000000000 -0500
@@ -61,9 +61,18 @@
 #ifndef _DEFLATER_HXX_
 #include <Deflater.hxx>
 #endif
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#define z_deflateParams deflateParams
+#define z_deflate deflate
+#define z_deflateSetDictionary deflateSetDictionary
+#define z_deflateReset deflateReset
+#define z_deflateEnd deflateEnd
+#else
 #ifndef _ZLIB_H
 #include <external/zlib/zlib.h>
 #endif
+#endif
 #ifndef _VOS_DIAGNOSE_H_
 #include <vos/diagnose.hxx>
 #endif
diff -Nur oo_1.1_src.orig/package/source/zipapi/Inflater.cxx oo_1.1_src/package/source/zipapi/Inflater.cxx
--- oo_1.1_src.orig/package/source/zipapi/Inflater.cxx	2001-11-15 14:17:02.000000000 -0600
+++ oo_1.1_src/package/source/zipapi/Inflater.cxx	2003-10-25 12:17:55.000000000 -0500
@@ -61,9 +61,18 @@
 #ifndef _INFLATER_HXX_
 #include <Inflater.hxx>
 #endif
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#define z_inflateSetDictionary inflateSetDictionary
+#define z_inflateSetDictionary inflateSetDictionary
+#define z_inflateReset inflateReset
+#define z_inflateEnd inflateEnd
+#define z_inflate inflate
+#else
 #ifndef _ZLIB_H
 #include <external/zlib/zlib.h>
 #endif
+#endif
 #ifndef _VOS_DIAGNOSE_H_
 #include <vos/diagnose.hxx>
 #endif
diff -Nur oo_1.1_src.orig/package/source/zipapi/makefile.mk oo_1.1_src/package/source/zipapi/makefile.mk
--- oo_1.1_src.orig/package/source/zipapi/makefile.mk	2002-01-29 09:30:48.000000000 -0600
+++ oo_1.1_src/package/source/zipapi/makefile.mk	2003-10-25 12:04:45.000000000 -0500
@@ -73,6 +73,10 @@
 .INCLUDE : settings.mk
 .INCLUDE : sv.mk
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CFLAGS += -DSYSTEM_ZLIB
+.ENDIF
+
 # --- Files --------------------------------------------------------
 #CFLAGS+=/Ob0 /Od
 SLOFILES= \
diff -Nur oo_1.1_src.orig/python/makefile.mk oo_1.1_src/python/makefile.mk
--- oo_1.1_src.orig/python/makefile.mk	2003-08-15 06:22:45.000000000 -0500
+++ oo_1.1_src/python/makefile.mk	2003-10-25 00:27:22.000000000 -0500
@@ -63,6 +63,11 @@
 PRJNAME=so_python
 TARGET=so_python
 
+.IF "$(SYSTEM_PYTHON)" == "YES"
+all:
+	@echo "Using System Installed python..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
diff -Nur oo_1.1_src.orig/pyuno/source/loader/makefile.mk oo_1.1_src/pyuno/source/loader/makefile.mk
--- oo_1.1_src.orig/pyuno/source/loader/makefile.mk	2003-08-15 07:38:43.000000000 -0500
+++ oo_1.1_src/pyuno/source/loader/makefile.mk	2003-10-25 13:32:42.000000000 -0500
@@ -69,7 +69,12 @@
 
 DLLPRE = 
 
+.IF "$(SYSTEM_PYTHON)" == "YES"
+CFLAGS += $(SYSTEM_PYTHON_INCLUDES)
+.ELSE
 .INCLUDE :  pyversion.mk
+.ENDIF
+
 #-------------------------------------------------------------------
 
 CFLAGS+=-I$(SOLARINCDIR)$/python
diff -Nur oo_1.1_src.orig/pyuno/source/module/makefile.mk oo_1.1_src/pyuno/source/module/makefile.mk
--- oo_1.1_src.orig/pyuno/source/module/makefile.mk	2003-08-15 07:39:44.000000000 -0500
+++ oo_1.1_src/pyuno/source/module/makefile.mk	2003-10-25 13:25:39.000000000 -0500
@@ -66,7 +66,11 @@
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  settings.mk
+.IF "$(SYSTEM_PYTHON)" == "YES"
+CFLAGS += $(SYSTEM_PYTHON_INCLUDES)
+.ELSE
 .INCLUDE :  pyversion.mk
+.ENDIF
 #-------------------------------------------------------------------
 
 CFLAGS+=-I$(SOLARINCDIR)$/python
diff -Nur oo_1.1_src.orig/pyuno/zipcore/makefile.mk oo_1.1_src/pyuno/zipcore/makefile.mk
--- oo_1.1_src.orig/pyuno/zipcore/makefile.mk	2003-08-15 07:45:45.000000000 -0500
+++ oo_1.1_src/pyuno/zipcore/makefile.mk	2003-10-25 13:09:27.000000000 -0500
@@ -1,6 +1,10 @@
 PRJNAME=pyuno
 PRJ=..
 
+.IF "$(SYSTEM_PYTHON)" == "YES"
+all:
+	@echo "Using system installed python..."
+.ELSE
 .INCLUDE : settings.mk
 .INCLUDE : pyversion.mk
 
@@ -48,3 +52,4 @@
 .IF "$(GUI)"== "UNX"
 	chmod +x $@
 .ENDIF
+.ENDIF
diff -Nur oo_1.1_src.orig/sablot/Sablot-0.52.patch oo_1.1_src/sablot/Sablot-0.52.patch
--- oo_1.1_src.orig/sablot/Sablot-0.52.patch	2003-08-05 04:41:11.000000000 -0500
+++ oo_1.1_src/sablot/Sablot-0.52.patch	2003-10-25 01:33:48.000000000 -0500
@@ -3,7 +3,7 @@
 ***************
 *** 1 ****
 ! dummy
---- 1,163 ----
+--- 1,167 ----
 ! #*************************************************************************
 ! #
 ! #   $RCSfile: openoffice-1.1.0-use_system_components-2.patch,v $
@@ -77,6 +77,10 @@
 ! 
 ! .INCLUDE: settings.mk
 ! 
+! .IF "$(SYSTEM_EXPAT)"=="YES"
+! CFLAGS+=-DHAVE_EXPAT_H
+! .ENDIF
+! 
 ! .IF "$(GUI)"=="WNT"
 ! CFLAGS+=-GR
 ! .ENDIF
diff -Nur oo_1.1_src.orig/sax/source/expatwrap/makefile.mk oo_1.1_src/sax/source/expatwrap/makefile.mk
--- oo_1.1_src.orig/sax/source/expatwrap/makefile.mk	2001-03-02 01:16:52.000000000 -0600
+++ oo_1.1_src/sax/source/expatwrap/makefile.mk	2003-10-25 10:07:53.000000000 -0500
@@ -72,6 +72,10 @@
 #-----------------------------------------------------------
 CFLAGS += -DXML_UNICODE
 
+.IF "$(SYSTEM_EXPAT)" == "YES"
+CFLAGS += -DSYSTEM_EXPAT
+.ENDIF
+
 SLOFILES =\
 		$(SLO)$/xml2utf.obj\
 		$(SLO)$/attrlistimpl.obj\
diff -Nur oo_1.1_src.orig/sax/source/expatwrap/sax_expat.cxx oo_1.1_src/sax/source/expatwrap/sax_expat.cxx
--- oo_1.1_src.orig/sax/source/expatwrap/sax_expat.cxx	2002-05-15 11:33:29.000000000 -0500
+++ oo_1.1_src/sax/source/expatwrap/sax_expat.cxx	2003-10-25 10:04:11.000000000 -0500
@@ -82,7 +82,11 @@
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase2.hxx>
 
+#ifdef SYSTEM_EXPAT
+#include <expat.h>
+#else
 #include "expat/xmlparse.h"
+#endif
 
 using namespace ::rtl;
 using namespace ::std;
diff -Nur oo_1.1_src.orig/scp/source/global/makefile.mk oo_1.1_src/scp/source/global/makefile.mk
--- oo_1.1_src.orig/scp/source/global/makefile.mk	2003-04-17 10:42:01.000000000 -0500
+++ oo_1.1_src/scp/source/global/makefile.mk	2003-10-26 15:25:00.000000000 -0600
@@ -79,6 +79,10 @@
 SCPDEFS+=-DINCLUDE_JAVA_ACCESSBRIDGE
 .ENDIF
 
+.IF "$(SYSTEM_FREETYPE)" == "YES"
+SCPDEFS += -DSYSTEM_FREETYPE
+.ENDIF
+
 SCP_PRODUCT_TYPE=osl fat fam ada adm web wem srv ofs omc
 PARFILES= \
 		setupzip.par		\
diff -Nur oo_1.1_src.orig/scp/source/global/setupzip.scp oo_1.1_src/scp/source/global/setupzip.scp
--- oo_1.1_src.orig/scp/source/global/setupzip.scp	2003-08-22 06:44:24.000000000 -0500
+++ oo_1.1_src/scp/source/global/setupzip.scp	2003-10-26 14:24:46.000000000 -0600
@@ -559,6 +559,7 @@
 #ifdef UNX
 
 #ifndef MACOSX
+#ifndef SYSTEM_FREETYPE
 File GID_FILE_LIB_FREETYPE
     #if defined (LINUX)  &&  ( defined (CLASSIC_FAT_PRODUCT) || defined (OSL_PRODUCT) || defined (FAM_PRODUCT) )
         Dir     = GID_DIR_FILTER;
@@ -574,6 +575,7 @@
     #endif
 End
 #endif
+#endif
 
 #ifdef OSL_PRODUCT
 STD_FONTUNX_FILE( GID_FILE_FNT_VERA, Vera.ttf, Vera Sans)
@@ -654,4 +656,4 @@
         Name (99)       = "fontunxpsprint.zip";
 End
 
-#endif
\ No newline at end of file
+#endif
diff -Nur oo_1.1_src.orig/scp/source/office/files.scp oo_1.1_src/scp/source/office/files.scp
--- oo_1.1_src.orig/scp/source/office/files.scp	2003-10-28 01:00:53.000000000 -0600
+++ oo_1.1_src/scp/source/office/files.scp	2003-10-26 20:58:34.000000000 -0600
@@ -876,6 +876,7 @@
         #endif
 End
 
+#ifndef SYSTEM_CURL
 File GID_FILE_LIB_CURL
         TXT_FILE_BODY;
         Styles          = (PACKED);
@@ -886,6 +887,7 @@
         Name            = "libcurl.dll";
         #endif
 End
+#endif
 
 
 File GID_FILE_LIB_I18NREGEXP
@@ -933,6 +935,8 @@
 
 #endif
 
+#ifndef SYSTEM_DB
+
 File GID_FILE_LIB_DB31
         TXT_FILE_BODY;
         Styles          = (PACKED);
@@ -970,6 +974,8 @@
 
 #endif
 
+#endif
+
 #ifdef UNX
 
 File GID_FILE_MSGBOX_GNOME
diff -Nur oo_1.1_src.orig/scp/source/office/makefile.mk oo_1.1_src/scp/source/office/makefile.mk
--- oo_1.1_src.orig/scp/source/office/makefile.mk	2003-07-16 13:17:16.000000000 -0500
+++ oo_1.1_src/scp/source/office/makefile.mk	2003-10-26 20:57:13.000000000 -0600
@@ -72,6 +72,14 @@
 SCPDEFS+=-DENABLE_CRASHDUMP
 .ENDIF
 
+.IF "$(SYSTEM_DB)" == "YES"
+SCPDEFS += -DSYSTEM_DB
+.ENDIF
+
+.IF "$(SYSTEM_CURL)" == "YES"
+SCPDEFS += -DSYSTEM_CURL
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :  svpre.mk
diff -Nur oo_1.1_src.orig/scp/source/python/makefile.mk oo_1.1_src/scp/source/python/makefile.mk
--- oo_1.1_src.orig/scp/source/python/makefile.mk	2003-07-02 10:15:41.000000000 -0500
+++ oo_1.1_src/scp/source/python/makefile.mk	2003-10-26 21:27:56.000000000 -0600
@@ -76,6 +76,10 @@
 
 SCP_PRODUCT_TYPE=osl
 
+.IF "$(SYSTEM_PYTHON)" == "YES"
+SCPDEFS += -DSYSTEM_PYTHON
+.ENDIF
+
 .IF "$(GUI)"=="UNX"
 SCRIPTFILES=	unxbasic_python.par
 .ELSE
diff -Nur oo_1.1_src.orig/scp/source/python/python.scp oo_1.1_src/scp/source/python/python.scp
--- oo_1.1_src.orig/scp/source/python/python.scp	2003-08-18 09:32:57.000000000 -0500
+++ oo_1.1_src/scp/source/python/python.scp	2003-10-27 21:26:35.000000000 -0600
@@ -160,6 +160,7 @@
     Value  = "$ORIGIN/services.rdb";
 End
 
+#ifndef SYSTEM_PYTHON
 File gid_File_Py_python_core
      TXT_FILE_BODY;
      ModuleID = GID_MODULE_PYUNO;
@@ -167,6 +168,7 @@
      Name = "python-core-2.2.2.zip";
      Styles          = (ARCHIVE);
 End
+#endif
 
 Profile gid_Profile_pythonloader_uno_ini
     ModuleID = GID_MODULE_PYUNO;
@@ -179,6 +181,7 @@
     Styles = (NETWORK);
 End
 
+#ifndef SYSTEM_PYTHON
 ProfileItem GID_PROFILEITEM_PYTHONLOADER_PYTHONHOME
     ProfileID = gid_Profile_pythonloader_uno_ini;
     ModuleID = GID_MODULE_PYUNO;
@@ -187,7 +190,9 @@
     Key  = "PYTHONHOME";
     Value  = "$ORIGIN/python-core";
 End
+#endif
 
+#ifndef SYSTEM_PYTHON
 ProfileItem GID_PROFILEITEM_PYTHONLOADER_PYTHONPATH
     ProfileID = gid_Profile_pythonloader_uno_ini;
     ModuleID = GID_MODULE_PYUNO;
@@ -200,6 +205,7 @@
     Value  = "$ORIGIN/python-core-2.2.2/lib $ORIGIN";
 #endif
 End
+#endif
 
 
 #ifdef WNT
@@ -214,6 +220,7 @@
 
 #ifdef UNX
 #ifndef MACOSX
+#ifndef SYSTEM_PYTHON
 File gid_File_Lib_Python_so
      TXT_FILE_BODY;
      ModuleID = GID_MODULE_PYUNO;
@@ -229,7 +236,9 @@
     Name = STRING(CONCAT3(libpython,UNXSUFFIX,.2));
     Styles = (NETWORK,RELATIVE);
 End
+#endif
 #else
+#ifndef SYSTEM_PYTHON
 File gid_File_Lib_Python_so
      TXT_FILE_BODY;
      ModuleID = GID_MODULE_PYUNO;
@@ -246,7 +255,9 @@
     Styles = (NETWORK,RELATIVE);
 End
 #endif
+#endif
 
+#ifndef SYSTEM_PYTHON
 Shortcut gid_Shortcut_Lib_Python_2
     ModuleID =GID_MODULE_PYUNO;
     FileID = gid_File_Lib_Python_so;
@@ -254,6 +265,7 @@
     Name = STRING(CONCAT2(libpython,UNXSUFFIX));
     Styles = (NETWORK,RELATIVE);
 End
+#endif
 
 
 File gid_File_Pyuno
@@ -264,6 +276,7 @@
     Styles          = (PACKED);
 End
 
+#ifndef SYSTEM_PYTHON
 File gid_File_python_sh
      BIN_FILE_BODY;
      ModuleID = GID_MODULE_PYUNO;
@@ -271,5 +284,6 @@
      Dir = GCFG_BINARY_DIR;
      Styles = (PACKED);
 End
+#endif
 
 #endif
diff -Nur oo_1.1_src.orig/solenv/inc/libs.mk oo_1.1_src/solenv/inc/libs.mk
--- oo_1.1_src.orig/solenv/inc/libs.mk	2003-07-02 08:43:33.000000000 -0500
+++ oo_1.1_src/solenv/inc/libs.mk	2003-10-25 22:58:53.000000000 -0500
@@ -171,13 +171,31 @@
 HM2LIBST=-lhmwrap
 LINGULIB=$(HM2LIBST)
 LNGLIB=-llng$(OFFICEUPD)$(DLLPOSTFIX)
+.IF "$(SYSTEM_EXPAT)" == "YES"
+EXPAT3RDLIB=-lexpat
+EXPATASCII3RDLIB=-lexpat
+.ELSE
 EXPAT3RDLIB=-lexpat_xmlparse -lexpat_xmltok
 EXPATASCII3RDLIB=-lascii_expat_xmlparse -lexpat_xmltok
+.ENDIF
+.IF "$(SYSTEM_ZLIB)" == "YES"
+ZLIB3RDLIB=-lz
+.ELSE
 ZLIB3RDLIB=-lzlib
+.ENDIF
+.IF "$(SYSTEM_JPEG)" == "YES"
+JPEG3RDLIB=-ljpeg
+.ELSE
 JPEG3RDLIB=-ljpeglib
+.ENDIF
 NEON3RDLIB=-lneon
+.IF "$(SYSTEM_DB)" == "YES"
+BERKELEYLIB=-ldb-$(SYSTEM_DB_VERSION)
+BERKELEYCPPLIB=-ldb_cxx-$(SYSTEM_DB_VERSION)
+.ELSE
 BERKELEYLIB=-ldb-3.2
 BERKELEYCPPLIB=-ldb_cxx-3.2
+.ENDIF
 CURLLIB=-lcurl
 SFX2LIB=-lsfx$(OFFICEUPD)$(DLLPOSTFIX)
 SFXLIB=-lsfx$(OFFICEUPD)$(DLLPOSTFIX)
diff -Nur oo_1.1_src.orig/tools/source/zcodec/makefile.mk oo_1.1_src/tools/source/zcodec/makefile.mk
--- oo_1.1_src.orig/tools/source/zcodec/makefile.mk	2000-09-18 12:03:10.000000000 -0500
+++ oo_1.1_src/tools/source/zcodec/makefile.mk	2003-10-25 11:05:13.000000000 -0500
@@ -71,6 +71,10 @@
 .INCLUDE :  settings.mk
 .INCLUDE :  sv.mk
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CFLAGS += -DSYSTEM_ZLIB
+.ENDIF
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=	$(SLO)$/zcodec.obj
diff -Nur oo_1.1_src.orig/tools/source/zcodec/zcodec.cxx oo_1.1_src/tools/source/zcodec/zcodec.cxx
--- oo_1.1_src.orig/tools/source/zcodec/zcodec.cxx	2000-09-18 12:03:10.000000000 -0500
+++ oo_1.1_src/tools/source/zcodec/zcodec.cxx	2003-10-25 11:06:32.000000000 -0500
@@ -62,9 +62,13 @@
 #ifndef _STREAM_HXX
 #include "stream.hxx"
 #endif
+#ifdef SYSTEM_ZLIB
+#include <zlib.h>
+#else
 #ifndef _ZLIB_H
 #include "zlib/zlib.h"
 #endif 
+#endif
 #ifndef _ZCODEC_HXX
 #include "zcodec.hxx"
 #endif
diff -Nur oo_1.1_src.orig/vcl/source/glyphs/makefile.mk oo_1.1_src/vcl/source/glyphs/makefile.mk
--- oo_1.1_src.orig/vcl/source/glyphs/makefile.mk	2002-02-15 09:52:27.000000000 -0600
+++ oo_1.1_src/vcl/source/glyphs/makefile.mk	2003-10-25 19:15:27.000000000 -0500
@@ -70,6 +70,10 @@
 .INCLUDE :  $(PRJ)$/util$/makefile.pmk
 .INCLUDE :  settings.mk
 
+.IF "$(SYSTEM_FREETYPE)" == "YES"
+CFLAGS += $(SYSTEM_FREETYPE_INCLUDES)
+.ENDIF
+
 # --- Files --------------------------------------------------------
 
 .IF "$(USE_BUILTIN_RASTERIZER)" != ""
diff -Nur oo_1.1_src.orig/xmlhelp/source/com/sun/star/help/CreateDb-4.1.java oo_1.1_src/xmlhelp/source/com/sun/star/help/CreateDb-4.1.java
--- oo_1.1_src.orig/xmlhelp/source/com/sun/star/help/CreateDb-4.1.java	1969-12-31 18:00:00.000000000 -0600
+++ oo_1.1_src/xmlhelp/source/com/sun/star/help/CreateDb-4.1.java	2003-10-25 16:26:46.000000000 -0500
@@ -0,0 +1,199 @@
+
+/**
+ * Title:        Help Content Provider<p>
+ * Description:  <p>
+ * Copyright:    Copyright (c) Andreas Bille ( abi )<p>
+ * Company:      Sun Microsystems. Inc<p>
+ * @author Andreas Bille ( abi )
+ * @version 1.0
+ */
+package com.sun.star.help;
+
+import java.io.*;
+import com.sleepycat.db.*;
+
+public class CreateDb {
+
+	public CreateDb()
+ 	{
+  	}
+
+
+
+   	void iterate( String dbName )
+    {
+    	System.out.println( dbName );
+    	Db table = null;
+		try
+		{
+			table = new Db( null,0 );
+		}
+		catch( DbException e )
+		{
+			System.out.println( "Error initializing database" );
+		}
+
+		table.set_error_stream( System.err );
+		table.set_errpfx( "HelpAccess" );
+		try
+		{
+			table.open( null,dbName,null,Db.DB_BTREE,Db.DB_RDONLY,0644 );
+			Dbc cursor = table.cursor( null,0 );
+
+			StringDbt key = new StringDbt();
+			StringDbt data = new StringDbt();
+			//
+			boolean first = true;
+  			key.set_flags( Db.DB_DBT_MALLOC );      // The cursor must allocate the necessary memory
+     		data.set_flags( Db.DB_DBT_MALLOC );
+		    String filePrefix = System.getProperty( "com.sun.star.help.Directory" );
+		    File outFile = new File( "e:/helpdata/test1/filelist" );
+			try
+			{
+			    outFile.createNewFile();
+			}
+			catch( IOException e )
+			{
+			    e.printStackTrace();
+			}
+
+			FileWriter outStream = null;
+			try
+			{
+			    outStream = new FileWriter( outFile );
+			}
+			catch( IOException e )
+			{
+				e.printStackTrace();
+			}
+
+			while( Db.DB_NOTFOUND != cursor.get( key,data,Db.DB_NEXT ) )
+			{
+   				// String keyStr = new String( key.get_data(),0,key.get_size() );
+       			// String dataStr = new String( data.get_data(),0,data.get_size() );
+
+				String keyStr = key.getString();
+				String dataStr = data.getString();
+				String testStr1 = data.getFile();
+				String testStr2 = data.getDatabase();
+				String testStr3 = data.getTitle();
+				if( ! testStr3.equals("") )
+					System.out.println( keyStr + " " + testStr1 + " " + testStr2 + " " + testStr3 );
+
+                String fileStr = filePrefix + "49/" + dataStr;
+                File aFile = new File( fileStr );
+                if( aFile.exists() )
+				{
+                	System.out.println( keyStr + " " + dataStr );
+				    outStream.write( keyStr + " " + dataStr );
+				}
+       			if( first )
+          		{
+					key.set_flags( Db.DB_DBT_REALLOC );
+     				data.set_flags( Db.DB_DBT_REALLOC );
+         			first = false;
+            	}
+            }
+		}
+		catch( DbRunRecoveryException e )
+		{
+			System.out.println( "Not able to create cursor: " + e.getMessage() );
+		}
+		catch (DbException dbe)
+		{
+			System.err.println("HelpAccess: " + dbe.toString());
+			System.exit(1);
+		}
+		catch (FileNotFoundException fnfe)
+		{
+			System.err.println("HelpAccess: " + fnfe.toString());
+			System.exit(1);
+		}
+		catch( IOException e )
+		{
+		    e.printStackTrace();
+		}
+	}
+
+
+
+  	public static void CreateDatabase()
+  	{
+    	String key1 = "1234";
+    	String data1 = "dumm/start.xml";
+    	String key2 = "4321";
+    	String data2 = "blub/embedded.xml";
+    	String key3 = "1235";
+    	String data3 = "dumm/testpage.xml";
+
+    	try
+    	{
+      		Db table = new Db(null, 0);
+      		table.set_error_stream(System.err);
+      		table.set_errpfx("AccessExample");
+      		table.open(null,"e:/rvp603b/help/helpaccess.db", null, Db.DB_HASH, Db.DB_CREATE, 0644);
+      		StringDbt key = new StringDbt(key1);
+      		StringDbt data = new StringDbt(data1);
+      		try
+      		{
+        		int err;
+        		if ((err = table.put(null, key, data, 0)) == Db.DB_KEYEXIST)
+        		{
+          			System.out.println("Key " + " already exists.");
+        		}
+      		}
+      		catch (DbException dbe)
+      		{
+        		System.out.println(dbe.toString());
+			}
+      		System.out.println(" inserted first key ");
+
+
+      		key = new StringDbt(key2);
+      		data = new StringDbt(data2);
+      		try
+      		{
+        		int err;
+        		if ((err = table.put(null, key, data, 0)) == Db.DB_KEYEXIST)
+        		{
+          			System.out.println("Key " + " already exists.");
+        		}
+      		}
+      		catch (DbException dbe)
+      		{
+        		System.out.println(dbe.toString());
+      		}
+      		System.out.println(" inserted second key ");
+
+
+      		key = new StringDbt(key3);
+      		data = new StringDbt(data3);
+      		try
+      		{
+        		int err;
+        		if ((err = table.put(null, key, data, 0)) == Db.DB_KEYEXIST)
+        		{
+          			System.out.println("Key " + " already exists.");
+        		}
+      		}
+      		catch (DbException dbe)
+      		{
+        		System.out.println(dbe.toString());
+      		}
+      		System.out.println(" inserted third key ");
+
+
+      		table.close(0);
+		}
+    	catch (DbException dbe)
+    	{
+      		System.err.println("AccessExample: " + dbe.toString());
+      		System.exit(1);
+    	}
+    	catch (FileNotFoundException fnfe)
+    	{
+      		System.err.println("AccessExample: " + fnfe.toString());
+      		System.exit(1);
+    	}
+  	}
+}
diff -Nur oo_1.1_src.orig/xmlhelp/source/com/sun/star/help/HelpDatabases-4.1.java oo_1.1_src/xmlhelp/source/com/sun/star/help/HelpDatabases-4.1.java
--- oo_1.1_src.orig/xmlhelp/source/com/sun/star/help/HelpDatabases-4.1.java	1969-12-31 18:00:00.000000000 -0600
+++ oo_1.1_src/xmlhelp/source/com/sun/star/help/HelpDatabases-4.1.java	2003-10-25 16:28:09.000000000 -0500
@@ -0,0 +1,590 @@
+package com.sun.star.help;
+
+import com.sleepycat.db.*;
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+
+
+public final class HelpDatabases
+{
+	// The office installation directory for the help system
+	// Has to be read from the configuration
+	private static String _installDirectory = System.getProperty( "com.sun.star.help.Directory" );
+
+ 	public static synchronized void setInstallPath( String _dir )
+  	{
+   		_installDirectory = _dir;
+   	}
+
+	// Holds the databases for the different languages;
+	private static final Hashtable _dbHash = new Hashtable();
+
+ 	// The same for the jar files
+	private static final Hashtable _jarHash = new Hashtable();
+
+
+	public static final class StaticModuleInformation
+ 	{
+  		private String _startId;
+    	private String _programSwitch;
+     	private String _title;
+		private String _heading;
+		private String _fulltext;
+		
+     	public StaticModuleInformation( String title,
+										String startId,
+										String programSwitch,
+										String heading,
+										String fulltext )
+      	{
+       		_title = title;
+         	_startId = startId;
+          	_programSwitch = programSwitch;
+			_heading = heading;
+			_fulltext = fulltext;
+       	}
+
+        public String get_title()   { return _title; }
+      	public String get_id() { return _startId; }
+       	public String get_program() { return _programSwitch; }
+		public String get_heading() { return _heading; }
+		public String get_fulltext() { return _fulltext; }
+  	}
+
+
+	public static final Hashtable _modInfo = new Hashtable();
+
+	
+	
+ 	public static String getURLMode()
+  	{
+		return new String( "with-jars" );
+		
+		// return new String( "with-files" );
+   	}
+
+	
+
+    private static final class DbFilter implements FilenameFilter
+    {
+    	public boolean accept( File dir, String name )
+     	{
+      		if( dir.exists() && ends( name ) )
+        		return true;
+          	else
+           		return false;
+      	}
+
+       	boolean ends( String name )
+        {
+        	int idx = name.lastIndexOf(  '.' );
+         	if( ( name.charAt( idx + 1 ) == 'd' ||
+				  name.charAt( idx + 1 ) == 'D' )    && 
+				( name.charAt( idx + 2 ) == 'b' ||
+				  name.charAt( idx + 2 ) == 'B' ) )
+          	{
+           		if( name.substring(0,idx).toLowerCase().equals("picture") )
+             		return false;
+
+          		return true;
+            }
+            else
+            	return false;
+        }
+    }
+
+
+    public static String[] getModuleList( String Language )
+    {
+		String dirName = _installDirectory + lang( Language );
+  		File dirFile = new File( dirName );
+    	if( dirFile.isDirectory() )
+			return dirFile.list( new DbFilter() );
+   		else
+     		return null;
+    }
+
+	public static String getInstallDirectory()
+	{
+	    return _installDirectory;
+	}
+
+
+	public static final HashSet langSet = new HashSet();
+	
+	
+	public static synchronized String lang( String Language )
+	{
+		String ret = Language;
+		if( ! langSet.contains( ret ) )
+		{
+			if( ! (new File( _installDirectory + ret )).exists() )
+			{
+				int idx;
+				if( ( idx = ret.indexOf( '-' ) ) != -1 ||    // Only one is true
+					( idx = ret.indexOf( '_' ) ) != -1 )
+					ret = ret.substring( 0,idx );
+			}
+			langSet.add( ret );
+		}
+
+		return ret;
+	}
+	
+	
+ 	public static synchronized StaticModuleInformation getStaticInformationForModule( String Module, String Language )
+  	{
+   		String key = lang(Language) + File.separator + Module;
+     	StaticModuleInformation info = ( StaticModuleInformation ) _modInfo.get( key );
+      	if( info == null )
+       	{
+   			String cfgDat = _installDirectory + key + ".cfg";
+			FileInputStream cfgFile = null;
+			try
+			{
+				cfgFile = new FileInputStream( cfgDat );
+			}
+			catch( FileNotFoundException e )
+			{
+				e.printStackTrace();
+			}
+  			try
+    		{
+				InputStreamReader input;
+				try
+				{
+					input = new InputStreamReader( cfgFile,"UTF8" );
+				}
+				catch( UnsupportedEncodingException e )
+				{
+					input = new InputStreamReader( cfgFile );
+				}
+						
+    			String fileContent = new String();
+   				char[] buffer = new char[128];
+   				while( input.read( buffer,0,128 ) != -1 )
+      			{
+         			fileContent += new String( buffer );
+           			buffer = new char[128];
+        		}
+				input.close();
+				cfgFile.close();
+
+				String current = new String();
+    			String lang = null,program = null,startid = null,title = null,heading = "",fulltext="";
+				for( int i = 0; i < fileContent.length(); ++i )
+    			{
+       				char ch = fileContent.charAt( i );
+       				if( ch == '\n' || ch == '\r' )
+           			{
+              			if( current.length() != 0 )
+                 		{
+                   			// Something to interpret
+							if( current.startsWith( "Title" ) )
+       						{
+                            	title = current.substring( current.indexOf('=') + 1 );
+             				}
+                 			else if( current.startsWith( "Start" ) )
+                    		{
+                            	startid = current.substring( current.indexOf('=') + 1 );
+                      		}
+                        	else if( current.startsWith( "Language" ) )
+                         	{
+                            	lang = current.substring( current.indexOf('=') + 1 );
+                          	}
+                           	else if( current.startsWith( "Program" ) )
+                            {
+                            	program = current.substring( current.indexOf('=') + 1 );
+                            }
+                           	else if( current.startsWith( "Heading" ) )
+                            {
+                            	heading = current.substring( current.indexOf('=') + 1 );
+                            }
+                           	else if( current.startsWith( "FullText" ) )
+                            {
+                            	fulltext = current.substring( current.indexOf('=') + 1 );
+                            }
+                   		}
+						current = new String();
+     				}
+					else
+     					current += ch;
+       			}
+          		info = new StaticModuleInformation( title,startid,program,heading,fulltext );
+            	_modInfo.put( key,info );
+  			}
+    		catch( Exception e )
+     		{
+      			System.err.println( "Corrupted cfg-file: " + cfgDat );
+        		e.printStackTrace();
+      		}
+        }
+		
+        return info;
+   	}
+
+
+
+	public static synchronized Db getDatabaseForLanguage( String Database,String Language )
+	{
+		if( Database == null || Language == null )
+			return null;
+		String key = lang(Language) + File.separator + Database;       // For example de/swriter
+		Db table = ( Db ) _dbHash.get( key );
+		if( table == null )
+		{
+            try
+            {
+				table = new Db( null,0 );
+
+				String tablePath = _installDirectory + key + ".db";
+				table.open( null,tablePath,null,Db.DB_BTREE,Db.DB_RDONLY,0644 );
+				_dbHash.put( key,table );
+            }
+            catch( DbException e )
+            {
+				System.err.println( "Unsupported language in helpsystem: " + Language );
+    			System.err.println( "module: " + Database );
+    			System.err.println( e.getMessage() );
+            }
+            catch( FileNotFoundException e )
+            {
+				System.err.println( "Unsupported language in helpsystem: " + Language );
+   				System.err.println( "module: " + Database );
+    			System.err.println( e.getMessage() );
+            }
+		}
+
+		return table;
+	}
+
+
+ 	static Hashtable _helptextHash = new Hashtable();
+
+
+	public static synchronized Db getHelptextDbForLanguage( String Database,String Language )
+	{
+		String key = lang( Language ) + File.separator + Database;       // For example de/swriter
+		Db table = ( Db ) _helptextHash.get( key );
+		if( table == null )
+		{
+            try
+            {
+				table = new Db( null,0 );
+
+				String tablePath = _installDirectory + key + ".ht";
+				table.open( null,tablePath,null,Db.DB_BTREE,Db.DB_RDONLY,0644 );
+				_dbHash.put( key,table );
+            }
+            catch( DbException e )
+            {
+				System.err.println( "Unsupported language in helpsystem: " + Language );
+    			System.err.println( "module: " + Database );
+    			System.err.println( e.getMessage() );
+            }
+            catch( FileNotFoundException e )
+            {
+				System.err.println( "Unsupported language in helpsystem: " + Language );
+   				System.err.println( "module: " + Database );
+    			System.err.println( e.getMessage() );
+            }
+		}
+
+		return table;
+	}
+
+
+
+	public static synchronized JarFile getJarFileForLanguage( String Database,String Language )
+	{
+		if( Language == null || Database == null )
+			return null;
+		
+		String key = lang(Language) + File.separator + Database;
+		JarFile jarFile = ( JarFile ) _jarHash.get( key );
+		if( jarFile == null )
+		{
+            try
+            {
+            	File file = new File( _installDirectory + key );
+             	if( file.exists() )
+              	{
+					jarFile = new JarFile( file );
+					_jarHash.put( key,jarFile );
+     			}
+        		else
+          			throw new java.io.IOException();
+            }
+            catch( IOException e )
+            {
+				System.err.println( "Jarfile not found: " + Database + " " + Language );
+            }
+		}
+
+		return jarFile;
+	}
+
+
+	public static InputStream getCssSheet()
+	{
+		try
+		{
+			return new FileInputStream( _installDirectory + "custom.css" );
+		}
+		catch( FileNotFoundException e )
+		{
+			return null;
+		}
+	}
+
+	
+	public static InputStream errorFile( String Language )
+	{
+		try 
+		{
+			return new FileInputStream( _installDirectory + lang(Language) + File.separator + "err.html" );
+		}
+		catch( IOException e )
+		{
+			String errorFile =
+				" <html><body>         "+
+				"     The requested document does not exist in the database !!            "+
+				" </body></html> ";
+			
+			return new ByteArrayInputStream( errorFile.getBytes() );
+		}
+	}
+
+
+
+	public static InputStream popupDocument( HelpURLParameter xPar )
+	{
+//  		String popupFile =
+//  			" <help:document xmlns:help=\"http://openoffice.org/2000/help\">         "+
+//  			" <help:body>" +
+//  			"  <help:popup-cut Id=\""+xPar.get_id()+"\" Eid=\""+xPar.get_eid()+"\"></help:popup-cut> " +
+//  		1	" </help:body></help:document> ";
+		
+		String popupFile =
+			" <html>                                                                                 "+
+			" <head>                                                                                 "+
+			" <help:css-file-link xmlns:help=\"http://openoffice.org/2000/help\"/>                   "+
+			" </head>                                                                                "+
+			" <body>                                                                                 "+
+			" <help:popup-cut Id=\""+xPar.get_id()+"\" Eid=\""+xPar.get_eid()+"\" xmlns:help=\"http://openoffice.org/2000/help\"></help:popup-cut>  "+
+			" </body>                                                                                "+
+			" </html>                                                                                ";
+		
+		System.out.println( popupFile );
+
+		return new ByteArrayInputStream( popupFile.getBytes() );
+	}
+
+
+	private static final Hashtable _keyword = new Hashtable();
+
+
+ 	public static final class KeywordInfo
+  	{
+   		int pos = 0;
+   		String[] listKey = new String[100];
+		String[][] listId;
+		String[][] listAnchor;
+  		String[][] listTitle;
+
+		public String [] getKeywordList()
+  		{
+    		return listKey;
+    	}
+
+     	public String[][] getIdList()
+      	{
+       		return listId;
+       	}
+
+
+		public String[][] getAnchorList()
+		{
+			return listAnchor;
+		}
+
+     	public String[][] getTitleList()
+      	{
+       		return listTitle;
+       	}
+
+     	private void realloc( int length )
+      	{
+    		String[] buff = listKey;
+        	listKey = new String[ length ];
+         	int count = ( listKey.length > buff.length ) ? buff.length : listKey.length;
+           	for( int i = 0; i < count; ++i )
+              	listKey[i] = buff[i];
+        	buff = null;
+       	}
+
+
+        public String[] getTitleForIndex( int i )
+        {
+			return listTitle[i];
+        }
+
+
+     	void insert( String id )
+		{
+			if( pos == listKey.length )
+				realloc( pos + 100 );
+			listKey[ pos++ ] = id;
+   		}
+
+
+      	public String[] insertId( int index,String ids )
+       	{
+        	int pos = 0;
+        	String[] test = new String[10];
+        	while( ids != null && ids.length() != 0 )
+         	{
+          		int idx = ids.indexOf( ';' );
+            	if( pos == test.length )
+             	{
+    				String[] buff = test;
+        			test = new String[ pos+10 ];
+           			for( int i = 0; i < buff.length; ++i )
+              			test[i] = buff[i];
+        			buff = null;
+              	}
+
+             	test[pos++] = ids.substring(0,idx);
+             	ids = ids.substring( 1+idx );
+          	}
+
+       		String[] buff = test;
+        	test = new String[ pos ];
+           	for( int i = 0; i < pos; ++i )
+            	test[i] = buff[i];
+
+      		listId[index] = test;
+			listAnchor[index] = new String[test.length];
+
+			for( int k = 0; k < listId[index].length; ++k )
+			{
+				if( listId[index][k] == null )
+				{
+					listId[index][k] = "";
+					listAnchor[index][k] = "";
+				}
+				else
+				{
+					int idx = listId[index][k].indexOf('#');
+					if( idx != -1 )
+					{
+						listAnchor[index][k] = listId[index][k].substring(1+idx).trim();
+						listId[index][k] = listId[index][k].substring(0,idx).trim();
+					}
+					else
+						listAnchor[index][k] = "";
+				}
+			}
+			
+			listTitle[index] = new String[test.length];
+   			return test;
+		}
+
+
+
+     	public void sort()
+      	{
+			realloc( pos );
+   			Arrays.sort( listKey );
+      		listId = new String[ listKey.length ][];
+      		listAnchor = new String[ listKey.length ][];
+        	listTitle = new String[ listKey.length ][];
+       	}
+   	}
+
+	
+ 	public static synchronized KeywordInfo getKeyword( String Database, String Language )
+  	{
+   		String keyStr = lang(Language) + File.separator + Database;
+		KeywordInfo info = ( KeywordInfo ) _keyword.get( keyStr );
+		
+  		if( info == null )
+    	{
+     		try
+       		{
+				HashMap internalHash = new HashMap();
+				String fileName = HelpDatabases.getInstallDirectory() + keyStr + ".key";
+        		Db table = new Db( null,0 );
+				System.err.println( fileName );
+				table.open( null,fileName,null,Db.DB_BTREE,Db.DB_RDONLY,0644 );
+				Dbc cursor = table.cursor( null,0 );
+				StringDbt key = new StringDbt();
+				StringDbt data = new StringDbt();
+
+				boolean first = true;
+  				key.set_flags( Db.DB_DBT_MALLOC );      // Initially the cursor must allocate the necessary memory
+     			data.set_flags( Db.DB_DBT_MALLOC );
+        		info = new KeywordInfo();
+
+				String keyStri;
+				
+				while( Db.DB_NOTFOUND != cursor.get( key,data,Db.DB_NEXT ) )
+				{
+					keyStri = key.getString();
+					info.insert( keyStri );
+		       		internalHash.put( keyStri,data.getString() );
+					if( first )
+          			{
+						key.set_flags( Db.DB_DBT_REALLOC );
+     					data.set_flags( Db.DB_DBT_REALLOC );
+         				first = false;
+            		}
+            	}
+
+             	info.sort();
+            	cursor.close();
+            	table.close( 0 );
+				
+    			String[] keywords = info.getKeywordList();
+       			Db table2 = getDatabaseForLanguage( Database,Language );
+       			for( int i = 0; i < keywords.length; ++i )
+          		{
+					String[] id = info.insertId( i,((String)internalHash.get( keywords[i])) );
+         			String[] title = info.getTitleForIndex( i );
+
+     				for( int j = 0; j < id.length; ++j )
+     				{
+						StringDbt key1 = new StringDbt(); 
+						key1.setString( id[j] );
+      					StringDbt data1 = new StringDbt();
+						try
+      					{
+         					table2.get( null,key1,data1,0 );
+							title[j] = data1.getTitle();
+       					}
+            			catch( Exception e )
+               			{
+							e.printStackTrace();
+                  			title[j] = "";
+                  		}
+         			}
+            	}
+
+            	_keyword.put( keyStr,info );
+            }
+			catch( Exception e )
+   			{
+				e.printStackTrace();
+				System.err.println( "any other exception in getKeyword: " + e.getMessage() );
+      		}
+		}
+
+		return info;
+	}
+
+}    // end class HelpDatabases
+
+
+
+
diff -Nur oo_1.1_src.orig/xmlhelp/source/com/sun/star/help/HelpIndexer-4.1.java oo_1.1_src/xmlhelp/source/com/sun/star/help/HelpIndexer-4.1.java
--- oo_1.1_src.orig/xmlhelp/source/com/sun/star/help/HelpIndexer-4.1.java	1969-12-31 18:00:00.000000000 -0600
+++ oo_1.1_src/xmlhelp/source/com/sun/star/help/HelpIndexer-4.1.java	2003-10-25 16:28:45.000000000 -0500
@@ -0,0 +1,774 @@
+/**
+ * Title:        <p>
+ * Description:  <p>
+ * Copyright:    Copyright (c) <p>
+ * Company:      <p>
+ * @author
+ * @version 1.0
+ */
+package com.sun.star.help;
+
+
+import java.io.*;
+import java.net.URL;
+import java.util.*;
+
+import org.w3c.dom.*;
+import com.sun.xml.tree.*;
+import org.xml.sax.*;
+import javax.xml.parsers.*;
+import com.jclark.xsl.sax.*;
+
+import com.sun.xmlsearch.util.*;
+import com.sun.xmlsearch.xml.qe.*;
+import com.sun.xmlsearch.xml.indexer.*;
+
+import com.sleepycat.db.*;
+import com.sun.star.help.HelpURLStreamHandlerFactory;
+
+public class HelpIndexer {
+
+	private HelpURLStreamHandlerFactory _urlHandler = null;
+	private String _language = null, _module = null, _system = null;
+
+
+	public HelpIndexer( HelpURLStreamHandlerFactory urlHandler,String language, String module, String system )
+  	{
+   		_urlHandler = urlHandler;
+		_system = system;
+  		_language = language;
+    	_module = module;
+  	}
+
+
+   	private final class TagInfo
+    {
+    	String _tag,_id;
+
+      	public TagInfo( String id,String tag )
+       	{
+        	_tag = tag;
+         	_id = id;
+        }
+
+		public String get_tag()
+  		{
+    		return _tag;
+    	}
+
+     	public String get_id()
+      	{
+       		return _id;
+       	}
+    }
+
+
+	private final class DocInfo
+ 	{
+  		private String _url = null,_id = null;
+
+    	private ArrayList _helptags = new ArrayList();
+
+
+  		public void append( String id,String tag )
+    	{
+     		_helptags.add( new TagInfo( id,tag ) );
+     	}
+
+
+      	public String getURL()
+       	{
+			return _url;
+        }
+
+		public void setURL( String url )
+  		{
+    		_url = url;
+      	}
+
+		public void setId( String id )
+  		{
+    		_id = id;
+      	}
+
+       	public String getId()
+        {
+        	return _id;
+        }
+
+        public ArrayList getAppendices()
+        {
+        	return _helptags;
+        }
+  	}
+
+
+	Hashtable _hashDocInfo = new Hashtable();
+	Hashtable _hashHelptext = new Hashtable();
+
+
+ 	private void schnitzel()
+  	{
+		// Determine the location of the database
+    	String installDirectory = HelpDatabases.getInstallDirectory();
+    	Db table = null;
+		
+  		try
+		{
+			table = new Db( null,0 );
+     		table.set_error_stream( System.err );
+			table.set_errpfx( "indexing" );
+
+
+   			// Create indexDirectory, if not existent
+     		String indexDirectory = installDirectory + _language + File.separator + _module + ".idx";
+      		File indexDir = new File( indexDirectory );
+       		if( indexDir.exists() && indexDir.isFile() )
+        		indexDir.delete();
+
+	        if( ! indexDir.exists() )
+    	    	indexDir.mkdir();
+
+        	indexDir = null;
+
+         	// Initialize the indexBuilder
+			XmlIndexBuilder builder = new XmlIndexBuilder( indexDirectory );
+
+ 			String[] translations = { "vnd.sun.star.help://", "#HLP#" };
+			PrefixTranslator translator = PrefixTranslator.makePrefixTranslator( translations );
+			builder.setPrefixTranslator( translator );
+
+        	builder.clearIndex();    			// Build index from scratch
+        	builder.setTransformLocation( installDirectory + "..\\StyleSheets\\Indexing\\" );
+			builder.init( "index" );
+
+
+     		// Determine and read the database
+        	String fileName = installDirectory
+          					+ _language
+                			+ File.separator
+                    		+ _module
+                       		+ ".db";
+
+			table.open( null,fileName,null,Db.DB_BTREE,Db.DB_RDONLY,0644 );
+			Dbc cursor = table.cursor( null,0 );
+			StringDbt key = new StringDbt();
+			StringDbt data = new StringDbt();
+
+			boolean first = true;
+  			key.set_flags( Db.DB_DBT_MALLOC );      // Initially the cursor must allocate the necessary memory
+     		data.set_flags( Db.DB_DBT_MALLOC );
+			while( Db.DB_NOTFOUND != cursor.get( key,data,Db.DB_NEXT ) )
+			{
+    			try
+        		{
+   					String keyStr = key.getString();
+        			String dataStr = data.getFile();
+					String tagStr = data.getHash();
+
+					DocInfo info = ( DocInfo ) _hashDocInfo.get( dataStr );
+
+         			if( info == null )
+         			{
+            			info = new DocInfo();
+            			_hashDocInfo.put( dataStr,info );
+            		}
+
+              		if( ! tagStr.equals( "" ) )
+              			info.append( keyStr,tagStr );
+					else
+     				{
+                    	String url = "vnd.sun.star.help://" + _module + "/" + keyStr + "?Language=" + _language;
+                    	info.setURL( url );
+                		info.setId( keyStr );
+                  	}
+				}
+    			catch( Exception e )
+       			{
+          		}
+       			if( first )
+          		{
+					key.set_flags( Db.DB_DBT_REALLOC );
+     				data.set_flags( Db.DB_DBT_REALLOC );
+         			first = false;
+            	}
+    		}
+			cursor.close();
+   			table.close( 0 );
+
+			System.out.println( "Indexing..." );
+      		Enumeration enum = _hashDocInfo.elements();
+        	int cut = 0;
+         	while( enum.hasMoreElements() && cut < 100000000 )
+         	{
+          		try
+            	{
+          			DocInfo info = ( DocInfo ) enum.nextElement();
+         			String url = info.getURL();
+					if( url == null )
+     				{
+         				System.out.println( "<----------------------------------->" );
+     					System.out.println( "big error: found helptext without URL" );
+          				System.out.println( "<----------------------------------->" );
+              			continue;
+          			}
+          			cut++;
+					
+           			_urlHandler.setMode( null );
+              		byte[] embResolved = getSourceDocument( url );
+//             		InputSource in = new InputSource( new ByteArrayInputStream( embResolved ) );
+					
+					ByteArrayInputStream inbyte = new ByteArrayInputStream(embResolved);
+					InputStreamReader inread;
+					try
+					{
+						inread = new InputStreamReader( inbyte,"UTF8" );
+					}
+					catch( UnsupportedEncodingException e )
+					{
+						inread = new InputStreamReader( inbyte );
+					}
+             		InputSource in = new InputSource( inread );
+
+              		in.setEncoding( "UTF8" );
+					Document docResolved = null;
+					try
+					{
+						docResolved	= XmlDocument.createXmlDocument( in,false );
+					}
+					catch( Exception e )
+					{
+						if( docResolved == null )
+							System.err.println( "Nullpointer" );
+						
+						System.err.println( e.getMessage() );
+					}
+
+                 	String id = info.getId();
+                  	if( id == null )
+                   		System.out.println( "Found tag without valid id" );
+                    else
+                		addKeywords( docResolved,info.getId() );
+					
+                  	Object[] attrList = info.getAppendices().toArray();
+                   	for( int i = 0; i < attrList.length; ++i )
+                    {
+                    	TagInfo tag = ( TagInfo ) attrList[i];
+     					Node node = extractHelptext( docResolved,tag.get_tag() );
+           				if( node != null )
+               			{
+							String text = dump(node);
+							_hashHelptext.put( tag.get_id(),text );
+                   		}
+                    }
+                 	_urlHandler.setMode( embResolved );
+					
+					int idx = url.indexOf( '?' );
+					if( idx != -1 )
+					 	url = url.substring( 0,idx );
+					System.out.println( url );
+                  	builder.indexDocument( new URL( url ),"" );
+                }
+                catch( Exception e )
+                {
+					System.err.println( e.getMessage() );
+				}
+         	}
+			
+			try
+			{
+				dumpHelptext();
+				_keywords.dump();
+				builder.close();
+			}
+			catch( Exception e )
+			{
+				System.err.println( e.getMessage() );
+			}
+    	}
+ 		catch( DbRunRecoveryException e )
+		{
+			System.out.println( "Not able to create cursor: " + e.getMessage() );
+     		System.exit(1);
+		}
+		catch( DbException e )
+		{
+			System.out.println( "Error initializing database" );
+     		System.exit(1);
+		}
+		catch (FileNotFoundException fnfe)
+		{
+			System.err.println("HelpAccess: " + fnfe.getMessage() );
+			System.exit(1);
+		}
+  		catch( java.lang.Exception e )
+    	{
+     		System.out.println( "any other exception" + e.getMessage() );
+     	}
+   	}
+
+
+
+    private final class NodeIterator
+    {
+		private final class StackElement
+  		{
+    		public boolean _isDone;
+      		public Node _node;
+
+    		StackElement( Node node )
+      		{
+        		_isDone = false;
+          		_node = node;
+            }
+    	}
+
+    	private Stack stack = new Stack();
+
+		public NodeIterator( Node node )
+  		{
+    		stack.push( new StackElement(node) );
+    	}
+
+     	void change()
+      	{
+       		((StackElement)(stack.peek()))._isDone = true;
+          	NodeList top = ((StackElement)(stack.peek()))._node.getChildNodes();
+          	for( int i = top.getLength()-1; i >= 0; --i )
+            	stack.push( new StackElement( top.item(i) ) );
+       	}
+
+     	public Node next()
+      	{
+       		if( stack.empty() ) return null;
+			while( ! ((StackElement)(stack.peek()))._isDone ) change();
+   			return ((StackElement)stack.pop())._node;
+		}
+    }
+
+
+    /**
+     *  Given a dom of the document, the next Help:Helptext following Help:HelpID value="tag" is extracted
+     */
+
+    private Node extractHelptext( Node node,String tag )
+    {
+    	boolean found = false;
+		Node test;
+		NodeIterator it = new NodeIterator( node );
+  		while( ( test=it.next() ) != null )
+		{
+			if( !found && test.getNodeName().equals("help:help-id" ) && ((Element)test).getAttribute("value").equals(tag) )
+   				found = true;
+       		if( found && test.getNodeName().equals("help:help-text") )
+         		return test;
+  		}
+    	return null;
+    }
+
+
+    private final class Keywords
+    {
+    	private Hashtable _hash = new Hashtable();
+
+     	class Data
+      	{
+       		int pos = 0;
+       		String[] _idList = new String[5];
+
+         	void append( String id )
+          	{
+				if( pos == _idList.length )
+				{
+    				String[] buff = _idList;
+        			_idList = new String[ pos + 5 ];
+           			for( int i = 0; i < buff.length; ++i )
+              			_idList[i] = buff[i];
+                 	buff = null;
+    			}
+				_idList[ pos++] = id;
+           	}
+
+
+            int getLength()
+            {
+            	return pos;
+            }
+
+            String getString()
+            {
+            	String ret = new String();
+            	for( int i = 0; i < pos; ++i )
+             	{
+              		ret += ( _idList[i] + ";" );
+              	}
+               	return ret;
+            }
+       	}   // end class data
+
+
+		public void insert( String key, String id )
+  		{
+    		Data data = (Data)_hash.get(key);
+      		if( data == null )
+        	{
+         		data = new Data();
+           		_hash.put( key,data );
+         	}
+          	data.append( id );
+    	}
+
+
+     	void dump()
+      	{
+			Enumeration enum = _hash.keys();
+   			int j = 0;
+			String[] list = new String[ _hash.size() ];
+   			while( enum.hasMoreElements() )
+      		{
+      			list[j++] = ( String ) enum.nextElement();
+           	}
+
+			Db table;
+  			try
+			{
+				table = new Db( null,0 );
+
+        		String fileName = HelpDatabases.getInstallDirectory()
+          						  + _language
+                			      + File.separator
+                    		      + _module
+                       		      + ".key";
+
+				table.open( null,fileName,null,Db.DB_BTREE,Db.DB_CREATE,0644 );
+
+            	for( int i = 0; i < list.length; ++i )
+            	{
+            		Data data = ( Data ) _hash.get( list[i] );
+              		StringDbt key = new StringDbt( list[i] );
+                	StringDbt value = new StringDbt( data.getString() );
+                 	table.put( null,key,value,0);
+            	}
+             	table.close( 0 );
+        	}
+         	catch( Exception e )
+          	{
+				System.out.println( "error writing keydata" );
+        	}
+       	}
+
+    }
+
+
+     void dumpHelptext()
+     {
+		Enumeration enum = _hashHelptext.keys();
+   		int j = 0;
+		String[] list = new String[ _hashHelptext.size() ];
+   		while( enum.hasMoreElements() )
+      	{
+      		list[j++] = ( String ) enum.nextElement();
+        }
+
+		Db table;
+  		try
+		{
+			table = new Db( null,0 );
+
+        	String fileName = HelpDatabases.getInstallDirectory()
+				            + _language
+                			+ File.separator
+                    		+ _module
+                       		+ ".ht";
+
+			table.open( null,fileName,null,Db.DB_BTREE,Db.DB_CREATE,0644 );
+
+            for( int i = 0; i < list.length; ++i )
+            {
+            	String data = ( String ) _hashHelptext.get( list[i] );
+              	StringDbt key = new StringDbt( list[i] );
+                StringDbt value = new StringDbt( data );
+                table.put( null,key,value,0);
+            }
+            table.close( 0 );
+        }
+        catch( Exception e )
+        {
+			System.out.println( "error writing keydata" );
+        }
+	}
+
+
+
+
+    Keywords _keywords = new Keywords();
+
+    private void addKeywords( Node node,String id )
+    {
+  		Node test;
+  		NodeIterator it = new NodeIterator( node );
+    	while( ( test=it.next() ) != null )
+     	{
+      		if( test.getNodeName().equals( "help:key-word" ) )
+        	{
+				Element element = ( Element ) test;
+				
+				String isEmbedded = element.getAttribute( "embedded" );
+				 
+				if( isEmbedded != null && isEmbedded.equals( "false" ) )
+				{
+					String keyword = element.getAttribute( "value" );
+					String getJump = element.getAttribute( "tag" );
+					
+					if( ! keyword.equals("") && !id.equals("") )
+						_keywords.insert( keyword,id + "#" + getJump );
+				}
+         	}
+      	}
+    }
+
+
+
+    /**
+     *  Returns a textual representation of
+     *  the node
+     */
+
+
+    private String dump( Node node )
+    {
+    	String app = new String();
+		if( node.hasChildNodes() )
+  		{
+    		NodeList list = node.getChildNodes();
+        	for( int i = 0; i < list.getLength(); ++ i )
+         		app += dump( list.item(i) );
+    	}
+     	if( node.getNodeType() == Node.ELEMENT_NODE )
+      	{
+			/*
+         	String start = "<" + node.getNodeName();
+       		NamedNodeMap attr = node.getAttributes();
+           	for( int j = 0; j < attr.getLength(); ++j )
+           	{
+            	start += ( " " + ((Attr)attr.item(j)).getName()+"=\"" + ((Attr)attr.item(j)).getValue() + "\"");
+            }
+            start += ">";
+          	String end = "</" + node.getNodeName() + ">";
+
+           	return start + app + end;
+            */
+       	}
+        else if( node.getNodeType() == Node.TEXT_NODE )
+        {
+        	return ((Text)node).toString();
+        }
+        return app;
+    }
+
+
+
+	// This is a configurable class, which capsulates the parser initialization stuff and all this things
+
+   	public static final class ParseStuff
+    {
+    	private final XSLProcessor _processor;
+     	private final OutputMethodHandlerImpl _output;
+
+
+		private ParseStuff()
+		{
+        	_processor = new XSLProcessorImpl();
+			
+			// Determine the parser
+         	SAXParserFactory spf = SAXParserFactory.newInstance();
+          	spf.setValidating( false );
+            try
+            {
+				_processor.setParser( spf.newSAXParser().getParser() );
+            }
+            catch( java.lang.Exception e )
+            {
+            	System.err.println( "<!-- NO HELP AVAILABLE: no parser found -->" );
+             	System.exit( 1 );
+            }			
+
+			// Determine the OutputMethodHandler
+			_output = new OutputMethodHandlerImpl( _processor );
+			_processor.setOutputMethodHandler( _output );
+		}
+		
+		// Loading from a URL
+      	public ParseStuff( URL url )
+       	{
+			this();
+			try
+			{
+				_processor.loadStylesheet( new InputSource( url.toExternalForm() ) );
+			}
+			catch( SAXException e )
+			{
+				System.err.println( "<!-- Syntactic error in stylesheet -->" );
+				System.err.println( e.getMessage() );
+   				System.exit( 1 );
+			}
+			catch( java.io.IOException e )
+			{
+				System.err.println( "<!-- Style sheet not found -->" );
+				System.err.println( e.getMessage() );
+   				System.exit( 1 );
+			}
+			System.out.println( "Using stylesheet: " + url.toExternalForm() );
+		}
+		
+
+		// Loading from a file
+      	public ParseStuff( String styleSheet )
+       	{
+			this();
+			try
+			{
+				_processor.loadStylesheet( new InputSource( new FileInputStream( styleSheet ) ) );
+			}
+			catch( SAXException e )
+			{
+				System.err.println( "<!-- Syntactic error in stylesheet -->" );
+				System.err.println( e.getMessage() );
+   				System.exit( 1 );
+			}
+			catch( java.io.IOException e )
+			{
+				System.err.println( "<!-- Style sheet not found: -->" );
+   				System.exit( 1 );
+			}
+			System.out.println( "Using stylesheet: " + styleSheet );
+		}
+		
+		
+  		public byte[] parse( String url )
+    	{
+			InputSource _in = new InputSource( url );
+   			_in.setEncoding( "UTF-8" );
+			
+			
+			HelpOutputStream _out = new HelpOutputStream();
+       		try
+        	{
+  				// OutputStreamDestination _dest = new OutputStreamDestination( _out );
+				HelpProvider.ProviderDestination _dest = new HelpProvider.ProviderDestination( _out,"UTF-8" );
+  				synchronized( this )
+     			{
+					_output.setDestination( _dest );
+					_processor.parse( _in );
+    				_out.flush();
+    			}
+         	}
+			catch( java.io.IOException e )
+			{
+				System.err.println( "no file corresponding to URL exists: " + url );
+				System.err.println( "no file corresponding to URL exists: " + e.getMessage() );
+				// System.exit( 1 );
+			}
+			catch( SAXException e )
+			{
+				System.err.println( "ill formed xml document: " + e.getMessage() );
+				System.err.println( "                    url: " + url );
+				// System.exit( 1 );
+			}
+			catch( Exception e )
+			{
+				System.err.println( "any other exception" );
+				System.err.println( e.getMessage() );
+			}
+			
+   			return _out.getBigBuffer();
+     	}
+
+
+      	public void setParameter( String key,Object value )
+       	{
+        	_processor.setParameter( key,value );
+        }
+		
+    }   // end class ParseStuff
+	
+
+
+	/**
+  	 *   Returns the embedding resolved document
+     */
+
+    ParseStuff _stuff = null;
+
+	byte[] getSourceDocument( String url )
+ 	{
+  		// Initialize
+  		if( _stuff == null )
+		{
+  			String styleSheet = HelpDatabases.getInstallDirectory() + "..\\StyleSheets\\Indexing\\ResEmb.xsl";
+    		_stuff = new ParseStuff( styleSheet );
+
+     		// Setting the parameters
+     		_stuff.setParameter( "Language", _language );
+     		_stuff.setParameter( "Database", _module );
+		}
+
+        // and parse
+		return _stuff.parse( url );
+  	}
+
+
+
+
+   	// Now has to be settled up
+	public static void main( String[] args ) throws Exception
+	{
+ 		System.setProperty( "XMLSEARCH", HelpDatabases.getInstallDirectory() );
+		if( args.length != 6 )
+  		{
+    		System.out.println( "Usage example: main -language de -module swriter -system WIN" );
+      		System.exit( 1 );
+    	}
+
+     	String language = null,module = null, system = null;
+
+      	for( int i = 0; i < 5; i+=2 )
+       	{
+     		if( args[i].trim().equals( "-language" ) )
+				language = args[i+1];
+   			else if( args[i].trim().equals( "-module" ) )
+     			module = args[i+1];
+       		else if( args[i].trim().equals( "-system" ) )
+         		system = args[i+1];
+        }
+
+       	if( language == null || module == null || system == null )
+        {
+    		System.out.println( "Usage example: main -language de -module swriter -system WIN" );
+      		System.exit( 1 );
+        }
+        else
+		{
+  			System.out.println( " Configuring for \"system\" = " + system);
+  			System.out.println( "                 \"module\" = " + module);
+  			System.out.println( "               \"language\" = " + language);
+  		}
+
+		try
+  		{
+    		String urlmode = HelpDatabases.getURLMode();
+      		HelpURLStreamHandlerFactory urlHandler = new HelpURLStreamHandlerFactory( urlmode );
+      		URL.setURLStreamHandlerFactory( urlHandler );
+
+        	HelpIndexer helpIndexer = new HelpIndexer( urlHandler,language,module,system );
+
+        	// helpIndexer.indexDatabase();
+         	helpIndexer.schnitzel();
+      	}
+    	catch( Exception e )
+    	{
+      		e.printStackTrace();
+    	}
+	}
+}
+
diff -Nur oo_1.1_src.orig/xmlhelp/source/cxxhelp/provider/databases.cxx oo_1.1_src/xmlhelp/source/cxxhelp/provider/databases.cxx
--- oo_1.1_src.orig/xmlhelp/source/cxxhelp/provider/databases.cxx	2003-04-04 11:09:36.000000000 -0600
+++ oo_1.1_src/xmlhelp/source/cxxhelp/provider/databases.cxx	2003-10-25 20:27:52.000000000 -0500
@@ -60,7 +60,12 @@
  ************************************************************************/
 
 
+#ifdef SYSTEM_DB
+#include <db_cxx.h>
+#define DB_VER (1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR)
+#else
 #include <berkeleydb/db_cxx.h>
+#endif
 #ifndef _VOS_DIAGNOSE_HXX_
 #include <vos/diagnose.hxx>
 #endif
@@ -497,7 +502,15 @@
 		
 		rtl::OString fileName( fileNameOU.getStr(),fileNameOU.getLength(),osl_getThreadTextEncoding() );
 		
+#ifdef SYSTEM_DB
+#if (DB_VER >= 4100)
+		if( table->open( NULL,fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#else
+		if( table->open( fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#endif
+#else
 		if( table->open( fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#endif
 		{
 			table->close( 0 );
 			delete table;
@@ -711,7 +724,15 @@
                                osl_getThreadTextEncoding() );
 		
 		Db table(0,DB_CXX_NO_EXCEPTIONS);
+#ifdef SYSTEM_DB
+#if (DB_VER >= 4100)
+		if( 0 == table.open( NULL,fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#else
 		if( 0 == table.open( fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#endif
+#else
+		if( 0 == table.open( fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
+#endif
 		{   
 			std::vector<KeywordInfo::KeywordElement> aVector;
 			Db* idmap = getBerkeley( Database,Language );
diff -Nur oo_1.1_src.orig/xmlhelp/source/cxxhelp/provider/makefile.mk oo_1.1_src/xmlhelp/source/cxxhelp/provider/makefile.mk
--- oo_1.1_src.orig/xmlhelp/source/cxxhelp/provider/makefile.mk	2003-04-28 11:19:35.000000000 -0500
+++ oo_1.1_src/xmlhelp/source/cxxhelp/provider/makefile.mk	2003-10-25 20:29:18.000000000 -0500
@@ -75,6 +75,10 @@
 
 CFLAGS +=  -DHAVE_EXPAT_H
 
+.IF "$(SYSTEM_DB)" == "YES"
+CFLAGS += -DSYSTEM_DB
+.ENDIF
+
 .IF "$(GUI)"=="WNT"
 CFLAGS+=-GR
 .ENDIF
diff -Nur oo_1.1_src.orig/xmlhelp/source/cxxhelp/provider/urlparameter.cxx oo_1.1_src/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
--- oo_1.1_src.orig/xmlhelp/source/cxxhelp/provider/urlparameter.cxx	2003-08-05 04:42:33.000000000 -0500
+++ oo_1.1_src/xmlhelp/source/cxxhelp/provider/urlparameter.cxx	2003-10-25 16:34:38.000000000 -0500
@@ -93,9 +93,13 @@
 #ifndef ShandlerHIncl
 #include <sablot/shandler.h>
 #endif
+#ifdef SYSTEM_DB
+#include <db_cxx.h>
+#else
 #ifndef _DB_CXX_H_
 #include <berkeleydb/db_cxx.h>
 #endif
+#endif
 #ifndef _URLPARAMETER_HXX_
 #include <provider/urlparameter.hxx>
 #endif
diff -Nur oo_1.1_src.orig/xmlhelp/source/treeview/makefile.mk oo_1.1_src/xmlhelp/source/treeview/makefile.mk
--- oo_1.1_src.orig/xmlhelp/source/treeview/makefile.mk	2001-07-18 05:30:44.000000000 -0500
+++ oo_1.1_src/xmlhelp/source/treeview/makefile.mk	2003-10-25 14:20:02.000000000 -0500
@@ -72,6 +72,10 @@
 
 .INCLUDE: settings.mk
 
+.IF "$(SYSTEM_EXPAT)" == "YES"
+CFLAGS += -DSYSTEM_EXPAT
+.ENDIF
+
 SLOFILES=\
 	$(SLO)$/tvfactory.obj  \
 	$(SLO)$/tvread.obj
diff -Nur oo_1.1_src.orig/xmlhelp/source/treeview/tvread.cxx oo_1.1_src/xmlhelp/source/treeview/tvread.cxx
--- oo_1.1_src.orig/xmlhelp/source/treeview/tvread.cxx	2001-11-08 10:42:46.000000000 -0600
+++ oo_1.1_src/xmlhelp/source/treeview/tvread.cxx	2003-10-25 14:19:06.000000000 -0500
@@ -8,9 +8,13 @@
 #ifndef _TREEVIEW_TVREAD_HXX_
 #include "tvread.hxx"
 #endif
+#ifdef SYSTEM_EXPAT
+#include <expat.h>
+#else
 #ifndef XmlParse_INCLUDED
 #include <expat/xmlparse.h>
 #endif
+#endif
 #ifndef _OSL_FILE_HXX_
 #include <osl/file.hxx>
 #endif
diff -Nur oo_1.1_src.orig/zlib/makefile.mk oo_1.1_src/zlib/makefile.mk
--- oo_1.1_src.orig/zlib/makefile.mk	2003-03-27 12:13:15.000000000 -0600
+++ oo_1.1_src/zlib/makefile.mk	2003-10-25 00:34:35.000000000 -0500
@@ -65,6 +65,11 @@
 PRJNAME=zlib
 TARGET=zlib
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+all:
+	@echo "Using System Installed zlib..."
+.ENDIF
+
 # --- Settings -----------------------------------------------------
 
 .INCLUDE :	settings.mk
