diff options
author | Andreas Bille <abi@openoffice.org> | 2001-05-17 08:58:55 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-05-17 08:58:55 +0000 |
commit | 7851708af63f2fb051acecf0e32b2a775e44f485 (patch) | |
tree | 924646636905009a4c05d7408696c7d6d8bd5ec2 /xmlhelp | |
parent | 86360790b986f8de74e5df45cc0d5fd9f53507af (diff) |
Query results and module information
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/content.cxx | 66 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/makefile.mk | 22 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 167 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/resultsetforroot.cxx | 122 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 9 |
5 files changed, 368 insertions, 18 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index 09bf5fb6f786..16d854b438ba 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: abi $ $Date: 2001-05-16 14:53:27 $ + * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,6 +117,9 @@ #ifndef _RESULTSETFORROOT_HXX #include <provider/resultsetforroot.hxx> #endif +#ifndef _RESULTSETFORQUERY_HXX +#include <provider/resultsetforquery.hxx> +#endif using namespace com::sun::star::container; @@ -318,6 +321,49 @@ public: +class ResultSetForQueryFactory + : public ResultSetFactory +{ +private: + + Reference< XMultiServiceFactory > m_xSMgr; + Reference< XContentProvider > m_xProvider; + sal_Int32 m_nOpenMode; + Sequence< Property > m_seq; + Sequence< NumberedSortingInfo > m_seqSort; + URLParameter m_aURLParameter; + + +public: + + ResultSetForQueryFactory( const Reference< XMultiServiceFactory >& xSMgr, + const Reference< XContentProvider >& xProvider, + sal_Int32 nOpenMode, + const Sequence< Property >& seq, + const Sequence< NumberedSortingInfo >& seqSort, + URLParameter aURLParameter ) + : m_xSMgr( xSMgr ), + m_xProvider( xProvider ), + m_nOpenMode( nOpenMode ), + m_seq( seq ), + m_seqSort( seqSort ), + m_aURLParameter( aURLParameter ) + { + } + + ResultSetBase* createResultSet() + { + return new ResultSetForQuery( m_xSMgr, + m_xProvider, + m_nOpenMode, + m_seq, + m_seqSort, + m_aURLParameter ); + } +}; + + + // virtual Any SAL_CALL Content::execute( const Command& aCommand, sal_Int32 CommandId, @@ -377,10 +423,20 @@ Any SAL_CALL Content::execute( const Command& aCommand, m_aURLParameter ) ); aRet <<= xSet; } - - if( m_aURLParameter.isQuery() ) + else if( m_aURLParameter.isQuery() ) { - + Reference< XDynamicResultSet > xSet + = new DynamicResultSet( m_xSMgr, + this, + aOpenCommand, + Environment, + new ResultSetForQueryFactory( m_xSMgr, + m_xProvider.getBodyPtr(), + aOpenCommand.Mode, + aOpenCommand.Properties, + aOpenCommand.SortingInfo, + m_aURLParameter ) ); + aRet <<= xSet; } } else diff --git a/xmlhelp/source/cxxhelp/provider/makefile.mk b/xmlhelp/source/cxxhelp/provider/makefile.mk index 7ff5e1bcc98c..2cea4edc3d3f 100644 --- a/xmlhelp/source/cxxhelp/provider/makefile.mk +++ b/xmlhelp/source/cxxhelp/provider/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,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 09:58:55 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -96,6 +96,7 @@ SLOFILES=\ $(SLO)$/resultset.obj \ $(SLO)$/resultsetbase.obj \ $(SLO)$/resultsetforroot.obj \ + $(SLO)$/resultsetforquery.obj \ $(SLO)$/contentcaps.obj \ $(SLO)$/urlparameter.obj \ $(SLO)$/databases.obj @@ -115,13 +116,16 @@ SHL1IMPLIB=i$(TARGET) SHL1VERSIONMAP=exports.map # @@@ Add additional libs here. -SHL1STDLIBS=\ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(VOSLIB) \ - $(UCBHELPERLIB) \ - libdb32.lib +SHL1STDLIBS= \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) \ + $(VOSLIB) \ + $(UCBHELPERLIB) \ + libdb32.lib \ + $(SLB)$/jaqe.lib \ + $(SLB)$/jautil.lib \ + $(SLB)$/jadb.lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def SHL1LIBS=$(LIB1TARGET) diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx new file mode 100644 index 000000000000..0535d4bd1828 --- /dev/null +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * $RCSfile: resultsetforquery.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_UCB_COMMAND_HPP_ +#include <com/sun/star/ucb/Command.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_ +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_ +#include <com/sun/star/ucb/XCommandProcessor.hpp> +#endif +#ifndef _RESULTSETFORROOT_HXX +#include <provider/resultsetforquery.hxx> +#endif +#ifndef _DATABASES_HXX_ +#include <provider/databases.hxx> +#endif +#ifndef _XMLSEARCH_QE_QUERYPROCESSOR_HXX_ +#include <qe/QueryProcessor.hxx> +#endif + +using namespace chelp; +using namespace xmlsearch::qe; +using namespace com::sun::star; +using namespace com::sun::star::ucb; + + + +ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceFactory >& xMSF, + const uno::Reference< XContentProvider >& xProvider, + sal_Int32 nOpenMode, + const uno::Sequence< beans::Property >& seq, + const uno::Sequence< NumberedSortingInfo >& seqSort, + URLParameter& aURLParameter ) + : ResultSetBase( xMSF,xProvider,nOpenMode,seq,seqSort ), + m_aURLParameter( aURLParameter ) +{ + std::vector< rtl::OUString > queryList; + + { + sal_Int32 idx; + rtl::OUString query = m_aURLParameter.get_query(); + while( query.getLength() ) + { + idx = query.indexOf( sal_Unicode( ' ' ) ); + if( idx == -1 ) + idx = query.getLength(); + + queryList.push_back( query.copy( 0,idx ) ); + query = query.copy( 1 + idx ); + } + } + + rtl::OUString scope = m_aURLParameter.get_scope(); + StaticModuleInformation* inf = + Databases::getStaticInformationForModule( m_aURLParameter.get_module(), + m_aURLParameter.get_language() ); + + if( scope.compareToAscii( "Heading" ) == 0 ) + scope = inf->get_heading(); + else + scope = inf->get_fulltext(); + + sal_Int32 hitCount = m_aURLParameter.get_hitCount(); + + QueryStatement queryStatement( hitCount,queryList,scope ); + QueryProcessor queryProcessor( rtl::OUString::createFromAscii( "//./e:/index/" ) ); + QueryResults *queryResults = queryProcessor.processQuery( queryStatement ); + + sal_Int32 replIdx = rtl::OUString::createFromAscii( "#HLP#" ).getLength(); + rtl::OUString replWith = rtl::OUString::createFromAscii( "vnd.sun.star.help://" ); + + QueryHitIterator* it = queryResults->makeQueryHitIterator(); + while( it->next() ) + { + QueryHitData* qhd = it->getHit( 0 ); + m_aPath.push_back( replWith + ( qhd->getDocument()).copy( replIdx ) ); + } + delete it; + + m_aItems.resize( m_aPath.size() ); + m_aIdents.resize( m_aPath.size() ); + + Command aCommand; + aCommand.Name = rtl::OUString::createFromAscii( "getPropertyValues" ); + aCommand.Argument <<= m_sProperty; + + for( sal_uInt32 i = 0; i < m_aPath.size(); ++i ) + { + m_aPath[i] = + m_aPath[i] + + rtl::OUString::createFromAscii( "?Language=" ) + + m_aURLParameter.get_language() + + rtl::OUString::createFromAscii( "&System=" ) + + m_aURLParameter.get_system(); + + m_nRow = sal_Int32( i ); + + uno::Reference< XContent > content = queryContent(); + if( content.is() ) + { + uno::Reference< XCommandProcessor > cmd( content,uno::UNO_QUERY ); + if( ! ( cmd->execute( aCommand,0,uno::Reference< XCommandEnvironment >( 0 ) ) >>= m_aItems[i] ) ) + ; + } + m_nRow = -1; + } +} diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforroot.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforroot.cxx new file mode 100644 index 000000000000..73cebb1eecdb --- /dev/null +++ b/xmlhelp/source/cxxhelp/provider/resultsetforroot.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * $RCSfile: resultsetforroot.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_UCB_COMMAND_HPP_ +#include <com/sun/star/ucb/Command.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_ +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_ +#include <com/sun/star/ucb/XCommandProcessor.hpp> +#endif +#ifndef _RESULTSETFORROOT_HXX +#include <provider/resultsetforroot.hxx> +#endif +#ifndef _DATABASES_HXX_ +#include <provider/databases.hxx> +#endif + +using namespace chelp; +using namespace com::sun::star; +using namespace com::sun::star::ucb; + + + +ResultSetForRoot::ResultSetForRoot( const uno::Reference< lang::XMultiServiceFactory >& xMSF, + const uno::Reference< XContentProvider >& xProvider, + sal_Int32 nOpenMode, + const uno::Sequence< beans::Property >& seq, + const uno::Sequence< NumberedSortingInfo >& seqSort, + URLParameter& aURLParameter ) + : ResultSetBase( xMSF,xProvider,nOpenMode,seq,seqSort ), + m_aURLParameter( aURLParameter ) +{ + m_aPath = Databases::getModuleList( m_aURLParameter.get_language() ); + m_aItems.resize( m_aPath.size() ); + m_aIdents.resize( m_aPath.size() ); + + Command aCommand; + aCommand.Name = rtl::OUString::createFromAscii( "getPropertyValues" ); + aCommand.Argument <<= m_sProperty; + + for( sal_uInt32 i = 0; i < m_aPath.size(); ++i ) + { + m_aPath[i] = + rtl::OUString::createFromAscii( "vnd.sun.star.help://" ) + + m_aPath[i] + + rtl::OUString::createFromAscii( "?Language=" ) + + m_aURLParameter.get_language() + + rtl::OUString::createFromAscii( "&System=" ) + + m_aURLParameter.get_system(); + + m_nRow = sal_Int32( i ); + + uno::Reference< XContent > content = queryContent(); + if( content.is() ) + { + uno::Reference< XCommandProcessor > cmd( content,uno::UNO_QUERY ); + if( ! ( cmd->execute( aCommand,0,uno::Reference< XCommandEnvironment >( 0 ) ) >>= m_aItems[i] ) ) + ; + } + m_nRow = -1; + } +} diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 73d023d56c36..d309568e4965 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: abi $ $Date: 2001-05-16 14:53:27 $ + * last change: $Author: abi $ $Date: 2001-05-17 09:58:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -271,6 +271,7 @@ void URLParameter::init( bool bDefaultLanguageIsInitialized ) { m_bBerkeleyRead = false; m_bStart = false; + m_nHitCount = 100; // The default maximum hitcount // m_aTag = rtl::OUString::createFromAscii( "" ); // m_aId = rtl::OUString::createFromAscii( "" ); @@ -292,7 +293,7 @@ void URLParameter::init( bool bDefaultLanguageIsInitialized ) // m_aQuery = rtl::OUString::createFromAscii( "" ); // m_aScope = rtl::OUString::createFromAscii( "" ); - m_nHitCount = 100; // The default maximum hitcount + } @@ -444,7 +445,7 @@ bool URLParameter::name( bool modulePresent ) return false; else { - m_aId = m_aExpr.copy( 1,idx ); + m_aId = m_aExpr.copy( 1,idx-1 ); m_aExpr = m_aExpr.copy( idx ); } } |