diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 11:47:06 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 11:47:06 +0000 |
commit | 8ceff95c69cf9bd9ff5ab3a4b5689925b8bd6a59 (patch) | |
tree | ca2b0cc4fba88107f5f6e740285184a061011866 /sc/inc | |
parent | Adding debian version 4:24.2.3-2. (diff) | |
download | libreoffice-8ceff95c69cf9bd9ff5ab3a4b5689925b8bd6a59.tar.xz libreoffice-8ceff95c69cf9bd9ff5ab3a4b5689925b8bd6a59.zip |
Merging upstream version 4:24.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/column.hxx | 2 | ||||
-rw-r--r-- | sc/inc/interpretercontext.hxx | 51 | ||||
-rw-r--r-- | sc/inc/patattr.hxx | 2 |
3 files changed, 37 insertions, 18 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 733923b0f5..69850197bd 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -984,7 +984,7 @@ inline const SfxPoolItem& ScColumnData::GetAttr( SCROW nRow, sal_uInt16 nWhich, inline sal_uInt32 ScColumnData::GetNumberFormat( const ScInterpreterContext& rContext, SCROW nRow ) const { - return pAttrArray->GetPattern( nRow )->GetNumberFormat( rContext.GetFormatTable() ); + return pAttrArray->GetPattern( nRow )->GetNumberFormat( rContext ); } inline void ScColumn::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex ) 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; diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index d6536551f9..e4b149516c 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -31,6 +31,7 @@ namespace vcl { class Font; } namespace model { class ComplexColor; } +struct ScInterpreterContext; class OutputDevice; class Fraction; class ScStyleSheet; @@ -171,6 +172,7 @@ public: bool IsSymbolFont() const; sal_uInt32 GetNumberFormat( SvNumberFormatter* ) const; + sal_uInt32 GetNumberFormat( const ScInterpreterContext& rContext ) const; sal_uInt32 GetNumberFormat( SvNumberFormatter* pFormatter, const SfxItemSet* pCondSet ) const; |