1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tkresmgr.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include <toolkit/helper/tkresmgr.hxx>
34 #include <tools/simplerm.hxx>
35 #ifndef _TOOLS_RESMGR_HXX_
36 #include <tools/resmgr.hxx>
40 #include <vcl/svapp.hxx>
43 // -----------------------------------------------------------------------------
45 // -----------------------------------------------------------------------------
47 SimpleResMgr
* TkResMgr::m_pSimpleResMgr
= NULL
;
48 ResMgr
* TkResMgr::m_pResMgr
= NULL
;
50 // -----------------------------------------------------------------------------
52 TkResMgr::EnsureDelete::~EnsureDelete()
54 delete TkResMgr::m_pSimpleResMgr
;
55 // delete TkResMgr::m_pResMgr;
58 // -----------------------------------------------------------------------------
60 void TkResMgr::ensureImplExists()
65 ::com::sun::star::lang::Locale aLocale
= Application::GetSettings().GetUILocale();
67 ByteString
sResMgrName( "tk" );
69 m_pSimpleResMgr
= SimpleResMgr::Create( sResMgrName
.GetBuffer(), aLocale
);
70 m_pResMgr
= ResMgr::CreateResMgr( sResMgrName
.GetBuffer() );
74 // now that we have a impl class, make sure it's deleted on unloading the library
75 static TkResMgr::EnsureDelete s_aDeleteTheImplClass
;
79 // -----------------------------------------------------------------------------
80 ::rtl::OUString
TkResMgr::loadString( sal_uInt16 nResId
)
82 ::rtl::OUString sReturn
;
85 if ( m_pSimpleResMgr
)
86 sReturn
= m_pSimpleResMgr
->ReadString( nResId
);
91 // -----------------------------------------------------------------------------
92 Image
TkResMgr::loadImage( sal_uInt16 nResId
)
98 aReturn
= Image( ResId( nResId
, *m_pResMgr
) );
103 // -----------------------------------------------------------------------------