summaryrefslogtreecommitdiff
path: root/basic/source/uno/namecont.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/uno/namecont.cxx')
-rw-r--r--basic/source/uno/namecont.cxx202
1 files changed, 137 insertions, 65 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index b92f5a590617..430cab8b3264 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -25,11 +25,14 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/ucb/ContentCreationException.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <utility>
#include <vcl/svapp.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/mutex.hxx>
#include <vcl/errinf.hxx>
#include <rtl/ustring.hxx>
@@ -41,7 +44,7 @@
#include <namecont.hxx>
#include <basic/basicmanagerrepository.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include <unotools/pathoptions.hxx>
#include <svtools/sfxecode.hxx>
@@ -141,7 +144,7 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
const Type& aAnyType = aElement.getValueType();
if( mType != aAnyType )
{
- throw IllegalArgumentException("types do not match", static_cast<cppu::OWeakObject*>(this), 2);
+ throw IllegalArgumentException("types do not match", getXWeak(), 2);
}
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
if( aIt == mHashMap.end() )
@@ -192,7 +195,7 @@ void NameContainer::insertNoCheck(const OUString& aName, const Any& aElement)
const Type& aAnyType = aElement.getValueType();
if( mType != aAnyType )
{
- throw IllegalArgumentException("types do not match", static_cast<cppu::OWeakObject*>(this), 2);
+ throw IllegalArgumentException("types do not match", getXWeak(), 2);
}
sal_Int32 nCount = mNames.size();
@@ -285,7 +288,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi
{
if( !xListener.is() )
{
- throw RuntimeException("addContainerListener called with null xListener",static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("addContainerListener called with null xListener",getXWeak());
}
maContainerListeners.addInterface( xListener );
}
@@ -294,7 +297,7 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine
{
if( !xListener.is() )
{
- throw RuntimeException("removeContainerListener called with null xListener",static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("removeContainerListener called with null xListener",getXWeak());
}
maContainerListeners.removeInterface( xListener );
}
@@ -304,7 +307,7 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen
{
if( !xListener.is() )
{
- throw RuntimeException("addChangesListener called with null xListener",static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("addChangesListener called with null xListener",getXWeak());
}
maChangesListeners.addInterface( xListener );
}
@@ -313,7 +316,7 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis
{
if( !xListener.is() )
{
- throw RuntimeException("removeChangesListener called with null xListener",static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("removeChangesListener called with null xListener",getXWeak());
}
maChangesListeners.removeInterface( xListener );
}
@@ -344,6 +347,7 @@ SfxLibraryContainer::SfxLibraryContainer()
, maVBAScriptListeners( m_aMutex )
, mnRunningVBAScripts( 0 )
, mbVBACompat( false )
+ , meVBATextEncoding( RTL_TEXTENCODING_DONTKNOW )
, maModifiable( *this, m_aMutex )
, maNameContainer( new NameContainer(cppu::UnoType<XNameAccess>::get()) )
, mbOldInfoFormat( false )
@@ -418,7 +422,7 @@ void SAL_CALL SfxLibraryContainer::setRootStorage( const Reference< XStorage >&
LibraryContainerMethodGuard aGuard( *this );
if ( !_rxRootStorage.is() )
{
- throw IllegalArgumentException("no root storage", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("no root storage", getXWeak(), 1);
}
mxStorage = _rxRootStorage;
onNewRootStorage();
@@ -429,7 +433,7 @@ void SAL_CALL SfxLibraryContainer::storeLibrariesToStorage( const Reference< XSt
LibraryContainerMethodGuard aGuard( *this );
if ( !_rxRootStorage.is() )
{
- throw IllegalArgumentException("no root storage", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("no root storage", getXWeak(), 1);
}
try
{
@@ -533,7 +537,9 @@ void SAL_CALL SfxLibraryContainer::storeLibraries( )
}
}
-static void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj,
+namespace
+{
+void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj,
const INetURLObject& rTargetFolderInetObj,
std::u16string_view rCheckFileName,
std::u16string_view rCheckExtension,
@@ -555,19 +561,23 @@ static void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj,
}
}
-static void createVariableURL( OUString& rStr, std::u16string_view rLibName,
+constexpr OUString sUserBasicVariablePrefix = u"$(USER)/basic/"_ustr;
+constexpr OUString sInstBasicVariablePrefix = u"$(INST)/" LIBO_SHARE_FOLDER "/basic/"_ustr;
+
+void createVariableURL( OUString& rStr, std::u16string_view rLibName,
std::u16string_view rInfoFileName, bool bUser )
{
if( bUser )
{
- rStr = "$(USER)/basic/";
+ rStr = sUserBasicVariablePrefix;
}
else
{
- rStr = "$(INST)/" LIBO_SHARE_FOLDER "/basic/";
+ rStr = sInstBasicVariablePrefix;
}
rStr += OUString::Concat(rLibName) + "/" + rInfoFileName + ".xlb/";
}
+}
void SfxLibraryContainer::init( const OUString& rInitialDocumentURL, const uno::Reference< embed::XStorage >& rxInitialStorage )
{
@@ -585,10 +595,10 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
uno::Reference< embed::XStorage > xStorage = rxInitialStorage;
maInitialDocumentURL = rInitialDocumentURL;
- maInfoFileName = OUString::createFromAscii( getInfoFileName() );
- maOldInfoFileName = OUString::createFromAscii( getOldInfoFileName() );
- maLibElementFileExtension = OUString::createFromAscii( getLibElementFileExtension() );
- maLibrariesDir = OUString::createFromAscii( getLibrariesDir() );
+ maInfoFileName = getInfoFileName();
+ maOldInfoFileName = getOldInfoFileName();
+ maLibElementFileExtension = getLibElementFileExtension();
+ maLibrariesDir = getLibrariesDir();
meInitMode = DEFAULT;
INetURLObject aInitUrlInetObj( maInitialDocumentURL );
@@ -646,8 +656,6 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
maLibraryPath = SvtPathOptions().GetBasicPath();
}
- Reference< XParser > xParser = xml::sax::Parser::create(mxContext);
-
uno::Reference< io::XInputStream > xInput;
mxStorage = xStorage;
@@ -731,11 +739,11 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
{
if( nPass == 1 )
{
- pLibInfoInetObj.reset(new INetURLObject( maLibraryPath.getToken(0, ';') ));
+ pLibInfoInetObj.reset(new INetURLObject( o3tl::getToken(maLibraryPath, 0, ';') ));
}
else
{
- pLibInfoInetObj.reset(new INetURLObject( maLibraryPath.getToken(1, ';') ));
+ pLibInfoInetObj.reset(new INetURLObject( o3tl::getToken(maLibraryPath, 1, ';') ));
}
pLibInfoInetObj->insertName( maInfoFileName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All );
pLibInfoInetObj->setExtension( u"xlc" );
@@ -755,7 +763,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// Old variant?
if( !xInput.is() && nPass == 0 )
{
- INetURLObject aLibInfoInetObj( maLibraryPath.getToken(1, ';') );
+ INetURLObject aLibInfoInetObj( o3tl::getToken(maLibraryPath, 1, ';') );
aLibInfoInetObj.insertName( maOldInfoFileName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All );
aLibInfoInetObj.setExtension( u"xli" );
aFileName = aLibInfoInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
@@ -781,6 +789,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// start parsing
auto pLibArray = std::make_unique<::xmlscript::LibDescriptorArray> ( );
+ Reference< XParser > xParser = xml::sax::Parser::create(mxContext);
try
{
xParser->setDocumentHandler( ::xmlscript::importLibraryContainer( pLibArray.get() ) );
@@ -828,7 +837,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
else if( rLib.bLink )
{
// Check "share" path
- INetURLObject aShareInetObj( maLibraryPath.getToken(0, ';') );
+ INetURLObject aShareInetObj( o3tl::getToken(maLibraryPath, 0, ';') );
aShareInetObj.insertName( rLib.aName, true, INetURLObject::LAST_SEGMENT,
INetURLObject::EncodeMechanism::All );
OUString aShareLibDirPath = aShareInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
@@ -970,7 +979,11 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
if( meInitMode != DEFAULT )
return;
- INetURLObject aUserBasicInetObj( maLibraryPath.getToken(1, ';') );
+ // tdf#121740 speed up loading documents with lots of embedded documents by avoid the UCB work of updating non-existent VBA libraries
+ if (rInitialDocumentURL.isEmpty())
+ return;
+
+ INetURLObject aUserBasicInetObj( o3tl::getToken(maLibraryPath, 1, ';') );
OUString aStandardStr("Standard");
INetURLObject aPrevUserBasicInetObj_1( aUserBasicInetObj );
@@ -1254,6 +1267,17 @@ void SfxLibraryContainer::checkStorageURL( const OUString& aSourceURL,
{
aUnexpandedStorageURL = aSourceURL;
}
+ else
+ {
+ // try to re-create the variable URL: helps moving the profile
+ if (OUString aRest; aSourceURL.startsWith(expand_url(sUserBasicVariablePrefix), &aRest))
+ aUnexpandedStorageURL = sUserBasicVariablePrefix + aRest;
+ else if (aSourceURL.startsWith(expand_url(sInstBasicVariablePrefix), &aRest))
+ aUnexpandedStorageURL = sInstBasicVariablePrefix + aRest;
+ else
+ aUnexpandedStorageURL.clear(); // This will use eventual value of aLibInfoFileURL
+ }
+
INetURLObject aInetObj( aExpandedSourceURL );
OUString aExtension = aInetObj.getExtension();
if( aExtension == "xlb" )
@@ -1318,7 +1342,7 @@ OUString SfxLibraryContainer::createAppLibraryFolder( SfxLibrary* pLib, std::u16
OUString aLibDirPath = pLib->maStorageURL;
if( aLibDirPath.isEmpty() )
{
- INetURLObject aInetObj( maLibraryPath.getToken(1, ';') );
+ INetURLObject aInetObj( o3tl::getToken(maLibraryPath, 1, ';') );
aInetObj.insertName( aName, true, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All );
checkStorageURL( aInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), pLib->maLibInfoFileURL,
pLib->maStorageURL, pLib->maUnexpandedStorageURL );
@@ -1345,14 +1369,14 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
{
Reference< XSimpleFileAccess3 > xDummySFA;
Reference< XInteractionHandler > xDummyHandler;
- implStoreLibrary( pLib, aName, xStorage, OUString(), xDummySFA, xDummyHandler );
+ implStoreLibrary( pLib, aName, xStorage, u"", xDummySFA, xDummyHandler );
}
// New variant for library export
void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
std::u16string_view aName,
const uno::Reference< embed::XStorage >& xStorage,
- const OUString& aTargetURL,
+ std::u16string_view aTargetURL,
const Reference< XSimpleFileAccess3 >& rToUseSFI,
const Reference< XInteractionHandler >& xHandler )
{
@@ -1413,7 +1437,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
else
{
// Export?
- bool bExport = !aTargetURL.isEmpty();
+ bool bExport = !aTargetURL.empty();
try
{
Reference< XSimpleFileAccess3 > xSFI = mxSFI;
@@ -1497,14 +1521,14 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
const uno::Reference< embed::XStorage >& xStorage )
{
Reference< XSimpleFileAccess3 > xDummySFA;
- implStoreLibraryIndexFile( pLib, rLib, xStorage, OUString(), xDummySFA );
+ implStoreLibraryIndexFile( pLib, rLib, xStorage, u"", xDummySFA );
}
// New variant for library export
void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
const ::xmlscript::LibDescriptor& rLib,
const uno::Reference< embed::XStorage >& xStorage,
- const OUString& aTargetURL,
+ std::u16string_view aTargetURL,
const Reference< XSimpleFileAccess3 >& rToUseSFI )
{
// Create sax writer
@@ -1546,7 +1570,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
else
{
// Export?
- bool bExport = !aTargetURL.isEmpty();
+ bool bExport = !aTargetURL.empty();
Reference< XSimpleFileAccess3 > xSFI = mxSFI;
if( rToUseSFI.is() )
{
@@ -1781,10 +1805,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
sal_Int32 index = 0;
do
{
- OUStringBuffer aTempTargetName( aTempTargetNameBase );
- aTempTargetName.append( index++ );
-
- sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear();
+ sTargetLibrariesStoreName = aTempTargetNameBase + OUString::number( index++ );
if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) )
{
break;
@@ -2051,7 +2072,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
else
{
// Create Output stream
- INetURLObject aLibInfoInetObj( maLibraryPath.getToken(1, ';') );
+ INetURLObject aLibInfoInetObj( o3tl::getToken(maLibraryPath, 1, ';') );
aLibInfoInetObj.insertName( maInfoFileName, false, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All );
aLibInfoInetObj.setExtension( u"xlc" );
OUString aLibInfoPath( aLibInfoInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
@@ -2139,6 +2160,9 @@ Reference< XNameContainer > SAL_CALL SfxLibraryContainer::createLibrary( const O
pNewLib->maLibElementFileExtension = maLibElementFileExtension;
createVariableURL( pNewLib->maUnexpandedStorageURL, Name, maInfoFileName, true );
+ // tdf#151741 - fill various storage URLs for the newly created library
+ checkStorageURL(pNewLib->maUnexpandedStorageURL, pNewLib->maLibInfoFileURL,
+ pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL);
Reference< XNameAccess > xNameAccess( pNewLib );
Any aElement;
@@ -2204,7 +2228,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name )
SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() );
if( pImplLib->mbReadOnly && !pImplLib->mbLink )
{
- throw IllegalArgumentException("readonly && !link", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("readonly && !link", getXWeak(), 1);
}
// Remove from container
maNameContainer->removeByName( Name );
@@ -2242,7 +2266,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name )
catch(const Exception& ) {}
// Delete folder if empty
- INetURLObject aInetObj( maLibraryPath.getToken(1, ';') );
+ INetURLObject aInetObj( o3tl::getToken(maLibraryPath, 1, ';') );
aInetObj.insertName( Name, true, INetURLObject::LAST_SEGMENT,
INetURLObject::EncodeMechanism::All );
OUString aLibDirPath = aInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
@@ -2310,7 +2334,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
" storage!"));
if ( !xLibrariesStor.is() )
{
- throw uno::RuntimeException("null returned from openStorageElement",static_cast< cppu::OWeakObject * >(this));
+ throw uno::RuntimeException("null returned from openStorageElement",getXWeak());
}
xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
@@ -2320,7 +2344,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
" storage!"));
if ( !xLibrariesStor.is() )
{
- throw uno::RuntimeException("null returned from openStorageElement",static_cast< cppu::OWeakObject * >(this));
+ throw uno::RuntimeException("null returned from openStorageElement",getXWeak());
}
#if OSL_DEBUG_LEVEL > 0
}
@@ -2427,7 +2451,7 @@ OUString SAL_CALL SfxLibraryContainer::getLibraryLinkURL( const OUString& Name )
bool bLink = pImplLib->mbLink;
if( !bLink )
{
- throw IllegalArgumentException("!link", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("!link", getXWeak(), 1);
}
OUString aRetStr = pImplLib->maLibInfoFileURL;
return aRetStr;
@@ -2484,10 +2508,6 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
}
loadLibrary( Name );
- // Remove from container
- maNameContainer->removeByName( Name );
- maModifiable.setModified( true );
-
// Rename library folder, but not for linked libraries
bool bMovedSuccessful = true;
@@ -2498,15 +2518,23 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
bMovedSuccessful = false;
OUString aLibDirPath = pImplLib->maStorageURL;
+ // tdf#151741 - fill various storage URLs for the library
+ // These URLs should not be empty for newly created libraries after
+ // the change in SfxLibraryContainer::createLibrary.
+ if (aLibDirPath.isEmpty())
+ {
+ checkStorageURL(pImplLib->maUnexpandedStorageURL, pImplLib->maLibInfoFileURL,
+ pImplLib->maStorageURL, pImplLib->maUnexpandedStorageURL);
+ }
- INetURLObject aDestInetObj( maLibraryPath.getToken(1, ';'));
+ INetURLObject aDestInetObj( o3tl::getToken(maLibraryPath, 1, ';'));
aDestInetObj.insertName( NewName, true, INetURLObject::LAST_SEGMENT,
INetURLObject::EncodeMechanism::All );
OUString aDestDirPath = aDestInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
// Store new URL
OUString aLibInfoFileURL = pImplLib->maLibInfoFileURL;
- checkStorageURL( aDestDirPath, pImplLib->maLibInfoFileURL, pImplLib->maStorageURL,
+ checkStorageURL(aDestDirPath, pImplLib->maLibInfoFileURL, pImplLib->maStorageURL,
pImplLib->maUnexpandedStorageURL );
try
@@ -2574,12 +2602,13 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU
bMovedSuccessful = true;
pImplLib->implSetModified( true );
+ // Remove old library from container
+ maNameContainer->removeByName( Name );
+ maModifiable.setModified( true );
}
}
catch(const Exception& )
{
- // Restore old library
- maNameContainer->insertByName( Name, aLibAny ) ;
}
}
@@ -2600,7 +2629,7 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument
LibraryContainerMethodGuard aGuard( *this );
sal_Int32 nArgCount = _rArguments.getLength();
if ( nArgCount != 1 )
- throw IllegalArgumentException("too many args", static_cast<cppu::OWeakObject*>(this), -1);
+ throw IllegalArgumentException("too many args", getXWeak(), -1);
OUString sInitialDocumentURL;
Reference< XStorageBasedDocument > xDocument;
@@ -2615,7 +2644,7 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument
initializeFromDocument( xDocument );
return;
}
- throw IllegalArgumentException("arg1 unknown type", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("arg1 unknown type", getXWeak(), 1);
}
@@ -2640,7 +2669,7 @@ void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBased
if ( !xDocStorage.is() )
{
- throw IllegalArgumentException("no doc storage", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("no doc storage", getXWeak(), 1);
}
init( OUString(), xDocStorage );
}
@@ -2694,7 +2723,7 @@ void SAL_CALL SfxLibraryContainer::changeLibraryPassword(const OUString&, const
void SAL_CALL SfxLibraryContainer::addContainerListener( const Reference< XContainerListener >& xListener )
{
LibraryContainerMethodGuard aGuard( *this );
- maNameContainer->setEventSource( static_cast< XInterface* >( static_cast<OWeakObject*>(this) ) );
+ maNameContainer->setEventSource( getXWeak() );
maNameContainer->addContainerListener( xListener );
}
@@ -2766,7 +2795,7 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
bool bLink = pImplLib->mbLink;
if( !bLink )
{
- throw IllegalArgumentException("!link", static_cast<cppu::OWeakObject*>(this), 1);
+ throw IllegalArgumentException("!link", getXWeak(), 1);
}
OUString aRetStr = pImplLib->maOriginalStorageURL;
return aRetStr;
@@ -2867,6 +2896,51 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie
maVBAScriptListeners.notifyEach( &css::script::vba::XVBAScriptListener::notifyVBAScriptEvent, aEvent );
}
+// Methods XPropertySet
+css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL SfxLibraryContainer::getPropertySetInfo()
+{
+ return uno::Reference<beans::XPropertySetInfo>();
+}
+
+void SAL_CALL SfxLibraryContainer::setPropertyValue(const OUString& aPropertyName,
+ const uno::Any& aValue)
+{
+ if (aPropertyName != sVBATextEncodingPropName)
+ throw UnknownPropertyException(aPropertyName, getXWeak());
+ aValue >>= meVBATextEncoding;
+}
+
+css::uno::Any SAL_CALL SfxLibraryContainer::getPropertyValue(const OUString& aPropertyName)
+{
+ if (aPropertyName == sVBATextEncodingPropName)
+ return uno::Any(meVBATextEncoding);
+ throw UnknownPropertyException(aPropertyName, getXWeak());
+}
+
+void SAL_CALL SfxLibraryContainer::addPropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener>& /* xListener */)
+{
+ throw NoSupportException();
+}
+
+void SAL_CALL SfxLibraryContainer::removePropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener>& /* aListener */)
+{
+ throw NoSupportException();
+}
+
+void SAL_CALL SfxLibraryContainer::addVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference<XVetoableChangeListener>& /* aListener */)
+{
+ throw NoSupportException();
+}
+
+void SAL_CALL SfxLibraryContainer::removeVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference<XVetoableChangeListener>& /* aListener */)
+{
+ throw NoSupportException();
+}
+
// Methods XServiceInfo
sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const OUString& _rServiceName )
{
@@ -2878,8 +2952,7 @@ sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const OUString& _rServic
// Ctor
SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
const Reference< XSimpleFileAccess3 >& xSFI )
- : OComponentHelper( m_aMutex )
- , mxSFI( xSFI )
+ : mxSFI( xSFI )
, mrModifiable( _rModifiable )
, maNameContainer( new NameContainer(aType) )
, mbLoaded( true )
@@ -2899,16 +2972,15 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
const Reference< XSimpleFileAccess3 >& xSFI,
- const OUString& aLibInfoFileURL, const OUString& aStorageURL, bool ReadOnly )
- : OComponentHelper( m_aMutex )
- , mxSFI( xSFI )
+ OUString aLibInfoFileURL, OUString aStorageURL, bool ReadOnly )
+ : mxSFI( xSFI )
, mrModifiable( _rModifiable )
, maNameContainer( new NameContainer(aType) )
, mbLoaded( false )
, mbIsModified( true )
, mbInitialised( false )
- , maLibInfoFileURL( aLibInfoFileURL )
- , maStorageURL( aStorageURL )
+ , maLibInfoFileURL(std::move( aLibInfoFileURL ))
+ , maStorageURL(std::move( aStorageURL ))
, mbLink( true )
, mbReadOnly( false )
, mbReadOnlyLink( ReadOnly )
@@ -2952,7 +3024,7 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType )
static_cast< XChangesNotifier * >( this ) );
if( !aRet.hasValue() )
{
- aRet = OComponentHelper::queryInterface( rType );
+ aRet = WeakComponentImplHelper::queryInterface( rType );
}
return aRet;
}
@@ -3088,7 +3160,7 @@ Sequence< Type > SfxLibrary::getTypes()
cppu::UnoType<XNameContainer>::get(),
cppu::UnoType<XContainer>::get(),
cppu::UnoType<XChangesNotifier>::get(),
- OComponentHelper::getTypes() );
+ WeakComponentImplHelper::getTypes() );
return ourTypes_NameContainer.getTypes();
}
@@ -3102,7 +3174,7 @@ Sequence< sal_Int8 > SfxLibrary::getImplementationId()
// Methods XContainer
void SAL_CALL SfxLibrary::addContainerListener( const Reference< XContainerListener >& xListener )
{
- maNameContainer->setEventSource( static_cast< XInterface* >( static_cast<OWeakObject*>(this) ) );
+ maNameContainer->setEventSource( getXWeak() );
maNameContainer->addContainerListener( xListener );
}
@@ -3114,7 +3186,7 @@ void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerLi
// Methods XChangesNotifier
void SAL_CALL SfxLibrary::addChangesListener( const Reference< XChangesListener >& xListener )
{
- maNameContainer->setEventSource( static_cast< XInterface* >( static_cast<OWeakObject*>(this) ) );
+ maNameContainer->setEventSource( getXWeak() );
maNameContainer->addChangesListener( xListener );
}