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