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