[PATCH] bootstrap replacement c++ help component

Caolán McNamara caolanm at redhat.com
Wed Feb 15 02:03:24 PST 2012


---
 config_host.mk.in                                  |    3 -
 configure.in                                       |   86 -----------
 postprocess/packcomponents/makefile.mk             |    5 +-
 scp2/source/ooo/file_library_ooo.scp               |   11 ++
 scp2/source/ooo/file_ooo.scp                       |   11 --
 scp2/source/ooo/makefile.mk                        |    4 -
 scp2/source/ooo/module_hidden_ooo.scp              |    6 +-
 solenv/inc/extension_helplink.mk                   |   21 +---
 solenv/inc/settings.mk                             |    1 +
 xmlhelp/prj/build.lst                              |    4 +-
 xmlhelp/prj/d.lst                                  |    4 +-
 xmlhelp/source/cxxhelp/provider/databases.cxx      |    2 +
 .../source/cxxhelp/provider/resultsetforquery.cxx  |    4 +-
 .../helpcomponent/CLuceneHelpWrapper.component     |   35 +++++
 .../source/helpcomponent/CLuceneHelpWrapper.cxx    |  161 ++++++++++++++++++++
 xmlhelp/source/helpcomponent/makefile.mk           |   68 ++++++++
 16 files changed, 290 insertions(+), 136 deletions(-)
 create mode 100755 xmlhelp/source/helpcomponent/CLuceneHelpWrapper.component
 create mode 100644 xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx
 create mode 100755 xmlhelp/source/helpcomponent/makefile.mk

diff --git a/config_host.mk.in b/config_host.mk.in
index 8d38959..b0b215a 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -256,8 +256,6 @@ export LIBXSLT_LIBS=@LIBXSLT_LIBS@
 export LINK_X64_BINARY=@LINK_X64_BINARY@
 export LO_PATH=@LO_PATH@
 @x_Cygwin@ export LS=@WIN_LS@
-export LUCENE_ANALYZERS_JAR=@LUCENE_ANALYZERS_JAR@
-export LUCENE_CORE_JAR=@LUCENE_CORE_JAR@
 export MANDIR=@MANDIR@
 export MACOSX_DEPLOYMENT_TARGET=@MACOSX_DEPLOYMENT_TARGET@
 export MACOSX_DEPLOYMENT_TARGET_FOR_BUILD=@MACOSX_DEPLOYMENT_TARGET_FOR_BUILD@
@@ -432,7 +430,6 @@ export SYSTEM_LIBXML=@SYSTEM_LIBXML@
 export SYSTEM_LIBXSLT=@SYSTEM_LIBXSLT@
 export SYSTEM_LIBXSLT_FOR_BUILD=@SYSTEM_LIBXSLT_FOR_BUILD@
 export SYSTEM_LPSOLVE=@SYSTEM_LPSOLVE@
-export SYSTEM_LUCENE=@SYSTEM_LUCENE@
 export SYSTEM_MDDS=@SYSTEM_MDDS@
 export SYSTEM_MESA_HEADERS=@SYSTEM_MESA_HEADERS@
 export SYSTEM_MOZILLA=@SYSTEM_MOZILLA@
diff --git a/configure.in b/configure.in
index 0f5ba8a..b6118bf 100644
--- a/configure.in
+++ b/configure.in
@@ -1163,26 +1163,11 @@ AC_ARG_WITH(system-db,
         [Use Berkeley db already on system.]),,
     [with_system_db="$with_system_libs"])
 
-AC_ARG_WITH(system-lucene,
-    AS_HELP_STRING([--with-system-lucene],
-        [Use Lucene already on system.]),,
-    [with_system_lucene="$with_system_jars"])
-
 AC_ARG_WITH(system-apache-commons,
     AS_HELP_STRING([--with-system-apache-commons],
         [Use Apache commons libraries already on system.]),,
     [with_system_apache_commons="$with_system_jars"])
 
-AC_ARG_WITH(lucene-core-jar,
-    AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
-        [Specify path to jarfile manually.]),
-    LUCENE_CORE_JAR=$withval)
-
-AC_ARG_WITH(lucene-analyzers-jar,
-    AS_HELP_STRING([--with-lucene-analyzers-jar=JARFILE],
-        [Specify path to jarfile manually.]),
-    LUCENE_ANALYZERS_JAR=$withval ,)
-
 AC_ARG_WITH(system-mysql,
     AS_HELP_STRING([--with-system-mysql],
         [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice
@@ -6085,77 +6070,6 @@ AC_SUBST(SYSTEM_DB_CFLAGS)
 AC_SUBST(DB_LIB)
 AC_SUBST(DB_CPPLIB)
 
-dnl ===================================================================
-dnl Check for system lucene
-dnl ===================================================================
-if test "$with_java" != "no"; then
-AC_MSG_CHECKING([which lucene to use])
-if test "$with_system_lucene" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LUCENE=YES
-    if test -z $LUCENE_CORE_JAR; then
-         AC_CHECK_FILE(/usr/share/java/lucene-core-2.3.jar,
-            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.3.jar ],
-            [
-              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
-                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
-                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
-                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
-                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
-                  )
-                ]
-              )
-            ]
-         )
-    else
-        AC_CHECK_FILE($LUCENE_CORE_JAR, [],
-               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
-    fi
-
-    if test -z $LUCENE_ANALYZERS_JAR; then
-        AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
-            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
-            [
-              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
-                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
-                [ AC_CHECK_FILE(/usr/share/java/lucene-analyzers.jar,
-                   [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers.jar ],
-                   [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
-                  )
-                ]
-              )
-            ]
-        )
-    else
-        AC_CHECK_FILE($LUCENE_CORE_JAR, [],
-               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
-    fi
-    AC_MSG_CHECKING([whether lucene is version 2.x])
-    export LUCENE_CORE_JAR
-    if $PERL -e 'use Archive::Zip;
-            my $file = "$ENV{'LUCENE_CORE_JAR'}";
-            my $zip = Archive::Zip->new( $file );
-            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
-            if ( $mf =~ m/Specification-Version: 2.*/ ) {
-                exit 0;
-            } else {
-                exit 1;
-            }'; then
-        AC_MSG_RESULT([yes])
-    else
-        AC_MSG_ERROR([no, you need lucene 2])
-    fi
-
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LUCENE=NO
-    BUILD_TYPE="$BUILD_TYPE LUCENE"
-fi
-fi
-AC_SUBST(SYSTEM_LUCENE)
-AC_SUBST(LUCENE_CORE_JAR)
-AC_SUBST(LUCENE_ANALYZERS_JAR)
-
 AC_MSG_CHECKING([whether to build the MySQL Connector extension])
 if test "x$enable_ext_mysql_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
     AC_MSG_RESULT([yes])
diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk
index c79a28a..9041cba 100644
--- a/postprocess/packcomponents/makefile.mk
+++ b/postprocess/packcomponents/makefile.mk
@@ -174,6 +174,7 @@ my_components += \
     syssh \
     tvhlp1 \
     ucpchelp1 \
+    CLuceneHelpWrapper \
 
 .ENDIF
 
@@ -248,10 +249,6 @@ my_components += component/framework/util/lomenubar
 .END
 
 .IF "$(SOLAR_JAVA)" == "TRUE"
-.IF "$(BUILD_TYPE)" != "$(BUILD_TYPE:s/DESKTOP//)"
-my_components += \
-    LuceneHelpWrapper
-.ENDIF
 my_components += \
     component/xmerge/source/bridge/XMergeBridge \
     component/filter/source/xsltfilter/XSLTFilter.jar \
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 3d46339..c8458bf 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -1237,6 +1237,17 @@ File gid_File_Lib_Tvhlp1
   #endif
 End
 
+File gid_File_Lib_CLuceneHelpWrapper
+    LIB_FILE_BODY;
+    Styles = (PACKED);
+    Dir = SCP2_OOO_BIN_DIR;
+  #ifdef UNX
+    Name = STRING(CONCAT2(libCLuceneHelpWrapper,UNXSUFFIX));
+  #else
+    Name = "libCLuceneHelpWrapper.dll";
+  #endif
+End
+
 File gid_File_Lib_Ucb1
     LIB_FILE_BODY;
     Styles = (PACKED);
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index cae313a..5bc5ced 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -391,17 +391,6 @@ End
 #endif
 
 #ifdef SOLAR_JAVA
-#ifndef SYSTEM_LUCENE
-STD_JAR_FILE( gid_File_Jar_Lucene_Core, lucene-core-2.3 )
-STD_JAR_FILE( gid_File_Jar_Lucene_Analyzers, lucene-analyzers-2.3 )
-#endif
-#endif
-
-#ifdef SOLAR_JAVA
-STD_JAR_FILE( gid_File_Jar_Lucenehelpwrapper, LuceneHelpWrapper )
-#endif
-
-#ifdef SOLAR_JAVA
 
 #ifndef MACOSX
 
diff --git a/scp2/source/ooo/makefile.mk b/scp2/source/ooo/makefile.mk
index 244cf55..bd1036b 100644
--- a/scp2/source/ooo/makefile.mk
+++ b/scp2/source/ooo/makefile.mk
@@ -194,10 +194,6 @@ SCPDEFS+=-DSYSTEM_SAXON -DSAXON_JAR=\""file://$(SAXON_JAR)"\"
 SCPDEFS+=-DGCJ
 .ENDIF
 
-.IF "$(SYSTEM_LUCENE)" == "YES"
-SCPDEFS+=-DSYSTEM_LUCENE
-.ENDIF
-
 .IF "$(SYSTEM_ICU)" == "YES"
 SCPDEFS+=\
     -DSYSTEM_ICU \
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index 67499de..89b43b8 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -159,9 +159,6 @@ Module gid_Module_Root_Files_3
 	gid_File_Jar_Xflatxml,
 	gid_File_Jar_Xmerge,
 	gid_File_Jar_Xmergebridge,
-	gid_File_Jar_Lucene_Core,
-	gid_File_Jar_Lucene_Analyzers,
-	gid_File_Jar_Lucenehelpwrapper,
 	gid_File_Rdb_Offapi,
 	gid_Starregistry_Services_Rdb);
 End
@@ -339,8 +336,9 @@ Module gid_Module_Root_Files_5
 	gid_File_Lib_Dlgprov,
 	gid_File_Lib_Stringresource,
 	gid_File_Lib_Ldapbe2,
-	gid_File_Lib_Comphelper2,
 	gid_File_Lib_Cached1,
+        gid_File_Lib_CLuceneHelpWrapper,
+	gid_File_Lib_Comphelper2,
 	gid_File_Lib_Curl,
 	gid_Unixlink_File_Lib_Curl,
 	gid_File_Lib_Db,
diff --git a/solenv/inc/extension_helplink.mk b/solenv/inc/extension_helplink.mk
index df61f42..c515669 100644
--- a/solenv/inc/extension_helplink.mk
+++ b/solenv/inc/extension_helplink.mk
@@ -25,18 +25,6 @@
 #
 #*************************************************************************
 
-my_cp:=$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)/jaxp.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/juh.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/parser.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/unoil.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/ridl.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/jurt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/xmlsearch.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/LuceneHelpWrapper.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/HelpIndexerTool.jar$
-
-.IF "$(SYSTEM_LUCENE)" == "YES"
-my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR)
-.ELSE
-my_cp!:=$(my_cp)$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-core-2.3.jar$(PATH_SEPERATOR)$(SOLARBINDIR)/lucene-analyzers-2.3.jar
-.ENDIF
-
-.IF "$(SYSTEM_DB)" != "YES"
-JAVA_LIBRARY_PATH= -Djava.library.path=$(SOLARSHAREDBIN)
-.ENDIF
-
 #aux_alllangiso*:=$(foreach,i,$(alllangiso) $(foreach,j,$(aux_langdirs) $(eq,$i,$j  $i $(NULL))))
 aux_alllangiso*:=$(alllangiso)
 
@@ -68,12 +56,9 @@ $(HELPLINKALLTARGETS) : $(foreach,i,$(LINKLINKFILES) $(XHPLINKSRC)/$$(@:b:s/_/./
 .IF "$(SOLAR_JAVA)" == "TRUE"
 # cleanup index dir
     -$(RM) $(XHPLINKSRC)/{$(subst,$(TARGET)_$(LINKNAME)_, $(@:b))}/$(LINKNAME).idxl/*
-.IF "$(CHECK_LUCENCE_INDEXER_OUTPUT)" == ""
-    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVA_LIBRARY_PATH) -cp "$(my_cp)" com.sun.star.help.HelpIndexerTool -extension -lang $(@:b:s/_/./:e:s/.//) -mod $(LINKNAME) -zipdir $(XHPLINKSRC)/{$(subst,$(TARGET)_$(LINKNAME)_, $(@:b))} && $(TOUCH) $@
-.ELSE
-    $(COMMAND_ECHO)$(JAVAI) $(JAVAIFLAGS) $(JAVA_LIBRARY_PATH) -cp "$(my_cp)" com.sun.star.help.HelpIndexerTool -extension -lang $(@:b:s/_/./:e:s/.//) -mod $(LINKNAME) -zipdir $(XHPLINKSRC)/{$(subst,$(TARGET)_$(LINKNAME)_, $(@:b))} -checkcfsandsegname _0 _3  && $(TOUCH) $@
-.ENDIF
-.ELSE
+    $(HELPINDEXER) -lang $(@:b:s/_/./:e:s/.//) -mod $(LINKNAME) -srcdir $(XHPLINKSRC)/{$(subst,$(TARGET)_$(LINKNAME)_, $(@:b))} -zipdir $(XHPLINKSRC)/{$(subst,$(TARGET)_$(LINKNAME)_, $(@:b))} && $(TOUCH) $@
     -$(RM) $(XHPLINKSRC)/$(@:b:s/_/./:e:s/.//)/content/*.*
+    -$(RMDIR) $(XHPLINKSRC)/$(@:b:s/_/./:e:s/.//)/content
     -$(RM) $(XHPLINKSRC)/$(@:b:s/_/./:e:s/.//)/caption/*.*
+    -$(RMDIR) $(XHPLINKSRC)/$(@:b:s/_/./:e:s/.//)/caption
 .ENDIF
diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
index 65751eb..278329d 100644
--- a/solenv/inc/settings.mk
+++ b/solenv/inc/settings.mk
@@ -1006,6 +1006,7 @@ CPPUNITTESTER=$(AUGMENT_LIBRARY_PATH_LOCAL) $(GDBCPPUNITTRACE) $(VALGRINDTOOL) $
 HELPEX=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/helpex
 LNGCONVEX=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/lngconvex
 HELPLINKER=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/HelpLinker
+HELPINDEXER=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/HelpIndexer
 
 .IF "$(JAVAINTERPRETER)" == ""
 JAVA*:=java
diff --git a/xmlhelp/prj/build.lst b/xmlhelp/prj/build.lst
index 446a9df..19ca1fc 100644
--- a/xmlhelp/prj/build.lst
+++ b/xmlhelp/prj/build.lst
@@ -1,7 +1,7 @@
-xh      xmlhelp :       comphelper ucbhelper LIBXSLT:libxslt unoil BERKELEYDB:berkeleydb LUCENE:lucene javaunohelper DESKTOP:l10ntools unotools NULL
+xh      xmlhelp :       comphelper ucbhelper LIBXSLT:libxslt unoil BERKELEYDB:berkeleydb javaunohelper DESKTOP:l10ntools unotools NULL
 xh	xmlhelp									usr1	-	all	xh_mkout NULL
 xh	xmlhelp\source\treeview					nmake	-	all	xh_treeview NULL
-xh	xmlhelp\source\com\sun\star\help		nmake	-	all	xh_help NULL
+xh	xmlhelp\source\helpcomponent			nmake	-	all	xh_help NULL
 xh	xmlhelp\source\cxxhelp\util				nmake	-	all	xh_cutil NULL
 xh	xmlhelp\source\cxxhelp\qe				nmake	-	all	xh_qe NULL
 xh	xmlhelp\source\cxxhelp\provider			nmake	-	all	xh_provider NULL
diff --git a/xmlhelp/prj/d.lst b/xmlhelp/prj/d.lst
index 11b504a..8ce9628 100644
--- a/xmlhelp/prj/d.lst
+++ b/xmlhelp/prj/d.lst
@@ -1,12 +1,10 @@
 ..\%__SRC%\bin\*.dll %_DEST%\bin\*.*
-..\%__SRC%\bin\HelpLinker* %_DEST%\bin
 ..\%__SRC%\lib\lib*.so %_DEST%\lib
 ..\%__SRC%\lib\*.dylib %_DEST%\lib\*.*
 ..\%__SRC%\class\*.jar %_DEST%\bin\*.*
 ..\util\ucpchelp.xml %_DEST%\xml\ucpchelp.xml
 ..\util\*.xsl %_DEST%\bin\*.*
-..\%__SRC%\lib\ihelplinker.lib %_DEST%\lib\ihelplinker.lib
 ..\%__SRC%\bin\helpxsl.zip %_DEST%\pck\helpxsl.zip
-..\%__SRC%\misc\LuceneHelpWrapper.component %_DEST%\xml\LuceneHelpWrapper.component
+..\%__SRC%\misc\CLuceneHelpWrapper.component %_DEST%\xml\CLuceneHelpWrapper.component
 ..\%__SRC%\misc\tvhlp1.component %_DEST%\xml\tvhlp1.component
 ..\%__SRC%\misc\ucpchelp1.component %_DEST%\xml\ucpchelp1.component
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 4a4a756..7ee812e 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -2086,6 +2086,8 @@ rtl::OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o
 
 rtl::OUString IndexFolderIterator::implGetIndexFolderFromPackage( bool& o_rbTemporary, Reference< deployment::XPackage > xPackage )
 {
+    fprintf(stderr, "IndexFolderIterator::implGetIndexFolderFromPackage\n");
+
     rtl::OUString aIndexFolder =
         implGetFileFromPackage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".idxl" )), xPackage );
 
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
index ec175cc..767ce89 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx
@@ -84,6 +84,8 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF
       m_pDatabases( pDatabases ),
       m_aURLParameter( aURLParameter )
 {
+    fprintf(stderr, "ResultSetForQuery::ResultSetForQuery\n");
+
     Reference< XTransliteration > xTrans(
         xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.Transliteration" )) ),
         UNO_QUERY );
@@ -94,7 +96,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF
         xTrans->loadModule(TransliterationModules_UPPERCASE_LOWERCASE,
                            aLocale );
 
-    // Access Lucene via XInvocation
+    // Access CLucene via XInvocation
     Reference< script::XInvocation > xInvocation(
         xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.help.HelpSearch" )) ),
         UNO_QUERY );
diff --git a/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.component b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.component
new file mode 100755
index 0000000..fbe7828f
--- /dev/null
+++ b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
+ *  (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ -->
+<component loader="com.sun.star.loader.SharedLibrary"
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="libreoffice.CLuceneWrapper">
+    <service name="com.sun.star.help.HelpIndexer"/>
+    <service name="com.sun.star.help.HelpSearch"/>
+  </implementation>
+</component>
diff --git a/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx
new file mode 100644
index 0000000..6e800f8
--- /dev/null
+++ b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2010 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
+ *  (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implementationentry.hxx>
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::script;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+
+class CLuceneHelpWrapper : public WeakImplHelper2<XServiceInfo, XInvocation>
+{
+public:
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+        throw (RuntimeException);
+
+    virtual sal_Bool SAL_CALL supportsService(const OUString&)
+        throw (RuntimeException);
+
+    virtual Sequence< OUString > SAL_CALL
+    getSupportedServiceNames() throw (RuntimeException);
+
+    // XInvocation
+    virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw( RuntimeException )
+    {
+        return Reference< XIntrospectionAccess >();
+    }
+    virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
+        throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException );
+    virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value)
+        throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException )
+    {
+        throw UnknownPropertyException();
+    }
+    virtual Any SAL_CALL getValue(const OUString&) throw( UnknownPropertyException, RuntimeException )
+    {
+        throw UnknownPropertyException();
+    }
+    virtual sal_Bool SAL_CALL hasMethod(const OUString& rName) throw( RuntimeException )
+    {
+        return rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("search"))
+            || rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("createIndex"));
+    }
+    virtual sal_Bool SAL_CALL hasProperty(const OUString&) throw( RuntimeException )
+    {
+        return sal_False;
+    }
+};
+
+Any CLuceneHelpWrapper::invoke(const OUString& rFunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
+        throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException )
+{
+    fprintf(stderr, "invoke something or other, %s\n", rtl::OUStringToOString(rFunctionName, RTL_TEXTENCODING_UTF8).getStr());
+    if (rFunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("search")))
+        fprintf(stderr, "implement me, do search thing from helpsearch.cxx here");
+    else if (rFunctionName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("createIndex")))
+        fprintf(stderr, "implement me, do indexing thing for extensions with help, but without pre-created index, make need to split l10ntools HelpIndexer tool into a lib and header that we can link to here");
+    else
+        throw IllegalArgumentException();
+}
+
+namespace
+{
+    Reference<XInterface> create( Reference<XComponentContext> const & /*xContext*/ )
+    {
+        return static_cast< ::cppu::OWeakObject * >(new CLuceneHelpWrapper);
+    }
+
+    OUString getImplName()
+    {
+        return OUString(RTL_CONSTASCII_USTRINGPARAM("libreoffice.CLuceneWrapper"));
+    }
+
+    Sequence< OUString > getSuppServices()
+    {
+        OUString sHelpIndexer(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.help.HelpIndexer"));
+        OUString sHelpSearch(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.help.HelpSearch"));
+        Sequence< OUString > aServiceNames(2);
+        aServiceNames[0] = sHelpIndexer;
+        aServiceNames[1] = sHelpSearch;
+        return aServiceNames;
+    }
+}
+
+OUString CLuceneHelpWrapper::getImplementationName()
+    throw (RuntimeException)
+{
+    return getImplName();
+}
+
+sal_Bool CLuceneHelpWrapper::supportsService(const OUString& rService)
+    throw (RuntimeException)
+{
+    Sequence<OUString> names(getSupportedServiceNames());
+    for (sal_Int32 i = 0; i < names.getLength(); ++i)
+    {
+        if (names[i] == rService)
+            return true;
+    }
+    return false;
+}
+
+Sequence< OUString > CLuceneHelpWrapper::getSupportedServiceNames()
+    throw (RuntimeException)
+{
+    return getSuppServices();
+}
+
+namespace
+{
+    static ::cppu::ImplementationEntry const entries[] = {
+        { create,
+          getImplName,
+          getSuppServices,
+          ::cppu::createSingleComponentFactory, 0, 0 },
+        { 0, 0, 0, 0, 0, 0 }
+    };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+    char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+    return cppu::component_getFactoryHelper(
+        pImplName, pServiceManager, pRegistryKey, entries);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlhelp/source/helpcomponent/makefile.mk b/xmlhelp/source/helpcomponent/makefile.mk
new file mode 100755
index 0000000..50b635e
--- /dev/null
+++ b/xmlhelp/source/helpcomponent/makefile.mk
@@ -0,0 +1,68 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
+#  (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+PRJ = ..$/..$/
+PRJNAME = xmlhelp
+TARGET = CLuceneHelpWrapper
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+
+SLOFILES=\
+    $(SLO)$/CLuceneHelpWrapper.obj
+
+PKGCONFIG_MODULES=libclucene-core
+.INCLUDE : pkg_config.mk
+
+LIB1TARGET=$(SLB)$/_$(TARGET).lib
+LIB1OBJFILES=$(SLOFILES)
+
+SHL1TARGET=$(TARGET)
+SHL1LIBS=$(LIB1TARGET)
+SHL1IMPLIB=i$(TARGET)
+SHL1STDLIBS=\
+    $(CPPUHELPERLIB) \
+    $(CPPULIB) \
+    $(COMPHELPERLIB) \
+    $(UNOTOOLSLIB) \
+    $(SALLIB) \
+    $(PKGCONFIG_LIBS)
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+ 
+.INCLUDE :  target.mk
+
+ALLTAR : $(MISC)/CLuceneHelpWrapper.component
+
+$(MISC)/CLuceneHelpWrapper.component .ERRREMOVE : \
+        $(SOLARENV)/bin/createcomponent.xslt CLuceneHelpWrapper.component
+    $(XSLTPROC) --nonet --stringparam uri \
+        '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+        $(SOLARENV)/bin/createcomponent.xslt CLuceneHelpWrapper.component
+
+# vim: set noet sw=4 ts=4:
-- 
1.7.7.6


--=-Lt2Hoi72hpk/b8lL/owU--



More information about the LibreOffice mailing list