namecont.cxx (c887325f) namecont.cxx (0848378b)
1/**************************************************************
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

--- 591 unchanged lines hidden (view full) ---

600 maInfoFileName = OUString::createFromAscii( getInfoFileName() );
601 maOldInfoFileName = OUString::createFromAscii( getOldInfoFileName() );
602 maLibElementFileExtension = OUString::createFromAscii( getLibElementFileExtension() );
603 maLibrariesDir = OUString::createFromAscii( getLibrariesDir() );
604
605 meInitMode = DEFAULT;
606 INetURLObject aInitUrlInetObj( maInitialDocumentURL );
607 OUString aInitFileName = aInitUrlInetObj.GetMainURL( INetURLObject::NO_DECODE );
1/**************************************************************
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

--- 591 unchanged lines hidden (view full) ---

600 maInfoFileName = OUString::createFromAscii( getInfoFileName() );
601 maOldInfoFileName = OUString::createFromAscii( getOldInfoFileName() );
602 maLibElementFileExtension = OUString::createFromAscii( getLibElementFileExtension() );
603 maLibrariesDir = OUString::createFromAscii( getLibrariesDir() );
604
605 meInitMode = DEFAULT;
606 INetURLObject aInitUrlInetObj( maInitialDocumentURL );
607 OUString aInitFileName = aInitUrlInetObj.GetMainURL( INetURLObject::NO_DECODE );
608 if( aInitFileName.getLength() )
608 if( !aInitFileName.isEmpty() )
609 {
610 // We need a BasicManager to avoid problems
611 StarBASIC* pBas = new StarBASIC();
612 mpBasMgr = new BasicManager( pBas );
613 mbOwnBasMgr = sal_True;
614
615 OUString aExtension = aInitUrlInetObj.getExtension();
616 if( aExtension.compareToAscii( "xlc" ) == COMPARE_EQUAL )

--- 212 unchanged lines hidden (view full) ---

829
830 sal_Int32 nLibCount = pLibArray->mnLibCount;
831 for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
832 {
833 ::xmlscript::LibDescriptor& rLib = pLibArray->mpLibs[i];
834
835 // Check storage URL
836 OUString aStorageURL = rLib.aStorageURL;
609 {
610 // We need a BasicManager to avoid problems
611 StarBASIC* pBas = new StarBASIC();
612 mpBasMgr = new BasicManager( pBas );
613 mbOwnBasMgr = sal_True;
614
615 OUString aExtension = aInitUrlInetObj.getExtension();
616 if( aExtension.compareToAscii( "xlc" ) == COMPARE_EQUAL )

--- 212 unchanged lines hidden (view full) ---

829
830 sal_Int32 nLibCount = pLibArray->mnLibCount;
831 for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
832 {
833 ::xmlscript::LibDescriptor& rLib = pLibArray->mpLibs[i];
834
835 // Check storage URL
836 OUString aStorageURL = rLib.aStorageURL;
837 if( !bStorage && !aStorageURL.getLength() && nPass == 0 )
837 if( !bStorage && aStorageURL.isEmpty() && nPass == 0 )
838 {
839 String aLibraryPath;
840 if( meInitMode == CONTAINER_INIT_FILE )
841 aLibraryPath = maLibraryPath;
842 else
843 aLibraryPath = String(maLibraryPath).GetToken(1);
844 INetURLObject aInetObj( aLibraryPath );
845

--- 388 unchanged lines hidden (view full) ---

1234}
1235
1236void SfxLibraryContainer::implScanExtensions( void )
1237{
1238 ScriptExtensionIterator aScriptIt;
1239 rtl::OUString aLibURL;
1240
1241 bool bPureDialogLib = false;
838 {
839 String aLibraryPath;
840 if( meInitMode == CONTAINER_INIT_FILE )
841 aLibraryPath = maLibraryPath;
842 else
843 aLibraryPath = String(maLibraryPath).GetToken(1);
844 INetURLObject aInetObj( aLibraryPath );
845

--- 388 unchanged lines hidden (view full) ---

1234}
1235
1236void SfxLibraryContainer::implScanExtensions( void )
1237{
1238 ScriptExtensionIterator aScriptIt;
1239 rtl::OUString aLibURL;
1240
1241 bool bPureDialogLib = false;
1242 while( (aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).getLength() > 0 )
1242 while( (aLibURL = aScriptIt.nextBasicOrDialogLibrary( bPureDialogLib )).isEmpty() == false )
1243 {
1244 if( bPureDialogLib && maInfoFileName.equalsAscii( "script" ) )
1245 continue;
1246
1247 // Extract lib name
1248 sal_Int32 nLen = aLibURL.getLength();
1249 sal_Int32 indexLastSlash = aLibURL.lastIndexOf( '/' );
1250 sal_Int32 nReduceCopy = 0;

--- 95 unchanged lines hidden (view full) ---

1346
1347#define EXPAND_PROTOCOL "vnd.sun.star.expand"
1348#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
1349
1350OUString SfxLibraryContainer::createAppLibraryFolder
1351 ( SfxLibrary* pLib, const OUString& aName )
1352{
1353 OUString aLibDirPath = pLib->maStorageURL;
1243 {
1244 if( bPureDialogLib && maInfoFileName.equalsAscii( "script" ) )
1245 continue;
1246
1247 // Extract lib name
1248 sal_Int32 nLen = aLibURL.getLength();
1249 sal_Int32 indexLastSlash = aLibURL.lastIndexOf( '/' );
1250 sal_Int32 nReduceCopy = 0;

--- 95 unchanged lines hidden (view full) ---

1346
1347#define EXPAND_PROTOCOL "vnd.sun.star.expand"
1348#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
1349
1350OUString SfxLibraryContainer::createAppLibraryFolder
1351 ( SfxLibrary* pLib, const OUString& aName )
1352{
1353 OUString aLibDirPath = pLib->maStorageURL;
1354 if( !aLibDirPath.getLength() )
1354 if( aLibDirPath.isEmpty() )
1355 {
1356 INetURLObject aInetObj( String(maLibraryPath).GetToken(1) );
1357 aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
1358 checkStorageURL( aInetObj.GetMainURL( INetURLObject::NO_DECODE ), pLib->maLibInfoFileURL,
1359 pLib->maStorageURL, pLib->maUnexpandedStorageURL );
1360 aLibDirPath = pLib->maStorageURL;
1361 }
1362

--- 608 unchanged lines hidden (view full) ---

1971 }
1972
1973 // For container info ReadOnly refers to mbReadOnlyLink
1974 rLib.bReadOnly = pImplLib->mbReadOnlyLink;
1975 }
1976
1977 // if we did an in-place save into a storage (i.e. a save into the storage we were already based on),
1978 // then we need to clean up the temporary storage we used for this
1355 {
1356 INetURLObject aInetObj( String(maLibraryPath).GetToken(1) );
1357 aInetObj.insertName( aName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
1358 checkStorageURL( aInetObj.GetMainURL( INetURLObject::NO_DECODE ), pLib->maLibInfoFileURL,
1359 pLib->maStorageURL, pLib->maUnexpandedStorageURL );
1360 aLibDirPath = pLib->maStorageURL;
1361 }
1362

--- 608 unchanged lines hidden (view full) ---

1971 }
1972
1973 // For container info ReadOnly refers to mbReadOnlyLink
1974 rLib.bReadOnly = pImplLib->mbReadOnlyLink;
1975 }
1976
1977 // if we did an in-place save into a storage (i.e. a save into the storage we were already based on),
1978 // then we need to clean up the temporary storage we used for this
1979 if ( bInplaceStorage && sTempTargetStorName.getLength() )
1979 if ( bInplaceStorage && !sTempTargetStorName.isEmpty() )
1980 {
1981 OSL_ENSURE( xSourceLibrariesStor.is(), "SfxLibrariesContainer::storeLibraries_impl: unexpected: we should have a source storage here!" );
1982 try
1983 {
1984 // for this, we first remove everything from the source storage, then copy the complete content
1985 // from the temporary target storage. From then on, what used to be the "source storage" becomes
1986 // the "targt storage" for all subsequent operations.
1987

--- 1126 unchanged lines hidden (view full) ---

3114}
3115
3116void SfxLibrary::impl_removeWithoutChecks( const ::rtl::OUString& _rElementName )
3117{
3118 maNameContainer.removeByName( _rElementName );
3119 implSetModified( sal_True );
3120
3121 // Remove element file
1980 {
1981 OSL_ENSURE( xSourceLibrariesStor.is(), "SfxLibrariesContainer::storeLibraries_impl: unexpected: we should have a source storage here!" );
1982 try
1983 {
1984 // for this, we first remove everything from the source storage, then copy the complete content
1985 // from the temporary target storage. From then on, what used to be the "source storage" becomes
1986 // the "targt storage" for all subsequent operations.
1987

--- 1126 unchanged lines hidden (view full) ---

3114}
3115
3116void SfxLibrary::impl_removeWithoutChecks( const ::rtl::OUString& _rElementName )
3117{
3118 maNameContainer.removeByName( _rElementName );
3119 implSetModified( sal_True );
3120
3121 // Remove element file
3122 if( maStorageURL.getLength() )
3122 if( !maStorageURL.isEmpty() )
3123 {
3124 INetURLObject aElementInetObj( maStorageURL );
3125 aElementInetObj.insertName( _rElementName, sal_False,
3126 INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
3127 aElementInetObj.setExtension( maLibElementFileExtension );
3128 OUString aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
3129
3130 try

--- 118 unchanged lines hidden (view full) ---

3249 Reference< XInterface >() );
3250 }
3251}
3252
3253rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib )
3254{
3255 rtl::OUString aRetLib;
3256
3123 {
3124 INetURLObject aElementInetObj( maStorageURL );
3125 aElementInetObj.insertName( _rElementName, sal_False,
3126 INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
3127 aElementInetObj.setExtension( maLibElementFileExtension );
3128 OUString aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE );
3129
3130 try

--- 118 unchanged lines hidden (view full) ---

3249 Reference< XInterface >() );
3250 }
3251}
3252
3253rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib )
3254{
3255 rtl::OUString aRetLib;
3256
3257 while( !aRetLib.getLength() && m_eState != END_REACHED )
3257 while( aRetLib.isEmpty() && m_eState != END_REACHED )
3258 {
3259 switch( m_eState )
3260 {
3261 case USER_EXTENSIONS:
3262 {
3263 Reference< deployment::XPackage > xScriptPackage =
3264 implGetNextUserScriptPackage( rbPureDialogLib );
3265 if( !xScriptPackage.is() )

--- 348 unchanged lines hidden ---
3258 {
3259 switch( m_eState )
3260 {
3261 case USER_EXTENSIONS:
3262 {
3263 Reference< deployment::XPackage > xScriptPackage =
3264 implGetNextUserScriptPackage( rbPureDialogLib );
3265 if( !xScriptPackage.is() )

--- 348 unchanged lines hidden ---