summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-09-23 19:51:02 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-09-23 20:07:47 +0200
commitb3d5de767c6dbd30ded0881da9de8ae9638abb54 (patch)
tree12479acfe4c6f72481f71aa45977824dad9ad12e /sc
parent31018fa81f2fa51a3c7c2d6c992cef03b17c378d (diff)
improve the dump code for cond formats
Change-Id: Icefaa4777f64ca934928ae2ad95496000df364e9
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/colorscale.hxx8
-rw-r--r--sc/inc/conditio.hxx6
-rw-r--r--sc/source/core/data/colorscale.cxx54
-rw-r--r--sc/source/core/data/conditio.cxx4
4 files changed, 59 insertions, 13 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index db13e92db74e..df3e17a66507 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -86,6 +86,10 @@ public:
ScColorScaleEntryType GetType() const;
void SetType( ScColorScaleEntryType eType );
+
+#if DUMP_FORMAT_INFO
+ void dumpInfo(rtl::OUStringBuffer& rBuf) const;
+#endif
};
namespace databar
@@ -228,7 +232,7 @@ public:
size_t size() const;
#if DUMP_FORMAT_INFO
- virtual void dumpInfo() const;
+ virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
#endif
};
@@ -252,7 +256,7 @@ public:
virtual condformat::ScFormatEntryType GetType() const;
#if DUMP_FORMAT_INFO
- virtual void dumpInfo() const;
+ virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
#endif
private:
double getMin(double nMin, double nMax) const;
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index b4f686ea6dc6..7b1cf170ebe7 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -114,7 +114,7 @@ public:
bool operator==( const ScFormatEntry& ) const;
#if DUMP_FORMAT_INFO
- virtual void dumpInfo() const = 0;
+ virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const = 0;
#endif
protected:
ScDocument* mpDoc;
@@ -213,7 +213,7 @@ public:
static ScConditionMode GetModeFromApi(sal_Int32 nOperator);
#if DUMP_FORMAT_INFO
- virtual void dumpInfo() const {}
+ virtual void dumpInfo(rtl::OUStringBuffer& ) const {}
#endif
protected:
@@ -319,7 +319,7 @@ public:
bool MarkUsedExternalReferences() const;
#if DUMP_FORMAT_INFO
- void dumpInfo() const;
+ void dumpInfo(rtl::OUStringBuffer& rBuf) const;
#endif
// sorted (via PTRARR) by Index
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 1303e0165096..4ca1bc7c6baf 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -147,6 +147,44 @@ void ScColorScaleEntry::SetColor(const Color& rColor)
maColor = rColor;
}
+#if DUMP_FORMAT_INFO
+
+void ScColorScaleEntry::dumpInfo(rtl::OUStringBuffer& rBuf) const
+{
+ rBuf.append("Color Scale Entry\n");
+ rBuf.append("Type: ");
+ switch(meType)
+ {
+ case COLORSCALE_VALUE:
+ rBuf.append( "Value\n" );
+ break;
+ case COLORSCALE_MIN:
+ rBuf.append( "Min\n" );
+ break;
+ case COLORSCALE_MAX:
+ rBuf.append( "Max\n" );
+ break;
+ case COLORSCALE_PERCENT:
+ rBuf.append( "Percent\n" );
+ break;
+ case COLORSCALE_PERCENTILE:
+ rBuf.append( "Percentile\n" );
+ break;
+ case COLORSCALE_FORMULA:
+ rBuf.append( "Formual\n" );
+ break;
+ default:
+ rBuf.append( "Unsupported Type\n" );
+ }
+ rBuf.append( "Color: " ).append( (int)maColor.GetRed() ).append( "," ).append( (int)maColor.GetGreen() ).append( "," ).append( (int)maColor.GetBlue() ).append( "\n" );
+ if(meType == COLORSCALE_FORMULA)
+ rBuf.append( "Formula: " ).append( GetFormula( formula::FormulaGrammar::GRAM_DEFAULT ) ).append("\n");
+ else if( meType != COLORSCALE_MIN && meType != COLORSCALE_MAX )
+ rBuf.append( "Value: " ).append( mnVal ).append( "\n" );
+}
+
+#endif
+
ScColorFormat::ScColorFormat(ScDocument* pDoc):
ScFormatEntry(pDoc)
{
@@ -491,9 +529,14 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const
}
#if DUMP_FORMAT_INFO
-void ScColorScaleFormat::dumpInfo() const
+void ScColorScaleFormat::dumpInfo(rtl::OUStringBuffer& rBuf) const
{
- std::cout << "Color Scale" << std::endl;
+ rBuf.append("Color Scale with ").append(static_cast<sal_Int32>(size())).append(" entries\n");
+ for(const_iterator itr = begin(); itr != end(); ++itr)
+ {
+ itr->dumpInfo(rBuf);
+ }
+
const ScRangeList& rRange = GetRange();
size_t n = rRange.size();
for(size_t i = 0; i < n; ++i)
@@ -505,9 +548,8 @@ void ScColorScaleFormat::dumpInfo() const
for( SCROW nRow = pRange->aStart.Row(), nEndRow = pRange->aEnd.Row(); nRow <= nEndRow; ++nRow)
{
boost::scoped_ptr<Color> pColor( GetColor(ScAddress(nCol, nRow, nTab)) );
- std::cout << nCol << "," << nRow << "," << nTab << ",";
- std::cout << ((int)pColor->GetRed()) << "," << ((int)pColor->GetGreen()) << "," << ((int)pColor->GetBlue());
- std::cout << std::endl;
+ rBuf.append(nCol).append(",").append(nRow).append(",").append(nTab).append(",");
+ rBuf.append(((int)pColor->GetRed())).append(",").append(((int)pColor->GetGreen())).append(",").append(((int)pColor->GetBlue())).append("\n");
}
}
}
@@ -852,7 +894,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
}
#if DUMP_FORMAT_INFO
-void ScDataBarFormat::dumpInfo() const
+void ScDataBarFormat::dumpInfo(rtl::OUStringBuffer& rBuf) const
{
const ScRangeList& rRange = GetRange();
size_t n = rRange.size();
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 7f0c2d97b004..c8e2dbc5409b 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1457,11 +1457,11 @@ ScCondFormatData ScConditionalFormat::GetData( ScBaseCell* pCell, const ScAddres
#if DUMP_FORMAT_INFO
-void ScConditionalFormat::dumpInfo() const
+void ScConditionalFormat::dumpInfo(rtl::OUStringBuffer& rBuf) const
{
for(CondFormatContainer::const_iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
{
- itr->dumpInfo();
+ itr->dumpInfo(rBuf);
}
}
#endif