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

Avoid msfilter::util::ConvertColor in DocxTableStyleExport

It's more consistent to do all the any to string conversion on the
import side. Also, when we have the ConvertColor calls in a single
place, audit grab-bag-related calls: those should always enable auto
color conversion.

Change-Id: I39ef74986617ee0ed629607e2a069047879b0422
üst 1b76aebc
...@@ -1364,6 +1364,9 @@ DECLARE_OOXML_TEST(testQuicktables, "quicktables.docx") ...@@ -1364,6 +1364,9 @@ DECLARE_OOXML_TEST(testQuicktables, "quicktables.docx")
// MediumList2-Accent1. // MediumList2-Accent1.
CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumList2-Accent1']/w:tblStylePr[@w:type='band1Vert']/w:tcPr/w:shd", "themeFillTint").equalsIgnoreAsciiCase("3F")); CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumList2-Accent1']/w:tblStylePr[@w:type='band1Vert']/w:tcPr/w:shd", "themeFillTint").equalsIgnoreAsciiCase("3F"));
// MediumShading2-Accent5.
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='MediumShading2-Accent5']/w:tblStylePr[@w:type='firstRow']/w:tcPr/w:tcBorders/w:top", "color", "auto");
} }
DECLARE_OOXML_TEST(testSmartart, "smartart.docx") DECLARE_OOXML_TEST(testSmartart, "smartart.docx")
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <oox/token/tokens.hxx> #include <oox/token/tokens.hxx>
#include <comphelper/sequenceashashmap.hxx> #include <comphelper/sequenceashashmap.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <filter/msfilter/util.hxx>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
...@@ -155,9 +154,9 @@ void lcl_TableStyleShd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be ...@@ -155,9 +154,9 @@ void lcl_TableStyleShd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
if (rShd[i].Name == "val") if (rShd[i].Name == "val")
pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr()); pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
else if (rShd[i].Name == "color") else if (rShd[i].Name == "color")
pAttributeList->add(FSNS(XML_w, XML_color), msfilter::util::ConvertColor(rShd[i].Value.get<sal_Int32>(), /*bAutoColor =*/ true)); pAttributeList->add(FSNS(XML_w, XML_color), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
else if (rShd[i].Name == "fill") else if (rShd[i].Name == "fill")
pAttributeList->add(FSNS(XML_w, XML_fill), msfilter::util::ConvertColor(rShd[i].Value.get<sal_Int32>(), /*bAutoColor =*/ true)); pAttributeList->add(FSNS(XML_w, XML_fill), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
else if (rShd[i].Name == "themeFill") else if (rShd[i].Name == "themeFill")
pAttributeList->add(FSNS(XML_w, XML_themeFill), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr()); pAttributeList->add(FSNS(XML_w, XML_themeFill), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
else if (rShd[i].Name == "themeFillShade") else if (rShd[i].Name == "themeFillShade")
......
...@@ -83,7 +83,7 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal) ...@@ -83,7 +83,7 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal)
case NS_ooxml::LN_CT_Border_color: case NS_ooxml::LN_CT_Border_color:
case NS_rtf::LN_ICO: // 0x2873 case NS_rtf::LN_ICO: // 0x2873
m_nLineColor = nIntValue; m_nLineColor = nIntValue;
appendGrabBag("color", OStringToOUString(msfilter::util::ConvertColor(nIntValue), RTL_TEXTENCODING_UTF8)); appendGrabBag("color", OStringToOUString(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true), RTL_TEXTENCODING_UTF8));
break; break;
case NS_rtf::LN_DPTSPACE: // border distance in points case NS_rtf::LN_DPTSPACE: // border distance in points
m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue * 20 ); m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue * 20 );
......
...@@ -117,13 +117,13 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal) ...@@ -117,13 +117,13 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
} }
break; break;
case NS_ooxml::LN_CT_Shd_fill: case NS_ooxml::LN_CT_Shd_fill:
createGrabBag("fill", uno::makeAny(nIntValue)); createGrabBag("fill", uno::makeAny(OStringToOUString(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true), RTL_TEXTENCODING_UTF8)));
if( nIntValue == OOXML_COLOR_AUTO ) if( nIntValue == OOXML_COLOR_AUTO )
nIntValue = 0xffffff; //fill color auto means white nIntValue = 0xffffff; //fill color auto means white
m_nFillColor = nIntValue; m_nFillColor = nIntValue;
break; break;
case NS_ooxml::LN_CT_Shd_color: case NS_ooxml::LN_CT_Shd_color:
createGrabBag("color", uno::makeAny(nIntValue)); createGrabBag("color", uno::makeAny(OStringToOUString(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true), RTL_TEXTENCODING_UTF8)));
if( nIntValue == OOXML_COLOR_AUTO ) if( nIntValue == OOXML_COLOR_AUTO )
nIntValue = 0; //shading color auto means black nIntValue = 0; //shading color auto means black
//color of the shading //color of the shading
......
...@@ -916,7 +916,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) ...@@ -916,7 +916,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Color_val: case NS_ooxml::LN_CT_Color_val:
if (m_pImpl->GetTopContext()) if (m_pImpl->GetTopContext())
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) ); m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) );
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OStringToOUString(msfilter::util::ConvertColor(nIntValue), RTL_TEXTENCODING_UTF8)); m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OStringToOUString(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true), RTL_TEXTENCODING_UTF8));
break; break;
case NS_ooxml::LN_CT_Underline_color: case NS_ooxml::LN_CT_Underline_color:
if (m_pImpl->GetTopContext()) if (m_pImpl->GetTopContext())
......
...@@ -336,7 +336,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal) ...@@ -336,7 +336,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
break; break;
case NS_ooxml::LN_CT_Border_color: case NS_ooxml::LN_CT_Border_color:
case NS_rtf::LN_ICO: // 0x2873 case NS_rtf::LN_ICO: // 0x2873
appendGrabBag("color", OStringToOUString(msfilter::util::ConvertColor(nIntValue), RTL_TEXTENCODING_UTF8)); appendGrabBag("color", OStringToOUString(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true), RTL_TEXTENCODING_UTF8));
m_nLineColor = nIntValue; m_nLineColor = nIntValue;
break; break;
case NS_rtf::LN_DPTSPACE: // 0x2874 case NS_rtf::LN_DPTSPACE: // 0x2874
......
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