Update ooo320-m1
[ooovba.git] / framework / inc / jobs / configaccess.hxx
blob5b2da2f3ef4d61e53252f21f88f60035651e56c7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: configaccess.hxx,v $
10 * $Revision: 1.4 $
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 #ifndef __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_
32 #define __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_
34 //_______________________________________
35 // my own includes
37 #include <threadhelp/threadhelpbase.hxx>
38 #include <macros/debug.hxx>
39 #include <general.h>
41 //_______________________________________
42 // interface includes
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 //_______________________________________
46 // other includes
47 #include <rtl/ustring.hxx>
49 //_______________________________________
50 // namespace
52 namespace framework{
54 //_______________________________________
55 // public const
57 //_______________________________________
58 /**
59 @short implements a simple configuration access
60 @descr Sometimes it's better to have direct config access
61 instead of using soecialize config items of the svtools
62 project. This class can wrapp such configuration access.
64 class ConfigAccess : public ThreadHelpBase
66 //___________________________________
67 // const
69 public:
71 /** represent the possible modes of the internal wrapped configuration access */
72 enum EOpenMode
74 /// config isn't used yet
75 E_CLOSED,
76 /// config access is open for reading only
77 E_READONLY,
78 /// config access is open for reading/writing data
79 E_READWRITE
82 //___________________________________
83 // member
85 private:
87 /**
88 reference to the uno service manager
89 It's neccessary to instanciate own needed services.
91 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
93 /** hold an opened configuration alive */
94 css::uno::Reference< css::uno::XInterface > m_xConfig;
96 /** knows the root of the opened config access point */
97 ::rtl::OUString m_sRoot;
99 /** represent the current open mode */
100 EOpenMode m_eMode;
102 //___________________________________
103 // native interface methods
105 public:
107 ConfigAccess( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
108 const ::rtl::OUString& sRoot );
109 virtual ~ConfigAccess();
111 virtual void open ( EOpenMode eMode );
112 virtual void close ( );
113 virtual EOpenMode getMode( ) const;
115 virtual const css::uno::Reference< css::uno::XInterface >& cfg();
118 } // namespace framework
120 #endif // __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_