diff options
author | Andreas Bille <abi@openoffice.org> | 2001-05-17 14:46:30 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-05-17 14:46:30 +0000 |
commit | 412eec32a4c7e30488de74119ca29be82df4af8e (patch) | |
tree | 45483819664ae96b80f1bf129c478e7547713455 /xmlhelp/source | |
parent | 84a118166553a03027a3fba725c24330f7cf4c13 (diff) |
Now also loading files without transformation
Diffstat (limited to 'xmlhelp/source')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/content.cxx | 15 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 68 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/provider.cxx | 74 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 11 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 104 |
5 files changed, 246 insertions, 26 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index 16d854b438ba..650aeb0c3ea9 100644 --- a/xmlhelp/source/cxxhelp/provider/content.cxx +++ b/xmlhelp/source/cxxhelp/provider/content.cxx @@ -2,9 +2,9 @@ * * $RCSfile: content.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ + * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,9 @@ #ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_ #include <com/sun/star/ucb/XCommandInfo.hpp> #endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_ +#include <com/sun/star/io/XActiveDataSink.hpp> +#endif #ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_ #include <com/sun/star/ucb/XPersistentPropertySet.hpp> #endif @@ -121,7 +124,7 @@ #include <provider/resultsetforquery.hxx> #endif - +using namespace com::sun::star::io; using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace com::sun::star::lang; @@ -408,6 +411,12 @@ Any SAL_CALL Content::execute( const Command& aCommand, throw CommandAbortedException(); } + + Reference< XActiveDataSink > xActiveDataSink( aOpenCommand.Sink,UNO_QUERY ); + if( xActiveDataSink.is() ) + m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment ); + + if( m_aURLParameter.isRoot() ) { Reference< XDynamicResultSet > xSet diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 444401ddab2d..8d18e3cd6833 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -2,9 +2,9 @@ * * $RCSfile: databases.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: abi $ $Date: 2001-05-16 14:53:27 $ + * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,9 @@ * ************************************************************************/ +#ifndef _VOS_DIAGNOSE_HXX_ +#include <vos/diagnose.hxx> +#endif #ifndef _DATABASES_HXX_ #include <provider/databases.hxx> #endif @@ -81,16 +84,24 @@ using namespace com::sun::star::uno; osl::Mutex Databases::m_aMutex; -rtl::OUString Databases::m_aInstallDirectory; // Installation directory -Databases::DatabasesTable Databases::m_aDatabases; // Language and module dependent databases -Databases::LangSetTable Databases::m_aLangSet; // Mapping to of lang-country to lang -Databases::ModInfoTable Databases::m_aModInfo; // Module information +rtl::OUString Databases::m_aInstallDirectory; // Installation directory +rtl::OUString Databases::m_aInstallDirectoryAsSystemPath; // Installation directory +rtl::OUString Databases::m_aInstallDirectoryAsURL; // Installation directory +Databases::DatabasesTable Databases::m_aDatabases; // Language and module dependent databases +Databases::LangSetTable Databases::m_aLangSet; // Mapping to of lang-country to lang +Databases::ModInfoTable Databases::m_aModInfo; // Module information Databases::KeywordInfoTable Databases::m_aKeywordInfo; -void Databases::setInstallPath( const rtl::OUString& aInstallDirectory ) + +void Databases::setInstallPath( const rtl::OUString& aInstDir ) { osl::MutexGuard aGuard( m_aMutex ); - m_aInstallDirectory = aInstallDirectory; + + if( osl::FileBase::E_None != osl::FileBase::normalizePath( aInstDir,m_aInstallDirectory ) ) + ; + + if( m_aInstallDirectory.lastIndexOf( sal_Unicode( "/" ) ) != m_aInstallDirectory.getLength() - 1 ) + m_aInstallDirectory += rtl::OUString::createFromAscii( "/" ); } @@ -98,17 +109,48 @@ rtl::OUString Databases::getInstallPath() { osl::MutexGuard aGuard( m_aMutex ); - return rtl::OUString::createFromAscii( "//./e:/src630c/help/" ); + return m_aInstallDirectory; +} + +rtl::OUString Databases::getInstallPathAsSystemPath() +{ + osl::MutexGuard aGuard( m_aMutex ); + + if( ! m_aInstallDirectoryAsSystemPath.getLength() ) + { + bool bla = + osl::FileBase::E_None == + osl::FileBase::getSystemPathFromNormalizedPath( m_aInstallDirectory,m_aInstallDirectoryAsSystemPath ); + VOS_ENSURE( bla, + "HelpProvider, no installpath" ); + } - // return m_aInstallDirectory; + return m_aInstallDirectoryAsSystemPath; } +rtl::OUString Databases::getInstallPathAsURL() +{ + osl::MutexGuard aGuard( m_aMutex ); + + if( ! m_aInstallDirectoryAsURL.getLength() ) + { + bool bla = + osl::FileBase::E_None == + osl::FileBase::getFileURLFromNormalizedPath( m_aInstallDirectory,m_aInstallDirectoryAsURL ); + VOS_ENSURE( bla, + "HelpProvider, no installpath" ); + } + + return m_aInstallDirectoryAsURL; +} + + + rtl::OUString Databases::getURLMode() { return rtl::OUString::createFromAscii( "with-jars" ); - // return rtl::OUString::createFromAscii( "with-files" ); } @@ -279,7 +321,7 @@ Db* Databases::getBerkeley( const rtl::OUString& Database, Db* table = it->second = new Db( 0,0 ); rtl::OUString fileNameOU = - getInstallPath() + + getInstallPathAsSystemPath() + key + rtl::OUString::createFromAscii( ".db" ); @@ -472,7 +514,7 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, std::hash_map< rtl::OUString,rtl::OUString,ha,eq > internalHash; rtl::OUString fileNameOU = - getInstallPath() + + getInstallPathAsSystemPath() + key + rtl::OUString::createFromAscii( ".key" ); diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index 5c3dfe210350..85de7b712e8a 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -2,9 +2,9 @@ * * $RCSfile: provider.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: abi $ $Date: 2001-05-16 14:53:27 $ + * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,7 +78,28 @@ #ifndef _CONTENT_HXX #include <provider/content.hxx> #endif +#ifndef _DATABASES_HXX_ +#include <provider/databases.hxx> +#endif +#ifndef COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_ +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_ +#include <com/sun/star/frame/XConfigManager.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_ +#include <com/sun/star/beans/PropertyState.hpp> +#endif +using namespace com::sun::star::frame; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; using namespace com::sun::star::lang; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; @@ -187,8 +208,53 @@ Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< X void ContentProvider::init() { - //t - // Get installation path, for example + rtl::OUString sProviderService = + rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ); + + // New access to configuration + Any aAny; + aAny <<= rtl::OUString::createFromAscii( "plugin" ); + PropertyValue aProp( rtl::OUString::createFromAscii( "servertype" ), + -1, + aAny, + PropertyState_DIRECT_VALUE ); + + Sequence< Any > seq(1); + seq[0] <<= aProp; + + Reference< XMultiServiceFactory > + sProvider( + m_xSMgr->createInstanceWithArguments( sProviderService,seq ), + UNO_QUERY ); + + rtl::OUString sReaderService = + rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ); + + seq[0] <<= rtl::OUString::createFromAscii( "org.openoffice.Office.Common" ); + + Reference< XHierarchicalNameAccess > xHierAccess( + sProvider->createInstanceWithArguments( sReaderService,seq ),UNO_QUERY ); + + aAny = + xHierAccess->getByHierarchicalName( rtl::OUString::createFromAscii("Path/Current/Help") ); + + rtl::OUString instPath; + if( ! ( aAny >>= instPath ) ) + ; + else + instPath = rtl::OUString::createFromAscii( "$(instpath)/help" ); + + Reference< XConfigManager > xCfgMgr( + m_xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ), + UNO_QUERY ); + + VOS_ENSURE( xCfgMgr.is(), + "FileProvider::FileProvider - No Config Manager!" ); + + if( xCfgMgr.is() ) + instPath = xCfgMgr->substituteVariables( instPath ); + + Databases::setInstallPath( instPath ); isInitialized = true; } diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index 0535d4bd1828..a4d802faafb4 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -2,9 +2,9 @@ * * $RCSfile: resultsetforquery.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ + * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -123,7 +123,12 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF sal_Int32 hitCount = m_aURLParameter.get_hitCount(); QueryStatement queryStatement( hitCount,queryList,scope ); - QueryProcessor queryProcessor( rtl::OUString::createFromAscii( "//./e:/index/" ) ); + QueryProcessor queryProcessor( Databases::getInstallPath() + + m_aURLParameter.get_language() + + rtl::OUString::createFromAscii( "/" ) + + m_aURLParameter.get_module() + + rtl::OUString::createFromAscii( ".idx/" ) ); + QueryResults *queryResults = queryProcessor.processQuery( queryStatement ); sal_Int32 replIdx = rtl::OUString::createFromAscii( "#HLP#" ).getLength(); diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index d309568e4965..c611bb1a68fc 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urlparameter.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ + * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,12 @@ * ************************************************************************/ +#ifndef _VOS_DIAGNOSE_HXX_ +#include <vos/diagnose.hxx> +#endif +#ifndef _RTL_URI_HXX_ +#include <rtl/uri.hxx> +#endif #ifndef _DB_CXX_H_ #include <berkeleydb/db_cxx.h> #endif @@ -68,7 +74,27 @@ #ifndef _DATABASES_HXX_ #include <provider/databases.hxx> #endif - +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_ +#include <com/sun/star/io/XActiveDataSink.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_ +#include <com/sun/star/ucb/OpenCommandArgument2.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_ +#include <com/sun/star/ucb/XCommandProcessor.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_ +#include <com/sun/star/ucb/XContentIdentifier.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_ +#include <com/sun/star/ucb/XContentProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_ +#include <com/sun/star/ucb/XContentIdentifierFactory.hpp> +#endif namespace chelp { @@ -90,6 +116,10 @@ namespace chelp { } +using namespace com::sun::star::io; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::ucb; using namespace chelp; @@ -366,6 +396,74 @@ void URLParameter::readBerkeley() } + + +void URLParameter::open( const Reference< XMultiServiceFactory >& rxSMgr, + const Command& command, + sal_Int32 CommandId, + const Reference< XCommandEnvironment >& Environment ) +{ + rtl::OUString service = rtl::OUString::createFromAscii( "com.sun.star.ucb.UniversalContentBroker" ); + + Reference< XContentProvider > provider( rxSMgr->createInstance( service ),UNO_QUERY ); + Reference< XContentIdentifierFactory > factory( provider,UNO_QUERY ); + + rtl::OUString url = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + rtl::OUString jar = + Databases::getInstallPathAsURL() + + get_language() + + rtl::OUString::createFromAscii( "/" ) + + get_module() + + rtl::OUString::createFromAscii( ".jar" ); + + url+= rtl::Uri::encode( jar, + rtl_UriCharClassUricNoSlash, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + + url += ( rtl::OUString::createFromAscii( "/" ) + get_path() ); + + Reference< XContentIdentifier > xIdentifier = factory->createContentIdentifier( url ); + Reference< XContent > xContent = provider->queryContent( xIdentifier ); + + Reference< XCommandProcessor > processor( xContent,UNO_QUERY ); + + if( isRoot() ) + { +// getPicture( HelpDatabases.getCssSheet(),m_xOutputStream); + } + else if( isPicture() ) + { +// getPicture( m_xParameter.getInputFromJarFile(),m_xOutputStream ); + } + else if( isActive() ) + { // This is a Helptext +// m_xOutputStream.setBigBuffer( m_xParameter.getByteArrayText() ); + } + else + { + processor->execute( command, + CommandId, + Environment ); +// OpenCommandArgument2 aOpenCommand; + +// if ( !( command.Argument >>= aOpenCommand ) ) +// { +// VOS_ENSURE( sal_False, +// "Content::execute - invalid parameter!" ); +// } + +// Reference< XActiveDataSink > xActiveDataSink( aOpenCommand.Sink,UNO_QUERY ); +// Reference< XInputStream> ref = xActiveDataSink->getInputStream(); +// Sequence< sal_Int8 > aD; +// sal_Int32 du = ref->readBytes( aD, +// 1000000 ); +// rtl::OUString bla( reinterpret_cast< const char* >(aD.getConstArray()),du,RTL_TEXTENCODING_UTF8 ); + } +} + + + void URLParameter::parse() throw( com::sun::star::ucb::IllegalIdentifierException ) { m_aExpr = m_aURL; |