diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-12 21:53:34 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-03-13 10:44:00 -0500 |
commit | 3da21555accb654a3185bdac5532304ac6ce5b34 (patch) | |
tree | 108c800066b4709efd46cda9f32ae24262d40b09 | |
parent | 6293d898c16bafeb703129ed0d33857934ab1dfb (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>
-rw-r--r-- | sc/inc/column.hxx | 3 | ||||
-rw-r--r-- | sc/inc/document.hxx | 8 | ||||
-rw-r--r-- | sc/inc/refupdatecontext.hxx | 14 | ||||
-rw-r--r-- | sc/inc/table.hxx | 3 | ||||
-rw-r--r-- | sc/inc/tokenarray.hxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 34 | ||||
-rw-r--r-- | sc/source/core/data/refupdatecontext.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 46 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocimp.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh5.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/undo/refundo.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/undo/undotab.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/spelldialog.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun4.cxx | 6 |
19 files changed, 174 insertions, 46 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 07da1ca16a89..756b4c4a1448 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -57,6 +57,7 @@ class EditTextIterator; struct NoteEntry; class DocumentStreamAccess; class CompileFormulaContext; +struct SetFormulaDirtyContext; } @@ -321,7 +322,7 @@ public: bool IsFormulaDirty( SCROW nRow ) const; - void SetDirty(); + void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt ); void SetDirty( SCROW nRow1, SCROW nRow2 ); void SetDirtyVar(); void SetDirtyAfterLoad(); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index ed2626a7e99b..9603ae5db3a3 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -73,6 +73,7 @@ struct NoteEntry; struct FormulaGroupContext; class DocumentStreamAccess; class DocumentLinkManager; +struct SetFormulaDirtyContext; } @@ -614,8 +615,9 @@ public: void SetTabNameOnLoad(SCTAB nTab, const OUString& rName); void InvalidateStreamOnSave(); - SC_DLLPUBLIC bool InsertTab( SCTAB nPos, const OUString& rName, - bool bExternalDocument = false ); + SC_DLLPUBLIC bool InsertTab( + SCTAB nPos, const OUString& rName, bool bExternalDocument = false, bool bUndoDeleteTab = false ); + SC_DLLPUBLIC bool InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames, bool bExternalDocument = false, bool bNamesValid = false ); SC_DLLPUBLIC bool DeleteTabs( SCTAB nTab, SCTAB nSheets ); @@ -975,7 +977,7 @@ public: void ResetChanged( const ScRange& rRange ); - void SetDirty(); + void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt ); void SetDirty( const ScRange& ); void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp void InterpretDirtyCells( const ScRangeList& rRanges ); diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx index c8e52d8acdf0..bd87792114ff 100644 --- a/sc/inc/refupdatecontext.hxx +++ b/sc/inc/refupdatecontext.hxx @@ -130,6 +130,20 @@ struct RefUpdateMoveTabContext SCTAB getNewTab(SCTAB nOldTab) const; }; +struct SetFormulaDirtyContext +{ + SCTAB mnTabDeletedStart; + SCTAB mnTabDeletedEnd; + + /** + * When true, go through all reference tokens and clears "sheet deleted" + * flag if its corresponding index falls within specified sheet range. + */ + bool mbClearTabDeletedFlag; + + SetFormulaDirtyContext(); +}; + } #endif diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 4aab32e5d298..4f30caeb4398 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -69,6 +69,7 @@ struct RefUpdateMoveTabContext; struct NoteEntry; class DocumentStreamAccess; class CompileFormulaContext; +struct SetFormulaDirtyContext; } @@ -509,7 +510,7 @@ public: void ResetChanged( const ScRange& rRange ); - void SetDirty(); + void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt ); void SetDirty( const ScRange& ); void SetDirtyAfterLoad(); void SetDirtyVar(); diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index b8aec07b2354..5f04a9ab41c7 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -169,6 +169,18 @@ public: sc::RefUpdateResult AdjustReferenceOnMovedTab( sc::RefUpdateMoveTabContext& rCxt, const ScAddress& rOldPos ); + /** + * Clear sheet deleted flag from internal reference tokens if the sheet + * index falls within specified range. Note that when a reference is on a + * sheet that's been deleted, its referenced sheet index retains the + * original index of the deleted sheet. + * + * @param rPos position of formula cell + * @param nStartTab index of first sheet, inclusive. + * @param nEndTab index of last sheet, inclusive. + */ + void ClearTabDeleted( const ScAddress& rPos, SCTAB nStartTab, SCTAB nEndTab ); + void CheckRelativeReferenceBounds( const sc::RefUpdateContext& rCxt, const ScAddress& rPos, SCROW nGroupLen, std::vector<SCROW>& rBounds ) const; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index e573defa3087..2bcc710b8bf4 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2958,11 +2958,23 @@ struct SetDirtyVarHandler class SetDirtyHandler { ScDocument& mrDoc; + const sc::SetFormulaDirtyContext& mrCxt; public: - SetDirtyHandler(ScDocument& rDoc) : mrDoc(rDoc) {} + SetDirtyHandler( ScDocument& rDoc, const sc::SetFormulaDirtyContext& rCxt ) : + mrDoc(rDoc), mrCxt(rCxt) {} void operator() (size_t /*nRow*/, ScFormulaCell* p) { + if (mrCxt.mbClearTabDeletedFlag) + { + if (!p->IsShared() || p->IsSharedTop()) + { + ScTokenArray* pCode = p->GetCode(); + pCode->ClearTabDeleted( + p->aPos, mrCxt.mnTabDeletedStart, mrCxt.mnTabDeletedEnd); + } + } + p->SetDirtyVar(); if (!mrDoc.IsInFormulaTree(p)) mrDoc.PutInFormulaTree(p); @@ -3353,11 +3365,11 @@ bool ScColumn::IsFormulaDirty( SCROW nRow ) const return p->GetDirty(); } -void ScColumn::SetDirty() +void ScColumn::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt ) { // is only done documentwide, no FormulaTracking sc::AutoCalcSwitch aSwitch(*pDocument, false); - SetDirtyHandler aFunc(*pDocument); + SetDirtyHandler aFunc(*pDocument, rCxt); sc::ProcessFormula(maCells, aFunc); } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index d027bb49f9d2..87e75102717f 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -790,7 +790,9 @@ bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress ) (*it)->StartAllListeners(); // sheet names of references may not be valid until sheet is moved pChartListenerCollection->UpdateScheduledSeriesRanges(); - SetDirty(); + + sc::SetFormulaDirtyContext aFormulaDirtyCxt; + SetAllFormulasDirty(aFormulaDirtyCxt); if (pDrawLayer) DrawMovePage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) ); @@ -914,7 +916,8 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM pNewList->UpdateReference(aRefCxt); maTabs[nNewPos]->SetCondFormList( pNewList ); - SetDirty(); + sc::SetFormulaDirtyContext aCxt; + SetAllFormulasDirty(aCxt); if (pDrawLayer) DrawCopyPage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index e76b78ccd7dd..b2efbdfe858f 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -803,11 +803,11 @@ void ScDocument::CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario maTabs[nSrcTab]->SetActiveScenario(true); // da kommt's her... if (!bNewScenario) // Daten aus dem ausgewaehlten Szenario kopieren { - bool bOldAutoCalc = GetAutoCalc(); - SetAutoCalc( false ); // Mehrfachberechnungen vermeiden + sc::AutoCalcSwitch aACSwitch(*this, false); maTabs[nSrcTab]->CopyScenarioTo( maTabs[nDestTab] ); - SetDirty(); - SetAutoCalc( bOldAutoCalc ); + + sc::SetFormulaDirtyContext aCxt; + SetAllFormulasDirty(aCxt); } } } 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); } diff --git a/sc/source/core/data/refupdatecontext.cxx b/sc/source/core/data/refupdatecontext.cxx index ca550d179902..8bf52985953d 100644 --- a/sc/source/core/data/refupdatecontext.cxx +++ b/sc/source/core/data/refupdatecontext.cxx @@ -94,6 +94,9 @@ SCTAB RefUpdateMoveTabContext::getNewTab(SCTAB nOldTab) const return nOldTab + 1; } +SetFormulaDirtyContext::SetFormulaDirtyContext() : + mnTabDeletedStart(-1), mnTabDeletedEnd(-1), mbClearTabDeletedFlag(false) {} + } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 7d49a0026d14..076087fda883 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1651,13 +1651,12 @@ void ScTable::SetDirtyVar() } -void ScTable::SetDirty() +void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt ) { - bool bOldAutoCalc = pDocument->GetAutoCalc(); - pDocument->SetAutoCalc( false ); // Mehrfachberechnungen vermeiden + sc::AutoCalcSwitch aACSwitch(*pDocument, false); + for (SCCOL i=0; i<=MAXCOL; i++) - aCol[i].SetDirty(); - pDocument->SetAutoCalc( bOldAutoCalc ); + aCol[i].SetAllFormulasDirty(rCxt); } diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index ec323de2f6c7..2b03db3e7795 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3198,6 +3198,52 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMovedTab( sc::RefUpdateMoveTa namespace { +void clearTabDeletedFlag( ScSingleRefData& rRef, const ScAddress& rPos, SCTAB nStartTab, SCTAB nEndTab ) +{ + if (!rRef.IsTabDeleted()) + return; + + ScAddress aAbs = rRef.toAbs(rPos); + if (nStartTab <= aAbs.Tab() && aAbs.Tab() <= nEndTab) + rRef.SetTabDeleted(false); +} + +} + +void ScTokenArray::ClearTabDeleted( const ScAddress& rPos, SCTAB nStartTab, SCTAB nEndTab ) +{ + if (nEndTab < nStartTab) + return; + + FormulaToken** p = pCode; + FormulaToken** pEnd = p + static_cast<size_t>(nLen); + for (; p != pEnd; ++p) + { + switch ((*p)->GetType()) + { + case svSingleRef: + { + ScToken* pToken = static_cast<ScToken*>(*p); + ScSingleRefData& rRef = pToken->GetSingleRef(); + clearTabDeletedFlag(rRef, rPos, nStartTab, nEndTab); + } + break; + case svDoubleRef: + { + ScToken* pToken = static_cast<ScToken*>(*p); + ScComplexRefData& rRef = pToken->GetDoubleRef(); + clearTabDeletedFlag(rRef.Ref1, rPos, nStartTab, nEndTab); + clearTabDeletedFlag(rRef.Ref2, rPos, nStartTab, nEndTab); + } + break; + default: + ; + } + } +} + +namespace { + void checkBounds( const sc::RefUpdateContext& rCxt, const ScAddress& rPos, SCROW nGroupLen, const ScSingleRefData& rRef, std::vector<SCROW>& rBounds) diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 033ab00612ba..0f4a55587e62 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -53,6 +53,7 @@ #include "hints.hxx" #include "miscuno.hxx" #include "chgtrack.hxx" +#include <refupdatecontext.hxx> using namespace com::sun::star; @@ -626,7 +627,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, pUndoDoc, pRedoDoc, pUndoDBData, pRedoDBData ) ); } - pDoc->SetDirty(); + sc::SetFormulaDirtyContext aCxt; + pDoc->SetAllFormulasDirty(aCxt); rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID); aModificator.SetDocumentModified(); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index a6420921077d..bfc94db4e381 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -121,6 +121,7 @@ #include "orcusfilters.hxx" #include <datastream.hxx> #include <documentlinkmgr.hxx> +#include <refupdatecontext.hxx> #include <config_telepathy.h> @@ -1207,7 +1208,8 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) bRet = aImpEx.ImportStream( *pInStream, rMedium.GetBaseURL() ); eError = bRet ? eERR_OK : SCERR_IMPORT_CONNECT; aDocument.StartAllListeners(); - aDocument.SetDirty(); + sc::SetFormulaDirtyContext aCxt; + aDocument.SetAllFormulasDirty(aCxt); bOverflowRow = aImpEx.IsOverflowRow(); bOverflowCol = aImpEx.IsOverflowCol(); bOverflowCell = aImpEx.IsOverflowCell(); @@ -1325,7 +1327,8 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) bRet = aImpEx.ImportStream( *pInStream, rMedium.GetBaseURL(), SOT_FORMATSTR_ID_SYLK ); eError = bRet ? eERR_OK : SCERR_IMPORT_UNKNOWN; aDocument.StartAllListeners(); - aDocument.SetDirty(); + sc::SetFormulaDirtyContext aCxt; + aDocument.SetAllFormulasDirty(aCxt); } else { @@ -1379,7 +1382,8 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) else bRet = sal_True; aDocument.StartAllListeners(); - aDocument.SetDirty(); + sc::SetFormulaDirtyContext aCxt; + aDocument.SetAllFormulasDirty(aCxt); bSetColWidths = sal_True; bSetRowHeights = sal_True; } @@ -1430,7 +1434,9 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) else bRet = sal_True; aDocument.StartAllListeners(); - aDocument.SetDirty(); + + sc::SetFormulaDirtyContext aCxt; + aDocument.SetAllFormulasDirty(aCxt); } else { diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 9ad746df0823..ee63dcf16d6a 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -47,6 +47,7 @@ #include "waitoff.hxx" #include "sizedev.hxx" #include "clipparam.hxx" +#include <refupdatecontext.hxx> // defined in docfunc.cxx void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, const OUString& sModuleName, const OUString& sModuleSource ); @@ -686,7 +687,9 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, sal_Bool bRecor } aDocument.CopyScenario( nSrcTab, nTab ); - aDocument.SetDirty(); + + sc::SetFormulaDirtyContext aCxt; + aDocument.SetAllFormulasDirty(aCxt); // alles painten, weil in anderen Bereichen das aktive Szenario // geaendert sein kann diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx index 002a2bacea37..e489e4c72144 100644 --- a/sc/source/ui/undo/refundo.cxx +++ b/sc/source/ui/undo/refundo.cxx @@ -31,6 +31,8 @@ #include "dpobject.hxx" #include "areasave.hxx" #include "unoreflist.hxx" +#include <scopetools.hxx> +#include <refupdatecontext.hxx> ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) : pUnoRefs( NULL ) @@ -162,11 +164,11 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, sal_Bool bUndoRefFirst ) if (pDBCollection || pRangeName) { - sal_Bool bOldAutoCalc = pDoc->GetAutoCalc(); - pDoc->SetAutoCalc( false ); // Avoid multiple calculations + sc::AutoCalcSwitch aACSwitch(*pDoc, false); pDoc->CompileAll(); - pDoc->SetDirty(); - pDoc->SetAutoCalc( bOldAutoCalc ); + + sc::SetFormulaDirtyContext aCxt; + pDoc->SetAllFormulasDirty(aCxt); } if (pAreaLinks) diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index f4fce0f7e0c6..dcc570b69883 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -315,7 +315,7 @@ void ScUndoDeleteTab::Undo() unsigned int i=0; ScDocument* pDoc = pDocShell->GetDocument(); - sal_Bool bLink = false; + bool bLink = false; OUString aName; for(i=0; i<theTabs.size(); ++i) @@ -323,8 +323,8 @@ void ScUndoDeleteTab::Undo() SCTAB nTab = theTabs[i]; pRefUndoDoc->GetName( nTab, aName ); - bDrawIsInUndo = sal_True; - sal_Bool bOk = pDoc->InsertTab( nTab, aName ); + bDrawIsInUndo = true; + bool bOk = pDoc->InsertTab(nTab, aName, false, true); bDrawIsInUndo = false; if (bOk) { @@ -338,7 +338,7 @@ void ScUndoDeleteTab::Undo() pDoc->SetLink( nTab, pRefUndoDoc->GetLinkMode(nTab), pRefUndoDoc->GetLinkDoc(nTab), pRefUndoDoc->GetLinkFlt(nTab), pRefUndoDoc->GetLinkOpt(nTab), pRefUndoDoc->GetLinkTab(nTab), pRefUndoDoc->GetLinkRefreshDelay(nTab) ); - bLink = sal_True; + bLink = true; } if ( pRefUndoDoc->IsScenario(nTab) ) diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index eec312cd9971..7f5b6b9726ee 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -34,8 +34,7 @@ #include "scmod.hxx" #include "editable.hxx" #include "undoblk.hxx" - -// ============================================================================ +#include <refupdatecontext.hxx> SFX_IMPL_CHILDWINDOW_WITHID( ScSpellDialogChildWindow, SID_SPELL_DIALOG ) @@ -133,7 +132,10 @@ void ScSpellDialogChildWindow::Reset() nOldCol, nOldRow, nTab, mxUndoDoc.release(), nNewCol, nNewRow, nTab, mxRedoDoc.release(), ScConversionParam( SC_CONVERSION_SPELLCHECK ) ) ); - mpDoc->SetDirty(); + + sc::SetFormulaDirtyContext aCxt; + mpDoc->SetAllFormulasDirty(aCxt); + mpDocShell->SetDocumentModified(); } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index ab8d24203ea1..81bc251d36cb 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -65,6 +65,7 @@ #include "reffind.hxx" #include "compiler.hxx" #include "tokenarray.hxx" +#include <refupdatecontext.hxx> #include <boost/scoped_ptr.hpp> @@ -559,7 +560,10 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, sal_Boo nCol, nRow, nTab, pUndoDoc, nNewCol, nNewRow, nTab, pRedoDoc, rConvParam ) ); } - pDoc->SetDirty(); + + sc::SetFormulaDirtyContext aCxt; + pDoc->SetAllFormulasDirty(aCxt); + pDocSh->SetDocumentModified(); } else |