check IFrame "FrameURL" target
[LibreOffice.git] / sc / inc / cellvalues.hxx
blob0043d65270e6174611fe71c302686712a5dfe4d9
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 #pragma once
12 #include "address.hxx"
13 #include <memory>
14 #include <vector>
16 class ScColumn;
17 class ScFormulaCell;
19 namespace svl
21 class SharedString;
24 namespace sc
26 struct CellValuesImpl;
28 struct CellValueSpan
30 SCROW mnRow1;
31 SCROW mnRow2;
33 CellValueSpan(SCROW nRow1, SCROW nRow2);
36 /**
37 * Think of this as a mini-ScColumn like storage that only stores cell
38 * values in a column.
40 class CellValues
42 std::unique_ptr<CellValuesImpl> mpImpl;
44 CellValues(const CellValues&) = delete;
45 CellValues& operator=(const CellValues&) = delete;
47 public:
48 CellValues();
49 ~CellValues();
51 /**
52 * Transfer values from specified column. The transferred segment in the
53 * source column becomes empty after this call.
55 * @param rCol source column to transfer values from.
56 * @param nRow top row position in the source column.
57 * @param nLen length of the segment to transfer.
59 void transferFrom(ScColumn& rCol, SCROW nRow, size_t nLen);
61 void copyTo(ScColumn& rCol, SCROW nRow) const;
62 void swapNonEmpty(ScColumn& rCol);
64 void assign(const std::vector<double>& rVals);
65 void assign(const std::vector<ScFormulaCell*>& rVals);
67 size_t size() const;
69 void reset(size_t nSize);
70 void setValue(size_t nRow, double fVal);
71 void setValue(size_t nRow, const svl::SharedString& rStr);
73 void swap(CellValues& r);
75 std::vector<CellValueSpan> getNonEmptySpans() const;
77 private:
78 void copyCellsTo(ScColumn& rCol, SCROW nRow) const;
79 void copyCellTextAttrsTo(ScColumn& rCol, SCROW nRow) const;
82 /**
83 * Stores cell values for multiple tables.
85 class TableValues
87 struct Impl;
89 std::unique_ptr<Impl> mpImpl;
91 TableValues(const TableValues&) = delete;
92 TableValues& operator=(const TableValues&) = delete;
94 public:
95 TableValues();
96 TableValues(const ScRange& rRange);
97 ~TableValues();
99 const ScRange& getRange() const;
102 * Swap the entire column.
104 void swap(SCTAB nTab, SCCOL nCol, CellValues& rColValue);
107 * Swap non-empty blocks with the column storage.
109 void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn& rCol);
111 std::vector<CellValueSpan> getNonEmptySpans(SCTAB nTab, SCCOL nCol) const;
113 void swap(TableValues& rOther);
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */