Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
17 : * Portions created by the Initial Developer are Copyright (C) 2010 the
18 : * Initial Developer. All Rights Reserved.
19 : *
20 : * Major Contributor(s):
21 : *
22 : * For minor contributions see the git repository.
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
26 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
27 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
28 : * instead of those above.
29 : */
30 :
31 : #ifndef EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX
32 : #define EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX
33 :
34 :
35 : #include <boost/shared_ptr.hpp>
36 : #include <com/sun/star/container/XNameAccess.hpp>
37 : #include <com/sun/star/uno/Reference.hxx>
38 : #include <com/sun/star/uno/Sequence.hxx>
39 : #include <com/sun/star/uno/XInterface.hpp>
40 : #include <cppuhelper/implbase1.hxx>
41 :
42 : class ResMgr;
43 :
44 : namespace extensions { namespace resource
45 : {
46 : /** This class provides access to tools library text resources */
47 0 : class ResourceIndexAccess : public cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess>
48 : {
49 : public:
50 : /** The ctor takes a sequence with one element: the name of the resource, e.g. svt */
51 : ResourceIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&);
52 : // XNameAccess
53 : // The XNameAccess provides access to two named elements:
54 : // "String" returns a XIndexAccess to String resources
55 : // "StringList" returns a XIndexAccess to StringList/StringArray resources
56 : virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
57 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
58 : virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
59 : // XElementAccess
60 0 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException)
61 0 : { return ::getCppuType(static_cast< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*>(0)); };
62 0 : virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException)
63 0 : { return static_cast<bool>(m_pResMgr.get()); };
64 :
65 : private:
66 : // m_pResMgr should never be NULL
67 : const ::boost::shared_ptr<ResMgr> m_pResMgr;
68 : };
69 : }}
70 :
71 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceIndexAccess(::extensions::resource::ResourceIndexAccess*);
72 :
73 : #endif
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|