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