diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-12 21:53:34 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-12 22:00:07 -0400 |
commit | 18909ddb30db7ca9416ee2bfb0503753e877f002 (patch) | |
tree | f8865f2f8b3932172fa08390adbe98c23e19d6ca /sc/inc | |
parent | c9058f25e97b58a05eb25b7b769f6406423186b6 (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.
Change-Id: If0de5dc1737a2722b6d61a87644b10a4f921edc5
Diffstat (limited to 'sc/inc')
-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 |
5 files changed, 35 insertions, 5 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 0e4c1d72abb1..de2821451499 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -60,6 +60,7 @@ class CellValues; struct RowSpan; class RowHeightContext; class CompileFormulaContext; +struct SetFormulaDirtyContext; } @@ -330,7 +331,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 82b4d2386dad..d8b4d7cdf7c6 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -75,6 +75,7 @@ class DocumentStreamAccess; class DocumentLinkManager; class CellValues; class RowHeightContext; +struct SetFormulaDirtyContext; } @@ -618,8 +619,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 ); @@ -977,7 +979,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 fd8fbdd18253..8cf0fb1d6815 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -71,6 +71,7 @@ class DocumentStreamAccess; class CellValues; class RowHeightContext; class CompileFormulaContext; +struct SetFormulaDirtyContext; } @@ -512,7 +513,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 c151cdb906fa..312e63a5584a 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -168,6 +168,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; |