filter/source/msfilter/util.cxx                  |    5 +----
 include/filter/msfilter/util.hxx                 |    5 +----
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx         |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx       |   14 --------------
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx        |   16 ++++++++--------
 sw/source/core/text/xmldump.cxx                  |    3 ++-
 writerfilter/source/dmapper/BorderHandler.cxx    |    2 +-
 writerfilter/source/dmapper/CellColorHandler.cxx |   10 +++++-----
 writerfilter/source/dmapper/DomainMapper.cxx     |    2 +-
 writerfilter/source/dmapper/TDefTableHandler.cxx |    2 +-
 writerfilter/source/ooxml/OOXMLFactory.cxx       |    9 +++++++++
 writerfilter/source/ooxml/OOXMLFactory.hxx       |    1 +
 writerfilter/source/ooxml/OOXMLPropertySet.cxx   |   16 ++++++++++++++++
 writerfilter/source/ooxml/OOXMLPropertySet.hxx   |    8 ++++++++
 writerfilter/source/ooxml/factoryimpl.py         |    5 ++++-
 writerfilter/source/ooxml/model.xml              |    2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |    6 ++++--
 17 files changed, 64 insertions(+), 44 deletions(-)

New commits:
commit fe6da2feb57c3d5e355a36f6b8ac09b48412ff39
Author: Luke Deller <l...@deller.id.au>
Date:   Thu Mar 8 01:11:40 2018 +1100

    tdf#116179 Support reading "auto" colour from docx
    
    In docx a colour value is represented as a 6-digit hex RGB value, or
    alternatively the word "auto" to represent automatic colour.
    
     - Add support for reading the value "auto" as COL_AUTO.  Previously
       this would be read as if it were a hex value, stopping at the
       letter 'u' which is not a valid hex digit, resulting in the colour
       0x00000A - a very dark blue, which looks close enough to black that
       it went unnoticed for a long time :-)
    
     - Remove code which tried to handle this wrong 0x00000A value,
       including the constant OOXML_COLOR_AUTO, as it is no longer needed
       and will cause surprises for anyone who really wanted this exact
       shade of dark blue
    
     - Fix unit tests that were checking for 0x00000A
    
    Change-Id: I6000070341931147ff9341ad6281cd3b53c02b46
    Reviewed-on: https://gerrit.libreoffice.org/50995
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index cdb885bd9449..fec841f2d34f 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -126,13 +126,10 @@ sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar,
 }
 
 
-OString ConvertColor( const Color & rColor, bool bAutoColor )
+OString ConvertColor( const Color &rColor )
 {
     OString color( "auto" );
 
-    if (bAutoColor && rColor == OOXML_COLOR_AUTO)
-        return color;
-
     if ( rColor != COL_AUTO )
     {
         const char pHexDigits[] = "0123456789ABCDEF";
diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx
index 50252fc6191a..6718dffc9299 100644
--- a/include/filter/msfilter/util.hxx
+++ b/include/filter/msfilter/util.hxx
@@ -56,15 +56,12 @@ MSFILTER_DLLPUBLIC sal_Unicode 
bestFitOpenSymbolToMSFont(sal_Unicode cBullet,
     rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName);
 
 
-#define OOXML_COLOR_AUTO 0x0a
-
 /**
  * Converts tools Color to HTML color (without leading hashmark).
  *
  * @param rColor color to convert
- * @param bAutoColor if OOXML_COLOR_AUTO should be recognized as an auto color
  */
-MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor, bool bAutoColor 
= false );
+MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor );
 
 
 /** Paper size in 1/100 millimeters. */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b7acdffbdc16..bc831c024ec1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -715,7 +715,7 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, 
"num-override-lvltext.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), 
comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get<sal_Int16>());
 
     // The paragraph marker's red font color was inherited by the number 
portion, this was ff0000.
-    CPPUNIT_ASSERT_EQUAL(OUString("00000a"), 
parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color"));
+    CPPUNIT_ASSERT_EQUAL(OUString("ffffffff"), 
parseDump("//Special[@nType='POR_NUMBER']/SwFont", "color"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testNumOverrideStart, "num-override-start.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 813b0c3c4f3c..4fdc51170d49 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -277,21 +277,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx")
 
     // Check that the page number field colour is set to "automatic".
     sal_Int32 nPgNumColour = getProperty<sal_Int32>(xPgNumRun, "CharColor");
-#if 0
-    // TODO Enable this once tdf#116179 is fixed
     CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), nPgNumColour);
-
-#else
-    // Meanwhile just check that the page number field colour is different
-    // from the green text before it:
-
-    // Select the first run containing the green text
-    auto xTextRun = getRun(getParagraph(1), 1);
-
-    // Check that the page number field colour is different from the green text
-    CPPUNIT_ASSERT(getProperty<sal_Int32>(xTextRun, "CharColor") != 
nPgNumColour);
-#endif
-
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index fc98eb98243d..1fa183ca174a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -650,43 +650,43 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color
 = 'auto']", 1);
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color
 = 'auto']", 1);
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color
 = 'auto']", 1);
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color
 = 'auto']", 1);
 
     //Table Cell Borders
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:color
 = 'auto']", 1);
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:color
 = 'auto']", 1);
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:color
 = 'auto']", 1);
 
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:val
 = 'single']",1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:sz
 = 4]", 1);
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:space
 = 0]", 1);
-    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:color
 = '00000A']", 1);
+    assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:color
 = 'auto']", 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo77129, "fdo77129.docx")
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 3aa391f92724..e7c1fade99a7 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -465,7 +465,8 @@ void SwFont::dumpAsXml(xmlTextWriterPtr writer) const
 {
     xmlTextWriterStartElement(writer, BAD_CAST("SwFont"));
     xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", this);
-    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("color"), "%s", 
GetColor().AsRGBHexString().toUtf8().getStr());
+    // do not use Color::AsRGBHexString() as that omits the transparency
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("color"), "%08x", 
sal_uInt32(GetColor()));
     xmlTextWriterEndElement(writer);
 }
 
diff --git a/writerfilter/source/dmapper/BorderHandler.cxx 
b/writerfilter/source/dmapper/BorderHandler.cxx
index e2528c28d50e..0a07c9753393 100644
--- a/writerfilter/source/dmapper/BorderHandler.cxx
+++ b/writerfilter/source/dmapper/BorderHandler.cxx
@@ -67,7 +67,7 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal)
         break;
         case NS_ooxml::LN_CT_Border_color:
             m_nLineColor = nIntValue;
-            appendGrabBag("color", 
OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, 
/*bAutoColor=*/true)));
+            appendGrabBag("color", 
OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
         break;
         case NS_ooxml::LN_CT_Border_space: // border distance in points
             m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue 
* 20 );
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx 
b/writerfilter/source/dmapper/CellColorHandler.cxx
index cb8fccac1f71..968c1b1f553f 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -109,8 +109,8 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
         }
         break;
         case NS_ooxml::LN_CT_Shd_fill:
-            createGrabBag("fill", 
uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, 
/*bAutoColor=*/true))));
-            if( nIntValue == OOXML_COLOR_AUTO )
+            createGrabBag("fill", 
uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
+            if( nIntValue == sal_Int32(COL_AUTO) )
                 nIntValue = 0xffffff; //fill color auto means white
             else
                 m_bAutoFillColor = false;
@@ -118,8 +118,8 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
             m_nFillColor = nIntValue;
         break;
         case NS_ooxml::LN_CT_Shd_color:
-            createGrabBag("color", 
uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, 
/*bAutoColor=*/true))));
-            if( nIntValue == OOXML_COLOR_AUTO )
+            createGrabBag("color", 
uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
+            if( nIntValue == sal_Int32(COL_AUTO) )
                 nIntValue = 0; //shading color auto means black
             //color of the shading
             m_nColor = nIntValue;
@@ -283,7 +283,7 @@ TablePropertyMapPtr  CellColorHandler::getProperties()
         pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
                             : PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor 
));
 
-    createGrabBag("originalColor", 
uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nApplyColor, 
true))));
+    createGrabBag("originalColor", 
uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nApplyColor))));
 
     return pPropertyMap;
 }
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 60f65a481084..310bf761f3b7 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -304,7 +304,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         case NS_ooxml::LN_CT_Color_val:
             if (m_pImpl->GetTopContext())
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, 
uno::makeAny( nIntValue ) );
-            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", 
OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, 
/*bAutoColor=*/true)));
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", 
OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
             break;
         case NS_ooxml::LN_CT_Underline_color:
             if (m_pImpl->GetTopContext())
diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx 
b/writerfilter/source/dmapper/TDefTableHandler.cxx
index bd594fc510cb..b86f37ed8bf3 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -287,7 +287,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
             appendGrabBag("val", 
TDefTableHandler::getBorderTypeString(nIntValue));
         break;
         case NS_ooxml::LN_CT_Border_color:
-            appendGrabBag("color", 
OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, 
/*bAutoColor=*/true)));
+            appendGrabBag("color", 
OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
             m_nLineColor = nIntValue;
         break;
         case NS_ooxml::LN_CT_Border_space:
diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx 
b/writerfilter/source/ooxml/OOXMLFactory.cxx
index c164ff949757..91eb7b0e4c96 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.cxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.cxx
@@ -96,6 +96,15 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * 
pHandler,
                 pFactory->attributeAction(pHandler, nToken, xValue);
             }
             break;
