LibreOffice Module sc (master)  1
cellvalue.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_CELLVALUE_HXX
11 #define INCLUDED_SC_INC_CELLVALUE_HXX
12 
13 #include "global.hxx"
14 
15 class ScDocument;
16 class ScFormulaCell;
17 class EditTextObject;
18 class ScColumn;
19 struct ScRefCellValue;
20 
21 namespace sc {
22 struct ColumnBlockPosition;
23 }
24 
25 namespace svl {
26 
27 class SharedString;
28 
29 }
30 
37 {
39  union {
40  double mfValue;
44  };
45 
46  ScCellValue();
47  ScCellValue( const ScRefCellValue& rCell );
48  ScCellValue( double fValue );
49  ScCellValue( const svl::SharedString& rString );
50  ScCellValue( const ScCellValue& r );
51  ScCellValue(ScCellValue&& r) noexcept;
52  ~ScCellValue();
53 
54  void clear() noexcept;
55 
56  void set( double fValue );
57  void set( const svl::SharedString& rStr );
58  void set( const EditTextObject& rEditText );
59  void set( EditTextObject* pEditText );
60  void set( ScFormulaCell* pFormula );
61 
65  void assign( const ScDocument& rDoc, const ScAddress& rPos );
66 
67  void assign(const ScCellValue& rOther, ScDocument& rDestDoc, ScCloneFlags nCloneFlags = ScCloneFlags::Default);
68 
72  void commit( ScDocument& rDoc, const ScAddress& rPos ) const;
73 
74  void commit( ScColumn& rColumn, SCROW nRow ) const;
75 
81  void release( ScDocument& rDoc, const ScAddress& rPos );
82 
83  void release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType eListenType = sc::SingleCellListening );
84 
85  OUString getString( const ScDocument* pDoc ) const;
86 
87  bool isEmpty() const;
88 
89  bool equalsWithoutFormat( const ScCellValue& r ) const;
90 
91  ScCellValue& operator= ( const ScCellValue& r );
92  ScCellValue& operator=(ScCellValue&& r) noexcept;
93  ScCellValue& operator= ( const ScRefCellValue& r );
94 
95  void swap( ScCellValue& r );
96 };
97 
105 {
107  union {
108  double mfValue;
112  };
113 
114  ScRefCellValue();
115  ScRefCellValue( double fValue );
116  ScRefCellValue( const svl::SharedString* pString );
117  ScRefCellValue( const EditTextObject* pEditText );
118  ScRefCellValue( ScFormulaCell* pFormula );
119 
123  ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos );
124  ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos, sc::ColumnBlockPosition& rBlockPos );
125 
126  void clear();
127 
131  void assign( ScDocument& rDoc, const ScAddress& rPos );
132  void assign( ScDocument& rDoc, const ScAddress& rPos, sc::ColumnBlockPosition& rBlockPos );
133 
137  void commit( ScDocument& rDoc, const ScAddress& rPos ) const;
138 
139  bool hasString() const;
140 
141  bool hasNumeric() const;
142 
143  bool hasError() const;
144 
145  double getValue();
146 
151  double getRawValue() const;
152 
165  OUString getString( const ScDocument* pDoc ) const;
166 
173  OUString getRawString( const ScDocument* pDoc ) const;
174 
175  bool isEmpty() const;
176 
177  bool hasEmptyValue();
178 
179  bool equalsWithoutFormat( const ScRefCellValue& r ) const;
180 };
181 
182 #endif
183 
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CellType meType
Definition: cellvalue.hxx:38
ScCloneFlags
Definition: global.hxx:261
css::beans::Optional< css::uno::Any > getValue(OUString const &id)
Store position data for column array storage.
double mfValue
Definition: cellvalue.hxx:40
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:104
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:36
const EditTextObject * mpEditText
Definition: cellvalue.hxx:110
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:43
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:111
const svl::SharedString * mpString
Definition: cellvalue.hxx:109
svl::SharedString * mpString
Definition: cellvalue.hxx:41
StartListeningType
Definition: types.hxx:124
CellType meType
Definition: cellvalue.hxx:106
sal_Int32 SCROW
Definition: types.hxx:18
CellType
Definition: global.hxx:281
These need to be in global namespace just like their respective types are.
EditTextObject * mpEditText
Definition: cellvalue.hxx:42
OUString getString(const Any &_rAny)
def assign(rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny)
#define SC_DLLPUBLIC
Definition: scdllapi.h:28