Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / extensions / source / resource / ResourceIndexAccess.hxx
blob6d89f1b90508f95a5dc3c765cf904c9f86a148b0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_EXTENSIONS_SOURCE_RESOURCE_RESOURCEINDEXACCESS_HXX
11 #define INCLUDED_EXTENSIONS_SOURCE_RESOURCE_RESOURCEINDEXACCESS_HXX
14 #include <com/sun/star/container/XNameAccess.hpp>
15 #include <com/sun/star/uno/Reference.hxx>
16 #include <com/sun/star/uno/Sequence.hxx>
17 #include <com/sun/star/uno/XInterface.hpp>
18 #include <cppuhelper/implbase.hxx>
19 #include <memory>
21 namespace com { namespace sun { namespace star { namespace uno {
22 class XComponentContext;
23 } } } }
24 class ResMgr;
26 namespace extensions { namespace resource
28 /** This class provides access to tools library text resources */
29 class ResourceIndexAccess : public cppu::WeakImplHelper< css::container::XNameAccess>
31 public:
32 /** The ctor takes a sequence with one element: the name of the resource, e.g. svt */
33 ResourceIndexAccess(css::uno::Sequence< css::uno::Any> const& rArgs, css::uno::Reference< css::uno::XComponentContext> const&);
34 // XNameAccess
35 // The XNameAccess provides access to one named elements:
36 // "String" returns a XIndexAccess to String resources
37 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
38 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
39 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
40 // XElementAccess
41 virtual css::uno::Type SAL_CALL getElementType( ) override
42 { return cppu::UnoType<css::uno::XInterface>::get(); };
43 virtual sal_Bool SAL_CALL hasElements( ) override
44 { return static_cast<bool>(m_pResMgr.get()); };
46 private:
47 // m_pResMgr should never be NULL
48 const std::shared_ptr<ResMgr> m_pResMgr;
52 #endif
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */