migration.cxx (07a3d7f1) | migration.cxx (53d915a9) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_desktop.hxx" 26 27#include <map> --- 240 unchanged lines hidden (view full) --- 268{ 269 270} 271 272sal_Bool MigrationImpl::doMigration() 273{ 274 // compile file list for migration 275 m_vrFileList = compileFileList(); | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_desktop.hxx" 26 27#include <map> --- 240 unchanged lines hidden (view full) --- 268{ 269 270} 271 272sal_Bool MigrationImpl::doMigration() 273{ 274 // compile file list for migration 275 m_vrFileList = compileFileList(); |
276 | 276 |
277 sal_Bool result = sal_False; 278 try 279 { | 277 sal_Bool result = sal_False; 278 try 279 { |
280 NewVersionUIInfo aNewVersionUIInfo; | 280 NewVersionUIInfo aNewVersionUIInfo; |
281 ::std::vector< MigrationModuleInfo > vModulesInfo = dectectUIChangesForAllModules(); 282 aNewVersionUIInfo.init(vModulesInfo); 283 284 copyFiles(); 285 286 const ::rtl::OUString sMenubarResourceURL = ::rtl::OUString::createFromAscii("private:resource/menubar/menubar"); 287 const ::rtl::OUString sToolbarResourcePre = ::rtl::OUString::createFromAscii("private:resource/toolbar/"); 288 for (sal_uInt32 i=0; i<vModulesInfo.size(); ++i) --- 40 unchanged lines hidden (view full) --- 329 ::rtl::OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; 330 ::rtl::OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; 331 332 uno::Reference< container::XIndexContainer > xOldVersionToolbarSettings = uno::Reference< container::XIndexContainer >(xOldCfgManager->getSettings(sToolbarResourceURL, sal_True), uno::UNO_QUERY); 333 uno::Reference< container::XIndexContainer > xNewVersionToolbarSettings = aNewVersionUIInfo.getNewToolbarSettings(vModulesInfo[i].sModuleShortName, sToolbarName); 334 ::rtl::OUString sParent; 335 compareOldAndNewConfig(sParent, xOldVersionToolbarSettings, xNewVersionToolbarSettings, sToolbarResourceURL); 336 mergeOldToNewVersion(xCfgManager, xNewVersionToolbarSettings, sModuleIdentifier, sToolbarResourceURL); | 281 ::std::vector< MigrationModuleInfo > vModulesInfo = dectectUIChangesForAllModules(); 282 aNewVersionUIInfo.init(vModulesInfo); 283 284 copyFiles(); 285 286 const ::rtl::OUString sMenubarResourceURL = ::rtl::OUString::createFromAscii("private:resource/menubar/menubar"); 287 const ::rtl::OUString sToolbarResourcePre = ::rtl::OUString::createFromAscii("private:resource/toolbar/"); 288 for (sal_uInt32 i=0; i<vModulesInfo.size(); ++i) --- 40 unchanged lines hidden (view full) --- 329 ::rtl::OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; 330 ::rtl::OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; 331 332 uno::Reference< container::XIndexContainer > xOldVersionToolbarSettings = uno::Reference< container::XIndexContainer >(xOldCfgManager->getSettings(sToolbarResourceURL, sal_True), uno::UNO_QUERY); 333 uno::Reference< container::XIndexContainer > xNewVersionToolbarSettings = aNewVersionUIInfo.getNewToolbarSettings(vModulesInfo[i].sModuleShortName, sToolbarName); 334 ::rtl::OUString sParent; 335 compareOldAndNewConfig(sParent, xOldVersionToolbarSettings, xNewVersionToolbarSettings, sToolbarResourceURL); 336 mergeOldToNewVersion(xCfgManager, xNewVersionToolbarSettings, sModuleIdentifier, sToolbarResourceURL); |
337 } | 337 } |
338 } 339 340 m_aOldVersionItemsHashMap.clear(); 341 m_aNewVersionItemsHashMap.clear(); 342 } 343 344 // execute the migration items from Setup.xcu 345 copyConfig(); --- 71 unchanged lines hidden (view full) --- 417 rAvailableMigrations.push_back( aSupportedMigration ); 418} 419 420bool MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigrations) 421{ 422 // get supported version names 423 uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); 424 uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames(); | 338 } 339 340 m_aOldVersionItemsHashMap.clear(); 341 m_aNewVersionItemsHashMap.clear(); 342 } 343 344 // execute the migration items from Setup.xcu 345 copyConfig(); --- 71 unchanged lines hidden (view full) --- 417 rAvailableMigrations.push_back( aSupportedMigration ); 418} 419 420bool MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigrations) 421{ 422 // get supported version names 423 uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); 424 uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames(); |
425 | 425 |
426 const OUString aVersionIdentifiers( RTL_CONSTASCII_USTRINGPARAM( "VersionIdentifiers" )); 427 const OUString aPriorityIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Priority" )); 428 429 for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) 430 { 431 sal_Int32 nPriority( 0 ); 432 uno::Sequence< OUString > seqVersions; 433 uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW ); --- 11 unchanged lines hidden (view full) --- 445 return true; 446} 447 448migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigrationName) 449{ 450 // get migration access 451 uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); 452 uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(rMigrationName), uno::UNO_QUERY_THROW ); | 426 const OUString aVersionIdentifiers( RTL_CONSTASCII_USTRINGPARAM( "VersionIdentifiers" )); 427 const OUString aPriorityIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Priority" )); 428 429 for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) 430 { 431 sal_Int32 nPriority( 0 ); 432 uno::Sequence< OUString > seqVersions; 433 uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW ); --- 11 unchanged lines hidden (view full) --- 445 return true; 446} 447 448migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigrationName) 449{ 450 // get migration access 451 uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); 452 uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(rMigrationName), uno::UNO_QUERY_THROW ); |
453 | 453 |
454 // get migration description from from org.openoffice.Setup/Migration 455 // and build vector of migration steps 456 OUString aMigrationSteps( RTL_CONSTASCII_USTRINGPARAM( "MigrationSteps" )); 457 uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName(aMigrationSteps), uno::UNO_QUERY_THROW); 458 uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames(); 459 uno::Reference< XNameAccess > tmpAccess; 460 uno::Reference< XNameAccess > tmpAccess2; 461 uno::Sequence< OUString > tmpSeq; --- 12 unchanged lines hidden (view full) --- 474 { 475 for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) 476 { 477 aSeqEntry = tmpSeq[j]; 478 tmpStep.includeFiles.push_back(aSeqEntry); 479 } 480 } 481 | 454 // get migration description from from org.openoffice.Setup/Migration 455 // and build vector of migration steps 456 OUString aMigrationSteps( RTL_CONSTASCII_USTRINGPARAM( "MigrationSteps" )); 457 uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName(aMigrationSteps), uno::UNO_QUERY_THROW); 458 uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames(); 459 uno::Reference< XNameAccess > tmpAccess; 460 uno::Reference< XNameAccess > tmpAccess2; 461 uno::Sequence< OUString > tmpSeq; --- 12 unchanged lines hidden (view full) --- 474 { 475 for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) 476 { 477 aSeqEntry = tmpSeq[j]; 478 tmpStep.includeFiles.push_back(aSeqEntry); 479 } 480 } 481 |
482 // exluded files... | 482 // excluded files... |
483 if (tmpAccess->getByName(OUString::createFromAscii("ExcludedFiles")) >>= tmpSeq) 484 { 485 for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) 486 tmpStep.excludeFiles.push_back(tmpSeq[j]); 487 } 488 489 // included nodes... 490 if (tmpAccess->getByName(OUString::createFromAscii("IncludedNodes")) >>= tmpSeq) --- 62 unchanged lines hidden (view full) --- 553 ::rtl::OUString aVersion, aProfileName; 554 sal_Int32 nSeparatorIndex = (*i_ver).indexOf('='); 555 if ( nSeparatorIndex != -1 ) 556 { 557 aVersion = (*i_ver).copy( 0, nSeparatorIndex ); 558 aProfileName = (*i_ver).copy( nSeparatorIndex+1 ); 559 } 560 | 483 if (tmpAccess->getByName(OUString::createFromAscii("ExcludedFiles")) >>= tmpSeq) 484 { 485 for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) 486 tmpStep.excludeFiles.push_back(tmpSeq[j]); 487 } 488 489 // included nodes... 490 if (tmpAccess->getByName(OUString::createFromAscii("IncludedNodes")) >>= tmpSeq) --- 62 unchanged lines hidden (view full) --- 553 ::rtl::OUString aVersion, aProfileName; 554 sal_Int32 nSeparatorIndex = (*i_ver).indexOf('='); 555 if ( nSeparatorIndex != -1 ) 556 { 557 aVersion = (*i_ver).copy( 0, nSeparatorIndex ); 558 aProfileName = (*i_ver).copy( nSeparatorIndex+1 ); 559 } 560 |
561 if ( aVersion.getLength() && aProfileName.getLength() && | 561 if ( aVersion.getLength() && aProfileName.getLength() && |
562 ( !aInfo.userdata.getLength() || !aProfileName.toAsciiLowerCase().compareTo( aProductName, aProductName.getLength() ) ) 563 ) 564 { 565 ::rtl::OUString aUserInst; 566 osl::Security().getConfigDir( aUserInst ); 567 if ( aUserInst.getLength() && aUserInst[ aUserInst.getLength()-1 ] != '/' ) 568 aUserInst += ::rtl::OUString::createFromAscii("/"); 569#if defined UNX && ! defined MACOSX --- 16 unchanged lines hidden (view full) --- 586 587 return aInfo; 588} 589 590sal_Int32 MigrationImpl::findPreferedMigrationProcess(const migrations_available& rAvailableMigrations) 591{ 592 sal_Int32 nIndex( -1 ); 593 sal_Int32 i( 0 ); | 562 ( !aInfo.userdata.getLength() || !aProfileName.toAsciiLowerCase().compareTo( aProductName, aProductName.getLength() ) ) 563 ) 564 { 565 ::rtl::OUString aUserInst; 566 osl::Security().getConfigDir( aUserInst ); 567 if ( aUserInst.getLength() && aUserInst[ aUserInst.getLength()-1 ] != '/' ) 568 aUserInst += ::rtl::OUString::createFromAscii("/"); 569#if defined UNX && ! defined MACOSX --- 16 unchanged lines hidden (view full) --- 586 587 return aInfo; 588} 589 590sal_Int32 MigrationImpl::findPreferedMigrationProcess(const migrations_available& rAvailableMigrations) 591{ 592 sal_Int32 nIndex( -1 ); 593 sal_Int32 i( 0 ); |
594 | 594 |
595 migrations_available::const_iterator rIter = rAvailableMigrations.begin(); 596 while ( rIter != rAvailableMigrations.end() ) 597 { 598 install_info aInstallInfo = findInstallation(rIter->supported_versions); 599 if (aInstallInfo.productname.getLength() > 0 ) 600 { 601 m_aInfo = aInstallInfo; 602 nIndex = i; --- 229 unchanged lines hidden (view full) --- 832 while (i_in != va.end()) 833 { 834 if ( *i_in == *i_ex) 835 { 836 i_next = i_in+1; 837 va.erase(i_in); 838 i_in = i_next; 839 // we can only find one match since we | 595 migrations_available::const_iterator rIter = rAvailableMigrations.begin(); 596 while ( rIter != rAvailableMigrations.end() ) 597 { 598 install_info aInstallInfo = findInstallation(rIter->supported_versions); 599 if (aInstallInfo.productname.getLength() > 0 ) 600 { 601 m_aInfo = aInstallInfo; 602 nIndex = i; --- 229 unchanged lines hidden (view full) --- 832 while (i_in != va.end()) 833 { 834 if ( *i_in == *i_ex) 835 { 836 i_next = i_in+1; 837 va.erase(i_in); 838 i_in = i_next; 839 // we can only find one match since we |
840 // ensured uniquness of the entries. ergo: | 840 // ensured uniqueness of the entries. ergo: |
841 break; 842 } 843 else 844 i_in++; 845 } 846 i_ex++; 847 } 848} --- 78 unchanged lines hidden (view full) --- 927 OUString::createFromAscii("UserData"), 928 uno::makeAny(m_aInfo.userdata))); 929 930 931 // create an instance of every migration service 932 // and execute the migration job 933 uno::Reference< XJob > xMigrationJob; 934 | 841 break; 842 } 843 else 844 i_in++; 845 } 846 i_ex++; 847 } 848} --- 78 unchanged lines hidden (view full) --- 927 OUString::createFromAscii("UserData"), 928 uno::makeAny(m_aInfo.userdata))); 929 930 931 // create an instance of every migration service 932 // and execute the migration job 933 uno::Reference< XJob > xMigrationJob; 934 |
935 migrations_v::const_iterator i_mig = m_vrMigrations->begin(); | 935 migrations_v::const_iterator i_mig = m_vrMigrations->begin(); |
936 while (i_mig != m_vrMigrations->end()) 937 { 938 if( i_mig->service.getLength() > 0) 939 { 940 941 try 942 { 943 // set black list for extension migration 944 uno::Sequence< rtl::OUString > seqExtBlackList; 945 sal_uInt32 nSize = i_mig->excludeExtensions.size(); 946 if ( nSize > 0 ) | 936 while (i_mig != m_vrMigrations->end()) 937 { 938 if( i_mig->service.getLength() > 0) 939 { 940 941 try 942 { 943 // set black list for extension migration 944 uno::Sequence< rtl::OUString > seqExtBlackList; 945 sal_uInt32 nSize = i_mig->excludeExtensions.size(); 946 if ( nSize > 0 ) |
947 seqExtBlackList = comphelper::arrayToSequence< ::rtl::OUString >( 948 &i_mig->excludeExtensions[0], nSize ); | 947 seqExtBlackList = comphelper::arrayToSequence< ::rtl::OUString >( 948 &i_mig->excludeExtensions[0], nSize ); |
949 seqArguments[2] = uno::makeAny(NamedValue( 950 OUString::createFromAscii("ExtensionBlackList"), 951 uno::makeAny( seqExtBlackList ))); 952 953 xMigrationJob = uno::Reference< XJob >(m_xFactory->createInstanceWithArguments( 954 i_mig->service, seqArguments), uno::UNO_QUERY_THROW); 955 956 xMigrationJob->execute(uno::Sequence< NamedValue >()); --- 63 unchanged lines hidden (view full) --- 1020 const ::rtl::OUString RESOURCEURL_CUSTOM_ELEMENT = ::rtl::OUString::createFromAscii("custom_"); 1021 sal_Int32 nCustomLen = 7; 1022 1023 uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xToolbar, uno::UNO_QUERY); 1024 ::uno::Sequence< ::rtl::OUString > lToolbars = xNameAccess->getElementNames(); 1025 for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) 1026 { 1027 ::rtl::OUString sToolbarName = lToolbars[j]; | 949 seqArguments[2] = uno::makeAny(NamedValue( 950 OUString::createFromAscii("ExtensionBlackList"), 951 uno::makeAny( seqExtBlackList ))); 952 953 xMigrationJob = uno::Reference< XJob >(m_xFactory->createInstanceWithArguments( 954 i_mig->service, seqArguments), uno::UNO_QUERY_THROW); 955 956 xMigrationJob->execute(uno::Sequence< NamedValue >()); --- 63 unchanged lines hidden (view full) --- 1020 const ::rtl::OUString RESOURCEURL_CUSTOM_ELEMENT = ::rtl::OUString::createFromAscii("custom_"); 1021 sal_Int32 nCustomLen = 7; 1022 1023 uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xToolbar, uno::UNO_QUERY); 1024 ::uno::Sequence< ::rtl::OUString > lToolbars = xNameAccess->getElementNames(); 1025 for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) 1026 { 1027 ::rtl::OUString sToolbarName = lToolbars[j]; |
1028 if (sToolbarName.getLength()>=nCustomLen && | 1028 if (sToolbarName.getLength()>=nCustomLen && |
1029 sToolbarName.copy(0, nCustomLen).equals(RESOURCEURL_CUSTOM_ELEMENT)) 1030 continue; 1031 1032 aModuleInfo.sModuleShortName = sModuleShortName; 1033 sal_Int32 nIndex = sToolbarName.lastIndexOf('.'); 1034 if (nIndex > 0) 1035 { 1036 ::rtl::OUString sExtension(sToolbarName.copy(nIndex)); --- 71 unchanged lines hidden (view full) --- 1108 if (sParent.getLength()>0) 1109 sName = sParent + MENU_SEPERATOR + it->m_sCommandURL; 1110 else 1111 sName = it->m_sCommandURL; 1112 compareOldAndNewConfig(sName, it->m_xPopupMenu, pFound->m_xPopupMenu, sResourceURL); 1113 } 1114 else if (pFound == vNewItems.end()) 1115 { | 1029 sToolbarName.copy(0, nCustomLen).equals(RESOURCEURL_CUSTOM_ELEMENT)) 1030 continue; 1031 1032 aModuleInfo.sModuleShortName = sModuleShortName; 1033 sal_Int32 nIndex = sToolbarName.lastIndexOf('.'); 1034 if (nIndex > 0) 1035 { 1036 ::rtl::OUString sExtension(sToolbarName.copy(nIndex)); --- 71 unchanged lines hidden (view full) --- 1108 if (sParent.getLength()>0) 1109 sName = sParent + MENU_SEPERATOR + it->m_sCommandURL; 1110 else 1111 sName = it->m_sCommandURL; 1112 compareOldAndNewConfig(sName, it->m_xPopupMenu, pFound->m_xPopupMenu, sResourceURL); 1113 } 1114 else if (pFound == vNewItems.end()) 1115 { |
1116 MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); | 1116 MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); |
1117 if (m_aOldVersionItemsHashMap.find(sResourceURL)==m_aOldVersionItemsHashMap.end()) 1118 { 1119 ::std::vector< MigrationItem > vMigrationItems; 1120 m_aOldVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); 1121 m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); 1122 } 1123 else 1124 { --- 16 unchanged lines hidden (view full) --- 1141 if (sParent.getLength()>0) 1142 sName = sParent + MENU_SEPERATOR + it->m_sCommandURL; 1143 else 1144 sName = it->m_sCommandURL; 1145 compareOldAndNewConfig(sName, pFound->m_xPopupMenu, it->m_xPopupMenu, sResourceURL); 1146 } 1147 else if (::std::find(vOldItems.begin(), vOldItems.end(), *it) == vOldItems.end()) 1148 { | 1117 if (m_aOldVersionItemsHashMap.find(sResourceURL)==m_aOldVersionItemsHashMap.end()) 1118 { 1119 ::std::vector< MigrationItem > vMigrationItems; 1120 m_aOldVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); 1121 m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); 1122 } 1123 else 1124 { --- 16 unchanged lines hidden (view full) --- 1141 if (sParent.getLength()>0) 1142 sName = sParent + MENU_SEPERATOR + it->m_sCommandURL; 1143 else 1144 sName = it->m_sCommandURL; 1145 compareOldAndNewConfig(sName, pFound->m_xPopupMenu, it->m_xPopupMenu, sResourceURL); 1146 } 1147 else if (::std::find(vOldItems.begin(), vOldItems.end(), *it) == vOldItems.end()) 1148 { |
1149 MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); | 1149 MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); |
1150 if (m_aNewVersionItemsHashMap.find(sResourceURL)==m_aNewVersionItemsHashMap.end()) 1151 { 1152 ::std::vector< MigrationItem > vMigrationItems; 1153 m_aNewVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); 1154 m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); 1155 } 1156 else 1157 { 1158 if (::std::find(m_aNewVersionItemsHashMap[sResourceURL].begin(), m_aNewVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aNewVersionItemsHashMap[sResourceURL].end()) 1159 m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); 1160 } 1161 } 1162 } 1163} 1164 | 1150 if (m_aNewVersionItemsHashMap.find(sResourceURL)==m_aNewVersionItemsHashMap.end()) 1151 { 1152 ::std::vector< MigrationItem > vMigrationItems; 1153 m_aNewVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); 1154 m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); 1155 } 1156 else 1157 { 1158 if (::std::find(m_aNewVersionItemsHashMap[sResourceURL].begin(), m_aNewVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aNewVersionItemsHashMap[sResourceURL].end()) 1159 m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); 1160 } 1161 } 1162 } 1163} 1164 |
1165void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurationManager >& xCfgManager, 1166 const uno::Reference< container::XIndexContainer>& xIndexContainer, 1167 const ::rtl::OUString& sModuleIdentifier, | 1165void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurationManager >& xCfgManager, 1166 const uno::Reference< container::XIndexContainer>& xIndexContainer, 1167 const ::rtl::OUString& sModuleIdentifier, |
1168 const ::rtl::OUString& sResourceURL) 1169{ 1170 MigrationHashMap::iterator pFound = m_aOldVersionItemsHashMap.find(sResourceURL); 1171 if (pFound==m_aOldVersionItemsHashMap.end()) 1172 return; 1173 1174 ::std::vector< MigrationItem >::iterator it; 1175 for (it=pFound->second.begin(); it!=pFound->second.end(); ++it) 1176 { 1177 uno::Reference< container::XIndexContainer > xTemp = xIndexContainer; 1178 1179 ::rtl::OUString sParentNodeName = it->m_sParentNodeName; 1180 sal_Int32 nIndex = 0; | 1168 const ::rtl::OUString& sResourceURL) 1169{ 1170 MigrationHashMap::iterator pFound = m_aOldVersionItemsHashMap.find(sResourceURL); 1171 if (pFound==m_aOldVersionItemsHashMap.end()) 1172 return; 1173 1174 ::std::vector< MigrationItem >::iterator it; 1175 for (it=pFound->second.begin(); it!=pFound->second.end(); ++it) 1176 { 1177 uno::Reference< container::XIndexContainer > xTemp = xIndexContainer; 1178 1179 ::rtl::OUString sParentNodeName = it->m_sParentNodeName; 1180 sal_Int32 nIndex = 0; |
1181 do | 1181 do |
1182 { 1183 ::rtl::OUString sToken = sParentNodeName.getToken(0, '|', nIndex).trim(); 1184 if (sToken.getLength()<=0) 1185 break; 1186 1187 sal_Int32 nCount = xTemp->getCount(); 1188 for (sal_Int32 i=0; i<nCount; ++i) 1189 { 1190 ::rtl::OUString sCommandURL; 1191 ::rtl::OUString sLabel; 1192 uno::Reference< container::XIndexContainer > xChild; 1193 | 1182 { 1183 ::rtl::OUString sToken = sParentNodeName.getToken(0, '|', nIndex).trim(); 1184 if (sToken.getLength()<=0) 1185 break; 1186 1187 sal_Int32 nCount = xTemp->getCount(); 1188 for (sal_Int32 i=0; i<nCount; ++i) 1189 { 1190 ::rtl::OUString sCommandURL; 1191 ::rtl::OUString sLabel; 1192 uno::Reference< container::XIndexContainer > xChild; 1193 |
1194 uno::Sequence< beans::PropertyValue > aPropSeq; | 1194 uno::Sequence< beans::PropertyValue > aPropSeq; |
1195 xTemp->getByIndex(i) >>= aPropSeq; 1196 for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j) 1197 { 1198 ::rtl::OUString sPropName = aPropSeq[j].Name; 1199 if (sPropName.equals(ITEM_DESCRIPTOR_COMMANDURL)) 1200 aPropSeq[j].Value >>= sCommandURL; 1201 else if (sPropName.equals(ITEM_DESCRIPTOR_LABEL)) 1202 aPropSeq[j].Value >>= sLabel; --- 25 unchanged lines hidden (view full) --- 1228 xTemp->insertByIndex(0, uno::makeAny(aPropSeq)); 1229 else if (it->m_sPrevSibling.getLength() > 0) 1230 { 1231 sal_Int32 nCount = xTemp->getCount(); 1232 sal_Int32 i = 0; 1233 for (; i<nCount; ++i) 1234 { 1235 ::rtl::OUString sCmd; | 1195 xTemp->getByIndex(i) >>= aPropSeq; 1196 for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j) 1197 { 1198 ::rtl::OUString sPropName = aPropSeq[j].Name; 1199 if (sPropName.equals(ITEM_DESCRIPTOR_COMMANDURL)) 1200 aPropSeq[j].Value >>= sCommandURL; 1201 else if (sPropName.equals(ITEM_DESCRIPTOR_LABEL)) 1202 aPropSeq[j].Value >>= sLabel; --- 25 unchanged lines hidden (view full) --- 1228 xTemp->insertByIndex(0, uno::makeAny(aPropSeq)); 1229 else if (it->m_sPrevSibling.getLength() > 0) 1230 { 1231 sal_Int32 nCount = xTemp->getCount(); 1232 sal_Int32 i = 0; 1233 for (; i<nCount; ++i) 1234 { 1235 ::rtl::OUString sCmd; |
1236 uno::Sequence< beans::PropertyValue > aTempPropSeq; | 1236 uno::Sequence< beans::PropertyValue > aTempPropSeq; |
1237 xTemp->getByIndex(i) >>= aTempPropSeq; 1238 for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j) 1239 { 1240 if (aTempPropSeq[j].Name.equals(ITEM_DESCRIPTOR_COMMANDURL)) 1241 { 1242 aTempPropSeq[j].Value >>= sCmd; 1243 break; 1244 } --- 13 unchanged lines hidden (view full) --- 1258 xCfgManager->replaceSettings(sResourceURL, xIndexAccess); 1259 1260 uno::Reference< ui::XUIConfigurationPersistence > xUIConfigurationPersistence(xCfgManager, uno::UNO_QUERY); 1261 if (xUIConfigurationPersistence.is()) 1262 xUIConfigurationPersistence->store(); 1263} 1264 1265uno::Reference< ui::XUIConfigurationManager > NewVersionUIInfo::getConfigManager(const ::rtl::OUString& sModuleShortName) const | 1237 xTemp->getByIndex(i) >>= aTempPropSeq; 1238 for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j) 1239 { 1240 if (aTempPropSeq[j].Name.equals(ITEM_DESCRIPTOR_COMMANDURL)) 1241 { 1242 aTempPropSeq[j].Value >>= sCmd; 1243 break; 1244 } --- 13 unchanged lines hidden (view full) --- 1258 xCfgManager->replaceSettings(sResourceURL, xIndexAccess); 1259 1260 uno::Reference< ui::XUIConfigurationPersistence > xUIConfigurationPersistence(xCfgManager, uno::UNO_QUERY); 1261 if (xUIConfigurationPersistence.is()) 1262 xUIConfigurationPersistence->store(); 1263} 1264 1265uno::Reference< ui::XUIConfigurationManager > NewVersionUIInfo::getConfigManager(const ::rtl::OUString& sModuleShortName) const |
1266{ | 1266{ |
1267 uno::Reference< ui::XUIConfigurationManager > xCfgManager; 1268 1269 for (sal_Int32 i=0; i<m_lCfgManagerSeq.getLength(); ++i) 1270 { 1271 if (m_lCfgManagerSeq[i].Name.equals(sModuleShortName)) 1272 { | 1267 uno::Reference< ui::XUIConfigurationManager > xCfgManager; 1268 1269 for (sal_Int32 i=0; i<m_lCfgManagerSeq.getLength(); ++i) 1270 { 1271 if (m_lCfgManagerSeq[i].Name.equals(sModuleShortName)) 1272 { |
1273 m_lCfgManagerSeq[i].Value >>= xCfgManager; | 1273 m_lCfgManagerSeq[i].Value >>= xCfgManager; |
1274 break; 1275 } 1276 } 1277 1278 return xCfgManager; 1279} 1280 1281uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewMenubarSettings(const ::rtl::OUString& sModuleShortName) const --- 81 unchanged lines hidden (view full) --- 1363 m_lNewVersionToolbarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; 1364 m_lNewVersionToolbarSettingsSeq[i].Value <<= lPropSeq; 1365 } 1366 } 1367 } 1368} 1369 1370} // namespace desktop | 1274 break; 1275 } 1276 } 1277 1278 return xCfgManager; 1279} 1280 1281uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewMenubarSettings(const ::rtl::OUString& sModuleShortName) const --- 81 unchanged lines hidden (view full) --- 1363 m_lNewVersionToolbarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; 1364 m_lNewVersionToolbarSettingsSeq[i].Value <<= lPropSeq; 1365 } 1366 } 1367 } 1368} 1369 1370} // namespace desktop |
1371 |
|