1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmlhelp.hxx"
26 #include <com/sun/star/ucb/Command.hpp>
27 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
28 #include <com/sun/star/ucb/XCommandProcessor.hpp>
29
30 #include "resultsetforroot.hxx"
31 #include "databases.hxx"
32
33 using namespace chelp;
34 using namespace com::sun::star;
35 using namespace com::sun::star::ucb;
36
37
38
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,Databases * pDatabases)39 ResultSetForRoot::ResultSetForRoot( const uno::Reference< lang::XMultiServiceFactory >& xMSF,
40 const uno::Reference< XContentProvider >& xProvider,
41 sal_Int32 nOpenMode,
42 const uno::Sequence< beans::Property >& seq,
43 const uno::Sequence< NumberedSortingInfo >& seqSort,
44 URLParameter& aURLParameter,
45 Databases* pDatabases )
46 : ResultSetBase( xMSF,xProvider,nOpenMode,seq,seqSort ),
47 m_aURLParameter( aURLParameter ),
48 m_pDatabases( pDatabases )
49 {
50 m_aPath = m_pDatabases->getModuleList( m_aURLParameter.get_language() );
51 m_aItems.resize( m_aPath.size() );
52 m_aIdents.resize( m_aPath.size() );
53
54 Command aCommand;
55 aCommand.Name = rtl::OUString::createFromAscii( "getPropertyValues" );
56 aCommand.Argument <<= m_sProperty;
57
58 for( sal_uInt32 i = 0; i < m_aPath.size(); ++i )
59 {
60 m_aPath[i] =
61 rtl::OUString::createFromAscii( "vnd.sun.star.help://" ) +
62 m_aPath[i] +
63 rtl::OUString::createFromAscii( "?Language=" ) +
64 m_aURLParameter.get_language() +
65 rtl::OUString::createFromAscii( "&System=" ) +
66 m_aURLParameter.get_system();
67
68 m_nRow = sal_Int32( i );
69
70 uno::Reference< XContent > content = queryContent();
71 if( content.is() )
72 {
73 uno::Reference< XCommandProcessor > cmd( content,uno::UNO_QUERY );
74 cmd->execute( aCommand,0,uno::Reference< XCommandEnvironment >( 0 ) ) >>= m_aItems[i]; //TODO: check return value of operator >>=
75 }
76 m_nRow = 0xffffffff;
77 }
78 }
79