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