1 /************************************************************************* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * Copyright 2000, 2010 Oracle and/or its affiliates. 5 * 6 * OpenOffice.org - a multi-platform office productivity suite 7 * 8 * This file is part of OpenOffice.org. 9 * 10 * OpenOffice.org is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License version 3 12 * only, as published by the Free Software Foundation. 13 * 14 * OpenOffice.org is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License version 3 for more details 18 * (a copy is included in the LICENSE file that accompanied this code). 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * version 3 along with OpenOffice.org. If not, see 22 * <http://www.openoffice.org/license.html> 23 * for a copy of the LGPLv3 License. 24 * 25 ************************************************************************/ 26 27 #ifndef DBACCESS_MIGRATIONERROR_HXX 28 #define DBACCESS_MIGRATIONERROR_HXX 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/uno/Any.hxx> 32 /** === end UNO includes === **/ 33 34 #include <vector> 35 36 //........................................................................ 37 namespace dbmm 38 { 39 //........................................................................ 40 41 enum MigrationErrorType 42 { 43 ERR_OPENING_SUB_DOCUMENT_FAILED = 1, 44 ERR_CLOSING_SUB_DOCUMENT_FAILED, 45 ERR_STORAGE_COMMIT_FAILED, 46 ERR_STORING_DATABASEDOC_FAILED, 47 ERR_COLLECTING_DOCUMENTS_FAILED, 48 ERR_UNEXPECTED_LIBSTORAGE_ELEMENT, 49 ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED, 50 ERR_COMMITTING_SCRIPT_STORAGES_FAILED, 51 ERR_GENERAL_SCRIPT_MIGRATION_FAILURE, 52 ERR_GENERAL_MACRO_MIGRATION_FAILURE, 53 ERR_UNKNOWN_SCRIPT_TYPE, 54 ERR_UNKNOWN_SCRIPT_LANGUAGE, 55 ERR_UNKNOWN_SCRIPT_NAME_FORMAT, 56 ERR_SCRIPT_TRANSLATION_FAILURE, 57 ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT, 58 ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED, 59 ERR_ADJUSTING_DIALOG_EVENTS_FAILED, 60 ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED, 61 ERR_BIND_SCRIPT_STORAGE_FAILED, 62 ERR_REMOVE_SCRIPTS_STORAGE_FAILED, 63 ERR_DOCUMENT_BACKUP_FAILED, 64 ERR_UNKNOWN_SCRIPT_FOLDER, 65 ERR_EXAMINING_SCRIPTS_FOLDER_FAILED, 66 ERR_PASSWORD_VERIFICATION_FAILED, 67 ERR_NEW_STYLE_REPORT 68 }; 69 70 //==================================================================== 71 //= MigrationError 72 //==================================================================== 73 /** encapsulates information about an error which happened during the migration 74 */ 75 struct MigrationError 76 { 77 const MigrationErrorType eType; 78 ::std::vector< ::rtl::OUString > aErrorDetails; 79 const ::com::sun::star::uno::Any aCaughtException; 80 81 MigrationError( 82 const MigrationErrorType _eType ) 83 :eType( _eType ) 84 { 85 } 86 87 MigrationError( 88 const MigrationErrorType _eType, 89 const ::com::sun::star::uno::Any& _rCaughtException ) 90 :eType( _eType ) 91 ,aCaughtException( _rCaughtException ) 92 { 93 } 94 95 MigrationError( 96 const MigrationErrorType _eType, 97 const ::rtl::OUString& _rDetail ) 98 :eType( _eType ) 99 { 100 impl_constructDetails( _rDetail ); 101 } 102 103 MigrationError( 104 const MigrationErrorType _eType, 105 const ::rtl::OUString& _rDetail, 106 const ::com::sun::star::uno::Any& _rCaughtException ) 107 :eType( _eType ) 108 ,aCaughtException( _rCaughtException ) 109 { 110 impl_constructDetails( _rDetail ); 111 } 112 113 MigrationError( 114 const MigrationErrorType _eType, 115 const ::rtl::OUString& _rDetail1, 116 const ::rtl::OUString& _rDetail2 ) 117 :eType( _eType ) 118 { 119 impl_constructDetails( _rDetail1, _rDetail2 ); 120 } 121 122 MigrationError( 123 const MigrationErrorType _eType, 124 const ::rtl::OUString& _rDetail1, 125 const ::rtl::OUString& _rDetail2, 126 const ::com::sun::star::uno::Any& _rCaughtException ) 127 :eType( _eType ) 128 ,aCaughtException( _rCaughtException ) 129 { 130 impl_constructDetails( _rDetail1, _rDetail2 ); 131 } 132 133 MigrationError( 134 const MigrationErrorType _eType, 135 const ::rtl::OUString& _rDetail1, 136 const ::rtl::OUString& _rDetail2, 137 const ::rtl::OUString& _rDetail3, 138 const ::com::sun::star::uno::Any& _rCaughtException ) 139 :eType( _eType ) 140 ,aCaughtException( _rCaughtException ) 141 { 142 impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 ); 143 } 144 145 MigrationError( 146 const MigrationErrorType _eType, 147 const ::rtl::OUString& _rDetail1, 148 const ::rtl::OUString& _rDetail2, 149 const ::rtl::OUString& _rDetail3 ) 150 :eType( _eType ) 151 { 152 impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 ); 153 } 154 155 private: 156 void impl_constructDetails( 157 const ::rtl::OUString& _rDetail1, 158 const ::rtl::OUString& _rDetail2 = ::rtl::OUString(), 159 const ::rtl::OUString& _rDetail3 = ::rtl::OUString() 160 ) 161 { 162 if ( _rDetail1.getLength() ) aErrorDetails.push_back( _rDetail1 ); 163 if ( _rDetail2.getLength() ) aErrorDetails.push_back( _rDetail2 ); 164 if ( _rDetail3.getLength() ) aErrorDetails.push_back( _rDetail3 ); 165 } 166 }; 167 168 //........................................................................ 169 } // namespace dbmm 170 //........................................................................ 171 172 #endif // DBACCESS_MIGRATIONERROR_HXX 173 174