diff options
author | Martin van Zijl <martin.vanzijl@gmail.com> | 2018-12-06 10:49:25 +1300 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2019-01-29 18:32:00 +0100 |
commit | 3931e7c05d38ee7805e2f7898d92a44c037900b5 (patch) | |
tree | 6aee14d3d8b11138b548805af0e6106e8af25f29 /sc | |
parent | 0ca822c95a21c22f5118b16a5da5761f58fa38cc (diff) |
tdf#89998 set increment for percent values to 1%
Change-Id: I759f1041faa1222b0feb42e01c95166f56591e19
Reviewed-on: https://gerrit.libreoffice.org/66129
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table4.cxx | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index b01df1402c74..d2a8fb845011 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -367,6 +367,10 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bVal) rCmd = FILL_LINEAR; } + else if(nFormatType == SvNumFormatType::PERCENT) + { + rInc = 0.01; // tdf#89998 increment by 1% at a time + } } } else if (eCellType == CELLTYPE_STRING || eCellType == CELLTYPE_EDIT) @@ -948,10 +952,16 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW double nVal = aCell.mfValue; if ( !(nScFillModeMouseModifier & KEY_MOD1) ) { - if (nVal == 0.0 || nVal == 1.0) + const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(nNumFmt); + bool bPercentCell = (nFormatType == SvNumFormatType::PERCENT); + if (bPercentCell) + { + // tdf#89998 increment by 1% at a time + nVal += static_cast<double>(nDelta) * 0.01; + } + else if (nVal == 0.0 || nVal == 1.0) { - bool bBooleanCell = (pDocument->GetFormatTable()->GetType( nNumFmt) == - SvNumFormatType::LOGICAL); + bool bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); if (!bBooleanCell) nVal += static_cast<double>(nDelta); } @@ -1347,6 +1357,7 @@ void ScTable::FillAutoSimple( sal_uLong nFormulaCounter = nActFormCnt; bool bGetCell = true; bool bBooleanCell = false; + bool bPercentCell = false; sal_uInt16 nCellDigits = 0; short nHeadNoneTail = 0; sal_Int32 nStringValue = 0; @@ -1378,15 +1389,19 @@ void ScTable::FillAutoSimple( FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, nIStart, nIEnd, pProgress, rProgress); return; } - bBooleanCell = (pDocument->GetFormatTable()->GetType( - aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource)) == SvNumFormatType::LOGICAL); + const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType( + aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource)); + bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); + bPercentCell = (nFormatType == SvNumFormatType::PERCENT); } else // rInner&:=nCol, rOuter&:=nRow { aSrcCell = aCol[nSource].GetCellValue(rRow); - bBooleanCell = (pDocument->GetFormatTable()->GetType( - aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow)) == SvNumFormatType::LOGICAL); + const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType( + aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow)); + bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); + bPercentCell = (nFormatType == SvNumFormatType::PERCENT); } bGetCell = false; @@ -1425,6 +1440,8 @@ void ScTable::FillAutoSimple( double fVal; if (bBooleanCell && ((fVal = aSrcCell.mfValue) == 0.0 || fVal == 1.0)) aCol[rCol].SetValue(rRow, aSrcCell.mfValue); + else if(bPercentCell) + aCol[rCol].SetValue(rRow, aSrcCell.mfValue + nDelta * 0.01); // tdf#89998 increment by 1% at a time else aCol[rCol].SetValue(rRow, aSrcCell.mfValue + nDelta); } |