2002-10-11 07:41:19 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* $RCSfile: configaccess.hxx,v $
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* $Revision: 1.3 $
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-09 00:21:54 $
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
2005-09-08 18:21:54 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-10-11 07:41:19 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_
|
|
|
|
#define __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_
|
|
|
|
|
|
|
|
//_______________________________________
|
|
|
|
// my own includes
|
|
|
|
|
|
|
|
#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
|
|
|
|
#include <threadhelp/threadhelpbase.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
|
|
|
|
#include <macros/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __FRAMEWORK_GENERAL_H_
|
|
|
|
#include <general.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//_______________________________________
|
|
|
|
// interface includes
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//_______________________________________
|
|
|
|
// other includes
|
|
|
|
|
|
|
|
#ifndef _RTL_USTRING_HXX_
|
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//_______________________________________
|
|
|
|
// namespace
|
|
|
|
|
|
|
|
namespace framework{
|
|
|
|
|
|
|
|
//_______________________________________
|
|
|
|
// public const
|
|
|
|
|
|
|
|
//_______________________________________
|
|
|
|
/**
|
|
|
|
@short implements a simple configuration access
|
|
|
|
@descr Sometimes it's better to have direct config access
|
|
|
|
instead of using soecialize config items of the svtools
|
|
|
|
project. This class can wrapp such configuration access.
|
|
|
|
*/
|
|
|
|
class ConfigAccess : public ThreadHelpBase
|
|
|
|
{
|
|
|
|
//___________________________________
|
|
|
|
// const
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/** represent the possible modes of the internal wrapped configuration access */
|
|
|
|
enum EOpenMode
|
|
|
|
{
|
|
|
|
/// config isn't used yet
|
|
|
|
E_CLOSED,
|
|
|
|
/// config access is open for reading only
|
|
|
|
E_READONLY,
|
|
|
|
/// config access is open for reading/writing data
|
|
|
|
E_READWRITE
|
|
|
|
};
|
|
|
|
|
|
|
|
//___________________________________
|
|
|
|
// member
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
reference to the uno service manager
|
|
|
|
It's neccessary to instanciate own needed services.
|
|
|
|
*/
|
|
|
|
css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
|
|
|
|
|
|
|
|
/** hold an opened configuration alive */
|
|
|
|
css::uno::Reference< css::uno::XInterface > m_xConfig;
|
|
|
|
|
|
|
|
/** knows the root of the opened config access point */
|
|
|
|
::rtl::OUString m_sRoot;
|
|
|
|
|
|
|
|
/** represent the current open mode */
|
|
|
|
EOpenMode m_eMode;
|
|
|
|
|
|
|
|
//___________________________________
|
|
|
|
// native interface methods
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConfigAccess( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
|
|
|
|
const ::rtl::OUString& sRoot );
|
|
|
|
virtual ~ConfigAccess();
|
|
|
|
|
2003-03-25 11:22:13 -06:00
|
|
|
virtual void open ( EOpenMode eMode );
|
|
|
|
virtual void close ( );
|
|
|
|
virtual EOpenMode getMode( ) const;
|
2002-10-11 07:41:19 -05:00
|
|
|
|
|
|
|
virtual const css::uno::Reference< css::uno::XInterface >& cfg();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace framework
|
|
|
|
|
|
|
|
#endif // __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_
|