summaryrefslogtreecommitdiffstats
path: root/sc/inc/calcconfig.hxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sc/inc/calcconfig.hxx
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/inc/calcconfig.hxx')
-rw-r--r--sc/inc/calcconfig.hxx88
1 files changed, 88 insertions, 0 deletions
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
new file mode 100644
index 000000000..29d926c45
--- /dev/null
+++ b/sc/inc/calcconfig.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_INC_CALCCONFIG_HXX
+#define INCLUDED_SC_INC_CALCCONFIG_HXX
+
+#include "scdllapi.h"
+
+#include <memory>
+
+#include <o3tl/sorted_vector.hxx>
+#include <formula/grammar.hxx>
+#include <formula/opcode.hxx>
+#include <rtl/ustring.hxx>
+
+// have to match the registry values
+enum ScRecalcOptions
+{
+ RECALC_ALWAYS = 0,
+ RECALC_NEVER,
+ RECALC_ASK,
+};
+
+// Env.var. SC_FORCE_CALCULATION can be used to force all calculation
+// to be done using OpenCL or group threading (even for single cells).
+enum ForceCalculationType
+{
+ ForceCalculationNone, // do not force anything
+ ForceCalculationCore, // "core", use only non-threaded normal code
+ ForceCalculationOpenCL, // "opencl", force OpenCL
+ ForceCalculationThreads // "threads", force threaded code
+};
+
+/**
+ * Configuration options for formula interpreter.
+ */
+struct SC_DLLPUBLIC ScCalcConfig
+{
+ // from most stringent to most relaxed
+ enum class StringConversion
+ {
+ ILLEGAL, ///< =1+"1" or =1+"x" give #VALUE!
+ ZERO, ///< =1+"1" or =1+"x" give 1
+ UNAMBIGUOUS, ///< =1+"1" gives 2, but =1+"1.000" or =1+"x" give #VALUE!
+ LOCALE ///< =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE!
+ };
+ formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax;
+ StringConversion meStringConversion;
+ bool mbEmptyStringAsZero:1;
+ bool mbHasStringRefSyntax:1;
+
+ static bool isOpenCLEnabled();
+ static bool isThreadingEnabled();
+ static ForceCalculationType getForceCalculationType();
+
+ bool mbOpenCLSubsetOnly:1;
+ bool mbOpenCLAutoSelect:1;
+ OUString maOpenCLDevice;
+ sal_Int32 mnOpenCLMinimumFormulaGroupSize;
+
+ typedef std::shared_ptr<o3tl::sorted_vector<OpCode>> OpCodeSet;
+
+ OpCodeSet mpOpenCLSubsetOpCodes;
+
+ ScCalcConfig();
+
+ void setOpenCLConfigToDefault();
+
+ void reset();
+ void MergeDocumentSpecific( const ScCalcConfig& r );
+ void SetStringRefSyntax( formula::FormulaGrammar::AddressConvention eConv );
+
+ bool operator== (const ScCalcConfig& r) const;
+ bool operator!= (const ScCalcConfig& r) const;
+};
+
+OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes);
+ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& rOpCodes);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */