LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sc / inc / calcconfig.hxx
blob57f6d38866166483b4ad8f7d3d2e130bbf78cf10
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 #pragma once
12 #include "scdllapi.h"
14 #include <memory>
15 #include <string_view>
17 #include <o3tl/sorted_vector.hxx>
18 #include <formula/grammar.hxx>
19 #include <formula/opcode.hxx>
20 #include <rtl/ustring.hxx>
22 // have to match the registry values
23 enum ScRecalcOptions
25 RECALC_ALWAYS = 0,
26 RECALC_NEVER,
27 RECALC_ASK,
30 // Env.var. SC_FORCE_CALCULATION can be used to force all calculation
31 // to be done using OpenCL or group threading (even for single cells).
32 enum ForceCalculationType
34 ForceCalculationNone, // do not force anything
35 ForceCalculationCore, // "core", use only non-threaded normal code
36 ForceCalculationOpenCL, // "opencl", force OpenCL
37 ForceCalculationThreads // "threads", force threaded code
40 /**
41 * Configuration options for formula interpreter.
43 struct SC_DLLPUBLIC ScCalcConfig
45 // from most stringent to most relaxed
46 enum class StringConversion
48 ILLEGAL, ///< =1+"1" or =1+"x" give #VALUE!
49 ZERO, ///< =1+"1" or =1+"x" give 1
50 UNAMBIGUOUS, ///< =1+"1" gives 2, but =1+"1.000" or =1+"x" give #VALUE!
51 LOCALE ///< =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE!
53 formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax;
54 StringConversion meStringConversion;
55 bool mbEmptyStringAsZero : 1;
56 bool mbHasStringRefSyntax : 1;
58 static bool isOpenCLEnabled();
59 static bool isThreadingEnabled();
60 static ForceCalculationType getForceCalculationType();
62 bool mbOpenCLSubsetOnly : 1;
63 bool mbOpenCLAutoSelect : 1;
64 OUString maOpenCLDevice;
65 sal_Int32 mnOpenCLMinimumFormulaGroupSize;
67 typedef std::shared_ptr<o3tl::sorted_vector<OpCode>> OpCodeSet;
69 OpCodeSet mpOpenCLSubsetOpCodes;
71 ScCalcConfig();
73 void setOpenCLConfigToDefault();
75 void reset();
76 void MergeDocumentSpecific(const ScCalcConfig& r);
77 void SetStringRefSyntax(formula::FormulaGrammar::AddressConvention eConv);
79 bool operator==(const ScCalcConfig& r) const;
80 bool operator!=(const ScCalcConfig& r) const;
83 OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes);
84 ScCalcConfig::OpCodeSet ScStringToOpCodeSet(std::u16string_view rOpCodes);
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */