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