diff options
Diffstat (limited to 'sc/inc/scmatrix.hxx')
-rw-r--r-- | sc/inc/scmatrix.hxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 9857d675b7ab..b788672aa715 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -99,6 +99,7 @@ class SC_DLLPUBLIC ScMatrix mutable ULONG nRefCnt; // reference count SCSIZE nColCount; SCSIZE nRowCount; + bool mbCloneIfConst; // Whether the matrix is cloned with a CloneIfConst() call. void ResetIsString(); void DeleteIsString(); @@ -171,11 +172,19 @@ public: /** If nC*nR results in more than GetElementsMax() entries, a 1x1 matrix is created instead and a double error value (errStackOverflow) is set. Compare nC and nR with a GetDimensions() call to check. */ - ScMatrix( SCSIZE nC, SCSIZE nR) : nRefCnt(0) { CreateMatrix( nC, nR); } + ScMatrix( SCSIZE nC, SCSIZE nR) : nRefCnt(0), mbCloneIfConst(true) { CreateMatrix( nC, nR); } /** Clone the matrix. */ ScMatrix* Clone() const; + /** Clone the matrix if mbCloneIfConst (immutable) is set, otherwise + return _this_ matrix, to be assigned to a ScMatrixRef. */ + ScMatrix* CloneIfConst(); + + /** Set the matrix to (im)mutable for CloneIfConst(), only the interpreter + should do this and know the consequences. */ + inline void SetImmutable( bool bVal ) { mbCloneIfConst = bVal; } + /** * Resize the matrix to specified new dimension. Note that this operation * clears all stored values. |