diff options
author | Attila Szűcs <szucs.attila3@nisz.hu> | 2020-10-01 14:40:08 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-05 11:22:12 +0200 |
commit | 03dfa09886b6fd0ebda7abe7d5e142da172e8cc2 (patch) | |
tree | 41028434105f9cd5b6756e745bdd470bcc401d07 /sc/inc | |
parent | 47f0e09af5bfc250d91896d0af56b34b83bd16a2 (diff) |
tdf#88782 sc: autofill number sequences in merged cells
Improve FillAuto, FillAnalyse and FillSeries to continue
linear sequences of numbers in merged cells by skipping
the empty overlapped cells of the merged area, like other
spreadsheets do. For example this fix autofill, when merged
cells are used to highlight nth numbers. Instead of 1, 2 ->
1, 2, 2, 3, we get 1, 2 -> 1, 2, 3, 4 on the following fill:
+-+-+-+ +-+-+-+-+-+-+
|1| 2 | -> |1| 2 |3| 4 |
+-+-+-+ +-+-+-+-+-+-+
See the unit test document for more complex examples, and
use merge/unmerge to check the work of the algorithm. For
example, column C of the test document contains cells
EMPTY, EMPTY, EMPTY, 2, EMPTY, 4, EMPTY
calculated as 2, 4 during fill by skipping empty
overlapped cells, but keeping also the merged structure,
resulting the requested continuation of the linear sequence:
EMPTY, EMPTY, EMPTY, 6, EMPTY, 8, EMPTY
Note: special formats are not handled yet like date, string,
boolean and userlist.
Co-authored-by: Tibor Nagy (NISZ)
Change-Id: Ib431e8968f5d71e321b0e57cfb173534a0f5da31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103765
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 62315b51429f..7fcb3af03fc6 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1178,7 +1178,7 @@ public: * @return pointer to the double value stored in a numeric cell, or NULL * if the cell at specified position is not a numeric cell. */ - double* GetValueCell( const ScAddress& rPos ); + SC_DLLPUBLIC double* GetValueCell( const ScAddress& rPos ); SC_DLLPUBLIC svl::SharedStringPool& GetSharedStringPool(); const svl::SharedStringPool& GetSharedStringPool() const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 15a74d3fbaf8..3c2ab08e2b9c 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1115,11 +1115,15 @@ private: sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, double nStepValue, double nMaxValue, sal_uInt16 nMinDigits, - bool bAttribs, ScProgress* pProgress ); + bool bAttribs, ScProgress* pProgress, + bool bSkipOverlappedCells = false, + std::vector<sal_Int32>* pNonOverlappedCellIdx = nullptr); void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, FillCmd& rCmd, FillDateCmd& rDateCmd, double& rInc, sal_uInt16& rMinDigits, - ScUserListData*& rListData, sal_uInt16& rListIndex); + ScUserListData*& rListData, sal_uInt16& rListIndex, + bool bHasFiltered, bool& rSkipOverlappedCells, + std::vector<sal_Int32>& rNonOverlappedCellIdx ); void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress ); |