xref: /trunk/main/vcl/inc/vcl/configsettings.hxx (revision 0d63794c)
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 #ifndef VCL_INC_CONFIGSETTINGS_HXX
24 #define VCL_INC_CONFIGSETTINGS_HXX
25 
26 #include <rtl/ustring.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <unotools/configitem.hxx>
29 #include <vcl/dllapi.h>
30 
31 #include <hash_map>
32 
33 //........................................................................
34 namespace vcl
35 {
36 //........................................................................
37 
38     typedef std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > OUStrMap;
SmallOUStrMap()39     class SmallOUStrMap : public OUStrMap { public: SmallOUStrMap() : OUStrMap(1) {} };
40 
41 	//====================================================================
42 	//= SettingsConfigItem
43 	//====================================================================
44     class VCL_DLLPUBLIC SettingsConfigItem : public ::utl::ConfigItem
45     {
46 
47         std::hash_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings;
48 
49         virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames );
50 
51         void getValues();
52         SettingsConfigItem();
53     public:
54         virtual ~SettingsConfigItem();
55 
56         static SettingsConfigItem* get();
57 
58         const rtl::OUString& getValue( const rtl::OUString& rGroup, const rtl::OUString& rKey ) const;
59         void setValue( const rtl::OUString& rGroup, const rtl::OUString& rKey, const rtl::OUString& rValue );
60 
61         virtual void Commit();
62     };
63 
64 //........................................................................
65 } // namespace vcl
66 //........................................................................
67 
68 #endif // VCL_INC_CONFIGSETTINGS_HXX
69 
70