diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 11:48:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 11:48:25 +0000 |
commit | 9c0049cfae49c8e4ddef9125a69db2ad134c10c6 (patch) | |
tree | 812a86c0eee63dfc5ace12f2622ed3ce9cd3d680 /sc/inc/interpretercontext.hxx | |
parent | Releasing progress-linux version 4:24.2.3-2~progress7.99u1. (diff) | |
download | libreoffice-9c0049cfae49c8e4ddef9125a69db2ad134c10c6.tar.xz libreoffice-9c0049cfae49c8e4ddef9125a69db2ad134c10c6.zip |
Merging upstream version 4:24.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/inc/interpretercontext.hxx')
-rw-r--r-- | sc/inc/interpretercontext.hxx | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/sc/inc/interpretercontext.hxx b/sc/inc/interpretercontext.hxx index 39d528cb6c..bc6dcf0f94 100644 --- a/sc/inc/interpretercontext.hxx +++ b/sc/inc/interpretercontext.hxx @@ -9,13 +9,16 @@ #pragma once +#include <array> #include <vector> #include <memory> +#include <i18nlangtag/lang.h> +#include <svl/numformat.hxx> #include "types.hxx" namespace formula { -class FormulaToken; +class FormulaTypedDoubleToken; } #define TOKEN_CACHE_SIZE 8 @@ -34,27 +37,13 @@ struct DelayedSetNumberFormat sal_uInt32 mnNumberFormat; }; -struct NFIndexAndFmtType -{ - sal_uInt32 nIndex; - SvNumFormatType eType : 16; - bool bIsValid : 1; - - NFIndexAndFmtType() - : nIndex(0) - , eType(static_cast<SvNumFormatType>(0)) - , bIsValid(false) - { - } -}; - class ScInterpreterContextPool; struct ScInterpreterContext { const ScDocument* mpDoc; size_t mnTokenCachePos; - std::vector<formula::FormulaToken*> maTokens; + std::vector<formula::FormulaTypedDoubleToken*> maTokens; std::vector<DelayedSetNumberFormat> maDelayedSetNumberFormat; std::unique_ptr<ScLookupCacheMap> mxScLookupCache; // cache for lookups like VLOOKUP and MATCH // Allocation cache for "aConditions" array in ScInterpreter::IterateParameterIfs() @@ -77,6 +66,8 @@ struct ScInterpreterContext SvNumFormatType GetNumberFormatType(sal_uInt32 nFIndex) const; + sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat, LanguageType eLnge) const; + private: friend class ScInterpreterContextPool; void ResetTokens(); @@ -85,7 +76,33 @@ private: void ClearLookupCache(const ScDocument* pDoc); void initFormatTable(); SvNumberFormatter* mpFormatter; - mutable NFIndexAndFmtType maNFTypeCache; + + // Some temp caches of the 4 most recent results from NumberFormatting + // lookups. + struct NFBuiltIn + { + sal_uInt64 nKey; + sal_uInt32 nFormat; + NFBuiltIn() + : nKey(SAL_MAX_UINT64) + , nFormat(SAL_MAX_UINT32) + { + } + }; + // from format+lang to builtin format + mutable std::array<NFBuiltIn, 4> maNFBuiltInCache; + struct NFType + { + sal_uInt32 nKey; + SvNumFormatType eType; + NFType() + : nKey(SAL_MAX_UINT32) + , eType(SvNumFormatType::ALL) + { + } + }; + // from format index to type + mutable std::array<NFType, 4> maNFTypeCache; }; class ScThreadedInterpreterContextGetterGuard; |