Bump version to 6.4-15
[LibreOffice.git] / sc / inc / cellvalues.hxx
blob4b877c661a1edf8f68e983624e499bc760ab4d62
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef INCLUDED_SC_INC_CELLVALUES_HXX
11 #define INCLUDED_SC_INC_CELLVALUES_HXX
13 #include "address.hxx"
14 #include <memory>
15 #include <vector>
17 class ScColumn;
18 class ScFormulaCell;
20 namespace svl {
22 class SharedString;
26 namespace sc {
28 struct CellValuesImpl;
30 struct CellValueSpan
32 SCROW const mnRow1;
33 SCROW const mnRow2;
35 CellValueSpan( SCROW nRow1, SCROW nRow2 );
38 /**
39 * Think of this as a mini-ScColumn like storage that only stores cell
40 * values in a column.
42 class CellValues
44 std::unique_ptr<CellValuesImpl> mpImpl;
46 CellValues( const CellValues& ) = delete;
47 CellValues& operator= ( const CellValues& ) = delete;
49 public:
50 CellValues();
51 ~CellValues();
53 /**
54 * Transfer values from specified column. The transferred segment in the
55 * source column becomes empty after this call.
57 * @param rCol source column to transfer values from.
58 * @param nRow top row position in the source column.
59 * @param nLen length of the segment to transfer.
61 void transferFrom( ScColumn& rCol, SCROW nRow, size_t nLen );
63 void copyTo( ScColumn& rCol, SCROW nRow ) const;
64 void swapNonEmpty( ScColumn& rCol );
66 void assign( const std::vector<double>& rVals );
67 void assign( const std::vector<ScFormulaCell*>& rVals );
69 size_t size() const;
71 void reset( size_t nSize );
72 void setValue( size_t nRow, double fVal );
73 void setValue( size_t nRow, const svl::SharedString& rStr );
75 void swap( CellValues& r );
77 std::vector<CellValueSpan> getNonEmptySpans() const;
79 private:
80 void copyCellsTo( ScColumn& rCol, SCROW nRow ) const;
81 void copyCellTextAttrsTo( ScColumn& rCol, SCROW nRow ) const;
84 /**
85 * Stores cell values for multiple tables.
87 class TableValues
89 struct Impl;
91 std::unique_ptr<Impl> mpImpl;
93 TableValues( const TableValues& ) = delete;
94 TableValues& operator= ( const TableValues& ) = delete;
96 public:
98 TableValues();
99 TableValues( const ScRange& rRange );
100 ~TableValues();
102 const ScRange& getRange() const;
105 * Swap the entire column.
107 void swap( SCTAB nTab, SCCOL nCol, CellValues& rColValue );
110 * Swap non-empty blocks with the column storage.
112 void swapNonEmpty( SCTAB nTab, SCCOL nCol, ScColumn& rCol );
114 std::vector<CellValueSpan> getNonEmptySpans( SCTAB nTab, SCCOL nCol ) const;
116 void swap( TableValues& rOther );
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */