From 15704e6319c1194944df6c25a9d1ce413f309610 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 15 Feb 2012 10:03:24 +0000 Subject: bootstrap replacement c++ help component --- 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 +++++++++ 7 files changed, 272 insertions(+), 6 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 (limited to 'xmlhelp') diff --git a/xmlhelp/prj/build.lst b/xmlhelp/prj/build.lst index 446a9df20954..19ca1fcce50e 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 11b504aab785..8ce962800636 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 4a4a756cc0cd..7ee812e94837 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 ec175ccb93ef..767ce89173b0 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 000000000000..fbe7828fb07a --- /dev/null +++ b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.component @@ -0,0 +1,35 @@ + + + + + + + + diff --git a/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx new file mode 100644 index 000000000000..6e800f8ac9c6 --- /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 + * (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 +#include +#include +#include + +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 +{ +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 create( Reference 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 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 000000000000..50b635e62824 --- /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 +# (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: -- cgit