diff --git a/include/docmodel/color/ComplexColor.hxx b/include/docmodel/color/ComplexColor.hxx
index 19e228b2a858..4952d91ac217 100644
--- a/include/docmodel/color/ComplexColor.hxx
+++ b/include/docmodel/color/ComplexColor.hxx
@@ -133,13 +133,19 @@ public:
meType = ColorType::CRGB;
}
+ void setColor(Color const& rColor)
+ {
+ mnComponent1 = rColor.GetRed();
+ mnComponent2 = rColor.GetGreen();
+ mnComponent3 = rColor.GetBlue();
+ maFinalColor = rColor;
+ meType = ColorType::RGB;
+ }
+
void setRGB(sal_Int32 nRGB)
{
::Color aColor(ColorTransparency, nRGB);
- mnComponent1 = aColor.GetRed();
- mnComponent2 = aColor.GetGreen();
- mnComponent3 = aColor.GetBlue();
- meType = ColorType::RGB;
+ setColor(aColor);
}
void setHSL(sal_Int32 nH, sal_Int32 nS, sal_Int32 nL)
diff --git a/sc/Library_scqahelper.mk b/sc/Library_scqahelper.mk
index a4a6814203bd..6e8c9eca7327 100644
--- a/sc/Library_scqahelper.mk
+++ b/sc/Library_scqahelper.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_libraries,scqahelper,\
comphelper \
cppu \
cppuhelper \
+ docmodel \
editeng \
for \
sal \
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 1df3a31d6fac..cc37c335cfc0 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -30,6 +30,7 @@
#include "fonthelper.hxx"
namespace vcl { class Font; }
+namespace model { class ComplexColor; }
class OutputDevice;
class Fraction;
class ScStyleSheet;
@@ -107,19 +108,23 @@ public:
SvtScriptType nScript = SvtScriptType::NONE, const Color* pBackConfigColor = nullptr,
const Color* pTextConfigColor = nullptr);
- static void fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet = nullptr,
- const Color* pBackConfigColor = nullptr, const Color* pTextConfigColor = nullptr);
+ static void fillColor(model::ComplexColor& rComplexColor,
+ const SfxItemSet& rItemSet,
+ ScAutoFontColorMode eAutoMode,
+ const SfxItemSet* pCondSet = nullptr,
+ const Color* pBackConfigColor = nullptr,
+ const Color* pTextConfigColor = nullptr);
static ScDxfFont GetDxfFont(const SfxItemSet& rSet, SvtScriptType nScript);
- void fillColor(Color& rColor,
+ void fillColor(model::ComplexColor& rComplexColor,
ScAutoFontColorMode eAutoMode,
const SfxItemSet* pCondSet = nullptr,
const Color* pBackConfigColor = nullptr,
const Color* pTextConfigColor = nullptr) const
{
- fillColor(rColor, GetItemSet(), eAutoMode, pCondSet, pBackConfigColor, pTextConfigColor);
+ fillColor(rComplexColor, GetItemSet(), eAutoMode, pCondSet, pBackConfigColor, pTextConfigColor);
}
void fillFontOnly(vcl::Font& rFont,
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index eff2c62d9aeb..23ddf5271fc4 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -177,12 +177,12 @@ void ScModelTestBase::testFormats(ScDocument* pDoc,std::u16string_view sFormat)
//test Sheet2
const ScPatternAttr* pPattern = pDoc->GetPattern(0, 0, 1);
vcl::Font aFont;
- Color aColor;
+ model::ComplexColor aComplexColor;
pPattern->fillFontOnly(aFont);
- pPattern->fillColor(aColor, ScAutoFontColorMode::Raw);
+ pPattern->fillColor(aComplexColor, ScAutoFontColorMode::Raw);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", tools::Long(200), aFont.GetFontSize().getHeight());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, aColor);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, aComplexColor.getFinalColor());
pPattern = pDoc->GetPattern(0,1,1);
pPattern->fillFontOnly(aFont);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 12", tools::Long(240), aFont.GetFontSize().getHeight());
@@ -194,8 +194,8 @@ void ScModelTestBase::testFormats(ScDocument* pDoc,std::u16string_view sFormat)
CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight());
pPattern = pDoc->GetPattern(1,0,1);
pPattern->fillFontOnly(aFont);
- pPattern->fillColor(aColor, ScAutoFontColorMode::Raw);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aColor);
+ pPattern->fillColor(aComplexColor, ScAutoFontColorMode::Raw);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aComplexColor.getFinalColor());
pPattern = pDoc->GetPattern(1,1,1);
pPattern->fillFontOnly(aFont);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be striked out with a single line", STRIKEOUT_SINGLE, aFont.GetStrikeout());
@@ -227,7 +227,7 @@ void ScModelTestBase::testFormats(ScDocument* pDoc,std::u16string_view sFormat)
CPPUNIT_ASSERT_EQUAL( aKnownGoodStr, aTestStr );
}
pPattern = pDoc->GetPattern(1,4,1);
- aColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor();
+ Color aColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor();
CPPUNIT_ASSERT_EQUAL_MESSAGE("background color should be green", COL_LIGHTGREEN, aColor);
pPattern = pDoc->GetPattern(2,0,1);
SvxCellHorJustify eHorJustify = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue();
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 1bb2e50daf4d..d3a9de543d3a 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -253,14 +253,14 @@ void ScPatternAttr::fillFont(
const SfxItemSet* pCondSet, SvtScriptType nScript,
const Color* pBackConfigColor, const Color* pTextConfigColor)
{
- Color aColor;
+ model::ComplexColor aComplexColor;
// determine effective font color
ScPatternAttr::fillFontOnly(rFont, rItemSet, pOutDev, pScale, pCondSet, nScript);
- ScPatternAttr::fillColor(aColor, rItemSet, eAutoMode, pCondSet, pBackConfigColor, pTextConfigColor);
+ ScPatternAttr::fillColor(aComplexColor, rItemSet, eAutoMode, pCondSet, pBackConfigColor, pTextConfigColor);
// set font effects
- rFont.SetColor(aColor);
+ rFont.SetColor(aComplexColor.getFinalColor());
}
void ScPatternAttr::fillFontOnly(
@@ -432,9 +432,11 @@ void ScPatternAttr::fillFontOnly(
rFont.SetTransparent( true );
}
-void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet, const Color* pBackConfigColor, const Color* pTextConfigColor)
+void ScPatternAttr::fillColor(model::ComplexColor& rComplexColor, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet, const Color* pBackConfigColor, const Color* pTextConfigColor)
{
- Color aColor = COL_TRANSPARENT;
+ model::ComplexColor aComplexColor;
+
+ Color aColor;
SvxColorItem const* pColorItem = nullptr;
@@ -445,15 +447,24 @@ void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoF
pColorItem = &rItemSet.Get(ATTR_FONT_COLOR);
if (pColorItem)
+ {
+ aComplexColor = pColorItem->getComplexColor();
aColor = pColorItem->GetValue();
+ }
+ if (aComplexColor.getType() == model::ColorType::Unused)
+ {
+ aComplexColor.setColor(aColor);
+ }
if ((aColor == COL_AUTO && eAutoMode != ScAutoFontColorMode::Raw)
|| eAutoMode == ScAutoFontColorMode::IgnoreFont
|| eAutoMode == ScAutoFontColorMode::IgnoreAll)
{
- if ( eAutoMode == ScAutoFontColorMode::Black )
+ if (eAutoMode == ScAutoFontColorMode::Black)
+ {
aColor = COL_BLACK;
+ }
else
{
// get background color from conditional or own set
@@ -503,9 +514,11 @@ void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoF
// get system text color for comparison
Color aSysTextColor;
- if ( eAutoMode == ScAutoFontColorMode::Print )
+ if (eAutoMode == ScAutoFontColorMode::Print)
+ {
aSysTextColor = COL_BLACK;
- else if ( pTextConfigColor )
+ }
+ else if (pTextConfigColor)
{
// pTextConfigColor can be used to avoid repeated lookup of the configured color
aSysTextColor = *pTextConfigColor;
@@ -533,8 +546,8 @@ void ScPatternAttr::fillColor(Color& rColor, const SfxItemSet& rItemSet, ScAutoF
}
}
}
-
- rColor = aColor;
+ aComplexColor.setFinalColor(aColor);
+ rComplexColor = aComplexColor;
}
ScDxfFont ScPatternAttr::GetDxfFont(const SfxItemSet& rItemSet, SvtScriptType nScript)
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 3c4aa0571fc6..86afa5a6c163 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -801,7 +801,7 @@ void XclExpAutofilter::AddColorEntry(const ScQueryEntry& rEntry)
// Ensure that selected color(s) will be added to dxf: selection can be not in list
// of already added to dfx colors taken from filter range
if (GetDxfs().GetDxfByColor(rItem.maColor) == -1)
- GetDxfs().AddColor(rItem.maColor);
+ GetDxfs().addColor(rItem.maColor);
}
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 5b51f8754f93..9c7eb9673c9f 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -1130,8 +1130,8 @@ void XclExpChFontBase::ConvertFontBase( const XclExpChRoot& rRoot, sal_uInt16 nF
{
if( const XclExpFont* pFont = rRoot.GetFontBuffer().GetFont( nFontIdx ) )
{
- XclExpChFontRef xFont = new XclExpChFont( nFontIdx );
- SetFont( xFont, pFont->GetFontData().maColor, pFont->GetFontColorId() );
+ XclExpChFontRef xFont = new XclExpChFont(nFontIdx);
+ SetFont(xFont, pFont->GetFontData().maComplexColor, pFont->GetFontColorId());
}
}
@@ -1152,11 +1152,11 @@ XclExpChText::XclExpChText( const XclExpChRoot& rRoot ) :
{
}
-void XclExpChText::SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId )
+void XclExpChText::SetFont( XclExpChFontRef xFont, model::ComplexColor const& rComplexColor, sal_uInt32 nColorId )
{
mxFont = xFont;
- maData.maTextColor = rColor;
- ::set_flag( maData.mnFlags, EXC_CHTEXT_AUTOCOLOR, rColor == COL_AUTO );
+ maData.maTextComplexColor = rComplexColor;
+ ::set_flag(maData.mnFlags, EXC_CHTEXT_AUTOCOLOR, rComplexColor.getFinalColor() == COL_AUTO);
mnTextColorId = nColorId;
}
@@ -1386,7 +1386,7 @@ void XclExpChText::WriteBody( XclExpStream& rStrm )
rStrm << maData.mnHAlign
<< maData.mnVAlign
<< maData.mnBackMode
- << maData.maTextColor
+ << maData.maTextComplexColor.getFinalColor()
<< maData.maRect
<< maData.mnFlags;
@@ -2845,10 +2845,10 @@ void XclExpChTick::Convert( const ScfPropertySet& rPropSet, const XclChExtTypeIn
}
}
-void XclExpChTick::SetFontColor( const Color& rColor, sal_uInt32 nColorId )
+void XclExpChTick::SetFontColor(model::ComplexColor const& rComplexColor, sal_uInt32 nColorId )
{
- maData.maTextColor = rColor;
- ::set_flag( maData.mnFlags, EXC_CHTICK_AUTOCOLOR, rColor == COL_AUTO );
+ maData.maTextComplexColor = rComplexColor;
+ ::set_flag(maData.mnFlags, EXC_CHTICK_AUTOCOLOR, rComplexColor.getFinalColor() == COL_AUTO);
mnTextColorId = nColorId;
}
@@ -2866,7 +2866,7 @@ void XclExpChTick::WriteBody( XclExpStream& rStrm )
<< maData.mnLabelPos
<< maData.mnBackMode;
rStrm.WriteZeroBytes( 16 );
- rStrm << maData.maTextColor
+ rStrm << maData.maTextComplexColor.getFinalColor()
<< maData.mnFlags;
if( GetBiff() == EXC_BIFF8 )
rStrm << GetPalette().GetColorIndex( mnTextColorId ) << maData.mnRotation;
@@ -2922,11 +2922,11 @@ XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) :
maData.mnType = nAxisType;
}
-void XclExpChAxis::SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId )
+void XclExpChAxis::SetFont( XclExpChFontRef xFont, model::ComplexColor const& rComplexColor, sal_uInt32 nColorId )
{
mxFont = xFont;
if( mxTick )
- mxTick->SetFontColor( rColor, nColorId );
+ mxTick->SetFontColor(rComplexColor, nColorId);
}
void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 47114264a50e..b1329e56f535 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -668,11 +668,11 @@ XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rF
if( mbFontUsed )
{
vcl::Font aFont;
- ::Color aColor;
+ model::ComplexColor aComplexColor;
ScPatternAttr::fillFontOnly(aFont, rItemSet);
- ScPatternAttr::fillColor(aColor, rItemSet, ScAutoFontColorMode::Raw);
- maFontData.FillFromVclFont(aFont, aColor);
- mnFontColorId = GetPalette().InsertColor(maFontData.maColor, EXC_COLOR_CELLTEXT);
+ ScPatternAttr::fillColor(aComplexColor, rItemSet, ScAutoFontColorMode::Raw);
+ maFontData.FillFromVclFont(aFont, aComplexColor);
+ mnFontColorId = GetPalette().InsertColor(maFontData.maComplexColor.getFinalColor(), EXC_COLOR_CELLTEXT);
}
// border
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index e9390f8ce6f5..2bae772b0ebd 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -389,8 +389,8 @@ XclExpStringRef lclCreateFormattedString(
// construct font from current text portion
SvxFont aFont(XclExpFontHelper::GetFontFromItemSet(rRoot, rItemSet, nScript));
- Color aColor;
- ScPatternAttr::fillColor(aColor, rItemSet, ScAutoFontColorMode::Raw);
+ model::ComplexColor aComplexColor;
+ ScPatternAttr::fillColor(aComplexColor, rItemSet, ScAutoFontColorMode::Raw);
// Excel start position of this portion
sal_Int32 nXclPortionStart = xString->Len();
@@ -399,7 +399,7 @@ XclExpStringRef lclCreateFormattedString(
if( nXclPortionStart < xString->Len() )
{
// insert font into buffer
- sal_uInt16 nFontIdx = rFontBuffer.Insert(aFont, aColor, EXC_COLOR_CELLTEXT);
+ sal_uInt16 nFontIdx = rFontBuffer.Insert(aFont, aComplexColor, EXC_COLOR_CELLTEXT);
// insert font index into format run vector
xString->AppendFormat( nXclPortionStart, nFontIdx );
}
@@ -503,8 +503,8 @@ XclExpStringRef lclCreateFormattedString(
if( nScript == ApiScriptType::WEAK )
nScript = nLastScript;
SvxFont aFont( XclExpFontHelper::GetFontFromItemSet(rRoot, aItemSet, nScript));
- Color aColor;
- ScPatternAttr::fillColor(aColor, aItemSet, ScAutoFontColorMode::Raw);
+ model::ComplexColor aComplexColor;
+ ScPatternAttr::fillColor(aComplexColor, aItemSet, ScAutoFontColorMode::Raw);
nLastScript = nScript;
@@ -512,10 +512,10 @@ XclExpStringRef lclCreateFormattedString(
aFont.SetEscapement( nEsc );
// modify automatic font color for hyperlinks
if (bIsHyperlink && aItemSet.Get(ATTR_FONT_COLOR).GetValue() == COL_AUTO)
- aColor = COL_LIGHTBLUE;
+ aComplexColor.setFinalColor(COL_LIGHTBLUE);
// insert font into buffer
- sal_uInt16 nFontIdx = rFontBuffer.Insert(aFont, aColor, EXC_COLOR_CELLTEXT);
+ sal_uInt16 nFontIdx = rFontBuffer.Insert(aFont, aComplexColor, EXC_COLOR_CELLTEXT);
// insert font index into format run vector
xString->AppendFormat( nXclPortionStart, nFontIdx );
}
@@ -731,12 +731,12 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico
// --- font attributes ---
vcl::Font aFont;
- Color aColor;
+ model::ComplexColor aComplexColor;
aItemSet.ClearItem();
SfxItemSet aEditSet( mrEE.GetAttribs( aSel ) );
ScPatternAttr::GetFromEditItemSet( aItemSet, aEditSet );
ScPatternAttr::fillFontOnly(aFont, aItemSet);
- ScPatternAttr::fillColor(aColor, aItemSet, ScAutoFontColorMode::Raw);
+ ScPatternAttr::fillColor(aComplexColor, aItemSet, ScAutoFontColorMode::Raw);
// font name and style
aNewData.maName = XclTools::GetXclFontName( aFont.GetFamilyName() );
@@ -789,10 +789,12 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico
}
// font color
- aNewData.maColor = aColor;
- if ( !aFontData.maColor.IsRGBEqual( aNewData.maColor ) )
+ aNewData.maComplexColor = aComplexColor;
+ Color aNewColor = aNewData.maComplexColor.getFinalColor();
+
+ if (!aFontData.maComplexColor.getFinalColor().IsRGBEqual(aNewColor))
{
- aParaText.append("&K" + aNewData.maColor.AsRGBHexString());
+ aParaText.append("&K" + aNewColor.AsRGBHexString());
}
// strikeout
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index b8fd323aa400..eeb42449f3c9 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -883,14 +883,17 @@ sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( sax_fastparser::FSHelper
if (bHaveVertAlign)
pStream->singleElement(XML_vertAlign, XML_val, pVertAlign);
pStream->singleElement(XML_sz, XML_val, OString::number( rFontData.mnHeight / 20.0 )); // Twips->Pt
- if( rFontData.maColor != Color( ColorAlpha, 0, 0xFF, 0xFF, 0xFF ) )
- pStream->singleElement( XML_color,
+
+ if (rFontData.maComplexColor.getFinalColor() != Color( ColorAlpha, 0, 0xFF, 0xFF, 0xFF))
+ {
+ pStream->singleElement(XML_color,
// OOXTODO: XML_auto, bool
// OOXTODO: XML_indexed, uint
- XML_rgb, XclXmlUtils::ToOString(rFontData.maColor)
+ XML_rgb, XclXmlUtils::ToOString(rFontData.maComplexColor.getFinalColor())
// OOXTODO: XML_theme, index into
// OOXTODO: XML_tint, double
);
+ }
pStream->singleElement(nFontId, XML_val, rFontData.maName);
pStream->singleElement(XML_family, XML_val, OString::number( rFontData.mnFamily ));
if (rFontData.mnCharSet != 0)
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 43b9ac5e23c2..652e5f77a951 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -938,21 +938,22 @@ bool XclExpFontHelper::CheckItems( const XclExpRoot& rRoot, const SfxItemSet& rI
namespace {
-sal_uInt32 lclCalcHash( const XclFontData& rFontData )
+std::size_t lclCalcHash( const XclFontData& rFontData )
{
- sal_uInt32 nHash = rFontData.maName.getLength();
- nHash += sal_uInt32(rFontData.maColor) * 2;
- nHash += rFontData.mnWeight * 3;
- nHash += rFontData.mnCharSet * 5;
- nHash += rFontData.mnFamily * 7;
- nHash += rFontData.mnHeight * 11;
- nHash += rFontData.mnUnderline * 13;
- nHash += rFontData.mnEscapem * 17;
- if( rFontData.mbItalic ) nHash += 19;
- if( rFontData.mbStrikeout ) nHash += 23;
- if( rFontData.mbOutline ) nHash += 29;
- if( rFontData.mbShadow ) nHash += 31;
- return nHash;
+ std::size_t seed = 0;
+ o3tl::hash_combine(seed, rFontData.maName);
+ o3tl::hash_combine(seed, rFontData.maComplexColor);
+ o3tl::hash_combine(seed, rFontData.mnWeight);
+ o3tl::hash_combine(seed, rFontData.mnCharSet);
+ o3tl::hash_combine(seed, rFontData.mnFamily);
+ o3tl::hash_combine(seed, rFontData.mnHeight);
+ o3tl::hash_combine(seed, rFontData.mnUnderline);
+ o3tl::hash_combine(seed, rFontData.mnEscapem);
+ o3tl::hash_combine(seed, rFontData.mbItalic);
+ o3tl::hash_combine(seed, rFontData.mbStrikeout);
+ o3tl::hash_combine(seed, rFontData.mbOutline);
+ o3tl::hash_combine(seed, rFontData.mbShadow);
+ return seed;
}
} // namespace
@@ -964,7 +965,7 @@ XclExpFont::XclExpFont( const XclExpRoot& rRoot,
maData( rFontData )
{
// insert font color into palette
- mnColorId = rRoot.GetPalette().InsertColor( rFontData.maColor, eColorType, EXC_COLOR_FONTAUTO );
+ mnColorId = rRoot.GetPalette().InsertColor(rFontData.maComplexColor.getFinalColor(), eColorType, EXC_COLOR_FONTAUTO);
// hash value for faster comparison
mnHash = lclCalcHash( maData );
// record size
@@ -1222,18 +1223,18 @@ sal_uInt16 XclExpFontBuffer::Insert(
return static_cast< sal_uInt16 >( nPos );
}
-sal_uInt16 XclExpFontBuffer::Insert(const SvxFont& rFont, Color const& rColor, XclExpColorType eColorType )
+sal_uInt16 XclExpFontBuffer::Insert(const SvxFont& rFont, model::ComplexColor const& rComplexColor, XclExpColorType eColorType )
{
- return Insert(XclFontData(rFont, rColor), eColorType);
+ return Insert(XclFontData(rFont, rComplexColor), eColorType);
}
sal_uInt16 XclExpFontBuffer::Insert(const SfxItemSet& rItemSet, sal_Int16 nScript, XclExpColorType eColorType, bool bAppFont )
{
// #i17050# script type now provided by caller
vcl::Font aFont = XclExpFontHelper::GetFontFromItemSet(GetRoot(), rItemSet, nScript);
- Color aColor;
- ScPatternAttr::fillColor(aColor, rItemSet, ScAutoFontColorMode::Raw);
- return Insert(XclFontData(aFont, aColor), eColorType, bAppFont );
+ model::ComplexColor aComplexColor;
+ ScPatternAttr::fillColor(aComplexColor, rItemSet, ScAutoFontColorMode::Raw);
+ return Insert(XclFontData(aFont, aComplexColor), eColorType, bAppFont );
}
void XclExpFontBuffer::Save( XclExpStream& rStrm )
@@ -3208,7 +3209,7 @@ sal_Int32 XclExpDxfs::GetDxfByColor(Color aColor) const
return -1;
}
-void XclExpDxfs::AddColor(Color aColor)
+void XclExpDxfs::addColor(Color aColor)
{
maColorToDxfId.emplace(aColor, maDxf.size());
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 4a30dcd25323..a52bb103fbb6 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -949,14 +949,19 @@ void XclImpChText::ReadHeaderRecord( XclImpStream& rStrm )
maData.mnHAlign = rStrm.ReaduInt8();
maData.mnVAlign = rStrm.ReaduInt8();
maData.mnBackMode = rStrm.ReaduInt16();
- rStrm >> maData.maTextColor
- >> maData.maRect;
+
+ Color aColor;
+ rStrm >> aColor;
+ maData.maTextComplexColor.setColor(aColor);
+
+ rStrm >> maData.maRect;
maData.mnFlags = rStrm.ReaduInt16();
if( GetBiff() == EXC_BIFF8 )
{
// BIFF8: index into palette used instead of RGB data
- maData.maTextColor = GetPalette().GetColor( rStrm.ReaduInt16() );
+ aColor = GetPalette().GetColor(rStrm.ReaduInt16());
+ maData.maTextComplexColor.setColor(aColor);
// placement and rotation
maData.mnFlags2 = rStrm.ReaduInt16();
maData.mnRotation = rStrm.ReaduInt16();
@@ -1015,7 +1020,7 @@ sal_uInt16 XclImpChText::GetFontIndex() const
Color XclImpChText::GetFontColor() const
{
- return ::get_flag( maData.mnFlags, EXC_CHTEXT_AUTOCOLOR ) ? GetFontAutoColor() : maData.maTextColor;
+ return ::get_flag(maData.mnFlags, EXC_CHTEXT_AUTOCOLOR) ? GetFontAutoColor() : maData.maTextComplexColor.getFinalColor();
}
sal_uInt16 XclImpChText::GetRotation() const
@@ -1042,8 +1047,8 @@ void XclImpChText::UpdateText( const XclImpChText* pParentText )
{
mxFont = pParentText->mxFont;
// text color is taken from CHTEXT record, not from font in CHFONT
- ::set_flag( maData.mnFlags, EXC_CHTEXT_AUTOCOLOR, ::get_flag( pParentText->maData.mnFlags, EXC_CHTEXT_AUTOCOLOR ) );
- maData.maTextColor = pParentText->maData.maTextColor;
+ ::set_flag(maData.mnFlags, EXC_CHTEXT_AUTOCOLOR, ::get_flag(pParentText->maData.mnFlags, EXC_CHTEXT_AUTOCOLOR));
+ maData.maTextComplexColor = pParentText->maData.maTextComplexColor;
}
}
@@ -3193,13 +3198,15 @@ void XclImpChTick::ReadChTick( XclImpStream& rStrm )
maData.mnLabelPos = rStrm.ReaduInt8();
maData.mnBackMode = rStrm.ReaduInt8();
rStrm.Ignore( 16 );
- rStrm >> maData.maTextColor;
+ Color aColor;
+ rStrm >> aColor;
+ maData.maTextComplexColor.setColor(aColor);
maData.mnFlags = rStrm.ReaduInt16();
if( GetBiff() == EXC_BIFF8 )
{
// BIFF8: index into palette used instead of RGB data
- maData.maTextColor = GetPalette().GetColor( rStrm.ReaduInt16() );
+ maData.maTextComplexColor.setColor(GetPalette().GetColor(rStrm.ReaduInt16()));
// rotation
maData.mnRotation = rStrm.ReaduInt16();
}
@@ -3213,7 +3220,7 @@ void XclImpChTick::ReadChTick( XclImpStream& rStrm )
Color XclImpChTick::GetFontColor() const
{
- return ::get_flag( maData.mnFlags, EXC_CHTICK_AUTOCOLOR ) ? GetFontAutoColor() : maData.maTextColor;
+ return ::get_flag(maData.mnFlags, EXC_CHTICK_AUTOCOLOR) ? GetFontAutoColor() : maData.maTextComplexColor.getFinalColor();
}
sal_uInt16 XclImpChTick::GetRotation() const
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 7361c7ee612d..0d417deb4886 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -309,7 +309,7 @@ void XclImpFont::ReadCFFontBlock( XclImpStream& rStrm )
if( (mbUnderlUsed = !::get_flag( nFontFlags3, EXC_CF_FONT_UNDERL ) && (nUnderl <= 0x7F)) )
maData.mnUnderline = nUnderl;
if( (mbColorUsed = (nColor <= 0x7FFF)) )
- maData.maColor = GetPalette().GetColor( static_cast< sal_uInt16 >( nColor ) );
+ maData.maComplexColor.setColor(GetPalette().GetColor(sal_uInt16(nColor)));
if( (mbStrikeUsed = !::get_flag( nFontFlags1, EXC_CF_FONT_STRIKEOUT )) )
maData.mbStrikeout = ::get_flag( nStyle, EXC_CF_FONT_STRIKEOUT );
}
@@ -368,7 +368,7 @@ void XclImpFont::FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType, boo
// Font color - pass AUTO_COL to item
if( mbColorUsed )
- PUTITEM( SvxColorItem( maData.maColor, ATTR_FONT_COLOR ), ATTR_FONT_COLOR, EE_CHAR_COLOR );
+ PUTITEM(SvxColorItem(maData.maComplexColor.getFinalColor(), maData.maComplexColor, ATTR_FONT_COLOR ), ATTR_FONT_COLOR, EE_CHAR_COLOR);
// Font weight (for all script types)
if( mbWeightUsed )
@@ -455,7 +455,7 @@ void XclImpFont::ReadFontData5( XclImpStream& rStrm )
void XclImpFont::ReadFontColor( XclImpStream& rStrm )
{
- maData.maColor = GetPalette().GetColor( rStrm.ReaduInt16() );
+ maData.maComplexColor.setColor(GetPalette().GetColor(rStrm.ReaduInt16()));
}
void XclImpFont::ReadFontName2( XclImpStream& rStrm )
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index 92c4899a0c60..011d4578ff6f 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -153,7 +153,6 @@ XclChFrLabelProps::XclChFrLabelProps() :
}
XclChText::XclChText() :
- maTextColor( COL_BLACK ),
mnHAlign( EXC_CHTEXT_ALIGN_CENTER ),
mnVAlign( EXC_CHTEXT_ALIGN_CENTER ),
mnBackMode( EXC_CHTEXT_TRANSPARENT ),
@@ -161,6 +160,7 @@ XclChText::XclChText() :
mnFlags2( EXC_CHTEXT_POS_DEFAULT ),
mnRotation( EXC_ROT_NONE )
{
+ maTextComplexColor.setColor(COL_BLACK);
}
// Data series ================================================================
@@ -303,7 +303,6 @@ XclChValueRange::XclChValueRange() :
}
XclChTick::XclChTick() :
- maTextColor( COL_BLACK ),
mnMajor( EXC_CHTICK_INSIDE | EXC_CHTICK_OUTSIDE ),
mnMinor( 0 ),
mnLabelPos( EXC_CHTICK_NEXT ),
@@ -311,6 +310,7 @@ XclChTick::XclChTick() :
mnFlags( EXC_CHTICK_AUTOCOLOR | EXC_CHTICK_AUTOROT ),
mnRotation( EXC_ROT_NONE )
{
+ maTextComplexColor.setColor(COL_BLACK);
}
XclChAxis::XclChAxis() :
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index f42d30edc574..5c494a7e60da 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -174,22 +174,22 @@ XclFontData::XclFontData()
Clear();
}
-XclFontData::XclFontData(const vcl::Font& rFont, Color const& rColor)
+XclFontData::XclFontData(const vcl::Font& rFont, model::ComplexColor const& rComplexColor)
{
Clear();
- FillFromVclFont(rFont, rColor);
+ FillFromVclFont(rFont, rComplexColor);
}
-XclFontData::XclFontData(const SvxFont& rFont, Color const& rColor)
+XclFontData::XclFontData(const SvxFont& rFont, model::ComplexColor const& rComplexColor)
{
- FillFromSvxFont(rFont, rColor);
+ FillFromSvxFont(rFont, rComplexColor);
}
void XclFontData::Clear()
{
maName.clear();
maStyle.clear();
- maColor = COL_AUTO;
+ maComplexColor.setColor(COL_AUTO);
mnHeight = 0;
mnWeight = EXC_FONTWGHT_DONTKNOW;
mnEscapem = EXC_FONTESC_NONE;
@@ -199,11 +199,10 @@ void XclFontData::Clear()
mbItalic = mbStrikeout = mbOutline = mbShadow = false;
}
-void XclFontData::FillFromVclFont(const vcl::Font& rFont, Color const& rColor)
+void XclFontData::FillFromVclFont(const vcl::Font& rFont, model::ComplexColor const& rComplexColor)
{
maName = XclTools::GetXclFontName( rFont.GetFamilyName() ); // substitute with MS fonts
maStyle.clear();
- maColor = rColor;
SetScUnderline( rFont.GetUnderline() );
mnEscapem = EXC_FONTESC_NONE;
SetScHeight( rFont.GetFontSize().Height() );
@@ -214,11 +213,13 @@ void XclFontData::FillFromVclFont(const vcl::Font& rFont, Color const& rColor)
SetScStrikeout( rFont.GetStrikeout() );
mbOutline = rFont.IsOutline();
mbShadow = rFont.IsShadow();
+
+ maComplexColor = rComplexColor;
}
-void XclFontData::FillFromSvxFont(const SvxFont& rFont, Color const& rColor)
+void XclFontData::FillFromSvxFont(const SvxFont& rFont, model::ComplexColor const& rComplexColor)
{
- FillFromVclFont(rFont, rColor);
+ FillFromVclFont(rFont, rComplexColor);
SetScEscapement(rFont.GetEscapement());
}
@@ -520,7 +521,7 @@ bool operator==( const XclFontData& rLeft, const XclFontData& rRight )
(rLeft.mnHeight == rRight.mnHeight) &&
(rLeft.mnWeight == rRight.mnWeight) &&
(rLeft.mnUnderline == rRight.mnUnderline) &&
- (rLeft.maColor == rRight.maColor) &&
+ (rLeft.maComplexColor == rRight.maComplexColor) &&
(rLeft.mnEscapem == rRight.mnEscapem) &&
(rLeft.mnFamily == rRight.mnFamily) &&
(rLeft.mnCharSet == rRight.mnCharSet) &&
@@ -638,11 +639,13 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
rPropSetHlp >> aApiFontName >> fApiHeight >> eApiPosture >> fApiWeight;
// read common properties
maHlpChCommon.ReadFromPropertySet( rPropSet );
- maHlpChCommon >> nApiUnderl
- >> nApiStrikeout
- >> rFontData.maColor
- >> rFontData.mbOutline
- >> rFontData.mbShadow;
+ maHlpChCommon >> nApiUnderl;
+ maHlpChCommon >> nApiStrikeout;
+ Color aColor;
+ maHlpChCommon >> aColor;
+ rFontData.maComplexColor.setColor(aColor);
+ maHlpChCommon >> rFontData.mbOutline;
+ maHlpChCommon >> rFontData.mbShadow;
// convert API property values to Excel settings
lclSetApiFontSettings( rFontData, aApiFontName,
@@ -667,15 +670,17 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
// read font properties
maHlpControl.ReadFromPropertySet( rPropSet );
- maHlpControl >> aApiFontName
- >> nApiFamily
- >> nApiCharSet
- >> fApiHeight
- >> nApiPosture
- >> fApiWeight
- >> nApiUnderl
- >> nApiStrikeout
- >> rFontData.maColor;
+ maHlpControl >> aApiFontName;
+ maHlpControl >> nApiFamily;
+ maHlpControl >> nApiCharSet;
+ maHlpControl >> fApiHeight;
+ maHlpControl >> nApiPosture;
+ maHlpControl >> fApiWeight;
+ maHlpControl >> nApiUnderl;
+ maHlpControl >> nApiStrikeout;
+ Color aColor;
+ maHlpControl >> aColor;
+ rFontData.maComplexColor.setColor(aColor);
// convert API property values to Excel settings
Awt::FontSlant eApiPosture = static_cast< Awt::FontSlant >( nApiPosture );
@@ -699,10 +704,10 @@ void XclFontPropSetHelper::WriteFontProperties(
{
// write common properties
maHlpChCommon.InitializeWrite();
- const Color& rColor = pFontColor ? *pFontColor : rFontData.maColor;
+ Color aColor = pFontColor ? *pFontColor : rFontData.maComplexColor.getFinalColor();
maHlpChCommon << rFontData.GetApiUnderline()
<< rFontData.GetApiStrikeout()
- << rColor
+ << aColor
<< rFontData.mbOutline
<< rFontData.mbShadow;
maHlpChCommon.WriteToPropertySet( rPropSet );
@@ -733,7 +738,7 @@ void XclFontPropSetHelper::WriteFontProperties(
<< rFontData.GetApiWeight()
<< rFontData.GetApiUnderline()
<< rFontData.GetApiStrikeout()
- << rFontData.maColor;
+ << rFontData.maComplexColor.getFinalColor();
maHlpControl.WriteToPropertySet( rPropSet );
}
break;
diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx
index ff7dcc90920f..fb1eefca85f4 100644
--- a/sc/source/filter/inc/xechart.hxx
+++ b/sc/source/filter/inc/xechart.hxx
@@ -473,7 +473,7 @@ public:
virtual ~XclExpChFontBase();
/** Derived classes set font color and color identifier to internal data structures. */
- virtual void SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId ) = 0;
+ virtual void SetFont( XclExpChFontRef xFont, const model::ComplexColor& rComplexColor, sal_uInt32 nColorId ) = 0;
/** Derived classes set text rotation to internal data structures. */
virtual void SetRotation( sal_uInt16 nRotation ) = 0;
@@ -496,7 +496,7 @@ public:
explicit XclExpChText( const XclExpChRoot& rRoot );
/** Sets font color and color identifier to internal data structures. */
- virtual void SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId ) override;
+ virtual void SetFont( XclExpChFontRef xFont, model::ComplexColor const& rComplexColor, sal_uInt32 nColorId ) override;
/** Sets text rotation to internal data structures. */
virtual void SetRotation( sal_uInt16 nRotation ) override;
@@ -993,7 +993,8 @@ public:
/** Converts axis tick mark settings. */
void Convert( const ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, sal_uInt16 nAxisType );
/** Sets font color and color identifier to internal data structures. */
- void SetFontColor( const Color& rColor, sal_uInt32 nColorId );
+ void SetFontColor(model::ComplexColor const& rComplexColor, sal_uInt32 nColorId);
+
/** Sets text rotation to internal data structures. */
void SetRotation( sal_uInt16 nRotation );
@@ -1019,7 +1020,7 @@ public:
explicit XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType );
/** Sets font color and color identifier to internal data structures. */
- virtual void SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId ) override;
+ virtual void SetFont( XclExpChFontRef xFont, model::ComplexColor const& rComplexColor, sal_uInt32 nColorId ) override;
/** Sets text rotation to internal data structures. */
virtual void SetRotation( sal_uInt16 nRotation ) override;
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index c479c6ac51f6..04e0a752bc6b 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -221,7 +221,7 @@ public:
sal_uInt16 Insert(const XclFontData& rFontData, XclExpColorType eColorType, bool bAppFont = false );
/** Inserts the SvxFont into the buffer if not present, e.g. where escapements are used.
@return The resulting Excel font index. */
- sal_uInt16 Insert(const SvxFont& rFont, Color const& rColor, XclExpColorType eColorType);
+ sal_uInt16 Insert(const SvxFont& rFont, model::ComplexColor const& rComplexColor, XclExpColorType eColorType);
/** Inserts the font contained in the passed item set into the buffer, if not present.
@param nScript The script type of the font properties to be used.
@param bAppFont true = Sets the application font; false = Inserts a new font.
@@ -756,7 +756,7 @@ public:
sal_Int32 GetDxfId(const OUString& rName) const;
sal_Int32 GetDxfByColor(Color aColor) const;
- void AddColor(Color aColor);
+ void addColor(Color aColor);
virtual void SaveXml( XclExpXmlStream& rStrm) override;
void Finalize();
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index e28c6943c22a..d1a6a56b0972 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -20,6 +20,7 @@
#pragma once
#include
+#include
#include "fapihelper.hxx"
#include