Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / sc / inc / dpitemdata.hxx
blobf44bc3ab883662a7c07e7e2479483240977e7d21
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License or as specified alternatively below. You may obtain a copy of
8 * the License at http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * Major Contributor(s):
16 * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida@suse.com>
18 * All Rights Reserved.
20 * For minor contributions see the git repository.
22 * Alternatively, the contents of this file may be used under the terms of
23 * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 * instead of those above.
29 #ifndef __SC_DPITEMDATA_HXX__
30 #define __SC_DPITEMDATA_HXX__
32 #include "scdllapi.h"
33 #include "address.hxx"
35 #include "sal/types.h"
36 #include "tools/solar.h"
37 #include "rtl/ustring.hxx"
38 #include "dpmacros.hxx"
40 /**
41 * When assigning a string value, you can also assign an interned string
42 * whose life-cycle is managed by the pivot cache that it belongs to. Those
43 * methods that take a string pointer assume that the string is interned.
45 * <p>Do make sure that an item with an interned string won't persist after
46 * the pivot cache has been destroyed or reloaded.</p>
48 class SC_DLLPUBLIC ScDPItemData
50 friend class ScDPCache;
52 public:
53 enum Type { GroupValue = 0, RangeStart = 1, Value = 2, String = 3, Error = 4, Empty = 5 };
55 static const sal_Int32 DateFirst;
56 static const sal_Int32 DateLast;
58 struct GroupValueAttr
60 sal_Int32 mnGroupType;
61 sal_Int32 mnValue;
64 private:
66 union {
67 const rtl::OUString* mpString;
68 GroupValueAttr maGroupValue;
69 double mfValue;
72 sal_uInt8 meType:3;
73 bool mbStringInterned:1;
75 void DisposeString();
77 public:
78 // case insensitive equality
79 static sal_Int32 Compare(const ScDPItemData& rA, const ScDPItemData& rB);
81 ScDPItemData();
82 ScDPItemData(const ScDPItemData& r);
83 ScDPItemData(const rtl::OUString& rStr);
84 ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue);
85 ~ScDPItemData();
87 Type GetType() const;
88 void SetEmpty();
89 void SetString(const rtl::OUString& rS);
90 void SetString(const rtl::OUString* pS);
91 void SetValue(double fVal);
92 void SetRangeStart(double fVal);
93 void SetRangeFirst();
94 void SetRangeLast();
95 void SetErrorString(const rtl::OUString* pS);
96 bool IsCaseInsEqual(const ScDPItemData& r) const;
98 // exact equality
99 bool operator==(const ScDPItemData& r) const;
100 bool operator!=(const ScDPItemData& r) const;
101 bool operator< (const ScDPItemData& r) const;
103 ScDPItemData& operator= (const ScDPItemData& r);
105 bool IsEmpty() const;
106 bool IsValue() const;
107 rtl::OUString GetString() const;
108 double GetValue() const;
109 GroupValueAttr GetGroupValue() const;
110 bool HasStringData() const ;
112 sal_uInt8 GetCellType() const;
114 #if DEBUG_PIVOT_TABLE
115 void Dump(const char* msg) const;
116 #endif
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */