external/liborcus/UnpackedTarball_liborcus.mk  |    1 +
 external/liborcus/gnumeric-set-grammar.patch.1 |   17 +++++++++++++++++
 2 files changed, 18 insertions(+)

New commits:
commit cba8c933d1ff2e31ec55544f46d6fff99e8a5ccd
Author:     Kohei Yoshida <ko...@libreoffice.org>
AuthorDate: Fri Sep 29 17:45:14 2023 -0400
Commit:     Kohei Yoshida <ko...@libreoffice.org>
CommitDate: Sat Sep 30 00:52:06 2023 +0200

    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 <ko...@libreoffice.org>

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();
+ }

Reply via email to