1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SC_INC_DPITEMDATA_HXX
11 #define INCLUDED_SC_INC_DPITEMDATA_HXX
14 #include "address.hxx"
16 #include <sal/types.h>
17 #include <rtl/ustring.hxx>
18 #include "calcmacros.hxx"
19 #include "dpglobal.hxx"
22 * When assigning a string value, you can also assign an interned string
23 * whose life-cycle is managed by the pivot cache that it belongs to. Those
24 * methods that take a string pointer assume that the string is interned.
26 * <p>Do make sure that an item with an interned string won't persist after
27 * the pivot cache has been destroyed or reloaded.</p>
29 class SC_DLLPUBLIC ScDPItemData
31 friend class ScDPCache
;
34 enum Type
{ GroupValue
= 0, RangeStart
= 1, Value
= 2, String
= 3, Error
= 4, Empty
= 5 };
36 static const sal_Int32 DateFirst
;
37 static const sal_Int32 DateLast
;
41 sal_Int32 mnGroupType
;
48 rtl_uString
* mpString
;
49 GroupValueAttr maGroupValue
;
54 bool mbStringInterned
:1;
59 // case insensitive equality
60 static sal_Int32
Compare(const ScDPItemData
& rA
, const ScDPItemData
& rB
);
63 ScDPItemData(const ScDPItemData
& r
);
64 ScDPItemData(const OUString
& rStr
);
65 ScDPItemData(sal_Int32 nGroupType
, sal_Int32 nValue
);
68 Type
GetType() const { return static_cast<Type
>(meType
); }
70 void SetString(const OUString
& rS
);
71 void SetStringInterned( rtl_uString
* pS
);
72 void SetValue(double fVal
);
73 void SetRangeStart(double fVal
);
76 void SetErrorStringInterned( rtl_uString
* pS
);
77 bool IsCaseInsEqual(const ScDPItemData
& r
) const;
80 bool operator==(const ScDPItemData
& r
) const;
81 bool operator< (const ScDPItemData
& r
) const;
83 ScDPItemData
& operator= (const ScDPItemData
& r
);
87 OUString
GetString() const;
88 double GetValue() const;
89 GroupValueAttr
GetGroupValue() const;
90 bool HasStringData() const ;
92 ScDPValue::Type
GetCellType() const;
95 void Dump(const char* msg
) const;
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */