1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SVTOOLS_LOCALRESACCESS_HXX_
21 #define _SVTOOLS_LOCALRESACCESS_HXX_
23 #include <tools/rc.hxx>
24 #include <tools/rcid.h>
25 #include <osl/diagnose.h>
27 //.........................................................................
30 //.........................................................................
32 //=========================================================================
33 //= OLocalResourceAccess
34 //=========================================================================
35 /** helper class for acessing local resources
37 class OLocalResourceAccess
: public Resource
43 OLocalResourceAccess( const ResId
& _rId
)
44 :Resource( _rId
.SetAutoRelease( sal_False
) )
45 ,m_pManager( _rId
.GetResMgr() )
49 OLocalResourceAccess(const ResId
& _rId
, RESOURCE_TYPE _rType
)
50 :Resource(_rId
.SetRT(_rType
).SetAutoRelease(sal_False
))
51 ,m_pManager(_rId
.GetResMgr())
53 OSL_ENSURE( m_pManager
!= NULL
, "OLocalResourceAccess::OLocalResourceAccess: invalid resource manager!" );
56 ~OLocalResourceAccess()
59 m_pManager
->Increment( m_pManager
->GetRemainSize() );
63 inline sal_Bool
IsAvailableRes( const ResId
& _rId
) const
65 return Resource::IsAvailableRes( _rId
);
69 //.........................................................................
71 //.........................................................................
73 #endif // _SVTOOLS_LOCALRESACCESS_HXX_
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */