Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ext / macromigration / migrationlog.hxx
blob1a854e6e89f623356cf4924c813b69a4e4f112b2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONLOG_HXX
21 #define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONLOG_HXX
23 #include "dbmm_types.hxx"
25 #include <rtl/ustring.hxx>
27 #include <memory>
29 namespace dbmm
32 typedef sal_Int16 DocumentID;
33 struct MigrationError;
35 // MigrationLog
36 struct MigrationLog_Data;
37 class MigrationLog
39 public:
40 MigrationLog();
41 ~MigrationLog();
43 //- event logging
45 /** logs an unrecoverable error during the migration process
47 void logFailure( const MigrationError& _rError );
49 /** logs a recoverable (or at least ignorable) error during the migration process
51 void logRecoverable( const MigrationError& _rError );
53 /// checks whether logFailure has been called
54 bool hadFailure() const;
56 /// logs the fact that the database document has been backed up
57 void backedUpDocument( const OUString& _rNewDocumentLocation );
59 /** logs that the migration for a certain sub document has been started, returns
60 a unique ID for this sub document which is to be used in later calls
62 DocumentID startedDocument( const SubDocumentType _eType, const OUString& _rName );
64 /** logs the event that a macro or script library has been moved from within a
65 sub document to the database document
67 void movedLibrary(
68 const DocumentID _nDocID,
69 const ScriptType _eScriptType,
70 const OUString& _rOriginalLibName,
71 const OUString& _rNewLibName
74 /** logs that the migration for a certain document has been finished
76 void finishedDocument( const DocumentID _nDocID );
78 //- information retrieval
80 /** retrieves the new name of a library
82 The new library name must previously have been logger by calling
83 <member>movedLibrary</member>. If not, an assertion will be raised in
84 the non-product builds, and an empty string will be returned.
86 const OUString&
87 getNewLibraryName(
88 DocumentID _nDocID,
89 ScriptType _eScriptType,
90 const OUString& _rOriginalLibName
91 ) const;
93 /** determines whether for the given document, any library needed to be (and was) moved
95 bool movedAnyLibrary( const DocumentID );
97 /** provides a human-readable version of the log, explaining a user what happened during
98 the migration.
100 OUString
101 getCompleteLog() const;
103 private:
104 ::std::unique_ptr< MigrationLog_Data > m_pData;
107 } // namespace dbmm
109 #endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONLOG_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */