1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
23 #include <rtl/ustring.hxx>
24 #include <osl/mutex.hxx>
31 #define DBA_RES( id ) ResourceManager::loadString( id )
32 #define DBA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace )
34 #define DBACORE_RESSTRING( id ) DBA_RES( id )
38 // handling resources within the DBA-Core library
41 friend class OModuleClient
;
42 static sal_Int32 s_nClients
; /// number of registered clients
43 static ResMgr
* m_pImpl
;
46 // no instantiation allowed
48 ~ResourceManager() { }
51 static void ensureImplExists();
52 /// register a client for the module
53 static void registerClient();
54 /// revoke a client for the module
55 static void revokeClient();
58 /** loads the string with the specified resource id
60 static OUString
loadString(sal_uInt16 _nResId
);
62 /** loads a string from the resource file, substituting a placeholder with a given string
65 the resource ID of the string to load
66 @param _pPlaceholderAscii
67 the ASCII representation of the placeholder string
69 the string which should substitute the placeholder
71 static OUString
loadString(
73 const sal_Char
* _pPlaceholderAscii
,
74 const OUString
& _rReplace
77 /** loads a string from the resource file, substituting two placeholders with given strings
80 the resource ID of the string to load
81 @param _pPlaceholderAscii1
82 the ASCII representation of the first placeholder string
84 the string which should substitute the first placeholder
85 @param _pPlaceholderAscii2
86 the ASCII representation of the second placeholder string
88 the string which should substitute the second placeholder
90 static OUString
loadString(
92 const sal_Char
* _pPlaceholderAscii1
,
93 const OUString
& _rReplace1
,
94 const sal_Char
* _pPlaceholderAscii2
,
95 const OUString
& _rReplace2
100 /** base class for objects which uses any global module-specific resources
105 OModuleClient() { ResourceManager::registerClient(); }
106 ~OModuleClient() { ResourceManager::revokeClient(); }
110 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */