1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
21 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
22 #include <com/sun/star/beans/PropertyValue.hpp>
23 #include <comphelper/processfactory.hxx>
24 #include <comphelper/propertysequence.hxx>
25 #include <cppuhelper/supportsservice.hxx>
26 #include <cppuhelper/factory.hxx>
27 #include <tvfactory.hxx>
31 using namespace treeview
;
32 using namespace com::sun::star
;
33 using namespace com::sun::star::uno
;
34 using namespace com::sun::star::lang
;
35 using namespace com::sun::star::beans
;
36 using namespace com::sun::star::container
;
38 TVFactory::TVFactory()
42 TVFactory::~TVFactory()
46 // XServiceInfo methods.
49 TVFactory::getImplementationName()
51 return u
"com.sun.star.help.TreeViewImpl"_ustr
;
54 sal_Bool SAL_CALL
TVFactory::supportsService( const OUString
& ServiceName
)
56 return cppu::supportsService( this, ServiceName
);
59 Sequence
< OUString
> SAL_CALL
60 TVFactory::getSupportedServiceNames()
62 return { u
"com.sun.star.help.TreeView"_ustr
, u
"com.sun.star.ucb.HiearchyDataSource"_ustr
};
65 // XMultiServiceFactory
67 Reference
< XInterface
> SAL_CALL
68 TVFactory::createInstance(
69 const OUString
& aServiceSpecifier
)
71 uno::Sequence
<uno::Any
> seq(comphelper::InitAnyPropertySequence(
73 {"nodepath", uno::Any(OUString())}
76 return createInstanceWithArguments( aServiceSpecifier
, seq
);
79 Reference
< XInterface
> SAL_CALL
80 TVFactory::createInstanceWithArguments(
81 const OUString
& /*ServiceSpecifier*/,
82 const Sequence
< Any
>& Arguments
)
86 m_xHDS
= cppu::getXWeak(new TVChildTarget());
90 for( const auto& rArgument
: Arguments
)
93 if( ! ( rArgument
>>= pV
) )
96 if( pV
.Name
!= "nodepath" )
99 if( ! ( pV
.Value
>>= hierview
) )
105 if( !hierview
.isEmpty() )
107 Reference
< XHierarchicalNameAccess
> xhieraccess( m_xHDS
,UNO_QUERY
);
108 Any aAny
= xhieraccess
->getByHierarchicalName( hierview
);
109 Reference
< XInterface
> xInterface
;
117 Sequence
< OUString
> SAL_CALL
118 TVFactory::getAvailableServiceNames( )
120 return { u
"com.sun.star.ucb.HierarchyDataReadAccess"_ustr
};
123 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
124 com_sun_star_help_TreeViewImpl_get_implementation(
125 css::uno::XComponentContext
* /*context*/, css::uno::Sequence
<css::uno::Any
> const&)
127 return cppu::acquire(new TVFactory
);
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */