tdf#118936 writerfilter: MultiPropertySet exception lost properties

An unsupported character style property was causing the loss of
some properties - anything with a higher sorting value.

Another way to deal with this could be something similar
to section properties which retries properties individually
if multiset fails.

Another option is to add CHAR_SHADING_VALUE to aCharStyleMap
in unomap1.cxx, since it is already in aAutoCharStyleMap.
However, this is an area I completely don't understand.

Change-Id: I70676c7a35d0efc95222960609da039e26df8a58
Reviewed-on: https://gerrit.libreoffice.org/76875
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index fb6836c..ec87951 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -332,6 +332,11 @@ DECLARE_OOXMLEXPORT_TEST(testTcBorders, "testTcBorders.docx")
    assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:sz = 4]", 1);
    assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:space = 0]", 1);
    assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:color = 808080]", 1);

    uno::Reference<beans::XPropertySet> xStyle(
        getStyles("CharacterStyles")->getByName("Code Featured Element"),
        uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Bold", float(150), getProperty<float>(xStyle, "CharWeight"));
}

DECLARE_OOXMLEXPORT_TEST(testQuicktables, "quicktables.docx")
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 5b23d9a..d3630e7 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -913,6 +913,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                if( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR || pEntry->nStyleTypeCode == STYLE_TYPE_PARA || pEntry->nStyleTypeCode == STYLE_TYPE_LIST )
                {
                    bool bParaStyle = pEntry->nStyleTypeCode == STYLE_TYPE_PARA;
                    bool bCharStyle = pEntry->nStyleTypeCode == STYLE_TYPE_CHAR;
                    bool bListStyle = pEntry->nStyleTypeCode == STYLE_TYPE_LIST;
                    bool bInsert = false;
                    uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : (bListStyle ? xNumberingStyles : xCharStyles);
@@ -1098,7 +1099,8 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                            // Don't add the style name properties
                            bool bIsParaStyleName = rValue.Name == "ParaStyleName";
                            bool bIsCharStyleName = rValue.Name == "CharStyleName";
                            if ( !bIsParaStyleName && !bIsCharStyleName )
                            bool bDirectFormattingOnly = bCharStyle && rValue.Name == "CharShadingValue";
                            if ( !bIsParaStyleName && !bIsCharStyleName && !bDirectFormattingOnly )
                            {
                                aSortedPropVals.Insert(rValue);
                            }
@@ -1133,6 +1135,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                                aMessage += ": " + aUnknownPropertyException.Message;

                            SAL_WARN("writerfilter", aMessage);
                            assert (false && "SERIOUS: remaining alphabetically sorted properties were lost");
#else
                            (void) rWrapped;
#endif