Kaydet (Commit) 83258658 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX filter: more run properties table style roundtrip work

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

Change-Id: I1ac88de030356a5ce08a28ac16cd159a426d2be9
üst 2bb5f477
...@@ -1332,6 +1332,10 @@ DECLARE_OOXML_TEST(testCalendar2, "calendar2.docx") ...@@ -1332,6 +1332,10 @@ DECLARE_OOXML_TEST(testCalendar2, "calendar2.docx")
// These run properties were missing // 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", "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: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 // Table borders were also missing
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblPr/w:tblBorders/w:insideV", "themeTint", "99"); assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:tblPr/w:tblBorders/w:insideV", "themeTint", "99");
......
...@@ -174,6 +174,8 @@ void lcl_TableStyleRColor(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence ...@@ -174,6 +174,8 @@ void lcl_TableStyleRColor(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence
{ {
if (rColor[i].Name == "val") if (rColor[i].Name == "val")
pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rColor[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr()); 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); sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
pSerializer->singleElementNS(XML_w, XML_color, xAttributeList); pSerializer->singleElementNS(XML_w, XML_color, xAttributeList);
...@@ -285,7 +287,7 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be ...@@ -285,7 +287,7 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
pSerializer->startElementNS(XML_w, XML_rPr, FSEND); pSerializer->startElementNS(XML_w, XML_rPr, FSEND);
uno::Sequence<beans::PropertyValue> aRFonts, aLang, aColor; 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) for (sal_Int32 i = 0; i < rRPr.getLength(); ++i)
{ {
if (rRPr[i].Name == "rFonts") if (rRPr[i].Name == "rFonts")
...@@ -302,12 +304,24 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be ...@@ -302,12 +304,24 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
aSz = rRPr[i].Value.get<OUString>(); aSz = rRPr[i].Value.get<OUString>();
else if (rRPr[i].Name == "szCs") else if (rRPr[i].Name == "szCs")
aSzCs = rRPr[i].Value.get<OUString>(); 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_TableStyleRRFonts(pSerializer, aRFonts);
lcl_TableStyleRLang(pSerializer, aLang); lcl_TableStyleRLang(pSerializer, aLang);
lcl_handleBoolean(aB, XML_b, pSerializer); lcl_handleBoolean(aB, XML_b, pSerializer);
lcl_handleBoolean(aI, XML_i, pSerializer); lcl_handleBoolean(aI, XML_i, pSerializer);
lcl_handleBoolean(aCaps, XML_caps, pSerializer);
lcl_handleBoolean(aSmallCaps, XML_smallCaps, pSerializer);
lcl_TableStyleRColor(pSerializer, aColor); 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()) if (!aSz.isEmpty())
pSerializer->singleElementNS(XML_w, XML_sz, pSerializer->singleElementNS(XML_w, XML_sz,
FSNS(XML_w, XML_val), OUStringToOString(aSz, RTL_TEXTENCODING_UTF8).getStr(), FSNS(XML_w, XML_val), OUStringToOString(aSz, RTL_TEXTENCODING_UTF8).getStr(),
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <resourcemodel/ResourceModelHelper.hxx> #include <resourcemodel/ResourceModelHelper.hxx>
#include <SdtHelper.hxx> #include <SdtHelper.hxx>
#include <TDefTableHandler.hxx>
#include <DomainMapper_Impl.hxx> #include <DomainMapper_Impl.hxx>
#include <ConversionHelper.hxx> #include <ConversionHelper.hxx>
#include <ModelEventListener.hxx> #include <ModelEventListener.hxx>
...@@ -1440,6 +1441,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) ...@@ -1440,6 +1441,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_FtnEdnRef_id: case NS_ooxml::LN_CT_FtnEdnRef_id:
// footnote or endnote reference id - not needed // footnote or endnote reference id - not needed
case NS_ooxml::LN_CT_Color_themeColor: 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_themeTint:
case NS_ooxml::LN_CT_Color_themeShade: case NS_ooxml::LN_CT_Color_themeShade:
//unsupported //unsupported
...@@ -2196,10 +2199,12 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType ...@@ -2196,10 +2199,12 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
case NS_sprm::LN_CFSmallCaps: /*sprmCFSmallCaps*/ case NS_sprm::LN_CFSmallCaps: /*sprmCFSmallCaps*/
rContext->Insert(ePropertyId, rContext->Insert(ePropertyId,
uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE)); uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE));
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "smallCaps", OUString::number(nIntValue));
break; break;
case NS_sprm::LN_CFCaps: /*sprmCFCaps*/ case NS_sprm::LN_CFCaps: /*sprmCFCaps*/
rContext->Insert(ePropertyId, rContext->Insert(ePropertyId,
uno::makeAny( nIntValue ? style::CaseMap::UPPERCASE : style::CaseMap::NONE)); uno::makeAny( nIntValue ? style::CaseMap::UPPERCASE : style::CaseMap::NONE));
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "caps", OUString::number(nIntValue));
break; break;
case NS_sprm::LN_CFEmboss: /*sprmCFEmboss*/ case NS_sprm::LN_CFEmboss: /*sprmCFEmboss*/
rContext->Insert(ePropertyId, rContext->Insert(ePropertyId,
...@@ -2305,6 +2310,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType ...@@ -2305,6 +2310,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
nResult = static_cast<sal_Int16>(nIntValue); nResult = static_cast<sal_Int16>(nIntValue);
} }
rContext->Insert(PROP_CHAR_CHAR_KERNING, uno::makeAny(nResult)); rContext->Insert(PROP_CHAR_CHAR_KERNING, uno::makeAny(nResult));
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "spacing", OUString::number(nIntValue));
} }
break; break;
case NS_sprm::LN_CHpsKern: // sprmCHpsKern auto kerning is bound to a minimum font size in Word - but not in Writer :-( case NS_sprm::LN_CHpsKern: // sprmCHpsKern auto kerning is bound to a minimum font size in Word - but not in Writer :-(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment