Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / interpretercontext.hxx
blob8b920472fb44e26eba3327df58a314d7c711b1a2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_SC_INC_INTERPRETERCONTEXT_HXX
11 #define INCLUDED_SC_INC_INTERPRETERCONTEXT_HXX
13 #include <vector>
14 #include <formula/token.hxx>
15 #include "types.hxx"
17 #define TOKEN_CACHE_SIZE 8
19 class ScDocument;
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)
38 : mrDoc(rDoc)
39 , mpFormatter(pFormatter)
40 , mnTokenCachePos(0)
41 , maTokens(TOKEN_CACHE_SIZE, nullptr)
45 ~ScInterpreterContext()
47 for (auto p : maTokens)
48 if (p)
49 p->DecRef();
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: */