From dbf2ad161fdead7ca29fb96f5d8eb9f4da604827 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 6 Jul 2011 11:01:56 +0200 Subject: [PATCH] add comment explaining ww8 import does the same --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1f5b31b22611..8320b30d2bdb 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -259,12 +259,16 @@ static const char* lcl_RtfToString(RTFKeyword nKeyword) return NULL; } -sal_uInt32 lcl_BrgToRgb(sal_uInt32 nBrg) +// NEEDSWORK: wwUtility::BGRToRGB does the same. +sal_uInt32 lcl_BGRToRGB(sal_uInt32 nColor) { - sal_uInt32 nBlue = (nBrg & 0xff0000) >> 16; - sal_uInt32 nGreen = (nBrg & 0x00ff00) >> 8; - sal_uInt32 nRed = nBrg & 0x0000ff; - return (nRed << 16) | (nGreen << 8) | nBlue; + sal_uInt8 + r(static_cast(nColor&0xFF)), + g(static_cast(((nColor)>>8)&0xFF)), + b(static_cast((nColor>>16)&0xFF)), + t(static_cast((nColor>>24)&0xFF)); + nColor = (t<<24) + (r<<16) + (g<<8) + b; + return nColor; } RTFDocumentImpl::RTFDocumentImpl(uno::Reference const& xContext, @@ -2460,7 +2464,7 @@ void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pairfirst.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("fillColor"))) { uno::Any aColor; - aColor <<= lcl_BrgToRgb(i->second.toInt32()); + aColor <<= lcl_BGRToRGB(i->second.toInt32()); xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aColor); } else