LibreOffice Module sc (master) 1
cellvalues.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 "address.hxx"
13#include <memory>
14#include <vector>
15
16class ScColumn;
17class ScFormulaCell;
18class EditTextObject;
19
20namespace svl
21{
22class SharedString;
23}
24
25namespace sc
26{
27struct CellValuesImpl;
28
30{
33
34 CellValueSpan(SCROW nRow1, SCROW nRow2);
35};
36
42{
43 std::unique_ptr<CellValuesImpl> mpImpl;
44
45 CellValues(const CellValues&) = delete;
46 CellValues& operator=(const CellValues&) = delete;
47
48public:
49 CellValues();
51
60 void transferFrom(ScColumn& rCol, SCROW nRow, size_t nLen);
61
62 void copyTo(ScColumn& rCol, SCROW nRow) const;
63 void swapNonEmpty(ScColumn& rCol);
64
65 void assign(const std::vector<double>& rVals);
66 void assign(const std::vector<ScFormulaCell*>& rVals);
67
68 size_t size() const;
69
70 void reset(size_t nSize);
71 void setValue(size_t nRow, double fVal);
72 void setValue(size_t nRow, const svl::SharedString& rStr);
74 void setValue(size_t nRow, std::unique_ptr<EditTextObject> pEditText);
75
76 void swap(CellValues& r);
77
78 std::vector<CellValueSpan> getNonEmptySpans() const;
79
80private:
81 void copyCellsTo(ScColumn& rCol, SCROW nRow) const;
82 void copyCellTextAttrsTo(ScColumn& rCol, SCROW nRow) const;
83};
84
89{
90 struct Impl;
91
92 std::unique_ptr<Impl> mpImpl;
93
94 TableValues(const TableValues&) = delete;
96
97public:
99 TableValues(const ScRange& rRange);
100 ~TableValues();
101
102 const ScRange& getRange() const;
103
107 void swap(SCTAB nTab, SCCOL nCol, CellValues& rColValue);
108
112 void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn& rCol);
113
114 std::vector<CellValueSpan> getNonEmptySpans(SCTAB nTab, SCCOL nCol) const;
115
116 void swap(TableValues& rOther);
117};
118}
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Think of this as a mini-ScColumn like storage that only stores cell values in a column.
Definition: cellvalues.hxx:42
CellValues & operator=(const CellValues &)=delete
void assign(const std::vector< double > &rVals)
Definition: cellvalues.cxx:92
void copyCellTextAttrsTo(ScColumn &rCol, SCROW nRow) const
Definition: cellvalues.cxx:243
void transferFrom(ScColumn &rCol, SCROW nRow, size_t nLen)
Transfer values from specified column.
Definition: cellvalues.cxx:53
void reset(size_t nSize)
Definition: cellvalues.cxx:128
void copyCellsTo(ScColumn &rCol, SCROW nRow) const
Definition: cellvalues.cxx:178
std::unique_ptr< CellValuesImpl > mpImpl
Definition: cellvalues.hxx:43
CellValues(const CellValues &)=delete
std::vector< CellValueSpan > getNonEmptySpans() const
Definition: cellvalues.cxx:162
void swap(CellValues &r)
Definition: cellvalues.cxx:157
size_t size() const
Definition: cellvalues.cxx:122
void copyTo(ScColumn &rCol, SCROW nRow) const
Definition: cellvalues.cxx:62
void swapNonEmpty(ScColumn &rCol)
Definition: cellvalues.cxx:68
void setValue(size_t nRow, double fVal)
Definition: cellvalues.cxx:139
Stores cell values for multiple tables.
Definition: cellvalues.hxx:89
void swap(SCTAB nTab, SCCOL nCol, CellValues &rColValue)
Swap the entire column.
Definition: cellvalues.cxx:329
TableValues & operator=(const TableValues &)=delete
std::vector< CellValueSpan > getNonEmptySpans(SCTAB nTab, SCCOL nCol) const
Definition: cellvalues.cxx:347
const ScRange & getRange() const
Definition: cellvalues.cxx:324
TableValues(const TableValues &)=delete
void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn &rCol)
Swap non-empty blocks with the column storage.
Definition: cellvalues.cxx:338
std::unique_ptr< Impl > mpImpl
Definition: cellvalues.hxx:90
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
These need to be in global namespace just like their respective types are.
CellValueSpan(SCROW nRow1, SCROW nRow2)
Definition: cellvalues.cxx:30
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17