bump product version to 4.1.6.2
[LibreOffice.git] / extensions / source / resource / oooresourceloader.hxx
blob09da484da32bb43fde33399049e72bc8b9e6f36f
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/.
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 #ifndef EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX
21 #define EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/resource/XResourceBundleLoader.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <cppuhelper/implbase1.hxx>
28 #include <functional>
29 #include <map>
30 #include <utility>
32 namespace extensions { namespace resource
34 typedef ::std::pair< OUString, ::com::sun::star::lang::Locale> ResourceBundleDescriptor;
36 struct ResourceBundleDescriptorLess : public ::std::binary_function<ResourceBundleDescriptor, ResourceBundleDescriptor, bool>
38 bool operator()( const ResourceBundleDescriptor& _lhs, const ResourceBundleDescriptor& _rhs ) const
40 if ( _lhs.first < _rhs.first )
41 return true;
42 if ( _lhs.second.Language < _rhs.second.Language )
43 return true;
44 if ( _lhs.second.Country < _rhs.second.Country )
45 return true;
46 if ( _lhs.second.Variant < _rhs.second.Variant )
47 return true;
48 return false;
52 class OpenOfficeResourceLoader : public ::cppu::WeakImplHelper1< ::com::sun::star::resource::XResourceBundleLoader>
54 public:
55 typedef ::std::map<
56 ResourceBundleDescriptor,
57 ::com::sun::star::uno::WeakReference< ::com::sun::star::resource::XResourceBundle>,
58 ResourceBundleDescriptorLess> ResourceBundleCache;
60 OpenOfficeResourceLoader(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&);
61 // XResourceBundleLoader
62 virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle_Default( const OUString& aBaseName ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException);
63 virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle( const OUString& abaseName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException);
65 private:
66 OpenOfficeResourceLoader(); // never implemented
67 OpenOfficeResourceLoader( const OpenOfficeResourceLoader& ); // never implemented
68 OpenOfficeResourceLoader& operator=( const OpenOfficeResourceLoader& ); // never implemented
69 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
70 ::osl::Mutex m_aMutex;
71 ResourceBundleCache m_aBundleCache;
75 #endif // EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */