summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-10-15 16:04:22 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-18 23:22:39 -0400
commitc30a2c4baf54696ed796a5ca0b805e8b67aaa263 (patch)
treee710fc99df96f81b0a6c445cefc921949c1dd31e
parent7586151cbea2d3b93b42a42aa8dd157e75ca4f60 (diff)
More eye-pleasing way of checking for valid vector array...
Change-Id: If2f47a7d98a4cbc9e09dc98c1bb0e11f8f889265
-rw-r--r--formula/source/core/api/vectortoken.cxx5
-rw-r--r--include/formula/vectortoken.hxx2
-rw-r--r--sc/source/core/data/formulacell.cxx4
3 files changed, 9 insertions, 2 deletions
diff --git a/formula/source/core/api/vectortoken.cxx b/formula/source/core/api/vectortoken.cxx
index 206b9c9da8e8..55ab18e27932 100644
--- a/formula/source/core/api/vectortoken.cxx
+++ b/formula/source/core/api/vectortoken.cxx
@@ -15,6 +15,11 @@ VectorRefArray::VectorRefArray() : mpNumericArray(NULL), mpStringArray(NULL) {}
VectorRefArray::VectorRefArray( const double* pArray ) : mpNumericArray(pArray), mpStringArray(NULL) {}
VectorRefArray::VectorRefArray( rtl_uString** pArray ) : mpNumericArray(NULL), mpStringArray(pArray) {}
+bool VectorRefArray::isValid() const
+{
+ return mpNumericArray || mpStringArray;
+}
+
SingleVectorRefToken::SingleVectorRefToken( const double* pArray, size_t nLength ) :
FormulaToken(svSingleVectorRef, ocPush), maArray(pArray), mnArrayLength(nLength) {}
diff --git a/include/formula/vectortoken.hxx b/include/formula/vectortoken.hxx
index 54043b114990..3b1db684a010 100644
--- a/include/formula/vectortoken.hxx
+++ b/include/formula/vectortoken.hxx
@@ -40,6 +40,8 @@ struct FORMULA_DLLPUBLIC VectorRefArray
VectorRefArray();
VectorRefArray( const double* pArray );
VectorRefArray( rtl_uString** pArray );
+
+ bool isValid() const;
};
/**
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index dfcf352145d5..9d3210481bef 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3420,7 +3420,7 @@ public:
// length.
formula::VectorRefArray aArray = mrDoc.FetchVectorRefArray(mrCxt, aRefPos, nLen);
- if (!aArray.mpNumericArray && !aArray.mpStringArray)
+ if (!aArray.isValid())
return false;
formula::SingleVectorRefToken aTok(aArray, nLen);
@@ -3488,7 +3488,7 @@ public:
{
aRefPos.SetCol(i);
formula::VectorRefArray aArray = mrDoc.FetchVectorRefArray(mrCxt, aRefPos, nArrayLength);
- if (!aArray.mpNumericArray && !aArray.mpStringArray)
+ if (!aArray.isValid())
return false;
aArrays.push_back(aArray);