1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_FORMULA_VECTORTOKEN_HXX
11 #define INCLUDED_FORMULA_VECTORTOKEN_HXX
16 #include <formula/formuladllapi.h>
17 #include <formula/token.hxx>
18 #include <rtl/ustring.h>
23 * Single unit of vector reference consists of two physical arrays.
25 * <p>If the whole data array consists of only numeric values, mpStringArray
26 * will be NULL, and NaN values in the numeric array represent empty
29 * <p>If the whole data array consists of only string values, mpNumericArray
30 * will be NULL, and NULL values in the string array represent empty
33 * <p>If the data array consists of numeric and string values, then both
34 * mpNumericArray and mpStringArray will be non-NULL, and a string cell will
35 * be represented by a non-NULL pointer value in the string array. If the
36 * string value is NULL, check the corresponding value in the numeric array.
37 * If the value in the numeric array is NaN, it's an empty cell, otherwise
38 * it's a numeric cell.</p>
40 struct FORMULA_DLLPUBLIC VectorRefArray
42 enum InitInvalid
{ Invalid
};
44 const double* mpNumericArray
;
45 rtl_uString
** mpStringArray
;
50 VectorRefArray( InitInvalid
);
51 VectorRefArray( const double* pArray
);
52 VectorRefArray( rtl_uString
** pArray
);
53 VectorRefArray( const double* pNumArray
, rtl_uString
** pStrArray
);
59 * This token represents a single cell reference in a vectorized formula
60 * calculation context.
62 class FORMULA_DLLPUBLIC SingleVectorRefToken
: public FormulaToken
64 VectorRefArray maArray
;
68 SingleVectorRefToken( const VectorRefArray
& rArray
, size_t nArrayLength
);
70 virtual FormulaToken
* Clone() const override
;
72 const VectorRefArray
& GetArray() const;
73 size_t GetArrayLength() const;
77 * This token represents a range reference in a vectorized formula
78 * calculation context.
80 class FORMULA_DLLPUBLIC DoubleVectorRefToken
: public FormulaToken
82 std::vector
<VectorRefArray
> maArrays
;
84 size_t mnArrayLength
; /// length of all arrays which does not include trailing empty region.
85 size_t mnRefRowSize
; /// original reference row size. The row size may
86 /// change as it goes down the array if either the
87 /// start or end position is fixed.
89 bool mbStartFixed
:1; /// whether or not the start row position is absolute.
90 bool mbEndFixed
:1; /// whether or not the end row position is absolute.
94 const std::vector
<VectorRefArray
>& rArrays
, size_t nArrayLength
,
95 size_t nRefRowSize
, bool bStartFixed
, bool bEndFixed
);
97 virtual FormulaToken
* Clone() const override
;
99 const std::vector
<VectorRefArray
>& GetArrays() const;
100 size_t GetArrayLength() const;
101 size_t GetRefRowSize() const;
102 bool IsStartFixed() const;
103 bool IsEndFixed() const;
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */