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_XML_ACCELERATORCONFIGURATIONWRITER_HXX_ 25 #define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_ 26 27 //_______________________________________________ 28 // own includes 29 30 #include <accelerators/acceleratorcache.hxx> 31 #include <accelerators/keymapping.hxx> 32 #include <threadhelp/threadhelpbase.hxx> 33 #include <general.h> 34 35 //_______________________________________________ 36 // interface includes 37 38 #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ 39 #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 40 #endif 41 42 //_______________________________________________ 43 // other includes 44 #include <salhelper/singletonref.hxx> 45 #include <rtl/ustring.hxx> 46 47 namespace framework{ 48 49 class AcceleratorConfigurationWriter : private ThreadHelpBase 50 { 51 //------------------------------------------- 52 // member 53 54 private: 55 56 //--------------------------------------- 57 /** @short needed to write the xml configuration. */ 58 css::uno::Reference< css::xml::sax::XDocumentHandler > m_xConfig; 59 60 //--------------------------------------- 61 /** @short reference to the outside container, where this 62 writer must work on. */ 63 const AcceleratorCache& m_rContainer; 64 65 //--------------------------------------- 66 /** @short is used to map key codes to its 67 string representation. 68 69 @descr To perform this operatio is 70 created only one times and holded 71 alive forever ...*/ 72 ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping; 73 74 //------------------------------------------- 75 // interface 76 77 public: 78 79 //--------------------------------------- 80 /** @short connect this new writer instance 81 to an outside container, which should be 82 flushed to the underlying XML configuration. 83 84 @param rContainer 85 a reference to the outside container. 86 87 @param xConfig 88 used to write the configuration there. 89 */ 90 AcceleratorConfigurationWriter(const AcceleratorCache& rContainer, 91 const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig ); 92 93 //--------------------------------------- 94 /** @short does nothing real ... */ 95 virtual ~AcceleratorConfigurationWriter(); 96 97 //--------------------------------------- 98 /** @short TODO */ 99 virtual void flush(); 100 101 //------------------------------------------- 102 // helper 103 104 private: 105 106 //--------------------------------------- 107 /** @short TODO */ 108 void impl_ts_writeKeyCommandPair(const css::awt::KeyEvent& aKey , 109 const ::rtl::OUString& sCommand, 110 const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig ); 111 }; 112 113 } // namespace framework 114 115 #endif // _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_ 116