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 #ifndef INCLUDED_SC_INC_CELLVALUES_HXX
11 #define INCLUDED_SC_INC_CELLVALUES_HXX
12 
13 #include "address.hxx"
14 #include <memory>
15 #include <vector>
16 
17 class ScColumn;
18 class ScFormulaCell;
19 
20 namespace svl {
21 
22 class SharedString;
23 
24 }
25 
26 namespace sc {
27 
28 struct CellValuesImpl;
29 
31 {
34 
35  CellValueSpan( SCROW nRow1, SCROW nRow2 );
36 };
37 
43 {
44  std::unique_ptr<CellValuesImpl> mpImpl;
45 
46  CellValues( const CellValues& ) = delete;
47  CellValues& operator= ( const CellValues& ) = delete;
48 
49 public:
50  CellValues();
51  ~CellValues();
52 
61  void transferFrom( ScColumn& rCol, SCROW nRow, size_t nLen );
62 
63  void copyTo( ScColumn& rCol, SCROW nRow ) const;
64  void swapNonEmpty( ScColumn& rCol );
65 
66  void assign( const std::vector<double>& rVals );
67  void assign( const std::vector<ScFormulaCell*>& rVals );
68 
69  size_t size() const;
70 
71  void reset( size_t nSize );
72  void setValue( size_t nRow, double fVal );
73  void setValue( size_t nRow, const svl::SharedString& rStr );
74 
75  void swap( CellValues& r );
76 
77  std::vector<CellValueSpan> getNonEmptySpans() const;
78 
79 private:
80  void copyCellsTo( ScColumn& rCol, SCROW nRow ) const;
81  void copyCellTextAttrsTo( ScColumn& rCol, SCROW nRow ) const;
82 };
83 
88 {
89  struct Impl;
90 
91  std::unique_ptr<Impl> mpImpl;
92 
93  TableValues( const TableValues& ) = delete;
94  TableValues& operator= ( const TableValues& ) = delete;
95 
96 public:
97 
98  TableValues();
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 
121 #endif
122 
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void reset(size_t nSize)
Definition: cellvalues.cxx:127
void swap(SCTAB nTab, SCCOL nCol, CellValues &rColValue)
Swap the entire column.
Definition: cellvalues.cxx:322
TableValues & operator=(const TableValues &)=delete
Think of this as a mini-ScColumn like storage that only stores cell values in a column.
Definition: cellvalues.hxx:42
CellValueSpan(SCROW nRow1, SCROW nRow2)
Definition: cellvalues.cxx:29
Stores cell values for multiple tables.
Definition: cellvalues.hxx:87
void transferFrom(ScColumn &rCol, SCROW nRow, size_t nLen)
Transfer values from specified column.
Definition: cellvalues.cxx:52
void copyCellTextAttrsTo(ScColumn &rCol, SCROW nRow) const
Definition: cellvalues.cxx:236
void swapNonEmpty(ScColumn &rCol)
Definition: cellvalues.cxx:67
void setValue(size_t nRow, double fVal)
Definition: cellvalues.cxx:138
void assign(const std::vector< double > &rVals)
Definition: cellvalues.cxx:91
void copyCellsTo(ScColumn &rCol, SCROW nRow) const
Definition: cellvalues.cxx:171
sal_Int16 SCCOL
Definition: types.hxx:22
size_t size() const
Definition: cellvalues.cxx:121
std::vector< CellValueSpan > getNonEmptySpans() const
Definition: cellvalues.cxx:155
const ScRange & getRange() const
Definition: cellvalues.cxx:317
std::unique_ptr< Impl > mpImpl
Definition: cellvalues.hxx:89
std::unique_ptr< CellValuesImpl > mpImpl
Definition: cellvalues.hxx:44
std::vector< CellValueSpan > getNonEmptySpans(SCTAB nTab, SCCOL nCol) const
Definition: cellvalues.cxx:340
void copyTo(ScColumn &rCol, SCROW nRow) const
Definition: cellvalues.cxx:61
sal_Int32 SCROW
Definition: types.hxx:18
CellValues & operator=(const CellValues &)=delete
void swap(CellValues &r)
Definition: cellvalues.cxx:150
These need to be in global namespace just like their respective types are.
sal_Int16 SCTAB
Definition: types.hxx:23
void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn &rCol)
Swap non-empty blocks with the column storage.
Definition: cellvalues.cxx:331