Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / svl / cintitem.hxx
blob5f23dd12116cf16bc4b62f84106973470dd6453a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVL_CINTITEM_HXX
21 #define INCLUDED_SVL_CINTITEM_HXX
23 #include <svl/svldllapi.h>
24 #include <tools/debug.hxx>
25 #include <svl/poolitem.hxx>
27 class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem
29 sal_uInt8 m_nValue;
31 public:
33 CntByteItem(sal_uInt16 which = 0, sal_uInt8 nTheValue = 0):
34 SfxPoolItem(which), m_nValue(nTheValue) {}
36 CntByteItem(const CntByteItem & rItem):
37 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
40 virtual ~CntByteItem() {}
42 virtual bool operator ==(const SfxPoolItem & rItem) const override;
44 virtual bool GetPresentation(SfxItemPresentation,
45 SfxMapUnit, SfxMapUnit,
46 OUString & rText,
47 const IntlWrapper * = nullptr)
48 const override;
50 virtual bool QueryValue(css::uno::Any& rVal,
51 sal_uInt8 nMemberId = 0) const override;
53 virtual bool PutValue(const css::uno::Any& rVal,
54 sal_uInt8 nMemberId) override;
56 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override;
58 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override;
60 virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
62 sal_uInt8 GetValue() const { return m_nValue; }
64 inline void SetValue(sal_uInt8 nTheValue);
67 inline void CntByteItem::SetValue(sal_uInt8 nTheValue)
69 DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item");
70 m_nValue = nTheValue;
73 class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem
75 sal_uInt16 m_nValue;
77 public:
79 CntUInt16Item(sal_uInt16 which = 0, sal_uInt16 nTheValue = 0):
80 SfxPoolItem(which), m_nValue(nTheValue)
83 CntUInt16Item(sal_uInt16 which, SvStream & rStream);
85 CntUInt16Item(const CntUInt16Item & rItem):
86 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
89 virtual ~CntUInt16Item() {}
91 virtual bool operator ==(const SfxPoolItem & rItem) const override;
93 virtual bool GetPresentation(SfxItemPresentation,
94 SfxMapUnit, SfxMapUnit,
95 OUString & rText,
96 const IntlWrapper * = nullptr)
97 const override;
99 virtual bool QueryValue(css::uno::Any& rVal,
100 sal_uInt8 nMemberId = 0) const override;
102 virtual bool PutValue(const css::uno::Any& rVal,
103 sal_uInt8 nMemberId) override;
105 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override;
107 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override;
109 virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
111 sal_uInt16 GetValue() const { return m_nValue; }
113 inline void SetValue(sal_uInt16 nTheValue);
116 inline void CntUInt16Item::SetValue(sal_uInt16 nTheValue)
118 DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item");
119 m_nValue = nTheValue;
122 class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem
124 sal_Int32 m_nValue;
126 public:
128 CntInt32Item(sal_uInt16 which = 0, sal_Int32 nTheValue = 0):
129 SfxPoolItem(which), m_nValue(nTheValue)
132 CntInt32Item(sal_uInt16 which, SvStream & rStream);
134 CntInt32Item(const CntInt32Item & rItem):
135 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
138 virtual ~CntInt32Item() {}
140 virtual bool operator ==(const SfxPoolItem & rItem) const override;
142 virtual bool GetPresentation(SfxItemPresentation,
143 SfxMapUnit, SfxMapUnit,
144 OUString & rText,
145 const IntlWrapper * = nullptr)
146 const override;
148 virtual bool QueryValue(css::uno::Any& rVal,
149 sal_uInt8 nMemberId = 0) const override;
151 virtual bool PutValue(const css::uno::Any& rVal,
152 sal_uInt8 nMemberId) override;
154 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override;
156 virtual SvStream & Store(SvStream &, sal_uInt16) const override;
158 virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
160 sal_Int32 GetValue() const { return m_nValue; }
162 inline void SetValue(sal_Int32 nTheValue);
165 inline void CntInt32Item::SetValue(sal_Int32 nTheValue)
167 DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item");
168 m_nValue = nTheValue;
171 class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem
173 sal_uInt32 m_nValue;
175 public:
177 CntUInt32Item(sal_uInt16 which = 0, sal_uInt32 nTheValue = 0):
178 SfxPoolItem(which), m_nValue(nTheValue)
181 CntUInt32Item(sal_uInt16 nWhich, SvStream & rStream);
183 CntUInt32Item(const CntUInt32Item & rItem):
184 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
187 virtual ~CntUInt32Item() {}
189 virtual bool operator ==(const SfxPoolItem & rItem) const override;
191 virtual bool GetPresentation(SfxItemPresentation,
192 SfxMapUnit, SfxMapUnit,
193 OUString & rText,
194 const IntlWrapper * = nullptr)
195 const override;
197 virtual bool QueryValue(css::uno::Any& rVal,
198 sal_uInt8 nMemberId = 0) const override;
200 virtual bool PutValue(const css::uno::Any& rVal,
201 sal_uInt8 nMemberId) override;
203 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override;
205 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override;
207 virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
209 sal_uInt32 GetValue() const { return m_nValue; }
211 inline void SetValue(sal_uInt32 nTheValue);
214 inline void CntUInt32Item::SetValue(sal_uInt32 nTheValue)
216 DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item");
217 m_nValue = nTheValue;
220 #endif // INCLUDED_SVL_CINTITEM_HXX
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */