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