Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include "core_resource.hxx"
29 : : #include <tools/simplerm.hxx>
30 : :
31 : : // ---- needed as long as we have no contexts for components ---
32 : : #include <vcl/svapp.hxx>
33 : : //---------------------------------------------------
34 : : #include <comphelper/configurationhelper.hxx>
35 : : #include <osl/thread.h>
36 : : #include <com/sun/star/util/XMacroExpander.hpp>
37 : : #include <com/sun/star/beans/XPropertySet.hpp>
38 : : #include <com/sun/star/uno/XComponentContext.hpp>
39 : : #include <rtl/uri.hxx>
40 : :
41 : : #include <svl/solar.hrc>
42 : : #include "ModuleHelper.hxx"
43 : : //.........................................................................
44 : : namespace reportdesign
45 : : {
46 : : using namespace ::com::sun::star;
47 : : //==================================================================
48 : : //= ResourceManager
49 : : //==================================================================
50 : : SimpleResMgr* ResourceManager::m_pImpl = NULL;
51 : :
52 : : //------------------------------------------------------------------
53 : 0 : ResourceManager::EnsureDelete::~EnsureDelete()
54 : : {
55 [ # # ]: 0 : delete ResourceManager::m_pImpl;
56 : 0 : }
57 : :
58 : : //------------------------------------------------------------------
59 : 0 : void ResourceManager::ensureImplExists(const uno::Reference< lang::XMultiComponentFactory >& /* _rM */)
60 : : {
61 [ # # ]: 0 : if (!m_pImpl)
62 : : {
63 : : // now that we have an impl class make sure it's deleted on unloading the library
64 [ # # ][ # # ]: 0 : static ResourceManager::EnsureDelete s_aDeleteTheImplClass;
65 : :
66 [ # # ][ # # ]: 0 : ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
67 : :
68 [ # # ]: 0 : m_pImpl = SimpleResMgr::Create("rpt", aLocale);
69 : : }
70 : 0 : }
71 : :
72 : : //------------------------------------------------------------------
73 : 0 : ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId,const uno::Reference< lang::XMultiComponentFactory >& _rM)
74 : : {
75 : 0 : ::rtl::OUString sReturn;
76 : :
77 [ # # ]: 0 : ensureImplExists(_rM);
78 [ # # ]: 0 : if (m_pImpl)
79 [ # # ]: 0 : sReturn = m_pImpl->ReadString(_nResId);
80 : :
81 : 0 : return sReturn;
82 : : }
83 : :
84 : : //.........................................................................
85 : : }
86 : : //.........................................................................
87 : :
88 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|