[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Jul 8 12:29:50 PDT 2013
sc/inc/column.hxx | 3 ++
sc/source/core/data/column.cxx | 51 +++++++++++++++++++++--------------------
2 files changed, 30 insertions(+), 24 deletions(-)
New commits:
commit a448c8e7ff13b16be8b6a5ce23080fd9215e0c1e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Jul 8 15:29:40 2013 -0400
Make update ref on copy a separate method.
Change-Id: I95cb42845535532fca5622d8d4f8b394ff22d4d3
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6bbfb6a..37f67d5 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -310,6 +310,9 @@ public:
void ResetChanged( SCROW nStartRow, SCROW nEndRow );
+ bool UpdateReferenceOnCopy(
+ const ScRange& rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, ScDocument* pUndoDoc = NULL );
+
/**
* Update reference addresses in formula cell in response to mass cell
* movement.
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index fad7edd..4372688 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1991,8 +1991,7 @@ void ScColumn::CopyScenarioFrom( const ScColumn& rSrcCol )
// UpdateUsed not needed, already done in TestCopyScenario (obsolete comment ?)
SCsTAB nDz = nTab - rSrcCol.nTab;
- UpdateReference(
- URM_COPY, ScRange(nCol, nStart, nTab, nCol, nEnd, nTab), 0, 0, nDz, NULL);
+ UpdateReferenceOnCopy(ScRange(nCol, nStart, nTab, nCol, nEnd, nTab), 0, 0, nDz, NULL);
UpdateCompile();
}
@@ -2020,8 +2019,8 @@ void ScColumn::CopyScenarioTo( ScColumn& rDestCol ) const
// UpdateUsed not needed, is already done in TestCopyScenario (obsolete comment ?)
SCsTAB nDz = rDestCol.nTab - nTab;
- rDestCol.UpdateReference(
- URM_COPY, ScRange(rDestCol.nCol, nStart, rDestCol.nTab, rDestCol.nCol, nEnd, rDestCol.nTab),
+ rDestCol.UpdateReferenceOnCopy(
+ ScRange(rDestCol.nCol, nStart, rDestCol.nTab, rDestCol.nCol, nEnd, rDestCol.nTab),
0, 0, nDz, NULL);
rDestCol.UpdateCompile();
}
@@ -2261,32 +2260,36 @@ public:
}
-bool ScColumn::UpdateReference(
- UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- ScDocument* pUndoDoc )
+bool ScColumn::UpdateReferenceOnCopy(
+ const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, ScDocument* pUndoDoc )
{
- if (eUpdateRefMode == URM_COPY)
- {
- // When copying, the range equals the destination range where cells
- // are pasted, and the dx, dy, dz refer to the distance from the
- // source range.
+ // When copying, the range equals the destination range where cells
+ // are pasted, and the dx, dy, dz refer to the distance from the
+ // source range.
- UpdateRefOnCopy aHandler(rRange, nDx, nDy, nDz, pUndoDoc);
- sc::CellStoreType::position_type aPos = maCells.position(rRange.aStart.Row());
- sc::ProcessBlock(aPos.first, maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row());
+ UpdateRefOnCopy aHandler(rRange, nDx, nDy, nDz, pUndoDoc);
+ sc::CellStoreType::position_type aPos = maCells.position(rRange.aStart.Row());
+ sc::ProcessBlock(aPos.first, maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row());
- // The formula groups at the top and bottom boundaries are expected to
- // have been split prior to this call. Here, we only do the joining.
+ // The formula groups at the top and bottom boundaries are expected to
+ // have been split prior to this call. Here, we only do the joining.
+ JoinFormulaCellAbove(aPos);
+ if (rRange.aEnd.Row() < MAXROW)
+ {
+ aPos = maCells.position(aPos.first, rRange.aEnd.Row()+1);
JoinFormulaCellAbove(aPos);
- if (rRange.aEnd.Row() < MAXROW)
- {
- aPos = maCells.position(aPos.first, rRange.aEnd.Row()+1);
- JoinFormulaCellAbove(aPos);
- }
-
- return aHandler.isUpdated();
}
+ return aHandler.isUpdated();
+}
+
+bool ScColumn::UpdateReference(
+ UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
+ ScDocument* pUndoDoc )
+{
+ if (eUpdateRefMode == URM_COPY)
+ return UpdateReferenceOnCopy(rRange, nDx, nDy, nDz, pUndoDoc);
+
bool bThisColShifted = (rRange.aStart.Tab() <= nTab && nTab <= rRange.aEnd.Tab() && rRange.aStart.Col() <= nCol && nCol <= rRange.aEnd.Col());
if (bThisColShifted)
{
More information about the Libreoffice-commits
mailing list