summaryrefslogtreecommitdiff
path: root/sc/source/core/data/document.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-12 21:53:34 -0400
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-13 10:44:00 -0500
commit3da21555accb654a3185bdac5532304ac6ce5b34 (patch)
tree108c800066b4709efd46cda9f32ae24262d40b09 /sc/source/core/data/document.cxx
parent6293d898c16bafeb703129ed0d33857934ab1dfb (diff)
fdo#75977: Clear sheet deleted flags for affected references when undoing.
This will allow formula cells to restore deleted references when they get recalculated. With this change, SetDirty() that previosly took no argument has been renamed to SetAllFormulasDirty(), and it now takes one argument that stores context information. (cherry picked from commit 18909ddb30db7ca9416ee2bfb0503753e877f002) Conflicts: sc/inc/document.hxx sc/source/ui/docshell/docsh5.cxx sc/source/ui/view/spelldialog.cxx Change-Id: If0de5dc1737a2722b6d61a87644b10a4f921edc5 Reviewed-on: https://gerrit.libreoffice.org/8564 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/core/data/document.cxx')
-rw-r--r--sc/source/core/data/document.cxx34
1 files changed, 25 insertions, 9 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index ab39965d2863..e45bd026c7a9 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -460,8 +460,8 @@ void ScDocument::InvalidateStreamOnSave()
}
}
-bool ScDocument::InsertTab( SCTAB nPos, const OUString& rName,
- bool bExternalDocument )
+bool ScDocument::InsertTab(
+ SCTAB nPos, const OUString& rName, bool bExternalDocument, bool bUndoDeleteTab )
{
SCTAB nTabCount = static_cast<SCTAB>(maTabs.size());
bool bValid = ValidTab(nTabCount);
@@ -471,6 +471,7 @@ bool ScDocument::InsertTab( SCTAB nPos, const OUString& rName,
{
if (nPos == SC_TAB_APPEND || nPos >= nTabCount)
{
+ nPos = maTabs.size();
maTabs.push_back( new ScTable(this, nTabCount, rName) );
if ( bExternalDocument )
maTabs[nTabCount]->SetVisible( false );
@@ -538,7 +539,13 @@ bool ScDocument::InsertTab( SCTAB nPos, const OUString& rName,
}
if (bValid)
- SetDirty();
+ {
+ sc::SetFormulaDirtyContext aCxt;
+ aCxt.mbClearTabDeletedFlag = bUndoDeleteTab;
+ aCxt.mnTabDeletedStart = nPos;
+ aCxt.mnTabDeletedEnd = nPos;
+ SetAllFormulasDirty(aCxt);
+ }
return bValid;
}
@@ -625,7 +632,10 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
}
if (bValid)
- SetDirty();
+ {
+ sc::SetFormulaDirtyContext aCxt;
+ SetAllFormulasDirty(aCxt);
+ }
return bValid;
}
@@ -702,7 +712,9 @@ bool ScDocument::DeleteTab( SCTAB nTab )
for (; it != maTabs.end(); ++it)
if ( *it )
(*it)->StartAllListeners();
- SetDirty();
+
+ sc::SetFormulaDirtyContext aFormulaDirtyCxt;
+ SetAllFormulasDirty(aFormulaDirtyCxt);
}
// sheet names of references are not valid until sheet is deleted
pChartListenerCollection->UpdateScheduledSeriesRanges();
@@ -791,7 +803,9 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
for (; it != maTabs.end(); ++it)
if ( *it )
(*it)->StartAllListeners();
- SetDirty();
+
+ sc::SetFormulaDirtyContext aFormulaDirtyCxt;
+ SetAllFormulasDirty(aFormulaDirtyCxt);
}
// sheet names of references are not valid until sheet is deleted
pChartListenerCollection->UpdateScheduledSeriesRanges();
@@ -3545,7 +3559,7 @@ bool ScDocument::HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
}
-void ScDocument::SetDirty()
+void ScDocument::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
{
bool bOldAutoCalc = GetAutoCalc();
bAutoCalc = false; // keine Mehrfachberechnung
@@ -3554,7 +3568,7 @@ void ScDocument::SetDirty()
TableContainer::iterator it = maTabs.begin();
for (;it != maTabs.end(); ++it)
if (*it)
- (*it)->SetDirty();
+ (*it)->SetAllFormulasDirty(rCxt);
}
// Charts werden zwar auch ohne AutoCalc im Tracking auf Dirty gesetzt,
@@ -3660,7 +3674,9 @@ void ScDocument::CompileAll()
for (; it != maTabs.end(); ++it)
if (*it)
(*it)->CompileAll(aCxt);
- SetDirty();
+
+ sc::SetFormulaDirtyContext aFormulaDirtyCxt;
+ SetAllFormulasDirty(aFormulaDirtyCxt);
}