LCOV - code coverage report
Current view: top level - desktop/source/migration - migration.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 104 730 14.2 %
Date: 2012-08-25 Functions: 10 37 27.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 100 1578 6.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <map>
      31                 :            : #include <new>
      32                 :            : #include <set>
      33                 :            : 
      34                 :            : #include "migration.hxx"
      35                 :            : #include "migration_impl.hxx"
      36                 :            : 
      37                 :            : #include <unotools/textsearch.hxx>
      38                 :            : #include <comphelper/componentcontext.hxx>
      39                 :            : #include <comphelper/processfactory.hxx>
      40                 :            : #include <comphelper/sequence.hxx>
      41                 :            : #include <unotools/bootstrap.hxx>
      42                 :            : #include <rtl/bootstrap.hxx>
      43                 :            : #include <rtl/uri.hxx>
      44                 :            : #include <i18npool/lang.h>
      45                 :            : #include <tools/urlobj.hxx>
      46                 :            : #include <osl/file.hxx>
      47                 :            : #include <osl/mutex.hxx>
      48                 :            : #include <osl/security.hxx>
      49                 :            : #include <unotools/configmgr.hxx>
      50                 :            : 
      51                 :            : #include <com/sun/star/configuration/Update.hpp>
      52                 :            : #include <com/sun/star/configuration/theDefaultProvider.hpp>
      53                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      54                 :            : #include <com/sun/star/task/XJob.hpp>
      55                 :            : #include <com/sun/star/beans/NamedValue.hpp>
      56                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      57                 :            : #include <com/sun/star/util/XRefreshable.hpp>
      58                 :            : #include <com/sun/star/util/XChangesBatch.hpp>
      59                 :            : #include <com/sun/star/util/XStringSubstitution.hpp>
      60                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      61                 :            : #include <com/sun/star/embed/FileSystemStorageFactory.hpp>
      62                 :            : #include <com/sun/star/embed/XStorage.hpp>
      63                 :            : #include <com/sun/star/ui/XUIConfiguration.hpp>
      64                 :            : #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
      65                 :            : #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
      66                 :            : 
      67                 :            : using namespace osl;
      68                 :            : using namespace std;
      69                 :            : using namespace com::sun::star::task;
      70                 :            : using namespace com::sun::star::lang;
      71                 :            : using namespace com::sun::star::beans;
      72                 :            : using namespace com::sun::star::util;
      73                 :            : using namespace com::sun::star::container;
      74                 :            : using com::sun::star::uno::Exception;
      75                 :            : using namespace com::sun::star;
      76                 :            : 
      77                 :            : using ::rtl::OUString;
      78                 :            : using ::rtl::OString;
      79                 :            : 
      80                 :            : namespace desktop {
      81                 :            : 
      82                 :            : static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
      83                 :            : static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
      84                 :            : static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
      85                 :            : 
      86                 :            : static const char XDG_CONFIG_PART[] = "/.config";
      87                 :            : 
      88                 :          0 : ::rtl::OUString retrieveLabelFromCommand(const ::rtl::OUString& sCommand, const ::rtl::OUString& sModuleIdentifier)
      89                 :            : {
      90                 :          0 :     ::rtl::OUString sLabel;
      91                 :            : 
      92                 :          0 :     uno::Reference< container::XNameAccess > xUICommands;
      93 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription")) ), uno::UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
      94         [ #  # ]:          0 :     if ( xNameAccess.is() )
      95                 :            :     {
      96 [ #  # ][ #  # ]:          0 :         uno::Any a = xNameAccess->getByName( sModuleIdentifier );
      97         [ #  # ]:          0 :         a >>= xUICommands;
      98                 :            :     }
      99         [ #  # ]:          0 :     if (xUICommands.is())
     100                 :            :     {
     101         [ #  # ]:          0 :         if ( !sCommand.isEmpty() )
     102                 :            :         {
     103                 :          0 :             rtl::OUString aStr;
     104         [ #  # ]:          0 :             ::uno::Sequence< beans::PropertyValue > aPropSeq;
     105                 :            :             try
     106                 :            :             {
     107 [ #  # ][ #  # ]:          0 :                 uno::Any a( xUICommands->getByName( sCommand ));
     108 [ #  # ][ #  # ]:          0 :                 if ( a >>= aPropSeq )
     109                 :            :                 {
     110         [ #  # ]:          0 :                     for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
     111                 :            :                     {
     112 [ #  # ][ #  # ]:          0 :                         if ( aPropSeq[i].Name == "Label" )
     113                 :            :                         {
     114         [ #  # ]:          0 :                             aPropSeq[i].Value >>= aStr;
     115                 :          0 :                             break;
     116                 :            :                         }
     117                 :            :                     }
     118                 :            :                 }
     119                 :            : 
     120         [ #  # ]:          0 :                 sLabel = aStr;
     121                 :            :             }
     122         [ #  # ]:          0 :             catch (const container::NoSuchElementException&)
     123                 :            :             {
     124                 :          0 :                 sLabel = sCommand;
     125                 :          0 :                 sal_Int32 nIndex = sLabel.indexOf(':');
     126   [ #  #  #  #  :          0 :                 if (nIndex>=0 && nIndex <= sLabel.getLength()-1)
                   #  # ]
     127                 :          0 :                     sLabel = sLabel.copy(nIndex+1);
     128         [ #  # ]:          0 :             }
     129                 :            : 
     130                 :            :         }
     131                 :            :     }
     132                 :            : 
     133                 :          0 :     return sLabel;
     134                 :            : }
     135                 :            : 
     136                 :          0 : ::rtl::OUString mapModuleShortNameToIdentifier(const ::rtl::OUString& sShortName)
     137                 :            : {
     138                 :          0 :     ::rtl::OUString sIdentifier;
     139                 :            : 
     140         [ #  # ]:          0 :     if ( sShortName == "StartModule" )
     141         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule"));
     142                 :            : 
     143         [ #  # ]:          0 :     else if ( sShortName == "swriter" )
     144         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument"));
     145                 :            : 
     146         [ #  # ]:          0 :     else if ( sShortName == "scalc" )
     147         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument"));
     148                 :            : 
     149         [ #  # ]:          0 :     else if ( sShortName == "sdraw" )
     150         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
     151                 :            : 
     152         [ #  # ]:          0 :     else if ( sShortName == "simpress" )
     153         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
     154                 :            : 
     155         [ #  # ]:          0 :     else if ( sShortName == "smath" )
     156         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.formula.FormulaProperties"));
     157                 :            : 
     158         [ #  # ]:          0 :     else if ( sShortName == "schart" )
     159         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument"));
     160                 :            : 
     161         [ #  # ]:          0 :     else if ( sShortName == "BasicIDE" )
     162         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.BasicIDE"));
     163                 :            : 
     164         [ #  # ]:          0 :     else if ( sShortName == "dbapp" )
     165         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument"));
     166                 :            : 
     167         [ #  # ]:          0 :     else if ( sShortName == "sglobal" )
     168         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalDocument"));
     169                 :            : 
     170         [ #  # ]:          0 :     else if ( sShortName == "sweb" )
     171         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.WebDocument"));
     172                 :            : 
     173         [ #  # ]:          0 :     else if ( sShortName == "swxform" )
     174         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xforms.XMLFormDocument"));
     175                 :            : 
     176         [ #  # ]:          0 :     else if ( sShortName == "sbibliography" )
     177         [ #  # ]:          0 :         sIdentifier = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Bibliography"));
     178                 :            : 
     179                 :          0 :     return sIdentifier;
     180                 :            : }
     181                 :            : 
     182                 :          0 : bool MigrationImpl::alreadyMigrated()
     183                 :            : {
     184         [ #  # ]:          0 :     rtl::OUString MIGRATION_STAMP_NAME(RTL_CONSTASCII_USTRINGPARAM("/MIGRATED"));
     185                 :          0 :     rtl::OUString aStr = m_aInfo.userdata + MIGRATION_STAMP_NAME;
     186                 :          0 :     File aFile(aStr);
     187                 :            :     // create migration stamp, and/or check its existence
     188         [ #  # ]:          0 :     bool bRet = aFile.open (osl_File_OpenFlag_Write | osl_File_OpenFlag_Create | osl_File_OpenFlag_NoLock) == FileBase::E_EXIST;
     189                 :            :     OSL_TRACE( "File '%s' exists? %d\n",
     190                 :            :              rtl::OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr(),
     191                 :            :              bRet );
     192         [ #  # ]:          0 :     return bRet;
     193                 :            : }
     194                 :            : 
     195                 :         62 : bool MigrationImpl::initializeMigration()
     196                 :            : {
     197                 :         62 :     bool bRet = false;
     198                 :            : 
     199         [ +  - ]:         62 :     if (!checkMigrationCompleted()) {
     200                 :         62 :         readAvailableMigrations(m_vMigrationsAvailable);
     201                 :         62 :         sal_Int32 nIndex = findPreferedMigrationProcess(m_vMigrationsAvailable);
     202                 :            :         // m_aInfo is now set to the preferred migration source
     203         [ -  + ]:         62 :         if ( nIndex >= 0 ) {
     204         [ #  # ]:          0 :             if (alreadyMigrated())
     205                 :          0 :                 return false;
     206                 :          0 :             m_vrMigrations = readMigrationSteps(m_vMigrationsAvailable[nIndex].name);
     207                 :            :         }
     208                 :            : 
     209                 :         62 :         bRet = !m_aInfo.userdata.isEmpty();
     210                 :            :     }
     211                 :            : 
     212                 :            :     OSL_TRACE( "Migration %s", bRet ? "needed" : "not required" );
     213                 :            : 
     214                 :         62 :     return bRet;
     215                 :            : }
     216                 :            : 
     217                 :         62 : void Migration::migrateSettingsIfNecessary()
     218                 :            : {
     219 [ +  - ][ +  - ]:         62 :     MigrationImpl aImpl( comphelper::getProcessServiceFactory() );
     220                 :            : 
     221 [ +  - ][ +  - ]:         62 :     if (! aImpl.initializeMigration() )
     222                 :         62 :         return;
     223                 :            : 
     224                 :          0 :     sal_Bool bResult = sal_False;
     225                 :            :     try
     226                 :            :     {
     227         [ #  # ]:          0 :         bResult = aImpl.doMigration();
     228                 :            :     }
     229   [ #  #  #  # ]:          0 :     catch (const Exception& e)
     230                 :            :     {
     231                 :          0 :         OString aMsg("doMigration() exception: ");
     232         [ #  # ]:          0 :         aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
     233                 :          0 :         OSL_FAIL(aMsg.getStr());
     234                 :            :     }
     235                 :            :     OSL_ENSURE(bResult, "Migration has not been successfull");
     236 [ +  - ][ -  + ]:         62 :     (void)bResult;
     237                 :            : }
     238                 :            : 
     239                 :         62 : MigrationImpl::MigrationImpl(const uno::Reference< XMultiServiceFactory >& xFactory)
     240         [ +  - ]:         62 :     : m_vrVersions(new strings_v)
     241 [ +  - ][ +  - ]:        124 :     , m_xFactory(xFactory)
                 [ +  - ]
     242                 :            : {
     243                 :         62 : }
     244                 :            : 
     245 [ +  - ][ +  - ]:         62 : MigrationImpl::~MigrationImpl()
     246                 :            : {
     247                 :         62 : }
     248                 :            : 
     249                 :            : // The main entry point for migrating settings
     250                 :          0 : sal_Bool MigrationImpl::doMigration()
     251                 :            : {
     252                 :            :     // compile file list for migration
     253                 :          0 :     m_vrFileList = compileFileList();
     254                 :            : 
     255                 :          0 :     sal_Bool result = sal_False;
     256                 :            :     try
     257                 :            :     {
     258         [ #  # ]:          0 :         NewVersionUIInfo aNewVersionUIInfo;
     259         [ #  # ]:          0 :         ::std::vector< MigrationModuleInfo > vModulesInfo = dectectUIChangesForAllModules();
     260         [ #  # ]:          0 :         aNewVersionUIInfo.init(vModulesInfo);
     261                 :            : 
     262         [ #  # ]:          0 :         copyFiles();
     263                 :            : 
     264         [ #  # ]:          0 :         const ::rtl::OUString sMenubarResourceURL(RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/menubar"));
     265         [ #  # ]:          0 :         const ::rtl::OUString sToolbarResourcePre(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/"));
     266         [ #  # ]:          0 :         for (sal_uInt32 i=0; i<vModulesInfo.size(); ++i)
     267                 :            :         {
     268         [ #  # ]:          0 :             ::rtl::OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName);
     269         [ #  # ]:          0 :             if (sModuleIdentifier.isEmpty())
     270                 :          0 :                 continue;
     271                 :            : 
     272         [ #  # ]:          0 :             uno::Sequence< uno::Any > lArgs(2);
     273         [ #  # ]:          0 :             ::rtl::OUString aOldCfgDataPath = m_aInfo.userdata + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user/config/soffice.cfg/modules/"));
     274 [ #  # ][ #  # ]:          0 :             lArgs[0] <<= aOldCfgDataPath + vModulesInfo[i].sModuleShortName;
     275 [ #  # ][ #  # ]:          0 :             lArgs[1] <<= embed::ElementModes::READ;
     276                 :            : 
     277                 :            :             uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
     278 [ #  # ][ #  # ]:          0 :                      embed::FileSystemStorageFactory::create(comphelper::ComponentContext(m_xFactory).getUNOContext()));
         [ #  # ][ #  # ]
     279 [ #  # ][ #  # ]:          0 :             uno::Reference< embed::XStorage >             xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY);
                 [ #  # ]
     280 [ #  # ][ #  # ]:          0 :             uno::Reference< ui::XUIConfigurationManager > xOldCfgManager( m_xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager"))), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     281         [ #  # ]:          0 :             uno::Reference< ui::XUIConfigurationStorage > xOldCfgStorage( xOldCfgManager, uno::UNO_QUERY );
     282         [ #  # ]:          0 :             uno::Reference< ui::XUIConfigurationPersistence > xOldCfgPersistence( xOldCfgManager, uno::UNO_QUERY );
     283                 :            : 
     284 [ #  # ][ #  # ]:          0 :             if ( xOldCfgStorage.is() && xOldCfgPersistence.is() && xModules.is() )
         [ #  # ][ #  # ]
     285                 :            :             {
     286 [ #  # ][ #  # ]:          0 :                     xOldCfgStorage->setStorage( xModules );
     287 [ #  # ][ #  # ]:          0 :                     xOldCfgPersistence->reload();
     288                 :            :             }
     289                 :            : 
     290         [ #  # ]:          0 :             uno::Reference< ui::XUIConfigurationManager > xCfgManager = aNewVersionUIInfo.getConfigManager(vModulesInfo[i].sModuleShortName);
     291                 :            : 
     292         [ #  # ]:          0 :             if (vModulesInfo[i].bHasMenubar)
     293                 :            :             {
     294 [ #  # ][ #  # ]:          0 :                 uno::Reference< container::XIndexContainer > xOldVersionMenuSettings = uno::Reference< container::XIndexContainer >(xOldCfgManager->getSettings(sMenubarResourceURL, sal_True), uno::UNO_QUERY);
                 [ #  # ]
     295         [ #  # ]:          0 :                 uno::Reference< container::XIndexContainer > xNewVersionMenuSettings = aNewVersionUIInfo.getNewMenubarSettings(vModulesInfo[i].sModuleShortName);
     296                 :          0 :                 ::rtl::OUString sParent;
     297         [ #  # ]:          0 :                 compareOldAndNewConfig(sParent, xOldVersionMenuSettings, xNewVersionMenuSettings, sMenubarResourceURL);
     298         [ #  # ]:          0 :                 mergeOldToNewVersion(xCfgManager, xNewVersionMenuSettings, sModuleIdentifier, sMenubarResourceURL);
     299                 :            :             }
     300                 :            : 
     301                 :          0 :             sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size();
     302         [ #  # ]:          0 :             if (nToolbars >0)
     303                 :            :             {
     304         [ #  # ]:          0 :                 for (sal_Int32 j=0; j<nToolbars; ++j)
     305                 :            :                 {
     306                 :          0 :                     ::rtl::OUString sToolbarName = vModulesInfo[i].m_vToolbars[j];
     307                 :          0 :                     ::rtl::OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName;
     308                 :            : 
     309 [ #  # ][ #  # ]:          0 :                     uno::Reference< container::XIndexContainer > xOldVersionToolbarSettings = uno::Reference< container::XIndexContainer >(xOldCfgManager->getSettings(sToolbarResourceURL, sal_True), uno::UNO_QUERY);
                 [ #  # ]
     310         [ #  # ]:          0 :                     uno::Reference< container::XIndexContainer > xNewVersionToolbarSettings = aNewVersionUIInfo.getNewToolbarSettings(vModulesInfo[i].sModuleShortName, sToolbarName);
     311                 :          0 :                     ::rtl::OUString sParent;
     312         [ #  # ]:          0 :                     compareOldAndNewConfig(sParent, xOldVersionToolbarSettings, xNewVersionToolbarSettings, sToolbarResourceURL);
     313         [ #  # ]:          0 :                     mergeOldToNewVersion(xCfgManager, xNewVersionToolbarSettings, sModuleIdentifier, sToolbarResourceURL);
     314                 :          0 :                 }
     315                 :            :             }
     316                 :            : 
     317         [ #  # ]:          0 :             m_aOldVersionItemsHashMap.clear();
     318         [ #  # ]:          0 :             m_aNewVersionItemsHashMap.clear();
     319 [ #  # ][ #  # ]:          0 :         }
     320                 :            : 
     321                 :            :         // execute the migration items from Setup.xcu
     322         [ #  # ]:          0 :         copyConfig();
     323                 :            : 
     324                 :            :         // execute custom migration services from Setup.xcu
     325                 :            :         // and refresh the cache
     326         [ #  # ]:          0 :         runServices();
     327         [ #  # ]:          0 :         refresh();
     328                 :            : 
     329         [ #  # ]:          0 :         result = sal_True;
     330                 :            :     }
     331                 :          0 :     catch (...)
     332                 :            :     {
     333                 :          0 :         OString aMsg("An unexpected exception was thrown during migration");
     334         [ #  # ]:          0 :         aMsg += "\nOldVersion: " + OUStringToOString(m_aInfo.productname, RTL_TEXTENCODING_ASCII_US);
     335         [ #  # ]:          0 :         aMsg += "\nDataPath  : " + OUStringToOString(m_aInfo.userdata, RTL_TEXTENCODING_ASCII_US);
     336                 :          0 :         OSL_FAIL(aMsg.getStr());
     337                 :            :     }
     338                 :            : 
     339                 :            :     // prevent running the migration multiple times
     340                 :          0 :     setMigrationCompleted();
     341                 :          0 :     return result;
     342                 :            : }
     343                 :            : 
     344                 :          0 : void MigrationImpl::refresh()
     345                 :            : {
     346                 :            :     uno::Reference< XRefreshable >(
     347                 :            :         configuration::theDefaultProvider::get(
     348                 :            :             comphelper::getComponentContext(m_xFactory)),
     349 [ #  # ][ #  # ]:          0 :         uno::UNO_QUERY_THROW)->refresh();
         [ #  # ][ #  # ]
     350                 :          0 : }
     351                 :            : 
     352                 :          0 : void MigrationImpl::setMigrationCompleted()
     353                 :            : {
     354                 :            :     try
     355                 :            :     {
     356 [ #  # ][ #  # ]:          0 :         uno::Reference< XPropertySet > aPropertySet(getConfigAccess("org.openoffice.Setup/Office", true), uno::UNO_QUERY_THROW);
     357 [ #  # ][ #  # ]:          0 :         aPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("MigrationCompleted")), uno::makeAny(sal_True));
         [ #  # ][ #  # ]
     358 [ #  # ][ #  # ]:          0 :         uno::Reference< XChangesBatch >(aPropertySet, uno::UNO_QUERY_THROW)->commitChanges();
                 [ #  # ]
     359                 :            :     }
     360                 :          0 :     catch (...)
     361                 :            :     {
     362                 :            :         // fail silently
     363                 :            :     }
     364                 :          0 : }
     365                 :            : 
     366                 :         62 : bool MigrationImpl::checkMigrationCompleted()
     367                 :            : {
     368                 :         62 :     sal_Bool bMigrationCompleted = sal_False;
     369                 :            :     try {
     370                 :            :         uno::Reference< XPropertySet > aPropertySet(
     371 [ +  - ][ +  - ]:         62 :             getConfigAccess("org.openoffice.Setup/Office"), uno::UNO_QUERY_THROW);
     372         [ +  - ]:         62 :         aPropertySet->getPropertyValue(
     373 [ +  - ][ +  - ]:         62 :             OUString(RTL_CONSTASCII_USTRINGPARAM("MigrationCompleted"))) >>= bMigrationCompleted;
     374                 :            : 
     375 [ -  + ][ -  + ]:         62 :         if( !bMigrationCompleted && getenv("SAL_DISABLE_USERMIGRATION" ) )
                 [ +  - ]
     376                 :            :         {
     377                 :            :             // migration prevented - fake it's success
     378         [ #  # ]:          0 :             setMigrationCompleted();
     379                 :          0 :             bMigrationCompleted = sal_True;
     380         [ #  # ]:         62 :         }
     381                 :            :     }
     382         [ #  # ]:          0 :     catch (const Exception&)
     383                 :            :     {
     384                 :            :         // just return false...
     385                 :            :     }
     386                 :            :     OSL_TRACE( "Migration %s", bMigrationCompleted ? "already completed" : "not done" );
     387                 :            : 
     388                 :         62 :     return bMigrationCompleted;
     389                 :            : }
     390                 :            : 
     391                 :         62 : static void insertSorted(migrations_available& rAvailableMigrations, supported_migration& aSupportedMigration)
     392                 :            : {
     393                 :         62 :     bool                           bInserted( false );
     394                 :         62 :     migrations_available::iterator pIter = rAvailableMigrations.begin();
     395 [ +  - ][ +  - ]:         62 :     while ( !bInserted && pIter != rAvailableMigrations.end())
         [ -  + ][ +  - ]
           [ -  +  #  # ]
     396                 :            :     {
     397         [ #  # ]:          0 :         if ( pIter->nPriority < aSupportedMigration.nPriority )
     398                 :            :         {
     399         [ #  # ]:          0 :             rAvailableMigrations.insert(pIter, aSupportedMigration );
     400                 :          0 :             bInserted = true;
     401                 :          0 :             break; // i111193: insert invalidates iterator!
     402                 :            :         }
     403                 :          0 :         ++pIter;
     404                 :            :     }
     405         [ +  - ]:         62 :     if ( !bInserted )
     406         [ +  - ]:         62 :         rAvailableMigrations.push_back( aSupportedMigration );
     407                 :         62 : }
     408                 :            : 
     409                 :         62 : bool MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigrations)
     410                 :            : {
     411                 :            :     // get supported version names
     412 [ +  - ][ +  - ]:         62 :     uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW);
     413 [ +  - ][ +  - ]:         62 :     uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames();
     414                 :            : 
     415         [ +  - ]:         62 :     const OUString aVersionIdentifiers( RTL_CONSTASCII_USTRINGPARAM( "VersionIdentifiers" ));
     416         [ +  - ]:         62 :     const OUString aPriorityIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Priority" ));
     417                 :            : 
     418         [ +  + ]:        124 :     for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++)
     419                 :            :     {
     420                 :         62 :         sal_Int32                 nPriority( 0 );
     421         [ +  - ]:         62 :         uno::Sequence< OUString > seqVersions;
     422 [ +  - ][ +  - ]:         62 :         uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW );
         [ +  - ][ +  - ]
     423 [ +  - ][ +  - ]:         62 :         xMigrationData->getByName( aVersionIdentifiers ) >>= seqVersions;
                 [ +  - ]
     424 [ +  - ][ +  - ]:         62 :         xMigrationData->getByName( aPriorityIdentifier ) >>= nPriority;
     425                 :            : 
     426         [ +  - ]:         62 :         supported_migration aSupportedMigration;
     427         [ +  - ]:         62 :         aSupportedMigration.name      = seqSupportedVersions[i];
     428                 :         62 :         aSupportedMigration.nPriority = nPriority;
     429         [ +  + ]:        372 :         for (sal_Int32 j=0; j<seqVersions.getLength(); j++)
     430 [ +  - ][ +  - ]:        310 :             aSupportedMigration.supported_versions.push_back(seqVersions[j].trim());
     431         [ +  - ]:         62 :         insertSorted( rAvailableMigrations, aSupportedMigration );
     432                 :            :         OSL_TRACE( " available migration '%s'\n",
     433                 :            :                    rtl::OUStringToOString( aSupportedMigration.name, RTL_TEXTENCODING_ASCII_US ).getStr() );
     434         [ +  - ]:         62 :     }
     435                 :            : 
     436         [ +  - ]:         62 :     return true;
     437                 :            : }
     438                 :            : 
     439                 :          0 : migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigrationName)
     440                 :            : {
     441                 :            :     // get migration access
     442 [ #  # ][ #  # ]:          0 :     uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW);
     443 [ #  # ][ #  # ]:          0 :     uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(rMigrationName), uno::UNO_QUERY_THROW );
                 [ #  # ]
     444                 :            : 
     445                 :            :     // get migration description from from org.openoffice.Setup/Migration
     446                 :            :     // and build vector of migration steps
     447         [ #  # ]:          0 :     OUString aMigrationSteps( RTL_CONSTASCII_USTRINGPARAM( "MigrationSteps" ));
     448 [ #  # ][ #  # ]:          0 :     uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName(aMigrationSteps), uno::UNO_QUERY_THROW);
                 [ #  # ]
     449 [ #  # ][ #  # ]:          0 :     uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames();
     450                 :          0 :     uno::Reference< XNameAccess > tmpAccess;
     451                 :          0 :     uno::Reference< XNameAccess > tmpAccess2;
     452         [ #  # ]:          0 :     uno::Sequence< OUString > tmpSeq;
     453 [ #  # ][ #  # ]:          0 :     migrations_vr vrMigrations(new migrations_v);
     454         [ #  # ]:          0 :     for (sal_Int32 i = 0; i < seqMigrations.getLength(); i++)
     455                 :            :     {
     456                 :            :         // get current migration step
     457 [ #  # ][ #  # ]:          0 :         theNameAccess->getByName(seqMigrations[i]) >>= tmpAccess;
         [ #  # ][ #  # ]
     458         [ #  # ]:          0 :         migration_step tmpStep;
     459         [ #  # ]:          0 :         tmpStep.name = seqMigrations[i];
     460                 :            : 
     461                 :            :         // read included files from current step description
     462                 :          0 :         ::rtl::OUString aSeqEntry;
     463 [ #  # ][ #  # ]:          0 :         if (tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IncludedFiles"))) >>= tmpSeq)
         [ #  # ][ #  # ]
                 [ #  # ]
     464                 :            :         {
     465         [ #  # ]:          0 :             for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
     466                 :            :             {
     467         [ #  # ]:          0 :                 aSeqEntry = tmpSeq[j];
     468         [ #  # ]:          0 :                 tmpStep.includeFiles.push_back(aSeqEntry);
     469                 :            :             }
     470                 :            :         }
     471                 :            : 
     472                 :            :         // exluded files...
     473 [ #  # ][ #  # ]:          0 :         if (tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("ExcludedFiles"))) >>= tmpSeq)
         [ #  # ][ #  # ]
                 [ #  # ]
     474                 :            :         {
     475         [ #  # ]:          0 :             for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
     476 [ #  # ][ #  # ]:          0 :                 tmpStep.excludeFiles.push_back(tmpSeq[j]);
     477                 :            :         }
     478                 :            : 
     479                 :            :         // included nodes...
     480 [ #  # ][ #  # ]:          0 :         if (tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IncludedNodes"))) >>= tmpSeq)
         [ #  # ][ #  # ]
                 [ #  # ]
     481                 :            :         {
     482         [ #  # ]:          0 :             for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
     483 [ #  # ][ #  # ]:          0 :                 tmpStep.includeConfig.push_back(tmpSeq[j]);
     484                 :            :         }
     485                 :            : 
     486                 :            :         // excluded nodes...
     487 [ #  # ][ #  # ]:          0 :         if (tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("ExcludedNodes"))) >>= tmpSeq)
         [ #  # ][ #  # ]
                 [ #  # ]
     488                 :            :         {
     489         [ #  # ]:          0 :             for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
     490 [ #  # ][ #  # ]:          0 :                 tmpStep.excludeConfig.push_back(tmpSeq[j]);
     491                 :            :         }
     492                 :            : 
     493                 :            :         // included extensions...
     494 [ #  # ][ #  # ]:          0 :         if (tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IncludedExtensions"))) >>= tmpSeq)
         [ #  # ][ #  # ]
                 [ #  # ]
     495                 :            :         {
     496         [ #  # ]:          0 :             for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
     497 [ #  # ][ #  # ]:          0 :                 tmpStep.includeExtensions.push_back(tmpSeq[j]);
     498                 :            :         }
     499                 :            : 
     500                 :            :         // excluded extensions...
     501 [ #  # ][ #  # ]:          0 :         if (tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("ExcludedExtensions"))) >>= tmpSeq)
         [ #  # ][ #  # ]
                 [ #  # ]
     502                 :            :         {
     503         [ #  # ]:          0 :             for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
     504                 :            :             {
     505         [ #  # ]:          0 :                 aSeqEntry = tmpSeq[j];
     506         [ #  # ]:          0 :                 tmpStep.excludeExtensions.push_back(aSeqEntry);
     507                 :            :             }
     508                 :            :         }
     509                 :            : 
     510                 :            :         // generic service
     511 [ #  # ][ #  # ]:          0 :         tmpAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("MigrationService"))) >>= tmpStep.service;
                 [ #  # ]
     512                 :            : 
     513         [ #  # ]:          0 :         vrMigrations->push_back(tmpStep);
     514                 :          0 :     }
     515 [ #  # ][ #  # ]:          0 :     return vrMigrations;
     516                 :            : }
     517                 :            : 
     518                 :          0 : static FileBase::RC _checkAndCreateDirectory(INetURLObject& dirURL)
     519                 :            : {
     520         [ #  # ]:          0 :     FileBase::RC result = Directory::create(dirURL.GetMainURL(INetURLObject::DECODE_TO_IURI));
     521         [ #  # ]:          0 :     if (result == FileBase::E_NOENT)
     522                 :            :     {
     523         [ #  # ]:          0 :         INetURLObject baseURL(dirURL);
     524         [ #  # ]:          0 :         baseURL.removeSegment();
     525         [ #  # ]:          0 :         _checkAndCreateDirectory(baseURL);
     526 [ #  # ][ #  # ]:          0 :         return Directory::create(dirURL.GetMainURL(INetURLObject::DECODE_TO_IURI));
                 [ #  # ]
     527                 :            :     } else
     528                 :          0 :         return result;
     529                 :            : }
     530                 :            : 
     531                 :         62 : install_info MigrationImpl::findInstallation(const strings_v& rVersions)
     532                 :            : {
     533                 :         62 :     install_info aInfo;
     534                 :         62 :     strings_v::const_iterator i_ver = rVersions.begin();
     535 [ +  - ][ +  + ]:        372 :     while (i_ver != rVersions.end())
     536                 :            :     {
     537                 :        310 :         ::rtl::OUString aVersion, aProfileName;
     538                 :        310 :         sal_Int32 nSeparatorIndex = (*i_ver).indexOf('=');
     539         [ +  - ]:        310 :         if ( nSeparatorIndex != -1 )
     540                 :            :         {
     541                 :        310 :             aVersion = (*i_ver).copy( 0, nSeparatorIndex );
     542                 :        310 :             aProfileName = (*i_ver).copy( nSeparatorIndex+1 );
     543                 :            :         }
     544                 :            : 
     545 [ +  - ][ +  -  :        930 :         if ( !aVersion.isEmpty() && !aProfileName.isEmpty() &&
             -  +  #  # ]
                 [ +  - ]
     546                 :        310 :              ( aInfo.userdata.isEmpty() ||
     547                 :            :                aProfileName.equalsIgnoreAsciiCase(
     548 [ #  # ][ -  + ]:        310 :                    utl::ConfigManager::getProductName() ) ) )
                 [ #  # ]
     549                 :            :         {
     550                 :        310 :             ::rtl::OUString aUserInst;
     551 [ +  - ][ +  - ]:        310 :             osl::Security().getConfigDir( aUserInst );
                 [ +  - ]
     552                 :            : #if defined UNX && ! defined MACOSX
     553                 :        310 :             const char* pXDGCfgHome = getenv("XDG_CONFIG_HOME");
     554                 :            :             // cater for XDG_CONFIG_HOME change
     555                 :            :             // If XDG_CONFIG_HOME is set then we;
     556                 :            :             // assume the user knows what they are doing ( room for improvement here, we could
     557                 :            :             // of course search the default config dir etc. also  - but this is more complex,
     558                 :            :             // we would need to weigh results from the current config dir against matches in
     559                 :            :             // the 'old' config dir etc. ) - currently we just use the returned config dir.
     560                 :            :             // If XDG_CONFIG_HOME is NOT set;
     561                 :            :             // assume then we should now using the default $HOME/,config config location for
     562                 :            :             // our user profiles, however *all* previous libreoffice and openoffice.org
     563                 :            :             // configurations will be in the 'old' config directory and that's where we need
     564                 :            :             // to search - we convert the returned config dir to the 'old' dir
     565 [ +  - ][ +  - ]:        310 :             if ( !pXDGCfgHome && aUserInst.endsWithAsciiL( XDG_CONFIG_PART, sizeof( XDG_CONFIG_PART ) - 1 )  )
                 [ +  - ]
     566                 :        310 :                 aUserInst = aUserInst.copy( 0, aUserInst.getLength() - sizeof(  XDG_CONFIG_PART ) + 2 ); // remove trailing '.config' ( but leave the terminating '/' )
     567                 :            : #endif
     568 [ +  - ][ -  + ]:        310 :             if ( !aUserInst.isEmpty() && aUserInst[ aUserInst.getLength()-1 ] != '/' )
                 [ -  + ]
     569         [ #  # ]:          0 :                 aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
     570                 :            : #if defined UNX && ! defined MACOSX
     571                 :            :             // tribute to whoever had the "great" idea to use different names on Windows and Unix
     572         [ +  - ]:        310 :             aUserInst += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("."));
     573                 :            : #endif
     574                 :        310 :             aUserInst += aProfileName;
     575                 :            :             rtl::OUString url(
     576 [ +  - ][ +  - ]:        310 :                 INetURLObject(aUserInst).GetMainURL(INetURLObject::NO_DECODE));
                 [ +  - ]
     577                 :        310 :             osl::DirectoryItem item;
     578                 :        310 :             osl::FileStatus stat(osl_FileStatus_Mask_Type);
     579 [ -  + ][ #  # ]:        310 :             if (osl::DirectoryItem::get(url, item) == osl::FileBase::E_None
         [ #  # ][ -  + ]
                 [ +  - ]
     580         [ #  # ]:          0 :                 && item.getFileStatus(stat) == osl::FileBase::E_None
     581         [ #  # ]:          0 :                 && stat.getFileType() == osl::FileStatus::Directory)
     582                 :            :             {
     583                 :          0 :                 aInfo.userdata = url;
     584                 :          0 :                 aInfo.productname = aVersion;
     585         [ +  - ]:        310 :             }
     586                 :            :         }
     587                 :        310 :         ++i_ver;
     588                 :        310 :     }
     589                 :            : 
     590                 :         62 :     return aInfo;
     591                 :            : }
     592                 :            : 
     593                 :         62 : sal_Int32 MigrationImpl::findPreferedMigrationProcess(const migrations_available& rAvailableMigrations)
     594                 :            : {
     595                 :         62 :     sal_Int32    nIndex( -1 );
     596                 :         62 :     sal_Int32    i( 0 );
     597                 :            : 
     598                 :         62 :     migrations_available::const_iterator rIter = rAvailableMigrations.begin();
     599 [ +  - ][ +  + ]:        124 :     while ( rIter != rAvailableMigrations.end() )
     600                 :            :     {
     601         [ +  - ]:         62 :         install_info aInstallInfo = findInstallation(rIter->supported_versions);
     602         [ -  + ]:         62 :         if (!aInstallInfo.productname.isEmpty() )
     603                 :            :         {
     604                 :          0 :             m_aInfo = aInstallInfo;
     605                 :          0 :             nIndex  = i;
     606                 :            :             break;
     607                 :            :         }
     608                 :         62 :         ++i;
     609         [ +  - ]:        124 :         ++rIter;
     610                 :         62 :     }
     611                 :            : 
     612                 :            :     OSL_TRACE( " preferred migration is from product '%s'\n",
     613                 :            :                rtl::OUStringToOString( m_aInfo.productname, RTL_TEXTENCODING_ASCII_US ).getStr() );
     614                 :            :     OSL_TRACE( " and settings directory '%s'\n",
     615                 :            :                rtl::OUStringToOString( m_aInfo.userdata, RTL_TEXTENCODING_ASCII_US ).getStr() );
     616                 :            : 
     617                 :         62 :     return nIndex;
     618                 :            : }
     619                 :            : 
     620                 :          0 : strings_vr MigrationImpl::applyPatterns(const strings_v& vSet, const strings_v& vPatterns) const
     621                 :            : {
     622                 :            :     using namespace utl;
     623 [ #  # ][ #  # ]:          0 :     strings_vr vrResult(new strings_v);
     624                 :          0 :     strings_v::const_iterator i_set;
     625                 :          0 :     strings_v::const_iterator i_pat = vPatterns.begin();
     626 [ #  # ][ #  # ]:          0 :     while (i_pat != vPatterns.end())
     627                 :            :     {
     628                 :            :         // find matches for this pattern in input set
     629                 :            :         // and copy them to the result
     630         [ #  # ]:          0 :         SearchParam param(*i_pat, SearchParam::SRCH_REGEXP);
     631         [ #  # ]:          0 :         TextSearch ts(param, LANGUAGE_DONTKNOW);
     632                 :          0 :         i_set = vSet.begin();
     633                 :          0 :         xub_StrLen start = 0;
     634                 :          0 :         xub_StrLen end = 0;
     635 [ #  # ][ #  # ]:          0 :         while (i_set != vSet.end())
     636                 :            :         {
     637                 :          0 :             end = (xub_StrLen)(i_set->getLength());
     638 [ #  # ][ #  # ]:          0 :             if (ts.SearchFrwrd(*i_set, &start, &end))
         [ #  # ][ #  # ]
     639         [ #  # ]:          0 :                 vrResult->push_back(*i_set);
     640                 :          0 :             ++i_set;
     641                 :            :         }
     642                 :          0 :         ++i_pat;
     643 [ #  # ][ #  # ]:          0 :     }
     644                 :          0 :     return vrResult;
     645                 :            : }
     646                 :            : 
     647                 :          0 : strings_vr MigrationImpl::getAllFiles(const OUString& baseURL) const
     648                 :            : {
     649                 :            :     using namespace osl;
     650 [ #  # ][ #  # ]:          0 :     strings_vr vrResult(new strings_v);
     651                 :            : 
     652                 :            :     // get sub dirs
     653                 :          0 :     Directory dir(baseURL);
     654 [ #  # ][ #  # ]:          0 :     if (dir.open() == FileBase::E_None)
     655                 :            :     {
     656         [ #  # ]:          0 :         strings_v vSubDirs;
     657                 :          0 :         strings_vr vrSubResult;
     658                 :            : 
     659                 :            :         // work through directory contents...
     660                 :          0 :         DirectoryItem item;
     661                 :          0 :         FileStatus fs(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL);
     662 [ #  # ][ #  # ]:          0 :         while (dir.getNextItem(item) == FileBase::E_None)
     663                 :            :         {
     664 [ #  # ][ #  # ]:          0 :             if (item.getFileStatus(fs) == FileBase::E_None)
     665                 :            :             {
     666 [ #  # ][ #  # ]:          0 :                 if (fs.getFileType() == FileStatus::Directory)
     667 [ #  # ][ #  # ]:          0 :                     vSubDirs.push_back(fs.getFileURL());
     668                 :            :                 else
     669 [ #  # ][ #  # ]:          0 :                     vrResult->push_back(fs.getFileURL());
     670                 :            :             }
     671                 :            :         }
     672                 :            : 
     673                 :            :         // recurse subfolders
     674         [ #  # ]:          0 :         strings_v::const_iterator i = vSubDirs.begin();
     675 [ #  # ][ #  # ]:          0 :         while (i != vSubDirs.end())
     676                 :            :         {
     677         [ #  # ]:          0 :             vrSubResult = getAllFiles(*i);
     678         [ #  # ]:          0 :             vrResult->insert(vrResult->end(), vrSubResult->begin(), vrSubResult->end());
     679                 :          0 :             ++i;
     680         [ #  # ]:          0 :         }
     681                 :            :     }
     682         [ #  # ]:          0 :     return vrResult;
     683                 :            : }
     684                 :            : 
     685                 :          0 : strings_vr MigrationImpl::compileFileList()
     686                 :            : {
     687                 :            : 
     688 [ #  # ][ #  # ]:          0 :     strings_vr vrResult(new strings_v);
     689                 :          0 :     strings_vr vrInclude;
     690                 :          0 :     strings_vr vrExclude;
     691                 :            : 
     692                 :            :     // get a list of all files:
     693         [ #  # ]:          0 :     strings_vr vrFiles = getAllFiles(m_aInfo.userdata);
     694                 :            : 
     695                 :            :     // get a file list result for each migration step
     696         [ #  # ]:          0 :     migrations_v::const_iterator i_migr = m_vrMigrations->begin();
     697 [ #  # ][ #  # ]:          0 :     while (i_migr != m_vrMigrations->end())
     698                 :            :     {
     699         [ #  # ]:          0 :         vrInclude = applyPatterns(*vrFiles, i_migr->includeFiles);
     700         [ #  # ]:          0 :         vrExclude = applyPatterns(*vrFiles, i_migr->excludeFiles);
     701         [ #  # ]:          0 :         subtract(*vrInclude, *vrExclude);
     702         [ #  # ]:          0 :         vrResult->insert(vrResult->end(), vrInclude->begin(), vrInclude->end());
     703                 :          0 :         ++i_migr;
     704                 :            :     }
     705                 :          0 :     return vrResult;
     706                 :            : }
     707                 :            : 
     708                 :            : namespace {
     709                 :            : 
     710         [ #  # ]:          0 : struct componentParts {
     711                 :            :     std::set< rtl::OUString > includedPaths;
     712                 :            :     std::set< rtl::OUString > excludedPaths;
     713                 :            : };
     714                 :            : 
     715                 :            : typedef std::map< rtl::OUString, componentParts > Components;
     716                 :            : 
     717                 :          0 : bool getComponent(rtl::OUString const & path, rtl::OUString * component) {
     718                 :            :     OSL_ASSERT(component != 0);
     719 [ #  # ][ #  # ]:          0 :     if (path.isEmpty() || path[0] != '/') {
                 [ #  # ]
     720                 :            :         OSL_TRACE(
     721                 :            :             ("configuration migration in/exclude path %s ignored (does not"
     722                 :            :              " start with slash)"),
     723                 :            :             rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr());
     724                 :          0 :         return false;
     725                 :            :     }
     726                 :          0 :     sal_Int32 i = path.indexOf('/', 1);
     727         [ #  # ]:          0 :     *component = i < 0 ? path.copy(1) : path.copy(1, i - 1);
     728                 :          0 :     return true;
     729                 :            : }
     730                 :            : 
     731                 :          0 : uno::Sequence< rtl::OUString > setToSeq(std::set< rtl::OUString > const & set) {
     732                 :          0 :     std::set< rtl::OUString >::size_type n = set.size();
     733         [ #  # ]:          0 :     if (n > SAL_MAX_INT32) {
     734                 :          0 :         throw std::bad_alloc();
     735                 :            :     }
     736                 :          0 :     uno::Sequence< rtl::OUString > seq(static_cast< sal_Int32 >(n));
     737                 :          0 :     sal_Int32 i = 0;
     738         [ #  # ]:          0 :     for (std::set< rtl::OUString >::const_iterator j(set.begin());
     739                 :          0 :          j != set.end(); ++j)
     740                 :            :     {
     741         [ #  # ]:          0 :         seq[i++] = *j;
     742                 :            :     }
     743                 :          0 :     return seq;
     744                 :            : }
     745                 :            : 
     746                 :            : }
     747                 :            : 
     748                 :          0 : void MigrationImpl::copyConfig() {
     749         [ #  # ]:          0 :     Components comps;
     750 [ #  # ][ #  # ]:          0 :     for (migrations_v::const_iterator i(m_vrMigrations->begin());
                 [ #  # ]
     751                 :          0 :          i != m_vrMigrations->end(); ++i)
     752                 :            :     {
     753 [ #  # ][ #  # ]:          0 :         for (strings_v::const_iterator j(i->includeConfig.begin());
     754                 :          0 :              j != i->includeConfig.end(); ++j)
     755                 :            :         {
     756                 :          0 :             rtl::OUString comp;
     757 [ #  # ][ #  # ]:          0 :             if (getComponent(*j, &comp)) {
     758 [ #  # ][ #  # ]:          0 :                 comps[comp].includedPaths.insert(*j);
     759                 :            :             }
     760                 :          0 :         }
     761 [ #  # ][ #  # ]:          0 :         for (strings_v::const_iterator j(i->excludeConfig.begin());
     762                 :          0 :              j != i->excludeConfig.end(); ++j)
     763                 :            :         {
     764                 :          0 :             rtl::OUString comp;
     765 [ #  # ][ #  # ]:          0 :             if (getComponent(*j, &comp)) {
     766 [ #  # ][ #  # ]:          0 :                 comps[comp].excludedPaths.insert(*j);
     767                 :            :             }
     768                 :          0 :         }
     769                 :            :     }
     770                 :            : 
     771                 :            :     // check if the shared registrymodifications.xcu file exists
     772                 :          0 :     bool bRegistryModificationsXcuExists = false;
     773                 :          0 :     rtl::OUString regFilePath(m_aInfo.userdata);
     774         [ #  # ]:          0 :     regFilePath += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user/registrymodifications.xcu"));
     775                 :          0 :     File regFile(regFilePath);
     776         [ #  # ]:          0 :     ::osl::FileBase::RC nError = regFile.open(osl_File_OpenFlag_Read);
     777         [ #  # ]:          0 :     if ( nError == ::osl::FileBase::E_None ) {
     778                 :          0 :         bRegistryModificationsXcuExists = true;
     779         [ #  # ]:          0 :         regFile.close();
     780                 :            :     }
     781                 :            : 
     782         [ #  # ]:          0 :     for (Components::const_iterator i(comps.begin()); i != comps.end(); ++i) {
     783         [ #  # ]:          0 :         if (!i->second.includedPaths.empty()) {
     784         [ #  # ]:          0 :             if (!bRegistryModificationsXcuExists) {
     785                 :            :                 // shared registrymodifications.xcu does not exists
     786                 :            :                 // the configuration is split in many registry files
     787                 :            :                 // determine the file names from the first element in included paths
     788         [ #  # ]:          0 :                 rtl::OUStringBuffer buf(m_aInfo.userdata);
     789         [ #  # ]:          0 :                 buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("/user/registry/data"));
     790                 :          0 :                 sal_Int32 n = 0;
     791         [ #  # ]:          0 :                 do {
     792                 :          0 :                     rtl::OUString seg(i->first.getToken(0, '.', n));
     793                 :            :                     rtl::OUString enc(
     794                 :            :                         rtl::Uri::encode(
     795                 :            :                             seg, rtl_UriCharClassPchar, rtl_UriEncodeStrict,
     796                 :          0 :                             RTL_TEXTENCODING_UTF8));
     797 [ #  # ][ #  # ]:          0 :                     if (enc.isEmpty() && !seg.isEmpty()) {
                 [ #  # ]
     798                 :            :                         OSL_TRACE(
     799                 :            :                             ("configuration migration component %s ignored (cannot"
     800                 :            :                             " be encoded as file path)"),
     801                 :            :                             rtl::OUStringToOString(
     802                 :            :                                 i->first, RTL_TEXTENCODING_UTF8).getStr());
     803                 :            :                         goto next;
     804                 :            :                     }
     805         [ #  # ]:          0 :                     buf.append(sal_Unicode('/'));
     806 [ #  # ][ #  # ]:          0 :                     buf.append(enc);
                 [ #  # ]
     807                 :            :                 } while (n >= 0);
     808         [ #  # ]:          0 :                 buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(".xcu"));
     809         [ #  # ]:          0 :                 regFilePath = buf.toString();
     810                 :            :             }
     811                 :            :             configuration::Update::get(
     812 [ #  # ][ #  # ]:          0 :                 comphelper::getProcessComponentContext())->
                 [ #  # ]
     813                 :            :                 insertModificationXcuFile(
     814                 :          0 :                     regFilePath, setToSeq(i->second.includedPaths),
     815   [ #  #  #  # ]:          0 :                     setToSeq(i->second.excludedPaths));
         [ #  # ][ #  # ]
                 [ #  # ]
     816                 :            :         } else {
     817                 :            :             OSL_TRACE(
     818                 :            :                 ("configuration migration component %s ignored (only excludes,"
     819                 :            :                  " no includes)"),
     820                 :            :                 rtl::OUStringToOString(
     821                 :            :                     i->first, RTL_TEXTENCODING_UTF8).getStr());
     822                 :            :         }
     823                 :            :     next:;
     824         [ #  # ]:          0 :     }
     825                 :          0 : }
     826                 :            : 
     827                 :            : // removes elements of vector 2 in vector 1
     828                 :          0 : void MigrationImpl::subtract(strings_v& va, const strings_v& vb_c) const
     829                 :            : {
     830         [ #  # ]:          0 :     strings_v vb(vb_c);
     831                 :            :     // ensure uniqueness of entries
     832         [ #  # ]:          0 :     sort(va.begin(), va.end());
     833         [ #  # ]:          0 :     sort(vb.begin(), vb.end());
     834         [ #  # ]:          0 :     unique(va.begin(), va.end());
     835         [ #  # ]:          0 :     unique(vb.begin(), vb.end());
     836                 :            : 
     837         [ #  # ]:          0 :     strings_v::const_iterator i_ex = vb.begin();
     838                 :          0 :     strings_v::iterator i_in;
     839                 :          0 :     strings_v::iterator i_next;
     840 [ #  # ][ #  # ]:          0 :     while (i_ex != vb.end())
     841                 :            :     {
     842                 :          0 :         i_in = va.begin();
     843 [ #  # ][ #  # ]:          0 :         while (i_in != va.end())
     844                 :            :         {
     845         [ #  # ]:          0 :             if ( *i_in == *i_ex)
     846                 :            :             {
     847         [ #  # ]:          0 :                 i_next = i_in+1;
     848         [ #  # ]:          0 :                 va.erase(i_in);
     849                 :          0 :                 i_in = i_next;
     850                 :            :                 // we can only find one match since we
     851                 :            :                 // ensured uniquness of the entries. ergo:
     852                 :          0 :                 break;
     853                 :            :             }
     854                 :            :             else
     855                 :          0 :                 ++i_in;
     856                 :            :         }
     857                 :          0 :         ++i_ex;
     858                 :          0 :     }
     859                 :          0 : }
     860                 :            : 
     861                 :        124 : uno::Reference< XNameAccess > MigrationImpl::getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate)
     862                 :            : {
     863                 :        124 :     uno::Reference< XNameAccess > xNameAccess;
     864                 :            :     try{
     865                 :        124 :         OUString sAccessSrvc;
     866         [ -  + ]:        124 :         if (bUpdate)
     867         [ #  # ]:          0 :             sAccessSrvc = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess"));
     868                 :            :         else
     869         [ +  - ]:        124 :             sAccessSrvc = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess"));
     870                 :            : 
     871                 :        124 :         OUString sConfigURL = OUString::createFromAscii(pPath);
     872                 :            : 
     873                 :            :         uno::Reference< XMultiServiceFactory > theConfigProvider(
     874                 :            :             configuration::theDefaultProvider::get(
     875 [ +  - ][ +  - ]:        124 :                 comphelper::getProcessComponentContext()));
     876                 :            : 
     877                 :            :         // access the provider
     878         [ +  - ]:        124 :         uno::Sequence< uno::Any > theArgs(1);
     879 [ +  - ][ +  - ]:        124 :         theArgs[ 0 ] <<= sConfigURL;
     880                 :            :         xNameAccess = uno::Reference< XNameAccess > (
     881         [ +  - ]:        124 :                 theConfigProvider->createInstanceWithArguments(
     882 [ +  - ][ +  - ]:        124 :                 sAccessSrvc, theArgs ), uno::UNO_QUERY_THROW );
         [ +  - ][ +  - ]
     883                 :            :     }
     884   [ #  #  #  # ]:          0 :     catch (const com::sun::star::uno::Exception& e)
     885                 :            :     {
     886         [ #  # ]:          0 :         OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
     887                 :          0 :         OSL_FAIL(aMsg.getStr());
     888                 :            :     }
     889                 :        124 :     return xNameAccess;
     890                 :            : }
     891                 :            : 
     892                 :          0 : void MigrationImpl::copyFiles()
     893                 :            : {
     894         [ #  # ]:          0 :     strings_v::const_iterator i_file = m_vrFileList->begin();
     895                 :          0 :     OUString localName;
     896                 :          0 :     OUString destName;
     897                 :          0 :     OUString userInstall;
     898                 :            :     utl::Bootstrap::PathStatus aStatus;
     899         [ #  # ]:          0 :     aStatus = utl::Bootstrap::locateUserInstallation(userInstall);
     900         [ #  # ]:          0 :     if (aStatus == utl::Bootstrap::PATH_EXISTS)
     901                 :            :     {
     902 [ #  # ][ #  # ]:          0 :         while (i_file != m_vrFileList->end())
     903                 :            :         {
     904                 :            :             // remove installation prefix from file
     905                 :          0 :             localName = i_file->copy(m_aInfo.userdata.getLength());
     906                 :          0 :             destName = userInstall + localName;
     907         [ #  # ]:          0 :             INetURLObject aURL(destName);
     908                 :            :             // check whether destination directory exists
     909         [ #  # ]:          0 :             aURL.removeSegment();
     910         [ #  # ]:          0 :             _checkAndCreateDirectory(aURL);
     911         [ #  # ]:          0 :             FileBase::RC copyResult = File::copy(*i_file, destName);
     912         [ #  # ]:          0 :             if (copyResult != FileBase::E_None)
     913                 :            :             {
     914                 :          0 :                 OString msg("Cannot copy ");
     915                 :          0 :                 msg += OUStringToOString(*i_file, RTL_TEXTENCODING_UTF8) + " to "
     916 [ #  # ][ #  # ]:          0 :                     +  OUStringToOString(destName, RTL_TEXTENCODING_UTF8);
     917                 :          0 :                 OSL_FAIL(msg.getStr());
     918                 :            :             }
     919                 :          0 :             ++i_file;
     920         [ #  # ]:          0 :         }
     921                 :            :     }
     922                 :            :     else
     923                 :            :     {
     924                 :            :         OSL_FAIL("copyFiles: UserInstall does not exist");
     925                 :          0 :     }
     926                 :          0 : }
     927                 :            : 
     928                 :          0 : void MigrationImpl::runServices()
     929                 :            : {
     930                 :            :     // Build argument array
     931         [ #  # ]:          0 :     uno::Sequence< uno::Any > seqArguments(3);
     932         [ #  # ]:          0 :     seqArguments[0] = uno::makeAny(NamedValue(
     933                 :            :         OUString(RTL_CONSTASCII_USTRINGPARAM("Productname")),
     934 [ #  # ][ #  # ]:          0 :         uno::makeAny(m_aInfo.productname)));
                 [ #  # ]
     935         [ #  # ]:          0 :     seqArguments[1] = uno::makeAny(NamedValue(
     936                 :            :         OUString(RTL_CONSTASCII_USTRINGPARAM("UserData")),
     937 [ #  # ][ #  # ]:          0 :         uno::makeAny(m_aInfo.userdata)));
                 [ #  # ]
     938                 :            : 
     939                 :            : 
     940                 :            :     // create an instance of every migration service
     941                 :            :     // and execute the migration job
     942                 :          0 :     uno::Reference< XJob > xMigrationJob;
     943                 :            : 
     944         [ #  # ]:          0 :     migrations_v::const_iterator i_mig  = m_vrMigrations->begin();
     945 [ #  # ][ #  # ]:          0 :     while (i_mig != m_vrMigrations->end())
     946                 :            :     {
     947         [ #  # ]:          0 :         if( !i_mig->service.isEmpty())
     948                 :            :         {
     949                 :            : 
     950                 :            :             try
     951                 :            :             {
     952                 :            :                 // set black list for extension migration
     953         [ #  # ]:          0 :                 uno::Sequence< rtl::OUString > seqExtBlackList;
     954                 :          0 :                 sal_uInt32 nSize = i_mig->excludeExtensions.size();
     955         [ #  # ]:          0 :                 if ( nSize > 0 )
     956                 :            :                     seqExtBlackList = comphelper::arrayToSequence< ::rtl::OUString >(
     957 [ #  # ][ #  # ]:          0 :                         &i_mig->excludeExtensions[0], nSize );
                 [ #  # ]
     958         [ #  # ]:          0 :                 seqArguments[2] = uno::makeAny(NamedValue(
     959                 :            :                     OUString(RTL_CONSTASCII_USTRINGPARAM("ExtensionBlackList")),
     960 [ #  # ][ #  # ]:          0 :                     uno::makeAny( seqExtBlackList )));
                 [ #  # ]
     961                 :            : 
     962         [ #  # ]:          0 :                 xMigrationJob = uno::Reference< XJob >(m_xFactory->createInstanceWithArguments(
     963 [ #  # ][ #  # ]:          0 :                     i_mig->service, seqArguments), uno::UNO_QUERY_THROW);
                 [ #  # ]
     964                 :            : 
     965 [ #  # ][ #  # ]:          0 :                 xMigrationJob->execute(uno::Sequence< NamedValue >());
         [ #  # ][ #  # ]
                 [ #  # ]
     966                 :            : 
     967                 :            : 
     968                 :            :             }
     969         [ #  # ]:          0 :             catch (const Exception& e)
     970                 :            :             {
     971                 :          0 :                 OString aMsg("Execution of migration service failed (Exception caught).\nService: ");
     972         [ #  # ]:          0 :                 aMsg += OUStringToOString(i_mig->service, RTL_TEXTENCODING_ASCII_US) + "\nMessage: ";
     973         [ #  # ]:          0 :                 aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
     974                 :          0 :                 OSL_FAIL(aMsg.getStr());
     975                 :            :             }
     976   [ #  #  #  # ]:          0 :             catch (...)
     977                 :            :             {
     978                 :          0 :                 OString aMsg("Execution of migration service failed (Exception caught).\nService: ");
     979                 :          0 :                 aMsg += OUStringToOString(i_mig->service, RTL_TEXTENCODING_ASCII_US) +
     980         [ #  # ]:          0 :                     "\nNo message available";
     981                 :          0 :                 OSL_FAIL(aMsg.getStr());
     982                 :            :             }
     983                 :            : 
     984                 :            :         }
     985                 :          0 :         ++i_mig;
     986         [ #  # ]:          0 :     }
     987                 :          0 : }
     988                 :            : 
     989                 :          0 : ::std::vector< MigrationModuleInfo > MigrationImpl::dectectUIChangesForAllModules() const
     990                 :            : {
     991         [ #  # ]:          0 :     ::std::vector< MigrationModuleInfo > vModulesInfo;
     992         [ #  # ]:          0 :     const ::rtl::OUString MENUBAR(RTL_CONSTASCII_USTRINGPARAM("menubar"));
     993         [ #  # ]:          0 :     const ::rtl::OUString TOOLBAR(RTL_CONSTASCII_USTRINGPARAM("toolbar"));
     994                 :            : 
     995         [ #  # ]:          0 :     uno::Sequence< uno::Any > lArgs(2);
     996 [ #  # ][ #  # ]:          0 :     lArgs[0] <<= m_aInfo.userdata + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user/config/soffice.cfg/modules"));
                 [ #  # ]
     997 [ #  # ][ #  # ]:          0 :     lArgs[1] <<= embed::ElementModes::READ;
     998                 :            : 
     999                 :            :     uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
    1000 [ #  # ][ #  # ]:          0 :                      embed::FileSystemStorageFactory::create(comphelper::ComponentContext(m_xFactory).getUNOContext()));
         [ #  # ][ #  # ]
    1001                 :          0 :     uno::Reference< embed::XStorage >             xModules;
    1002                 :            : 
    1003 [ #  # ][ #  # ]:          0 :     xModules = uno::Reference< embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY);
         [ #  # ][ #  # ]
    1004         [ #  # ]:          0 :     if (!xModules.is())
    1005                 :            :         return vModulesInfo;
    1006                 :            : 
    1007         [ #  # ]:          0 :     uno::Reference< container::XNameAccess > xAccess = uno::Reference< container::XNameAccess >(xModules, uno::UNO_QUERY);
    1008 [ #  # ][ #  # ]:          0 :     uno::Sequence< ::rtl::OUString > lNames = xAccess->getElementNames();
    1009                 :          0 :     sal_Int32 nLength = lNames.getLength();
    1010         [ #  # ]:          0 :     for (sal_Int32 i=0; i<nLength; ++i)
    1011                 :            :     {
    1012         [ #  # ]:          0 :         ::rtl::OUString sModuleShortName = lNames[i];
    1013 [ #  # ][ #  # ]:          0 :         uno::Reference< embed::XStorage > xModule = xModules->openStorageElement(sModuleShortName, embed::ElementModes::READ);
    1014         [ #  # ]:          0 :         if (xModule.is())
    1015                 :            :         {
    1016         [ #  # ]:          0 :             MigrationModuleInfo aModuleInfo;
    1017                 :            : 
    1018 [ #  # ][ #  # ]:          0 :             uno::Reference< embed::XStorage > xMenubar = xModule->openStorageElement(MENUBAR, embed::ElementModes::READ);
    1019         [ #  # ]:          0 :             if (xMenubar.is())
    1020                 :            :             {
    1021         [ #  # ]:          0 :                 uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xMenubar, uno::UNO_QUERY);
    1022 [ #  # ][ #  # ]:          0 :                 if (xNameAccess->getElementNames().getLength() > 0)
         [ #  # ][ #  # ]
    1023                 :            :                 {
    1024                 :          0 :                     aModuleInfo.sModuleShortName = sModuleShortName;
    1025                 :          0 :                     aModuleInfo.bHasMenubar = sal_True;
    1026                 :          0 :                 }
    1027                 :            :             }
    1028                 :            : 
    1029 [ #  # ][ #  # ]:          0 :             uno::Reference< embed::XStorage > xToolbar = xModule->openStorageElement(TOOLBAR, embed::ElementModes::READ);
    1030         [ #  # ]:          0 :             if (xToolbar.is())
    1031                 :            :             {
    1032         [ #  # ]:          0 :                 const ::rtl::OUString RESOURCEURL_CUSTOM_ELEMENT(RTL_CONSTASCII_USTRINGPARAM("custom_"));
    1033                 :          0 :                 sal_Int32 nCustomLen = 7;
    1034                 :            : 
    1035         [ #  # ]:          0 :                 uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xToolbar, uno::UNO_QUERY);
    1036 [ #  # ][ #  # ]:          0 :                 ::uno::Sequence< ::rtl::OUString > lToolbars = xNameAccess->getElementNames();
    1037         [ #  # ]:          0 :                 for (sal_Int32 j=0; j<lToolbars.getLength(); ++j)
    1038                 :            :                 {
    1039         [ #  # ]:          0 :                     ::rtl::OUString sToolbarName = lToolbars[j];
    1040         [ #  # ]:          0 :                     if (sToolbarName.getLength()>=nCustomLen &&
           [ #  #  #  # ]
    1041         [ #  # ]:          0 :                         sToolbarName.copy(0, nCustomLen).equals(RESOURCEURL_CUSTOM_ELEMENT))
    1042                 :          0 :                         continue;
    1043                 :            : 
    1044                 :          0 :                     aModuleInfo.sModuleShortName = sModuleShortName;
    1045                 :          0 :                     sal_Int32 nIndex = sToolbarName.lastIndexOf('.');
    1046         [ #  # ]:          0 :                     if (nIndex > 0)
    1047                 :            :                     {
    1048                 :          0 :                         ::rtl::OUString sExtension(sToolbarName.copy(nIndex));
    1049                 :          0 :                         ::rtl::OUString sToolbarResourceName(sToolbarName.copy(0, nIndex));
    1050 [ #  # ][ #  # ]:          0 :                         if (!sToolbarResourceName.isEmpty() && sExtension.equalsAsciiL(".xml", 4))
                 [ #  # ]
    1051         [ #  # ]:          0 :                             aModuleInfo.m_vToolbars.push_back(sToolbarResourceName);
    1052                 :            :                     }
    1053 [ #  # ][ #  # ]:          0 :                 }
    1054                 :            :             }
    1055                 :            : 
    1056         [ #  # ]:          0 :             if (!aModuleInfo.sModuleShortName.isEmpty())
    1057         [ #  # ]:          0 :                 vModulesInfo.push_back(aModuleInfo);
    1058                 :            :         }
    1059                 :          0 :     }
    1060                 :            : 
    1061 [ #  # ][ #  # ]:          0 :     return vModulesInfo;
    1062                 :            : }
    1063                 :            : 
    1064                 :          0 : void MigrationImpl::compareOldAndNewConfig(const ::rtl::OUString& sParent,
    1065                 :            :                                            const uno::Reference< container::XIndexContainer >& xIndexOld,
    1066                 :            :                                            const uno::Reference< container::XIndexContainer >& xIndexNew,
    1067                 :            :                                            const ::rtl::OUString& sResourceURL)
    1068                 :            : {
    1069         [ #  # ]:          0 :     const ::rtl::OUString MENU_SEPERATOR(RTL_CONSTASCII_USTRINGPARAM(" | "));
    1070                 :            : 
    1071         [ #  # ]:          0 :     ::std::vector< MigrationItem > vOldItems;
    1072         [ #  # ]:          0 :     ::std::vector< MigrationItem > vNewItems;
    1073         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aProp;
    1074 [ #  # ][ #  # ]:          0 :     sal_Int32 nOldCount = xIndexOld->getCount();
    1075 [ #  # ][ #  # ]:          0 :     sal_Int32 nNewCount = xIndexNew->getCount();
    1076                 :            : 
    1077         [ #  # ]:          0 :     for (int n=0; n<nOldCount; ++n)
    1078                 :            :     {
    1079         [ #  # ]:          0 :         MigrationItem aMigrationItem;
    1080 [ #  # ][ #  # ]:          0 :         if (xIndexOld->getByIndex(n) >>= aProp)
         [ #  # ][ #  # ]
    1081                 :            :         {
    1082         [ #  # ]:          0 :             for(int i=0; i<aProp.getLength(); ++i)
    1083                 :            :             {
    1084 [ #  # ][ #  # ]:          0 :                 if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
    1085         [ #  # ]:          0 :                     aProp[i].Value >>= aMigrationItem.m_sCommandURL;
    1086 [ #  # ][ #  # ]:          0 :                 else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
    1087 [ #  # ][ #  # ]:          0 :                     aProp[i].Value >>= aMigrationItem.m_xPopupMenu;
    1088                 :            :             }
    1089                 :            : 
    1090         [ #  # ]:          0 :             if (!aMigrationItem.m_sCommandURL.isEmpty())
    1091         [ #  # ]:          0 :                 vOldItems.push_back(aMigrationItem);
    1092                 :            :         }
    1093         [ #  # ]:          0 :     }
    1094                 :            : 
    1095         [ #  # ]:          0 :     for (int n=0; n<nNewCount; ++n)
    1096                 :            :     {
    1097         [ #  # ]:          0 :         MigrationItem aMigrationItem;
    1098 [ #  # ][ #  # ]:          0 :         if (xIndexNew->getByIndex(n) >>= aProp)
         [ #  # ][ #  # ]
    1099                 :            :         {
    1100         [ #  # ]:          0 :             for(int i=0; i<aProp.getLength(); ++i)
    1101                 :            :             {
    1102 [ #  # ][ #  # ]:          0 :                 if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
    1103         [ #  # ]:          0 :                     aProp[i].Value >>= aMigrationItem.m_sCommandURL;
    1104 [ #  # ][ #  # ]:          0 :                 else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER )
    1105 [ #  # ][ #  # ]:          0 :                     aProp[i].Value >>= aMigrationItem.m_xPopupMenu;
    1106                 :            :             }
    1107                 :            : 
    1108         [ #  # ]:          0 :             if (!aMigrationItem.m_sCommandURL.isEmpty())
    1109         [ #  # ]:          0 :                 vNewItems.push_back(aMigrationItem);
    1110                 :            :         }
    1111         [ #  # ]:          0 :     }
    1112                 :            : 
    1113                 :          0 :     ::std::vector< MigrationItem >::iterator it;
    1114                 :            : 
    1115                 :          0 :     ::rtl::OUString sSibling;
    1116 [ #  # ][ #  # ]:          0 :     for (it = vOldItems.begin(); it!=vOldItems.end(); ++it)
    1117                 :            :     {
    1118         [ #  # ]:          0 :         ::std::vector< MigrationItem >::iterator pFound = ::std::find(vNewItems.begin(), vNewItems.end(), *it);
    1119 [ #  # ][ #  # ]:          0 :         if (pFound != vNewItems.end() && it->m_xPopupMenu.is())
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1120                 :            :         {
    1121                 :          0 :             ::rtl::OUString sName;
    1122         [ #  # ]:          0 :             if (!sParent.isEmpty())
    1123                 :          0 :                 sName = sParent + MENU_SEPERATOR + it->m_sCommandURL;
    1124                 :            :             else
    1125                 :          0 :                 sName = it->m_sCommandURL;
    1126         [ #  # ]:          0 :             compareOldAndNewConfig(sName, it->m_xPopupMenu, pFound->m_xPopupMenu, sResourceURL);
    1127                 :            :         }
    1128 [ #  # ][ #  # ]:          0 :         else if (pFound == vNewItems.end())
    1129                 :            :         {
    1130         [ #  # ]:          0 :             MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu);
    1131 [ #  # ][ #  # ]:          0 :             if (m_aOldVersionItemsHashMap.find(sResourceURL)==m_aOldVersionItemsHashMap.end())
                 [ #  # ]
    1132                 :            :             {
    1133         [ #  # ]:          0 :                 ::std::vector< MigrationItem > vMigrationItems;
    1134 [ #  # ][ #  # ]:          0 :                 m_aOldVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems));
    1135 [ #  # ][ #  # ]:          0 :                 m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem);
    1136                 :            :             }
    1137                 :            :             else
    1138                 :            :             {
    1139 [ #  # ][ #  # ]:          0 :                 if (::std::find(m_aOldVersionItemsHashMap[sResourceURL].begin(), m_aOldVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aOldVersionItemsHashMap[sResourceURL].end())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1140 [ #  # ][ #  # ]:          0 :                     m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem);
    1141         [ #  # ]:          0 :             }
    1142                 :            :         }
    1143                 :            : 
    1144                 :          0 :         sSibling = it->m_sCommandURL;
    1145                 :            :     }
    1146                 :            : 
    1147                 :          0 :     uno::Reference< container::XIndexContainer > xPopup;
    1148 [ #  # ][ #  # ]:          0 :     for (it = vNewItems.begin(); it!=vNewItems.end(); ++it)
    1149                 :            :     {
    1150         [ #  # ]:          0 :         ::std::vector< MigrationItem >::iterator pFound = ::std::find(vOldItems.begin(), vOldItems.end(), *it);
    1151 [ #  # ][ #  # ]:          0 :         if (pFound != vOldItems.end() && it->m_xPopupMenu.is())
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1152                 :            :         {
    1153                 :          0 :             ::rtl::OUString sName;
    1154         [ #  # ]:          0 :             if (!sParent.isEmpty())
    1155                 :          0 :                 sName = sParent + MENU_SEPERATOR + it->m_sCommandURL;
    1156                 :            :             else
    1157                 :          0 :                 sName = it->m_sCommandURL;
    1158         [ #  # ]:          0 :             compareOldAndNewConfig(sName, pFound->m_xPopupMenu, it->m_xPopupMenu, sResourceURL);
    1159                 :            :         }
    1160 [ #  # ][ #  # ]:          0 :         else if (::std::find(vOldItems.begin(), vOldItems.end(), *it) == vOldItems.end())
                 [ #  # ]
    1161                 :            :         {
    1162         [ #  # ]:          0 :             MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu);
    1163 [ #  # ][ #  # ]:          0 :             if (m_aNewVersionItemsHashMap.find(sResourceURL)==m_aNewVersionItemsHashMap.end())
                 [ #  # ]
    1164                 :            :             {
    1165         [ #  # ]:          0 :                 ::std::vector< MigrationItem > vMigrationItems;
    1166 [ #  # ][ #  # ]:          0 :                 m_aNewVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems));
    1167 [ #  # ][ #  # ]:          0 :                 m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem);
    1168                 :            :             }
    1169                 :            :             else
    1170                 :            :             {
    1171 [ #  # ][ #  # ]:          0 :                 if (::std::find(m_aNewVersionItemsHashMap[sResourceURL].begin(), m_aNewVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aNewVersionItemsHashMap[sResourceURL].end())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1172 [ #  # ][ #  # ]:          0 :                     m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem);
    1173         [ #  # ]:          0 :             }
    1174                 :            :         }
    1175         [ #  # ]:          0 :     }
    1176                 :          0 : }
    1177                 :            : 
    1178                 :          0 : void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurationManager >& xCfgManager,
    1179                 :            :                                          const uno::Reference< container::XIndexContainer>& xIndexContainer,
    1180                 :            :                                          const ::rtl::OUString& sModuleIdentifier,
    1181                 :            :                                          const ::rtl::OUString& sResourceURL)
    1182                 :            : {
    1183         [ #  # ]:          0 :     MigrationHashMap::iterator pFound = m_aOldVersionItemsHashMap.find(sResourceURL);
    1184 [ #  # ][ #  # ]:          0 :     if (pFound==m_aOldVersionItemsHashMap.end())
    1185                 :          0 :         return;
    1186                 :            : 
    1187                 :          0 :     ::std::vector< MigrationItem >::iterator it;
    1188 [ #  # ][ #  # ]:          0 :     for (it=pFound->second.begin(); it!=pFound->second.end(); ++it)
         [ #  # ][ #  # ]
    1189                 :            :     {
    1190                 :          0 :         uno::Reference< container::XIndexContainer > xTemp = xIndexContainer;
    1191                 :            : 
    1192                 :          0 :         ::rtl::OUString sParentNodeName = it->m_sParentNodeName;
    1193                 :          0 :         sal_Int32 nIndex = 0;
    1194         [ #  # ]:          0 :         do
    1195                 :            :         {
    1196                 :          0 :             ::rtl::OUString sToken = sParentNodeName.getToken(0, '|', nIndex).trim();
    1197         [ #  # ]:          0 :             if (sToken.isEmpty())
    1198                 :            :                 break;
    1199                 :            : 
    1200 [ #  # ][ #  # ]:          0 :             sal_Int32 nCount = xTemp->getCount();
    1201         [ #  # ]:          0 :             for (sal_Int32 i=0; i<nCount; ++i)
    1202                 :            :             {
    1203                 :          0 :                 ::rtl::OUString sCommandURL;
    1204                 :          0 :                 ::rtl::OUString sLabel;
    1205                 :          0 :                 uno::Reference< container::XIndexContainer > xChild;
    1206                 :            : 
    1207         [ #  # ]:          0 :                 uno::Sequence< beans::PropertyValue > aPropSeq;
    1208 [ #  # ][ #  # ]:          0 :                 xTemp->getByIndex(i) >>= aPropSeq;
                 [ #  # ]
    1209         [ #  # ]:          0 :                 for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j)
    1210                 :            :                 {
    1211         [ #  # ]:          0 :                     ::rtl::OUString sPropName = aPropSeq[j].Name;
    1212         [ #  # ]:          0 :                     if ( sPropName == ITEM_DESCRIPTOR_COMMANDURL )
    1213         [ #  # ]:          0 :                         aPropSeq[j].Value >>= sCommandURL;
    1214         [ #  # ]:          0 :                     else if ( sPropName == ITEM_DESCRIPTOR_LABEL )
    1215         [ #  # ]:          0 :                         aPropSeq[j].Value >>= sLabel;
    1216         [ #  # ]:          0 :                     else if ( sPropName == ITEM_DESCRIPTOR_CONTAINER )
    1217 [ #  # ][ #  # ]:          0 :                         aPropSeq[j].Value >>= xChild;
    1218                 :          0 :                 }
    1219                 :            : 
    1220         [ #  # ]:          0 :                 if (sCommandURL == sToken)
    1221                 :            :                 {
    1222         [ #  # ]:          0 :                     xTemp = xChild;
    1223                 :            :                     break;
    1224                 :            :                 }
    1225 [ #  # ][ #  # ]:          0 :             }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1226                 :            : 
    1227                 :            :         } while (nIndex>=0);
    1228                 :            : 
    1229         [ #  # ]:          0 :         if (nIndex == -1)
    1230                 :            :         {
    1231         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > aPropSeq(3);
    1232                 :            : 
    1233         [ #  # ]:          0 :             aPropSeq[0].Name = rtl::OUString(ITEM_DESCRIPTOR_COMMANDURL);
    1234 [ #  # ][ #  # ]:          0 :             aPropSeq[0].Value <<= it->m_sCommandURL;
    1235         [ #  # ]:          0 :             aPropSeq[1].Name = rtl::OUString(ITEM_DESCRIPTOR_LABEL);
    1236 [ #  # ][ #  # ]:          0 :             aPropSeq[1].Value <<= retrieveLabelFromCommand(it->m_sCommandURL, sModuleIdentifier);
                 [ #  # ]
    1237         [ #  # ]:          0 :             aPropSeq[2].Name = rtl::OUString(ITEM_DESCRIPTOR_CONTAINER);
    1238 [ #  # ][ #  # ]:          0 :             aPropSeq[2].Value <<= it->m_xPopupMenu;
    1239                 :            : 
    1240         [ #  # ]:          0 :             if (it->m_sPrevSibling.isEmpty())
    1241 [ #  # ][ #  # ]:          0 :                 xTemp->insertByIndex(0, uno::makeAny(aPropSeq));
                 [ #  # ]
    1242         [ #  # ]:          0 :             else if (!it->m_sPrevSibling.isEmpty())
    1243                 :            :             {
    1244 [ #  # ][ #  # ]:          0 :                 sal_Int32 nCount = xTemp->getCount();
    1245                 :          0 :                 sal_Int32 i = 0;
    1246         [ #  # ]:          0 :                 for (; i<nCount; ++i)
    1247                 :            :                 {
    1248                 :          0 :                     ::rtl::OUString sCmd;
    1249         [ #  # ]:          0 :                     uno::Sequence< beans::PropertyValue > aTempPropSeq;
    1250 [ #  # ][ #  # ]:          0 :                     xTemp->getByIndex(i) >>= aTempPropSeq;
                 [ #  # ]
    1251         [ #  # ]:          0 :                     for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j)
    1252                 :            :                     {
    1253 [ #  # ][ #  # ]:          0 :                         if ( aTempPropSeq[j].Name == ITEM_DESCRIPTOR_COMMANDURL )
    1254                 :            :                         {
    1255         [ #  # ]:          0 :                             aTempPropSeq[j].Value >>= sCmd;
    1256                 :          0 :                             break;
    1257                 :            :                         }
    1258                 :            :                     }
    1259                 :            : 
    1260         [ #  # ]:          0 :                     if (sCmd.equals(it->m_sPrevSibling))
    1261                 :            :                         break;
    1262 [ #  # ][ #  # ]:          0 :                 }
                 [ #  # ]
    1263                 :            : 
    1264 [ #  # ][ #  # ]:          0 :                 xTemp->insertByIndex(i+1, uno::makeAny(aPropSeq));
                 [ #  # ]
    1265         [ #  # ]:          0 :             }
    1266                 :            :         }
    1267                 :          0 :     }
    1268                 :            : 
    1269         [ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xIndexAccess(xIndexContainer, uno::UNO_QUERY);
    1270         [ #  # ]:          0 :     if (xIndexAccess.is())
    1271 [ #  # ][ #  # ]:          0 :         xCfgManager->replaceSettings(sResourceURL, xIndexAccess);
    1272                 :            : 
    1273         [ #  # ]:          0 :     uno::Reference< ui::XUIConfigurationPersistence > xUIConfigurationPersistence(xCfgManager, uno::UNO_QUERY);
    1274         [ #  # ]:          0 :     if (xUIConfigurationPersistence.is())
    1275 [ #  # ][ #  # ]:          0 :         xUIConfigurationPersistence->store();
    1276                 :            : }
    1277                 :            : 
    1278                 :          0 : uno::Reference< ui::XUIConfigurationManager > NewVersionUIInfo::getConfigManager(const ::rtl::OUString& sModuleShortName) const
    1279                 :            : {
    1280                 :          0 :     uno::Reference< ui::XUIConfigurationManager > xCfgManager;
    1281                 :            : 
    1282         [ #  # ]:          0 :     for (sal_Int32 i=0; i<m_lCfgManagerSeq.getLength(); ++i)
    1283                 :            :     {
    1284         [ #  # ]:          0 :         if (m_lCfgManagerSeq[i].Name.equals(sModuleShortName))
    1285                 :            :         {
    1286         [ #  # ]:          0 :             m_lCfgManagerSeq[i].Value >>= xCfgManager;
    1287                 :          0 :             break;
    1288                 :            :         }
    1289                 :            :     }
    1290                 :            : 
    1291                 :          0 :     return xCfgManager;
    1292                 :            : }
    1293                 :            : 
    1294                 :          0 : uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewMenubarSettings(const ::rtl::OUString& sModuleShortName) const
    1295                 :            : {
    1296                 :          0 :     uno::Reference< container::XIndexContainer > xNewMenuSettings;
    1297                 :            : 
    1298         [ #  # ]:          0 :     for (sal_Int32 i=0; i<m_lNewVersionMenubarSettingsSeq.getLength(); ++i)
    1299                 :            :     {
    1300         [ #  # ]:          0 :         if (m_lNewVersionMenubarSettingsSeq[i].Name.equals(sModuleShortName))
    1301                 :            :         {
    1302         [ #  # ]:          0 :             m_lNewVersionMenubarSettingsSeq[i].Value >>= xNewMenuSettings;
    1303                 :          0 :             break;
    1304                 :            :         }
    1305                 :            :     }
    1306                 :            : 
    1307                 :          0 :     return xNewMenuSettings;
    1308                 :            : }
    1309                 :            : 
    1310                 :          0 : uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewToolbarSettings(const ::rtl::OUString& sModuleShortName, const ::rtl::OUString& sToolbarName) const
    1311                 :            : {
    1312                 :          0 :     uno::Reference< container::XIndexContainer > xNewToolbarSettings;
    1313                 :            : 
    1314         [ #  # ]:          0 :     for (sal_Int32 i=0; i<m_lNewVersionToolbarSettingsSeq.getLength(); ++i)
    1315                 :            :     {
    1316         [ #  # ]:          0 :         if (m_lNewVersionToolbarSettingsSeq[i].Name.equals(sModuleShortName))
    1317                 :            :         {
    1318         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > lToolbarSettingsSeq;
    1319         [ #  # ]:          0 :             m_lNewVersionToolbarSettingsSeq[i].Value >>= lToolbarSettingsSeq;
    1320         [ #  # ]:          0 :             for (sal_Int32 j=0; j<lToolbarSettingsSeq.getLength(); ++j)
    1321                 :            :             {
    1322 [ #  # ][ #  # ]:          0 :                 if (lToolbarSettingsSeq[j].Name.equals(sToolbarName))
    1323                 :            :                 {
    1324 [ #  # ][ #  # ]:          0 :                     lToolbarSettingsSeq[j].Value >>= xNewToolbarSettings;
    1325                 :          0 :                     break;
    1326                 :            :                 }
    1327                 :            :             }
    1328                 :            : 
    1329         [ #  # ]:          0 :             break;
    1330                 :            :         }
    1331                 :            :     }
    1332                 :            : 
    1333                 :          0 :     return xNewToolbarSettings;
    1334                 :            : }
    1335                 :            : 
    1336                 :          0 : void NewVersionUIInfo::init(const ::std::vector< MigrationModuleInfo >& vModulesInfo)
    1337                 :            : {
    1338         [ #  # ]:          0 :     m_lCfgManagerSeq.realloc(vModulesInfo.size());
    1339         [ #  # ]:          0 :     m_lNewVersionMenubarSettingsSeq.realloc(vModulesInfo.size());
    1340         [ #  # ]:          0 :     m_lNewVersionToolbarSettingsSeq.realloc(vModulesInfo.size());
    1341                 :            : 
    1342         [ #  # ]:          0 :     const ::rtl::OUString sModuleCfgSupplier(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"));
    1343         [ #  # ]:          0 :     const ::rtl::OUString sMenubarResourceURL(RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/menubar"));
    1344         [ #  # ]:          0 :     const ::rtl::OUString sToolbarResourcePre(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/"));
    1345                 :            : 
    1346 [ #  # ][ #  # ]:          0 :     uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = uno::Reference< ui::XModuleUIConfigurationManagerSupplier >(::comphelper::getProcessServiceFactory()->createInstance(sModuleCfgSupplier), uno::UNO_QUERY);
         [ #  # ][ #  # ]
    1347                 :            : 
    1348         [ #  # ]:          0 :     for (sal_uInt32 i=0; i<vModulesInfo.size(); ++i)
    1349                 :            :     {
    1350         [ #  # ]:          0 :         ::rtl::OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName);
    1351         [ #  # ]:          0 :         if (!sModuleIdentifier.isEmpty())
    1352                 :            :         {
    1353 [ #  # ][ #  # ]:          0 :             uno::Reference< ui::XUIConfigurationManager > xCfgManager = xModuleCfgSupplier->getUIConfigurationManager(sModuleIdentifier);
    1354         [ #  # ]:          0 :             m_lCfgManagerSeq[i].Name = vModulesInfo[i].sModuleShortName;
    1355 [ #  # ][ #  # ]:          0 :             m_lCfgManagerSeq[i].Value <<= xCfgManager;
    1356                 :            : 
    1357         [ #  # ]:          0 :             if (vModulesInfo[i].bHasMenubar)
    1358                 :            :             {
    1359         [ #  # ]:          0 :                 m_lNewVersionMenubarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName;
    1360 [ #  # ][ #  # ]:          0 :                 m_lNewVersionMenubarSettingsSeq[i].Value <<= xCfgManager->getSettings(sMenubarResourceURL, sal_True);
         [ #  # ][ #  # ]
    1361                 :            :             }
    1362                 :            : 
    1363                 :          0 :             sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size();
    1364         [ #  # ]:          0 :             if (nToolbars > 0)
    1365                 :            :             {
    1366         [ #  # ]:          0 :                 uno::Sequence< beans::PropertyValue > lPropSeq(nToolbars);
    1367         [ #  # ]:          0 :                 for (sal_Int32 j=0; j<nToolbars; ++j)
    1368                 :            :                 {
    1369                 :          0 :                     ::rtl::OUString sToolbarName = vModulesInfo[i].m_vToolbars[j];
    1370                 :          0 :                     ::rtl::OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName;
    1371                 :            : 
    1372         [ #  # ]:          0 :                     lPropSeq[j].Name = sToolbarName;
    1373 [ #  # ][ #  # ]:          0 :                     lPropSeq[j].Value <<= xCfgManager->getSettings(sToolbarResourceURL, sal_True);
         [ #  # ][ #  # ]
    1374                 :          0 :                 }
    1375                 :            : 
    1376         [ #  # ]:          0 :                 m_lNewVersionToolbarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName;
    1377 [ #  # ][ #  # ]:          0 :                 m_lNewVersionToolbarSettingsSeq[i].Value <<= lPropSeq;
                 [ #  # ]
    1378                 :          0 :             }
    1379                 :            :         }
    1380                 :          0 :     }
    1381                 :          0 : }
    1382                 :            : 
    1383                 :            : } // namespace desktop
    1384                 :            : 
    1385                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10