1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef APPBASLIB_HXX 25 #define APPBASLIB_HXX 26 27 #include <com/sun/star/uno/Sequence.hxx> 28 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 29 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 30 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> 31 #include <com/sun/star/embed/XStorage.hpp> 32 33 class BasicManager; 34 35 /** helper class which holds and manipulates a BasicManager 36 */ 37 class SfxBasicManagerHolder 38 { 39 private: 40 BasicManager* mpBasicManager; 41 ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer > 42 mxBasicContainer; 43 ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer > 44 mxDialogContainer; 45 46 public: 47 SfxBasicManagerHolder(); 48 49 enum ContainerType 50 { 51 SCRIPTS, DIALOGS 52 }; 53 54 /** returns <TRUE/> if and only if the instance is currently bound to a non-<NULL/> 55 BasicManager. 56 */ isValid() const57 bool isValid() const { return mpBasicManager != NULL; } 58 59 /** returns the BasicManager which this instance is currently bound to 60 */ 61 BasicManager* get() const62 get() const { return mpBasicManager; } 63 64 /** binds the instance to the given BasicManager 65 */ 66 void reset( BasicManager* _pBasicManager ); 67 68 ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer > 69 getLibraryContainer( ContainerType _eType ); 70 71 /** determines whether any of our library containers is modified, i.e. returns <TRUE/> 72 in its isContainerModified call. 73 */ 74 bool isAnyContainerModified() const; 75 76 /** calls the storeLibraries at both our script and basic library container 77 */ 78 void storeAllLibraries(); 79 80 /** calls the setStorage at all our XStorageBasedLibraryContainer. 81 */ 82 void setStorage( 83 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage 84 ); 85 86 /** calls the storeLibrariesToStorage at all our XStorageBasedLibraryContainer. 87 */ 88 void storeLibrariesToStorage( 89 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage 90 ); 91 92 93 /** checks if any modules in the SfxLibraryContainer exceed the binary 94 limits. 95 */ 96 sal_Bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& sModules ); 97 98 99 private: 100 void impl_releaseContainers(); 101 102 bool impl_getContainer( 103 ContainerType _eType, 104 ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >& _out_rxContainer ); 105 }; 106 107 class SfxApplicationScriptLibraryContainer 108 { 109 public: 110 // Service 111 static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); 112 static ::rtl::OUString impl_getStaticImplementationName(); 113 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance 114 ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) 115 throw( ::com::sun::star::uno::Exception ); 116 static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory 117 ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 118 119 }; 120 121 class SfxApplicationDialogLibraryContainer 122 { 123 public: 124 // Service 125 static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); 126 static ::rtl::OUString impl_getStaticImplementationName(); 127 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance 128 ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) 129 throw( ::com::sun::star::uno::Exception ); 130 static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory 131 ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 132 133 }; 134 135 #endif // APPBASLIB_HXX 136 137