LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ext/macromigration - migrationlog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 208 0.0 %
Date: 2012-12-27 Functions: 0 25 0.0 %
Legend: Lines: hit not hit

          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             : 
      21             : #include "dbmm_module.hxx"
      22             : #include "dbmm_global.hrc"
      23             : #include "migrationerror.hxx"
      24             : #include "migrationlog.hxx"
      25             : 
      26             : 
      27             : #include <comphelper/anytostring.hxx>
      28             : #include <tools/string.hxx>
      29             : #include <rtl/ustrbuf.hxx>
      30             : 
      31             : #include <vector>
      32             : #include <map>
      33             : #include <list>
      34             : 
      35             : //........................................................................
      36             : namespace dbmm
      37             : {
      38             : //........................................................................
      39             : 
      40             :     /** === begin UNO using === **/
      41             :     /** === end UNO using === **/
      42             : 
      43             :     //====================================================================
      44             :     //= LibraryEntry
      45             :     //====================================================================
      46           0 :     struct LibraryEntry
      47             :     {
      48             :         ScriptType      eType;
      49             :         ::rtl::OUString sOldName;
      50             :         ::rtl::OUString sNewName;
      51             : 
      52             :         LibraryEntry()
      53             :             :eType( eBasic )
      54             :             ,sOldName()
      55             :             ,sNewName()
      56             :         {
      57             :         }
      58             : 
      59           0 :         LibraryEntry( const ScriptType& _eType, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName )
      60             :             :eType( _eType )
      61             :             ,sOldName( _rOldName )
      62           0 :             ,sNewName( _rNewName )
      63             :         {
      64           0 :         }
      65             :     };
      66             : 
      67             :     //====================================================================
      68             :     //= DocumentEntry
      69             :     //====================================================================
      70           0 :     struct DocumentEntry
      71             :     {
      72             :         SubDocumentType                 eType;
      73             :         ::rtl::OUString                 sName;
      74             :         ::std::vector< LibraryEntry >   aMovedLibraries;
      75             : 
      76           0 :         DocumentEntry()
      77             :             :eType( eForm )
      78             :             ,sName()
      79           0 :             ,aMovedLibraries()
      80             :         {
      81           0 :         }
      82             : 
      83           0 :         DocumentEntry( const SubDocumentType _eType, const ::rtl::OUString& _rName )
      84             :             :eType( _eType )
      85           0 :             ,sName( _rName )
      86             :         {
      87           0 :         }
      88             :     };
      89             : 
      90             :     //====================================================================
      91             :     //= DocumentLogs
      92             :     //====================================================================
      93             :     typedef ::std::map< DocumentID, DocumentEntry > DocumentLogs;
      94             : 
      95             :     //====================================================================
      96             :     //= ErrorLog
      97             :     //====================================================================
      98             :     typedef ::std::list< MigrationError >   ErrorLog;
      99             : 
     100             :     //====================================================================
     101             :     //= MigrationLog_Data
     102             :     //====================================================================
     103           0 :     struct MigrationLog_Data
     104             :     {
     105             :         ::rtl::OUString sBackupLocation;
     106             :         DocumentLogs    aDocumentLogs;
     107             :         ErrorLog        aFailures;
     108             :         ErrorLog        aWarnings;
     109             :     };
     110             : 
     111             :     //====================================================================
     112             :     //= MigrationLog
     113             :     //====================================================================
     114             :     //--------------------------------------------------------------------
     115           0 :     MigrationLog::MigrationLog()
     116           0 :         :m_pData( new MigrationLog_Data )
     117             :     {
     118           0 :     }
     119             : 
     120             :     //--------------------------------------------------------------------
     121           0 :     MigrationLog::~MigrationLog()
     122             :     {
     123           0 :     }
     124             : 
     125             :     //--------------------------------------------------------------------
     126           0 :     void MigrationLog::logFailure( const MigrationError& _rError )
     127             :     {
     128           0 :         m_pData->aFailures.push_back( _rError );
     129           0 :     }
     130             : 
     131             :     //--------------------------------------------------------------------
     132           0 :     void MigrationLog::logRecoverable( const MigrationError& _rError )
     133             :     {
     134           0 :         m_pData->aWarnings.push_back( _rError );
     135           0 :     }
     136             : 
     137             :     //--------------------------------------------------------------------
     138           0 :     bool MigrationLog::hadFailure() const
     139             :     {
     140           0 :         return !m_pData->aFailures.empty();
     141             :     }
     142             : 
     143             :     //--------------------------------------------------------------------
     144           0 :     void MigrationLog::backedUpDocument( const ::rtl::OUString& _rNewDocumentLocation )
     145             :     {
     146           0 :         m_pData->sBackupLocation = _rNewDocumentLocation;
     147           0 :     }
     148             : 
     149             :     //--------------------------------------------------------------------
     150           0 :     DocumentID MigrationLog::startedDocument( const SubDocumentType _eType, const ::rtl::OUString& _rName )
     151             :     {
     152             : #if OSL_DEBUG_LEVEL > 0
     153             :         bool bAlreadyKnown = false;
     154             :         for (   DocumentLogs::const_iterator doc = m_pData->aDocumentLogs.begin();
     155             :                 doc != m_pData->aDocumentLogs.end() && !bAlreadyKnown;
     156             :                 ++doc
     157             :             )
     158             :         {
     159             :             bAlreadyKnown = ( doc->second.eType == _eType ) && ( doc->second.sName == _rName );
     160             :         }
     161             :         OSL_ENSURE( !bAlreadyKnown, "MigrationLog::startedDocument: document is already known!" );
     162             : #endif
     163             : 
     164           0 :         DocumentID nID = (DocumentID)( m_pData->aDocumentLogs.size() + 1 );
     165           0 :         while ( m_pData->aDocumentLogs.find( nID ) != m_pData->aDocumentLogs.end() )
     166           0 :             ++nID;
     167             : 
     168           0 :         m_pData->aDocumentLogs[ nID ] = DocumentEntry( _eType, _rName );
     169             : 
     170           0 :         return nID;
     171             :     }
     172             : 
     173             :     //--------------------------------------------------------------------
     174           0 :     void MigrationLog::movedLibrary( const DocumentID _nDocID, const ScriptType _eScriptType,
     175             :             const ::rtl::OUString& _rOriginalLibName, const ::rtl::OUString& _rNewLibName )
     176             :     {
     177             :         OSL_ENSURE( m_pData->aDocumentLogs.find( _nDocID ) != m_pData->aDocumentLogs.end(),
     178             :             "MigrationLog::movedLibrary: document is not known!" );
     179             : 
     180           0 :         DocumentEntry& rDocEntry = m_pData->aDocumentLogs[ _nDocID ];
     181           0 :         rDocEntry.aMovedLibraries.push_back( LibraryEntry( _eScriptType, _rOriginalLibName, _rNewLibName ) );
     182           0 :     }
     183             : 
     184             :     //--------------------------------------------------------------------
     185           0 :     void MigrationLog::finishedDocument( const DocumentID _nDocID )
     186             :     {
     187             :         OSL_ENSURE( m_pData->aDocumentLogs.find( _nDocID ) != m_pData->aDocumentLogs.end(),
     188             :             "MigrationLog::finishedDocument: document is not known!" );
     189             : 
     190           0 :         DocumentEntry& rDocEntry = m_pData->aDocumentLogs[ _nDocID ];
     191             :         (void)rDocEntry;
     192             :         // nothing to do here
     193           0 :     }
     194             : 
     195             :     //--------------------------------------------------------------------
     196           0 :     const ::rtl::OUString& MigrationLog::getNewLibraryName( DocumentID _nDocID, ScriptType _eScriptType,
     197             :         const ::rtl::OUString& _rOriginalLibName ) const
     198             :     {
     199           0 :         static ::rtl::OUString s_sEmptyString;
     200             : 
     201           0 :         DocumentLogs::const_iterator docPos = m_pData->aDocumentLogs.find( _nDocID );
     202           0 :         if ( docPos == m_pData->aDocumentLogs.end() )
     203             :         {
     204             :             OSL_FAIL( "MigrationLog::getNewLibraryName: document is not known!" );
     205           0 :             return s_sEmptyString;
     206             :         }
     207             : 
     208           0 :         const DocumentEntry& rDocEntry( docPos->second );
     209           0 :         for (   ::std::vector< LibraryEntry >::const_iterator lib = rDocEntry.aMovedLibraries.begin();
     210           0 :                 lib != rDocEntry.aMovedLibraries.end();
     211             :                 ++lib
     212             :             )
     213             :         {
     214           0 :             if  (   ( _eScriptType == lib->eType )
     215           0 :                 &&  ( _rOriginalLibName == lib->sOldName )
     216             :                 )
     217           0 :                 return lib->sNewName;
     218             :         }
     219             : 
     220             :         OSL_FAIL( "MigrationLog::getNewLibraryName: doc is known, but library isn't!" );
     221           0 :         return s_sEmptyString;
     222             :     }
     223             : 
     224             :     //--------------------------------------------------------------------
     225             :     namespace
     226             :     {
     227             :         //----------------------------------------------------------------
     228           0 :         static void lcl_appendErrorDescription( ::rtl::OUStringBuffer& _inout_rBuffer, const MigrationError& _rError )
     229             :         {
     230           0 :             const sal_Char* pAsciiErrorDescription( NULL );
     231           0 :             ::std::vector< rtl::OUString > aParameterNames;
     232           0 :             switch ( _rError.eType )
     233             :             {
     234             :             case ERR_OPENING_SUB_DOCUMENT_FAILED:
     235           0 :                 pAsciiErrorDescription = "opening '#doc#' failed";
     236             :                 aParameterNames.push_back(
     237           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     238           0 :                 break;
     239             : 
     240             :             case ERR_CLOSING_SUB_DOCUMENT_FAILED:
     241           0 :                 pAsciiErrorDescription = "closing '#doc#' failed";
     242             :                 aParameterNames.push_back(
     243           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     244           0 :                 break;
     245             : 
     246             :             case ERR_STORAGE_COMMIT_FAILED:
     247           0 :                 pAsciiErrorDescription = "committing the changes for document '#doc#' failed";
     248             :                 aParameterNames.push_back(
     249           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     250           0 :                 break;
     251             : 
     252             :             case ERR_STORING_DATABASEDOC_FAILED:
     253           0 :                 pAsciiErrorDescription = "storing the database document failed";
     254           0 :                 break;
     255             : 
     256             :             case ERR_COLLECTING_DOCUMENTS_FAILED:
     257           0 :                 pAsciiErrorDescription = "collecting the forms/reports of the database document failed";
     258           0 :                 break;
     259             : 
     260             :             case ERR_UNEXPECTED_LIBSTORAGE_ELEMENT:
     261           0 :                 pAsciiErrorDescription = "unexpected #lib# storage element in document '#doc#', named '#element#'";
     262             :                 aParameterNames.push_back(
     263           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     264             :                 aParameterNames.push_back(
     265           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#libstore#")));
     266             :                 aParameterNames.push_back(
     267           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#element#")));
     268           0 :                 break;
     269             : 
     270             :             case ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED:
     271           0 :                 pAsciiErrorDescription = "creating the database document's storage for #scripttype# scripts failed";
     272             :                 aParameterNames.push_back(
     273           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#scripttype#")));
     274           0 :                 break;
     275             : 
     276             :             case ERR_COMMITTING_SCRIPT_STORAGES_FAILED:
     277           0 :                 pAsciiErrorDescription = "saving the #scripttype# scripts for document '#doc#' failed";
     278             :                 aParameterNames.push_back(
     279           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#scripttype#")));
     280             :                 aParameterNames.push_back(
     281           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     282           0 :                 break;
     283             : 
     284             :             case ERR_GENERAL_SCRIPT_MIGRATION_FAILURE:
     285           0 :                 pAsciiErrorDescription = "general error while migrating #scripttype# scripts of document '#doc#'";
     286             :                 aParameterNames.push_back(
     287           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#scripttype#")));
     288             :                 aParameterNames.push_back(
     289           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     290           0 :                 break;
     291             : 
     292             :             case ERR_GENERAL_MACRO_MIGRATION_FAILURE:
     293           0 :                 pAsciiErrorDescription = "general error during macro migration of document '#doc#'";
     294             :                 aParameterNames.push_back(
     295           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     296           0 :                 break;
     297             : 
     298             :             case ERR_UNKNOWN_SCRIPT_TYPE:
     299           0 :                 pAsciiErrorDescription = "unknown script type: #type#";
     300             :                 aParameterNames.push_back(
     301           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#type#")));
     302           0 :                 break;
     303             : 
     304             :             case ERR_UNKNOWN_SCRIPT_LANGUAGE:
     305           0 :                 pAsciiErrorDescription = "unknown script language: #lang#";
     306             :                 aParameterNames.push_back(
     307           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#lang#")));
     308           0 :                 break;
     309             : 
     310             :             case ERR_UNKNOWN_SCRIPT_NAME_FORMAT:
     311           0 :                 pAsciiErrorDescription = "unknown script name format: #script#";
     312             :                 aParameterNames.push_back(
     313           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#script#")));
     314           0 :                 break;
     315             : 
     316             :             case ERR_SCRIPT_TRANSLATION_FAILURE:
     317           0 :                 pAsciiErrorDescription = "analyzing/translating the script URL failed; script type: #type#; script: #code#";
     318             :                 aParameterNames.push_back(
     319           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#type#")));
     320             :                 aParameterNames.push_back(
     321           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#code#")));
     322           0 :                 break;
     323             : 
     324             :             case ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT:
     325           0 :                 pAsciiErrorDescription = "invalid script descriptor format";
     326           0 :                 break;
     327             : 
     328             :             case ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED:
     329           0 :                 pAsciiErrorDescription = "adjusting events for document '#doc#' failed";
     330             :                 aParameterNames.push_back(
     331           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     332           0 :                 break;
     333             : 
     334             :             case ERR_ADJUSTING_DIALOG_EVENTS_FAILED:
     335           0 :                 pAsciiErrorDescription = "adjusting events for dialog #lib#.#dlg# in document '#doc#' failed";
     336             :                 aParameterNames.push_back(
     337           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     338             :                 aParameterNames.push_back(
     339           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#lib#")));
     340             :                 aParameterNames.push_back(
     341           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#dlg#")));
     342           0 :                 break;
     343             : 
     344             :             case ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED:
     345           0 :                 pAsciiErrorDescription = "adjusting form component events for '#doc#' failed";
     346             :                 aParameterNames.push_back(
     347           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     348           0 :                 break;
     349             : 
     350             :             case ERR_BIND_SCRIPT_STORAGE_FAILED:
     351           0 :                 pAsciiErrorDescription = "binding to the script storage failed for document '#doc#'";
     352             :                 aParameterNames.push_back(
     353           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     354           0 :                 break;
     355             : 
     356             :             case ERR_REMOVE_SCRIPTS_STORAGE_FAILED:
     357           0 :                 pAsciiErrorDescription = "removing a scripts storage failed for document '#doc#'";
     358             :                 aParameterNames.push_back(
     359           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     360           0 :                 break;
     361             : 
     362             :             case ERR_DOCUMENT_BACKUP_FAILED:
     363           0 :                 pAsciiErrorDescription = "backing up the document to #location# failed";
     364             :                 aParameterNames.push_back(
     365           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#location#")));
     366           0 :                 break;
     367             : 
     368             :             case ERR_UNKNOWN_SCRIPT_FOLDER:
     369           0 :                 pAsciiErrorDescription = "unknown script folder '#name#' in document '#doc#'";
     370             :                 aParameterNames.push_back(
     371           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     372             :                 aParameterNames.push_back(
     373           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#name#")));
     374           0 :                 break;
     375             : 
     376             :             case ERR_EXAMINING_SCRIPTS_FOLDER_FAILED:
     377           0 :                 pAsciiErrorDescription = "examining the 'Scripts' folder failed for document '#doc#'";
     378             :                 aParameterNames.push_back(
     379           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     380           0 :                 break;
     381             : 
     382             :             case ERR_PASSWORD_VERIFICATION_FAILED:
     383           0 :                 pAsciiErrorDescription = "password verification failed for document '#doc#', #libtype# library '#name#'";
     384             :                 aParameterNames.push_back(
     385           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     386             :                 aParameterNames.push_back(
     387           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#libtype#")));
     388             :                 aParameterNames.push_back(
     389           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#name#")));
     390           0 :                 break;
     391             : 
     392             :             case ERR_NEW_STYLE_REPORT:
     393           0 :                 pAsciiErrorDescription = "#doc# could not be processed, since you don't have the Oracle Report Builder (TM) extension installed.";
     394             :                 aParameterNames.push_back(
     395           0 :                     rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
     396           0 :                 break;
     397             : 
     398             :                 // do *not* add a default case here: Without a default, some compilers will warn you when
     399             :                 // you miss a newly-introduced enum value here
     400             :             }
     401             :             OSL_ENSURE( pAsciiErrorDescription, "lcl_appendErrorDescription: no error message!" );
     402           0 :             if ( pAsciiErrorDescription )
     403             :             {
     404           0 :                 ::rtl::OUString sSubstituted( ::rtl::OUString::createFromAscii( pAsciiErrorDescription ) );
     405             :                 OSL_ENSURE( aParameterNames.size() == _rError.aErrorDetails.size(),
     406             :                     "lcl_appendErrorDescription: unexpected number of error message parameters!" );
     407             : 
     408           0 :                 for ( size_t i=0; i < ::std::min( aParameterNames.size(), _rError.aErrorDetails.size() ); ++i )
     409             :                 {
     410             :                     sSubstituted = sSubstituted.replaceFirst(
     411           0 :                         aParameterNames[i], _rError.aErrorDetails[i]);
     412             :                 }
     413             : 
     414           0 :                 _inout_rBuffer.append( sSubstituted );
     415           0 :             }
     416           0 :         }
     417             : 
     418             :         //----------------------------------------------------------------
     419           0 :         void lcl_describeErrors( ::rtl::OUStringBuffer& _rBuffer, const ErrorLog& _rErrors, const sal_uInt16 _nHeadingResId )
     420             :         {
     421           0 :             _rBuffer.appendAscii( "=== " );
     422           0 :             _rBuffer.append     ( String( MacroMigrationResId( _nHeadingResId ) ) );
     423           0 :             _rBuffer.appendAscii( " ===\n" );
     424             : 
     425           0 :             String sException( MacroMigrationResId( STR_EXCEPTION ) );
     426             : 
     427           0 :             for (   ErrorLog::const_iterator error = _rErrors.begin();
     428           0 :                     error != _rErrors.end();
     429             :                     ++error
     430             :                 )
     431             :             {
     432           0 :                 _rBuffer.append( sal_Unicode( '-' ) );
     433           0 :                 _rBuffer.append( sal_Unicode( ' ' ) );
     434           0 :                 lcl_appendErrorDescription( _rBuffer, *error );
     435           0 :                 _rBuffer.append( sal_Unicode( '\n' ) );
     436             : 
     437           0 :                 if ( !error->aCaughtException.hasValue() )
     438           0 :                     continue;
     439             : 
     440           0 :                 _rBuffer.append( sException );
     441           0 :                 _rBuffer.append( ::comphelper::anyToString( error->aCaughtException ) );
     442           0 :                 _rBuffer.append( sal_Unicode( '\n' ) );
     443           0 :                 _rBuffer.append( sal_Unicode( '\n' ) );
     444           0 :             }
     445           0 :         }
     446             :     }
     447             : 
     448             :     //--------------------------------------------------------------------
     449           0 :     bool MigrationLog::movedAnyLibrary( const DocumentID _nDocID )
     450             :     {
     451           0 :         DocumentLogs::const_iterator docPos = m_pData->aDocumentLogs.find( _nDocID );
     452           0 :         if ( docPos == m_pData->aDocumentLogs.end() )
     453             :         {
     454             :             OSL_FAIL( "MigrationLog::movedAnyLibrary: document is not known!" );
     455           0 :             return false;
     456             :         }
     457           0 :         return !docPos->second.aMovedLibraries.empty();
     458             :     }
     459             : 
     460             :     //--------------------------------------------------------------------
     461           0 :     ::rtl::OUString MigrationLog::getCompleteLog() const
     462             :     {
     463           0 :         ::rtl::OUStringBuffer aBuffer;
     464             : 
     465           0 :         if ( !m_pData->sBackupLocation.isEmpty() )
     466             :         {
     467           0 :             String sBackedUp( MacroMigrationResId( STR_SAVED_COPY_TO ) );
     468           0 :             sBackedUp.SearchAndReplaceAllAscii( "$location$", m_pData->sBackupLocation );
     469             : 
     470           0 :             aBuffer.appendAscii( "=== " );
     471           0 :             aBuffer.append     ( String( MacroMigrationResId( STR_DATABASE_DOCUMENT ) ) );
     472           0 :             aBuffer.appendAscii( " ===\n" );
     473           0 :             aBuffer.append     ( sBackedUp );
     474           0 :             aBuffer.appendAscii( "\n\n" );
     475             :         }
     476             : 
     477           0 :         if ( !m_pData->aFailures.empty() )
     478             :         {
     479           0 :             lcl_describeErrors( aBuffer, m_pData->aFailures
     480           0 :                 , STR_ERRORS );
     481             :         }
     482             :         else
     483             :         {
     484           0 :             String sMovedLibTemplate( MacroMigrationResId( STR_MOVED_LIBRARY ) );
     485             : 
     486           0 :             for (   DocumentLogs::const_iterator doc = m_pData->aDocumentLogs.begin();
     487           0 :                     doc != m_pData->aDocumentLogs.end();
     488             :                     ++doc
     489             :                 )
     490             :             {
     491           0 :                 const DocumentEntry& rDoc( doc->second );
     492             : 
     493           0 :                 if ( rDoc.aMovedLibraries.empty() )
     494           0 :                     continue;
     495             : 
     496           0 :                 String sDocTitle( MacroMigrationResId( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) );
     497           0 :                 sDocTitle.SearchAndReplaceAllAscii( "$name$", rDoc.sName );
     498             : 
     499           0 :                 aBuffer.appendAscii( "=== " );
     500           0 :                 aBuffer.append     ( sDocTitle );
     501           0 :                 aBuffer.appendAscii( " ===\n" );
     502             : 
     503           0 :                 for (   ::std::vector< LibraryEntry >::const_iterator lib = rDoc.aMovedLibraries.begin();
     504           0 :                         lib != rDoc.aMovedLibraries.end();
     505             :                         ++lib
     506             :                     )
     507             :                 {
     508           0 :                     String sMovedLib( sMovedLibTemplate );
     509           0 :                     sMovedLib.SearchAndReplaceAllAscii( "$type$", getScriptTypeDisplayName( lib->eType ) );
     510           0 :                     sMovedLib.SearchAndReplaceAllAscii( "$old$", lib->sOldName );
     511           0 :                     sMovedLib.SearchAndReplaceAllAscii( "$new$", lib->sNewName );
     512             : 
     513           0 :                     aBuffer.append( sMovedLib );
     514           0 :                     aBuffer.append( sal_Unicode( '\n' ) );
     515           0 :                 }
     516             : 
     517           0 :                 aBuffer.append( sal_Unicode( '\n' ) );
     518           0 :             }
     519             :         }
     520             : 
     521           0 :         if ( !m_pData->aWarnings.empty() )
     522             :         {
     523           0 :             lcl_describeErrors( aBuffer, m_pData->aWarnings, STR_WARNINGS );
     524             :         }
     525             : 
     526           0 :         return aBuffer.makeStringAndClear();
     527             :     }
     528             : 
     529             : //........................................................................
     530             : } // namespace dbmm
     531             : //........................................................................
     532             : 
     533             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10