File 0001-Upgrade-mdds-to-3.0.0-and-liborcus-to-0.20.0.patch of Package collaboraoffice
From 0e43e41b7ab34fd1eb01d97757547f217277d75a Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei@libreoffice.org>
Date: Sat, 8 Feb 2025 11:40:28 -0500
Subject: [PATCH] Upgrade mdds to 3.0.0 and liborcus to 0.20.0
The portion of this change related to the mdds upgrade has been done by Xisco
Fauli via https://gerrit.libreoffice.org/c/core/+/180862
mdds 3.0.0
* external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 is fixed upstream
* external/mdds/use-after-free.patch is fixed upstream
Downloaded from https://gitlab.com/api/v4/projects/mdds%2Fmdds/packages/generic/source/3.0.0/mdds-3.0.0.tar.xz
liborcus 0.20.0
* Pick up superscript and subscript text attributes.
* Update the import of the font underline attributes as well as the
strikethrough attributes applied to the cells.
* Pick up the underline and strikethrough attributes in rich text
strings.
* Implementation for the previous auto filter interface has been
removed for now.
Downloaded from https://gitlab.com/api/v4/projects/orcus%2Forcus/packages/generic/source/0.20.0/liborcus-0.20.0.tar.xz
Change-Id: I93f6e5ab961d707a2bae03a4eca1466c541f086e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181282
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
---
RepositoryExternal.mk | 4 +-
configure.ac | 4 +-
download.lst | 8 +-
.../libetonyek/UnpackedTarball_libetonyek.mk | 1 +
external/libetonyek/mdds3.0.patch.1 | 13 +
external/liborcus/ExternalPackage_liborcus.mk | 8 +-
external/liborcus/ExternalProject_liborcus.mk | 4 +-
external/liborcus/Library_orcus.mk | 20 +-
external/liborcus/UnpackedTarball_liborcus.mk | 2 +
external/liborcus/enum-labels.patch | 47 ++
external/liborcus/styles-element-rules.patch | 42 ++
...1-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 | 62 --
external/mdds/UnpackedTarball_mdds.mk | 2 -
.../gcc-12-silence-use-after-free.patch.1 | 8 +-
external/mdds/use-after-free.patch | 12 -
sc/inc/fstalgorithm.hxx | 2 +-
sc/source/core/data/segmenttree.cxx | 8 +-
sc/source/filter/excel/colrowst.cxx | 2 +-
sc/source/filter/inc/orcusinterface.hxx | 169 +++--
sc/source/filter/orcus/interface.cxx | 604 +++++++++++-------
.../filter/xml/XMLStylesExportHelper.cxx | 2 +-
21 files changed, 655 insertions(+), 369 deletions(-)
create mode 100644 external/libetonyek/mdds3.0.patch.1
create mode 100644 external/liborcus/enum-labels.patch
create mode 100644 external/liborcus/styles-element-rules.patch
delete mode 100644 external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1
delete mode 100644 external/mdds/use-after-free.patch
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 80f0fdee37dc..bdba7e00f869 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3441,7 +3441,7 @@ $(call gb_LinkTarget_set_include,$(1),\
)
$(call gb_LinkTarget_add_libs,$(1),\
- -L$(gb_UnpackedTarball_workdir)/liborcus/src/liborcus/.libs -lorcus-0.18 \
+ -L$(gb_UnpackedTarball_workdir)/liborcus/src/liborcus/.libs -lorcus-0.20 \
)
$(if $(SYSTEM_BOOST), \
@@ -3460,7 +3460,7 @@ $(call gb_LinkTarget_set_include,$(1),\
)
$(call gb_LinkTarget_add_libs,$(1),\
- -L$(gb_UnpackedTarball_workdir)/liborcus/src/parser/.libs -lorcus-parser-0.18 \
+ -L$(gb_UnpackedTarball_workdir)/liborcus/src/parser/.libs -lorcus-parser-0.20 \
)
endef
diff --git a/configure.ac b/configure.ac
index afdfd1be5b0c..bf92a22ebe1b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11212,7 +11212,7 @@ dnl ===================================================================
dnl Check for system mdds
dnl ===================================================================
MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
-libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
+libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-3.0 >= 3.0.0])
dnl ===================================================================
dnl Check for system dragonbox
@@ -11562,7 +11562,7 @@ fi
dnl ===================================================================
dnl Orcus
dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
+libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.20 >= 0.20.0])
if test "$with_system_orcus" != "yes"; then
if test "$SYSTEM_BOOST" = "TRUE"; then
dnl Link with Boost.System
diff --git a/download.lst b/download.lst
index 788b936f99b6..b66cbfaa88ec 100644
--- a/download.lst
+++ b/download.lst
@@ -554,8 +554,8 @@ MARIADB_CONNECTOR_C_TARBALL := mariadb-connector-c-3.3.17-src.tar.gz
# three static lines
# so that git cherry-pick
# will not run into conflicts
-MDDS_SHA256SUM := 1483d90cefb8aa4563c4d0a85cb7b243aa95217d235d422e9ca6722fd5b97e56
-MDDS_TARBALL := mdds-2.1.1.tar.xz
+MDDS_SHA256SUM := 9b077e8d929050e9a432cc131beed2380ac85cfe98b17fc26d01d0ed532129c8
+MDDS_TARBALL := mdds-3.0.0.tar.xz
# three static lines
# so that git cherry-pick
# will not run into conflicts
@@ -616,8 +616,8 @@ OPENSSL_TARBALL := openssl-3.0.18.tar.gz
# three static lines
# so that git cherry-pick
# will not run into conflicts
-ORCUS_SHA256SUM := 69ed26a00d4aaa7688e62a6e003cbc81928521a45e96605e53365aa499719e39
-ORCUS_TARBALL := liborcus-0.19.2.tar.xz
+ORCUS_SHA256SUM := fb6438977a75e7f455b772acf80d861fbc787ab18d52f7997af44a212311a507
+ORCUS_TARBALL := liborcus-0.20.0.tar.xz
# three static lines
# so that git cherry-pick
# will not run into conflicts
diff --git a/external/libetonyek/UnpackedTarball_libetonyek.mk b/external/libetonyek/UnpackedTarball_libetonyek.mk
index e13737cbe6a8..7bd9be889400 100644
--- a/external/libetonyek/UnpackedTarball_libetonyek.mk
+++ b/external/libetonyek/UnpackedTarball_libetonyek.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libetonyek,\
external/libetonyek/ubsan.patch \
external/libetonyek/rpath.patch \
external/libetonyek/enumarith.patch \
+ external/libetonyek/mdds3.0.patch.1 \
))
ifneq ($(OS),MACOSX)
diff --git a/external/libetonyek/mdds3.0.patch.1 b/external/libetonyek/mdds3.0.patch.1
new file mode 100644
index 000000000000..4e615e1bf0ee
--- /dev/null
+++ b/external/libetonyek/mdds3.0.patch.1
@@ -0,0 +1,13 @@
+diff --git a/src/lib/IWORKTable.cpp b/src/lib/IWORKTable.cpp
+index bde1011..a68f549 100644
+--- a/src/lib/IWORKTable.cpp
++++ b/src/lib/IWORKTable.cpp
+@@ -168,7 +168,7 @@ void parseDateTimeFormat(std::string const &format, librevenge::RVNGPropertyList
+
+ void writeBorder(librevenge::RVNGPropertyList &props, const char *name, IWORKGridLine_t &line, unsigned index)
+ {
+- if (!line.is_tree_valid())
++ if (!line.valid_tree())
+ line.build_tree();
+
+ IWORKStylePtr_t style;
diff --git a/external/liborcus/ExternalPackage_liborcus.mk b/external/liborcus/ExternalPackage_liborcus.mk
index 4adfcb247bdc..b9be5fcac405 100644
--- a/external/liborcus/ExternalPackage_liborcus.mk
+++ b/external/liborcus/ExternalPackage_liborcus.mk
@@ -12,11 +12,11 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,liborcus,liborcus))
$(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus))
ifeq ($(OS),MACOSX)
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.18.0.dylib,src/liborcus/.libs/liborcus-0.18.0.dylib))
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.18.0.dylib,src/parser/.libs/liborcus-parser-0.18.0.dylib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.20.0.dylib,src/liborcus/.libs/liborcus-0.20.0.dylib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.20.0.dylib,src/parser/.libs/liborcus-parser-0.20.0.dylib))
else ifeq ($(DISABLE_DYNLOADING),)
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.18.so.0,src/liborcus/.libs/liborcus-0.18.so.0.0.0))
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.18.so.0,src/parser/.libs/liborcus-parser-0.18.so.0.0.0))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.20.so.0,src/liborcus/.libs/liborcus-0.20.so.0.0.0))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.20.so.0,src/parser/.libs/liborcus-parser-0.20.so.0.0.0))
endif
# vim: set noet sw=4 ts=4:
diff --git a/external/liborcus/ExternalProject_liborcus.mk b/external/liborcus/ExternalProject_liborcus.mk
index 7f2e5f24083f..97d1c54b02d8 100644
--- a/external/liborcus/ExternalProject_liborcus.mk
+++ b/external/liborcus/ExternalProject_liborcus.mk
@@ -115,8 +115,8 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
$(MAKE) \
$(if $(filter MACOSX,$(OS)),\
&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
- $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.18.0.dylib \
- $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.18.0.dylib \
+ $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.20.0.dylib \
+ $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.20.0.dylib \
) \
)
$(call gb_Trace_EndRange,liborcus,EXTERNAL)
diff --git a/external/liborcus/Library_orcus.mk b/external/liborcus/Library_orcus.mk
index 7a138e11d925..776f5c2f04ad 100644
--- a/external/liborcus/Library_orcus.mk
+++ b/external/liborcus/Library_orcus.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
UnpackedTarball/liborcus/src/liborcus/config \
UnpackedTarball/liborcus/src/liborcus/css_document_tree \
UnpackedTarball/liborcus/src/liborcus/css_selector \
+ UnpackedTarball/liborcus/src/liborcus/debug_utils \
UnpackedTarball/liborcus/src/liborcus/detection_result \
UnpackedTarball/liborcus/src/liborcus/dom_tree \
UnpackedTarball/liborcus/src/liborcus/format_detection \
@@ -75,6 +76,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
UnpackedTarball/liborcus/src/liborcus/interface \
UnpackedTarball/liborcus/src/liborcus/json_document_tree \
UnpackedTarball/liborcus/src/liborcus/json_map_tree \
+ UnpackedTarball/liborcus/src/liborcus/json_path \
UnpackedTarball/liborcus/src/liborcus/json_structure_mapper \
UnpackedTarball/liborcus/src/liborcus/json_structure_tree \
UnpackedTarball/liborcus/src/liborcus/json_util \
@@ -86,10 +88,11 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
UnpackedTarball/liborcus/src/liborcus/odf_number_format_context \
UnpackedTarball/liborcus/src/liborcus/odf_para_context \
UnpackedTarball/liborcus/src/liborcus/odf_style_context \
- UnpackedTarball/liborcus/src/liborcus/odf_styles_context \
UnpackedTarball/liborcus/src/liborcus/odf_styles \
+ UnpackedTarball/liborcus/src/liborcus/odf_styles_context \
UnpackedTarball/liborcus/src/liborcus/odf_tokens \
UnpackedTarball/liborcus/src/liborcus/ods_content_xml_context \
+ UnpackedTarball/liborcus/src/liborcus/ods_database_ranges_context \
UnpackedTarball/liborcus/src/liborcus/ods_dde_links_context \
UnpackedTarball/liborcus/src/liborcus/ods_session_data \
UnpackedTarball/liborcus/src/liborcus/ooxml_content_types \
@@ -106,8 +109,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
UnpackedTarball/liborcus/src/liborcus/orcus_import_xlsx \
UnpackedTarball/liborcus/src/liborcus/orcus_json \
UnpackedTarball/liborcus/src/liborcus/orcus_ods \
- UnpackedTarball/liborcus/src/liborcus/orcus_xlsx \
UnpackedTarball/liborcus/src/liborcus/orcus_xls_xml \
+ UnpackedTarball/liborcus/src/liborcus/orcus_xlsx \
UnpackedTarball/liborcus/src/liborcus/orcus_xml \
UnpackedTarball/liborcus/src/liborcus/orcus_xml_impl \
UnpackedTarball/liborcus/src/liborcus/orcus_xml_map_def \
@@ -117,16 +120,19 @@ $(eval $(call gb_Library_add_generated_exception_objects,orcus,\
UnpackedTarball/liborcus/src/liborcus/spreadsheet_interface \
UnpackedTarball/liborcus/src/liborcus/spreadsheet_types \
UnpackedTarball/liborcus/src/liborcus/string_helper \
- UnpackedTarball/liborcus/src/liborcus/xlsx_autofilter_context \
- UnpackedTarball/liborcus/src/liborcus/xlsx_conditional_format_context \
- UnpackedTarball/liborcus/src/liborcus/xlsx_drawing_context \
- UnpackedTarball/liborcus/src/liborcus/xlsx_handler \
- UnpackedTarball/liborcus/src/liborcus/xlsx_helper \
+ UnpackedTarball/liborcus/src/liborcus/xls_filter_utils \
+ UnpackedTarball/liborcus/src/liborcus/xls_types \
+ UnpackedTarball/liborcus/src/liborcus/xls_xml_auto_filter_context \
UnpackedTarball/liborcus/src/liborcus/xls_xml_context \
UnpackedTarball/liborcus/src/liborcus/xls_xml_detection_handler \
UnpackedTarball/liborcus/src/liborcus/xls_xml_handler \
UnpackedTarball/liborcus/src/liborcus/xls_xml_namespace_types \
UnpackedTarball/liborcus/src/liborcus/xls_xml_tokens \
+ UnpackedTarball/liborcus/src/liborcus/xlsx_autofilter_context \
+ UnpackedTarball/liborcus/src/liborcus/xlsx_conditional_format_context \
+ UnpackedTarball/liborcus/src/liborcus/xlsx_drawing_context \
+ UnpackedTarball/liborcus/src/liborcus/xlsx_handler \
+ UnpackedTarball/liborcus/src/liborcus/xlsx_helper \
UnpackedTarball/liborcus/src/liborcus/xlsx_pivot_context \
UnpackedTarball/liborcus/src/liborcus/xlsx_revision_context \
UnpackedTarball/liborcus/src/liborcus/xlsx_session_data \
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
index bb399826c358..b866f59c6ac9 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -18,6 +18,8 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,liborcus))
$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/rpath.patch.0 \
external/liborcus/libtool.patch.0 \
+ external/liborcus/styles-element-rules.patch \
+ external/liborcus/enum-labels.patch \
))
ifeq ($(OS),WNT)
diff --git a/external/liborcus/enum-labels.patch b/external/liborcus/enum-labels.patch
new file mode 100644
index 000000000000..10f169c62fa1
--- /dev/null
+++ b/external/liborcus/enum-labels.patch
@@ -0,0 +1,47 @@
+From 3b590cabb6f8296dcddb6588e3346a7604f97d51 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida@gmail.com>
+Date: Fri, 7 Feb 2025 23:03:34 -0500
+Subject: [PATCH 2/2] Properly map enum types to their labels
+
+---
+ src/liborcus/spreadsheet_types.cpp | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/src/liborcus/spreadsheet_types.cpp b/src/liborcus/spreadsheet_types.cpp
+index f3f51050..161e53ca 100644
+--- a/src/liborcus/spreadsheet_types.cpp
++++ b/src/liborcus/spreadsheet_types.cpp
+@@ -595,10 +595,7 @@ std::ostream& operator<< (std::ostream& os, underline_style_t uline)
+ {
+ static constexpr std::string_view names[] = {
+ "none",
+- "single-line",
+- "single-accounting",
+- "double-line",
+- "double-accounting",
++ "solid",
+ "dotted",
+ "dash",
+ "long-dash",
+@@ -633,6 +630,7 @@ std::ostream& operator<< (std::ostream& os, underline_spacing_t ulmode)
+ static constexpr std::string_view names[] = {
+ "continuous",
+ "skip-white-space",
++ "continuous-over-field",
+ };
+
+ return write_name_for_pos(os, names, std::size(names), ulmode);
+@@ -642,8 +640,8 @@ std::ostream& operator<< (std::ostream& os, underline_count_t ultype)
+ {
+ static constexpr std::string_view names[] = {
+ "none",
+- "single-type",
+- "double-type",
++ "single-count",
++ "double-count",
+ };
+
+ return write_name_for_pos(os, names, std::size(names), ultype);
+--
+2.34.1
+
diff --git a/external/liborcus/styles-element-rules.patch b/external/liborcus/styles-element-rules.patch
new file mode 100644
index 000000000000..61b42478ad8e
--- /dev/null
+++ b/external/liborcus/styles-element-rules.patch
@@ -0,0 +1,42 @@
+From cfa3ec177d4dd44327cd42d018a0fb88888e19c9 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida@gmail.com>
+Date: Fri, 7 Feb 2025 22:51:29 -0500
+Subject: [PATCH 1/2] Define missing element rules for immediate child elements
+ of root
+
+---
+ src/liborcus/odf_styles_context.cpp | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/src/liborcus/odf_styles_context.cpp b/src/liborcus/odf_styles_context.cpp
+index a60e47da..0e45783e 100644
+--- a/src/liborcus/odf_styles_context.cpp
++++ b/src/liborcus/odf_styles_context.cpp
+@@ -67,6 +67,24 @@ styles_context::styles_context(
+ // parent element -> child element
+ { XMLNS_UNKNOWN_ID, XML_UNKNOWN_TOKEN, NS_odf_office, XML_automatic_styles }, // root element
+ { XMLNS_UNKNOWN_ID, XML_UNKNOWN_TOKEN, NS_odf_office, XML_styles }, // root element
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_boolean_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_currency_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_date_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_number_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_percentage_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_text_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_number, XML_time_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_style, XML_default_style },
++ { NS_odf_office, XML_automatic_styles, NS_odf_style, XML_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_boolean_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_currency_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_date_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_number_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_percentage_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_text_style },
++ { NS_odf_office, XML_styles, NS_odf_number, XML_time_style },
++ { NS_odf_office, XML_styles, NS_odf_style, XML_default_style },
++ { NS_odf_office, XML_styles, NS_odf_style, XML_style },
+ };
+
+ init_element_validator(rules, std::size(rules));
+--
+2.34.1
+
diff --git a/external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 b/external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1
deleted file mode 100644
index 9c47e1d22767..000000000000
--- a/external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1
+++ /dev/null
@@ -1,62 +0,0 @@
-From f7d8d7eaf2b4160354887ac740a1efed9b6fc23b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
-Date: Sun, 14 Jan 2024 21:03:12 +0000
-Subject: [PATCH] cid#1546160 COPY_INSTEAD_OF_MOVE
-
-and
-
-cid#1545547 COPY_INSTEAD_OF_MOVE
-cid#1545642 COPY_INSTEAD_OF_MOVE
-cid#1557206 COPY_INSTEAD_OF_MOVE
----
- include/mdds/flat_segment_tree.hpp | 2 +-
- include/mdds/flat_segment_tree_def.inl | 6 +++---
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/include/mdds/flat_segment_tree.hpp b/include/mdds/flat_segment_tree.hpp
-index bf8e0956..317eb279 100644
---- a/include/mdds/flat_segment_tree.hpp
-+++ b/include/mdds/flat_segment_tree.hpp
-@@ -767,7 +767,7 @@ private:
- {
- node_ptr next_node = cur_node->next;
- disconnect_all_nodes(cur_node.get());
-- cur_node = next_node;
-+ cur_node = std::move(next_node);
- }
- last_node->next = end_node;
- end_node->prev = last_node;
-diff --git a/include/mdds/flat_segment_tree_def.inl b/include/mdds/flat_segment_tree_def.inl
-index 76350656..d07cae82 100644
---- a/include/mdds/flat_segment_tree_def.inl
-+++ b/include/mdds/flat_segment_tree_def.inl
-@@ -114,7 +114,7 @@
- // Move on to the next destination node, and have the next node point
- // back to the previous node.
- node_ptr old_node = dest_node;
-- dest_node->next->prev = old_node;
-+ dest_node->next->prev = std::move(old_node);
- dest_node = dest_node->next;
-
- if (src_node == r.m_right_leaf.get())
-@@ -380,7 +380,7 @@
-
- p = get_insertion_pos_leaf(start_key, p);
- node_ptr start_pos(const_cast<node*>(p));
-- return insert_to_pos(start_pos, start_key, end_key, val);
-+ return insert_to_pos(std::move(start_pos), start_key, end_key, val);
- }
-
- template<typename Key, typename Value>
-@@ -456,7 +456,7 @@
- last_seg_value = node_pos->value_leaf.value;
- node_ptr next = node_pos->next;
- disconnect_all_nodes(node_pos.get());
-- node_pos = next;
-+ node_pos = std::move(next);
- }
-
- start_pos->value_leaf.value = last_seg_value;
---
-2.42.0
-
diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk
index ce1ba745be43..fe10a60bde59 100644
--- a/external/mdds/UnpackedTarball_mdds.mk
+++ b/external/mdds/UnpackedTarball_mdds.mk
@@ -14,9 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,mdds,$(MDDS_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0))
$(eval $(call gb_UnpackedTarball_add_patches,mdds,\
- external/mdds/use-after-free.patch \
external/mdds/gcc-12-silence-use-after-free.patch.1 \
- external/mdds/0001-cid-1546160-COPY_INSTEAD_OF_MOVE.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/mdds/gcc-12-silence-use-after-free.patch.1 b/external/mdds/gcc-12-silence-use-after-free.patch.1
index 94f7ba979e61..4fd742182d32 100644
--- a/external/mdds/gcc-12-silence-use-after-free.patch.1
+++ b/external/mdds/gcc-12-silence-use-after-free.patch.1
@@ -22,9 +22,9 @@ cc1plus: all warnings being treated as errors
diff -ur mdds.org/include/mdds/node.hpp mdds/include/mdds/node.hpp
--- mdds.org/include/mdds/node.hpp 2023-07-24 18:27:14.427139325 +0000
+++ mdds/include/mdds/node.hpp 2023-07-24 18:26:54.554461294 +0000
-@@ -244,9 +244,15 @@
- template<typename T>
- inline void intrusive_ptr_release(node<T>* p)
+@@ -210,9 +210,15 @@
+ template<typename KeyT, typename ValueT>
+ inline void intrusive_ptr_release(node<KeyT, ValueT>* p)
{
- --p->refcount;
- if (!p->refcount)
@@ -39,4 +39,4 @@ diff -ur mdds.org/include/mdds/node.hpp mdds/include/mdds/node.hpp
+#endif
}
- template<typename T>
+ template<typename NodePtrT>
diff --git a/external/mdds/use-after-free.patch b/external/mdds/use-after-free.patch
deleted file mode 100644
index 981c945821a7..000000000000
--- a/external/mdds/use-after-free.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- include/mdds/flat_segment_tree_def.inl
-+++ include/mdds/flat_segment_tree_def.inl
-@@ -84,8 +84,8 @@
- // Move on to the next destination node, and have the next node point
- // back to the previous node.
- node_ptr old_node = dest_node;
-+ dest_node->next->prev = old_node;
- dest_node = dest_node->next;
-- dest_node->prev = old_node;
-
- if (src_node == r.m_right_leaf.get())
- {
diff --git a/sc/inc/fstalgorithm.hxx b/sc/inc/fstalgorithm.hxx
index 4d46cfaaa28c..40b28d8d8a8f 100644
--- a/sc/inc/fstalgorithm.hxx
+++ b/sc/inc/fstalgorithm.hxx
@@ -103,7 +103,7 @@ std::vector<Span> toSpanArray( const mdds::flat_segment_tree<Key,bool>& rTree, K
typedef mdds::flat_segment_tree<Key,bool> FstType;
std::vector<Span> aSpans;
- if (!rTree.is_tree_valid())
+ if (!rTree.valid_tree())
return aSpans;
bool bThisVal = false;
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index a39c956a478b..470cc90ff2f4 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -134,7 +134,7 @@ typename ScFlatSegmentsImpl<ValueType_, ExtValueType_>::ValueType ScFlatSegments
return nValue;
}
- if (!maSegments.is_tree_valid())
+ if (!maSegments.valid_tree())
{
assert(!ScGlobal::bThreadedGroupCalcInProgress);
maSegments.build_tree();
@@ -150,7 +150,7 @@ sal_uInt64 ScFlatSegmentsImpl<ValueType_, ExtValueType_>::getSumValue(SCCOLROW n
if (mbTreeSearchEnabled)
{
- if (!maSegments.is_tree_valid())
+ if (!maSegments.valid_tree())
{
assert(!ScGlobal::bThreadedGroupCalcInProgress);
maSegments.build_tree();
@@ -242,7 +242,7 @@ bool ScFlatSegmentsImpl<ValueType_, ExtValueType_>::getRangeData(SCCOLROW nPos,
if (!mbTreeSearchEnabled)
return getRangeDataLeaf(nPos, rData);
- if (!maSegments.is_tree_valid())
+ if (!maSegments.valid_tree())
{
assert(!ScGlobal::bThreadedGroupCalcInProgress);
maSegments.build_tree();
@@ -333,7 +333,7 @@ template<typename ValueType_, typename ExtValueType_>
void ScFlatSegmentsImpl<ValueType_, ExtValueType_>::makeReady()
{
assert(!ScGlobal::bThreadedGroupCalcInProgress);
- if (!maSegments.is_tree_valid())
+ if (!maSegments.valid_tree())
maSegments.build_tree();
}
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index e194b7309d9b..663fe5d864ea 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -215,7 +215,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
rDoc.SetRowFlags( 0, rDoc.MaxRow(), nScTab, CRFlags::ManualSize );
maRowHeights.build_tree();
- if (!maRowHeights.is_tree_valid())
+ if (!maRowHeights.valid_tree())
return;
SCROW nPrevRow = -1;
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 2fd1d5ed40f3..d9c7e2eacacc 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -27,6 +27,8 @@
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/spreadsheet/import_interface_styles.hpp>
+#include <orcus/spreadsheet/import_interface_underline.hpp>
+#include <orcus/spreadsheet/import_interface_strikethrough.hpp>
#include <memory>
#include <map>
@@ -37,6 +39,8 @@
class ScOrcusSheet;
class ScOrcusStyles;
class ScOrcusFactory;
+class ScOrcusImportFontStyle;
+class ScOrcusSharedStrings;
class SfxItemSet;
namespace com::sun::star::task { class XStatusIndicator; }
@@ -103,6 +107,69 @@ public:
virtual void commit() override;
};
+struct ScOrcusStrikethrough
+{
+ std::optional<orcus::spreadsheet::strikethrough_style_t> meStyle;
+ std::optional<orcus::spreadsheet::strikethrough_type_t> meType;
+ std::optional<orcus::spreadsheet::strikethrough_width_t> meWidth;
+ std::optional<orcus::spreadsheet::strikethrough_text_t> meText;
+
+ void reset();
+ std::optional<FontStrikeout> toFontStrikeout() const;
+};
+
+struct ScOrcusUnderline
+{
+ std::optional<orcus::spreadsheet::underline_style_t> meStyle;
+ std::optional<orcus::spreadsheet::underline_thickness_t> meThickness;
+ std::optional<orcus::spreadsheet::underline_spacing_t> meSpacing;
+ std::optional<orcus::spreadsheet::underline_count_t> meCount;
+
+ void reset();
+ std::optional<FontLineStyle> toFontLineStyle() const;
+};
+
+class ScOrcusSegmentStrikethrough : public orcus::spreadsheet::iface::import_strikethrough
+{
+ friend class ScOrcusSharedStrings;
+
+ SfxItemSet* mpDestFormat = nullptr;
+ ScOrcusStrikethrough maAttrs;
+
+ void reset(SfxItemSet* pDestFormat);
+
+public:
+ void set_style(orcus::spreadsheet::strikethrough_style_t s) override;
+ void set_type(orcus::spreadsheet::strikethrough_type_t s) override;
+ void set_width(orcus::spreadsheet::strikethrough_width_t s) override;
+ void set_text(orcus::spreadsheet::strikethrough_text_t s) override;
+ void commit() override;
+};
+
+class ScOrcusSegmentUnderline : public orcus::spreadsheet::iface::import_underline
+{
+ friend class ScOrcusSharedStrings;
+
+ SfxItemSet* mpDestFormat = nullptr;
+
+ ScOrcusUnderline maAttrs;
+ std::optional<Color> maColor;
+
+ void reset(SfxItemSet* pDestFormat);
+
+public:
+ void set_style(orcus::spreadsheet::underline_style_t e) override;
+ void set_thickness(orcus::spreadsheet::underline_thickness_t e) override;
+ void set_spacing(orcus::spreadsheet::underline_spacing_t e) override;
+ void set_count(orcus::spreadsheet::underline_count_t e) override;
+ void set_color(
+ orcus::spreadsheet::color_elem_t alpha,
+ orcus::spreadsheet::color_elem_t red,
+ orcus::spreadsheet::color_elem_t green,
+ orcus::spreadsheet::color_elem_t blue) override;
+ void commit() override;
+};
+
class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
{
ScOrcusFactory& mrFactory;
@@ -111,6 +178,9 @@ class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_str
SfxItemSet maCurFormat;
std::vector<std::pair<ESelection, SfxItemSet>> maFormatSegments;
+ ScOrcusSegmentUnderline maImportUnderline;
+ ScOrcusSegmentStrikethrough maImportStrikethrough;
+
OUString toOUString(std::string_view s);
public:
@@ -121,6 +191,8 @@ public:
virtual void set_segment_bold(bool b) override;
virtual void set_segment_italic(bool b) override;
+ virtual void set_segment_superscript(bool b) override;
+ virtual void set_segment_subscript(bool b) override;
virtual void set_segment_font(size_t font_index) override;
virtual void set_segment_font_name(std::string_view s) override;
virtual void set_segment_font_size(double point) override;
@@ -128,6 +200,10 @@ public:
orcus::spreadsheet::color_elem_t red,
orcus::spreadsheet::color_elem_t green,
orcus::spreadsheet::color_elem_t blue) override;
+
+ virtual orcus::spreadsheet::iface::import_underline* start_underline() override;
+ virtual orcus::spreadsheet::iface::import_strikethrough* start_strikethrough() override;
+
virtual void append_segment(std::string_view s) override;
virtual size_t commit_segments() override;
@@ -195,28 +271,6 @@ private:
ScFormatEntry::Type meEntryType;
};
-class ScOrcusAutoFilter : public orcus::spreadsheet::iface::import_auto_filter
-{
-public:
- ScOrcusAutoFilter( const ScOrcusGlobalSettings& rGS );
-
- virtual ~ScOrcusAutoFilter() override;
-
- virtual void set_range(const orcus::spreadsheet::range_t& range) override;
-
- virtual void set_column(orcus::spreadsheet::col_t col) override;
-
- virtual void append_column_match_value(std::string_view value) override;
-
- virtual void commit_column() override;
-
- virtual void commit() override;
-
-private:
- const ScOrcusGlobalSettings& mrGlobalSettings;
- ScRange maRange;
-};
-
class ScOrcusSheetProperties : public orcus::spreadsheet::iface::import_sheet_properties
{
ScDocumentImport& mrDoc;
@@ -233,9 +287,12 @@ public:
orcus::spreadsheet::col_t col, orcus::spreadsheet::col_t col_span,
bool hidden) override;
- virtual void set_row_height(orcus::spreadsheet::row_t row, double height, orcus::length_unit_t unit) override;
+ virtual void set_row_height(
+ orcus::spreadsheet::row_t row, orcus::spreadsheet::row_t row_span,
+ double height, orcus::length_unit_t unit) override;
- virtual void set_row_hidden(orcus::spreadsheet::row_t row, bool hidden) override;
+ virtual void set_row_hidden(
+ orcus::spreadsheet::row_t row, orcus::spreadsheet::row_t row_span, bool hidden) override;
virtual void set_merge_cell_range(const orcus::spreadsheet::range_t& range) override;
};
@@ -314,7 +371,6 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
ScOrcusStyles& mrStyles;
sc::SharedFormulaGroups maFormulaGroups;
- ScOrcusAutoFilter maAutoFilter;
ScOrcusSheetProperties maProperties;
ScOrcusConditionalFormat maConditionalFormat;
ScOrcusNamedExpression maNamedExpressions;
@@ -330,8 +386,6 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
public:
ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
- virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() override;
- virtual orcus::spreadsheet::iface::import_table* get_table() override;
virtual orcus::spreadsheet::iface::import_sheet_properties* get_sheet_properties() override;
virtual orcus::spreadsheet::iface::import_conditional_format* get_conditional_format() override;
virtual orcus::spreadsheet::iface::import_named_expression* get_named_expression() override;
@@ -458,12 +512,55 @@ struct ScOrcusCellStyle
ScOrcusCellStyle();
};
+class ScOrcusImportFontUnderlineStyle : public orcus::spreadsheet::iface::import_underline
+{
+ friend class ScOrcusImportFontStyle;
+
+ ScOrcusFont* mpDestFont = nullptr;
+ ScOrcusUnderline maAttrs;
+ std::optional<Color> maColor;
+
+ void reset(ScOrcusFont* pDest);
+
+public:
+ void set_style(orcus::spreadsheet::underline_style_t e) override;
+ void set_thickness(orcus::spreadsheet::underline_thickness_t e) override;
+ void set_spacing(orcus::spreadsheet::underline_spacing_t e) override;
+ void set_count(orcus::spreadsheet::underline_count_t e) override;
+ void set_color(
+ orcus::spreadsheet::color_elem_t alpha,
+ orcus::spreadsheet::color_elem_t red,
+ orcus::spreadsheet::color_elem_t green,
+ orcus::spreadsheet::color_elem_t blue) override;
+ void commit() override;
+};
+
+class ScOrcusImportFontStrikethroughStyle : public orcus::spreadsheet::iface::import_strikethrough
+{
+ friend class ScOrcusImportFontStyle;
+
+ ScOrcusFont* mpDestFont = nullptr;
+ ScOrcusStrikethrough maAttrs;
+
+ void reset(ScOrcusFont* pDest);
+
+public:
+ void set_style(orcus::spreadsheet::strikethrough_style_t s) override;
+ void set_type(orcus::spreadsheet::strikethrough_type_t s) override;
+ void set_width(orcus::spreadsheet::strikethrough_width_t s) override;
+ void set_text(orcus::spreadsheet::strikethrough_text_t s) override;
+ void commit() override;
+};
+
class ScOrcusImportFontStyle : public orcus::spreadsheet::iface::import_font_style
{
ScOrcusFont maCurrentFont;
ScOrcusFactory& mrFactory;
std::vector<ScOrcusFont>& mrFonts;
+ ScOrcusImportFontUnderlineStyle maUnderlineImport;
+ ScOrcusImportFontStrikethroughStyle maStrikeoutImport;
+
public:
ScOrcusImportFontStyle( ScOrcusFactory& rFactory, std::vector<ScOrcusFont>& rFonts );
@@ -481,24 +578,16 @@ public:
void set_size(double point) override;
void set_size_asian(double point) override;
void set_size_complex(double point) override;
- void set_underline(orcus::spreadsheet::underline_t e) override;
- void set_underline_width(orcus::spreadsheet::underline_width_t e) override;
- void set_underline_mode(orcus::spreadsheet::underline_mode_t e) override;
- void set_underline_type(orcus::spreadsheet::underline_type_t e) override;
- void set_underline_color(
- orcus::spreadsheet::color_elem_t alpha,
- orcus::spreadsheet::color_elem_t red,
- orcus::spreadsheet::color_elem_t green,
- orcus::spreadsheet::color_elem_t blue) override;
+
void set_color(
orcus::spreadsheet::color_elem_t alpha,
orcus::spreadsheet::color_elem_t red,
orcus::spreadsheet::color_elem_t green,
orcus::spreadsheet::color_elem_t blue) override;
- void set_strikethrough_style(orcus::spreadsheet::strikethrough_style_t s) override;
- void set_strikethrough_type(orcus::spreadsheet::strikethrough_type_t s) override;
- void set_strikethrough_width(orcus::spreadsheet::strikethrough_width_t s) override;
- void set_strikethrough_text(orcus::spreadsheet::strikethrough_text_t s) override;
+
+ orcus::spreadsheet::iface::import_underline* start_underline() override;
+ orcus::spreadsheet::iface::import_strikethrough* start_strikethrough() override;
+
std::size_t commit() override;
};
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index e4b5667643b5..e64a6134c674 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -38,6 +38,7 @@
#include <editeng/crossedoutitem.hxx>
#include <editeng/justifyitem.hxx>
#include <editeng/eeitem.hxx>
+#include <editeng/escapementitem.hxx>
#include <svl/sharedstringpool.hxx>
#include <svl/numformat.hxx>
@@ -420,6 +421,7 @@ os::iface::import_reference_resolver* ScOrcusFactory::get_reference_resolver(os:
return &maRefResolver;
case os::formula_ref_context_t::named_expression_base:
case os::formula_ref_context_t::named_range:
+ case os::formula_ref_context_t::table_range:
return nullptr;
}
@@ -787,16 +789,20 @@ void ScOrcusSheetProperties::set_column_hidden(os::col_t col, os::col_t col_span
mrDoc.getDoc().SetColHidden(col, col + col_span - 1, mnTab, hidden);
}
-void ScOrcusSheetProperties::set_row_height(os::row_t row, double height, orcus::length_unit_t unit)
+void ScOrcusSheetProperties::set_row_height(
+ os::row_t row, os::row_t row_span, double height, orcus::length_unit_t unit)
{
double nNewHeight = translateToInternal(height, unit);
- mrDoc.getDoc().SetRowHeightOnly(row, row,mnTab, nNewHeight);
+ SCROW nStartRow = row;
+ SCROW nEndRow = row + row_span - 1;
+ mrDoc.getDoc().SetRowHeightOnly(nStartRow, nEndRow, mnTab, nNewHeight);
}
-void ScOrcusSheetProperties::set_row_hidden(os::row_t row, bool hidden)
+void ScOrcusSheetProperties::set_row_hidden(os::row_t row, os::row_t row_span, bool hidden)
{
- if (hidden)
- mrDoc.getDoc().SetRowHidden(row, row, mnTab, hidden);
+ SCROW nStartRow = row;
+ SCROW nEndRow = row + row_span - 1;
+ mrDoc.getDoc().SetRowHidden(nStartRow, nEndRow, mnTab, hidden);
}
void ScOrcusSheetProperties::set_merge_cell_range(const orcus::spreadsheet::range_t& range)
@@ -962,7 +968,6 @@ ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& r
mnTab(nTab),
mrFactory(rFactory),
mrStyles(static_cast<ScOrcusStyles&>(*mrFactory.get_styles())),
- maAutoFilter(rFactory.getGlobalSettings()),
maProperties(mnTab, mrDoc),
maConditionalFormat(mnTab, rDoc.getDoc()),
maNamedExpressions(rDoc, rFactory.getGlobalSettings(), nTab),
@@ -1169,16 +1174,6 @@ ScDocumentImport& ScOrcusSheet::getDoc()
return mrDoc;
}
-os::iface::import_auto_filter* ScOrcusSheet::get_auto_filter()
-{
- return &maAutoFilter;
-}
-
-os::iface::import_table* ScOrcusSheet::get_table()
-{
- return nullptr;
-}
-
os::iface::import_sheet_properties* ScOrcusSheet::get_sheet_properties()
{
return &maProperties;
@@ -1321,6 +1316,277 @@ ScOrcusFactory& ScOrcusSheet::getFactory()
return mrFactory;
}
+void ScOrcusStrikethrough::reset()
+{
+ meStyle.reset();
+ meType.reset();
+ meWidth.reset();
+ meText.reset();
+}
+
+std::optional<FontStrikeout> ScOrcusStrikethrough::toFontStrikeout() const
+{
+ std::optional<FontStrikeout> eStrikeout;
+
+ if (meType)
+ {
+ switch (*meType)
+ {
+ case os::strikethrough_type_t::unknown:
+ eStrikeout = STRIKEOUT_DONTKNOW;
+ break;
+ case os::strikethrough_type_t::none:
+ eStrikeout = STRIKEOUT_NONE;
+ break;
+ case os::strikethrough_type_t::single_type:
+ eStrikeout = STRIKEOUT_SINGLE;
+ break;
+ case os::strikethrough_type_t::double_type:
+ eStrikeout = STRIKEOUT_DOUBLE;
+ break;
+ }
+ }
+
+ if (meWidth)
+ {
+ switch (*meWidth)
+ {
+ case os::strikethrough_width_t::bold:
+ eStrikeout = STRIKEOUT_BOLD;
+ break;
+ default:;
+ }
+ }
+
+ if (meText)
+ {
+ switch (*meText)
+ {
+ case os::strikethrough_text_t::slash:
+ eStrikeout = STRIKEOUT_SLASH;
+ break;
+ case os::strikethrough_text_t::cross:
+ eStrikeout = STRIKEOUT_X;
+ break;
+ case os::strikethrough_text_t::unknown:
+ break;
+ }
+ }
+
+ return eStrikeout;
+}
+
+
+void ScOrcusUnderline::reset()
+{
+ meStyle.reset();
+ meThickness.reset();
+ meSpacing.reset();
+ meCount.reset();
+}
+
+std::optional<FontLineStyle> ScOrcusUnderline::toFontLineStyle() const
+{
+ std::optional<FontLineStyle> eUnderline;
+
+ if (meStyle)
+ {
+ switch (*meStyle)
+ {
+ case os::underline_style_t::none:
+ eUnderline = LINESTYLE_NONE;
+ break;
+ case os::underline_style_t::solid:
+ {
+ if (meCount)
+ {
+ switch (*meCount)
+ {
+ case os::underline_count_t::single_count:
+ eUnderline = LINESTYLE_SINGLE;
+ break;
+ case os::underline_count_t::double_count:
+ eUnderline = LINESTYLE_DOUBLE;
+ break;
+ case os::underline_count_t::none:
+ break;
+ }
+ }
+ else
+ eUnderline = LINESTYLE_SINGLE;
+ break;
+ }
+ case os::underline_style_t::dotted:
+ eUnderline = LINESTYLE_DOTTED;
+ break;
+ case os::underline_style_t::dash:
+ eUnderline = LINESTYLE_DASH;
+ break;
+ case os::underline_style_t::long_dash:
+ eUnderline = LINESTYLE_LONGDASH;
+ break;
+ case os::underline_style_t::dot_dash:
+ eUnderline = LINESTYLE_DASHDOT;
+ break;
+ case os::underline_style_t::dot_dot_dash:
+ eUnderline = LINESTYLE_DASHDOTDOT;
+ break;
+ case os::underline_style_t::wave:
+ {
+ if (meCount)
+ {
+ switch (*meCount)
+ {
+ case os::underline_count_t::single_count:
+ eUnderline = LINESTYLE_WAVE;
+ break;
+ case os::underline_count_t::double_count:
+ eUnderline = LINESTYLE_DOUBLEWAVE;
+ break;
+ case os::underline_count_t::none:
+ break;
+ }
+ }
+ else
+ eUnderline = LINESTYLE_WAVE;
+ break;
+ }
+ }
+ }
+
+ bool bApplyBold = false;
+
+ if (meThickness)
+ {
+ switch (*meThickness)
+ {
+ case os::underline_thickness_t::bold:
+ case os::underline_thickness_t::thick:
+ bApplyBold = true;
+ break;
+ default:;
+ }
+ }
+
+ if (bApplyBold)
+ {
+ if (eUnderline)
+ {
+ switch (*eUnderline)
+ {
+ case LINESTYLE_NONE:
+ case LINESTYLE_SINGLE:
+ eUnderline = LINESTYLE_BOLD;
+ break;
+ case LINESTYLE_DOTTED:
+ eUnderline = LINESTYLE_BOLDDOTTED;
+ break;
+ case LINESTYLE_DASH:
+ eUnderline = LINESTYLE_BOLDDASH;
+ break;
+ case LINESTYLE_LONGDASH:
+ eUnderline = LINESTYLE_BOLDLONGDASH;
+ break;
+ case LINESTYLE_DASHDOT:
+ eUnderline = LINESTYLE_BOLDDASHDOT;
+ break;
+ case LINESTYLE_DASHDOTDOT:
+ eUnderline = LINESTYLE_BOLDDASHDOTDOT;
+ break;
+ case LINESTYLE_WAVE:
+ eUnderline = LINESTYLE_BOLDWAVE;
+ break;
+ default:
+ ;
+ }
+ }
+ }
+
+ return eUnderline;
+}
+
+void ScOrcusSegmentStrikethrough::reset(SfxItemSet* pDestFormat)
+{
+ mpDestFormat = pDestFormat;
+ maAttrs.reset();
+}
+
+void ScOrcusSegmentStrikethrough::set_style(os::strikethrough_style_t s)
+{
+ maAttrs.meStyle = s;
+}
+
+void ScOrcusSegmentStrikethrough::set_type(os::strikethrough_type_t s)
+{
+ maAttrs.meType = s;
+}
+
+void ScOrcusSegmentStrikethrough::set_width(os::strikethrough_width_t s)
+{
+ maAttrs.meWidth = s;
+}
+
+void ScOrcusSegmentStrikethrough::set_text(os::strikethrough_text_t s)
+{
+ maAttrs.meText = s;
+}
+
+void ScOrcusSegmentStrikethrough::commit()
+{
+ auto eStrikeout = maAttrs.toFontStrikeout();
+ if (!eStrikeout)
+ return;
+
+ mpDestFormat->Put(SvxCrossedOutItem(*eStrikeout, EE_CHAR_STRIKEOUT));
+}
+
+void ScOrcusSegmentUnderline::reset(SfxItemSet* pDestFormat)
+{
+ mpDestFormat = pDestFormat;
+ maAttrs.reset();
+ maColor.reset();
+}
+
+void ScOrcusSegmentUnderline::set_style(os::underline_style_t e)
+{
+ maAttrs.meStyle = e;
+}
+
+void ScOrcusSegmentUnderline::set_thickness(os::underline_thickness_t e)
+{
+ maAttrs.meThickness = e;
+}
+
+void ScOrcusSegmentUnderline::set_spacing(os::underline_spacing_t e)
+{
+ maAttrs.meSpacing = e;
+}
+
+void ScOrcusSegmentUnderline::set_count(os::underline_count_t e)
+{
+ maAttrs.meCount = e;
+}
+
+void ScOrcusSegmentUnderline::set_color(
+ os::color_elem_t alpha, os::color_elem_t red, os::color_elem_t green, os::color_elem_t blue)
+{
+ maColor = Color(ColorAlpha, alpha, red, green, blue);
+}
+
+void ScOrcusSegmentUnderline::commit()
+{
+ auto eUnderline = maAttrs.toFontLineStyle();
+ if (!eUnderline)
+ return;
+
+ SvxUnderlineItem aItem(*eUnderline, EE_CHAR_UNDERLINE);
+
+ if (maColor)
+ aItem.SetColor(*maColor);
+
+ mpDestFormat->Put(aItem);
+}
+
OUString ScOrcusSharedStrings::toOUString(std::string_view s)
{
return {s.data(), sal_Int32(s.size()), mrFactory.getGlobalSettings().getTextEncoding()};
@@ -1360,6 +1626,18 @@ void ScOrcusSharedStrings::set_segment_italic(bool b)
maCurFormat.Put(SvxPostureItem(eItalic, EE_CHAR_ITALIC));
}
+void ScOrcusSharedStrings::set_segment_superscript(bool b)
+{
+ if (b)
+ maCurFormat.Put(SvxEscapementItem(SvxEscapement::Superscript, EE_CHAR_ESCAPEMENT));
+}
+
+void ScOrcusSharedStrings::set_segment_subscript(bool b)
+{
+ if (b)
+ maCurFormat.Put(SvxEscapementItem(SvxEscapement::Subscript, EE_CHAR_ESCAPEMENT));
+}
+
void ScOrcusSharedStrings::set_segment_font_name(std::string_view s)
{
OUString aName = toOUString(s);
@@ -1386,6 +1664,18 @@ void ScOrcusSharedStrings::set_segment_font_color(
maCurFormat.Put(SvxColorItem(aColor, EE_CHAR_COLOR));
}
+os::iface::import_underline* ScOrcusSharedStrings::start_underline()
+{
+ maImportUnderline.reset(&maCurFormat);
+ return &maImportUnderline;
+}
+
+os::iface::import_strikethrough* ScOrcusSharedStrings::start_strikethrough()
+{
+ maImportStrikethrough.reset(&maCurFormat);
+ return &maImportStrikethrough;
+}
+
void ScOrcusSharedStrings::append_segment(std::string_view s)
{
ESelection aSel{ mrEditEngine.GetEnd() }; // end of current text
@@ -1616,6 +1906,77 @@ ScOrcusCellStyle::ScOrcusCellStyle() :
{
}
+void ScOrcusImportFontUnderlineStyle::reset(ScOrcusFont* pDest)
+{
+ mpDestFont = pDest;
+
+ maAttrs.reset();
+ maColor.reset();
+}
+
+void ScOrcusImportFontUnderlineStyle::set_style(os::underline_style_t e)
+{
+ maAttrs.meStyle = e;
+}
+
+void ScOrcusImportFontUnderlineStyle::set_thickness(os::underline_thickness_t e)
+{
+ maAttrs.meThickness = e;
+}
+
+void ScOrcusImportFontUnderlineStyle::set_spacing(os::underline_spacing_t e)
+{
+ maAttrs.meSpacing = e;
+}
+
+void ScOrcusImportFontUnderlineStyle::set_count(os::underline_count_t e)
+{
+ maAttrs.meCount = e;
+}
+
+void ScOrcusImportFontUnderlineStyle::set_color(
+ os::color_elem_t alpha, os::color_elem_t red, os::color_elem_t green, os::color_elem_t blue)
+{
+ maColor = Color(ColorAlpha, alpha, red, green, blue);
+}
+
+void ScOrcusImportFontUnderlineStyle::commit()
+{
+ mpDestFont->meUnderline = maAttrs.toFontLineStyle();
+ mpDestFont->maUnderlineColor = maColor;
+}
+
+void ScOrcusImportFontStrikethroughStyle::reset(ScOrcusFont* pDest)
+{
+ mpDestFont = pDest;
+ maAttrs.reset();
+}
+
+void ScOrcusImportFontStrikethroughStyle::set_style(orcus::spreadsheet::strikethrough_style_t s)
+{
+ maAttrs.meStyle = s;
+}
+
+void ScOrcusImportFontStrikethroughStyle::set_type(orcus::spreadsheet::strikethrough_type_t s)
+{
+ maAttrs.meType = s;
+}
+
+void ScOrcusImportFontStrikethroughStyle::set_width(orcus::spreadsheet::strikethrough_width_t s)
+{
+ maAttrs.meWidth = s;
+}
+
+void ScOrcusImportFontStrikethroughStyle::set_text(orcus::spreadsheet::strikethrough_text_t s)
+{
+ maAttrs.meText = s;
+}
+
+void ScOrcusImportFontStrikethroughStyle::commit()
+{
+ mpDestFont->meStrikeout = maAttrs.toFontStrikeout();
+}
+
ScOrcusImportFontStyle::ScOrcusImportFontStyle( ScOrcusFactory& rFactory, std::vector<ScOrcusFont>& rFonts ) :
mrFactory(rFactory),
mrFonts(rFonts)
@@ -1690,181 +2051,22 @@ void ScOrcusImportFontStyle::set_size_complex(double point)
maCurrentFont.mnSizeComplex = point;
}
-void ScOrcusImportFontStyle::set_underline(os::underline_t e)
-{
- switch(e)
- {
- case os::underline_t::single_line:
- case os::underline_t::single_accounting:
- maCurrentFont.meUnderline = LINESTYLE_SINGLE;
- break;
- case os::underline_t::double_line:
- case os::underline_t::double_accounting:
- maCurrentFont.meUnderline = LINESTYLE_DOUBLE;
- break;
- case os::underline_t::none:
- maCurrentFont.meUnderline = LINESTYLE_NONE;
- break;
- case os::underline_t::dotted:
- maCurrentFont.meUnderline = LINESTYLE_DOTTED;
- break;
- case os::underline_t::dash:
- maCurrentFont.meUnderline = LINESTYLE_DASH;
- break;
- case os::underline_t::long_dash:
- maCurrentFont.meUnderline = LINESTYLE_LONGDASH;
- break;
- case os::underline_t::dot_dash:
- maCurrentFont.meUnderline = LINESTYLE_DASHDOT;
- break;
- case os::underline_t::dot_dot_dash:
- maCurrentFont.meUnderline = LINESTYLE_DASHDOTDOT;
- break;
- case os::underline_t::wave:
- maCurrentFont.meUnderline = LINESTYLE_WAVE;
- break;
- default:
- ;
- }
-}
-
-void ScOrcusImportFontStyle::set_underline_width(os::underline_width_t e)
-{
- if (e == os::underline_width_t::bold || e == os::underline_width_t::thick)
- {
- if (maCurrentFont.meUnderline)
- {
- switch (*maCurrentFont.meUnderline)
- {
- case LINESTYLE_NONE:
- case LINESTYLE_SINGLE:
- maCurrentFont.meUnderline = LINESTYLE_BOLD;
- break;
- case LINESTYLE_DOTTED:
- maCurrentFont.meUnderline = LINESTYLE_BOLDDOTTED;
- break;
- case LINESTYLE_DASH:
- maCurrentFont.meUnderline = LINESTYLE_BOLDDASH;
- break;
- case LINESTYLE_LONGDASH:
- maCurrentFont.meUnderline = LINESTYLE_BOLDLONGDASH;
- break;
- case LINESTYLE_DASHDOT:
- maCurrentFont.meUnderline = LINESTYLE_BOLDDASHDOT;
- break;
- case LINESTYLE_DASHDOTDOT:
- maCurrentFont.meUnderline = LINESTYLE_BOLDDASHDOTDOT;
- break;
- case LINESTYLE_WAVE:
- maCurrentFont.meUnderline = LINESTYLE_BOLDWAVE;
- break;
- default:
- ;
- }
- }
- else
- maCurrentFont.meUnderline = LINESTYLE_BOLD;
- }
-}
-
-void ScOrcusImportFontStyle::set_underline_mode(os::underline_mode_t /*e*/)
-{
-}
-
-void ScOrcusImportFontStyle::set_underline_type(os::underline_type_t e )
-{
- if (e == os::underline_type_t::double_type)
- {
- if (maCurrentFont.meUnderline)
- {
- switch (*maCurrentFont.meUnderline)
- {
- case LINESTYLE_NONE:
- case LINESTYLE_SINGLE:
- maCurrentFont.meUnderline = LINESTYLE_DOUBLE;
- break;
- case LINESTYLE_WAVE:
- maCurrentFont.meUnderline = LINESTYLE_DOUBLEWAVE;
- break;
- default:
- ;
- }
- }
- else
- maCurrentFont.meUnderline = LINESTYLE_DOUBLE;
- }
-}
-
-void ScOrcusImportFontStyle::set_underline_color(
- os::color_elem_t alpha, os::color_elem_t red, os::color_elem_t green, os::color_elem_t blue)
-{
- maCurrentFont.maUnderlineColor = Color(ColorAlpha, alpha, red, green, blue);
-}
-
void ScOrcusImportFontStyle::set_color(
os::color_elem_t alpha, os::color_elem_t red, os::color_elem_t green, os::color_elem_t blue)
{
maCurrentFont.maColor = Color(ColorAlpha, alpha, red, green, blue);
}
-void ScOrcusImportFontStyle::set_strikethrough_style(os::strikethrough_style_t /*s*/)
+orcus::spreadsheet::iface::import_underline* ScOrcusImportFontStyle::start_underline()
{
+ maUnderlineImport.reset(&maCurrentFont);
+ return &maUnderlineImport;
}
-void ScOrcusImportFontStyle::set_strikethrough_type(os::strikethrough_type_t s)
+orcus::spreadsheet::iface::import_strikethrough* ScOrcusImportFontStyle::start_strikethrough()
{
- if (maCurrentFont.meStrikeout)
- {
- if (*maCurrentFont.meStrikeout == STRIKEOUT_BOLD ||
- *maCurrentFont.meStrikeout == STRIKEOUT_SLASH ||
- *maCurrentFont.meStrikeout == STRIKEOUT_X)
- return;
- }
-
- switch (s)
- {
- case os::strikethrough_type_t::unknown:
- maCurrentFont.meStrikeout = STRIKEOUT_DONTKNOW;
- break;
- case os::strikethrough_type_t::none:
- maCurrentFont.meStrikeout = STRIKEOUT_NONE;
- break;
- case os::strikethrough_type_t::single_type:
- maCurrentFont.meStrikeout = STRIKEOUT_SINGLE;
- break;
- case os::strikethrough_type_t::double_type:
- maCurrentFont.meStrikeout = STRIKEOUT_DOUBLE;
- break;
- default:
- ;
- }
-}
-
-void ScOrcusImportFontStyle::set_strikethrough_width(os::strikethrough_width_t s)
-{
- switch (s)
- {
- case os::strikethrough_width_t::bold:
- maCurrentFont.meStrikeout = STRIKEOUT_BOLD;
- break;
- default:
- ;
- }
-}
-
-void ScOrcusImportFontStyle::set_strikethrough_text(os::strikethrough_text_t s)
-{
- switch (s)
- {
- case os::strikethrough_text_t::slash:
- maCurrentFont.meStrikeout = STRIKEOUT_SLASH;
- break;
- case os::strikethrough_text_t::cross:
- maCurrentFont.meStrikeout = STRIKEOUT_X;
- break;
- default:
- ;
- }
+ maStrikeoutImport.reset(&maCurrentFont);
+ return &maStrikeoutImport;
}
std::size_t ScOrcusImportFontStyle::commit()
@@ -2437,44 +2639,4 @@ void ScOrcusStyles::set_cell_style_count(size_t /*n*/)
{
}
-// auto filter import
-
-ScOrcusAutoFilter::ScOrcusAutoFilter( const ScOrcusGlobalSettings& rGS ) :
- mrGlobalSettings(rGS)
-{
-}
-
-ScOrcusAutoFilter::~ScOrcusAutoFilter()
-{
-}
-
-void ScOrcusAutoFilter::set_range(const os::range_t& range)
-{
- maRange.aStart.SetRow(range.first.row);
- maRange.aStart.SetCol(range.first.column);
- maRange.aEnd.SetRow(range.last.row);
- maRange.aEnd.SetCol(range.last.column);
-}
-
-void ScOrcusAutoFilter::set_column(os::col_t col)
-{
- SAL_INFO("sc.orcus.autofilter", "set_column: " << col);
-}
-
-void ScOrcusAutoFilter::append_column_match_value(std::string_view value)
-{
- OUString aString(value.data(), value.size(), mrGlobalSettings.getTextEncoding());
- SAL_INFO("sc.orcus.autofilter", "append_column_match_value: " << aString);
-}
-
-void ScOrcusAutoFilter::commit_column()
-{
- SAL_INFO("sc.orcus.autofilter", "commit column");
-}
-
-void ScOrcusAutoFilter::commit()
-{
- SAL_INFO("sc.orcus.autofilter", "commit");
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 11ac33f5004a..c6b142edfe86 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -1011,7 +1011,7 @@ sal_Int32 ScRowStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32
return maCache.mnStyle;
StylesType& r = *aTables[nTable];
- if (!r.is_tree_valid())
+ if (!r.valid_tree())
r.build_tree();
sal_Int32 nStyle(0);
sal_Int32 nStart(0), nEnd(0);
--
2.52.0