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 _TOOLKIT_HELPER_TKRESMGR_HXX_ 25 #define _TOOLKIT_HELPER_TKRESMGR_HXX_ 26 27 #include <rtl/ustring.hxx> 28 #include <vcl/image.hxx> 29 30 class SimpleResMgr; 31 class ResMgr; 32 33 #define TK_RES_STRING(id) TkResMgr::loadString(id) 34 #define TK_RES_IMAGE(id) TkResMgr::loadImage(id) 35 36 // ----------------------------------------------------------------------------- 37 // TkResMgr 38 // ----------------------------------------------------------------------------- 39 40 class TkResMgr 41 { 42 static SimpleResMgr* m_pSimpleResMgr; 43 static ResMgr* m_pResMgr; 44 45 private: 46 // no instantiation allowed TkResMgr()47 TkResMgr() { } ~TkResMgr()48 ~TkResMgr() { } 49 50 // we'll instantiate one static member of the following class, 51 // which in it's dtor ensures that m_pSimpleResMgr will be deleted 52 class EnsureDelete 53 { 54 public: EnsureDelete()55 EnsureDelete() { } 56 ~EnsureDelete(); 57 }; 58 friend class EnsureDelete; 59 60 protected: 61 static void ensureImplExists(); 62 63 public: 64 // loads the string with the specified resource id 65 static ::rtl::OUString loadString( sal_uInt16 nResId ); 66 67 // loads the image with the specified resource id 68 static Image loadImage( sal_uInt16 nResId ); 69 static Image getImageFromURL( const ::rtl::OUString& i_rImageURL ); 70 }; 71 72 73 #endif // _TOOLKIT_HELPER_TKRESMGR_HXX_ 74 75