summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorEike Rathke [er] <eike.rathke@oracle.com>2010-08-19 17:12:37 +0200
committerEike Rathke [er] <eike.rathke@oracle.com>2010-08-19 17:12:37 +0200
commite050b9bc7c26f58d9fcd4c261909249e0522f9df (patch)
treeb1ea133ada1a284c3bcd3ad808a8783404ed1a96 /sc/inc
parent20cd7f058892c76c9d794c6ff0a776ced306b34d (diff)
calc58: #i113879# add ScMatrix::CloneIfConst() and regard only temporary matrices created by the interpreter as mutable
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/scmatrix.hxx11
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.