Kaydet (Commit) caa7f3f5 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

add formula input to color scales

Change-Id: I I7f0a46cf5aea2eb1aa8bc9415d9761cc197b0c23
üst d0e4d1f3
......@@ -27,18 +27,22 @@
*/
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
#include <formula/grammar.hxx>
#include <tools/color.hxx>
#include <rangelst.hxx>
//TODO: merge this with conditio.hxx
class ScDocument;
class ScFormulaCell;
class SC_DLLPUBLIC ScColorScaleEntry
{
private:
double mnVal;
Color maColor;
boost::scoped_ptr<ScFormulaCell> mpCell;
bool mbMin;
bool mbMax;
......@@ -46,9 +50,11 @@ private:
public:
ScColorScaleEntry(double nVal, const Color& rCol);
ScColorScaleEntry(const ScColorScaleEntry& rEntry);
~ScColorScaleEntry();
const Color& GetColor() const;
double GetValue() const;
void SetFormula(const rtl::OUString& rFormula, ScDocument* pDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT);
bool GetMin() const;
bool GetMax() const;
......@@ -80,6 +86,8 @@ public:
void DataChanged(const ScRange& rRange);
void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab);
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
typedef ColorScaleEntries::iterator iterator;
typedef ColorScaleEntries::const_iterator const_iterator;
......@@ -105,6 +113,8 @@ public:
void DataChanged(const ScRange& rRange);
void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab);
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
iterator begin();
const_iterator begin() const;
......
......@@ -33,24 +33,44 @@
ScColorScaleEntry::ScColorScaleEntry(double nVal, const Color& rCol):
mnVal(nVal),
maColor(rCol),
mpCell(NULL),
mbMin(false),
mbMax(false),
mbPercent(false){
mbPercent(false)
{
}
ScColorScaleEntry::ScColorScaleEntry(const ScColorScaleEntry& rEntry):
mnVal(rEntry.mnVal),
maColor(rEntry.maColor),
mbMin(false),
mbMax(false),
mbPercent(false)
mpCell(NULL),
mbMin(rEntry.mbMin),
mbMax(rEntry.mbMax),
mbPercent(rEntry.mbPercent)
{
}
ScColorScaleEntry::~ScColorScaleEntry()
{
}
void ScColorScaleEntry::SetFormula( const rtl::OUString& rFormula, ScDocument* pDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar )
{
mpCell.reset(new ScFormulaCell( pDoc, rAddr, rFormula, eGrammar ));
mpCell->StartListeningTo( pDoc );
}
double ScColorScaleEntry::GetValue() const
{
if(mpCell)
{
mpCell->Interpret();
if(mpCell->IsValue())
return mpCell->GetValue();
return std::numeric_limits<double>::max();
}
return mnVal;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment