Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
30 : : #define __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
31 : :
32 : : #include <com/sun/star/uno/Any.h>
33 : : #include <com/sun/star/uno/Exception.hpp>
34 : :
35 : : #include <rtl/string.hxx>
36 : :
37 : : namespace framework{
38 : :
39 : : #ifndef css // conflict with define :-(
40 : : namespace css = ::com::sun::star;
41 : : #endif
42 : :
43 : : /** @short specify an exception, which can be used inside the
44 : : load environment only.
45 : :
46 : : @descr Of course outside code must wrapp it, to transport
47 : : the occurred information to its caller.
48 : :
49 : : @author as96863
50 : : */
51 : : class LoadEnvException
52 : : {
53 : :
54 : :
55 : : public:
56 : :
57 : : /** @short Can be used as an ID for an instance of a LoadEnvException.
58 : : @descr To prevent errors on adding/removing/changing such IDs here,
59 : : an enum field is used. Its int values are self organized ...
60 : : */
61 : : enum EIDs
62 : : {
63 : : /** @short The specified URL/Stream/etcpp. can not be handled by a LoadEnv instance. */
64 : : ID_UNSUPPORTED_CONTENT,
65 : :
66 : : /** @short It was not possible to get access to global filter configuration.
67 : : @descr Might som neccsessary services could not be created. */
68 : : ID_NO_CONFIG_ACCESS,
69 : :
70 : : /** @short Some data obtained from the filter configuration seems to incorrect.
71 : : @descr Might a filter-type relation ship seem to be damaged. */
72 : : ID_INVALID_FILTER_CONFIG,
73 : :
74 : : /** @short indicates a corrupted media descriptor.
75 : : @descr Some parts are required - some other ones are optional. Such exception
76 : : should be thrown, if a required item does not exists. */
77 : : ID_INVALID_MEDIADESCRIPTOR,
78 : :
79 : : /** @short Its similar to an uno::RuntimeException ....
80 : : @descr But such runtime exception can break the whole office code.
81 : : So its capsulated to this specialized load environment only.
82 : : Mostly it indicates a missing but needed resource ... e.g the
83 : : global desktop reference! */
84 : : ID_INVALID_ENVIRONMENT,
85 : :
86 : : /** @short indicates a failed search for the right target frame. */
87 : : ID_NO_TARGET_FOUND,
88 : :
89 : : /** @short An already existing document was found inside a target frame.
90 : : But its controller could not be suspended successfully. Thats
91 : : why the new load request was cancelled. The document could not
92 : : be replaced. */
93 : : ID_COULD_NOT_SUSPEND_CONTROLLER,
94 : :
95 : : /** @short TODO */
96 : : ID_COULD_NOT_REACTIVATE_CONTROLLER,
97 : :
98 : : /** @short inidcates an already running load operation. Of yourse the same
99 : : instance cant be used for multiple load requests at the same time.
100 : : */
101 : : ID_STILL_RUNNING,
102 : :
103 : : /** @short sometiems we cant specify the reason for an error, because we
104 : : was interrupted by an called code in an unexpected way ...
105 : : */
106 : : ID_GENERAL_ERROR
107 : : };
108 : :
109 : : //___________________________________________
110 : : // member
111 : :
112 : : public:
113 : :
114 : : /** @short contains a suitable message, which describes the reason for this
115 : : exception. */
116 : : ::rtl::OString m_sMessage;
117 : :
118 : : /** @short An ID, which make this exception unique among others. */
119 : : sal_Int32 m_nID;
120 : :
121 : : /** @short Contains the original exception, if any occurred. */
122 : : css::uno::Any m_exOriginal;
123 : :
124 : : /** TODO
125 : : Experimental use! May it can be usefully to know, if an exception was already
126 : : catched and handled by an interaction and was might be rethrowed! */
127 : : sal_Bool m_bHandled;
128 : :
129 : : //___________________________________________
130 : : // interface
131 : :
132 : : public:
133 : :
134 : : /** @short initialize a new instance with an ID.
135 : : @descr Some other items of this exception
136 : : (e.g. a suitable message) will be generated
137 : : automaticly.
138 : :
139 : : @param nID
140 : : One of the defined const IDs of this class.
141 : : */
142 : 0 : LoadEnvException(sal_Int32 nID)
143 : 0 : {
144 : 0 : m_nID = nID;
145 : 0 : }
146 : :
147 : : //_______________________________________
148 : :
149 : : /** @short initialize a new instance with an ID
150 : : an wrap a detected exception into this one.
151 : : @descr Some other items of this exception
152 : : (e.g. a suitable message) will be generated
153 : : automaticly.
154 : :
155 : : @param nID
156 : : One of the defined const IDs of this class.
157 : :
158 : : @param exUno
159 : : the original catched uno exception.
160 : : */
161 : 0 : LoadEnvException( sal_Int32 nID ,
162 : : const css::uno::Any& exUno)
163 : 0 : {
164 : 0 : m_nID = nID ;
165 : 0 : m_exOriginal = exUno;
166 : 0 : }
167 : :
168 : : //_______________________________________
169 : :
170 : : /** @short destruct an instance of this exception.
171 : : */
172 : 0 : ~LoadEnvException()
173 : 0 : {
174 : 0 : m_sMessage = ::rtl::OString();
175 : 0 : m_nID = 0;
176 : 0 : m_bHandled = false;
177 : 0 : m_exOriginal.clear();
178 : 0 : }
179 : : };
180 : :
181 : : } // namespace framework
182 : :
183 : : #endif // __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
184 : :
185 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|