support colored axis in data bars

Change-Id: Ie74404b35e31a2f96641abb18a9aaf46467e31c0
This commit is contained in:
Markus Mohrhard 2012-06-26 16:18:52 +02:00
parent 46b8dbda43
commit 59c2e04874
5 changed files with 14 additions and 2 deletions

View file

@ -99,6 +99,7 @@ enum ScAxisPostion
struct SC_DLLPUBLIC ScDataBarFormatData
{
ScDataBarFormatData():
maAxisColor(COL_BLACK),
mbGradient(true),
mbNeg(true),
meAxisPosition(databar::AUTOMATIC),
@ -106,6 +107,7 @@ struct SC_DLLPUBLIC ScDataBarFormatData
ScDataBarFormatData(const ScDataBarFormatData& r):
maPositiveColor(r.maPositiveColor),
maAxisColor(r.maAxisColor),
mbGradient(r.mbGradient),
mbNeg(r.mbNeg),
meAxisPosition(r.meAxisPosition),
@ -130,6 +132,11 @@ struct SC_DLLPUBLIC ScDataBarFormatData
* Default color is 0xFF0000, this value is not set
*/
boost::scoped_ptr<Color> mpNegativeColor;
/**
* Color of the axis if used
* Default color is black
*/
Color maAxisColor;
/**
* Paint the bars with gradient. If this is used the default is to draw with
* borders.

View file

@ -69,6 +69,7 @@ struct ScDataBarInfo
double mnLength; // -100 to 100
bool mbGradient;
bool mbShowValue;
Color maAxisColor;
bool operator==(const ScDataBarInfo& r) const
{

View file

@ -842,6 +842,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
pInfo->mbGradient = mpFormatData->mbGradient;
pInfo->mbShowValue = !mpFormatData->mbOnlyBar;
pInfo->maAxisColor = mpFormatData->maAxisColor;
return pInfo;
}

View file

@ -176,6 +176,7 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarForma
::SetType(rData.mpUpperLimit.get(), maLbTypeMax);
SetValue(rData.mpLowerLimit.get(), maEdMin);
SetValue(rData.mpUpperLimit.get(), maEdMax);
maLbAxisCol.SelectEntry(rData.maAxisColor);
TypeSelectHdl(NULL);
}
@ -259,6 +260,7 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData()
pData->mbGradient = true; //FIXME
pData->mpUpperLimit.reset(new ScColorScaleEntry());
pData->mpLowerLimit.reset(new ScColorScaleEntry());
pData->maAxisColor = maLbAxisCol.GetSelectEntryColor();
::GetType(maLbTypeMin, maEdMin, pData->mpLowerLimit.get(), mpNumberFormatter);
::GetType(maLbTypeMax, maEdMax, pData->mpUpperLimit.get(), mpNumberFormatter);

View file

@ -861,10 +861,11 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
aLineInfo.SetDashCount( 4 );
aLineInfo.SetDistance( 3 );
aLineInfo.SetDashLen( 3 );
pDev->SetFillColor(COL_BLACK);
pDev->SetLineColor(COL_BLACK);
pDev->SetFillColor(pOldDataBarInfo->maAxisColor);
pDev->SetLineColor(pOldDataBarInfo->maAxisColor);
pDev->DrawLine(aPoint1, aPoint2, aLineInfo);
pDev->SetLineColor();
pDev->SetFillColor();
}
}