merge the formfield patch from ooo-build
[ooovba.git] / reportdesign / source / core / resource / core_resource.cxx
blob55b2b8ef08c235d34665b1996beff8eb811db5d0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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.4 $
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 #include "core_resource.hxx"
32 #include <tools/simplerm.hxx>
34 // ---- needed as long as we have no contexts for components ---
35 #include <vcl/svapp.hxx>
36 //---------------------------------------------------
37 #include <comphelper/configurationhelper.hxx>
38 #include <osl/thread.h>
39 #include <com/sun/star/util/XMacroExpander.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/uno/XComponentContext.hpp>
42 #include <rtl/uri.hxx>
44 #ifndef _SOLAR_HRC
45 #include <svtools/solar.hrc>
46 #endif
47 #include "ModuleHelper.hxx"
48 //.........................................................................
49 namespace reportdesign
51 using namespace ::com::sun::star;
52 //==================================================================
53 //= ResourceManager
54 //==================================================================
55 SimpleResMgr* ResourceManager::m_pImpl = NULL;
57 //------------------------------------------------------------------
58 ResourceManager::EnsureDelete::~EnsureDelete()
60 delete ResourceManager::m_pImpl;
63 //------------------------------------------------------------------
64 void ResourceManager::ensureImplExists(const uno::Reference< lang::XMultiComponentFactory >& /* _rM */)
66 if (!m_pImpl)
68 // now that we have an impl class make sure it's deleted on unloading the library
69 static ResourceManager::EnsureDelete s_aDeleteTheImplClass;
71 ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
73 rtl::OString sResLibName = rtl::OString( "rpt" );
74 m_pImpl = SimpleResMgr::Create(sResLibName, aLocale);
78 //------------------------------------------------------------------
79 ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId,const uno::Reference< lang::XMultiComponentFactory >& _rM)
81 ::rtl::OUString sReturn;
83 ensureImplExists(_rM);
84 if (m_pImpl)
85 sReturn = m_pImpl->ReadString(_nResId);
87 return sReturn;
90 //.........................................................................
92 //.........................................................................