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 __FRAMEWORK_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX_
29 #define __FRAMEWORK_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX_
30 
31 //__________________________________________
32 // own includes
33 
34 #include <accelerators/acceleratorconfiguration.hxx>
35 #include <accelerators/istoragelistener.hxx>
36 #include <accelerators/presethandler.hxx>
37 
38 #include <macros/xinterface.hxx>
39 #include <macros/xtypeprovider.hxx>
40 #include <macros/xserviceinfo.hxx>
41 
42 //__________________________________________
43 // interface includes
44 #include <com/sun/star/lang/XInitialization.hpp>
45 #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
46 
47 //__________________________________________
48 // other includes
49 
50 //__________________________________________
51 // definition
52 
53 namespace framework
54 {
55 
56 //__________________________________________
57 /**
58     implements a read/write access to a document
59     based accelerator configuration.
60  */
61 class DocumentAcceleratorConfiguration : public XMLBasedAcceleratorConfiguration
62                                        , public css::lang::XServiceInfo
63                                        , public css::lang::XInitialization
64 //                                       , public css::ui::XUIConfigurationStorage
65 {
66     //______________________________________
67     // member
68 
69     private:
70 
71         //----------------------------------
72         /** points to the root storage of the outside document,
73             where we can read/save our configuration data. */
74         css::uno::Reference< css::embed::XStorage > m_xDocumentRoot;
75 
76     //______________________________________
77     // interface
78 
79     public:
80 
81         //----------------------------------
82         /** initialize this instance and fill the internal cache.
83 
84             @param  xSMGR
85                     reference to an uno service manager, which is used internaly.
86          */
87         DocumentAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR);
88         virtual ~DocumentAcceleratorConfiguration();
89 
90         // XInterface, XTypeProvider, XServiceInfo
91         FWK_DECLARE_XINTERFACE
92         FWK_DECLARE_XTYPEPROVIDER
93         DECLARE_XSERVICEINFO
94 
95         // XInitialization
96         virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
97             throw(css::uno::Exception       ,
98                   css::uno::RuntimeException);
99 
100 		// XUIConfigurationStorage
101 		virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
102 			throw(css::uno::RuntimeException);
103 
104 		virtual sal_Bool SAL_CALL hasStorage()
105 			throw(css::uno::RuntimeException);
106 
107     //______________________________________
108     // helper
109 
110     private:
111 
112         //----------------------------------
113         /** read all data into the cache. */
114         void impl_ts_fillCache();
115 
116         //----------------------------------
117         /** forget all currently cached data AND(!)
118             forget all currently used storages. */
119         void impl_ts_clearCache();
120 };
121 
122 } // namespace framework
123 
124 #endif // __FRAMEWORK_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX_
125