+        case ResourceType::HexColor:
+            {
+                const char *pValue = "";
+                pAttribs->getAsChar(nToken, pValue);
+                OOXMLValue::Pointer_t xValue(new OOXMLHexColorValue(pValue));
+                pHandler->newProperty(nId, xValue);
+                pFactory->attributeAction(pHandler, nToken, xValue);
+            }
+            break;
         case ResourceType::TwipsMeasure:
             {
                 const char *pValue = "";
diff --git a/writerfilter/source/ooxml/OOXMLFactory.hxx 
b/writerfilter/source/ooxml/OOXMLFactory.hxx
index dce03696185c..fcf89155ae7c 100644
--- a/writerfilter/source/ooxml/OOXMLFactory.hxx
+++ b/writerfilter/source/ooxml/OOXMLFactory.hxx
@@ -40,6 +40,7 @@ enum class ResourceType {
     Integer,
     Properties,
     Hex,
+    HexColor,
     String,
     Shape,
     Boolean,
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index 195d75b83185..13c5cf0493b7 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -23,6 +23,7 @@
 #include <ooxml/QNameToString.hxx>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <oox/token/tokens.hxx>
+#include <tools/color.hxx>
 
 namespace writerfilter {
 namespace ooxml
@@ -577,6 +578,21 @@ string OOXMLHexValue::toString() const
 }
 #endif
 
+/*
+  class OOXMLHexColorValue
+*/
+OOXMLHexColorValue::OOXMLHexColorValue(const char * pValue)
+{
+    if (!strcmp(pValue, "auto"))
+    {
+        mnValue = sal_uInt32(COL_AUTO);
+    }
+    else
+    {
+        mnValue = rtl_str_toUInt32(pValue, 16);
+    }
+}
+
 // OOXMLUniversalMeasureValue
 // ECMA-376 5th ed. Part 1 , 22.9.2.15
 OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(const char * pValue, 
sal_uInt32 npPt)
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
index fbedaeda6498..d8c38d87d904 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
@@ -211,7 +211,9 @@ public:
 
 class OOXMLHexValue : public OOXMLValue
 {
+protected:
     sal_uInt32 mnValue;
+    OOXMLHexValue() {}
 public:
     explicit OOXMLHexValue(sal_uInt32 nValue);
     explicit OOXMLHexValue(const char * pValue);
@@ -224,6 +226,12 @@ public:
     virtual OOXMLValue * clone() const override;
 };
 
+class OOXMLHexColorValue : public OOXMLHexValue
+{
+public:
+    explicit OOXMLHexColorValue(const char * pValue);
+};
+
 class OOXMLUniversalMeasureValue : public OOXMLValue
 {
 private:
diff --git a/writerfilter/source/ooxml/factoryimpl.py 
b/writerfilter/source/ooxml/factoryimpl.py
index 3605892fe71f..acbaf4234261 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -37,7 +37,10 @@ def createFastChildContextFromFactory(model):
 
             switch (nResource)
             {""")
-    resources = ["List", "Integer", "Hex", "String", "TwipsMeasure", 
"HpsMeasure", "Boolean", "MeasurementOrPercent"]
+    resources = [
+        "List", "Integer", "Hex", "HexColor", "String", "TwipsMeasure",
+        "HpsMeasure", "Boolean", "MeasurementOrPercent",
+    ]
     for resource in [r.getAttribute("resource") for r in 
model.getElementsByTagName("resource")]:
         if resource not in resources:
             resources.append(resource)
diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index a9ffbdfa6c65..25f8a267bb8a 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -16710,7 +16710,7 @@
       <value tokenid="ooxml:Value_ST_HexColorAuto_auto">auto</value>
     </resource>
     <resource name="ST_HexColorRGB" resource="Hex"/>
-    <resource name="ST_HexColor" resource="Hex"/>
+    <resource name="ST_HexColor" resource="HexColor"/>
     <resource name="CT_Color" resource="Properties">
       <attribute name="val" tokenid="ooxml:CT_Color_val"/>
       <attribute name="themeColor" tokenid="ooxml:CT_Color_themeColor"/>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b5d839f85027..4d5cf17c0b6e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -86,8 +86,10 @@ void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id 
nId, const RTFValue::Po
         if (nParent == NS_ooxml::LN_CT_TcPrBase_shd)
         {
             // RTF default is 'auto', see 
writerfilter::dmapper::CellColorHandler
-            aAttributes.set(NS_ooxml::LN_CT_Shd_color, 
std::make_shared<RTFValue>(0x0a));
-            aAttributes.set(NS_ooxml::LN_CT_Shd_fill, 
std::make_shared<RTFValue>(0x0a));
+            aAttributes.set(NS_ooxml::LN_CT_Shd_color,
+                            std::make_shared<RTFValue>(sal_uInt32(COL_AUTO)));
+            aAttributes.set(NS_ooxml::LN_CT_Shd_fill,
+                            std::make_shared<RTFValue>(sal_uInt32(COL_AUTO)));
         }
         auto pParentValue = std::make_shared<RTFValue>(aAttributes);
         rSprms.set(nParent, pParentValue, eOverwrite);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to