nss: upgrade to release 3.73
[LibreOffice.git] / sc / inc / tokenstringcontext.hxx
blobb44ab8bf087da5a9bfbba00c0bf76ecdfcee453d
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_TOKENSTRINGCONTEXT_HXX
11 #define INCLUDED_SC_INC_TOKENSTRINGCONTEXT_HXX
13 #include "compiler.hxx"
15 #include <unordered_map>
17 class ScDocument;
19 namespace sc
21 /**
22 * Context for creating string from an array of formula tokens, used in
23 * ScTokenArray::CreateString(). You can re-use the same string context
24 * between multiple CreateString() calls as long as the document content is
25 * unmodified.
27 struct SC_DLLPUBLIC TokenStringContext
29 typedef std::unordered_map<sal_uInt16, OUString> IndexNameMapType;
30 typedef std::unordered_map<size_t, std::vector<OUString>> IndexNamesMapType;
31 typedef std::unordered_map<SCTAB, IndexNameMapType> TabIndexMapType;
33 formula::FormulaGrammar::Grammar meGram;
34 formula::FormulaCompiler::OpCodeMapPtr mxOpCodeMap;
35 const ScCompiler::Convention* mpRefConv;
36 OUString maErrRef;
38 std::vector<OUString> maTabNames;
39 IndexNameMapType maGlobalRangeNames;
40 TabIndexMapType maSheetRangeNames;
41 IndexNameMapType maNamedDBs;
43 std::vector<OUString> maExternalFileNames;
44 IndexNamesMapType maExternalCachedTabNames;
46 TokenStringContext(const ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram);
49 class SC_DLLPUBLIC CompileFormulaContext
51 ScDocument& mrDoc;
52 formula::FormulaGrammar::Grammar meGram;
53 std::vector<OUString> maTabNames;
55 void updateTabNames();
57 public:
58 CompileFormulaContext(ScDocument& rDoc);
59 CompileFormulaContext(ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram);
61 formula::FormulaGrammar::Grammar getGrammar() const { return meGram; }
62 void setGrammar(formula::FormulaGrammar::Grammar eGram);
64 const std::vector<OUString>& getTabNames() const { return maTabNames; }
66 ScDocument& getDoc() { return mrDoc; }
70 #endif
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */