summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-08-11 13:28:22 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-08-13 12:34:17 +0200
commit06aeaad3d1ec55dafe985642ef2b34beef384012 (patch)
treecc85983711a8bb4074e6e2cc4cc7c5bae1f8dffb /sc
parentc6a8eb06027765640a5d1113866903454892d134 (diff)
implement AutoMin and AutoMax, fdo#50462
Change-Id: I73b2eb069bbb06d9b366b68d0ad85728df4d6a3a
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/colorscale.hxx4
-rw-r--r--sc/source/core/data/colorscale.cxx17
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx4
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx8
4 files changed, 30 insertions, 3 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index f1b8d41d8c60..8e7938547d68 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -49,7 +49,9 @@ enum ScColorScaleEntryType
COLORSCALE_MAX,
COLORSCALE_PERCENT,
COLORSCALE_PERCENTILE,
- COLORSCALE_FORMULA
+ COLORSCALE_FORMULA,
+ COLORSCALE_AUTOMIN,
+ COLORSCALE_AUTOMAX
};
class SC_DLLPUBLIC ScColorScaleEntry
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index e429068a89e9..0cecc9f81c36 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -298,7 +298,7 @@ double ScColorScaleFormat::GetMinValue() const
{
const_iterator itr = maColorScales.begin();
- if(itr->GetType() != COLORSCALE_MIN)
+ if(itr->GetType() != COLORSCALE_MIN && itr->GetType() != COLORSCALE_AUTOMIN)
return itr->GetValue();
else
{
@@ -310,7 +310,7 @@ double ScColorScaleFormat::GetMaxValue() const
{
ColorScaleEntries::const_reverse_iterator itr = maColorScales.rbegin();
- if(itr->GetType() != COLORSCALE_MAX)
+ if(itr->GetType() != COLORSCALE_MAX && itr->GetType() != COLORSCALE_AUTOMAX)
return itr->GetValue();
else
{
@@ -412,8 +412,12 @@ double ScColorScaleFormat::CalcValue(double nMin, double nMax, ScColorScaleForma
return nMin + (nMax-nMin)*(itr->GetValue()/100);
case COLORSCALE_MIN:
return nMin;
+ case COLORSCALE_AUTOMIN:
+ return std::min<double>(0, nMin);
case COLORSCALE_MAX:
return nMax;
+ case COLORSCALE_AUTOMAX:
+ return std::max<double>(0, nMax);
case COLORSCALE_PERCENTILE:
{
std::vector<double> aValues;
@@ -510,6 +514,8 @@ bool ScColorScaleFormat::CheckEntriesForRel(const ScRange& rRange) const
{
case COLORSCALE_MIN:
case COLORSCALE_MAX:
+ case COLORSCALE_AUTOMIN:
+ case COLORSCALE_AUTOMAX:
bNeedUpdate = true;
break;
case COLORSCALE_FORMULA:
@@ -616,6 +622,8 @@ bool NeedUpdate(ScColorScaleEntry* pEntry)
case COLORSCALE_MIN:
case COLORSCALE_MAX:
case COLORSCALE_FORMULA:
+ case COLORSCALE_AUTOMIN:
+ case COLORSCALE_AUTOMAX:
return true;
default:
return false;
@@ -660,6 +668,9 @@ double ScDataBarFormat::getMin(double nMin, double nMax) const
case COLORSCALE_MIN:
return nMin;
+ case COLORSCALE_AUTOMIN:
+ return std::min<double>(0, nMin);
+
case COLORSCALE_PERCENT:
return nMin + (nMax-nMin)/100*mpFormatData->mpLowerLimit->GetValue();
@@ -684,6 +695,8 @@ double ScDataBarFormat::getMax(double nMin, double nMax) const
{
case COLORSCALE_MAX:
return nMax;
+ case COLORSCALE_AUTOMAX:
+ return std::max<double>(0, nMax);
case COLORSCALE_PERCENT:
return nMin + (nMax-nMin)/100*mpFormatData->mpUpperLimit->GetValue();
case COLORSCALE_PERCENTILE:
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index e97829a0d2a0..a9eaf1b30960 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3800,6 +3800,10 @@ rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry)
return rtl::OUString("formula");
case COLORSCALE_VALUE:
return rtl::OUString("number");
+ case COLORSCALE_AUTOMIN:
+ return rtl::OUString("auto-minimum");
+ case COLORSCALE_AUTOMAX:
+ return rtl::OUString("auto-maximum");
}
return rtl::OUString();
}
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 6b4270ac2c00..21f33c8fba73 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -80,6 +80,10 @@ void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType,
rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue()));
rLbType.SelectEntryPos(3);
break;
+ case COLORSCALE_AUTOMIN:
+ break;
+ case COLORSCALE_AUTOMAX:
+ break;
}
rLbCol.SelectEntry(rEntry.GetColor());
}
@@ -109,6 +113,10 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Ed
rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue()));
rLbType.SelectEntryPos(3);
break;
+ case COLORSCALE_AUTOMIN:
+ break;
+ case COLORSCALE_AUTOMAX:
+ break;
}
}