[Libreoffice-commits] core.git: 3 commits - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Jan 31 18:03:39 PST 2014
sc/inc/table.hxx | 6 ++
sc/source/core/data/table4.cxx | 119 ++++++++++++++++++++++-------------------
2 files changed, 72 insertions(+), 53 deletions(-)
New commits:
commit dcca10d4e26d4602d9ac4f0b340b52c31fe086e3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Jan 31 21:06:34 2014 -0500
Special case for formula cell fill down for quicker filling.
Change-Id: Ia03aa4c042b22551deacf4d7a58c9492a0a13a66
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 16fd34f..88d1f68 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1298,7 +1298,14 @@ void ScTable::FillAutoSimple(
if ( bGetCell )
{
if (bVertical) // rInner&:=nRow, rOuter&:=nCol
+ {
aSrcCell = aCol[rCol].GetCellValue(nSource);
+ if (aSrcCell.meType == CELLTYPE_FORMULA)
+ {
+ FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, nIStart, nIEnd, pProgress, rProgress);
+ return;
+ }
+ }
else // rInner&:=nCol, rOuter&:=nRow
aSrcCell = aCol[nSource].GetCellValue(rRow);
commit 34ebbc6418e0953cd857c35e6d63a7aaae74dfda
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Jan 31 20:18:42 2014 -0500
Move this to its own method.
Change-Id: Ief8356bc8e0d3d791c97849b8b00ece4ede0b803
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 095b16e..2621d32 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -915,6 +915,12 @@ public:
static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
private:
+
+ void FillFormulaVertical(
+ const ScFormulaCell& rSrcCell,
+ SCCOLROW& rInner, SCCOL nCol, SCROW nRow1, SCROW nRow2,
+ ScProgress* pProgress, sal_uLong& rProgress );
+
void FillSeriesSimple(
ScCellValue& rSrcCell, SCCOLROW& rInner, SCCOLROW nIMin, SCCOLROW nIMax,
SCCOLROW& rCol, SCCOLROW& rRow, bool bVertical, ScProgress* pProgress, sal_uLong& rProgress );
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 71fb74c..16fd34f 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1133,6 +1133,51 @@ bool HiddenRowColumn(ScTable* pTable, SCCOLROW nRowColumn, bool bVertical, SCCOL
}
+void ScTable::FillFormulaVertical(
+ const ScFormulaCell& rSrcCell,
+ SCCOLROW& rInner, SCCOL nCol, SCROW nRow1, SCROW nRow2,
+ ScProgress* pProgress, sal_uLong& rProgress )
+{
+ bool bHidden = false;
+ SCCOLROW nHiddenLast = -1;
+
+ SCCOLROW nRowStart = -1, nRowEnd = -1;
+ std::vector<sc::RowSpan> aSpans;
+ for (rInner = nRow1; rInner <= nRow2; ++rInner)
+ {
+ if (rInner > nHiddenLast)
+ bHidden = HiddenRowColumn(this, rInner, true, nHiddenLast);
+
+ if (bHidden)
+ {
+ if (nRowStart >= 0)
+ {
+ nRowEnd = rInner - 1;
+ aSpans.push_back(sc::RowSpan(nRowStart, nRowEnd));
+ nRowStart = -1;
+ }
+ rInner = nHiddenLast;
+ continue;
+ }
+
+ if (nRowStart < 0)
+ nRowStart = rInner;
+ }
+
+ if (nRowStart >= 0)
+ {
+ nRowEnd = rInner - 1;
+ aSpans.push_back(sc::RowSpan(nRowStart, nRowEnd));
+ }
+
+ aCol[nCol].DeleteRanges(aSpans, IDF_CONTENTS, false);
+ aCol[nCol].CloneFormulaCell(rSrcCell, aSpans);
+
+ rProgress += nRow2 - nRow1 + 1;
+ if (pProgress)
+ pProgress->SetStateOnPercent(rProgress);
+}
+
void ScTable::FillSeriesSimple(
ScCellValue& rSrcCell, SCCOLROW& rInner, SCCOLROW nIMin, SCCOLROW nIMax,
SCCOLROW& rCol, SCCOLROW& rRow, bool bVertical, ScProgress* pProgress, sal_uLong& rProgress )
@@ -1146,41 +1191,8 @@ void ScTable::FillSeriesSimple(
{
case CELLTYPE_FORMULA:
{
- SCCOLROW nRowStart = -1, nRowEnd = -1;
- std::vector<sc::RowSpan> aSpans;
- for (rInner = nIMin; rInner <= nIMax; ++rInner)
- {
- if (rInner > nHiddenLast)
- bHidden = HiddenRowColumn(this, rInner, bVertical, nHiddenLast);
-
- if (bHidden)
- {
- if (nRowStart >= 0)
- {
- nRowEnd = rInner - 1;
- aSpans.push_back(sc::RowSpan(nRowStart, nRowEnd));
- nRowStart = -1;
- }
- rInner = nHiddenLast;
- continue;
- }
-
- if (nRowStart < 0)
- nRowStart = rInner;
- }
-
- if (nRowStart >= 0)
- {
- nRowEnd = rInner - 1;
- aSpans.push_back(sc::RowSpan(nRowStart, nRowEnd));
- }
-
- aCol[rCol].DeleteRanges(aSpans, IDF_CONTENTS, false);
- aCol[rCol].CloneFormulaCell(*rSrcCell.mpFormula, aSpans);
-
- rProgress += nIMax - nIMin + 1;
- if (pProgress)
- pProgress->SetStateOnPercent(rProgress);
+ FillFormulaVertical(
+ *rSrcCell.mpFormula, rInner, rCol, nIMin, nIMax, pProgress, rProgress);
}
break;
default:
commit af6116179f33c1ee714eb2b2b326d329267a0cb2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Jan 31 19:59:58 2014 -0500
Bit of a cleanup.
Change-Id: I814ab7e55119a28bd52a8da7f21c03ff44c73e33
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 09f9c78..71fb74c 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1267,7 +1267,6 @@ void ScTable::FillAutoSimple(
sal_Int32 nStringValue = 0;
OUString aValue;
ScCellValue aSrcCell;
- CellType eCellType = CELLTYPE_NONE;
bool bIsOrdinalSuffix = false;
bool bColHidden = false, bRowHidden = false;
@@ -1287,19 +1286,18 @@ void ScTable::FillAutoSimple(
if ( bGetCell )
{
if (bVertical) // rInner&:=nRow, rOuter&:=nCol
- aSrcCell = aCol[rCol].GetCellValue(static_cast<SCROW>(nSource));
+ aSrcCell = aCol[rCol].GetCellValue(nSource);
else // rInner&:=nCol, rOuter&:=nRow
- aSrcCell = aCol[nSource].GetCellValue(static_cast<SCROW>(rRow));
+ aSrcCell = aCol[nSource].GetCellValue(rRow);
bGetCell = false;
if (!aSrcCell.isEmpty())
{
- eCellType = aSrcCell.meType;
- switch (eCellType)
+ switch (aSrcCell.meType)
{
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
- if ( eCellType == CELLTYPE_STRING )
+ if (aSrcCell.meType == CELLTYPE_STRING)
aValue = aSrcCell.mpString->getString();
else
aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, pDocument);
@@ -1319,14 +1317,12 @@ void ScTable::FillAutoSimple(
}
}
}
- else
- eCellType = CELLTYPE_NONE;
}
- switch (eCellType)
+ switch (aSrcCell.meType)
{
case CELLTYPE_VALUE:
- aCol[rCol].SetValue(static_cast<SCROW>(rRow), aSrcCell.mfValue + nDelta);
+ aCol[rCol].SetValue(rRow, aSrcCell.mfValue + nDelta);
break;
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
@@ -1341,14 +1337,14 @@ void ScTable::FillAutoSimple(
if ( nHeadNoneTail < 0 )
{
setSuffixCell(
- aCol[rCol], static_cast<SCROW>(rRow),
+ aCol[rCol], rRow,
nNextValue, nCellDigits, aValue,
- eCellType, bIsOrdinalSuffix);
+ aSrcCell.meType, bIsOrdinalSuffix);
}
else
{
aStr = aValue + lcl_ValueString( nNextValue, nCellDigits );
- aCol[rCol].SetRawString(static_cast<SCROW>(rRow), aStr);
+ aCol[rCol].SetRawString(rRow, aStr);
}
}
else
@@ -1357,9 +1353,7 @@ void ScTable::FillAutoSimple(
break;
case CELLTYPE_FORMULA :
FillFormula(
- aSrcCell.mpFormula,
- static_cast<SCCOL>(rCol),
- static_cast<SCROW>(rRow), (rInner == nIEnd) );
+ aSrcCell.mpFormula, rCol, rRow, (rInner == nIEnd));
if (nFormulaCounter - nActFormCnt > nMaxFormCnt)
nMaxFormCnt = nFormulaCounter - nActFormCnt;
break;
@@ -1369,7 +1363,7 @@ void ScTable::FillAutoSimple(
}
}
- if (nSource==nISrcEnd)
+ if (nSource == nISrcEnd)
{
if ( nSource != nISrcStart )
{ // More than one source cell
@@ -1404,7 +1398,7 @@ void ScTable::FillAutoSimple(
// and even then not individually for each one
++rProgress;
- if ( pProgress && (eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT) )
+ if ( pProgress && (aSrcCell.meType == CELLTYPE_FORMULA || aSrcCell.meType == CELLTYPE_EDIT) )
pProgress->SetStateOnPercent( rProgress );
}
More information about the Libreoffice-commits
mailing list