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