summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei@libreoffice.org>2023-09-29 17:45:14 -0400
committerKohei Yoshida <kohei@libreoffice.org>2023-09-30 00:52:06 +0200
commitcba8c933d1ff2e31ec55544f46d6fff99e8a5ccd (patch)
treea9f8e7c051f06fba4739d445a0875387ea4566f0
parent77243143dfe8c462a3e4e74a1f5a8a1e58046635 (diff)
Set grammar type to gnumeric before loading the content
Without this, the document model side would not know what grammer to use to parse formula expressions. Change-Id: I7e921f9c0f9b088fb98fe126ad4a84db006c8747 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157413 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
-rw-r--r--external/liborcus/UnpackedTarball_liborcus.mk1
-rw-r--r--external/liborcus/gnumeric-set-grammar.patch.117
2 files changed, 18 insertions, 0 deletions
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
index b8c44479765b..292435dfd00d 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/libtool.patch.0 \
external/liborcus/liborcus_newline.patch.1 \
external/liborcus/msvc-int-narrowing.patch.1 \
+ external/liborcus/gnumeric-set-grammar.patch.1 \
))
ifeq ($(OS),WNT)
diff --git a/external/liborcus/gnumeric-set-grammar.patch.1 b/external/liborcus/gnumeric-set-grammar.patch.1
new file mode 100644
index 000000000000..42bc46177737
--- /dev/null
+++ b/external/liborcus/gnumeric-set-grammar.patch.1
@@ -0,0 +1,17 @@
+diff --git a/src/liborcus/orcus_gnumeric.cpp b/src/liborcus/orcus_gnumeric.cpp
+index 76c13682..849759ba 100644
+--- a/src/liborcus/orcus_gnumeric.cpp
++++ b/src/liborcus/orcus_gnumeric.cpp
+@@ -144,6 +144,12 @@ void orcus_gnumeric::read_stream(std::string_view stream)
+ if (!decompress_gzip(stream.data(), stream.size(), file_content))
+ return;
+
++ if (auto* gs = mp_impl->mp_factory->get_global_settings(); gs)
++ {
++ gs->set_origin_date(1899, 12, 30);
++ gs->set_default_formula_grammar(spreadsheet::formula_grammar_t::gnumeric);
++ }
++
+ mp_impl->read_content_xml(file_content, get_config());
+ mp_impl->mp_factory->finalize();
+ }