fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / core / resource / core_resource.cxx
blob471d0497c36feda007264c2d6da3a3c5b9ced1fd
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 #include "core_resource.hxx"
22 #include <tools/resmgr.hxx>
24 // ---- needed as long as we have no contexts for components ---
25 #include <vcl/svapp.hxx>
26 #include <vcl/settings.hxx>
27 #include <rtl/instance.hxx>
28 #include <svl/solar.hrc>
30 namespace dbaccess
33 // ResourceManager
34 namespace
36 // access safety
37 struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
40 sal_Int32 ResourceManager::s_nClients = 0;
41 ResMgr* ResourceManager::m_pImpl = NULL;
43 void ResourceManager::ensureImplExists()
45 if (m_pImpl)
46 return;
48 m_pImpl = ResMgr::CreateResMgr("dba", Application::GetSettings().GetUILanguageTag());
51 OUString ResourceManager::loadString(sal_uInt16 _nResId)
53 OUString sReturn;
55 ensureImplExists();
56 if (m_pImpl)
57 sReturn = OUString(ResId(_nResId,*m_pImpl));
59 return sReturn;
62 OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const OUString& _rReplace )
64 OUString sString( loadString( _nResId ) );
65 return sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii), _rReplace );
68 OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii1, const OUString& _rReplace1,
69 const sal_Char* _pPlaceholderAscii2, const OUString& _rReplace2 )
71 OUString sString( loadString( _nResId ) );
72 sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii1), _rReplace1 );
73 sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii2), _rReplace2 );
74 return sString;
77 void ResourceManager::registerClient()
79 ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
80 ++s_nClients;
83 void ResourceManager::revokeClient()
85 ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
86 if (!--s_nClients && m_pImpl)
88 delete m_pImpl;
89 m_pImpl = NULL;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */