diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-06-28 23:28:36 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-06-29 00:08:17 +0200 |
commit | 17cb1d6d82db56761c86ee95195689cc155901b3 (patch) | |
tree | acce5799ac6a7693f34a53a51606a9090002dc07 /sc/inc | |
parent | a539cf2c09bdd62d1c4a0124ed536f88d4fd01d5 (diff) |
allow these cond formats to be updated when formula val changes,fdo#64401
When the formulas depend on cells outside of the paint range we need to
update the whole range. This approach will update the range more often
than necessary but prevents that we need to mess with ScFormulaCell.
In the future we should replace ScFormulaCell in this part of the code
with something simpler that will correctly fix this problem.
Change-Id: Ie8a8e5205f9ea1e43bb6d9f8bee6e0bab29e4840
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/colorscale.hxx | 35 | ||||
-rw-r--r-- | sc/inc/conditio.hxx | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 5a390de6e430..832e09b9b026 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -17,6 +17,9 @@ #include <rangelst.hxx> #include "conditio.hxx" +#include <svl/listener.hxx> +#include <svl/broadcast.hxx> + #include <vector> //TODO: merge this with conditio.hxx @@ -27,6 +30,24 @@ class ScTokenArray; struct ScDataBarInfo; class BitmapEx; +class ScFormulaListener : public SvtListener +{ +private: + std::vector<ScRange> maCells; + mutable bool mbDirty; + ScDocument* mpDoc; + + void startListening(ScTokenArray* pTokens, const ScAddress& rPos); + +public: + ScFormulaListener(ScFormulaCell* pCell); + virtual ~ScFormulaListener(); + + void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + + bool NeedsRepaint() const; +}; + // don't change the order // they are also used in the dialog to determine the position // in the list box @@ -47,6 +68,7 @@ private: double mnVal; Color maColor; boost::scoped_ptr<ScFormulaCell> mpCell; + boost::scoped_ptr<ScFormulaListener> mpListener; ScColorScaleEntryType meType; public: @@ -60,7 +82,9 @@ public: void SetColor(const Color&); double GetValue() const; void SetValue(double nValue); - void SetFormula(const OUString& rFormula, ScDocument* pDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT); + void SetFormula(const OUString& rFormula, ScDocument* pDoc, const ScAddress& rAddr, + formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT); + void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab, SCTAB nTabNo); void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); @@ -71,6 +95,7 @@ public: ScColorScaleEntryType GetType() const; void SetType( ScColorScaleEntryType eType ); + bool NeedsRepaint() const; }; namespace databar @@ -200,6 +225,8 @@ public: virtual void startRendering(); virtual void endRendering(); + virtual bool NeedsRepaint() const = 0; + protected: std::vector<double>& getValues() const; @@ -243,6 +270,8 @@ public: virtual void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + virtual bool NeedsRepaint() const; + virtual condformat::ScFormatEntryType GetType() const; typedef ColorScaleEntries::iterator iterator; typedef ColorScaleEntries::const_iterator const_iterator; @@ -271,6 +300,8 @@ public: virtual void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + virtual bool NeedsRepaint() const; + virtual condformat::ScFormatEntryType GetType() const; private: @@ -313,6 +344,8 @@ public: virtual void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + virtual bool NeedsRepaint() const; + virtual condformat::ScFormatEntryType GetType() const; static ScIconSetMap* getIconSetMap(); diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 87cfcc30446d..42ad1f73e322 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -390,6 +390,8 @@ public: // don't use the same name as for the const version ScRangeList& GetRangeList() { return maRanges; } + ScDocument* GetDocument() { return pDoc; } + bool IsEmpty() const; size_t size() const; |