xref: /trunk/main/desktop/source/app/configinit.hxx (revision cdf0e10c)
1 #ifndef _DESKTOP_CONFIGINIT_HXX_
2 #define _DESKTOP_CONFIGINIT_HXX_
3 
4 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
5 #include <rtl/ustring.hxx>
6 
7 /** creates a ConfigurationProvider instance
8 Important: exceptions thrown from that method will contain a readily
9 displayable message.
10 
11     @return
12         The default configuration provider for the application or<br/>
13         <NULL/>, if startup was canceled
14 
15     @throw com::sun::star::configuration::CannotLoadConfigurationException
16         if the configuration provider can't be created
17 
18     @throw com::sun::star::lang::ServiceNotRegisteredException
19         if the ConfigurationProvider service is unknwon
20 
21     @throw com::sun::star::lang::WrappedTargetException
22         if the configuration backend could be created,
23         but incurred a failure later
24 
25 */
26 extern
27 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
28     CreateApplicationConfigurationProvider( );
29 
30 //-----------------------------------------------------------------------------
31 #include <com/sun/star/task/XInteractionHandler.hpp>
32 
33 /**
34     sets an InteractionHandler for configuration errors in the current context.
35 
36   */
37     class ConfigurationErrorHandler
38     {
39     public:
40         typedef com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > InteractionHandler;
41 
42         /// Constructor: Uses the default interaction handler
43         ConfigurationErrorHandler()
44         : m_pContext(0), m_xHandler()
45         {}
46 
47         /// Constructor: Uses an externally provided interaction handler
48         ConfigurationErrorHandler(const InteractionHandler & xHandler)
49         : m_pContext(0), m_xHandler( xHandler )
50         {}
51 
52         ~ConfigurationErrorHandler();
53 
54         static InteractionHandler getDefaultInteractionHandler();
55 
56         /// installs the handler into the current context
57         void activate();
58         /// deinstalls the handler from the current context, restoring the previous context
59         void deactivate();
60     private:
61         class Context;
62         Context * m_pContext;
63         InteractionHandler m_xHandler;
64     private:
65         // not implemented - suppress copy
66         ConfigurationErrorHandler(const ConfigurationErrorHandler&);
67         void operator=(const ConfigurationErrorHandler&);
68     };
69 
70 //-----------------------------------------------------------------------------
71 #endif
72