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
;
47 size_t operator() (const ScDPItemData
& rVal
) const;
53 const OUString
* mpString
;
54 GroupValueAttr maGroupValue
;
59 bool mbStringInterned
:1;
64 // case insensitive equality
65 static sal_Int32
Compare(const ScDPItemData
& rA
, const ScDPItemData
& rB
);
68 ScDPItemData(const ScDPItemData
& r
);
69 ScDPItemData(const OUString
& rStr
);
70 ScDPItemData(sal_Int32 nGroupType
, sal_Int32 nValue
);
75 void SetString(const OUString
& rS
);
76 void SetString(const OUString
* pS
);
77 void SetValue(double fVal
);
78 void SetRangeStart(double fVal
);
81 void SetErrorString(const OUString
* pS
);
82 bool IsCaseInsEqual(const ScDPItemData
& r
) const;
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
);
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;
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */