1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: core_resource.hxx,v $
10 * $Revision: 1.5.68.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBA_CORE_RESOURCE_HXX_
32 #define _DBA_CORE_RESOURCE_HXX_
34 #ifndef _RTL_USTRING_HXX_
35 #include <rtl/ustring.hxx>
37 #include <osl/mutex.hxx>
40 //.........................................................................
44 #define DBA_RES( id ) ResourceManager::loadString( id )
45 #define DBA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace )
47 #define DBACORE_RESSTRING( id ) DBA_RES( id )
50 //==================================================================
52 //= handling ressources within the DBA-Core library
53 //==================================================================
56 friend class OModuleClient
;
57 static ::osl::Mutex s_aMutex
; /// access safety
58 static sal_Int32 s_nClients
; /// number of registered clients
59 static ResMgr
* m_pImpl
;
62 // no instantiation allowed
64 ~ResourceManager() { }
67 static void ensureImplExists();
68 /// register a client for the module
69 static void registerClient();
70 /// revoke a client for the module
71 static void revokeClient();
74 /** loads the string with the specified resource id
76 static ::rtl::OUString
loadString(sal_uInt16 _nResId
);
78 /** loads a string from the resource file, substituting a placeholder with a given string
81 the resource ID of the string to load
82 @param _pPlaceholderAscii
83 the ASCII representation of the placeholder string
85 the string which should substitute the placeholder
87 static ::rtl::OUString
loadString(
89 const sal_Char
* _pPlaceholderAscii
,
90 const ::rtl::OUString
& _rReplace
93 /** loads a string from the resource file, substituting two placeholders with given strings
96 the resource ID of the string to load
97 @param _pPlaceholderAscii1
98 the ASCII representation of the first placeholder string
100 the string which should substitute the first placeholder
101 @param _pPlaceholderAscii2
102 the ASCII representation of the second placeholder string
104 the string which should substitute the second placeholder
106 static ::rtl::OUString
loadString(
108 const sal_Char
* _pPlaceholderAscii1
,
109 const ::rtl::OUString
& _rReplace1
,
110 const sal_Char
* _pPlaceholderAscii2
,
111 const ::rtl::OUString
& _rReplace2
114 static ResMgr
* getResManager();
117 //=========================================================================
119 //=========================================================================
120 /** base class for objects which uses any global module-specific ressources
125 OModuleClient() { ResourceManager::registerClient(); }
126 ~OModuleClient() { ResourceManager::revokeClient(); }
130 //.........................................................................
132 //.........................................................................
134 #endif // _DBA_CORE_RESOURCE_HXX_