bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / resource / ResourceIndexAccess.hxx
blob9a837cb0d1c1adcf213b1a6ede8e25121b8a9b60
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 <boost/shared_ptr.hpp>
15 #include <com/sun/star/container/XNameAccess.hpp>
16 #include <com/sun/star/uno/Reference.hxx>
17 #include <com/sun/star/uno/Sequence.hxx>
18 #include <com/sun/star/uno/XInterface.hpp>
19 #include <cppuhelper/implbase1.hxx>
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::WeakImplHelper1< ::com::sun::star::container::XNameAccess>
31 public:
32 /** The ctor takes a sequence with one element: the name of the resource, e.g. svt */
33 ResourceIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&);
34 // XNameAccess
35 // The XNameAccess provides access to two named elements:
36 // "String" returns a XIndexAccess to String resources
37 // "StringList" returns a XIndexAccess to StringList/StringArray resources
38 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
39 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
40 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
41 // XElementAccess
42 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
43 { return cppu::UnoType<com::sun::star::uno::XInterface>::get(); };
44 virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
45 { return static_cast<bool>(m_pResMgr.get()); };
47 private:
48 // m_pResMgr should never be NULL
49 const ::boost::shared_ptr<ResMgr> m_pResMgr;
53 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceIndexAccess(::extensions::resource::ResourceIndexAccess*);
55 #endif
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */