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_SC_INC_INTERPRETERCONTEXT_HXX
11 #define INCLUDED_SC_INC_INTERPRETERCONTEXT_HXX
14 #include <formula/token.hxx>
17 #define TOKEN_CACHE_SIZE 8
20 class SvNumberFormatter
;
22 // SetNumberFormat() is not thread-safe, so calls to it need to be delayed to the main thread.
23 struct DelayedSetNumberFormat
25 SCROW mRow
; // Used only with formula groups, so column and tab do not need to be stored.
26 sal_uInt32 mnNumberFormat
;
29 struct ScInterpreterContext
31 const ScDocument
& mrDoc
;
32 SvNumberFormatter
* mpFormatter
;
33 size_t mnTokenCachePos
;
34 std::vector
<formula::FormulaToken
*> maTokens
;
35 std::vector
<DelayedSetNumberFormat
> maDelayedSetNumberFormat
;
37 ScInterpreterContext(const ScDocument
& rDoc
, SvNumberFormatter
* pFormatter
)
39 , mpFormatter(pFormatter
)
41 , maTokens(TOKEN_CACHE_SIZE
, nullptr)
45 ~ScInterpreterContext()
47 for (auto p
: maTokens
)
52 SvNumberFormatter
* GetFormatTable() const { return mpFormatter
; }
55 #endif // INCLUDED_SC_INC_INTERPRETERCONTEXT_HXX
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */