1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e07b45SAndrew Rist  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e07b45SAndrew Rist  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19*f8e07b45SAndrew Rist  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_
25cdf0e10cSrcweir #define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________
28cdf0e10cSrcweir // own includes
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <accelerators/acceleratorcache.hxx>
31cdf0e10cSrcweir #include <accelerators/keymapping.hxx>
32cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
33cdf0e10cSrcweir #include <general.h>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //_______________________________________________
36cdf0e10cSrcweir // interface includes
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
39cdf0e10cSrcweir #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //_______________________________________________
43cdf0e10cSrcweir // other includes
44cdf0e10cSrcweir #include <salhelper/singletonref.hxx>
45cdf0e10cSrcweir #include <rtl/ustring.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace framework{
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class AcceleratorConfigurationWriter : private ThreadHelpBase
50cdf0e10cSrcweir {
51cdf0e10cSrcweir     //-------------------------------------------
52cdf0e10cSrcweir     // member
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     private:
55cdf0e10cSrcweir 
56cdf0e10cSrcweir         //---------------------------------------
57cdf0e10cSrcweir         /** @short  needed to write the xml configuration. */
58cdf0e10cSrcweir         css::uno::Reference< css::xml::sax::XDocumentHandler > m_xConfig;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir         //---------------------------------------
61cdf0e10cSrcweir         /** @short  reference to the outside container, where this
62cdf0e10cSrcweir                     writer must work on. */
63cdf0e10cSrcweir         const AcceleratorCache& m_rContainer;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         //---------------------------------------
66cdf0e10cSrcweir         /** @short  is used to map key codes to its
67cdf0e10cSrcweir                     string representation.
68cdf0e10cSrcweir 
69cdf0e10cSrcweir             @descr  To perform this operatio is
70cdf0e10cSrcweir                     created only one times and holded
71cdf0e10cSrcweir                     alive forever ...*/
72cdf0e10cSrcweir         ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     //-------------------------------------------
75cdf0e10cSrcweir     // interface
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	public:
78cdf0e10cSrcweir 
79cdf0e10cSrcweir         //---------------------------------------
80cdf0e10cSrcweir         /** @short  connect this new writer instance
81cdf0e10cSrcweir                     to an outside container, which should be
82cdf0e10cSrcweir                     flushed to the underlying XML configuration.
83cdf0e10cSrcweir 
84cdf0e10cSrcweir             @param  rContainer
85cdf0e10cSrcweir                     a reference to the outside container.
86cdf0e10cSrcweir 
87cdf0e10cSrcweir             @param  xConfig
88cdf0e10cSrcweir                     used to write the configuration there.
89cdf0e10cSrcweir           */
90cdf0e10cSrcweir         AcceleratorConfigurationWriter(const AcceleratorCache&                                       rContainer,
91cdf0e10cSrcweir                                        const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig   );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         //---------------------------------------
94cdf0e10cSrcweir         /** @short  does nothing real ... */
95cdf0e10cSrcweir 		virtual ~AcceleratorConfigurationWriter();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir         //---------------------------------------
98cdf0e10cSrcweir         /** @short  TODO */
99cdf0e10cSrcweir         virtual void flush();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     //-------------------------------------------
102cdf0e10cSrcweir     // helper
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     private:
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         //---------------------------------------
107cdf0e10cSrcweir         /** @short  TODO */
108cdf0e10cSrcweir         void impl_ts_writeKeyCommandPair(const css::awt::KeyEvent&                                     aKey    ,
109cdf0e10cSrcweir                                          const ::rtl::OUString&                                        sCommand,
110cdf0e10cSrcweir                                          const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig );
111cdf0e10cSrcweir };
112cdf0e10cSrcweir 
113cdf0e10cSrcweir } // namespace framework
114cdf0e10cSrcweir 
115cdf0e10cSrcweir #endif // _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_
116