Kaydet (Commit) 3931e7c0 authored tarafından Martin van Zijl's avatar Martin van Zijl Kaydeden (comit) Eike Rathke

tdf#89998 set increment for percent values to 1%

Change-Id: I759f1041faa1222b0feb42e01c95166f56591e19
Reviewed-on: https://gerrit.libreoffice.org/66129
Tested-by: Jenkins
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst 0ca822c9
...@@ -367,6 +367,10 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ...@@ -367,6 +367,10 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bVal) if (bVal)
rCmd = FILL_LINEAR; 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) else if (eCellType == CELLTYPE_STRING || eCellType == CELLTYPE_EDIT)
...@@ -948,10 +952,16 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW ...@@ -948,10 +952,16 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
double nVal = aCell.mfValue; double nVal = aCell.mfValue;
if ( !(nScFillModeMouseModifier & KEY_MOD1) ) 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) == bool bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
SvNumFormatType::LOGICAL);
if (!bBooleanCell) if (!bBooleanCell)
nVal += static_cast<double>(nDelta); nVal += static_cast<double>(nDelta);
} }
...@@ -1347,6 +1357,7 @@ void ScTable::FillAutoSimple( ...@@ -1347,6 +1357,7 @@ void ScTable::FillAutoSimple(
sal_uLong nFormulaCounter = nActFormCnt; sal_uLong nFormulaCounter = nActFormCnt;
bool bGetCell = true; bool bGetCell = true;
bool bBooleanCell = false; bool bBooleanCell = false;
bool bPercentCell = false;
sal_uInt16 nCellDigits = 0; sal_uInt16 nCellDigits = 0;
short nHeadNoneTail = 0; short nHeadNoneTail = 0;
sal_Int32 nStringValue = 0; sal_Int32 nStringValue = 0;
...@@ -1378,15 +1389,19 @@ void ScTable::FillAutoSimple( ...@@ -1378,15 +1389,19 @@ void ScTable::FillAutoSimple(
FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, nIStart, nIEnd, pProgress, rProgress); FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, nIStart, nIEnd, pProgress, rProgress);
return; return;
} }
bBooleanCell = (pDocument->GetFormatTable()->GetType( const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(
aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource)) == SvNumFormatType::LOGICAL); aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource));
bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
} }
else // rInner&:=nCol, rOuter&:=nRow else // rInner&:=nCol, rOuter&:=nRow
{ {
aSrcCell = aCol[nSource].GetCellValue(rRow); aSrcCell = aCol[nSource].GetCellValue(rRow);
bBooleanCell = (pDocument->GetFormatTable()->GetType( const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(
aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow)) == SvNumFormatType::LOGICAL); aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow));
bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
} }
bGetCell = false; bGetCell = false;
...@@ -1425,6 +1440,8 @@ void ScTable::FillAutoSimple( ...@@ -1425,6 +1440,8 @@ void ScTable::FillAutoSimple(
double fVal; double fVal;
if (bBooleanCell && ((fVal = aSrcCell.mfValue) == 0.0 || fVal == 1.0)) if (bBooleanCell && ((fVal = aSrcCell.mfValue) == 0.0 || fVal == 1.0))
aCol[rCol].SetValue(rRow, aSrcCell.mfValue); 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 else
aCol[rCol].SetValue(rRow, aSrcCell.mfValue + nDelta); aCol[rCol].SetValue(rRow, aSrcCell.mfValue + nDelta);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment