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 _DBA_CORE_RESOURCE_HXX_
21 #define _DBA_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 )
37 //==================================================================
39 //= handling resources within the DBA-Core library
40 //==================================================================
43 friend class OModuleClient
;
44 static sal_Int32 s_nClients
; /// number of registered clients
45 static ResMgr
* m_pImpl
;
48 // no instantiation allowed
50 ~ResourceManager() { }
53 static void ensureImplExists();
54 /// register a client for the module
55 static void registerClient();
56 /// revoke a client for the module
57 static void revokeClient();
60 /** loads the string with the specified resource id
62 static ::rtl::OUString
loadString(sal_uInt16 _nResId
);
64 /** loads a string from the resource file, substituting a placeholder with a given string
67 the resource ID of the string to load
68 @param _pPlaceholderAscii
69 the ASCII representation of the placeholder string
71 the string which should substitute the placeholder
73 static ::rtl::OUString
loadString(
75 const sal_Char
* _pPlaceholderAscii
,
76 const ::rtl::OUString
& _rReplace
79 /** loads a string from the resource file, substituting two placeholders with given strings
82 the resource ID of the string to load
83 @param _pPlaceholderAscii1
84 the ASCII representation of the first placeholder string
86 the string which should substitute the first placeholder
87 @param _pPlaceholderAscii2
88 the ASCII representation of the second placeholder string
90 the string which should substitute the second placeholder
92 static ::rtl::OUString
loadString(
94 const sal_Char
* _pPlaceholderAscii1
,
95 const ::rtl::OUString
& _rReplace1
,
96 const sal_Char
* _pPlaceholderAscii2
,
97 const ::rtl::OUString
& _rReplace2
101 //=========================================================================
103 //=========================================================================
104 /** base class for objects which uses any global module-specific resources
109 OModuleClient() { ResourceManager::registerClient(); }
110 ~OModuleClient() { ResourceManager::revokeClient(); }
114 #endif // _DBA_CORE_RESOURCE_HXX_
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */