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_accessibility.hxx" 26 #include <accessibility/helper/accresmgr.hxx> 27 28 #ifndef _TOOLS_SIMPLERESMGR_HXX 29 #include <tools/simplerm.hxx> 30 #endif 31 #include <vcl/svapp.hxx> 32 33 34 // ----------------------------------------------------------------------------- 35 // TkResMgr 36 // ----------------------------------------------------------------------------- 37 38 SimpleResMgr* TkResMgr::m_pImpl = NULL; 39 40 // ----------------------------------------------------------------------------- 41 ~EnsureDelete()42TkResMgr::EnsureDelete::~EnsureDelete() 43 { 44 delete TkResMgr::m_pImpl; 45 } 46 47 // ----------------------------------------------------------------------------- 48 ensureImplExists()49void TkResMgr::ensureImplExists() 50 { 51 if (m_pImpl) 52 return; 53 54 ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); 55 56 ByteString sResMgrName( "acc" ); 57 58 m_pImpl = SimpleResMgr::Create( sResMgrName.GetBuffer(), aLocale ); 59 60 if (m_pImpl) 61 { 62 // now that we have a impl class, make sure it's deleted on unloading the library 63 static TkResMgr::EnsureDelete s_aDeleteTheImplClass; 64 } 65 } 66 67 // ----------------------------------------------------------------------------- 68 loadString(sal_uInt16 nResId)69::rtl::OUString TkResMgr::loadString( sal_uInt16 nResId ) 70 { 71 ::rtl::OUString sReturn; 72 73 ensureImplExists(); 74 if ( m_pImpl ) 75 sReturn = m_pImpl->ReadString( nResId ); 76 77 return sReturn; 78 } 79 80 // ----------------------------------------------------------------------------- 81