diff options
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 14 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 22 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8struc.hxx | 7 |
12 files changed, 43 insertions, 38 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 29d5cf1dbb78..6c069de73777 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2984,7 +2984,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT // no need to write them. if( rStyleProps != nullptr && pBorderLine && !pBorderLine->isEmpty() && pBorderLine->GetBorderLineStyle() == static_cast<SvxBorderLineStyle>(rStyleProps->LineStyle) && - pBorderLine->GetColor() == rStyleProps->Color && + pBorderLine->GetColor() == Color(rStyleProps->Color) && pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) ) return; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 56c4169aff32..5e14913bb865 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1646,7 +1646,7 @@ void lcl_TextFrameShadow(std::vector<std::pair<OString, OString>>& rFlyPropertie const Color& rColor = aShadowItem.GetColor(); // We in fact need RGB to BGR, but the transformation is symmetric. rFlyProperties.push_back(std::make_pair<OString, OString>( - "shadowColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); + "shadowColor", OString::number(wwUtility::RGBToBGR(rColor)))); // Twips -> points -> EMUs -- hacky, the intermediate step hides rounding errors on roundtrip. OString aShadowWidth = OString::number(sal_Int32(aShadowItem.GetWidth() / 20) * 12700); @@ -3267,7 +3267,7 @@ void RtfAttributeOutput::FormatBackground(const SvxBrushItem& rBrush) const Color& rColor = rBrush.GetColor(); // We in fact need RGB to BGR, but the transformation is symmetric. m_aFlyProperties.push_back(std::make_pair<OString, OString>( - "fillColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); + "fillColor", OString::number(wwUtility::RGBToBGR(rColor)))); } else if (!rBrush.GetColor().GetTransparency()) { @@ -3291,11 +3291,11 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie const XGradient& rGradient = rFillGradient.GetGradientValue(); const Color& rStartColor = rGradient.GetStartColor(); m_aFlyProperties.push_back(std::make_pair<OString, OString>( - "fillBackColor", OString::number(msfilter::util::BGRToRGB(rStartColor.GetColor())))); + "fillBackColor", OString::number(wwUtility::RGBToBGR(rStartColor)))); const Color& rEndColor = rGradient.GetEndColor(); m_aFlyProperties.push_back(std::make_pair<OString, OString>( - "fillColor", OString::number(msfilter::util::BGRToRGB(rEndColor.GetColor())))); + "fillColor", OString::number(wwUtility::RGBToBGR(rEndColor)))); switch (rGradient.GetGradientStyle()) { @@ -3351,7 +3351,7 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) const Color& rColor = pTop->GetColor(); // We in fact need RGB to BGR, but the transformation is symmetric. m_aFlyProperties.push_back(std::make_pair<OString, OString>( - "lineColor", OString::number(msfilter::util::BGRToRGB(rColor.GetColor())))); + "lineColor", OString::number(wwUtility::RGBToBGR(rColor)))); if (pTop->GetBorderLineStyle() != SvxBorderLineStyle::NONE) { diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 292b1305e9c3..cb354fecd8f1 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -423,7 +423,7 @@ void RtfExport::WriteMainText() std::vector<std::pair<OString, OString>> aProperties; aProperties.push_back(std::make_pair<OString, OString>("shapeType", "1")); aProperties.push_back(std::make_pair<OString, OString>( - "fillColor", OString::number(msfilter::util::BGRToRGB(oBrush->GetColor().GetColor())))); + "fillColor", OString::number(wwUtility::RGBToBGR(oBrush->GetColor())))); for (std::pair<OString, OString>& rPair : aProperties) { Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{"); @@ -1287,7 +1287,7 @@ void RtfExport::OutColorTable() for (std::size_t n = 0; n < m_aColTable.size(); ++n) { const Color& rCol = m_aColTable[n]; - if (n || COL_AUTO != rCol.GetColor()) + if (n || COL_AUTO != rCol) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_RED); OutULong(rCol.GetRed()).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_GREEN); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 293e0d1ab38d..c7448f42fbd2 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2009,7 +2009,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, const sal_uInt16 nCstScale = 635; // unit scale between AOO and MS Word const sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value. - sal_uInt32 nColor = sal_uInt32(pSI->GetColor()); + Color nColor = pSI->GetColor(); sal_Int32 nOffX = pSI->GetWidth() * nCstScale; sal_Int32 nOffY = pSI->GetWidth() * nCstScale; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c2136a3ecb50..08f31d800dd5 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2638,7 +2638,7 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t if ( aColor == COL_AUTO ) aSHD.setCvBack( 0xFF000000 ); else - aSHD.setCvBack( wwUtility::RGBToBGR( aColor.GetColor() ) ); + aSHD.setCvBack( wwUtility::RGBToBGR( aColor ) ); aSHD.Write( m_rWW8Export ); } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 9b6b425269ef..f6c40194bf5e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1319,7 +1319,7 @@ void WW8AttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) { m_rWW8Export.InsUInt16( NS_sprm::sprmCCvUl ); - m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( aColor.GetColor() ) ); + m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( aColor ) ); } } @@ -1535,9 +1535,9 @@ bool WW8Export::TransBrush(const Color& rCol, WW8_SHD& rShd) return !rCol.GetTransparency(); } -sal_uInt32 SuitableBGColor(sal_uInt32 nIn) +sal_uInt32 SuitableBGColor(Color nIn) { - if (nIn == sal_uInt32(COL_AUTO)) + if (nIn == COL_AUTO) return 0xFF000000; return wwUtility::RGBToBGR(nIn); } @@ -1552,7 +1552,7 @@ void WW8AttributeOutput::CharColor( const SvxColorItem& rColor ) if (nColor) { m_rWW8Export.InsUInt16( NS_sprm::sprmCCv ); - m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( rColor.GetValue().GetColor() ) ); + m_rWW8Export.InsUInt32( wwUtility::RGBToBGR( rColor.GetValue() ) ); } } @@ -1570,7 +1570,7 @@ void WW8AttributeOutput::CharBackground( const SvxBrushItem& rBrush ) m_rWW8Export.InsUInt16( NS_sprm::sprmCShd ); m_rWW8Export.pO->push_back( 10 ); m_rWW8Export.InsUInt32( 0xFF000000 ); - m_rWW8Export.InsUInt32( SuitableBGColor( rBrush.GetColor().GetColor() ) ); + m_rWW8Export.InsUInt32( SuitableBGColor( rBrush.GetColor() ) ); m_rWW8Export.InsUInt16( 0x0000); } @@ -4185,7 +4185,7 @@ void WW8AttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) m_rWW8Export.InsUInt16( 0xC64D ); m_rWW8Export.pO->push_back( 10 ); m_rWW8Export.InsUInt32( 0xFF000000 ); - m_rWW8Export.InsUInt32( SuitableBGColor( rBrush.GetColor().GetColor() ) ); + m_rWW8Export.InsUInt32( SuitableBGColor( rBrush.GetColor() ) ); m_rWW8Export.InsUInt16( 0x0000 ); } } @@ -4283,7 +4283,7 @@ WW8_BRCVer9 WW8Export::TranslateBorderLine(const SvxBorderLine& rLine, nWidth = 1; // don't omit // BRC.cv - nColBGR = wwUtility::RGBToBGR(sal_uInt32(rLine.GetColor().GetRGBColor())); + nColBGR = wwUtility::RGBToBGR(rLine.GetColor().GetRGBColor()); } // BRC.dptSpace diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index d434c9616472..601dcc17fa53 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1021,7 +1021,7 @@ struct WW8TabBandDesc sal_uInt8 nOverrideSpacing[MAX_COL + 1]; short nOverrideValues[MAX_COL + 1][4]; WW8_SHD* pSHDs; - sal_uInt32* pNewSHDs; + Color* pNewSHDs; WW8_BRCVer9 aDefBrcs[6]; bool bExist[MAX_COL]; // does this cell exist ? @@ -1805,7 +1805,7 @@ public: // really private, but can only be done public void Read_TextBackColor(sal_uInt16, const sal_uInt8* pData, short nLen); void Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, short nLen); void Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen); - static sal_uInt32 ExtractColour(const sal_uInt8* &rpData, bool bVer67); + static Color ExtractColour(const sal_uInt8* &rpData, bool bVer67); void Read_TextVerticalAdjustment(sal_uInt16, const sal_uInt8* pData, short nLen); void Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 4374a1cf9ab3..1ab7029bca8e 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -1071,8 +1071,8 @@ WW8TabBandDesc::WW8TabBandDesc( WW8TabBandDesc const & rBand ) } if( rBand.pNewSHDs ) { - pNewSHDs = new sal_uInt32[nWwCols]; - memcpy(pNewSHDs, rBand.pNewSHDs, nWwCols * sizeof(sal_uInt32)); + pNewSHDs = new Color[nWwCols]; + memcpy(pNewSHDs, rBand.pNewSHDs, nWwCols * sizeof(Color)); } memcpy(aDefBrcs, rBand.aDefBrcs, sizeof(aDefBrcs)); } @@ -1556,7 +1556,7 @@ void WW8TabBandDesc::ReadNewShd(const sal_uInt8* pS, bool bVer67) return; if (!pNewSHDs) - pNewSHDs = new sal_uInt32[nWwCols]; + pNewSHDs = new Color[nWwCols]; short nCount = nLen / 10; //10 bytes each if (nCount > nWwCols) @@ -1567,7 +1567,7 @@ void WW8TabBandDesc::ReadNewShd(const sal_uInt8* pS, bool bVer67) pNewSHDs[i++] = SwWW8ImplReader::ExtractColour(pS, bVer67); while (i < nWwCols) - pNewSHDs[i++] = sal_uInt32(COL_AUTO); + pNewSHDs[i++] = COL_AUTO; } void WW8TabBandDesc::setcelldefaults(WW8_TCell *pCells, short nCols) @@ -3038,7 +3038,7 @@ void WW8TabDesc::SetTabShades( SwTableBox* pBox, short nWwIdx ) return; // faked cells -> no color bool bFound=false; - if (m_pActBand->pNewSHDs && m_pActBand->pNewSHDs[nWwIdx] != sal_uInt32(COL_AUTO)) + if (m_pActBand->pNewSHDs && m_pActBand->pNewSHDs[nWwIdx] != COL_AUTO) { Color aColor(m_pActBand->pNewSHDs[nWwIdx]); pBox->GetFrameFormat()->SetFormatAttr(SvxBrushItem(aColor, RES_BACKGROUND)); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index fd6b4e8293f5..178188ee5853 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2293,7 +2293,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString, OUString aNm; if (xPropSetInfo->hasPropertyByName(aNm = "TextColor")) { - aTmp <<= static_cast<sal_Int32>(static_cast<const SvxColorItem*>(pItem)->GetValue().GetColor()); + aTmp <<= static_cast<sal_Int32>(static_cast<const SvxColorItem*>(pItem)->GetValue()); rPropSet->setPropertyValue(aNm, aTmp); } } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 1384a7738c69..eb4abe1770a3 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3512,7 +3512,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh = static_cast<SvxUnderlineItem *>(aSet.Get( RES_CHRATR_UNDERLINE, false ).Clone()); if (pUnderline && nLen >= 4) { - pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) ); + pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ); m_pCurrentColl->SetFormatAttr( *pUnderline ); delete pUnderline; } @@ -3526,7 +3526,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh = static_cast<SvxUnderlineItem*>(m_xCurrentItemSet->Get(RES_CHRATR_UNDERLINE, false).Clone()); if (pUnderline && nLen >= 4) { - pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) ); + pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ); m_xCurrentItemSet->Put( *pUnderline ); delete pUnderline; } @@ -3536,7 +3536,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh { SvxUnderlineItem* pUnderlineAttr = const_cast<SvxUnderlineItem*>(static_cast<const SvxUnderlineItem*>(m_xCtrlStck->GetOpenStackAttr( *m_pPaM->GetPoint(), RES_CHRATR_UNDERLINE ))); if (pUnderlineAttr && nLen >= 4) - pUnderlineAttr->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32( pData )))); + pUnderlineAttr->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32( pData ) )); } } } @@ -4802,27 +4802,27 @@ void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, sho OSL_ENSURE(nLen == 10, "Len of para back colour not 10!"); if (nLen != 10) return; - NewAttr(SvxBrushItem(Color(ExtractColour(pData, m_bVer67)), RES_BACKGROUND)); + NewAttr(SvxBrushItem(ExtractColour(pData, m_bVer67), RES_BACKGROUND)); } } -sal_uInt32 SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67) +Color SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67) { OSL_ENSURE(!bVer67, "Impossible"); - sal_uInt32 nFore = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)); + Color nFore = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)); rpData+=4; - sal_uInt32 nBack = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)); + Color nBack = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)); rpData+=4; sal_uInt16 nIndex = SVBT16ToShort(rpData); rpData+=2; //Being a transparent background colour doesn't actually show the page //background through, it merely acts like white - if (nBack == 0xFF000000) - nBack = sal_uInt32(COL_AUTO); - OSL_ENSURE(nBack == sal_uInt32(COL_AUTO) || !(nBack & 0xFF000000), + if (nBack == Color(0xFF000000)) + nBack = COL_AUTO; + OSL_ENSURE(nBack == COL_AUTO || (nBack.GetTransparency() == 0), "ww8: don't know what to do with such a transparent bg colour, report"); SwWW8Shade aShade(nFore, nBack, nIndex); - return aShade.aColor.GetColor(); + return aShade.aColor; } void SwWW8ImplReader::Read_TextVerticalAdjustment( sal_uInt16, const sal_uInt8* pData, short nLen ) diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index a37ce262d1a7..380c2c8f1fba 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1342,7 +1342,7 @@ WW8_BRCVer9::WW8_BRCVer9(const WW8_BRC& brcVer8) else { sal_uInt32 _cv = brcVer8.ico() == 0 ? 0xff000000 // "auto" colour - : wwUtility::RGBToBGR(sal_uInt32(SwWW8ImplReader::GetCol(brcVer8.ico()))); + : wwUtility::RGBToBGR(SwWW8ImplReader::GetCol(brcVer8.ico())); *this = WW8_BRCVer9(_cv, brcVer8.dptLineWidth(), brcVer8.brcType(), brcVer8.dptSpace(), brcVer8.fShadow(), brcVer8.fFrame()); } diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index 00d56263c9a5..559f5d440091 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -27,6 +27,7 @@ #include <editeng/borderline.hxx> #include <filter/msfilter/util.hxx> +#include <tools/color.hxx> #ifdef _WIN32 # pragma pack(push, 2) @@ -1076,7 +1077,11 @@ struct SEPr namespace wwUtility { - inline sal_uInt32 RGBToBGR(sal_uInt32 nColour) { return msfilter::util::BGRToRGB(nColour); } + inline sal_uInt32 RGBToBGR(::Color nColour) + { + // we can use this because the translation is symmetric + return msfilter::util::BGRToRGB(sal_uInt32(nColour)); + } } /// [MS-OSHARED] FactoidType: one smart tag type. |