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: configexcept.hxx,v $
10 * $Revision: 1.6.10.2 $
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_CONFIGEXCEPT_HXX_
32 #define CONFIGMGR_CONFIGEXCEPT_HXX_
34 #include <rtl/ustring.hxx>
35 #include <rtl/string.hxx>
36 #include <com/sun/star/uno/Exception.hpp>
37 #include <com/sun/star/lang/IllegalArgumentException.hpp>
41 //-------------------------------------------------------------------------
42 namespace uno
= ::com::sun::star::uno
;
43 namespace lang
= ::com::sun::star::lang
;
44 //-----------------------------------------------------------------------------
45 namespace configuration
47 //-------------------------------------------------------------------------
51 rtl::OString m_sAsciiMessage
;
53 Exception(char const* sAsciiMessage
);
54 Exception(rtl::OString
const& sAsciiMessage
);
55 virtual ~Exception() {}
57 virtual rtl::OUString
message() const;
58 virtual char const* what() const;
60 //-------------------------------------------------------------------------
62 class InvalidName
: public Exception
64 rtl::OUString m_sName
;
66 InvalidName(rtl::OUString
const& sName
, char const* sAsciiDescription
);
68 virtual rtl::OUString
message() const;
70 //-------------------------------------------------------------------------
72 class ConstraintViolation
76 ConstraintViolation(char const* sConstraint
);
78 //-------------------------------------------------------------------------
80 class TypeMismatch
: public Exception
82 rtl::OUString m_sTypes
;
83 static rtl::OUString
describe(rtl::OUString
const& sFoundType
, rtl::OUString
const& sExpectedType
);
85 TypeMismatch(rtl::OUString
const& sFoundType
, rtl::OUString
const& sExpectedType
);
86 TypeMismatch(rtl::OUString
const& sFoundType
, rtl::OUString
const& sExpectedType
, char const* sAsciiDescription
);
88 virtual rtl::OUString
message() const;
90 //-------------------------------------------------------------------------
93 //-----------------------------------------------------------------------------
94 //-----------------------------------------------------------------------------
97 //-------------------------------------------------------------------------
100 configuration::Exception
& m_eOriginal
;
101 uno::Reference
<uno::XInterface
> m_xContext
;
102 rtl::OUString m_sMessage
;
104 ExceptionMapper(configuration::Exception
& e
);
107 void setContext(uno::XInterface
* pContext
);
109 rtl::OUString
message() const;
110 uno::Reference
<uno::XInterface
> context() const;
112 void illegalArgument(sal_Int16 nArgument
= -1) throw(lang::IllegalArgumentException
);
113 void unhandled() throw(uno::RuntimeException
);
115 //-------------------------------------------------------------------------
117 //-----------------------------------------------------------------------------
120 #endif // CONFIGMGR_CONFIGEXCEPT_HXX_