sw/qa/extras/ooxmlexport/data/tdf154751_dualStrikethrough.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 7 ++++ writerfilter/source/dmapper/DomainMapper.cxx | 16 +++++++--- 3 files changed, 19 insertions(+), 4 deletions(-)
New commits: commit 3e6f4bbefaa4f4f83210970210aa7796aab7cf03 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Thu Jun 1 20:18:46 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Fri Jun 2 04:27:44 2023 +0200 tdf#154751 writerfilter: last enabled strikethrough wins The problem is that multiple strikeout character properties can be defined for DOCX, but it is implemented using a single property in LO. If the last definition was "not *strike" then all strikeouts were disabled. Instead, if any strikeout is enabled, the last one overrides the others, but cancelling doesn't negate a previously defined strikeout. make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf154751_dualStrikethrough Change-Id: Iaf17380061a0b37db4bc7a87c703e81f0181bcc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152514 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf154751_dualStrikethrough.docx b/sw/qa/extras/ooxmlexport/data/tdf154751_dualStrikethrough.docx new file mode 100644 index 000000000000..4669be366a68 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf154751_dualStrikethrough.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 0b66396d556e..63f5b419df7f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -11,6 +11,7 @@ #include <queue> +#include <com/sun/star/awt/FontStrikeout.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> #include <com/sun/star/drawing/XShapes.hpp> @@ -151,6 +152,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_noTab, "tdf153042_noTab.docx") assertXPath(pLayout, "//SwFixPortion", "width", "10"); } +DECLARE_OOXMLEXPORT_TEST(testTdf154751_dualStrikethrough, "tdf154751_dualStrikethrough.docx") +{ + auto nStrike = getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharStrikeout"); + CPPUNIT_ASSERT_EQUAL(awt::FontStrikeout::SINGLE, nStrike); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf154478) { loadAndSave("tdf154478.docx"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 06bd0dd10ed1..fb3113273079 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1921,12 +1921,20 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } break; case NS_ooxml::LN_EG_RPrBase_strike: - rContext->Insert(ePropertyId, - uno::Any( nIntValue ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE ) ); + { + const auto eStrike + = nIntValue ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE; + const bool bOverwrite(nIntValue); + rContext->Insert(ePropertyId, uno::Any(eStrike), bOverwrite); + } break; case NS_ooxml::LN_EG_RPrBase_dstrike: - rContext->Insert(ePropertyId, - uno::Any( nIntValue ? awt::FontStrikeout::DOUBLE : awt::FontStrikeout::NONE ) ); + { + const auto eStrike + = nIntValue ? awt::FontStrikeout::DOUBLE : awt::FontStrikeout::NONE; + const bool bOverwrite(nIntValue); + rContext->Insert(ePropertyId, uno::Any(eStrike), bOverwrite); + } break; case NS_ooxml::LN_EG_RPrBase_outline: case NS_ooxml::LN_EG_RPrBase_shadow: