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 INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONERROR_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONERROR_HXX
22 :
23 : #include <com/sun/star/uno/Any.hxx>
24 :
25 : #include <vector>
26 :
27 : namespace dbmm
28 : {
29 :
30 : enum MigrationErrorType
31 : {
32 : ERR_OPENING_SUB_DOCUMENT_FAILED = 1,
33 : ERR_CLOSING_SUB_DOCUMENT_FAILED,
34 : ERR_STORAGE_COMMIT_FAILED,
35 : ERR_STORING_DATABASEDOC_FAILED,
36 : ERR_COLLECTING_DOCUMENTS_FAILED,
37 : ERR_UNEXPECTED_LIBSTORAGE_ELEMENT,
38 : ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED,
39 : ERR_COMMITTING_SCRIPT_STORAGES_FAILED,
40 : ERR_GENERAL_SCRIPT_MIGRATION_FAILURE,
41 : ERR_GENERAL_MACRO_MIGRATION_FAILURE,
42 : ERR_UNKNOWN_SCRIPT_TYPE,
43 : ERR_UNKNOWN_SCRIPT_LANGUAGE,
44 : ERR_UNKNOWN_SCRIPT_NAME_FORMAT,
45 : ERR_SCRIPT_TRANSLATION_FAILURE,
46 : ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT,
47 : ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED,
48 : ERR_ADJUSTING_DIALOG_EVENTS_FAILED,
49 : ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED,
50 : ERR_BIND_SCRIPT_STORAGE_FAILED,
51 : ERR_REMOVE_SCRIPTS_STORAGE_FAILED,
52 : ERR_DOCUMENT_BACKUP_FAILED,
53 : ERR_UNKNOWN_SCRIPT_FOLDER,
54 : ERR_EXAMINING_SCRIPTS_FOLDER_FAILED,
55 : ERR_PASSWORD_VERIFICATION_FAILED,
56 : ERR_NEW_STYLE_REPORT
57 : };
58 :
59 : // MigrationError
60 : /** encapsulates information about an error which happened during the migration
61 : */
62 0 : struct MigrationError
63 : {
64 : const MigrationErrorType eType;
65 : ::std::vector< OUString > aErrorDetails;
66 : const ::com::sun::star::uno::Any aCaughtException;
67 :
68 : MigrationError(
69 : const MigrationErrorType _eType )
70 : :eType( _eType )
71 : {
72 : }
73 :
74 0 : MigrationError(
75 : const MigrationErrorType _eType,
76 : const ::com::sun::star::uno::Any& _rCaughtException )
77 : :eType( _eType )
78 0 : ,aCaughtException( _rCaughtException )
79 : {
80 0 : }
81 :
82 0 : MigrationError(
83 : const MigrationErrorType _eType,
84 : const OUString& _rDetail )
85 0 : :eType( _eType )
86 : {
87 0 : impl_constructDetails( _rDetail );
88 0 : }
89 :
90 0 : MigrationError(
91 : const MigrationErrorType _eType,
92 : const OUString& _rDetail,
93 : const ::com::sun::star::uno::Any& _rCaughtException )
94 : :eType( _eType )
95 0 : ,aCaughtException( _rCaughtException )
96 : {
97 0 : impl_constructDetails( _rDetail );
98 0 : }
99 :
100 0 : MigrationError(
101 : const MigrationErrorType _eType,
102 : const OUString& _rDetail1,
103 : const OUString& _rDetail2 )
104 0 : :eType( _eType )
105 : {
106 0 : impl_constructDetails( _rDetail1, _rDetail2 );
107 0 : }
108 :
109 0 : MigrationError(
110 : const MigrationErrorType _eType,
111 : const OUString& _rDetail1,
112 : const OUString& _rDetail2,
113 : const ::com::sun::star::uno::Any& _rCaughtException )
114 : :eType( _eType )
115 0 : ,aCaughtException( _rCaughtException )
116 : {
117 0 : impl_constructDetails( _rDetail1, _rDetail2 );
118 0 : }
119 :
120 0 : MigrationError(
121 : const MigrationErrorType _eType,
122 : const OUString& _rDetail1,
123 : const OUString& _rDetail2,
124 : const OUString& _rDetail3,
125 : const ::com::sun::star::uno::Any& _rCaughtException )
126 : :eType( _eType )
127 0 : ,aCaughtException( _rCaughtException )
128 : {
129 0 : impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
130 0 : }
131 :
132 0 : MigrationError(
133 : const MigrationErrorType _eType,
134 : const OUString& _rDetail1,
135 : const OUString& _rDetail2,
136 : const OUString& _rDetail3 )
137 0 : :eType( _eType )
138 : {
139 0 : impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
140 0 : }
141 :
142 : private:
143 0 : void impl_constructDetails(
144 : const OUString& _rDetail1,
145 : const OUString& _rDetail2 = OUString(),
146 : const OUString& _rDetail3 = OUString()
147 : )
148 : {
149 0 : if ( !_rDetail1.isEmpty() ) aErrorDetails.push_back( _rDetail1 );
150 0 : if ( !_rDetail2.isEmpty() ) aErrorDetails.push_back( _rDetail2 );
151 0 : if ( !_rDetail3.isEmpty() ) aErrorDetails.push_back( _rDetail3 );
152 0 : }
153 : };
154 :
155 : } // namespace dbmm
156 :
157 : #endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONERROR_HXX
158 :
159 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|