nss: upgrade to release 3.73
[LibreOffice.git] / basic / source / inc / namecont.hxx
blob56b688dd1271ab37930e1f137a14e1b59aa10c9d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <unordered_map>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
26 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
27 #include <com/sun/star/script/XLibraryContainerExport.hpp>
28 #include <com/sun/star/script/XLibraryQueryExecutable.hpp>
29 #include <com/sun/star/script/XLibraryContainer3.hpp>
30 #include <com/sun/star/container/XNameContainer.hpp>
31 #include <com/sun/star/container/XContainer.hpp>
32 #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/util/XStringSubstitution.hpp>
36 #include <com/sun/star/document/XStorageBasedDocument.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/frame/XModel.hpp>
39 #include <com/sun/star/deployment/XPackage.hpp>
40 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
41 #include <com/sun/star/script/vba/XVBAScriptListener.hpp>
42 #include <com/sun/star/util/XChangesNotifier.hpp>
44 #include <osl/mutex.hxx>
45 #include <unotools/eventlisteneradapter.hxx>
46 #include <cppuhelper/implbase.hxx>
47 #include <cppuhelper/compbase.hxx>
48 #include <cppuhelper/weakref.hxx>
49 #include <cppuhelper/component.hxx>
50 #include <cppuhelper/basemutex.hxx>
51 #include <rtl/ref.hxx>
52 #include <comphelper/listenernotification.hxx>
53 #include <xmlscript/xmllib_imexp.hxx>
55 class BasicManager;
57 namespace basic
59 typedef ::cppu::WeakImplHelper<
60 css::container::XNameContainer,
61 css::container::XContainer,
62 css::util::XChangesNotifier > NameContainer_BASE;
65 class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
67 typedef std::unordered_map < OUString, sal_Int32 > NameContainerNameMap;
69 NameContainerNameMap mHashMap;
70 std::vector< OUString > mNames;
71 std::vector< css::uno::Any > mValues;
72 sal_Int32 mnElementCount;
74 css::uno::Type mType;
75 css::uno::XInterface* mpxEventSource;
77 ::comphelper::OInterfaceContainerHelper2 maContainerListeners;
78 ::comphelper::OInterfaceContainerHelper2 maChangesListeners;
80 public:
81 NameContainer( const css::uno::Type& rType )
82 : mnElementCount( 0 )
83 , mType( rType )
84 , mpxEventSource( nullptr )
85 , maContainerListeners( m_aMutex )
86 , maChangesListeners( m_aMutex )
89 void setEventSource( css::uno::XInterface* pxEventSource )
90 { mpxEventSource = pxEventSource; }
92 /// @throws css::lang::IllegalArgumentException
93 /// @throws css::container::ElementExistException
94 /// @throws css::lang::WrappedTargetException
95 /// @throws css::uno::RuntimeException
96 void insertCheck(const OUString& aName, const css::uno::Any& aElement);
98 /// @throws css::lang::IllegalArgumentException
99 /// @throws css::lang::WrappedTargetException
100 /// @throws css::uno::RuntimeException
101 void insertNoCheck(const OUString& aName, const css::uno::Any& aElement);
103 // Methods XElementAccess
104 virtual css::uno::Type SAL_CALL getElementType( ) override;
105 virtual sal_Bool SAL_CALL hasElements( ) override;
107 // Methods XNameAccess
108 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
109 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
110 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
112 // Methods XNameReplace
113 virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
115 // Methods XNameContainer
116 virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override;
117 virtual void SAL_CALL removeByName( const OUString& Name ) override;
119 // Methods XContainer
120 virtual void SAL_CALL addContainerListener( const css::uno::Reference<css::container::XContainerListener >& xListener ) override;
121 virtual void SAL_CALL removeContainerListener( const css::uno::Reference<css::container::XContainerListener >& xListener ) override;
123 // Methods XChangesNotifier
124 virtual void SAL_CALL addChangesListener( const css::uno::Reference<css::util::XChangesListener >& xListener ) override;
125 virtual void SAL_CALL removeChangesListener( const css::uno::Reference<css::util::XChangesListener >& xListener ) override;
129 class ModifiableHelper
131 private:
132 ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
133 ::cppu::OWeakObject& m_rEventSource;
134 bool mbModified;
136 public:
137 ModifiableHelper( ::cppu::OWeakObject& _rEventSource, ::osl::Mutex& _rMutex )
138 :m_aModifyListeners( _rMutex )
139 ,m_rEventSource( _rEventSource )
140 ,mbModified( false )
144 bool isModified() const { return mbModified; }
145 void setModified( bool _bModified );
147 void addModifyListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener )
149 m_aModifyListeners.addInterface( _rxListener );
152 void removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener )
154 m_aModifyListeners.removeInterface( _rxListener );
159 typedef ::comphelper::OListenerContainerBase<
160 css::script::vba::XVBAScriptListener,
161 css::script::vba::VBAScriptEvent > VBAScriptListenerContainer_BASE;
163 class VBAScriptListenerContainer : public VBAScriptListenerContainer_BASE
165 public:
166 explicit VBAScriptListenerContainer( ::osl::Mutex& rMutex );
168 private:
169 virtual bool implTypedNotify(
170 const css::uno::Reference< css::script::vba::XVBAScriptListener >& rxListener,
171 const css::script::vba::VBAScriptEvent& rEvent ) override;
175 class SfxLibrary;
177 typedef ::cppu::WeakComponentImplHelper<
178 css::lang::XInitialization,
179 css::script::XStorageBasedLibraryContainer,
180 css::script::XLibraryContainerPassword,
181 css::script::XLibraryContainerExport,
182 css::script::XLibraryContainer3,
183 css::container::XContainer,
184 css::script::XLibraryQueryExecutable,
185 css::script::vba::XVBACompatibility,
186 css::lang::XServiceInfo > SfxLibraryContainer_BASE;
188 class SfxLibraryContainer
189 : public ::cppu::BaseMutex
190 , public SfxLibraryContainer_BASE
191 , public ::utl::OEventListenerAdapter
193 VBAScriptListenerContainer maVBAScriptListeners;
194 sal_Int32 mnRunningVBAScripts;
195 bool mbVBACompat;
196 OUString msProjectName;
197 protected:
198 css::uno::Reference< css::uno::XComponentContext > mxContext;
199 css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI;
200 css::uno::Reference< css::util::XStringSubstitution > mxStringSubstitution;
201 css::uno::WeakReference< css::frame::XModel > mxOwnerDocument;
203 ModifiableHelper maModifiable;
205 rtl::Reference<NameContainer> maNameContainer;
206 bool mbOldInfoFormat;
207 bool mbOasis2OOoFormat;
209 OUString maInitialDocumentURL;
210 OUString maInfoFileName;
211 OUString maOldInfoFileName;
212 OUString maLibElementFileExtension;
213 OUString maLibraryPath;
214 OUString maLibrariesDir;
216 css::uno::Reference< css::embed::XStorage > mxStorage;
217 BasicManager* mpBasMgr;
218 bool mbOwnBasMgr;
220 enum InitMode
222 DEFAULT,
223 CONTAINER_INIT_FILE,
224 LIBRARY_INIT_FILE,
225 OFFICE_DOCUMENT,
226 OLD_BASIC_STORAGE
227 } meInitMode;
229 void implStoreLibrary( SfxLibrary* pLib,
230 const OUString& rName,
231 const css::uno::Reference< css::embed::XStorage >& rStorage );
233 // New variant for library export
234 void implStoreLibrary( SfxLibrary* pLib,
235 const OUString& rName,
236 const css::uno::Reference< css::embed::XStorage >& rStorage,
237 const OUString& rTargetURL,
238 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI,
239 const css::uno::Reference< css::task::XInteractionHandler >& rHandler );
241 void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
242 const css::uno::Reference< css::embed::XStorage >& xStorage );
244 // New variant for library export
245 void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
246 const css::uno::Reference< css::embed::XStorage >& xStorage,
247 const OUString& aTargetURL,
248 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI );
250 bool implLoadLibraryIndexFile( SfxLibrary* pLib,
251 ::xmlscript::LibDescriptor& rLib,
252 const css::uno::Reference< css::embed::XStorage >& xStorage,
253 const OUString& aIndexFileName );
255 void implImportLibDescriptor( SfxLibrary* pLib, ::xmlscript::LibDescriptor const & rLib );
257 // Methods to distinguish between different library types
258 virtual SfxLibrary* implCreateLibrary( const OUString& aName ) = 0;
259 virtual SfxLibrary* implCreateLibraryLink
260 ( const OUString& aName, const OUString& aLibInfoFileURL,
261 const OUString& StorageURL, bool ReadOnly ) = 0;
262 virtual css::uno::Any createEmptyLibraryElement() = 0;
263 virtual bool isLibraryElementValid(const css::uno::Any& rElement) const = 0;
264 /// @throws css::uno::Exception
265 virtual void writeLibraryElement
267 const css::uno::Reference< css::container::XNameContainer>& xLibrary,
268 const OUString& aElementName,
269 const css::uno::Reference< css::io::XOutputStream >& xOutput
270 ) = 0;
272 virtual css::uno::Any importLibraryElement
274 const css::uno::Reference< css::container::XNameContainer>& xLibrary,
275 const OUString& aElementName,
276 const OUString& aFile,
277 const css::uno::Reference< css::io::XInputStream >& xElementStream ) = 0;
278 virtual void importFromOldStorage( const OUString& aFile ) = 0;
280 // Password encryption
281 virtual bool implStorePasswordLibrary( SfxLibrary* pLib, const OUString& aName,
282 const css::uno::Reference< css::embed::XStorage >& xStorage, const css::uno::Reference< css::task::XInteractionHandler >& Handler );
284 // New variant for library export
285 virtual bool implStorePasswordLibrary( SfxLibrary* pLib, const OUString& aName,
286 const css::uno::Reference< css::embed::XStorage >& rStorage,
287 const OUString& aTargetURL,
288 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI, const css::uno::Reference< css::task::XInteractionHandler >& Handler );
290 /// @throws css::lang::WrappedTargetException
291 /// @throws css::uno::RuntimeException
292 virtual bool implLoadPasswordLibrary( SfxLibrary* pLib, const OUString& Name,
293 bool bVerifyPasswordOnly=false );
295 virtual void onNewRootStorage() = 0;
298 // #56666, Creates another library container
299 // instance of the same derived class
300 virtual SfxLibraryContainer* createInstanceImpl() = 0;
303 // Interface to get the BasicManager (Hack for password implementation)
304 BasicManager* getBasicManager();
305 OUString createAppLibraryFolder( SfxLibrary* pLib, const OUString& aName );
307 void init( const OUString& rInitialDocumentURL,
308 const css::uno::Reference< css::embed::XStorage >& _rxInitialStorage );
310 virtual const char* getInfoFileName() const = 0;
311 virtual const char* getOldInfoFileName() const = 0;
312 virtual const char* getLibElementFileExtension() const = 0;
313 virtual const char* getLibrariesDir() const = 0;
315 // Handle maLibInfoFileURL and maStorageURL correctly
316 void checkStorageURL
318 const OUString& aSourceURL,
319 OUString& aLibInfoFileURL,
320 OUString& aStorageURL,
321 OUString& aUnexpandedStorageURL
323 /// @throws css::uno::RuntimeException
324 OUString expand_url( const OUString& url );
326 SfxLibrary* getImplLib( const OUString& rLibraryName );
328 void storeLibraries_Impl(
329 const css::uno::Reference< css::embed::XStorage >& xStorage,
330 bool bComplete );
332 void initializeFromDocument( const css::uno::Reference< css::document::XStorageBasedDocument >& _rxDocument );
334 // OEventListenerAdapter
335 virtual void _disposing( const css::lang::EventObject& _rSource ) override;
337 // OComponentHelper
338 virtual void SAL_CALL disposing() override;
340 private:
341 void init_Impl( const OUString& rInitialDocumentURL,
342 const css::uno::Reference< css::embed::XStorage >& _rxInitialStorage );
343 void implScanExtensions();
345 public:
346 SfxLibraryContainer();
347 virtual ~SfxLibraryContainer() override;
350 // Interface to set the BasicManager (Hack for password implementation)
351 void setBasicManager( BasicManager* pBasMgr )
353 mpBasMgr = pBasMgr;
356 void enterMethod();
357 static void leaveMethod();
359 // Methods XElementAccess
360 virtual css::uno::Type SAL_CALL getElementType() override;
361 virtual sal_Bool SAL_CALL hasElements() override;
363 // Methods XNameAccess
364 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
365 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
366 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
368 // Members XStorageBasedLibraryContainer
369 virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getRootStorage() override;
370 virtual void SAL_CALL setRootStorage( const css::uno::Reference< css::embed::XStorage >& _rootstorage ) override;
371 virtual void SAL_CALL storeLibrariesToStorage( const css::uno::Reference< css::embed::XStorage >& RootStorage ) override;
373 // Methods XModifiable (base of XPersistentLibraryContainer)
374 virtual sal_Bool SAL_CALL isModified( ) override;
375 virtual void SAL_CALL setModified( sal_Bool bModified ) override;
376 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
377 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
379 // Methods XPersistentLibraryContainer (base of XStorageBasedLibraryContainer)
380 virtual css::uno::Any SAL_CALL getRootLocation() override;
381 virtual OUString SAL_CALL getContainerLocationName() override;
382 virtual void SAL_CALL storeLibraries( ) override;
384 //Methods XLibraryContainer3
385 virtual OUString SAL_CALL getOriginalLibraryLinkURL( const OUString& Name ) override;
387 // Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
388 virtual sal_Bool SAL_CALL isLibraryLink( const OUString& Name ) override;
389 virtual OUString SAL_CALL getLibraryLinkURL( const OUString& Name ) override;
390 virtual sal_Bool SAL_CALL isLibraryReadOnly( const OUString& Name ) override;
391 virtual void SAL_CALL setLibraryReadOnly( const OUString& Name, sal_Bool bReadOnly ) override;
392 virtual void SAL_CALL renameLibrary( const OUString& Name, const OUString& NewName ) override;
394 // Methods XLibraryContainer (base of XLibraryContainer2)
395 virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL
396 createLibrary( const OUString& Name ) override;
397 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL createLibraryLink
398 ( const OUString& Name, const OUString& StorageURL, sal_Bool ReadOnly ) override;
399 virtual void SAL_CALL removeLibrary( const OUString& Name ) override;
400 virtual sal_Bool SAL_CALL isLibraryLoaded( const OUString& Name ) override;
401 virtual void SAL_CALL loadLibrary( const OUString& Name ) override;
403 // Methods XInitialization
404 virtual void SAL_CALL initialize( const css::uno::Sequence<
405 css::uno::Any >& aArguments ) override;
407 // Methods XLibraryContainerPassword
408 virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const OUString& Name ) override;
409 virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const OUString& Name ) override;
410 virtual sal_Bool SAL_CALL verifyLibraryPassword( const OUString& Name, const OUString& Password ) override;
411 virtual void SAL_CALL changeLibraryPassword( const OUString& Name,
412 const OUString& OldPassword, const OUString& NewPassword ) override;
414 // Methods XContainer
415 virtual void SAL_CALL addContainerListener( const css::uno::Reference<
416 css::container::XContainerListener >& xListener ) override;
417 virtual void SAL_CALL removeContainerListener( const css::uno::Reference<
418 css::container::XContainerListener >& xListener ) override;
420 // Methods XLibraryContainerExport
421 virtual void SAL_CALL exportLibrary( const OUString& Name, const OUString& URL,
422 const css::uno::Reference< css::task::XInteractionHandler >& Handler ) override;
424 // Methods XServiceInfo
425 virtual OUString SAL_CALL getImplementationName( ) override = 0;
426 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
427 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override = 0;
428 // Methods XVBACompatibility
429 virtual sal_Bool SAL_CALL getVBACompatibilityMode() override;
430 virtual void SAL_CALL setVBACompatibilityMode( sal_Bool _vbacompatmodeon ) override;
431 virtual OUString SAL_CALL getProjectName() override { return msProjectName; }
432 virtual void SAL_CALL setProjectName( const OUString& _projectname ) override;
433 virtual sal_Int32 SAL_CALL getRunningVBAScripts() override;
434 virtual void SAL_CALL addVBAScriptListener(
435 const css::uno::Reference< css::script::vba::XVBAScriptListener >& Listener ) override;
436 virtual void SAL_CALL removeVBAScriptListener(
437 const css::uno::Reference< css::script::vba::XVBAScriptListener >& Listener ) override;
438 virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const OUString& rModuleName ) override;
442 class LibraryContainerMethodGuard
444 public:
445 LibraryContainerMethodGuard( SfxLibraryContainer& _rContainer )
447 _rContainer.enterMethod();
450 ~LibraryContainerMethodGuard()
452 basic::SfxLibraryContainer::leaveMethod();
457 class SfxLibrary
458 : public css::container::XNameContainer
459 , public css::container::XContainer
460 , public css::util::XChangesNotifier
461 , public ::cppu::BaseMutex
462 , public ::cppu::OComponentHelper
464 friend class SfxLibraryContainer;
465 friend class SfxDialogLibraryContainer;
466 friend class SfxScriptLibraryContainer;
468 css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI;
470 ModifiableHelper& mrModifiable;
471 rtl::Reference<NameContainer> maNameContainer;
473 bool mbLoaded;
474 bool mbIsModified;
475 bool mbInitialised;
477 private:
479 OUString maLibElementFileExtension;
480 OUString maLibInfoFileURL;
481 OUString maStorageURL;
482 OUString maUnexpandedStorageURL;
483 OUString maOriginalStorageURL;
485 bool mbLink;
486 bool mbReadOnly;
487 bool mbReadOnlyLink;
488 bool mbPreload;
490 protected:
491 bool mbPasswordProtected;
492 private:
493 bool mbPasswordVerified;
494 bool mbDoc50Password;
495 OUString maPassword;
497 bool mbSharedIndexFile;
498 bool mbExtension;
500 // Additional functionality for localisation
501 // Provide modify state including resources
502 virtual bool isModified() = 0;
503 virtual void storeResources() = 0;
504 virtual void storeResourcesAsURL( const OUString& URL, const OUString& NewName ) = 0;
505 virtual void storeResourcesToURL( const OUString& URL,
506 const css::uno::Reference< css::task::XInteractionHandler >& xHandler ) = 0;
507 virtual void storeResourcesToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage ) = 0;
509 protected:
510 bool implIsModified() const { return mbIsModified; }
511 void implSetModified( bool _bIsModified );
513 private:
514 /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
516 void impl_checkReadOnly();
517 /** checks whether the library is loaded, throws a LibraryNotLoadedException (wrapped in a WrappedTargetException),
518 if not.
520 void impl_checkLoaded();
522 private:
523 void impl_removeWithoutChecks( const OUString& _rElementName );
525 public:
526 SfxLibrary(
527 ModifiableHelper& _rModifiable,
528 const css::uno::Type& aType,
529 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI
531 SfxLibrary(
532 ModifiableHelper& _rModifiable,
533 const css::uno::Type& aType,
534 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI,
535 const OUString& aLibInfoFileURL,
536 const OUString& aStorageURL,
537 bool ReadOnly
540 // Methods XInterface
541 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override;
542 virtual void SAL_CALL acquire() throw() override { OComponentHelper::acquire(); }
543 virtual void SAL_CALL release() throw() override { OComponentHelper::release(); }
545 // Methods XElementAccess
546 virtual css::uno::Type SAL_CALL getElementType( ) override;
547 virtual sal_Bool SAL_CALL hasElements( ) override;
549 // Methods XNameAccess
550 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
551 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
552 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
554 // Methods XNameReplace
555 virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
557 // Methods XNameContainer
558 virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override;
559 virtual void SAL_CALL removeByName( const OUString& Name ) override;
561 // XTypeProvider
562 css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
563 css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
565 // Methods XContainer
566 virtual void SAL_CALL addContainerListener( const css::uno::Reference<
567 css::container::XContainerListener >& xListener ) override;
568 virtual void SAL_CALL removeContainerListener( const css::uno::Reference<
569 css::container::XContainerListener >& xListener ) override;
571 // Methods XChangesNotifier
572 virtual void SAL_CALL addChangesListener( const css::uno::Reference<
573 css::util::XChangesListener >& xListener ) override;
574 virtual void SAL_CALL removeChangesListener( const css::uno::Reference<
575 css::util::XChangesListener >& xListener ) override;
577 public:
578 struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } };
579 void removeElementWithoutChecks( const OUString& _rElementName, LibraryContainerAccess )
581 impl_removeWithoutChecks( _rElementName );
584 protected:
585 virtual bool isLoadedStorable();
587 virtual bool isLibraryElementValid(const css::uno::Any& rElement) const = 0;
591 class ScriptSubPackageIterator
593 css::uno::Reference< css::deployment::XPackage > m_xMainPackage;
595 bool m_bIsValid;
596 bool m_bIsBundle;
598 css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aSubPkgSeq;
599 sal_Int32 m_nSubPkgCount;
600 sal_Int32 m_iNextSubPkg;
602 static css::uno::Reference< css::deployment::XPackage >
603 implDetectScriptPackage( const css::uno::Reference
604 < css::deployment::XPackage >& rPackage, bool& rbPureDialogLib );
606 public:
607 ScriptSubPackageIterator( css::uno::Reference< css::deployment::XPackage > const & xMainPackage );
609 css::uno::Reference< css::deployment::XPackage > getNextScriptSubPackage( bool& rbPureDialogLib );
613 class ScriptExtensionIterator final
615 public:
616 ScriptExtensionIterator();
617 OUString nextBasicOrDialogLibrary( bool& rbPureDialogLib );
619 private:
620 css::uno::Reference< css::deployment::XPackage >
621 implGetNextUserScriptPackage( bool& rbPureDialogLib );
622 css::uno::Reference< css::deployment::XPackage >
623 implGetNextSharedScriptPackage( bool& rbPureDialogLib );
624 css::uno::Reference< css::deployment::XPackage >
625 implGetNextBundledScriptPackage( bool& rbPureDialogLib );
627 css::uno::Reference< css::uno::XComponentContext > m_xContext;
629 enum IteratorState
631 USER_EXTENSIONS,
632 SHARED_EXTENSIONS,
633 BUNDLED_EXTENSIONS,
634 END_REACHED
635 } m_eState;
637 css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aUserPackagesSeq;
638 bool m_bUserPackagesLoaded;
640 css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aSharedPackagesSeq;
641 bool m_bSharedPackagesLoaded;
643 css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > m_aBundledPackagesSeq;
644 bool m_bBundledPackagesLoaded;
646 int m_iUserPackage;
647 int m_iSharedPackage;
648 int m_iBundledPackage;
650 ScriptSubPackageIterator* m_pScriptSubPackageIterator;
652 }; // end class ScriptExtensionIterator
655 } // namespace basic
657 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */