xref: /trunk/main/sfx2/source/inc/appbaslib.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef APPBASLIB_HXX
29 #define APPBASLIB_HXX
30 
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
35 #include <com/sun/star/embed/XStorage.hpp>
36 
37 class BasicManager;
38 
39 /** helper class which holds and manipulates a BasicManager
40 */
41 class SfxBasicManagerHolder
42 {
43 private:
44     BasicManager*   mpBasicManager;
45     ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >
46                     mxBasicContainer;
47     ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >
48                     mxDialogContainer;
49 
50 public:
51     SfxBasicManagerHolder();
52 
53     enum ContainerType
54     {
55         SCRIPTS, DIALOGS
56     };
57 
58     /** returns <TRUE/> if and only if the instance is currently bound to a non-<NULL/>
59         BasicManager.
60     */
61     bool    isValid() const { return mpBasicManager != NULL; }
62 
63     /** returns the BasicManager which this instance is currently bound to
64     */
65     BasicManager*
66             get() const { return mpBasicManager; }
67 
68     /** binds the instance to the given BasicManager
69     */
70     void    reset( BasicManager* _pBasicManager );
71 
72     ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >
73             getLibraryContainer( ContainerType _eType );
74 
75     /** determines whether any of our library containers is modified, i.e. returns <TRUE/>
76         in its isContainerModified call.
77     */
78     bool    isAnyContainerModified() const;
79 
80     /** calls the storeLibraries at both our script and basic library container
81     */
82     void    storeAllLibraries();
83 
84     /** calls the setStorage at all our XStorageBasedLibraryContainer.
85     */
86     void    setStorage(
87                 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage
88             );
89 
90     /** calls the storeLibrariesToStorage at all our XStorageBasedLibraryContainer.
91     */
92     void    storeLibrariesToStorage(
93                 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage
94             );
95 
96 
97     /** checks if any modules in the SfxLibraryContainer exceed the binary
98         limits.
99     */
100     sal_Bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& sModules );
101 
102 
103 private:
104     void    impl_releaseContainers();
105 
106     bool    impl_getContainer(
107                 ContainerType _eType,
108                 ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >& _out_rxContainer );
109 };
110 
111 class SfxApplicationScriptLibraryContainer
112 {
113 public:
114 	// Service
115 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames();
116 	static ::rtl::OUString impl_getStaticImplementationName();
117 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance
118         ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager )
119             throw( ::com::sun::star::uno::Exception );
120 	static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory
121         ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
122 
123 };
124 
125 class SfxApplicationDialogLibraryContainer
126 {
127 public:
128 	// Service
129 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames();
130 	static ::rtl::OUString impl_getStaticImplementationName();
131 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance
132         ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager )
133             throw( ::com::sun::star::uno::Exception );
134 	static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory
135         ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
136 
137 };
138 
139 #endif // APPBASLIB_HXX
140 
141