diff options
author | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | 2012-02-14 21:56:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-23 10:31:16 +0000 |
commit | 0f691cc6896e03ab8ca805bf0689bc0fc53dd42f (patch) | |
tree | 9c6cb2b9a687824006660adc8db3c5c0462e5538 /xmlhelp | |
parent | db4bc712df5fbc17528b3f0fe694d84fb4bfeb66 (diff) |
HelpIndexer using rtl::OUString, called from xmlhelp
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 102 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/makefile.mk | 5 |
2 files changed, 50 insertions, 57 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 7ee812e94837..ccc74daa5084 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -39,6 +39,12 @@ #include <algorithm> #include <string.h> +// EDIT FROM HERE + +#include <HelpIndexer.hxx> + +// EDIT ENDS HERE + // Extensible help #include "com/sun/star/deployment/ExtensionManager.hpp" #include "com/sun/star/deployment/thePackageManagerFactory.hpp" @@ -2115,78 +2121,60 @@ rtl::OUString IndexFolderIterator::implGetIndexFolderFromPackage( bool& o_rbTemp // TEST //bIsWriteAccess = false; - Reference< script::XInvocation > xInvocation; - Reference< XMultiComponentFactory >xSMgr( m_xContext->getServiceManager(), UNO_QUERY ); +// EDIT FROM HERE try { - xInvocation = Reference< script::XInvocation >( - m_xContext->getServiceManager()->createInstanceWithContext( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.help.HelpIndexer" )), m_xContext ) , UNO_QUERY ); - - if( xInvocation.is() ) - { - Sequence<uno::Any> aParamsSeq( bIsWriteAccess ? 6 : 8 ); - - aParamsSeq[0] = uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "-lang" )) ); - - rtl::OUString aLang; - sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); - if( nLastSlash != -1 ) - aLang = aLangURL.copy( nLastSlash + 1 ); - else - aLang = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "en" )); - aParamsSeq[1] = uno::makeAny( aLang ); + rtl::OUString aLang; + sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); + if( nLastSlash != -1 ) + aLang = aLangURL.copy( nLastSlash + 1 ); + else + aLang = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "en" )); - aParamsSeq[2] = uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "-mod" )) ); - aParamsSeq[3] = uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "help" )) ); + rtl::OUString aMod(RTL_CONSTASCII_USTRINGPARAM("help")); - rtl::OUString aZipDir = aLangURL; - if( !bIsWriteAccess ) + rtl::OUString aZipDir = aLangURL; + if( !bIsWriteAccess ) + { + rtl::OUString aTempFileURL; + ::osl::FileBase::RC eErr = ::osl::File::createTempFile( 0, 0, &aTempFileURL ); + if( eErr == ::osl::FileBase::E_None ) { - rtl::OUString aTempFileURL; - ::osl::FileBase::RC eErr = ::osl::File::createTempFile( 0, 0, &aTempFileURL ); - if( eErr == ::osl::FileBase::E_None ) + rtl::OUString aTempDirURL = aTempFileURL; + try { - rtl::OUString aTempDirURL = aTempFileURL; - try - { - m_xSFA->kill( aTempDirURL ); - } - catch (Exception &) - {} - m_xSFA->createFolder( aTempDirURL ); - - aZipDir = aTempDirURL; - o_rbTemporary = true; + m_xSFA->kill( aTempDirURL ); } + catch (Exception &) + {} + m_xSFA->createFolder( aTempDirURL ); + + aZipDir = aTempDirURL; + o_rbTemporary = true; } + } - aParamsSeq[4] = uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "-zipdir" )) ); - rtl::OUString aSystemPath; - osl::FileBase::getSystemPathFromFileURL( aZipDir, aSystemPath ); - aParamsSeq[5] = uno::makeAny( aSystemPath ); + rtl::OUString aTargetDir; + osl::FileBase::getSystemPathFromFileURL( aZipDir, aTargetDir ); - if( !bIsWriteAccess ) - { - aParamsSeq[6] = uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "-srcdir" )) ); - rtl::OUString aSrcDirVal; - osl::FileBase::getSystemPathFromFileURL( aLangURL, aSrcDirVal ); - aParamsSeq[7] = uno::makeAny( aSrcDirVal ); - } + rtl::OUString aSourceDir; + osl::FileBase::getSystemPathFromFileURL( aLangURL, aSourceDir ); - Sequence< sal_Int16 > aOutParamIndex; - Sequence< uno::Any > aOutParam; - uno::Any aRet = xInvocation->invoke( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "createIndex" )), - aParamsSeq, aOutParamIndex, aOutParam ); + rtl::OUString aCaption(RTL_CONSTASCII_USTRINGPARAM("/caption")); + rtl::OUString aContent(RTL_CONSTASCII_USTRINGPARAM("/content")); - if( bIsWriteAccess ) - aIndexFolder = implGetFileFromPackage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".idxl" )), xPackage ); - else - aIndexFolder = aZipDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/help.idxl" )); - } + HelpIndexer aIndexer(aLang, aMod, aSourceDir + aCaption, aSourceDir + aContent, aTargetDir); + + if( bIsWriteAccess ) + aIndexFolder = implGetFileFromPackage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ".idxl" )), xPackage ); + else + aIndexFolder = aZipDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/help.idxl" )); } catch (Exception &) {} + +// EDIT UNTIL HERE + } } diff --git a/xmlhelp/source/cxxhelp/provider/makefile.mk b/xmlhelp/source/cxxhelp/provider/makefile.mk index b70979741fef..05f4eada22cc 100644 --- a/xmlhelp/source/cxxhelp/provider/makefile.mk +++ b/xmlhelp/source/cxxhelp/provider/makefile.mk @@ -67,6 +67,11 @@ LIBXSLTINCDIR=external$/libxslt CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) .ENDIF +CFLAGS+= -I$(SRC_ROOT)$/l10ntools$/source$/help + +PKGCONFIG_MODULES=libclucene-core libclucene-contribs-lib +.INCLUDE : pkg_config.mk + .IF "$(GUI)"=="WNT" .IF "$(COM)"=="MSC" CFLAGS+=-GR |