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