LOK: tilebench improvements
[LibreOffice.git] / sc / inc / dpitemdata.hxx
blob44e3dc1930c192486278f88775094e18c039c087
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 private:
47 union {
48 rtl_uString* mpString;
49 GroupValueAttr maGroupValue;
50 double mfValue;
53 sal_uInt8 meType:3;
54 bool mbStringInterned:1;
56 void DisposeString();
58 public:
59 // case insensitive equality
60 static sal_Int32 Compare(const ScDPItemData& rA, const ScDPItemData& rB);
62 ScDPItemData();
63 ScDPItemData(const ScDPItemData& r);
64 ScDPItemData(const OUString& rStr);
65 ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue);
66 ~ScDPItemData();
68 Type GetType() const { return static_cast<Type>(meType); }
69 void SetEmpty();
70 void SetString(const OUString& rS);
71 void SetStringInterned( rtl_uString* pS );
72 void SetValue(double fVal);
73 void SetRangeStart(double fVal);
74 void SetRangeFirst();
75 void SetRangeLast();
76 void SetErrorStringInterned( rtl_uString* pS );
77 bool IsCaseInsEqual(const ScDPItemData& r) const;
79 // exact equality
80 bool operator==(const ScDPItemData& r) const;
81 bool operator< (const ScDPItemData& r) const;
83 ScDPItemData& operator= (const ScDPItemData& r);
85 bool IsEmpty() const;
86 bool IsValue() const;
87 OUString GetString() const;
88 double GetValue() const;
89 GroupValueAttr GetGroupValue() const;
90 bool HasStringData() const ;
92 ScDPValue::Type GetCellType() const;
94 #if DEBUG_PIVOT_TABLE
95 void Dump(const char* msg) const;
96 #endif
99 #endif
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */