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>
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 0000000..4669be3
--- /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 0b66396..63f5b41 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 06bd0dd..fb31132 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: