[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sc/inc sc/source
Eike Rathke
erack at redhat.com
Tue Nov 25 11:56:12 PST 2014
sc/inc/column.hxx | 12 +++++++-----
sc/source/core/data/column4.cxx | 10 ++++++----
sc/source/core/data/table3.cxx | 3 ++-
3 files changed, 15 insertions(+), 10 deletions(-)
New commits:
commit d1d41626387391d72c0e495a43b6190e6d0fec02
Author: Eike Rathke <erack at redhat.com>
Date: Mon Nov 17 22:44:56 2014 +0100
fdo#83765 do not update references in SortReorderByColumn() if disabled
Similar to SortReorderByRow()
(cherry picked from commit 115a4b7ca36f65d93070d2e81048320d202e87a3)
Conflicts:
sc/inc/column.hxx
Change-Id: I39f8d62b79994196b9c5933355dbbc66a5f60a5d
Reviewed-on: https://gerrit.libreoffice.org/13113
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
Tested-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 8f8a93c..097c377 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -584,18 +584,20 @@ public:
/**
* Reset column position of formula cells within specified row range.
- * Reference positions are also adjusted to reflect the new position so
- * that the formula cells still reference the same cells or ranges after
- * the the position change. The position of a formula cell before the
- * call is interpreted as the old position of that cell.
+ * If bUpdateRefs==true then reference positions are also adjusted to
+ * reflect the new position so that the formula cells still reference the
+ * same cells or ranges after the the position change.
+ * The position of a formula cell before the call is interpreted as the old
+ * position of that cell.
*
* Caller needs to ensure that no formula groups cross the top and bottom
* row boundaries.
*
* @param nRow1 top row boundary
* @param nRow2 bottom row boundary
+ * @param bUpdateRefs whether to adjust references
*/
- void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2 );
+ void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs );
void SplitFormulaGroupByRelativeRef( const ScRange& rBoundRange );
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 93fca48..c1cf89e 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -856,8 +856,9 @@ namespace {
class FormulaColPosSetter
{
SCCOL mnCol;
+ bool mbUpdateRefs;
public:
- FormulaColPosSetter( SCCOL nCol ) : mnCol(nCol) {}
+ FormulaColPosSetter( SCCOL nCol, bool bUpdateRefs ) : mnCol(nCol), mbUpdateRefs(bUpdateRefs) {}
void operator() ( size_t nRow, ScFormulaCell* pCell )
{
@@ -868,7 +869,8 @@ public:
ScAddress aOldPos = pCell->aPos;
pCell->aPos.SetCol(mnCol);
pCell->aPos.SetRow(nRow);
- pCell->GetCode()->AdjustReferenceOnMovedOrigin(aOldPos, pCell->aPos);
+ if (mbUpdateRefs)
+ pCell->GetCode()->AdjustReferenceOnMovedOrigin(aOldPos, pCell->aPos);
}
else
{
@@ -880,9 +882,9 @@ public:
}
-void ScColumn::ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2 )
+void ScColumn::ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs )
{
- FormulaColPosSetter aFunc(nCol);
+ FormulaColPosSetter aFunc(nCol, bUpdateRefs);
sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aFunc);
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index af9793d..3b02d62 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -718,8 +718,9 @@ void ScTable::SortReorderByColumn(
}
// Reset formula cell positions which became out-of-sync after column reordering.
+ bool bUpdateRefs = pArray->IsUpdateRefs();
for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
- aCol[nCol].ResetFormulaCellPositions(nRow1, nRow2);
+ aCol[nCol].ResetFormulaCellPositions(nRow1, nRow2, bUpdateRefs);
// Set up column reorder map (for later broadcasting of reference updates).
sc::ColRowReorderMapType aColMap;
More information about the Libreoffice-commits
mailing list