xref: /aoo42x/main/svl/inc/svl/flagitem.hxx (revision cdf0e10c)
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 #ifndef _SFXFLAGITEM_HXX
28 #define _SFXFLAGITEM_HXX
29 
30 #include "svl/svldllapi.h"
31 #include <tools/solar.h>
32 #include <tools/rtti.hxx>
33 #include <svl/poolitem.hxx>
34 
35 class SvStream;
36 
37 extern sal_uInt16 nSfxFlagVal[16];
38 
39 // -----------------------------------------------------------------------
40 
41 DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVL_DLLPUBLIC)
42 
43 class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem
44 {
45 	sal_uInt16					 nVal;
46 
47 public:
48 							 TYPEINFO();
49 
50 							 SfxFlagItem( sal_uInt16 nWhich = 0, sal_uInt16 nValue = 0 );
51 							 SfxFlagItem( sal_uInt16 nWhich, SvStream & );
52 							 SfxFlagItem( const SfxFlagItem& );
53 
54 							 ~SfxFlagItem() {
55 								DBG_DTOR(SfxFlagItem, 0); }
56 
57 	virtual sal_uInt8			 GetFlagCount() const;
58 	virtual XubString		 GetFlagText( sal_uInt8 nFlag ) const;
59 
60 	virtual int 			 operator==( const SfxPoolItem& ) const;
61 	virtual SfxPoolItem*     Create(SvStream &, sal_uInt16 nVersion) const;
62 	virtual SvStream&		 Store(SvStream &, sal_uInt16 nItemVersion) const;
63 
64 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
65 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
66 									SfxMapUnit eCoreMetric,
67 									SfxMapUnit ePresMetric,
68 									XubString &rText,
69                                     const IntlWrapper * = 0 ) const;
70 			sal_uInt16           GetValue() const { return nVal; }
71 			void			 SetValue( sal_uInt16 nNewVal ) {
72 								 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
73 								 nVal = nNewVal;
74 							 }
75 			int 			 GetFlag( sal_uInt8 nFlag ) const {
76 								 return ( (nVal & nSfxFlagVal[nFlag]) != 0 ); }
77 			void			 SetFlag( sal_uInt8 nFlag, int bVal );
78 };
79 
80 #endif
81