xref: /aoo4110/main/forms/source/inc/frm_resource.hxx (revision b1cdbd2c)
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 #ifndef _FRM_RESOURCE_HXX_
25 #define _FRM_RESOURCE_HXX_
26 
27 #include <rtl/ustring.hxx>
28 
29 class SimpleResMgr;
30 //.........................................................................
31 namespace frm
32 {
33 
34 #define FRM_RES_STRING(id) ResourceManager::loadString(id)
35 
36 	//==================================================================
37 	//= ResourceManager
38 	//= handling ressources within the FormLayer library
39 	//==================================================================
40 	class ResourceManager
41 	{
42 		static SimpleResMgr*	m_pImpl;
43 
44 	private:
45 		// no instantiation allowed
ResourceManager()46 		ResourceManager() { }
~ResourceManager()47 		~ResourceManager() { }
48 
49 		// we'll instantiate one static member of the following class, which, in it's dtor,
50 		// ensures that m_pImpl will be deleted
51 		class EnsureDelete
52 		{
53 		public:
EnsureDelete()54 			EnsureDelete() { }
55 			~EnsureDelete();
56 		};
57 		friend class EnsureDelete;
58 
59 	protected:
60 		static void ensureImplExists();
61 
62 	public:
63 		/** loads the string with the specified resource id from the FormLayer resource file
64 		*/
65 		static ::rtl::OUString loadString(sal_uInt16 _nResId);
66 	};
67 
68 //.........................................................................
69 }
70 //.........................................................................
71 
72 #endif // _FRM_RESOURCE_HXX_
73 
74