summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-06-01 20:18:46 -0400
committerJustin Luth <jluth@mail.com>2023-06-02 04:27:44 +0200
commit3e6f4bbefaa4f4f83210970210aa7796aab7cf03 (patch)
tree7f640ab1a36fd35286b5027fba52dca798a1396d
parent472abf99a4d90d7a53316394a2e51a26b7e62345 (diff)
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 <jluth@mail.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf154751_dualStrikethrough.docxbin0 -> 11980 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport18.cxx7
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx16
3 files changed, 19 insertions, 4 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf154751_dualStrikethrough.docx
Binary files 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: