summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-08-26 13:52:56 +0200
committerIvo Hinkelmann <ihi@openoffice.org>2010-08-26 13:52:56 +0200
commit8c8d2a8a8f0721ebf8767ab2f0a058730d16996f (patch)
tree6e26807d786cd087d066db74deecfd6ccc6b0b35
parent9ceca79b6020bf63652012b9fe3863454be3145e (diff)
parentb07c2a4cb2b8060addbf0326970afedf62f7ecc9 (diff)
CWS-TOOLING: integrate CWS calc58
Notes
split repo tag: calc_ooo/OOO330_m6 split repo tag: calc_ooo/OOO330_m7
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx12
-rwxr-xr-xchart2/source/model/main/ChartModel.cxx1
-rw-r--r--sc/inc/scmatrix.hxx11
-rw-r--r--sc/source/core/tool/interpr1.cxx27
-rw-r--r--sc/source/core/tool/interpr4.cxx13
-rw-r--r--sc/source/core/tool/interpr5.cxx19
-rw-r--r--sc/source/core/tool/scmatrix.cxx5
7 files changed, 52 insertions, 36 deletions
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index ffe752f43a7a..779e3c32f1e7 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -827,16 +827,14 @@ bool ChartController::executeDispatch_Delete()
else
{
//remove additional shape
- uno::Reference< drawing::XShape > xShape( m_aSelection.getSelectedAdditionalShape() );
- if( xShape.is() )
+ impl_ClearSelection();
{
- impl_ClearSelection();
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( m_pDrawViewWrapper )
{
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
- if( m_pDrawViewWrapper )
- m_pDrawViewWrapper->UnmarkAll();
+ m_pDrawViewWrapper->DeleteMarked();
+ bReturn = true;
}
- bReturn = DrawModelWrapper::removeShape( xShape );
}
}
return bReturn;
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 950169395c95..5a30d97118c5 100755
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1043,6 +1043,7 @@ void SAL_CALL ChartModel::setVisualAreaSize( ::sal_Int64 nAspect, const awt::Siz
{
if( nAspect == embed::Aspects::MSOLE_CONTENT )
{
+ ControllerLockGuard aLockGuard( this );
bool bChanged =
(m_aVisualAreaSize.Width != aSize.Width ||
m_aVisualAreaSize.Height != aSize.Height);
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.
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 35c63f52a92b..1e4c02967152 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2481,22 +2481,13 @@ void ScInterpreter::ScN()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScN" );
USHORT nErr = nGlobalError;
nGlobalError = 0;
- double fVal;
- if ( GetRawStackType() == svString )
- {
- fVal = 0.0;
- Pop();
- }
- else
- {
- // Temporarily override the ConvertStringToValue() error for
- // GetCellValue() / GetCellValueOrZero()
- USHORT nSErr = mnStringNoValueError;
- mnStringNoValueError = errCellNoValue;
- fVal = GetDouble();
- mnStringNoValueError = nSErr;
- }
- if ( nGlobalError == NOTAVAILABLE || nGlobalError == errIllegalArgument )
+ // Temporarily override the ConvertStringToValue() error for
+ // GetCellValue() / GetCellValueOrZero()
+ USHORT nSErr = mnStringNoValueError;
+ mnStringNoValueError = errCellNoValue;
+ double fVal = GetDouble();
+ mnStringNoValueError = nSErr;
+ if ( nGlobalError == NOTAVAILABLE || nGlobalError == errCellNoValue )
nGlobalError = 0; // N(#NA) and N("text") are ok
if ( !nGlobalError && nErr != NOTAVAILABLE )
nGlobalError = nErr;
@@ -7108,10 +7099,6 @@ void ScInterpreter::ScText()
case svDouble:
fVal = PopDouble();
break;
- case svString:
- aStr = PopString();
- bString = true;
- break;
default:
{
FormulaTokenRef xTok( PopToken());
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 5c326001ff02..47cde7186067 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -231,6 +231,12 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertStringToValue" );
double fValue = 0.0;
+ if (mnStringNoValueError == errCellNoValue)
+ {
+ // Requested that all strings result in 0, error handled by caller.
+ SetError( mnStringNoValueError);
+ return fValue;
+ }
::rtl::OUString aStr( rStr);
rtl_math_ConversionStatus eStatus;
sal_Int32 nParseEnd;
@@ -3964,5 +3970,10 @@ StackVar ScInterpreter::Interpret()
while( maxsp-- )
(*p++)->DecRef();
- return xResult->GetType();
+ StackVar eType = xResult->GetType();
+ if (eType == svMatrix)
+ // Results are immutable in case they would be reused as input for new
+ // interpreters.
+ static_cast<ScToken*>(xResult.operator->())->GetMatrix()->SetImmutable( true);
+ return eType;
}
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index ba4322a3281a..73794cf15b2d 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -310,6 +310,9 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" );
ScMatrix* pMat = new ScMatrix( nC, nR);
pMat->SetErrorInterpreter( this);
+ // A temporary matrix is mutable and ScMatrix::CloneIfConst() returns the
+ // very matrix.
+ pMat->SetImmutable( false);
SCSIZE nCols, nRows;
pMat->GetDimensions( nCols, nRows);
if ( nCols != nC || nRows != nR )
@@ -2069,23 +2072,25 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE
{
PushIllegalArgument();
return false;
- } // if (!pMatY->IsValue(i))
- } // for ( SCSIZE i = 0; i < nCountY; i++ )
+ }
+ }
+
if ( _bLOG )
{
+ ScMatrixRef pNewY = pMatY->CloneIfConst();
for (SCSIZE nElem = 0; nElem < nCountY; nElem++)
{
- const double fVal = pMatY->GetDouble(nElem);
+ const double fVal = pNewY->GetDouble(nElem);
if (fVal <= 0.0)
{
PushIllegalArgument();
return false;
}
else
- pMatY->PutDouble(log(fVal), nElem);
- } // for (nElem = 0; nElem < nCountY; nElem++)
- } // if ( _bRKP )
-
+ pNewY->PutDouble(log(fVal), nElem);
+ }
+ pMatY = pNewY;
+ }
if (pMatX)
{
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index fbb859b64ebf..2ecc20f53405 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -81,6 +81,11 @@ ScMatrix* ScMatrix::Clone() const
return pScMat;
}
+ScMatrix* ScMatrix::CloneIfConst()
+{
+ return (mbCloneIfConst || IsEternalRef()) ? Clone() : this;
+}
+
void ScMatrix::Resize( SCSIZE nC, SCSIZE nR)
{
Clear();