LibreOffice Module sc (master)  1
dpitemdata.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #ifndef INCLUDED_SC_INC_DPITEMDATA_HXX
11 #define INCLUDED_SC_INC_DPITEMDATA_HXX
12 
13 #include "scdllapi.h"
14 
15 #include <sal/types.h>
16 #include <rtl/ustring.h>
17 #include <rtl/ustring.hxx>
18 #include "calcmacros.hxx"
19 #include "dpglobal.hxx"
20 
30 {
31  friend class ScDPCache;
32 
33 public:
34  enum Type { GroupValue = 0, RangeStart = 1, Value = 2, String = 3, Error = 4, Empty = 5 };
35 
36  static const sal_Int32 DateFirst;
37  static const sal_Int32 DateLast;
38 
40  {
41  sal_Int32 mnGroupType;
42  sal_Int32 mnValue;
43  };
44 
45 private:
46 
47  union {
48  rtl_uString* mpString;
50  double mfValue;
51  };
52 
54  bool mbStringInterned:1;
55 
56  void DisposeString();
57 
58 public:
59  // case insensitive equality
60  static sal_Int32 Compare(const ScDPItemData& rA, const ScDPItemData& rB);
61 
62  ScDPItemData();
63  ScDPItemData(const ScDPItemData& r);
64  ScDPItemData(const OUString& rStr);
65  ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue);
66  ~ScDPItemData();
67 
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;
78 
79  // exact equality
80  bool operator==(const ScDPItemData& r) const;
81  bool operator< (const ScDPItemData& r) const;
82 
83  ScDPItemData& operator= (const ScDPItemData& r);
84 
85  bool IsEmpty() const;
86  bool IsValue() const;
87  OUString GetString() const;
88  double GetValue() const;
89  GroupValueAttr GetGroupValue() const;
90  bool HasStringData() const ;
91 
92  ScDPValue::Type GetCellType() const;
93 
94 #if DEBUG_PIVOT_TABLE
95  void Dump(const char* msg) const;
96 #endif
97 };
98 
99 #endif
100 
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:517
std::string GetValue
This class represents the cached data part of the datapilot cache table implementation.
Definition: dpcache.hxx:48
double mfValue
Definition: dpitemdata.hxx:50
void SetString(SwCursor &rCursor, const OUString &rString)
OUString GetString(int nId)
Value
rtl_uString * mpString
Definition: dpitemdata.hxx:48
Type GetType() const
Definition: dpitemdata.hxx:68
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
Definition: dpitemdata.hxx:29
GroupValueAttr maGroupValue
Definition: dpitemdata.hxx:49
static short Compare(const OUString &sInput1, const OUString &sInput2, const bool bCaseSens, const ScUserListData *pData, const CollatorWrapper *pCW)
Naturally compares two given strings.
Definition: table3.cxx:163
Error
bool operator<(const ScDPCollection::DBType &left, const ScDPCollection::DBType &right)
Definition: dpobject.cxx:3929
static const sal_Int32 DateLast
Definition: dpitemdata.hxx:37
unsigned char sal_uInt8
static const sal_Int32 DateFirst
Definition: dpitemdata.hxx:36
Empty
RedlineType meType
#define SC_DLLPUBLIC
Definition: scdllapi.h:28