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 _SFXINTITEM_HXX
25 #define _SFXINTITEM_HXX
26
27 #include "svl/svldllapi.h"
28 #include <svl/cintitem.hxx>
29
30 //============================================================================
31 class SVL_DLLPUBLIC SfxByteItem: public CntByteItem
32 {
33 public:
34 TYPEINFO();
35
SfxByteItem(sal_uInt16 which=0,sal_uInt8 nValue=0)36 SfxByteItem(sal_uInt16 which = 0, sal_uInt8 nValue = 0):
37 CntByteItem(which, nValue) {}
38
SfxByteItem(sal_uInt16 which,SvStream & rStream)39 SfxByteItem(sal_uInt16 which, SvStream & rStream):
40 CntByteItem(which, rStream) {}
41
42 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
43
Clone(SfxItemPool * =0) const44 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
45 { return new SfxByteItem(*this); }
46 };
47
48 //============================================================================
49 DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVL_DLLPUBLIC)
50
51 class SVL_DLLPUBLIC SfxInt16Item: public SfxPoolItem
52 {
53 sal_Int16 m_nValue;
54
55 public:
56 TYPEINFO();
57
SfxInt16Item(sal_uInt16 which=0,sal_Int16 nTheValue=0)58 SfxInt16Item(sal_uInt16 which = 0, sal_Int16 nTheValue = 0):
59 SfxPoolItem(which), m_nValue(nTheValue)
60 { DBG_CTOR(SfxInt16Item, 0); }
61
62 SfxInt16Item(sal_uInt16 nWhich, SvStream & rStream);
63
SfxInt16Item(const SfxInt16Item & rItem)64 SfxInt16Item(const SfxInt16Item & rItem):
65 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
66 { DBG_CTOR(SfxInt16Item, 0); }
67
~SfxInt16Item()68 virtual ~SfxInt16Item() { DBG_DTOR(SfxInt16Item, 0); }
69
70 virtual int operator ==(const SfxPoolItem & rItem) const;
71
72 using SfxPoolItem::Compare;
73 virtual int Compare(const SfxPoolItem & rWith) const;
74
75 virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
76 SfxMapUnit, SfxMapUnit,
77 XubString & rText,
78 const IntlWrapper * = 0)
79 const;
80
81 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
82 sal_uInt8 nMemberId = 0 ) const;
83
84 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
85 sal_uInt8 nMemberId = 0 );
86
87 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
88
89 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
90
91 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
92
93 virtual sal_Int16 GetMin() const;
94
95 virtual sal_Int16 GetMax() const;
96
97 virtual SfxFieldUnit GetUnit() const;
98
GetValue() const99 sal_Int16 GetValue() const { return m_nValue; }
100
101 inline void SetValue(sal_Int16 nTheValue);
102 };
103
SetValue(sal_Int16 nTheValue)104 inline void SfxInt16Item::SetValue(sal_Int16 nTheValue)
105 {
106 DBG_ASSERT(GetRefCount() == 0, "SfxInt16Item::SetValue(); Pooled item");
107 m_nValue = nTheValue;
108 }
109
110 //============================================================================
111 class SVL_DLLPUBLIC SfxUInt16Item: public CntUInt16Item
112 {
113 public:
114 TYPEINFO();
115
SfxUInt16Item(sal_uInt16 which=0,sal_uInt16 nValue=0)116 SfxUInt16Item(sal_uInt16 which = 0, sal_uInt16 nValue = 0):
117 CntUInt16Item(which, nValue) {}
118
SfxUInt16Item(sal_uInt16 which,SvStream & rStream)119 SfxUInt16Item(sal_uInt16 which, SvStream & rStream):
120 CntUInt16Item(which, rStream) {}
121
Create(SvStream & rStream,sal_uInt16) const122 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
123 { return new SfxUInt16Item(Which(), rStream); }
124
Clone(SfxItemPool * =0) const125 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
126 { return new SfxUInt16Item(*this); }
127 };
128
129 //============================================================================
130 class SVL_DLLPUBLIC SfxInt32Item: public CntInt32Item
131 {
132 public:
133 TYPEINFO();
134
SfxInt32Item(sal_uInt16 which=0,sal_Int32 nValue=0)135 SfxInt32Item(sal_uInt16 which = 0, sal_Int32 nValue = 0):
136 CntInt32Item(which, nValue) {}
137
SfxInt32Item(sal_uInt16 which,SvStream & rStream)138 SfxInt32Item(sal_uInt16 which, SvStream & rStream):
139 CntInt32Item(which, rStream) {}
140
Create(SvStream & rStream,sal_uInt16) const141 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
142 { return new SfxInt32Item(Which(), rStream); }
143
Clone(SfxItemPool * =0) const144 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
145 { return new SfxInt32Item(*this); }
146
147 };
148
149 //============================================================================
150 class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item
151 {
152 public:
153 TYPEINFO();
154
SfxUInt32Item(sal_uInt16 which=0,sal_uInt32 nValue=0)155 SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0):
156 CntUInt32Item(which, nValue) {}
157
SfxUInt32Item(sal_uInt16 which,SvStream & rStream)158 SfxUInt32Item(sal_uInt16 which, SvStream & rStream):
159 CntUInt32Item(which, rStream) {}
160
Create(SvStream & rStream,sal_uInt16) const161 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
162 { return new SfxUInt32Item(Which(), rStream); }
163
Clone(SfxItemPool * =0) const164 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
165 { return new SfxUInt32Item(*this); }
166 };
167
168 #endif // _SFXINTITEM_HXX
169
170