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 DBACCESS_OPTIONALBOOLITEM_HXX
25 #define DBACCESS_OPTIONALBOOLITEM_HXX
26 
27 #include <svl/poolitem.hxx>
28 
29 #include <boost/optional.hpp>
30 
31 //........................................................................
32 namespace dbaui
33 {
34 //........................................................................
35 
36 	//====================================================================
37 	//= OptionalBoolItem
38 	//====================================================================
39     class OptionalBoolItem : public SfxPoolItem
40 	{
41         ::boost::optional< bool >   m_aValue;
42 
43     public:
44 	    TYPEINFO();
45 	    OptionalBoolItem( sal_Int16 nWhich );
46 	    OptionalBoolItem( const OptionalBoolItem& _rSource );
47 
48 	    virtual int 			 operator==( const SfxPoolItem& _rItem ) const;
49 	    virtual SfxPoolItem*	 Clone( SfxItemPool* _pPool = NULL ) const;
50 
HasValue() const51         bool    HasValue() const                { return !!m_aValue; }
ClearValue()52         void    ClearValue()                    { m_aValue.reset(); }
GetValue() const53         bool    GetValue() const                { return *m_aValue; }
SetValue(const bool _bValue)54         void    SetValue( const bool _bValue )  { m_aValue.reset( _bValue ); }
55 
56         const ::boost::optional< bool >&
GetFullValue() const57             GetFullValue() const { return m_aValue; }
58 	};
59 
60 //........................................................................
61 } // namespace dbaui
62 //........................................................................
63 
64 #endif // DBACCESS_OPTIONALBOOLITEM_HXX
65