DOCX filter: more run properties table style roundtrip work

Implement roundtrip of smallCaps, spacing, caps and color's themeColor
attribute.

Change-Id: I1ac88de030356a5ce08a28ac16cd159a426d2be9
diff --git a/sw/qa/extras/ooxmlexport/data/calendar2.docx b/sw/qa/extras/ooxmlexport/data/calendar2.docx
index e89222f..4e7d4ed 100644
--- a/sw/qa/extras/ooxmlexport/data/calendar2.docx
+++ b/sw/qa/extras/ooxmlexport/data/calendar2.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b4ecd7d..c7498d43 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1332,6 +1332,10 @@ DECLARE_OOXML_TEST(testCalendar2, "calendar2.docx")
    // These run properties were missing
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:rPr/w:lang", "val", "en-US");
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:rPr/w:lang", "bidi", "ar-SA");
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:caps", 1);
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:smallCaps", "val", "0");
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:color", "themeColor", "accent1");
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:spacing", "val", "20");

    // Table borders were also missing
    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblPr/w:tblBorders/w:insideV", "themeTint", "99");
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index cc92461..f909876 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -174,6 +174,8 @@ void lcl_TableStyleRColor(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence
    {
        if (rColor[i].Name == "val")
            pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rColor[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
        else if (rColor[i].Name == "themeColor")
            pAttributeList->add(FSNS(XML_w, XML_themeColor), OUStringToOString(rColor[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
    }
    sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
    pSerializer->singleElementNS(XML_w, XML_color, xAttributeList);
@@ -285,7 +287,7 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
    pSerializer->startElementNS(XML_w, XML_rPr, FSEND);

    uno::Sequence<beans::PropertyValue> aRFonts, aLang, aColor;
    OUString aB, aI, aSz, aSzCs;
    OUString aB, aI, aSz, aSzCs, aCaps, aSmallCaps, aSpacing;
    for (sal_Int32 i = 0; i < rRPr.getLength(); ++i)
    {
        if (rRPr[i].Name == "rFonts")
@@ -302,12 +304,24 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
            aSz = rRPr[i].Value.get<OUString>();
        else if (rRPr[i].Name == "szCs")
            aSzCs = rRPr[i].Value.get<OUString>();
        else if (rRPr[i].Name == "caps")
            aCaps = rRPr[i].Value.get<OUString>();
        else if (rRPr[i].Name == "smallCaps")
            aSmallCaps = rRPr[i].Value.get<OUString>();
        else if (rRPr[i].Name == "spacing")
            aSpacing = rRPr[i].Value.get<OUString>();
    }
    lcl_TableStyleRRFonts(pSerializer, aRFonts);
    lcl_TableStyleRLang(pSerializer, aLang);
    lcl_handleBoolean(aB, XML_b, pSerializer);
    lcl_handleBoolean(aI, XML_i, pSerializer);
    lcl_handleBoolean(aCaps, XML_caps, pSerializer);
    lcl_handleBoolean(aSmallCaps, XML_smallCaps, pSerializer);
    lcl_TableStyleRColor(pSerializer, aColor);
    if (!aSpacing.isEmpty())
        pSerializer->singleElementNS(XML_w, XML_spacing,
                FSNS(XML_w, XML_val), OUStringToOString(aSpacing, RTL_TEXTENCODING_UTF8).getStr(),
                FSEND);
    if (!aSz.isEmpty())
        pSerializer->singleElementNS(XML_w, XML_sz,
                FSNS(XML_w, XML_val), OUStringToOString(aSz, RTL_TEXTENCODING_UTF8).getStr(),
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 0d48d99..d026fa5 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -20,6 +20,7 @@

#include <resourcemodel/ResourceModelHelper.hxx>
#include <SdtHelper.hxx>
#include <TDefTableHandler.hxx>
#include <DomainMapper_Impl.hxx>
#include <ConversionHelper.hxx>
#include <ModelEventListener.hxx>
@@ -1440,6 +1441,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
        case NS_ooxml::LN_CT_FtnEdnRef_id:
            // footnote or endnote reference id - not needed
        case NS_ooxml::LN_CT_Color_themeColor:
            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
        break;
        case NS_ooxml::LN_CT_Color_themeTint:
        case NS_ooxml::LN_CT_Color_themeShade:
            //unsupported
@@ -2196,10 +2199,12 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                    case NS_sprm::LN_CFSmallCaps: /*sprmCFSmallCaps*/
                        rContext->Insert(ePropertyId,
                                         uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE));
                        m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "smallCaps", OUString::number(nIntValue));
                    break;
                    case NS_sprm::LN_CFCaps: /*sprmCFCaps*/
                        rContext->Insert(ePropertyId,
                                         uno::makeAny( nIntValue ? style::CaseMap::UPPERCASE : style::CaseMap::NONE));
                        m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "caps", OUString::number(nIntValue));
                    break;
                    case NS_sprm::LN_CFEmboss: /*sprmCFEmboss*/
                        rContext->Insert(ePropertyId,
@@ -2305,6 +2310,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                nResult = static_cast<sal_Int16>(nIntValue);
            }
            rContext->Insert(PROP_CHAR_CHAR_KERNING, uno::makeAny(nResult));
            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "spacing", OUString::number(nIntValue));
        }
        break;
    case NS_sprm::LN_CHpsKern:  // sprmCHpsKern    auto kerning is bound to a minimum font size in Word - but not in Writer :-(