20#include <config_extensions.h>
21#include <config_folders.h>
23#include <com/sun/star/container/XNameContainer.hpp>
24#include <com/sun/star/container/XContainer.hpp>
25#include <com/sun/star/embed/ElementModes.hpp>
26#include <com/sun/star/embed/XTransactedObject.hpp>
27#include <com/sun/star/io/IOException.hpp>
28#include <com/sun/star/lang/NoSupportException.hpp>
29#include <com/sun/star/lang/XMultiServiceFactory.hpp>
30#include <com/sun/star/lang/XServiceInfo.hpp>
31#include <com/sun/star/ucb/ContentCreationException.hpp>
32#include <com/sun/star/xml/sax/SAXException.hpp>
36#include <osl/mutex.hxx>
38#include <rtl/ustring.hxx>
53#include <com/sun/star/xml/sax/Parser.hpp>
54#include <com/sun/star/xml/sax/InputSource.hpp>
55#include <com/sun/star/io/XOutputStream.hpp>
56#include <com/sun/star/xml/sax/Writer.hpp>
57#include <com/sun/star/io/XInputStream.hpp>
58#include <com/sun/star/beans/XPropertySet.hpp>
59#include <com/sun/star/uno/DeploymentException.hpp>
60#include <com/sun/star/lang/DisposedException.hpp>
61#include <com/sun/star/script/LibraryNotLoadedException.hpp>
62#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
63#include <com/sun/star/ucb/SimpleFileAccess.hpp>
64#include <com/sun/star/util/PathSubstitution.hpp>
65#include <com/sun/star/deployment/ExtensionManager.hpp>
121 throw NoSuchElementException();
123 sal_Int32 iHashResult = (*aIt).second;
136 bool bRet = ( aIt !=
mHashMap.end() );
144 const Type& aAnyType = aElement.getValueType();
145 if(
mType != aAnyType )
147 throw IllegalArgumentException(
"types do not match", getXWeak(), 2);
149 NameContainerNameMap::iterator aIt =
mHashMap.find( aName );
152 throw NoSuchElementException();
154 sal_Int32 iHashResult = (*aIt).second;
156 mValues[ iHashResult ] = aElement;
165 aEvent.Element = aElement;
166 aEvent.ReplacedElement = aOldElement;
178 aEvent.Changes = { {
Any(aName), aElement, aOldElement } };
188 throw ElementExistException();
195 const Type& aAnyType = aElement.getValueType();
196 if(
mType != aAnyType )
198 throw IllegalArgumentException(
"types do not match", getXWeak(), 2);
214 aEvent.Element = aElement;
243 throw NoSuchElementException(
sMessage);
246 sal_Int32 iHashResult = (*aIt).second;
249 sal_Int32 iLast =
mNames.size() - 1;
250 if( iLast != iHashResult )
266 aEvent.Element = aOldElement;
289 if( !xListener.is() )
291 throw RuntimeException(
"addContainerListener called with null xListener",getXWeak());
298 if( !xListener.is() )
300 throw RuntimeException(
"removeContainerListener called with null xListener",getXWeak());
308 if( !xListener.is() )
310 throw RuntimeException(
"addChangesListener called with null xListener",getXWeak());
317 if( !xListener.is() )
319 throw RuntimeException(
"removeChangesListener called with null xListener",getXWeak());
348 , mnRunningVBAScripts( 0 )
349 , mbVBACompat( false )
350 , meVBATextEncoding( RTL_TEXTENCODING_DONTKNOW )
353 , mbOldInfoFormat( false )
354 , mbOasis2OOoFormat( false )
355 , mpBasMgr( nullptr )
356 , mbOwnBasMgr( false )
377 if ( rBHelper.bInDispose || rBHelper.bDisposed )
379 throw DisposedException( OUString(), *
this );
398 !xDocument.is(),
"basic",
399 (
"SfxLibraryContainer::getBasicManager: cannot obtain a BasicManager"
400 " without document!"));
401 if ( xDocument.is() )
406 catch (
const css::ucb::ContentCreationException&)
423 if ( !_rxRootStorage.is() )
425 throw IllegalArgumentException(
"no root storage", getXWeak(), 1);
434 if ( !_rxRootStorage.is() )
436 throw IllegalArgumentException(
"no root storage", getXWeak(), 1);
444 throw WrappedTargetException( OUString(),
445 *
this, ::cppu::getCaughtException() );
460 const OUString* pNames = aNames.getConstArray();
461 sal_Int32 nNameCount = aNames.getLength();
463 for( sal_Int32
i = 0 ;
i < nNameCount ;
i++ )
465 OUString
aName = pNames[
i ];
471 if (
aName ==
"Standard" )
485 catch(
const css::container::NoSuchElementException&)
536 throw WrappedTargetException( OUString(), *
this, ::cppu::getCaughtException() );
542 std::u16string_view rCheckFileName,
543 std::u16string_view rCheckExtension,
551 if( !xSFI->exists( aTargetFile ) )
558 xSFI->copy( aSourceFile, aTargetFile );
563 std::u16string_view rInfoFileName,
bool bUser )
567 rStr =
"$(USER)/basic/";
571 rStr =
"$(INST)/" LIBO_SHARE_FOLDER
"/basic/";
573 rStr += OUString::Concat(rLibName) +
"/" + rInfoFileName +
".xlb/";
582 init_Impl( rInitialDocumentURL, rxInitialStorage );
600 if( !aInitFileName.isEmpty() )
608 if( aExtension ==
"xlc" )
615 else if( aExtension ==
"xlb" )
640 catch (
const uno::Exception& )
671 for(
int nPass = 0 ; nPass < nPassCount ; nPass++ )
677 "Wrong InitMode for document");
683 if ( xLibrariesStor.is() )
690 catch(
const uno::Exception& )
703 catch(
const uno::Exception& )
717 xInput =
xStream->getInputStream();
720 catch(
const uno::Exception& )
727 std::unique_ptr<INetURLObject> pLibInfoInetObj;
730 aFileName = aInitFileName;
743 pLibInfoInetObj->setExtension(
u"xlc" );
749 xInput =
mxSFI->openFileRead( aFileName );
758 if( !xInput.is() && nPass == 0 )
767 xInput =
mxSFI->openFileRead( aFileName );
780 source.aInputStream = xInput;
781 source.sSystemId = aFileName;
784 auto pLibArray = std::make_unique<::xmlscript::LibDescriptorArray> ( );
789 xParser->setDocumentHandler( ::xmlscript::importLibraryContainer( pLibArray.get() ) );
790 xParser->parseStream( source );
792 catch (
const xml::sax::SAXException& )
797 catch (
const io::IOException& )
803 sal_Int32 nLibCount = pLibArray->mnLibCount;
804 for( sal_Int32
i = 0 ;
i < nLibCount ;
i++ )
810 if( !bStorage && aStorageURL.isEmpty() && nPass == 0 )
812 OUString aLibraryPath;
826 if(
mxSFI->isFolder( aLibDirPath ) )
831 else if( rLib.
bLink )
838 if(
mxSFI->isFolder( aShareLibDirPath ) )
851 OUString aLibName = rLib.
aName;
855 if( nPass == 1 &&
hasByName( aLibName ) )
864 pImplLib =
static_cast< SfxLibrary*
>( xLib.get() );
869 pImplLib =
static_cast< SfxLibrary*
>( xLib.get() );
888 xLibraryStor = xLibrariesStor->openStorageElement( rLib.
aName,
891 catch(
const uno::Exception& )
893 #if OSL_DEBUG_LEVEL > 0
896 "couldn't open sub storage for library \"" << rLib.
aName <<
"\"");
902 if( !pImplLib->
mbInitialised && (!bStorage || xLibraryStor.is()) )
906 bLoaded && aLibName != rLib.
aName,
"basic",
907 (
"Different library names in library container and"
908 " library info files!"));
950 catch(
const uno::Exception& )
953 SAL_WARN(
"basic",
"Cannot access extensions!");
960 const OUString* pNames = aNames.getConstArray();
961 sal_Int32 nNameCount = aNames.getLength();
962 for( sal_Int32
i = 0 ;
i < nNameCount ;
i++ )
964 OUString
aName = pNames[
i ];
977 if (rInitialDocumentURL.isEmpty())
981 OUString aStandardStr(
"Standard");
985 INetURLObject aPrevUserBasicInetObj_2 = aPrevUserBasicInetObj_1;
986 aPrevUserBasicInetObj_1.
Append(
u"__basic_80" );
987 aPrevUserBasicInetObj_2.
Append(
u"__basic_80_2" );
990 bool bCleanUp =
false;
993 INetURLObject aPrevUserBasicInetObj = aPrevUserBasicInetObj_1;
995 if(
mxSFI->isFolder( aPrevFolder ) )
998 INetURLObject aUserBasicStandardInetObj( aUserBasicInetObj );
1001 INetURLObject aPrevUserBasicStandardInetObj( aPrevUserBasicInetObj );
1005 if(
mxSFI->isFolder( aPrevStandardFolder ) )
1007 OUString aXlbExtension(
"xlb" );
1008 OUString aCheckFileName;
1011 aCheckFileName =
"script";
1013 aPrevUserBasicStandardInetObj,
1014 aCheckFileName, aXlbExtension,
mxSFI );
1017 aCheckFileName =
"dialog";
1019 aPrevUserBasicStandardInetObj,
1020 aCheckFileName, aXlbExtension,
mxSFI );
1023 aCheckFileName =
"Module1";
1025 aPrevUserBasicStandardInetObj,
1026 aCheckFileName,
u"xba",
mxSFI );
1031 mxSFI->copy( aStandardFolder, aPrevStandardFolder );
1035 mxSFI->copy( aPrevFolder, aPrevCopyToFolder );
1039 aPrevUserBasicInetObj = aPrevUserBasicInetObj_2;
1042 if(
mxSFI->isFolder( aPrevFolder ) )
1050 aUserBasicTmpInetObj.
Append(
u"__basic_tmp" );
1053 mxSFI->move( aFolderUserBasic, aFolderTmp );
1056 mxSFI->move( aPrevFolder, aFolderUserBasic );
1063 mxSFI->kill( aFolderUserBasic );
1067 mxSFI->move( aFolderTmp, aFolderUserBasic );
1071 INetURLObject aPrevUserBasicLibInfoInetObj( aUserBasicInetObj );
1077 aInitSeq.getArray()[0] <<= aLibInfoFileName;
1079 pPrevCont->initialize( aInitSeq );
1083 mxSFI->move( aFolderUserBasic, aPrevFolder );
1084 mxSFI->move( aFolderTmp, aFolderUserBasic );
1087 const OUString* pNames = aNames.getConstArray();
1088 sal_Int32 nNameCount = aNames.getLength();
1090 for( sal_Int32
i = 0 ;
i < nNameCount ;
i++ )
1092 OUString aLibName = pNames[
i ];
1095 if( aLibName == aStandardStr )
1099 mxSFI->kill( aStandardFolder );
1107 SfxLibrary* pImplLib = pPrevCont->getImplLib( aLibName );
1111 bool bCreateLink =
true;
1112 if( aStorageURL.indexOf(
"vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ) != -1 ||
1113 aStorageURL.indexOf(
"vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ) != -1 ||
1114 aStorageURL.indexOf(
"vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ) != -1 ||
1115 aStorageURL.indexOf(
"$(INST)" ) != -1 )
1117 bCreateLink =
false;
1127 INetURLObject aUserBasicLibFolderInetObj( aUserBasicInetObj );
1128 aUserBasicLibFolderInetObj.
Append( aLibName );
1131 INetURLObject aPrevUserBasicLibFolderInetObj( aPrevUserBasicInetObj );
1132 aPrevUserBasicLibFolderInetObj.
Append( aLibName );
1135 if(
mxSFI->isFolder( aPrevLibFolder ) && !
mxSFI->isFolder( aLibFolder ) )
1137 mxSFI->move( aPrevLibFolder, aLibFolder );
1140 if( aLibName == aStandardStr )
1159 mxSFI->kill( aPrevFolder );
1172 INetURLObject aPrevUserBasicInetObj_Err( aUserBasicInetObj );
1174 aPrevUserBasicInetObj_Err.
Append(
u"__basic_80_err" );
1177 bool bSaved =
false;
1181 if(
mxSFI->isFolder( aPrevFolder_1 ) )
1183 mxSFI->move( aPrevFolder_1, aPrevFolder_Err );
1192 if( !bSaved &&
mxSFI->isFolder( aPrevFolder_2 ) )
1194 mxSFI->move( aPrevFolder_2, aPrevFolder_Err );
1198 mxSFI->kill( aPrevFolder_2 );
1207#if HAVE_FEATURE_EXTENSIONS
1210 bool bPureDialogLib =
false;
1214 if (aLibURL.isEmpty())
1221 sal_Int32 nLen = aLibURL.getLength();
1222 sal_Int32 indexLastSlash = aLibURL.lastIndexOf(
'/' );
1223 sal_Int32 nReduceCopy = 0;
1224 if( indexLastSlash == nLen - 1 )
1227 indexLastSlash = aLibURL.lastIndexOf(
'/', nLen - 1 );
1230 OUString aLibName = aLibURL.copy( indexLastSlash + 1, nLen - indexLastSlash - nReduceCopy - 1 );
1238 OUString aIndexFileURL = aLibURL;
1239 if( nReduceCopy == 0 )
1241 aIndexFileURL +=
"/";
1256 OUString& aLibInfoFileURL, OUString& aStorageURL,
1257 OUString& aUnexpandedStorageURL )
1259 OUString aExpandedSourceURL =
expand_url( aSourceURL );
1260 if( aExpandedSourceURL != aSourceURL )
1262 aUnexpandedStorageURL = aSourceURL;
1266 if( aExtension ==
"xlb" )
1269 aLibInfoFileURL = aExpandedSourceURL;
1276 aStorageURL = aExpandedSourceURL;
1287 aLibAny >>= xNameAccess;
1307 const css::uno::Reference< css::embed::XStorage >& ,
1310 const uno::Reference< task::XInteractionHandler >& )
1325 OUString aLibDirPath =
pLib->maStorageURL;
1326 if( aLibDirPath.isEmpty() )
1331 pLib->maStorageURL,
pLib->maUnexpandedStorageURL );
1332 aLibDirPath =
pLib->maStorageURL;
1335 if( !
mxSFI->isFolder( aLibDirPath ) )
1339 mxSFI->createFolder( aLibDirPath );
1350 std::u16string_view aName,
1360 std::u16string_view aName,
1361 const uno::Reference< embed::XStorage >& xStorage,
1362 std::u16string_view aTargetURL,
1366 bool bLink =
pLib->mbLink;
1367 bool bStorage = xStorage.is() && !bLink;
1370 sal_Int32 nNameCount = aElementNames.getLength();
1371 const OUString* pNames = aElementNames.getConstArray();
1375 for( sal_Int32 i = 0 ;
i < nNameCount ;
i++ )
1377 OUString aElementName = pNames[
i ];
1378 OUString aStreamName = aElementName +
".xml";
1384 "invalid library element \"" << aElementName <<
'"');
1389 uno::Reference< io::XStream > xElementStream = xStorage->openStreamElement(
1391 embed::ElementModes::READWRITE );
1394 uno::Reference< beans::XPropertySet > xProps( xElementStream, uno::UNO_QUERY );
1396 !xProps.is(),
"basic",
1397 "The StorageStream must implement XPropertySet interface!");
1402 xProps->setPropertyValue(
"MediaType",
uno::Any( OUString(
"text/xml" ) ) );
1405 xProps->setPropertyValue(
"UseCommonStoragePasswordEncryption",
uno::Any(
true ) );
1412 catch(
const uno::Exception& )
1414 SAL_WARN(
"basic",
"Problem during storing of library!");
1418 pLib->storeResourcesToStorage( xStorage );
1427 if( rToUseSFI.is() )
1431 OUString aLibDirPath;
1438 if( !xSFI->isFolder( aLibDirPath ) )
1440 xSFI->createFolder( aLibDirPath );
1442 pLib->storeResourcesToURL( aLibDirPath, xHandler );
1447 pLib->storeResources();
1450 for( sal_Int32 i = 0 ;
i < nNameCount ;
i++ )
1452 OUString aElementName = pNames[
i ];
1455 aElementInetObj.insertName( aElementName,
false,
1465 "invalid library element \"" << aElementName <<
'"');
1472 if( xSFI->exists( aElementPath ) )
1474 xSFI->kill( aElementPath );
1479 xOutput->closeOutput();
1481 catch(
const Exception& )
1492 catch(
const Exception& )
1503 const ::xmlscript::LibDescriptor& rLib,
1504 const uno::Reference< embed::XStorage >& xStorage )
1512 const ::xmlscript::LibDescriptor& rLib,
1513 const uno::Reference< embed::XStorage >& xStorage,
1514 std::u16string_view aTargetURL,
1520 bool bLink =
pLib->mbLink;
1521 bool bStorage = xStorage.is() && !bLink;
1524 uno::Reference< io::XOutputStream > xOut;
1525 uno::Reference< io::XStream > xInfoStream;
1532 xInfoStream = xStorage->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
1533 SAL_WARN_IF(!xInfoStream.is(),
"basic",
"No stream!");
1534 uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY );
1539 xProps->setPropertyValue(
"MediaType",
uno::Any( OUString(
"text/xml") ) );
1542 xProps->setPropertyValue(
"UseCommonStoragePasswordEncryption",
uno::Any(
true ) );
1544 xOut = xInfoStream->getOutputStream();
1547 catch(
const uno::Exception& )
1549 SAL_WARN(
"basic",
"Problem during storing of library index file!");
1558 if( rToUseSFI.is() )
1562 OUString aLibInfoPath;
1568 if( !xSFI->isFolder( aLibDirPath ) )
1570 xSFI->createFolder( aLibDirPath );
1573 aInetObj.setExtension( u
"xlb" );
1579 aLibInfoPath =
pLib->maLibInfoFileURL;
1584 if( xSFI->exists( aLibInfoPath ) )
1586 xSFI->kill( aLibInfoPath );
1588 xOut = xSFI->openFileWrite( aLibInfoPath );
1590 catch(
const Exception& )
1602 SAL_WARN(
"basic",
"couldn't open output stream");
1605 xWriter->setOutputStream( xOut );
1613 const OUString& aIndexFileName )
1617 bool bStorage =
false;
1620 bool bLink =
pLib->mbLink;
1621 bStorage = xStorage.is() && !bLink;
1626 OUString aLibInfoPath;
1635 xInput = xInfoStream->getInputStream();
1637 catch(
const uno::Exception& )
1648 aLibInfoPath =
pLib->maLibInfoFileURL;
1652 aLibInfoPath = aIndexFileName;
1656 xInput =
mxSFI->openFileRead( aLibInfoPath );
1674 source.aInputStream = xInput;
1675 source.sSystemId = aLibInfoPath;
1680 xParser->setDocumentHandler( ::xmlscript::importLibrary( rLib ) );
1681 xParser->parseStream( source );
1685 SAL_WARN(
"basic",
"Parsing error");
1695 pLib->mbLoaded =
false;
1698 pLib->maUnexpandedStorageURL );
1709 if(
pLib->mbInitialised )
1713 const OUString* pElementNames = rLib.
aElementNames.getConstArray();
1715 for( sal_Int32
i = 0 ;
i < nElementCount ;
i++ )
1717 pLib->maNameContainer->insertByName( pElementNames[
i], aDummyElement );
1722 pLib->implSetModified(
false );
1723 pLib->mbInitialised =
true;
1732 const sal_Int32 nNameCount = aNames.getLength();
1733 const OUString*
pName = aNames.getConstArray();
1734 const OUString* pNamesEnd = aNames.getConstArray() + nNameCount;
1737 sal_Int32 nLibsToSave = nNameCount;
1747 bool bStorage = i_rStorage.is();
1750 OUString sTempTargetStorName;
1751 const bool bInplaceStorage = bStorage && ( i_rStorage ==
mxStorage );
1753 if( nLibsToSave == 0 )
1765 if ( ( nLibsToSave == 1 ) && ( aNames[0] ==
"Standard" ) )
1769 aLibAny >>= xNameAccess;
1770 if ( ! xNameAccess->hasElements() )
1783 OUString sTargetLibrariesStoreName;
1784 if ( bInplaceStorage )
1787 const OUStringBuffer aTempTargetNameBase =
maLibrariesDir +
"_temp_";
1788 sal_Int32
index = 0;
1791 sTargetLibrariesStoreName = aTempTargetNameBase + OUString::number(
index++ );
1792 if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) )
1798 sTempTargetStorName = sTargetLibrariesStoreName;
1803 if ( i_rStorage->hasByName( sTargetLibrariesStoreName ) )
1805 i_rStorage->removeElement( sTargetLibrariesStoreName );
1809 xTargetLibrariesStor.set( i_rStorage->openStorageElement( sTargetLibrariesStoreName, embed::ElementModes::READWRITE ), UNO_SET_THROW );
1811 catch(
const uno::Exception& )
1826 catch(
const uno::Exception& )
1834 pName = aNames.getConstArray();
1836 auto pLibArray = std::make_unique< ::xmlscript::LibDescriptorArray > ( nLibsToSave );
1846 aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray];
1847 if( !bExtensionLib )
1854 if( !bStorage || pImplLib->
mbLink )
1884 && xSourceLibrariesStor.is() ;
1889 (void)xSourceLibrariesStor->isStorageElement(rLib.
aName);
1891 catch (container::NoSuchElementException
const&)
1893 isCopyStorage =
false;
1900 xSourceLibrariesStor->copyElementTo( rLib.
aName, xTargetLibrariesStor, rLib.
aName );
1902 catch(
const uno::Exception& )
1913#if OSL_DEBUG_LEVEL > 0
1917 xLibraryStor = xTargetLibrariesStor->openStorageElement(
1919 embed::ElementModes::READWRITE );
1920#if OSL_DEBUG_LEVEL > 0
1922 catch(
const uno::Exception& )
1926 "couldn't create sub storage for library \"" << rLib.
aName <<
"\"");
1952 xTransact->commit();
1954 catch(
const uno::Exception& )
1972 if ( bInplaceStorage && !sTempTargetStorName.isEmpty() )
1975 !xSourceLibrariesStor.is(),
"basic",
1976 (
"SfxLibrariesContainer::storeLibraries_impl: unexpected: we should"
1977 " have a source storage here!"));
1987 if ( xSourceLibrariesStor.is() )
1991 for (
auto const & removeName : aRemoveNames )
1993 xSourceLibrariesStor->removeElement( removeName );
1998 for (
auto const & copyName : aCopyNames )
2000 xTargetLibrariesStor->copyElementTo( copyName, xSourceLibrariesStor, copyName );
2005 xTargetLibrariesStor->dispose();
2006 i_rStorage->removeElement( sTempTargetStorName );
2007 xTargetLibrariesStor.clear();
2008 sTempTargetStorName.clear();
2011 xTargetLibrariesStor = xSourceLibrariesStor;
2012 xSourceLibrariesStor.clear();
2041 xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
2043 xProps->setPropertyValue(
"MediaType",
uno::Any( OUString(
"text/xml" ) ) );
2046 xProps->setPropertyValue(
"UseCommonStoragePasswordEncryption",
uno::Any(
true ) );
2048 xOut = xInfoStream->getOutputStream();
2050 catch(
const uno::Exception& )
2065 if(
mxSFI->exists( aLibInfoPath ) )
2067 mxSFI->kill( aLibInfoPath );
2069 xOut =
mxSFI->openFileWrite( aLibInfoPath );
2081 SAL_WARN(
"basic",
"couldn't open output stream");
2085 xWriter->setOutputStream( xOut );
2093 xTransact->commit();
2096 catch(
const uno::Exception& )
2098 SAL_WARN(
"basic",
"Problem during storing of libraries!");
2147 checkStorageURL(pNewLib->maUnexpandedStorageURL, pNewLib->maLibInfoFileURL,
2148 pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL);
2152 aElement <<= xNameAccess;
2160 (
const OUString& Name,
const OUString& StorageURL,
sal_Bool ReadOnly )
2168 OUString aLibInfoFileURL;
2169 OUString aLibDirURL;
2170 OUString aUnexpandedStorageURL;
2171 checkStorageURL( StorageURL, aLibInfoFileURL, aLibDirURL, aUnexpandedStorageURL );
2176 pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
2177 pNewLib->maOriginalStorageURL = StorageURL;
2190 if( StorageURL.indexOf(
"vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ) != -1 )
2192 pNewLib->mbExtension =
true;
2194 else if( StorageURL.indexOf(
"vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ) != -1
2195 || StorageURL.indexOf(
"vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ) != -1 )
2197 pNewLib->mbExtension =
true;
2198 pNewLib->mbReadOnly =
true;
2210 aLibAny >>= xNameAccess;
2214 throw IllegalArgumentException(
"readonly && !link", getXWeak(), 1);
2228 if( xNameAccess->hasElements() )
2231 sal_Int32 nNameCount = aNames.getLength();
2232 const OUString* pNames = aNames.getConstArray();
2233 for( sal_Int32
i = 0 ;
i < nNameCount ; ++
i, ++pNames )
2244 if(
mxSFI->exists( aLibInfoPath ) )
2246 mxSFI->kill( aLibInfoPath );
2259 if(
mxSFI->isFolder( aLibDirPath ) )
2262 sal_Int32
nCount = aContentSeq.getLength();
2265 mxSFI->kill( aLibDirPath );
2288 aLibAny >>= xNameAccess;
2293 if( bLoaded || !xNameAccess->hasElements() )
2302 bool bLink = pImplLib->
mbLink;
2303 bool bStorage =
mxStorage.is() && !bLink;
2309#if OSL_DEBUG_LEVEL > 0
2315 !xLibrariesStor.is(),
"basic",
2316 (
"The method must either throw exception or return a"
2318 if ( !xLibrariesStor.is() )
2320 throw uno::RuntimeException(
"null returned from openStorageElement",getXWeak());
2325 !xLibraryStor.is(),
"basic",
2326 (
"The method must either throw exception or return a"
2328 if ( !xLibrariesStor.is() )
2330 throw uno::RuntimeException(
"null returned from openStorageElement",getXWeak());
2332#if OSL_DEBUG_LEVEL > 0
2334 catch(
const uno::Exception& )
2338 "couldn't open sub storage for library \"" <<
Name <<
"\"");
2345 sal_Int32 nNameCount = aNames.getLength();
2346 const OUString* pNames = aNames.getConstArray();
2347 for( sal_Int32
i = 0 ;
i < nNameCount ;
i++ )
2349 OUString aElementName = pNames[
i ];
2358 aFile = aElementName +
".xml";
2364 catch(
const uno::Exception& )
2367 if( !xElementStream.is() )
2375 catch(
const uno::Exception& )
2379 if ( xElementStream.is() )
2381 xInStream = xElementStream->getInputStream();
2383 if ( !xInStream.is() )
2387 "couldn't open library element stream - attempted to"
2388 " open library \"" <<
Name <<
'"');
2396 aElementInetObj.
insertName( aElementName,
false,
2406 if( pImplLib->
hasByName( aElementName ) )
2408 if( aAny.hasValue() )
2426 bool bRet = pImplLib->
mbLink;
2434 bool bLink = pImplLib->
mbLink;
2437 throw IllegalArgumentException(
"!link", getXWeak(), 1);
2479 throw ElementExistException();
2486 aLibAny >>= xNameAccess;
2495 bool bMovedSuccessful =
true;
2499 if( !bStorage && !pImplLib->
mbLink )
2501 bMovedSuccessful =
false;
2507 if (aLibDirPath.isEmpty())
2525 if(
mxSFI->isFolder( aLibDirPath ) )
2527 if( !
mxSFI->isFolder( aDestDirPath ) )
2529 mxSFI->createFolder( aDestDirPath );
2545 sal_Int32 nNameCount = aElementNames.getLength();
2546 const OUString* pNames = aElementNames.getConstArray();
2547 for( sal_Int32
i = 0 ;
i < nNameCount ;
i++ )
2549 OUString aElementName = pNames[
i ];
2552 aElementInetObj.
insertName( aElementName,
false,
2558 aElementDestInetObj.
insertName( aElementName,
false,
2566 if(
mxSFI->exists( aDestElementPath ) )
2568 mxSFI->kill( aDestElementPath );
2570 mxSFI->move( aElementPath, aDestElementPath );
2580 sal_Int32
nCount = aContentSeq.getLength();
2583 mxSFI->kill( aLibDirPath );
2586 bMovedSuccessful =
true;
2598 if( bStorage && !pImplLib->
mbLink )
2602 if( bMovedSuccessful )
2613 sal_Int32 nArgCount = _rArguments.getLength();
2614 if ( nArgCount != 1 )
2615 throw IllegalArgumentException(
"too many args", getXWeak(), -1);
2617 OUString sInitialDocumentURL;
2619 if ( _rArguments[0] >>= sInitialDocumentURL )
2621 init( sInitialDocumentURL,
nullptr );
2625 if ( _rArguments[0] >>= xDocument )
2630 throw IllegalArgumentException(
"arg1 unknown type", getXWeak(), 1);
2641 if ( xSI->supportsService(
"com.sun.star.document.OfficeDocument"))
2643 xDocStorage.set( _rxDocument->getDocumentStorage(), UNO_SET_THROW );
2653 if ( !xDocStorage.is() )
2655 throw IllegalArgumentException(
"no doc storage", getXWeak(), 1);
2657 init( OUString(), xDocStorage );
2663#if OSL_DEBUG_LEVEL > 0
2666 xDocument != _rSource.Source || !xDocument.is(),
"basic",
2667 "SfxLibraryContainer::_disposing: where does this come from?");
2692 throw IllegalArgumentException();
2697 throw IllegalArgumentException();
2702 throw IllegalArgumentException();
2729 xToUseSFI = ucb::SimpleFileAccess::create(
mxContext );
2730 xToUseSFI->setInteractionHandler( Handler );
2747 aLibDesc.
bLink =
false;
2758 if (url.startsWithIgnoreAsciiCase(
"vnd.sun.star.expand:" ))
2778 bool bLink = pImplLib->
mbLink;
2781 throw IllegalArgumentException(
"!link", getXWeak(), 1);
2805 OUString aLibName = pBasMgr->
GetName();
2806 if ( aLibName.isEmpty())
2808 aLibName =
"Standard";
2812 pBasic->SetVBAEnabled( _vbacompatmodeon );
2825 xFactory->createInstance(
"ooo.vba.VBAGlobals");
2866 switch( nIdentifier )
2868 case vba::VBAScriptEventId::SCRIPT_STARTED:
2871 case vba::VBAScriptEventId::SCRIPT_STOPPED:
2892 throw UnknownPropertyException(aPropertyName, getXWeak());
2900 throw UnknownPropertyException(aPropertyName, getXWeak());
2906 throw NoSupportException();
2912 throw NoSupportException();
2918 throw NoSupportException();
2924 throw NoSupportException();
2939 , mrModifiable( _rModifiable )
2942 , mbIsModified( true )
2943 , mbInitialised( false )
2945 , mbReadOnly( false )
2946 , mbReadOnlyLink( false )
2947 , mbPreload( false )
2948 , mbPasswordProtected( false )
2949 , mbPasswordVerified( false )
2950 , mbDoc50Password( false )
2951 , mbSharedIndexFile( false )
2952 , mbExtension( false )
2958 OUString aLibInfoFileURL, OUString aStorageURL,
bool ReadOnly )
2960 , mrModifiable( _rModifiable )
2963 , mbIsModified( true )
2964 , mbInitialised( false )
2965 , maLibInfoFileURL(
std::move( aLibInfoFileURL ))
2966 , maStorageURL(
std::move( aStorageURL ))
2968 , mbReadOnly( false )
2970 , mbPreload( false )
2971 , mbPasswordProtected( false )
2972 , mbPasswordVerified( false )
2973 , mbDoc50Password( false )
2974 , mbSharedIndexFile( false )
2975 , mbExtension( false )
3001 ::cppu::queryInterface(
3003 static_cast< XContainer *
>(
this ),
3004 static_cast< XNameContainer *
>(
this ),
3005 static_cast< XNameAccess *
>(
this ),
3006 static_cast< XElementAccess *
>(
this ),
3007 static_cast< XChangesNotifier *
>(
this ) );
3008 if( !aRet.hasValue() )
3010 aRet = WeakComponentImplHelper::queryInterface( rType );
3051 throw IllegalArgumentException(
3052 "Library is readonly.",
3063 throw WrappedTargetException(
3066 Any( LibraryNotLoadedException(
3082 "SfxLibrary::replaceByName: replacing element is invalid!");
3097 "SfxLibrary::insertByName: to-be-inserted element is invalid!");
3113 aElementInetObj.
insertName( _rElementName,
false,
3121 if(
mxSFI->exists( aFile ) )
3123 mxSFI->kill( aFile );
3146 WeakComponentImplHelper::getTypes() );
3148 return ourTypes_NameContainer.
getTypes();
3154 return css::uno::Sequence<sal_Int8>();
3189 , m_eState( USER_EXTENSIONS )
3190 , m_bUserPackagesLoaded( false )
3191 , m_bSharedPackagesLoaded( false )
3192 , m_bBundledPackagesLoaded( false )
3193 , m_iUserPackage( 0 )
3194 , m_iSharedPackage( 0 )
3195 , m_iBundledPackage( 0 )
3196 , m_pScriptSubPackageIterator( nullptr )
3211 if( !xScriptPackage.is() )
3215 aRetLib = xScriptPackage->getURL();
3223 if( !xScriptPackage.is() )
3227 aRetLib = xScriptPackage->getURL();
3234 if( !xScriptPackage.is() )
3238 aRetLib = xScriptPackage->getURL();
3244 (
"ScriptExtensionIterator::nextBasicOrDialogLibrary():"
3245 " Invalid case END_REACHED"));
3254 : m_xMainPackage( xMainPackage )
3255 , m_bIsValid( false )
3256 , m_bIsBundle( false )
3257 , m_nSubPkgCount( 0 )
3258 , m_iNextSubPkg( 0 )
3267 bool bRegistered =
false;
3270 beans::Ambiguous<sal_Bool>
const & reg =
option.Value;
3271 if( !reg.IsAmbiguous && reg.Value )
3291 rbPureDialogLib =
false;
3296 return xScriptPackage;
3306 if( xScriptPackage.is() )
3319 return xScriptPackage;
3323 bool& rbPureDialogLib )
3330 OUString aMediaType = xPackageTypeInfo->getMediaType();
3333 xScriptPackage = rPackage;
3337 rbPureDialogLib =
true;
3338 xScriptPackage = rPackage;
3342 return xScriptPackage;
3358 catch(
const css::uno::DeploymentException& )
3362 return xScriptPackage;
3379 !xPackage.is(),
"basic",
3380 (
"ScriptExtensionIterator::implGetNextUserScriptPackage():"
3381 " Invalid package"));
3386 if( !xScriptPackage.is() )
3394 return xScriptPackage;
3410 catch(
const css::uno::DeploymentException& )
3413 return xScriptPackage;
3430 !xPackage.is(),
"basic",
3431 (
"ScriptExtensionIterator::implGetNextSharedScriptPackage():"
3432 " Invalid package"));
3437 if( !xScriptPackage.is() )
3445 return xScriptPackage;
3461 catch(
const css::uno::DeploymentException& )
3464 return xScriptPackage;
3481 !xPackage.is(),
"basic",
3482 (
"ScriptExtensionIterator::implGetNextBundledScriptPackage():"
3483 " Invalid package"));
3488 if( !xScriptPackage.is() )
3496 return xScriptPackage;
Reference< XComponentContext > m_xContext
static comphelper::SolarMutex & GetSolarMutex()
StarBASIC * GetLib(sal_uInt16 nLib) const
void SetName(const OUString &rName)
const OUString & GetName() const
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString getExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
bool insertName(std::u16string_view rTheName, bool bAppendFinalSlash=false, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool setExtension(std::u16string_view rTheExtension, sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool IsOLEStorage() const
const OUString & GetBasicPath() const
static BasicManager * getDocumentBasicManager(const css::uno::Reference< css::frame::XModel > &_rxDocumentModel)
returns the BasicManager belonging to the given document
void setModified(bool _bModified)
::comphelper::OInterfaceContainerHelper3< css::util::XModifyListener > m_aModifyListeners
void addModifyListener(const css::uno::Reference< css::util::XModifyListener > &_rxListener)
::cppu::OWeakObject & m_rEventSource
void removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &_rxListener)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
css::uno::XInterface * mpxEventSource
void insertCheck(const OUString &aName, const css::uno::Any &aElement)
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
std::vector< css::uno::Any > mValues
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
NameContainerNameMap mHashMap
::comphelper::OInterfaceContainerHelper3< css::container::XContainerListener > maContainerListeners
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
virtual void SAL_CALL addChangesListener(const css::uno::Reference< css::util::XChangesListener > &xListener) override
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
::comphelper::OInterfaceContainerHelper3< css::util::XChangesListener > maChangesListeners
virtual void SAL_CALL removeChangesListener(const css::uno::Reference< css::util::XChangesListener > &xListener) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL removeByName(const OUString &Name) override
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
void insertNoCheck(const OUString &aName, const css::uno::Any &aElement)
virtual css::uno::Type SAL_CALL getElementType() override
std::vector< OUString > mNames
css::uno::Reference< css::deployment::XPackage > implGetNextBundledScriptPackage(bool &rbPureDialogLib)
ScriptSubPackageIterator * m_pScriptSubPackageIterator
css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aSharedPackagesSeq
OUString nextBasicOrDialogLibrary(bool &rbPureDialogLib)
css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aBundledPackagesSeq
css::uno::Reference< css::uno::XComponentContext > m_xContext
ScriptExtensionIterator()
enum basic::ScriptExtensionIterator::IteratorState m_eState
css::uno::Reference< css::deployment::XPackage > implGetNextSharedScriptPackage(bool &rbPureDialogLib)
css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aUserPackagesSeq
bool m_bBundledPackagesLoaded
css::uno::Reference< css::deployment::XPackage > implGetNextUserScriptPackage(bool &rbPureDialogLib)
bool m_bUserPackagesLoaded
bool m_bSharedPackagesLoaded
static css::uno::Reference< css::deployment::XPackage > implDetectScriptPackage(const css::uno::Reference< css::deployment::XPackage > &rPackage, bool &rbPureDialogLib)
css::uno::Reference< css::deployment::XPackage > getNextScriptSubPackage(bool &rbPureDialogLib)
css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aSubPkgSeq
ScriptSubPackageIterator(css::uno::Reference< css::deployment::XPackage > const &xMainPackage)
css::uno::Reference< css::deployment::XPackage > m_xMainPackage
virtual void SAL_CALL setVBACompatibilityMode(sal_Bool _vbacompatmodeon) override
virtual sal_Bool SAL_CALL isLibraryPasswordProtected(const OUString &Name) override
virtual void writeLibraryElement(const css::uno::Reference< css::container::XNameContainer > &xLibrary, const OUString &aElementName, const css::uno::Reference< css::io::XOutputStream > &xOutput)=0
virtual css::uno::Any createEmptyLibraryElement()=0
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
rtl_TextEncoding meVBATextEncoding
virtual bool implStorePasswordLibrary(SfxLibrary *pLib, const OUString &aName, const css::uno::Reference< css::embed::XStorage > &xStorage, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
enum basic::SfxLibraryContainer::InitMode meInitMode
bool implLoadLibraryIndexFile(SfxLibrary *pLib, ::xmlscript::LibDescriptor &rLib, const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &aIndexFileName)
virtual rtl::Reference< SfxLibraryContainer > createInstanceImpl()=0
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL createLibrary(const OUString &Name) override
virtual sal_Bool SAL_CALL isLibraryLink(const OUString &Name) override
virtual void SAL_CALL removeLibrary(const OUString &Name) override
virtual sal_Bool SAL_CALL verifyLibraryPassword(const OUString &Name, const OUString &Password) override
OUString maLibElementFileExtension
static void leaveMethod()
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
void implImportLibDescriptor(SfxLibrary *pLib, ::xmlscript::LibDescriptor const &rLib)
virtual css::uno::Type SAL_CALL getElementType() override
virtual sal_Bool SAL_CALL isModified() override
OUString createAppLibraryFolder(SfxLibrary *pLib, std::u16string_view aName)
virtual void SAL_CALL setLibraryReadOnly(const OUString &Name, sal_Bool bReadOnly) override
virtual css::uno::Any SAL_CALL getRootLocation() override
virtual sal_Int32 SAL_CALL getRunningVBAScripts() override
sal_Int32 mnRunningVBAScripts
virtual bool implLoadPasswordLibrary(SfxLibrary *pLib, const OUString &Name, bool bVerifyPasswordOnly=false)
virtual void SAL_CALL exportLibrary(const OUString &Name, const OUString &URL, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual void importFromOldStorage(const OUString &aFile)=0
virtual OUString getInfoFileName() const =0
OUString expand_url(const OUString &url)
virtual ~SfxLibraryContainer() override
virtual void SAL_CALL setRootStorage(const css::uno::Reference< css::embed::XStorage > &_rootstorage) override
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual void SAL_CALL addVBAScriptListener(const css::uno::Reference< css::script::vba::XVBAScriptListener > &Listener) override
virtual OUString SAL_CALL getContainerLocationName() override
virtual void SAL_CALL changeLibraryPassword(const OUString &Name, const OUString &OldPassword, const OUString &NewPassword) override
OUString maOldInfoFileName
virtual css::uno::Any importLibraryElement(const css::uno::Reference< css::container::XNameContainer > &xLibrary, const OUString &aElementName, const OUString &aFile, const css::uno::Reference< css::io::XInputStream > &xElementStream)=0
virtual void SAL_CALL disposing() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL renameLibrary(const OUString &Name, const OUString &NewName) override
virtual void SAL_CALL removeVBAScriptListener(const css::uno::Reference< css::script::vba::XVBAScriptListener > &Listener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual sal_Bool SAL_CALL hasElements() override
virtual OUString getLibrariesDir() const =0
virtual bool isLibraryElementValid(const css::uno::Any &rElement) const =0
void init_Impl(const OUString &rInitialDocumentURL, const css::uno::Reference< css::embed::XStorage > &_rxInitialStorage)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void onNewRootStorage()=0
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
void init(const OUString &rInitialDocumentURL, const css::uno::Reference< css::embed::XStorage > &_rxInitialStorage)
virtual void SAL_CALL loadLibrary(const OUString &Name) override
void implStoreLibraryIndexFile(SfxLibrary *pLib, const ::xmlscript::LibDescriptor &rLib, const css::uno::Reference< css::embed::XStorage > &xStorage)
static constexpr OUStringLiteral sVBATextEncodingPropName
css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI
css::uno::Reference< css::embed::XStorage > mxStorage
virtual sal_Bool SAL_CALL getVBACompatibilityMode() override
void implStoreLibrary(SfxLibrary *pLib, std::u16string_view rName, const css::uno::Reference< css::embed::XStorage > &rStorage)
virtual void SAL_CALL setProjectName(const OUString &_projectname) override
virtual OUString SAL_CALL getOriginalLibraryLinkURL(const OUString &Name) override
virtual sal_Bool SAL_CALL isLibraryReadOnly(const OUString &Name) override
virtual void SAL_CALL setModified(sal_Bool bModified) override
VBAScriptListenerContainer maVBAScriptListeners
ModifiableHelper maModifiable
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual void SAL_CALL broadcastVBAScriptEvent(sal_Int32 nIdentifier, const OUString &rModuleName) override
virtual rtl::Reference< SfxLibrary > implCreateLibrary(const OUString &aName)=0
virtual sal_Bool SAL_CALL isLibraryPasswordVerified(const OUString &Name) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void initializeFromDocument(const css::uno::Reference< css::document::XStorageBasedDocument > &_rxDocument)
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
BasicManager * getBasicManager()
void storeLibraries_Impl(const css::uno::Reference< css::embed::XStorage > &xStorage, bool bComplete)
void checkStorageURL(const OUString &aSourceURL, OUString &aLibInfoFileURL, OUString &aStorageURL, OUString &aUnexpandedStorageURL)
virtual void SAL_CALL storeLibrariesToStorage(const css::uno::Reference< css::embed::XStorage > &RootStorage) override
css::uno::Reference< css::util::XStringSubstitution > mxStringSubstitution
void implScanExtensions()
virtual OUString getOldInfoFileName() const =0
OUString maInitialDocumentURL
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual OUString getLibElementFileExtension() const =0
SfxLibrary * getImplLib(const OUString &rLibraryName)
virtual rtl::Reference< SfxLibrary > implCreateLibraryLink(const OUString &aName, const OUString &aLibInfoFileURL, const OUString &StorageURL, bool ReadOnly)=0
virtual void SAL_CALL storeLibraries() override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL createLibraryLink(const OUString &Name, const OUString &StorageURL, sal_Bool ReadOnly) override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual void _disposing(const css::lang::EventObject &_rSource) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
css::uno::WeakReference< css::frame::XModel > mxOwnerDocument
virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getRootStorage() override
virtual sal_Bool SAL_CALL isLibraryLoaded(const OUString &Name) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
rtl::Reference< NameContainer > maNameContainer
virtual OUString SAL_CALL getLibraryLinkURL(const OUString &Name) override
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
virtual void SAL_CALL removeByName(const OUString &Name) override
void impl_checkReadOnly()
checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
virtual sal_Bool SAL_CALL hasElements() override
bool implIsModified() const
OUString maLibInfoFileURL
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual void SAL_CALL removeChangesListener(const css::uno::Reference< css::util::XChangesListener > &xListener) override
virtual bool isLoadedStorable()
void impl_checkLoaded()
checks whether the library is loaded, throws a LibraryNotLoadedException (wrapped in a WrappedTargetE...
virtual bool isModified()=0
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
rtl::Reference< NameContainer > maNameContainer
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual css::uno::Type SAL_CALL getElementType() override
OUString maOriginalStorageURL
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
SfxLibrary(ModifiableHelper &_rModifiable, const css::uno::Type &aType, const css::uno::Reference< css::ucb::XSimpleFileAccess3 > &xSFI)
OUString maLibElementFileExtension
void implSetModified(bool _bIsModified)
void impl_removeWithoutChecks(const OUString &_rElementName)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual void SAL_CALL addChangesListener(const css::uno::Reference< css::util::XChangesListener > &xListener) override
OUString maUnexpandedStorageURL
virtual void storeResourcesAsURL(const OUString &URL, const OUString &NewName)=0
css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
ModifiableHelper & mrModifiable
virtual bool isLibraryElementValid(const css::uno::Any &rElement) const =0
void removeElementWithoutChecks(const OUString &_rElementName, LibraryContainerAccess)
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 getLength() const
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
static css::uno::Reference< css::embed::XStorage > GetStorageFromURL(const OUString &aURL, sal_Int32 nStorageMode, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
sal_uInt32 release(bool bUnlockAll=false)
void acquire(sal_uInt32 nLockCount=1)
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
void stopAllComponentListening()
void startComponentListening(const css::uno::Reference< css::lang::XComponent > &_rxComp)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
#define ERRCODE_IO_GENERAL
Reference< XSingleServiceFactory > xFactory
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral sDialogLibMediaType
static void checkAndCopyFileImpl(const INetURLObject &rSourceFolderInetObj, const INetURLObject &rTargetFolderInetObj, std::u16string_view rCheckFileName, std::u16string_view rCheckExtension, const Reference< XSimpleFileAccess3 > &xSFI)
static void createVariableURL(OUString &rStr, std::u16string_view rLibName, std::u16string_view rInfoFileName, bool bUser)
static bool GbMigrationSuppressErrors
::cppu::WeakComponentImplHelper< css::lang::XInitialization, css::script::XStorageBasedLibraryContainer, css::script::XLibraryContainerPassword, css::script::XLibraryContainerExport, css::script::XLibraryContainer3, css::container::XContainer, css::script::XLibraryQueryExecutable, css::script::vba::XVBACompatibility, css::lang::XServiceInfo, css::beans::XPropertySet > SfxLibraryContainer_BASE
constexpr OUStringLiteral sBasicLibMediaType
COMPHELPER_DLLPUBLIC OUString getExpandedUri(css::uno::Reference< css::uno::XComponentContext > const &context, OUString const &uri)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void exportLibraryContainer(Reference< xml::sax::XWriter > const &xOut, const LibDescriptorArray *pLibArray)
void exportLibrary(css::uno::Reference< css::xml::sax::XWriter > const &xOut, const LibDescriptor &rLib)
#define ERRCTX_SFX_LOADBASIC
#define ERRCTX_SFX_SAVEDOC
css::uno::Sequence< OUString > aElementNames
Reference< XModel > xModel