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.cxx,v $
10 * $Revision: 1.11.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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #include "core_resource.hxx"
36 #include <tools/resmgr.hxx>
38 // ---- needed as long as we have no contexts for components ---
40 #include <vcl/svapp.hxx>
42 //---------------------------------------------------
45 #include <svtools/solar.hrc>
48 //.........................................................................
52 //==================================================================
54 //==================================================================
55 ::osl::Mutex
ResourceManager::s_aMutex
;
56 sal_Int32
ResourceManager::s_nClients
= 0;
57 ResMgr
* ResourceManager::m_pImpl
= NULL
;
59 //------------------------------------------------------------------
60 void ResourceManager::ensureImplExists()
65 ::com::sun::star::lang::Locale aLocale
= Application::GetSettings().GetUILocale();
67 ByteString
sFileName("dba");
69 m_pImpl
= ResMgr::CreateResMgr(sFileName
.GetBuffer(), aLocale
);
72 //------------------------------------------------------------------
73 ::rtl::OUString
ResourceManager::loadString(sal_uInt16 _nResId
)
75 ::rtl::OUString sReturn
;
79 sReturn
= String(ResId(_nResId
,*m_pImpl
));
84 //------------------------------------------------------------------
85 ::rtl::OUString
ResourceManager::loadString( sal_uInt16 _nResId
, const sal_Char
* _pPlaceholderAscii
, const ::rtl::OUString
& _rReplace
)
87 String
sString( loadString( _nResId
) );
88 sString
.SearchAndReplaceAscii( _pPlaceholderAscii
, _rReplace
);
92 //------------------------------------------------------------------
93 ::rtl::OUString
ResourceManager::loadString( sal_uInt16 _nResId
, const sal_Char
* _pPlaceholderAscii1
, const ::rtl::OUString
& _rReplace1
,
94 const sal_Char
* _pPlaceholderAscii2
, const ::rtl::OUString
& _rReplace2
)
96 String
sString( loadString( _nResId
) );
97 sString
.SearchAndReplaceAscii( _pPlaceholderAscii1
, _rReplace1
);
98 sString
.SearchAndReplaceAscii( _pPlaceholderAscii2
, _rReplace2
);
102 //-------------------------------------------------------------------------
103 void ResourceManager::registerClient()
105 ::osl::MutexGuard
aGuard(s_aMutex
);
109 //-------------------------------------------------------------------------
110 void ResourceManager::revokeClient()
112 ::osl::MutexGuard
aGuard(s_aMutex
);
113 if (!--s_nClients
&& m_pImpl
)
119 ResMgr
* ResourceManager::getResManager()
125 //.........................................................................
127 //.........................................................................