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 PROPERTYSTORAGE_HXX
29 #define PROPERTYSTORAGE_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/uno/Any.hxx>
33 /** === end UNO includes === **/
34 
35 #include <tools/solar.h>
36 
37 #include <boost/shared_ptr.hpp>
38 #include <map>
39 
40 class SfxItemSet;
41 
42 //........................................................................
43 namespace dbaui
44 {
45 //........................................................................
46 
47 	//====================================================================
48 	//= PropertyStorage
49 	//====================================================================
50     class SAL_NO_VTABLE PropertyStorage
51     {
52     public:
53         virtual void getPropertyValue( ::com::sun::star::uno::Any& _out_rValue ) const = 0;
54         virtual void setPropertyValue( const ::com::sun::star::uno::Any& _rValue ) = 0;
55 
56         virtual ~PropertyStorage();
57     };
58 
59     typedef ::boost::shared_ptr< PropertyStorage >      PPropertyStorage;
60     typedef ::std::map< sal_Int32, PPropertyStorage >   PropertyValues;
61 
62 	//====================================================================
63 	//= SetItemPropertyStorage
64 	//====================================================================
65     typedef sal_uInt16  ItemId;
66 
67     /** a PropertyStorage implementation which stores the value in an item set
68     */
69     class SetItemPropertyStorage : public PropertyStorage
70     {
71     public:
72         SetItemPropertyStorage( SfxItemSet& _rItemSet, const ItemId _nItemID )
73             :m_rItemSet( _rItemSet )
74             ,m_nItemID( _nItemID )
75         {
76         }
77 
78         virtual ~SetItemPropertyStorage()
79         {
80         }
81 
82         virtual void getPropertyValue( ::com::sun::star::uno::Any& _out_rValue ) const;
83         virtual void setPropertyValue( const ::com::sun::star::uno::Any& _rValue );
84 
85     private:
86         SfxItemSet&     m_rItemSet;
87         const ItemId    m_nItemID;
88     };
89 
90 //........................................................................
91 } // namespace dbaui
92 //........................................................................
93 
94 #endif // PROPERTYSTORAGE_HXX
95