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