Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef APPBASLIB_HXX
21 : : #define APPBASLIB_HXX
22 : :
23 : : #include <com/sun/star/uno/Sequence.hxx>
24 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 : : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
26 : : #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
27 : : #include <com/sun/star/embed/XStorage.hpp>
28 : :
29 : : class BasicManager;
30 : :
31 : : /** helper class which holds and manipulates a BasicManager
32 : : */
33 : 2866 : class SfxBasicManagerHolder
34 : : {
35 : : private:
36 : : BasicManager* mpBasicManager;
37 : : ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >
38 : : mxBasicContainer;
39 : : ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >
40 : : mxDialogContainer;
41 : :
42 : : public:
43 : : SfxBasicManagerHolder();
44 : :
45 : : enum ContainerType
46 : : {
47 : : SCRIPTS, DIALOGS
48 : : };
49 : :
50 : : /** returns <TRUE/> if and only if the instance is currently bound to a non-<NULL/>
51 : : BasicManager.
52 : : */
53 : 1115 : bool isValid() const { return mpBasicManager != NULL; }
54 : :
55 : : /** returns the BasicManager which this instance is currently bound to
56 : : */
57 : : BasicManager*
58 : 5352 : get() const { return mpBasicManager; }
59 : :
60 : : /** binds the instance to the given BasicManager
61 : : */
62 : : void reset( BasicManager* _pBasicManager );
63 : :
64 : : ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >
65 : : getLibraryContainer( ContainerType _eType );
66 : :
67 : : /** calls the storeLibraries at both our script and basic library container
68 : : */
69 : : void storeAllLibraries();
70 : :
71 : : /** calls the setStorage at all our XStorageBasedLibraryContainer.
72 : : */
73 : : void setStorage(
74 : : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage
75 : : );
76 : :
77 : : /** calls the storeLibrariesToStorage at all our XStorageBasedLibraryContainer.
78 : : */
79 : : void storeLibrariesToStorage(
80 : : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage
81 : : );
82 : :
83 : :
84 : : /** checks if any modules in the SfxLibraryContainer exceed the binary
85 : : limits.
86 : : */
87 : : sal_Bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& sModules );
88 : :
89 : :
90 : : private:
91 : : void impl_releaseContainers();
92 : :
93 : : bool impl_getContainer(
94 : : ContainerType _eType,
95 : : ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer >& _out_rxContainer );
96 : : };
97 : :
98 : : class SfxApplicationScriptLibraryContainer
99 : : {
100 : : public:
101 : : // Service
102 : : static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames();
103 : : static ::rtl::OUString impl_getStaticImplementationName();
104 : : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance
105 : : ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager )
106 : : throw( ::com::sun::star::uno::Exception );
107 : : static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory
108 : : ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
109 : :
110 : : };
111 : :
112 : : class SfxApplicationDialogLibraryContainer
113 : : {
114 : : public:
115 : : // Service
116 : : static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames();
117 : : static ::rtl::OUString impl_getStaticImplementationName();
118 : : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance
119 : : ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager )
120 : : throw( ::com::sun::star::uno::Exception );
121 : : static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory
122 : : ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
123 : :
124 : : };
125 : :
126 : : #endif // APPBASLIB_HXX
127 : :
128 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|