merge the formfield patch from ooo-build
[ooovba.git] / framework / source / inc / loadenv / loadenvexception.hxx
blob4ba70befcb1701b79df33824a654eb49451bc36e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: loadenvexception.hxx,v $
10 * $Revision: 1.4 $
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 __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
32 #define __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
34 //_______________________________________________
35 // includes of own project
37 //_______________________________________________
38 // includes of uno interface
40 #include <com/sun/star/uno/Any.h>
41 #include <com/sun/star/uno/Exception.hpp>
43 //_______________________________________________
44 // includes of an other project
45 #include <rtl/string.hxx>
47 //_______________________________________________
48 // namespace
50 namespace framework{
52 #ifndef css // conflict with define :-(
53 namespace css = ::com::sun::star;
54 #endif
56 //_______________________________________________
57 // definitions
59 /** @short specify an exception, which can be used inside the
60 load environment only.
62 @descr Of course outside code must wrapp it, to transport
63 the occured information to its caller.
65 @author as96863
67 class LoadEnvException
69 //___________________________________________
70 // const
72 public:
74 /** @short Can be used as an ID for an instance of a LoadEnvException.
75 @descr To prevent errors on adding/removing/changing such IDs here,
76 an enum field is used. Its int values are self organized ...
78 enum EIDs
80 /** @short The specified URL/Stream/etcpp. can not be handled by a LoadEnv instance. */
81 ID_UNSUPPORTED_CONTENT,
83 /** @short It was not possible to get access to global filter configuration.
84 @descr Might som neccsessary services could not be created. */
85 ID_NO_CONFIG_ACCESS,
87 /** @short Some data obtained from the filter configuration seems to incorrect.
88 @descr Might a filter-type relation ship seem to be damaged. */
89 ID_INVALID_FILTER_CONFIG,
91 /** @short indicates a corrupted media descriptor.
92 @descr Some parts are required - some other ones are optional. Such exception
93 should be thrown, if a required item does not exists. */
94 ID_INVALID_MEDIADESCRIPTOR,
96 /** @short Its similar to an uno::RuntimeException ....
97 @descr But such runtime exception can break the whole office code.
98 So its capsulated to this specialized load environment only.
99 Mostly it indicates a missing but needed resource ... e.g the
100 global desktop reference! */
101 ID_INVALID_ENVIRONMENT,
103 /** @short indicates a failed search for the right target frame. */
104 ID_NO_TARGET_FOUND,
106 /** @short An already existing document was found inside a target frame.
107 But its controller could not be suspended successfully. Thats
108 why the new load request was cancelled. The document could not
109 be replaced. */
110 ID_COULD_NOT_SUSPEND_CONTROLLER,
112 /** @short TODO */
113 ID_COULD_NOT_REACTIVATE_CONTROLLER,
115 /** @short inidcates an already running load operation. Of yourse the same
116 instance cant be used for multiple load requests at the same time.
118 ID_STILL_RUNNING,
120 /** @short sometiems we cant specify the reason for an error, because we
121 was interrupted by an called code in an unexpected way ...
123 ID_GENERAL_ERROR
126 //___________________________________________
127 // member
129 public:
131 /** @short contains a suitable message, which describes the reason for this
132 exception. */
133 ::rtl::OString m_sMessage;
135 /** @short An ID, which make this exception unique among others. */
136 sal_Int32 m_nID;
138 /** @short Contains the original exception, if any occured. */
139 css::uno::Any m_exOriginal;
141 /** TODO
142 Experimental use! May it can be usefully to know, if an exception was already
143 catched and handled by an interaction and was might be rethrowed! */
144 sal_Bool m_bHandled;
146 //___________________________________________
147 // interface
149 public:
151 /** @short initialize a new instance with an ID.
152 @descr Some other items of this exception
153 (e.g. a suitable message) will be generated
154 automaticly.
156 @param nID
157 One of the defined const IDs of this class.
159 LoadEnvException(sal_Int32 nID)
161 m_nID = nID;
164 //_______________________________________
166 /** @short initialize a new instance with an ID
167 an wrap a detected exception into this one.
168 @descr Some other items of this exception
169 (e.g. a suitable message) will be generated
170 automaticly.
172 @param nID
173 One of the defined const IDs of this class.
175 @param exUno
176 the original catched uno exception.
178 LoadEnvException( sal_Int32 nID ,
179 const css::uno::Exception& exUno)
181 m_nID = nID ;
182 m_exOriginal <<= exUno;
185 //_______________________________________
187 /** @short destruct an instance of this exception.
189 ~LoadEnvException()
191 m_sMessage = ::rtl::OString();
192 m_nID = 0;
193 m_bHandled = false;
194 m_exOriginal.clear();
198 } // namespace framework
200 #endif // __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_