Bump version to 4.3-4
[LibreOffice.git] / sc / inc / dpitemdata.hxx
blob5ab1b1ac76d387d2387eccd36b4e22b5937acec8
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/.
8 */
10 #ifndef INCLUDED_SC_INC_DPITEMDATA_HXX
11 #define INCLUDED_SC_INC_DPITEMDATA_HXX
13 #include "scdllapi.h"
14 #include "address.hxx"
16 #include <sal/types.h>
17 #include <rtl/ustring.hxx>
18 #include "calcmacros.hxx"
19 #include "dpglobal.hxx"
21 /**
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;
33 public:
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;
39 struct GroupValueAttr
41 sal_Int32 mnGroupType;
42 sal_Int32 mnValue;
45 struct Hash
47 size_t operator() (const ScDPItemData& rVal) const;
50 private:
52 union {
53 const OUString* mpString;
54 GroupValueAttr maGroupValue;
55 double mfValue;
58 sal_uInt8 meType:3;
59 bool mbStringInterned:1;
61 void DisposeString();
63 public:
64 // case insensitive equality
65 static sal_Int32 Compare(const ScDPItemData& rA, const ScDPItemData& rB);
67 ScDPItemData();
68 ScDPItemData(const ScDPItemData& r);
69 ScDPItemData(const OUString& rStr);
70 ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue);
71 ~ScDPItemData();
73 Type GetType() const;
74 void SetEmpty();
75 void SetString(const OUString& rS);
76 void SetString(const OUString* pS);
77 void SetValue(double fVal);
78 void SetRangeStart(double fVal);
79 void SetRangeFirst();
80 void SetRangeLast();
81 void SetErrorString(const OUString* pS);
82 bool IsCaseInsEqual(const ScDPItemData& r) const;
84 // exact equality
85 bool operator==(const ScDPItemData& r) const;
86 bool operator!=(const ScDPItemData& r) const;
87 bool operator< (const ScDPItemData& r) const;
89 ScDPItemData& operator= (const ScDPItemData& r);
91 bool IsEmpty() const;
92 bool IsValue() const;
93 OUString GetString() const;
94 double GetValue() const;
95 GroupValueAttr GetGroupValue() const;
96 bool HasStringData() const ;
98 ScDPValue::Type GetCellType() const;
100 #if DEBUG_PIVOT_TABLE
101 void Dump(const char* msg) const;
102 #endif
105 #endif
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */