1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: wrapexception.hxx,v $
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 CONFIGMGR_WRAPEXCEPTION_HXX
32 #define CONFIGMGR_WRAPEXCEPTION_HXX
34 #include <com/sun/star/configuration/MissingBootstrapFileException.hpp>
35 #include <com/sun/star/configuration/InvalidBootstrapFileException.hpp>
36 #include <com/sun/star/configuration/InstallationIncompleteException.hpp>
37 #include <com/sun/star/configuration/CannotLoadConfigurationException.hpp>
38 #include <com/sun/star/configuration/backend/BackendSetupException.hpp>
39 #include <com/sun/star/configuration/backend/AuthenticationFailedException.hpp>
40 #include <com/sun/star/configuration/backend/InvalidAuthenticationMechanismException.hpp>
41 #include <com/sun/star/configuration/backend/CannotConnectException.hpp>
42 #include <com/sun/star/configuration/backend/InsufficientAccessRightsException.hpp>
44 #include <com/sun/star/configuration/backend/BackendAccessException.hpp>
45 #include <com/sun/star/configuration/backend/ConnectionLostException.hpp>
46 #include <com/sun/star/configuration/backend/MalformedDataException.hpp>
48 #include <com/sun/star/lang/DisposedException.hpp>
49 #include <com/sun/star/lang/WrappedTargetException.hpp>
50 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
51 #include <com/sun/star/xml/sax/SAXException.hpp>
52 #include <com/sun/star/xml/sax/SAXParseException.hpp>
54 #define WRAP_EXCEPTION( ETyp, Raise ) \
55 catch (ETyp & _e_) { Raise( uno::makeAny(_e_) ); }
57 #define WRAP_EXCEPTION1( ETyp, Raise, Arg ) \
58 catch (ETyp & _e_) { Raise( uno::makeAny(_e_), (Arg) ); }
60 #define PASS_EXCEPTION( ETyp ) \
61 catch (ETyp & ) { throw; }
63 #define WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS( Raise ) \
64 WRAP_EXCEPTION(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise) \
65 WRAP_EXCEPTION(::com::sun::star::configuration::backend::AuthenticationFailedException, Raise) \
66 WRAP_EXCEPTION(::com::sun::star::configuration::backend::InvalidAuthenticationMechanismException, Raise) \
67 WRAP_EXCEPTION(::com::sun::star::configuration::backend::CannotConnectException, Raise) \
68 WRAP_EXCEPTION(::com::sun::star::configuration::backend::BackendSetupException, Raise) \
69 WRAP_EXCEPTION(::com::sun::star::configuration::backend::BackendAccessException, Raise) \
70 WRAP_EXCEPTION(::com::sun::star::configuration::MissingBootstrapFileException, Raise) \
71 WRAP_EXCEPTION(::com::sun::star::configuration::InvalidBootstrapFileException, Raise) \
72 WRAP_EXCEPTION(::com::sun::star::configuration::InstallationIncompleteException, Raise) \
73 WRAP_EXCEPTION(::com::sun::star::configuration::CannotLoadConfigurationException, Raise) \
74 WRAP_EXCEPTION(::com::sun::star::lang::WrappedTargetException, Raise) \
75 WRAP_EXCEPTION(::com::sun::star::lang::WrappedTargetRuntimeException, Raise) \
76 WRAP_EXCEPTION(::com::sun::star::lang::DisposedException, Raise) \
77 WRAP_EXCEPTION(::com::sun::star::uno::RuntimeException, Raise) \
78 WRAP_EXCEPTION(::com::sun::star::uno::Exception, Raise)
80 #define WRAP_CONFIGBACKEND_EXCEPTIONS( Raise ) \
81 WRAP_EXCEPTION(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise) \
82 WRAP_EXCEPTION(::com::sun::star::configuration::backend::ConnectionLostException, Raise) \
83 WRAP_EXCEPTION(::com::sun::star::configuration::backend::BackendAccessException, Raise) \
85 #define WRAP_CONFIGDATA_EXCEPTIONS( Raise ) \
86 WRAP_EXCEPTION(::com::sun::star::configuration::backend::MalformedDataException, Raise) \
87 WRAP_CONFIGBACKEND_EXCEPTIONS( Raise ) \
88 WRAP_EXCEPTION(::com::sun::star::lang::WrappedTargetException, Raise) \
90 #define WRAP_SAX_EXCEPTIONS( Raise ) \
91 WRAP_EXCEPTION(::com::sun::star::xml::sax::SAXParseException, Raise) \
92 WRAP_EXCEPTION(::com::sun::star::xml::sax::SAXException, Raise) \
94 #define WRAP_OTHER_EXCEPTIONS( Raise ) \
95 WRAP_EXCEPTION(::com::sun::star::uno::Exception, Raise)
97 #define WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS1( Raise, Arg ) \
98 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise, Arg) \
99 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::AuthenticationFailedException, Raise, Arg) \
100 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::InvalidAuthenticationMechanismException, Raise, Arg) \
101 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::CannotConnectException, Raise, Arg) \
102 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::BackendSetupException, Raise, Arg) \
103 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::BackendAccessException, Raise, Arg) \
104 WRAP_EXCEPTION1(::com::sun::star::configuration::MissingBootstrapFileException, Raise, Arg) \
105 WRAP_EXCEPTION1(::com::sun::star::configuration::InvalidBootstrapFileException, Raise, Arg) \
106 WRAP_EXCEPTION1(::com::sun::star::configuration::InstallationIncompleteException, Raise, Arg) \
107 WRAP_EXCEPTION1(::com::sun::star::configuration::CannotLoadConfigurationException, Raise, Arg) \
108 WRAP_EXCEPTION1(::com::sun::star::lang::WrappedTargetException, Raise, Arg) \
109 WRAP_EXCEPTION1(::com::sun::star::lang::WrappedTargetRuntimeException, Raise, Arg) \
110 WRAP_EXCEPTION1(::com::sun::star::lang::DisposedException, Raise, Arg) \
111 WRAP_EXCEPTION1(::com::sun::star::uno::RuntimeException, Raise, Arg) \
112 WRAP_EXCEPTION1(::com::sun::star::uno::Exception, Raise, Arg)
114 #define WRAP_CONFIGBACKEND_EXCEPTIONS1( Raise, Arg ) \
115 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise, Arg) \
116 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::ConnectionLostException, Raise, Arg) \
117 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::BackendAccessException, Raise, Arg) \
119 #define WRAP_CONFIGDATA_EXCEPTIONS1( Raise, Arg ) \
120 WRAP_EXCEPTION1(::com::sun::star::configuration::backend::MalformedDataException, Raise, Arg) \
121 WRAP_CONFIGBACKEND_EXCEPTIONS1( Raise, Arg ) \
122 WRAP_EXCEPTION1(::com::sun::star::lang::WrappedTargetException, Raise, Arg) \
124 #define WRAP_SAX_EXCEPTIONS1( Raise, Arg ) \
125 WRAP_EXCEPTION1(::com::sun::star::xml::sax::SAXParseException, Raise, Arg) \
126 WRAP_EXCEPTION1(::com::sun::star::xml::sax::SAXException, Raise, Arg) \
128 #define WRAP_OTHER_EXCEPTIONS1( Raise, Arg ) \
129 WRAP_EXCEPTION1(::com::sun::star::uno::Exception, Raise, Arg)
131 #endif // CONFIGMGR_WRAPEXCEPTION_HXX