[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
Noel Grandin
noel at peralex.com
Mon Aug 31 04:29:48 PDT 2015
sc/inc/colorscale.hxx | 17 +++++++--------
sc/qa/unit/helper/shared_test_impl.hxx | 4 +--
sc/source/core/data/colorscale.cxx | 28 ++++++++++++-------------
sc/source/filter/excel/xecontent.cxx | 2 -
sc/source/filter/xml/xmlexprt.cxx | 2 -
sc/source/ui/condformat/condformatdlgentry.cxx | 4 +--
6 files changed, 28 insertions(+), 29 deletions(-)
New commits:
commit 4a5d980ff20ead85e63daf1561050fa7c2830a8f
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 31 11:25:04 2015 +0200
remove some typedef indirection
which just serves to make the code harder to read
Change-Id: Ib681aad99180df26b1cf3f4e23324dc5a86cc299
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 25f2c67..5514e02 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -245,17 +245,18 @@ private:
mutable boost::scoped_ptr<ScColorFormatCache> mpCache;
};
+typedef std::vector<std::unique_ptr<ScColorScaleEntry>> ScColorScaleEntries;
+
class SC_DLLPUBLIC ScColorScaleFormat : public ScColorFormat
{
private:
- typedef std::vector<std::unique_ptr<ScColorScaleEntry>> ColorScaleEntries;
- ColorScaleEntries maColorScales;
+ ScColorScaleEntries maColorScales;
double GetMinValue() const;
double GetMaxValue() const;
void calcMinMax(double& nMin, double& nMax) const;
- double CalcValue(double nMin, double nMax, ColorScaleEntries::const_iterator& rItr) const;
+ double CalcValue(double nMin, double nMax, ScColorScaleEntries::const_iterator& rItr) const;
public:
ScColorScaleFormat(ScDocument* pDoc);
ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleFormat& rFormat);
@@ -273,12 +274,10 @@ public:
virtual bool NeedsRepaint() const SAL_OVERRIDE;
virtual condformat::ScFormatEntryType GetType() const SAL_OVERRIDE;
- typedef ColorScaleEntries::iterator iterator;
- typedef ColorScaleEntries::const_iterator const_iterator;
- iterator begin();
- const_iterator begin() const;
- iterator end();
- const_iterator end() const;
+ ScColorScaleEntries::iterator begin();
+ ScColorScaleEntries::const_iterator begin() const;
+ ScColorScaleEntries::iterator end();
+ ScColorScaleEntries::const_iterator end() const;
ScColorScaleEntry* GetEntry(size_t nPos);
const ScColorScaleEntry* GetEntry(size_t nPos) const;
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index 9098378..956fc9f 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -102,7 +102,7 @@ void testColorScale2Entry_Impl(ScDocument& rDoc)
const ScColorScaleFormat* pColFormat = static_cast<const ScColorScaleFormat*>(pFormatEntry);
CPPUNIT_ASSERT_EQUAL(size_t(2), pColFormat->size());
- ScColorScaleFormat::const_iterator format_itr = pColFormat->begin();
+ ScColorScaleEntries::const_iterator format_itr = pColFormat->begin();
CPPUNIT_ASSERT_EQUAL(aData2Entry[i].eLowerType, format_itr[0]->GetType());
++format_itr;
CPPUNIT_ASSERT(format_itr != pColFormat->end());
@@ -141,7 +141,7 @@ void testColorScale3Entry_Impl(ScDocument& rDoc)
const ScColorScaleFormat* pColFormat = static_cast<const ScColorScaleFormat*>(pFormatEntry);
CPPUNIT_ASSERT_EQUAL(size_t(3), pColFormat->size());
- ScColorScaleFormat::const_iterator format_itr = pColFormat->begin();
+ ScColorScaleEntries::const_iterator format_itr = pColFormat->begin();
CPPUNIT_ASSERT_EQUAL(aData3Entry[i].eLowerType, format_itr[0]->GetType());
++format_itr;
CPPUNIT_ASSERT(format_itr != pColFormat->end());
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 621ea2d..5c6c54c 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -308,7 +308,7 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc):
ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleFormat& rFormat):
ScColorFormat(pDoc)
{
- for(const_iterator itr = rFormat.begin(); itr != rFormat.end(); ++itr)
+ for(ScColorScaleEntries::const_iterator itr = rFormat.begin(); itr != rFormat.end(); ++itr)
{
maColorScales.push_back(std::unique_ptr<ScColorScaleEntry>(new ScColorScaleEntry(pDoc, *itr[0])));
}
@@ -340,7 +340,7 @@ void ScColorScaleEntry::SetType( ScColorScaleEntryType eType )
double ScColorScaleFormat::GetMinValue() const
{
- const_iterator itr = maColorScales.begin();
+ ScColorScaleEntries::const_iterator itr = maColorScales.begin();
if(itr[0]->GetType() == COLORSCALE_VALUE || itr[0]->GetType() == COLORSCALE_FORMULA)
return itr[0]->GetValue();
@@ -352,7 +352,7 @@ double ScColorScaleFormat::GetMinValue() const
double ScColorScaleFormat::GetMaxValue() const
{
- ColorScaleEntries::const_reverse_iterator itr = maColorScales.rbegin();
+ ScColorScaleEntries::const_reverse_iterator itr = maColorScales.rbegin();
if(itr[0]->GetType() == COLORSCALE_VALUE || itr[0]->GetType() == COLORSCALE_FORMULA)
return itr[0]->GetValue();
@@ -499,7 +499,7 @@ double GetPercentile( const std::vector<double>& rArray, double fPercentile )
}
-double ScColorScaleFormat::CalcValue(double nMin, double nMax, ScColorScaleFormat::const_iterator& itr) const
+double ScColorScaleFormat::CalcValue(double nMin, double nMax, ScColorScaleEntries::const_iterator& itr) const
{
switch(itr[0]->GetType())
{
@@ -555,7 +555,7 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const
if(nMin >= nMax)
return NULL;
- const_iterator itr = begin();
+ ScColorScaleEntries::const_iterator itr = begin();
double nValMin = CalcValue(nMin, nMax, itr);
Color rColMin = itr[0]->GetColor();
++itr;
@@ -579,31 +579,31 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const
void ScColorScaleFormat::UpdateReference( sc::RefUpdateContext& rCxt )
{
- for(iterator itr = begin(); itr != end(); ++itr)
+ for(ScColorScaleEntries::iterator itr = begin(); itr != end(); ++itr)
itr[0]->UpdateReference(rCxt);
}
void ScColorScaleFormat::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
{
- for (iterator it = begin(); it != end(); ++it)
+ for (ScColorScaleEntries::iterator it = begin(); it != end(); ++it)
it[0]->UpdateInsertTab(rCxt);
}
void ScColorScaleFormat::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
{
- for (iterator it = begin(); it != end(); ++it)
+ for (ScColorScaleEntries::iterator it = begin(); it != end(); ++it)
it[0]->UpdateDeleteTab(rCxt);
}
void ScColorScaleFormat::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt )
{
- for (iterator it = begin(); it != end(); ++it)
+ for (ScColorScaleEntries::iterator it = begin(); it != end(); ++it)
it[0]->UpdateMoveTab(rCxt);
}
bool ScColorScaleFormat::NeedsRepaint() const
{
- for(const_iterator itr = begin(), itrEnd = end();
+ for(ScColorScaleEntries::const_iterator itr = begin(), itrEnd = end();
itr != itrEnd; ++itr)
{
if(itr[0]->NeedsRepaint())
@@ -619,22 +619,22 @@ condformat::ScFormatEntryType ScColorScaleFormat::GetType() const
return condformat::COLORSCALE;
}
-ScColorScaleFormat::iterator ScColorScaleFormat::begin()
+ScColorScaleEntries::iterator ScColorScaleFormat::begin()
{
return maColorScales.begin();
}
-ScColorScaleFormat::const_iterator ScColorScaleFormat::begin() const
+ScColorScaleEntries::const_iterator ScColorScaleFormat::begin() const
{
return maColorScales.begin();
}
-ScColorScaleFormat::iterator ScColorScaleFormat::end()
+ScColorScaleEntries::iterator ScColorScaleFormat::end()
{
return maColorScales.end();
}
-ScColorScaleFormat::const_iterator ScColorScaleFormat::end() const
+ScColorScaleEntries::const_iterator ScColorScaleFormat::end() const
{
return maColorScales.end();
}
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 0b26fc6..e5860a8 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1290,7 +1290,7 @@ XclExpColorScale::XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleF
{
const ScRange* pRange = rFormat.GetRange().front();
ScAddress aAddr = pRange->aStart;
- for(ScColorScaleFormat::const_iterator itr = rFormat.begin();
+ for(ScColorScaleEntries::const_iterator itr = rFormat.begin();
itr != rFormat.end(); ++itr)
{
// exact position is not important, we allow only absolute refs
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 632602f..f0ad9e0 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4301,7 +4301,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
{
SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, true, true);
const ScColorScaleFormat& mrColorScale = static_cast<const ScColorScaleFormat&>(*pFormatEntry);
- for(ScColorScaleFormat::const_iterator it = mrColorScale.begin();
+ for(ScColorScaleEntries::const_iterator it = mrColorScale.begin();
it != mrColorScale.end(); ++it)
{
if(it[0]->GetType() == COLORSCALE_FORMULA)
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 8668a75..6157ba3 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -756,7 +756,7 @@ ScColorScale2FrmtEntry::ScColorScale2FrmtEntry( vcl::Window* pParent, ScDocument
Init();
if(pFormat)
{
- ScColorScaleFormat::const_iterator itr = pFormat->begin();
+ ScColorScaleEntries::const_iterator itr = pFormat->begin();
SetColorScaleEntryTypes(*itr[0], *maLbEntryTypeMin.get(), *maEdMin.get(), *maLbColMin.get(), pDoc);
++itr;
SetColorScaleEntryTypes(*itr[0], *maLbEntryTypeMax.get(), *maEdMax.get(), *maLbColMax.get(), pDoc);
@@ -928,7 +928,7 @@ ScColorScale3FrmtEntry::ScColorScale3FrmtEntry( vcl::Window* pParent, ScDocument
maLbType->SelectEntryPos(0);
if(pFormat)
{
- ScColorScaleFormat::const_iterator itr = pFormat->begin();
+ ScColorScaleEntries::const_iterator itr = pFormat->begin();
SetColorScaleEntryTypes(*itr[0], *maLbEntryTypeMin.get(), *maEdMin.get(), *maLbColMin.get(), pDoc);
assert(pFormat->size() == 3);
++itr;
More information about the Libreoffice-commits
mailing list