xref: /aoo42x/main/svtools/source/misc/svtdata.cxx (revision 5900e8ec)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svtools.hxx"
26 
27 #include <map>
28 #include <tools/resmgr.hxx>
29 #include <tools/shl.hxx>
30 #include <vos/process.hxx>
31 #include <svtools/svtdata.hxx>
32 #include <vcl/svapp.hxx>
33 
34 //============================================================================
35 //
36 //  ImpSvtData
37 //
38 //============================================================================
39 
~ImpSvtData()40 ImpSvtData::~ImpSvtData()
41 {
42 	delete pResMgr;
43 }
44 
45 //============================================================================
GetResMgr(const::com::sun::star::lang::Locale aLocale)46 ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale)
47 {
48 	if (!pResMgr)
49 	{
50 		pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale );
51 	}
52 	return pResMgr;
53 }
54 
GetResMgr()55 ResMgr * ImpSvtData::GetResMgr()
56 {
57 	return GetResMgr(Application::GetSettings().GetUILocale());
58 }
59 
60 //============================================================================
61 // static
GetSvtData()62 ImpSvtData & ImpSvtData::GetSvtData()
63 {
64 	void ** pAppData = GetAppData(SHL_SVT);
65 	if (!*pAppData)
66 		*pAppData= new ImpSvtData;
67 	return *static_cast<ImpSvtData *>(*pAppData);
68 }
69 
SvtResId(sal_uInt16 nId,const::com::sun::star::lang::Locale aLocale)70 SvtResId::SvtResId(sal_uInt16 nId, const ::com::sun::star::lang::Locale aLocale):
71 		ResId(nId, *ImpSvtData::GetSvtData().GetResMgr(aLocale)) {}
72 
SvtResId(sal_uInt16 nId)73 SvtResId::SvtResId(sal_uInt16 nId): ResId(nId, *ImpSvtData::GetSvtData().GetResMgr()) {}
74 
75