1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef BASIC_NAMECONTAINER_HXX 29*cdf0e10cSrcweir #define BASIC_NAMECONTAINER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <hash_map> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/script/XLibraryContainerPassword.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/script/XLibraryContainerExport.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/script/XLibraryContainer3.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/ucb/XSimpleFileAccess.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/util/XMacroExpander.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/util/XStringSubstitution.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/document/XStorageBasedDocument.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/deployment/XPackage.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/script/vba/XVBACompatibility.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/script/vba/XVBAScriptListener.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/util/XChangesNotifier.hpp> 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir #include <osl/mutex.hxx> 56*cdf0e10cSrcweir #include <unotools/eventlisteneradapter.hxx> 57*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 58*cdf0e10cSrcweir #include <cppuhelper/compbase8.hxx> 59*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 60*cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 61*cdf0e10cSrcweir #include <cppuhelper/component.hxx> 62*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 63*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 64*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 65*cdf0e10cSrcweir #include <sot/storage.hxx> 66*cdf0e10cSrcweir #include <comphelper/listenernotification.hxx> 67*cdf0e10cSrcweir #include <xmlscript/xmllib_imexp.hxx> 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir class BasicManager; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir namespace basic 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir //============================================================================ 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper3< 77*cdf0e10cSrcweir ::com::sun::star::container::XNameContainer, 78*cdf0e10cSrcweir ::com::sun::star::container::XContainer, 79*cdf0e10cSrcweir ::com::sun::star::util::XChangesNotifier > NameContainer_BASE; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir typedef std::hash_map< ::rtl::OUString, sal_Int32, ::rtl::OUStringHash > NameContainerNameMap; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir NameContainerNameMap mHashMap; 86*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > mNames; 87*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues; 88*cdf0e10cSrcweir sal_Int32 mnElementCount; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir ::com::sun::star::uno::Type mType; 91*cdf0e10cSrcweir ::com::sun::star::uno::XInterface* mpxEventSource; 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper maContainerListeners; 94*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper maChangesListeners; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir public: 97*cdf0e10cSrcweir NameContainer( const ::com::sun::star::uno::Type& rType ) 98*cdf0e10cSrcweir : mnElementCount( 0 ) 99*cdf0e10cSrcweir , mType( rType ) 100*cdf0e10cSrcweir , mpxEventSource( NULL ) 101*cdf0e10cSrcweir , maContainerListeners( m_aMutex ) 102*cdf0e10cSrcweir , maChangesListeners( m_aMutex ) 103*cdf0e10cSrcweir {} 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource ) 106*cdf0e10cSrcweir { mpxEventSource = pxEventSource; } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // Methods XElementAccess 109*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) 110*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 111*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements( ) 112*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir // Methods XNameAccess 115*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) 116*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 117*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 118*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) 120*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 121*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) 122*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir // Methods XNameReplace 125*cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) 126*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 127*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 128*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 129*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir // Methods XNameContainer 132*cdf0e10cSrcweir virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) 133*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 134*cdf0e10cSrcweir ::com::sun::star::container::ElementExistException, 135*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 136*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 137*cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) 138*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 139*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 140*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir // Methods XContainer 143*cdf0e10cSrcweir virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< 144*cdf0e10cSrcweir ::com::sun::star::container::XContainerListener >& xListener ) 145*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 146*cdf0e10cSrcweir virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< 147*cdf0e10cSrcweir ::com::sun::star::container::XContainerListener >& xListener ) 148*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // Methods XChangesNotifier 151*cdf0e10cSrcweir virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< 152*cdf0e10cSrcweir ::com::sun::star::util::XChangesListener >& xListener ) 153*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 154*cdf0e10cSrcweir virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< 155*cdf0e10cSrcweir ::com::sun::star::util::XChangesListener >& xListener ) 156*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 157*cdf0e10cSrcweir }; 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir //============================================================================ 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir class ModifiableHelper 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir private: 164*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper m_aModifyListeners; 165*cdf0e10cSrcweir ::cppu::OWeakObject& m_rEventSource; 166*cdf0e10cSrcweir sal_Bool mbModified; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir public: 169*cdf0e10cSrcweir ModifiableHelper( ::cppu::OWeakObject& _rEventSource, ::osl::Mutex& _rMutex ) 170*cdf0e10cSrcweir :m_aModifyListeners( _rMutex ) 171*cdf0e10cSrcweir ,m_rEventSource( _rEventSource ) 172*cdf0e10cSrcweir ,mbModified( sal_False ) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir inline sal_Bool isModified() const { return mbModified; } 177*cdf0e10cSrcweir void setModified( sal_Bool _bModified ); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir inline void addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir m_aModifyListeners.addInterface( _rxListener ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir inline void removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener ) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir m_aModifyListeners.removeInterface( _rxListener ); 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir }; 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir //============================================================================ 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir typedef ::comphelper::OListenerContainerBase< 193*cdf0e10cSrcweir ::com::sun::star::script::vba::XVBAScriptListener, 194*cdf0e10cSrcweir ::com::sun::star::script::vba::VBAScriptEvent > VBAScriptListenerContainer_BASE; 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir class VBAScriptListenerContainer : public VBAScriptListenerContainer_BASE 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir public: 199*cdf0e10cSrcweir explicit VBAScriptListenerContainer( ::osl::Mutex& rMutex ); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir private: 202*cdf0e10cSrcweir virtual bool implTypedNotify( 203*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& rxListener, 204*cdf0e10cSrcweir const ::com::sun::star::script::vba::VBAScriptEvent& rEvent ) 205*cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 206*cdf0e10cSrcweir }; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir //============================================================================ 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir class SfxLibrary; 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper8< 213*cdf0e10cSrcweir ::com::sun::star::lang::XInitialization, 214*cdf0e10cSrcweir ::com::sun::star::script::XStorageBasedLibraryContainer, 215*cdf0e10cSrcweir ::com::sun::star::script::XLibraryContainerPassword, 216*cdf0e10cSrcweir ::com::sun::star::script::XLibraryContainerExport, 217*cdf0e10cSrcweir ::com::sun::star::script::XLibraryContainer3, 218*cdf0e10cSrcweir ::com::sun::star::container::XContainer, 219*cdf0e10cSrcweir ::com::sun::star::script::vba::XVBACompatibility, 220*cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > SfxLibraryContainer_BASE; 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir class SfxLibraryContainer : public SfxLibraryContainer_BASE, public ::utl::OEventListenerAdapter 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir VBAScriptListenerContainer maVBAScriptListeners; 225*cdf0e10cSrcweir sal_Int32 mnRunningVBAScripts; 226*cdf0e10cSrcweir sal_Bool mbVBACompat; 227*cdf0e10cSrcweir protected: 228*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; 229*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI; 230*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XMacroExpander > mxMacroExpander; 231*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubstitution; 232*cdf0e10cSrcweir ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > mxOwnerDocument; 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir ::osl::Mutex maMutex; 235*cdf0e10cSrcweir ModifiableHelper maModifiable; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir NameContainer maNameContainer; 238*cdf0e10cSrcweir sal_Bool mbOldInfoFormat; 239*cdf0e10cSrcweir sal_Bool mbOasis2OOoFormat; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir ::rtl::OUString maInitialDocumentURL; 242*cdf0e10cSrcweir ::rtl::OUString maInfoFileName; 243*cdf0e10cSrcweir ::rtl::OUString maOldInfoFileName; 244*cdf0e10cSrcweir ::rtl::OUString maLibElementFileExtension; 245*cdf0e10cSrcweir ::rtl::OUString maLibraryPath; 246*cdf0e10cSrcweir ::rtl::OUString maLibrariesDir; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > mxStorage; 249*cdf0e10cSrcweir BasicManager* mpBasMgr; 250*cdf0e10cSrcweir sal_Bool mbOwnBasMgr; 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir enum InitMode 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir DEFAULT, 255*cdf0e10cSrcweir CONTAINER_INIT_FILE, 256*cdf0e10cSrcweir LIBRARY_INIT_FILE, 257*cdf0e10cSrcweir OFFICE_DOCUMENT, 258*cdf0e10cSrcweir OLD_BASIC_STORAGE 259*cdf0e10cSrcweir } meInitMode; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void implStoreLibrary( SfxLibrary* pLib, 262*cdf0e10cSrcweir const ::rtl::OUString& aName, 263*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir // New variant for library export 266*cdf0e10cSrcweir void implStoreLibrary( SfxLibrary* pLib, 267*cdf0e10cSrcweir const ::rtl::OUString& aName, 268*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 269*cdf0e10cSrcweir const ::rtl::OUString& aTargetURL, 270*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, 271*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib, 274*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir // New variant for library export 277*cdf0e10cSrcweir void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib, 278*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 279*cdf0e10cSrcweir const ::rtl::OUString& aTargetURL, 280*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI ); 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir sal_Bool implLoadLibraryIndexFile( SfxLibrary* pLib, 283*cdf0e10cSrcweir ::xmlscript::LibDescriptor& rLib, 284*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 285*cdf0e10cSrcweir const ::rtl::OUString& aIndexFileName ); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir void implImportLibDescriptor( SfxLibrary* pLib, ::xmlscript::LibDescriptor& rLib ); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir // Methods to distinguish between deffirent library types 290*cdf0e10cSrcweir virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ) = 0; 291*cdf0e10cSrcweir virtual SfxLibrary* SAL_CALL implCreateLibraryLink 292*cdf0e10cSrcweir ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL, 293*cdf0e10cSrcweir const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) = 0; 294*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0; 295*cdf0e10cSrcweir virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0; 296*cdf0e10cSrcweir virtual void SAL_CALL writeLibraryElement 297*cdf0e10cSrcweir ( 298*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, 299*cdf0e10cSrcweir const ::rtl::OUString& aElementName, 300*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput 301*cdf0e10cSrcweir ) 302*cdf0e10cSrcweir throw(::com::sun::star::uno::Exception) = 0; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement 305*cdf0e10cSrcweir ( 306*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, 307*cdf0e10cSrcweir const ::rtl::OUString& aElementName, 308*cdf0e10cSrcweir const ::rtl::OUString& aFile, 309*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0; 310*cdf0e10cSrcweir virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir // Password encryption 313*cdf0e10cSrcweir virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName, 314*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // New variant for library export 317*cdf0e10cSrcweir virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName, 318*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 319*cdf0e10cSrcweir const ::rtl::OUString& aTargetURL, 320*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ); 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name, 323*cdf0e10cSrcweir sal_Bool bVerifyPasswordOnly=false ) 324*cdf0e10cSrcweir throw(::com::sun::star::lang::WrappedTargetException, 325*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir virtual void onNewRootStorage() = 0; 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir // #56666, Creates another library container 331*cdf0e10cSrcweir // instance of the same derived class 332*cdf0e10cSrcweir virtual SfxLibraryContainer* createInstanceImpl( void ) = 0; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir // Interface to get the BasicManager (Hack for password implementation) 336*cdf0e10cSrcweir BasicManager* getBasicManager( void ); 337*cdf0e10cSrcweir ::rtl::OUString createAppLibraryFolder( SfxLibrary* pLib, const ::rtl::OUString& aName ); 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir sal_Bool init( const ::rtl::OUString& rInitialDocumentURL, 340*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxInitialStorage ); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getInfoFileName() const = 0; 343*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getOldInfoFileName() const = 0; 344*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getLibElementFileExtension() const = 0; 345*cdf0e10cSrcweir virtual const sal_Char* SAL_CALL getLibrariesDir() const = 0; 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir // Handle maLibInfoFileURL and maStorageURL correctly 348*cdf0e10cSrcweir void checkStorageURL 349*cdf0e10cSrcweir ( 350*cdf0e10cSrcweir const ::rtl::OUString& aSourceURL, 351*cdf0e10cSrcweir ::rtl::OUString& aLibInfoFileURL, 352*cdf0e10cSrcweir ::rtl::OUString& aStorageURL, 353*cdf0e10cSrcweir ::rtl::OUString& aUnexpandedStorageURL 354*cdf0e10cSrcweir ); 355*cdf0e10cSrcweir ::rtl::OUString expand_url( const ::rtl::OUString& url ) 356*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir SfxLibrary* getImplLib( const String& rLibraryName ); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir void storeLibraries_Impl( 361*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 362*cdf0e10cSrcweir sal_Bool bComplete ); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir void SAL_CALL initializeFromDocumentURL( const ::rtl::OUString& _rInitialDocumentURL ); 365*cdf0e10cSrcweir void SAL_CALL initializeFromDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& _rxDocument ); 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir // OEventListenerAdapter 368*cdf0e10cSrcweir virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir // OComponentHelper 371*cdf0e10cSrcweir virtual void SAL_CALL disposing(); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir private: 374*cdf0e10cSrcweir sal_Bool init_Impl( const ::rtl::OUString& rInitialDocumentURL, 375*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxInitialStorage ); 376*cdf0e10cSrcweir void implScanExtensions( void ); 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir public: 379*cdf0e10cSrcweir SfxLibraryContainer( void ); 380*cdf0e10cSrcweir ~SfxLibraryContainer(); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir // Interface to set the BasicManager (Hack for password implementation) 384*cdf0e10cSrcweir void setBasicManager( BasicManager* pBasMgr ) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir mpBasMgr = pBasMgr; 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir void enterMethod(); 390*cdf0e10cSrcweir void leaveMethod(); 391*cdf0e10cSrcweir bool isDisposed() const { return rBHelper.bInDispose || rBHelper.bDisposed; } 392*cdf0e10cSrcweir void checkDisposed() const; 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir // Methods XElementAccess 395*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() 396*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 397*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() 398*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // Methods XNameAccess 401*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) 402*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 403*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 404*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 405*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() 406*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 407*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) 408*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir // Members XStorageBasedLibraryContainer 411*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL getRootStorage() throw (::com::sun::star::uno::RuntimeException); 412*cdf0e10cSrcweir virtual void SAL_CALL setRootStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rootstorage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 413*cdf0e10cSrcweir virtual void SAL_CALL storeLibrariesToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& RootStorage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir // Methods XModifiable (base of XPersistentLibraryContainer) 416*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException); 417*cdf0e10cSrcweir virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException); 418*cdf0e10cSrcweir virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 419*cdf0e10cSrcweir virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir // Methods XPersistentLibraryContainer (base of XStorageBasedLibraryContainer) 422*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getRootLocation() throw (::com::sun::star::uno::RuntimeException); 423*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException); 424*cdf0e10cSrcweir virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir //Methods XLibraryContainer3 427*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name ) 428*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 429*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 430*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir // Methods XLibraryContainer2 (base of XPersistentLibraryContainer) 433*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name ) 434*cdf0e10cSrcweir throw (::com::sun::star::container::NoSuchElementException, 435*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 436*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name ) 437*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 438*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 439*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 440*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name ) 441*cdf0e10cSrcweir throw (::com::sun::star::container::NoSuchElementException, 442*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 443*cdf0e10cSrcweir virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly ) 444*cdf0e10cSrcweir throw (::com::sun::star::container::NoSuchElementException, 445*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 446*cdf0e10cSrcweir virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName ) 447*cdf0e10cSrcweir throw (::com::sun::star::container::NoSuchElementException, 448*cdf0e10cSrcweir ::com::sun::star::container::ElementExistException, 449*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir // Methods XLibraryContainer (base of XLibraryContainer2) 452*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL 453*cdf0e10cSrcweir createLibrary( const ::rtl::OUString& Name ) 454*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 455*cdf0e10cSrcweir ::com::sun::star::container::ElementExistException, 456*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 457*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL createLibraryLink 458*cdf0e10cSrcweir ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) 459*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 460*cdf0e10cSrcweir ::com::sun::star::container::ElementExistException, 461*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 462*cdf0e10cSrcweir virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name ) 463*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 464*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 465*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 466*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name ) 467*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 468*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 469*cdf0e10cSrcweir virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name ) 470*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 471*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 472*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir // Methods XInitialization 475*cdf0e10cSrcweir virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< 476*cdf0e10cSrcweir ::com::sun::star::uno::Any >& aArguments ) 477*cdf0e10cSrcweir throw (::com::sun::star::uno::Exception, 478*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir // Methods XLibraryContainerPassword 481*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name ) 482*cdf0e10cSrcweir throw (::com::sun::star::container::NoSuchElementException, 483*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 484*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name ) 485*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 486*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 487*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 488*cdf0e10cSrcweir virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password ) 489*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 490*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 491*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 492*cdf0e10cSrcweir virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name, 493*cdf0e10cSrcweir const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword ) 494*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 495*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 496*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir // Methods XContainer 499*cdf0e10cSrcweir virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< 500*cdf0e10cSrcweir ::com::sun::star::container::XContainerListener >& xListener ) 501*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 502*cdf0e10cSrcweir virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< 503*cdf0e10cSrcweir ::com::sun::star::container::XContainerListener >& xListener ) 504*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir // Methods XLibraryContainerExport 507*cdf0e10cSrcweir virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL, 508*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 509*cdf0e10cSrcweir throw (::com::sun::star::uno::Exception, 510*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 511*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir // Methods XServiceInfo 514*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) 515*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) = 0; 516*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 517*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 518*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 519*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) = 0; 520*cdf0e10cSrcweir // Methods XVBACompatibility 521*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() 522*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 523*cdf0e10cSrcweir virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) 524*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 525*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getRunningVBAScripts() 526*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 527*cdf0e10cSrcweir virtual void SAL_CALL addVBAScriptListener( 528*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener ) 529*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 530*cdf0e10cSrcweir virtual void SAL_CALL removeVBAScriptListener( 531*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAScriptListener >& Listener ) 532*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 533*cdf0e10cSrcweir virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const ::rtl::OUString& rModuleName ) 534*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 535*cdf0e10cSrcweir }; 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir //============================================================================ 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir class LibraryContainerMethodGuard 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir private: 542*cdf0e10cSrcweir SfxLibraryContainer& m_rContainer; 543*cdf0e10cSrcweir public: 544*cdf0e10cSrcweir LibraryContainerMethodGuard( SfxLibraryContainer& _rContainer ) 545*cdf0e10cSrcweir :m_rContainer( _rContainer ) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir m_rContainer.enterMethod(); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir ~LibraryContainerMethodGuard() 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir m_rContainer.leaveMethod(); 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir }; 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir //============================================================================ 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir class SfxLibrary 559*cdf0e10cSrcweir : public ::com::sun::star::container::XNameContainer 560*cdf0e10cSrcweir , public ::com::sun::star::container::XContainer 561*cdf0e10cSrcweir , public ::com::sun::star::util::XChangesNotifier 562*cdf0e10cSrcweir , public ::cppu::BaseMutex 563*cdf0e10cSrcweir , public ::cppu::OComponentHelper 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir friend class SfxLibraryContainer; 566*cdf0e10cSrcweir friend class SfxDialogLibraryContainer; 567*cdf0e10cSrcweir friend class SfxScriptLibraryContainer; 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; 570*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI; 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir ModifiableHelper& mrModifiable; 573*cdf0e10cSrcweir NameContainer maNameContainer; 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir sal_Bool mbLoaded; 576*cdf0e10cSrcweir sal_Bool mbIsModified; 577*cdf0e10cSrcweir sal_Bool mbInitialised; 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir private: 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir ::rtl::OUString maLibElementFileExtension; 582*cdf0e10cSrcweir ::rtl::OUString maLibInfoFileURL; 583*cdf0e10cSrcweir ::rtl::OUString maStorageURL; 584*cdf0e10cSrcweir ::rtl::OUString maUnexpandedStorageURL; 585*cdf0e10cSrcweir ::rtl::OUString maOrignialStorageURL; 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir sal_Bool mbLink; 588*cdf0e10cSrcweir sal_Bool mbReadOnly; 589*cdf0e10cSrcweir sal_Bool mbReadOnlyLink; 590*cdf0e10cSrcweir sal_Bool mbPreload; 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir sal_Bool mbPasswordProtected; 593*cdf0e10cSrcweir sal_Bool mbPasswordVerified; 594*cdf0e10cSrcweir sal_Bool mbDoc50Password; 595*cdf0e10cSrcweir ::rtl::OUString maPassword; 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir sal_Bool mbSharedIndexFile; 598*cdf0e10cSrcweir sal_Bool mbExtension; 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir // Additional functionality for localisation 601*cdf0e10cSrcweir // Provide modify state including resources 602*cdf0e10cSrcweir virtual sal_Bool isModified( void ) = 0; 603*cdf0e10cSrcweir virtual void storeResources( void ) = 0; 604*cdf0e10cSrcweir virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName ) = 0; 605*cdf0e10cSrcweir virtual void storeResourcesToURL( const ::rtl::OUString& URL, 606*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) = 0; 607*cdf0e10cSrcweir virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference 608*cdf0e10cSrcweir < ::com::sun::star::embed::XStorage >& xStorage ) = 0; 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir protected: 611*cdf0e10cSrcweir inline sal_Bool implIsModified() const { return mbIsModified; } 612*cdf0e10cSrcweir void implSetModified( sal_Bool _bIsModified ); 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir private: 615*cdf0e10cSrcweir /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so 616*cdf0e10cSrcweir */ 617*cdf0e10cSrcweir void impl_checkReadOnly(); 618*cdf0e10cSrcweir /** checks whether the library is loaded, throws a LibraryNotLoadedException (wrapped in a WrappedTargetException), 619*cdf0e10cSrcweir if not. 620*cdf0e10cSrcweir */ 621*cdf0e10cSrcweir void impl_checkLoaded(); 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir private: 624*cdf0e10cSrcweir void impl_removeWithoutChecks( const ::rtl::OUString& _rElementName ); 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir public: 627*cdf0e10cSrcweir SfxLibrary( 628*cdf0e10cSrcweir ModifiableHelper& _rModifiable, 629*cdf0e10cSrcweir const ::com::sun::star::uno::Type& aType, 630*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF, 631*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI 632*cdf0e10cSrcweir ); 633*cdf0e10cSrcweir SfxLibrary( 634*cdf0e10cSrcweir ModifiableHelper& _rModifiable, 635*cdf0e10cSrcweir const ::com::sun::star::uno::Type& aType, 636*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF, 637*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI, 638*cdf0e10cSrcweir const ::rtl::OUString& aLibInfoFileURL, 639*cdf0e10cSrcweir const ::rtl::OUString& 640*cdf0e10cSrcweir aStorageURL, 641*cdf0e10cSrcweir sal_Bool ReadOnly 642*cdf0e10cSrcweir ); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir // Methods XInterface 645*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException ); 646*cdf0e10cSrcweir virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } 647*cdf0e10cSrcweir virtual void SAL_CALL release() throw() { OComponentHelper::release(); } 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir // Methods XElementAccess 650*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) 651*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 652*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements( ) 653*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir // Methods XNameAccess 656*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) 657*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 658*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 659*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 660*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) 661*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 662*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) 663*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir // Methods XNameReplace 666*cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) 667*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 668*cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 669*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 670*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir // Methods XNameContainer 673*cdf0e10cSrcweir virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) 674*cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 675*cdf0e10cSrcweir ::com::sun::star::container::ElementExistException, 676*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 677*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 678*cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) 679*cdf0e10cSrcweir throw(::com::sun::star::container::NoSuchElementException, 680*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 681*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir // XTypeProvider 684*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) 685*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 686*cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) 687*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir // Methods XContainer 690*cdf0e10cSrcweir virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< 691*cdf0e10cSrcweir ::com::sun::star::container::XContainerListener >& xListener ) 692*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 693*cdf0e10cSrcweir virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< 694*cdf0e10cSrcweir ::com::sun::star::container::XContainerListener >& xListener ) 695*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir // Methods XChangesNotifier 698*cdf0e10cSrcweir virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< 699*cdf0e10cSrcweir ::com::sun::star::util::XChangesListener >& xListener ) 700*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 701*cdf0e10cSrcweir virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< 702*cdf0e10cSrcweir ::com::sun::star::util::XChangesListener >& xListener ) 703*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir public: 706*cdf0e10cSrcweir struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } }; 707*cdf0e10cSrcweir void removeElementWithoutChecks( const ::rtl::OUString& _rElementName, LibraryContainerAccess ) 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir impl_removeWithoutChecks( _rElementName ); 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir protected: 713*cdf0e10cSrcweir virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0; 714*cdf0e10cSrcweir }; 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir //============================================================================ 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir class ScriptSubPackageIterator 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > m_xMainPackage; 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir bool m_bIsValid; 723*cdf0e10cSrcweir bool m_bIsBundle; 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 726*cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aSubPkgSeq; 727*cdf0e10cSrcweir sal_Int32 m_nSubPkgCount; 728*cdf0e10cSrcweir sal_Int32 m_iNextSubPkg; 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > 731*cdf0e10cSrcweir implDetectScriptPackage( const com::sun::star::uno::Reference 732*cdf0e10cSrcweir < com::sun::star::deployment::XPackage > xPackage, bool& rbPureDialogLib ); 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir public: 735*cdf0e10cSrcweir ScriptSubPackageIterator( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xMainPackage ); 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > getNextScriptSubPackage( bool& rbPureDialogLib ); 738*cdf0e10cSrcweir }; 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir //============================================================================ 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir class ScriptExtensionIterator 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir public: 745*cdf0e10cSrcweir ScriptExtensionIterator( void ); 746*cdf0e10cSrcweir rtl::OUString nextBasicOrDialogLibrary( bool& rbPureDialogLib ); 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir private: 749*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetScriptPackageFromPackage 750*cdf0e10cSrcweir ( const com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage, 751*cdf0e10cSrcweir bool& rbPureDialogLib ); 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir protected: 754*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > 755*cdf0e10cSrcweir implGetNextUserScriptPackage( bool& rbPureDialogLib ); 756*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > 757*cdf0e10cSrcweir implGetNextSharedScriptPackage( bool& rbPureDialogLib ); 758*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > 759*cdf0e10cSrcweir implGetNextBundledScriptPackage( bool& rbPureDialogLib ); 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; 762*cdf0e10cSrcweir 763*cdf0e10cSrcweir enum IteratorState 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir USER_EXTENSIONS, 766*cdf0e10cSrcweir SHARED_EXTENSIONS, 767*cdf0e10cSrcweir BUNDLED_EXTENSIONS, 768*cdf0e10cSrcweir END_REACHED 769*cdf0e10cSrcweir } m_eState; 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 772*cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aUserPackagesSeq; 773*cdf0e10cSrcweir bool m_bUserPackagesLoaded; 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 776*cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq; 777*cdf0e10cSrcweir bool m_bSharedPackagesLoaded; 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 780*cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq; 781*cdf0e10cSrcweir bool m_bBundledPackagesLoaded; 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir int m_iUserPackage; 784*cdf0e10cSrcweir int m_iSharedPackage; 785*cdf0e10cSrcweir int m_iBundledPackage; 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir ScriptSubPackageIterator* m_pScriptSubPackageIterator; 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir }; // end class ScriptExtensionIterator 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir //============================================================================ 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir } // namespace basic 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir #endif 796*cdf0e10cSrcweir 797