diff options
author | Kohei Yoshida <kohei@libreoffice.org> | 2023-02-21 22:16:30 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei@libreoffice.org> | 2023-02-28 03:46:24 +0000 |
commit | e83c243018c1c7f6662f9a8ecdc731c5c071ea31 (patch) | |
tree | f5298e9dc56f7e57ddb90a26d2b6bb2817eb6622 /sc/inc | |
parent | acc819f6f40e43775d9f5d76971a9ba72e690dbc (diff) |
tdf#153669: Track formulas that stopped listening ...
... then have them start listening again after the copy from
clipboard is complete. Note that in case the pasted cells
are formula cells, those will be handled together as well.
Change-Id: Ia4be814b888734267a39f7c89435011968570b7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147940
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/clipcontext.hxx | 15 | ||||
-rw-r--r-- | sc/inc/column.hxx | 19 | ||||
-rw-r--r-- | sc/inc/document.hxx | 3 |
3 files changed, 32 insertions, 5 deletions
diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx index b09e1be78761..b3ce874a6a7f 100644 --- a/sc/inc/clipcontext.hxx +++ b/sc/inc/clipcontext.hxx @@ -12,6 +12,7 @@ #include "address.hxx" #include "cellvalue.hxx" #include "celltextattr.hxx" +#include "columnspanset.hxx" #include "Sparkline.hxx" #include <memory> @@ -45,6 +46,9 @@ public: class SC_DLLPUBLIC CopyFromClipContext final : public ClipContextBase { + /** Tracks modified formula group spans. */ + sc::ColumnSpanSet maListeningFormulaSpans; + SCCOL mnDestCol1; SCCOL mnDestCol2; SCROW mnDestRow1; @@ -102,6 +106,17 @@ public: InsertDeleteFlags getDeleteFlag() const; /** + * Record a range of formula cells that need to start listening after the + * copy-from-clip is complete. + */ + void setListeningFormulaSpans( SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + + /** + * Have the formula cells in the recorded ranges start listening. + */ + void startListeningFormulas(); + + /** * Set the column size of a "single cell" row, which is used when copying * a single row of cells in a clip doc and pasting it into multiple * rows by replicating it. diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 69f0d12d8273..949ca30dd137 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -22,6 +22,7 @@ #include "global.hxx" #include "address.hxx" #include "cellvalue.hxx" +#include "columnspanset.hxx" #include "rangelst.hxx" #include "types.hxx" #include "mtvelements.hxx" @@ -48,8 +49,6 @@ class CopyFromClipContext; class CopyToClipContext; class CopyToDocContext; class MixDocContext; -class ColumnSpanSet; -class SingleColumnSpanSet; struct RefUpdateContext; struct RefUpdateInsertTabContext; struct RefUpdateDeleteTabContext; @@ -837,9 +836,19 @@ private: void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const; - void DeleteCells( - sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag, - sc::SingleColumnSpanSet& rDeleted ); + struct DeleteCellsResult + { + /** cell ranges that have been deleted. */ + sc::SingleColumnSpanSet aDeletedRows; + /** formula cell range that has stopped listening. */ + std::vector<std::pair<SCROW, SCROW>> aFormulaRanges; + + DeleteCellsResult( const ScDocument& rDoc ); + DeleteCellsResult( const DeleteCellsResult& ) = delete; + }; + + std::unique_ptr<DeleteCellsResult> DeleteCells( + sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag ); /** * Get all non-grouped formula cells and formula cell groups in the whole diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index c6b2f2289ddb..092d9ba0d9a9 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1672,6 +1672,9 @@ public: SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark, SCCOL nDx, SCROW& rClipStartRow, SCROW nClipEndRow); + void StartListeningFromClip( + sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt, + SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); void StartListeningFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark, InsertDeleteFlags nInsFlag ); |