bump product version to 4.1.6.2
[LibreOffice.git] / extensions / source / resource / ResourceIndexAccess.hxx
blob40fdf03aa55e4b33caa3db2a18083a137e9125b7
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 EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX
11 #define EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_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 class ResMgr;
23 namespace extensions { namespace resource
25 /** This class provides access to tools library text resources */
26 class ResourceIndexAccess : public cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess>
28 public:
29 /** The ctor takes a sequence with one element: the name of the resource, e.g. svt */
30 ResourceIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&);
31 // XNameAccess
32 // The XNameAccess provides access to two named elements:
33 // "String" returns a XIndexAccess to String resources
34 // "StringList" returns a XIndexAccess to StringList/StringArray resources
35 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);
36 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
37 virtual ::sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
38 // XElementAccess
39 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException)
40 { return ::getCppuType(static_cast< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*>(0)); };
41 virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException)
42 { return static_cast<bool>(m_pResMgr.get()); };
44 private:
45 // m_pResMgr should never be NULL
46 const ::boost::shared_ptr<ResMgr> m_pResMgr;
50 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceIndexAccess(::extensions::resource::ResourceIndexAccess*);
52 #endif
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */