diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-29 17:51:14 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-30 23:50:01 -0400 |
commit | 1fdc310b57af7dfdb97fe336ce9a2e4d579af3f2 (patch) | |
tree | ec5ad1c108c3f83b0cc9da937e2e561dfefc6532 /sc/inc | |
parent | f77c9d5b3cb65d9c2e2417f60bec1113feac50e1 (diff) |
More on getting named range update to work.
Change-Id: Id3f2ffe6d91ae43d799182b3744a839be5e1baf6
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/rangenam.hxx | 9 | ||||
-rw-r--r-- | sc/inc/refupdatecontext.hxx | 14 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/inc/tokenarray.hxx | 4 |
5 files changed, 24 insertions, 7 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 39334eea6f58..ea2d65feba54 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1232,7 +1232,7 @@ public: SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc ); void UpdateReference( - const sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true, + sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true ); SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc, diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index e3b507e924c8..a040a6b96880 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -122,7 +122,12 @@ public: SC_DLLPUBLIC void GetSymbol( OUString& rSymbol, const ScAddress& rPos, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; void UpdateSymbol( OUStringBuffer& rBuffer, const ScAddress&, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ); - void UpdateReference( const sc::RefUpdateContext& rCxt, bool bLocal = false ); + + /** + * @param nLocalTab sheet index where this name belongs, or -1 for global + * name. + */ + void UpdateReference( sc::RefUpdateContext& rCxt, SCTAB nLocalTab = -1 ); bool IsModified() const { return bModified; } SC_DLLPUBLIC void GuessPosition(); @@ -183,7 +188,7 @@ public: SC_DLLPUBLIC ScRangeData* findByUpperName(const OUString& rName); SC_DLLPUBLIC const ScRangeData* findByUpperName(const OUString& rName) const; SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i) const; - void UpdateReference(const sc::RefUpdateContext& rCxt, bool bLocal = false); + void UpdateReference( sc::RefUpdateContext& rCxt, SCTAB nLocalTab = -1 ); void UpdateTabRef(SCTAB nTable, ScRangeData::TabRefUpdateMode eMode, SCTAB nNewTable = 0, SCTAB nNewSheets = 1); void UpdateTranspose(const ScRange& rSource, const ScAddress& rDest); void UpdateGrow(const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY); diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx index af478510d89e..6bb4e73aa2d4 100644 --- a/sc/inc/refupdatecontext.hxx +++ b/sc/inc/refupdatecontext.hxx @@ -13,12 +13,18 @@ #include "global.hxx" #include "address.hxx" +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> + class ScDocument; namespace sc { struct RefUpdateContext { + typedef boost::unordered_set<sal_uInt16> NameIndicesType; + typedef boost::unordered_map<SCTAB, NameIndicesType> UpdatedNamesType; + ScDocument& mrDoc; /** @@ -42,16 +48,24 @@ struct RefUpdateContext /** Amount and direction of movement in the sheet direction. */ SCTAB mnTabDelta; + /** All named expressions that have been updated during this reference + * update run. */ + UpdatedNamesType maUpdatedNames; + RefUpdateContext(ScDocument& rDoc); bool isInserted() const; bool isDeleted() const; + + void setUpdatedName(SCTAB nTab, sal_uInt16 nIndex); + bool isNameUpdated(SCTAB nTab, sal_uInt16 nIndex) const; }; struct RefUpdateResult { bool mbValueChanged; bool mbReferenceModified; + bool mbNameModified; RefUpdateResult(); RefUpdateResult(const RefUpdateResult& r); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 2ce8cacffc00..14c68ec064aa 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -502,7 +502,7 @@ public: bool CompileErrorCells(sal_uInt16 nErrCode); void UpdateReference( - const sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL, + sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true ); void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index 71d8c7aa442f..54bd2fb1e203 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -136,13 +136,11 @@ public: * Adjust all references in named expression. In named expression, we only * update absolute positions, and leave relative positions intact. * - * Also, there is no such thing as the base position in named expressions. - * * @param rCxt context that stores details of shifted region * * @return update result. */ - sc::RefUpdateResult AdjustReferenceInName( const sc::RefUpdateContext& rCxt ); + sc::RefUpdateResult AdjustReferenceInName( const sc::RefUpdateContext& rCxt, const ScAddress& rPos ); /** * Adjust all references on sheet deletion. |