sc/source/core/data/table4.cxx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
New commits: commit 3931e7c05d38ee7805e2f7898d92a44c037900b5 Author: Martin van Zijl <martin.vanz...@gmail.com> AuthorDate: Thu Dec 6 10:49:25 2018 +1300 Commit: Eike Rathke <er...@redhat.com> CommitDate: Tue Jan 29 18:32:00 2019 +0100 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 <er...@redhat.com> 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); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits