summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--icon-themes/classic/classic_images.tar.gzbin1683284 -> 1683994 bytes
-rw-r--r--icon-themes/galaxy/sc/res/black_circle_1_4th.pngbin0 -> 800 bytes
-rw-r--r--icon-themes/galaxy/sc/res/black_circle_3_4th.pngbin0 -> 784 bytes
-rw-r--r--icon-themes/galaxy/sc/res/black_circle_empty.pngbin0 -> 771 bytes
-rw-r--r--icon-themes/galaxy/sc/res/black_circle_full.pngbin0 -> 777 bytes
-rw-r--r--icon-themes/galaxy/sc/res/black_circle_half.pngbin0 -> 797 bytes
-rw-r--r--icon-themes/galaxy/sc/res/cancel.pngbin0 -> 596 bytes
-rw-r--r--icon-themes/galaxy/sc/res/exclamation_mark.pngbin0 -> 267 bytes
-rw-r--r--icon-themes/galaxy/sc/res/green_arrow_up.pngbin0 -> 511 bytes
-rw-r--r--icon-themes/galaxy/sc/res/green_circle.pngbin0 -> 691 bytes
-rw-r--r--icon-themes/galaxy/sc/res/minus_black.pngbin0 -> 193 bytes
-rw-r--r--icon-themes/galaxy/sc/res/red_arrow_down.pngbin0 -> 496 bytes
-rw-r--r--icon-themes/galaxy/sc/res/red_circle.pngbin0 -> 712 bytes
-rw-r--r--icon-themes/galaxy/sc/res/sign.pngbin0 -> 467 bytes
-rw-r--r--icon-themes/galaxy/sc/res/triangle_down_red.pngbin0 -> 398 bytes
-rw-r--r--icon-themes/galaxy/sc/res/triangle_up_green.pngbin0 -> 394 bytes
-rw-r--r--icon-themes/galaxy/sc/res/yellow_arrow_down_right.pngbin0 -> 518 bytes
-rw-r--r--icon-themes/galaxy/sc/res/yellow_arrow_right.pngbin0 -> 500 bytes
-rw-r--r--icon-themes/galaxy/sc/res/yellow_arrow_up_right.pngbin0 -> 495 bytes
-rw-r--r--icon-themes/galaxy/sc/res/yellow_circle.pngbin0 -> 752 bytes
-rw-r--r--sc/AllLangResTarget_sc.mk1
-rw-r--r--sc/inc/colorscale.hxx75
-rw-r--r--sc/inc/conditio.hxx8
-rw-r--r--sc/inc/fillinfo.hxx12
-rw-r--r--sc/source/core/data/colorscale.cxx210
-rw-r--r--sc/source/core/data/conditio.cxx5
-rw-r--r--sc/source/core/data/fillinfo.cxx7
-rw-r--r--sc/source/filter/inc/condformatbuffer.hxx19
-rw-r--r--sc/source/filter/inc/condformatcontext.hxx11
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx59
-rw-r--r--sc/source/filter/oox/condformatcontext.cxx40
-rw-r--r--sc/source/ui/inc/iconsets.hrc31
-rw-r--r--sc/source/ui/src/iconsets.src90
-rw-r--r--sc/source/ui/view/output.cxx125
34 files changed, 683 insertions, 10 deletions
diff --git a/icon-themes/classic/classic_images.tar.gz b/icon-themes/classic/classic_images.tar.gz
index e9578d919801..f013ecbad47f 100644
--- a/icon-themes/classic/classic_images.tar.gz
+++ b/icon-themes/classic/classic_images.tar.gz
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/black_circle_1_4th.png b/icon-themes/galaxy/sc/res/black_circle_1_4th.png
new file mode 100644
index 000000000000..f5390af43f71
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/black_circle_1_4th.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/black_circle_3_4th.png b/icon-themes/galaxy/sc/res/black_circle_3_4th.png
new file mode 100644
index 000000000000..7fb720290c88
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/black_circle_3_4th.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/black_circle_empty.png b/icon-themes/galaxy/sc/res/black_circle_empty.png
new file mode 100644
index 000000000000..0b037e84ab28
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/black_circle_empty.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/black_circle_full.png b/icon-themes/galaxy/sc/res/black_circle_full.png
new file mode 100644
index 000000000000..8bfc1fea55a3
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/black_circle_full.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/black_circle_half.png b/icon-themes/galaxy/sc/res/black_circle_half.png
new file mode 100644
index 000000000000..1b1328cbd189
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/black_circle_half.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/cancel.png b/icon-themes/galaxy/sc/res/cancel.png
new file mode 100644
index 000000000000..ae3f7a60c9d0
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/cancel.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/exclamation_mark.png b/icon-themes/galaxy/sc/res/exclamation_mark.png
new file mode 100644
index 000000000000..1c0ba39b2cca
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/exclamation_mark.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/green_arrow_up.png b/icon-themes/galaxy/sc/res/green_arrow_up.png
new file mode 100644
index 000000000000..c407a3c2a779
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/green_arrow_up.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/green_circle.png b/icon-themes/galaxy/sc/res/green_circle.png
new file mode 100644
index 000000000000..82f9b226a776
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/green_circle.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/minus_black.png b/icon-themes/galaxy/sc/res/minus_black.png
new file mode 100644
index 000000000000..3f02a7d5e311
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/minus_black.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/red_arrow_down.png b/icon-themes/galaxy/sc/res/red_arrow_down.png
new file mode 100644
index 000000000000..7989707af07c
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/red_arrow_down.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/red_circle.png b/icon-themes/galaxy/sc/res/red_circle.png
new file mode 100644
index 000000000000..8da3f79a8920
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/red_circle.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/sign.png b/icon-themes/galaxy/sc/res/sign.png
new file mode 100644
index 000000000000..58e4f2f5d639
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/sign.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/triangle_down_red.png b/icon-themes/galaxy/sc/res/triangle_down_red.png
new file mode 100644
index 000000000000..569e1c672aef
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/triangle_down_red.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/triangle_up_green.png b/icon-themes/galaxy/sc/res/triangle_up_green.png
new file mode 100644
index 000000000000..216530a81947
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/triangle_up_green.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/yellow_arrow_down_right.png b/icon-themes/galaxy/sc/res/yellow_arrow_down_right.png
new file mode 100644
index 000000000000..29355872462e
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/yellow_arrow_down_right.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/yellow_arrow_right.png b/icon-themes/galaxy/sc/res/yellow_arrow_right.png
new file mode 100644
index 000000000000..f38d0d9d524a
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/yellow_arrow_right.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/yellow_arrow_up_right.png b/icon-themes/galaxy/sc/res/yellow_arrow_up_right.png
new file mode 100644
index 000000000000..ea78f27a974d
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/yellow_arrow_up_right.png
Binary files differ
diff --git a/icon-themes/galaxy/sc/res/yellow_circle.png b/icon-themes/galaxy/sc/res/yellow_circle.png
new file mode 100644
index 000000000000..d39cc6643ed6
--- /dev/null
+++ b/icon-themes/galaxy/sc/res/yellow_circle.png
Binary files differ
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 2d3c64c89153..978f2fae7f6f 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_SrsTarget_set_include,sc/res,\
))
$(eval $(call gb_SrsTarget_add_files,sc/res,\
+ sc/source/ui/src/iconsets.src \
sc/source/ui/src/optdlg.src \
sc/source/ui/src/popup.src \
sc/source/ui/src/autofmt.src \
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 92f88f3359b4..685fde1fc7d1 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -179,6 +179,33 @@ struct SC_DLLPUBLIC ScDataBarFormatData
boost::scoped_ptr<ScColorScaleEntry> mpLowerLimit;
};
+enum ScIconSetType
+{
+ IconSet_3Arrows,
+ IconSet_3ArrowsGray,
+ IconSet_3Flags,
+ IconSet_3TrafficLights1,
+ IconSet_3TrafficLights2,
+ IconSet_3Signs,
+ IconSet_3Symbols,
+ IconSet_3Symbols2,
+ IconSet_4Arrows,
+ IconSet_4ArrowsGray,
+ IconSet_4RedToBlack,
+ IconSet_4Rating,
+ IconSet_4TrafficLights,
+ IconSet_5Arrows,
+ IconSet_5ArrowsGray,
+ IconSet_5Ratings,
+ IconSet_5Quarters
+};
+
+struct ScIconSetMap {
+ const char* pName;
+ ScIconSetType eType;
+ sal_Int32 nElements;
+};
+
class SC_DLLPUBLIC ScColorFormat : public ScFormatEntry
{
public:
@@ -281,6 +308,54 @@ private:
boost::scoped_ptr<ScDataBarFormatData> mpFormatData;
};
+struct ScIconSetFormatData
+{
+ ScIconSetType eIconSetType;
+ boost::ptr_vector<ScColorScaleEntry> maEntries;
+};
+
+class SC_DLLPUBLIC ScIconSetFormat : public ScColorFormat
+{
+private:
+ typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator;
+ typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator;
+
+public:
+ ScIconSetFormat(ScDocument* pDoc);
+ ScIconSetFormat(ScDocument* pDoc, const ScIconSetFormat& rFormat);
+
+ virtual ScColorFormat* Clone(ScDocument* pDoc = NULL) const;
+
+ ScIconSetInfo* GetIconSetInfo(const ScAddress& rAddr) const;
+
+ void SetIconSetData( ScIconSetFormatData* pData );
+ const ScIconSetFormatData* GetIconSetData() const;
+
+ virtual void DataChanged(const ScRange& rRange);
+ virtual void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab);
+ virtual void UpdateReference( UpdateRefMode eUpdateRefMode,
+ const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+
+ virtual condformat::ScFormatEntryType GetType() const;
+
+ static ScIconSetMap* getIconSetMap();
+
+#if DUMP_FORMAT_INFO
+ virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
+#endif
+private:
+ iterator begin();
+ const_iterator begin() const;
+ iterator end();
+ const_iterator end() const;
+
+ double GetMinValue() const;
+ double GetMaxValue() const;
+ double CalcValue(double nMin, double nMax, ScIconSetFormat::const_iterator& itr) const;
+
+ boost::scoped_ptr<ScIconSetFormatData> mpFormatData;
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index b9b24c44060e..a18235ba7dbb 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -79,6 +79,7 @@ enum ScConditionMode
class ScConditionalFormat;
struct ScDataBarInfo;
+struct ScIconSetInfo;
namespace condformat
{
@@ -87,7 +88,8 @@ enum ScFormatEntryType
{
CONDITION,
COLORSCALE,
- DATABAR
+ DATABAR,
+ ICONSET
};
}
@@ -96,10 +98,12 @@ struct ScCondFormatData
{
ScCondFormatData():
pColorScale(NULL),
- pDataBar(NULL) {}
+ pDataBar(NULL),
+ pIconSet(NULL) {}
Color* pColorScale;
ScDataBarInfo* pDataBar;
+ ScIconSetInfo* pIconSet;
rtl::OUString aStyleName;
};
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index 838255ef1236..bbed41fc10f0 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -31,6 +31,7 @@
#include <svx/framelinkarray.hxx>
#include "global.hxx"
+#include "colorscale.hxx"
class SfxItemSet;
class SvxBrushItem;
@@ -91,6 +92,12 @@ struct ScDataBarInfo
}
};
+struct ScIconSetInfo
+{
+ sal_Int32 nIconIndex;
+ ScIconSetType eIconSetType;
+};
+
struct CellInfo
{
ScBaseCell* pCell;
@@ -99,6 +106,7 @@ struct CellInfo
const SfxItemSet* pConditionSet;
const Color* pColorScale;
const ScDataBarInfo* pDataBar;
+ const ScIconSetInfo* pIconSet;
const SvxBrushItem* pBackground;
@@ -135,12 +143,14 @@ struct CellInfo
CellInfo():
pColorScale(NULL),
- pDataBar(NULL) {}
+ pDataBar(NULL),
+ pIconSet(NULL) {}
~CellInfo()
{
delete pColorScale;
delete pDataBar;
+ delete pIconSet;
}
};
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 1f6779f7b0ea..4089bf919369 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -848,4 +848,214 @@ void ScDataBarFormat::dumpInfo(rtl::OUStringBuffer& rBuf) const
}
#endif
+ScIconSetFormat::ScIconSetFormat(ScDocument* pDoc):
+ ScColorFormat(pDoc),
+ mpFormatData(new ScIconSetFormatData)
+{
+}
+
+ScIconSetFormat::ScIconSetFormat(ScDocument* pDoc, const ScIconSetFormat& rFormat):
+ ScColorFormat(pDoc),
+ mpFormatData(new ScIconSetFormatData(*rFormat.mpFormatData))
+{
+}
+
+ScColorFormat* ScIconSetFormat::Clone( ScDocument* pDoc ) const
+{
+ return new ScIconSetFormat(pDoc, *this);
+}
+
+void ScIconSetFormat::SetIconSetData( ScIconSetFormatData* pFormatData )
+{
+ mpFormatData.reset( pFormatData );
+}
+
+const ScIconSetFormatData* ScIconSetFormat::GetIconSetData() const
+{
+ return mpFormatData.get();
+}
+
+ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const
+{
+ CellType eCellType = mpDoc->GetCellType(rAddr);
+ if(eCellType != CELLTYPE_VALUE && eCellType != CELLTYPE_FORMULA)
+ return NULL;
+
+ if (eCellType == CELLTYPE_FORMULA)
+ {
+ if(!static_cast<ScFormulaCell*>(mpDoc->GetCell(rAddr))->IsValue())
+ return NULL;
+ }
+
+ ScIconSetInfo* pInfo = new ScIconSetInfo;
+
+ // now we have for sure a value
+ double nVal = mpDoc->GetValue(rAddr);
+
+ if (mpFormatData->maEntries.size() < 2)
+ return NULL;
+
+ double nMin = GetMinValue();
+ double nMax = GetMaxValue();
+
+ // this check is for safety
+ if(nMin >= nMax)
+ return NULL;
+
+ sal_Int32 nIndex = 0;
+ const_iterator itr = begin();
+ ++itr;
+ double nValMax = CalcValue(nMin, nMax, itr);
+
+ ++itr;
+ while(itr != end() && nVal > nValMax)
+ {
+ ++nIndex;
+ nValMax = CalcValue(nMin, nMax, itr);
+ ++itr;
+ }
+ if(nVal > nValMax)
+ ++nIndex;
+
+ pInfo->nIconIndex = nIndex;
+ pInfo->eIconSetType = mpFormatData->eIconSetType;
+ return pInfo;
+}
+
+condformat::ScFormatEntryType ScIconSetFormat::GetType() const
+{
+ return condformat::ICONSET;
+}
+
+void ScIconSetFormat::DataChanged( const ScRange& )
+{
+
+}
+
+void ScIconSetFormat::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab )
+{
+ for(iterator itr = begin(); itr != end(); ++itr)
+ {
+ itr->UpdateMoveTab(nOldTab, nNewTab, 0);
+ }
+}
+
+void ScIconSetFormat::UpdateReference( UpdateRefMode eUpdateRefMode,
+ const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+{
+ for(iterator itr = begin(); itr != end(); ++itr)
+ {
+ itr->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz );
+ }
+}
+
+void ScIconSetFormat::dumpInfo( rtl::OUStringBuffer& rBuffer ) const
+{
+ rBuffer.append("IconSet: \n");
+ for(const_iterator itr = begin(); itr != end(); ++itr)
+ {
+ itr->dumpInfo(rBuffer);
+ }
+}
+
+ScIconSetFormat::iterator ScIconSetFormat::begin()
+{
+ return mpFormatData->maEntries.begin();
+}
+
+ScIconSetFormat::const_iterator ScIconSetFormat::begin() const
+{
+ return mpFormatData->maEntries.begin();
+}
+
+ScIconSetFormat::iterator ScIconSetFormat::end()
+{
+ return mpFormatData->maEntries.end();
+}
+
+ScIconSetFormat::const_iterator ScIconSetFormat::end() const
+{
+ return mpFormatData->maEntries.end();
+}
+
+double ScIconSetFormat::GetMinValue() const
+{
+ const_iterator itr = begin();
+
+ if(itr->GetType() == COLORSCALE_VALUE || itr->GetType() == COLORSCALE_FORMULA)
+ return itr->GetValue();
+ else
+ {
+ return getMinValue();
+ }
+}
+
+double ScIconSetFormat::GetMaxValue() const
+{
+ boost::ptr_vector<ScColorScaleEntry>::const_reverse_iterator itr = mpFormatData->maEntries.rbegin();
+
+ if(itr->GetType() == COLORSCALE_VALUE || itr->GetType() == COLORSCALE_FORMULA)
+ return itr->GetValue();
+ else
+ {
+ return getMaxValue();
+ }
+}
+
+double ScIconSetFormat::CalcValue(double nMin, double nMax, ScIconSetFormat::const_iterator& itr) const
+{
+ switch(itr->GetType())
+ {
+ case COLORSCALE_PERCENT:
+ return nMin + (nMax-nMin)*(itr->GetValue()/100);
+ case COLORSCALE_MIN:
+ return nMin;
+ case COLORSCALE_MAX:
+ return nMax;
+ case COLORSCALE_PERCENTILE:
+ {
+ std::vector<double>& rValues = getValues();
+ if(rValues.size() == 1)
+ return rValues[0];
+ else
+ {
+ double fPercentile = itr->GetValue()/100.0;
+ return GetPercentile(rValues, fPercentile);
+ }
+ }
+
+ default:
+ break;
+ }
+
+ return itr->GetValue();
+}
+
+ScIconSetMap* ScIconSetFormat::getIconSetMap()
+{
+
+ static ScIconSetMap aIconSetMap[] = {
+ { "3Arrows", IconSet_3Arrows, 3 },
+ { "3ArrowsGray", IconSet_3ArrowsGray, 3 },
+ { "3Flags", IconSet_3Flags, 3 },
+ { "3TrafficLights1", IconSet_3TrafficLights1, 3 },
+ { "3TrafficLights2", IconSet_3TrafficLights2, 3 },
+ { "3Signs", IconSet_3Signs, 3 },
+ { "3Symbols", IconSet_3Symbols, 3 },
+ { "3Symbols2", IconSet_3Symbols2, 3 },
+ { "4Arrows", IconSet_4Arrows, 4 },
+ { "4ArrowsGray", IconSet_4ArrowsGray, 4 },
+ { "4RedToBlack", IconSet_4RedToBlack, 4 },
+ { "4Rating", IconSet_4Rating, 4 },
+ { "4TrafficLights", IconSet_4TrafficLights, 4 },
+ { "5Arrows", IconSet_5Arrows, 5 },
+ { "5ArrowsGray", IconSet_5ArrowsGray, 5 },
+ { "5Ratings", IconSet_5Ratings, 5 },
+ { "5Quarters", IconSet_5Quarters, 5 },
+ { NULL, IconSet_3Arrows, 0 }
+ };
+
+ return aIconSetMap;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 773d60a58165..324bcf9f54fb 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1499,6 +1499,11 @@ ScCondFormatData ScConditionalFormat::GetData( ScBaseCell* pCell, const ScAddres
const ScDataBarFormat& rEntry = static_cast<const ScDataBarFormat&>(*itr);
aData.pDataBar = rEntry.GetDataBarInfo(rPos);
}
+ else if(itr->GetType() == condformat::ICONSET && !aData.pIconSet)
+ {
+ const ScIconSetFormat& rEntry = static_cast<const ScIconSetFormat&>(*itr);
+ aData.pIconSet = rEntry.GetIconSetInfo(rPos);
+ }
}
return aData;
}
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index a7c681e65d94..15868baab258 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -49,6 +49,8 @@
#include "colorscale.hxx"
#include "stlpool.hxx"
+#include <iostream>
+
// -----------------------------------------------------------------------
const sal_uInt16 ROWINFO_MAX = 1024;
@@ -570,6 +572,11 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
pInfo->pDataBar = aData.pDataBar;
bFound = true;
}
+ if(aData.pIconSet)
+ {
+ pInfo->pIconSet = aData.pIconSet;
+ bFound = true;
+ }
}
}
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index 91521c6e83d6..9dfe34ecba14 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -42,6 +42,8 @@ class ScColorScaleFormat;
class ScDataBarFormat;
struct ScDataBarFormatData;
class ScConditionalFormat;
+class ScIconSetFormat;
+struct ScIconSetFormatData;
namespace oox {
namespace xls {
@@ -135,6 +137,21 @@ private:
boost::scoped_ptr<ColorScaleRuleModelEntry> mpLowerLimit;
};
+class IconSetRule : public WorksheetHelper
+{
+public:
+ IconSetRule( const CondFormat& rFormat );
+ void importCfvo( const AttributeList& rAttribs );
+ void importAttribs( const AttributeList& rAttribs );
+
+ void SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr );
+
+private:
+ std::vector< ColorScaleRuleModelEntry > maEntries;
+ ScIconSetFormatData* mpFormatData;
+ rtl::OUString maIconSetType;
+};
+
// ============================================================================
@@ -161,6 +178,7 @@ public:
ColorScaleRule* getColorScale();
DataBarRule* getDataBar();
+ IconSetRule* getIconSet();
private:
const CondFormat& mrCondFormat;
@@ -168,6 +186,7 @@ private:
ScConditionalFormat* mpFormat;
boost::scoped_ptr<ColorScaleRule> mpColor;
boost::scoped_ptr<DataBarRule> mpDataBar;
+ boost::scoped_ptr<IconSetRule> mpIconSet;
};
typedef ::boost::shared_ptr< CondFormatRule > CondFormatRuleRef;
diff --git a/sc/source/filter/inc/condformatcontext.hxx b/sc/source/filter/inc/condformatcontext.hxx
index f5ebd8cad7ad..1078dce22de2 100644
--- a/sc/source/filter/inc/condformatcontext.hxx
+++ b/sc/source/filter/inc/condformatcontext.hxx
@@ -63,6 +63,17 @@ private:
CondFormatRuleRef mxRule;
};
+class IconSetContext : public WorksheetContextBase
+{
+public:
+ explicit IconSetContext( CondFormatContext& rFormat, CondFormatRuleRef xRule );
+
+ virtual oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+private:
+ CondFormatRuleRef mxRule;
+};
+
class CondFormatContext : public WorksheetContextBase
{
public:
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index f469390c975c..aa93f426b104 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -326,6 +326,49 @@ void DataBarRule::SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScA
// ============================================================================
+IconSetRule::IconSetRule( const CondFormat& rFormat ):
+ WorksheetHelper( rFormat ),
+ mpFormatData( new ScIconSetFormatData )
+{
+}
+
+void IconSetRule::importCfvo( const AttributeList& rAttribs )
+{
+ ColorScaleRuleModelEntry aNewEntry;
+ SetCfvoData(&aNewEntry, rAttribs);
+
+ maEntries.push_back(aNewEntry);
+}
+
+void IconSetRule::importAttribs( const AttributeList& rAttribs )
+{
+ maIconSetType = rAttribs.getString( XML_iconSet, rtl::OUString("3TrafficLights1") );
+}
+
+void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rPos )
+{
+ for(size_t i = 0; i < maEntries.size(); ++i)
+ {
+ ScColorScaleEntry* pModelEntry = ConvertToModel( maEntries[i], pDoc, rPos );
+ mpFormatData->maEntries.push_back(pModelEntry);
+ }
+
+ ScIconSetType eIconSetType = IconSet_3TrafficLights1;
+ ScIconSetMap* pIconSetMap = ScIconSetFormat::getIconSetMap();
+ for(size_t i = 0; pIconSetMap[i].pName; ++i)
+ {
+ if(rtl::OUString::createFromAscii(pIconSetMap[i].pName) == maIconSetType)
+ {
+ eIconSetType = pIconSetMap[i].eType;
+ break;
+ }
+ }
+ mpFormatData->eIconSetType = eIconSetType;
+ pFormat->SetIconSetData(mpFormatData);
+}
+
+// ============================================================================
+
CondFormatRuleModel::CondFormatRuleModel() :
mnPriority( -1 ),
mnType( XML_TOKEN_INVALID ),
@@ -802,6 +845,14 @@ void CondFormatRule::finalizeImport()
mpDataBar->SetData( pFormatEntry, &rDoc, aPos );
}
+ else if(mpIconSet)
+ {
+ ScDocument& rDoc = getScDocument();
+ ScIconSetFormat* pFormatEntry = new ScIconSetFormat(&rDoc);
+
+ mpFormat->AddEntry(pFormatEntry);
+ mpIconSet->SetData( pFormatEntry, &rDoc, aPos );
+ }
}
ColorScaleRule* CondFormatRule::getColorScale()
@@ -820,6 +871,14 @@ DataBarRule* CondFormatRule::getDataBar()
return mpDataBar.get();
}
+IconSetRule* CondFormatRule::getIconSet()
+{
+ if(!mpIconSet)
+ mpIconSet.reset( new IconSetRule(mrCondFormat) );
+
+ return mpIconSet.get();
+}
+
// ============================================================================
CondFormatModel::CondFormatModel() :
diff --git a/sc/source/filter/oox/condformatcontext.cxx b/sc/source/filter/oox/condformatcontext.cxx
index 85f4da51223d..cef08e135a79 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -88,7 +88,7 @@ ContextHandlerRef DataBarContext::onCreateContext( sal_Int32 nElement, const Att
switch( getCurrentElement() )
{
case XLS_TOKEN( cfRule ):
- return (nElement == XLS_TOKEN( colorScale )) ? this : 0;
+ return (nElement == XLS_TOKEN( dataBar )) ? this : 0;
case XLS_TOKEN( dataBar ):
if (nElement == XLS_TOKEN( cfvo ))
return this;
@@ -118,6 +118,42 @@ void DataBarContext::onStartElement( const AttributeList& rAttribs )
// ============================================================================
+IconSetContext::IconSetContext( CondFormatContext& rFragment, CondFormatRuleRef xRule ) :
+ WorksheetContextBase( rFragment ),
+ mxRule( xRule )
+{
+}
+
+ContextHandlerRef IconSetContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+{
+ switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( cfRule ):
+ return (nElement == XLS_TOKEN( iconSet )) ? this : 0;
+ case XLS_TOKEN( iconSet ):
+ if (nElement == XLS_TOKEN( cfvo ))
+ return this;
+ else
+ return 0;
+ }
+ return 0;
+}
+
+void IconSetContext::onStartElement( const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( iconSet ):
+ mxRule->getIconSet()->importAttribs( rAttribs );
+ break;
+ case XLS_TOKEN( cfvo ):
+ mxRule->getIconSet()->importCfvo( rAttribs );
+ break;
+ }
+}
+
+// ============================================================================
+
CondFormatContext::CondFormatContext( WorksheetFragmentBase& rFragment ) :
WorksheetContextBase( rFragment )
{
@@ -136,6 +172,8 @@ ContextHandlerRef CondFormatContext::onCreateContext( sal_Int32 nElement, const
return new ColorScaleContext( *this, mxRule );
else if (nElement == XLS_TOKEN( dataBar ) )
return new DataBarContext( *this, mxRule );
+ else if (nElement == XLS_TOKEN( iconSet ) )
+ return new IconSetContext( *this, mxRule );
else if (nElement == XLS_TOKEN( extLst ) )
return new ExtLstLocalContext( *this, mxRule->getDataBar()->getDataBarFormatData() );
else
diff --git a/sc/source/ui/inc/iconsets.hrc b/sc/source/ui/inc/iconsets.hrc
new file mode 100644
index 000000000000..2173fd2da289
--- /dev/null
+++ b/sc/source/ui/inc/iconsets.hrc
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+#define BMP_GREEN_CIRCLE 999
+#define BMP_YELLOW_CIRCLE 998
+#define BMP_RED_CIRCLE 997
+#define BMP_BLACK_CIRCLE 991
+#define BMP_BLACK_CIRCLE_EMPTY 990
+#define BMP_BLACK_CIRCLE_HALF 989
+#define BMP_BLACK_CIRCLE_1_4TH 988
+#define BMP_BLACK_CIRCLE_3_4TH 987
+#define BMP_ARROW_GREEN_UP 996
+#define BMP_ARROW_RED_DOWN 995
+#define BMP_ARROW_YELLOW_RIGHT 994
+#define BMP_ARROW_YELLOW_UP_RIGHT 993
+#define BMP_ARROW_YELLOW_DOWN_RIGHT 992
+#define BMP_GREEN_TRIANGLE_UP 986
+#define BMP_BLACK_MINUS 985
+#define BMP_RED_TRIANGLE_DOWN 984
+#define BMP_SIGN 983
+#define BMP_EXCLAMATION_MARK 982
+#define BMP_CANCEL 981
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/iconsets.src b/sc/source/ui/src/iconsets.src
new file mode 100644
index 000000000000..4a7df5b314e3
--- /dev/null
+++ b/sc/source/ui/src/iconsets.src
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "iconsets.hrc"
+
+Bitmap BMP_GREEN_CIRCLE
+{
+ File = "green_circle.png";
+};
+Bitmap BMP_YELLOW_CIRCLE
+{
+ File = "yellow_circle.png";
+};
+Bitmap BMP_RED_CIRCLE
+{
+ File = "red_circle.png";
+};
+Bitmap BMP_BLACK_CIRCLE
+{
+ File = "black_circle_full.png";
+};
+Bitmap BMP_BLACK_CIRCLE_EMPTY
+{
+ File = "black_circle_empty.png";
+};
+Bitmap BMP_BLACK_CIRCLE_HALF
+{
+ File = "black_circle_half.png";
+};
+Bitmap BMP_BLACK_CIRCLE_1_4TH
+{
+ File = "black_circle_1_4th.png";
+};
+Bitmap BMP_BLACK_CIRCLE_3_4TH
+{
+ File = "black_circle_3_4th.png";
+};
+Bitmap BMP_ARROW_GREEN_UP
+{
+ File = "green_arrow_up.png";
+};
+Bitmap BMP_ARROW_YELLOW_RIGHT
+{
+ File = "yellow_arrow_right.png";
+};
+Bitmap BMP_ARROW_RED_DOWN
+{
+ File = "red_arrow_down.png";
+};
+Bitmap BMP_ARROW_YELLOW_UP_RIGHT
+{
+ File = "yellow_arrow_up_right.png";
+};
+Bitmap BMP_ARROW_YELLOW_DOWN_RIGHT
+{
+ File = "yellow_arrow_down_right.png";
+};
+Bitmap BMP_GREEN_TRIANGLE_UP
+{
+ File = "triangle_up_green.png";
+};
+Bitmap BMP_BLACK_MINUS
+{
+ File = "minus.png";
+};
+Bitmap BMP_RED_TRIANGLE_DOWN
+{
+ File = "triangle_down_red.png";
+};
+Bitmap BMP_SIGN
+{
+ File = "sign.png";
+};
+Bitmap BMP_EXCLAMATION_MARK
+{
+ File = "exclamation_mark.png";
+};
+Bitmap BMP_CANCEL
+{
+ File = "cancel.png";
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 24b4fca77e41..81af7baaf2c8 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -71,7 +71,14 @@
#include "appoptio.hxx"
#include "postit.hxx"
+#include "scresid.hxx"
+#include "iconsets.hrc"
+#include "colorscale.hxx"
+
#include <math.h>
+#include <map>
+#include <utility>
+#include <iostream>
using namespace com::sun::star;
@@ -86,6 +93,56 @@ static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = {
COL_GREEN, COL_RED, COL_BLUE,
COL_BROWN, COL_MAGENTA, COL_CYAN };
+sal_Int32 a3TrafficLights1[] = {
+ BMP_RED_CIRCLE, BMP_YELLOW_CIRCLE, BMP_GREEN_CIRCLE
+};
+
+sal_Int32 a3Arrows[] = {
+ BMP_ARROW_RED_DOWN, BMP_ARROW_YELLOW_RIGHT, BMP_ARROW_GREEN_UP
+};
+
+sal_Int32 a4Arrows[] = {
+ BMP_ARROW_RED_DOWN, BMP_ARROW_YELLOW_DOWN_RIGHT, BMP_ARROW_YELLOW_UP_RIGHT, BMP_ARROW_GREEN_UP
+};
+
+sal_Int32 a5Arrows[] = {
+ BMP_ARROW_RED_DOWN, BMP_ARROW_YELLOW_DOWN_RIGHT, BMP_ARROW_YELLOW_RIGHT, BMP_ARROW_YELLOW_UP_RIGHT, BMP_ARROW_GREEN_UP
+};
+
+sal_Int32 a4TrafficLights[] = {
+ BMP_BLACK_CIRCLE, BMP_RED_CIRCLE, BMP_YELLOW_CIRCLE, BMP_GREEN_CIRCLE
+};
+
+sal_Int32 a5Quarters[] = {
+ BMP_BLACK_CIRCLE_EMPTY, BMP_BLACK_CIRCLE_1_4TH, BMP_BLACK_CIRCLE_HALF, BMP_BLACK_CIRCLE_3_4TH, BMP_BLACK_CIRCLE
+};
+
+sal_Int32 a3Symbols1[] = {
+ BMP_CANCEL, BMP_EXCLAMATION_MARK, BMP_SIGN
+};
+
+struct ScIconSetBitmapMap {
+ ScIconSetType eType;
+ sal_Int32* nBitmaps;
+};
+
+static ScIconSetBitmapMap aBitmapMap[] = {
+ { IconSet_3TrafficLights1, a3TrafficLights1 },
+ { IconSet_3TrafficLights2, a3TrafficLights1 },
+ { IconSet_3Arrows, a3Arrows },
+ { IconSet_3ArrowsGray, a3Arrows },
+ { IconSet_3Symbols, a3Symbols1 },
+ { IconSet_3Symbols2, a3Symbols1 },
+ { IconSet_4Arrows, a4Arrows },
+ { IconSet_4ArrowsGray, a4Arrows },
+ { IconSet_4TrafficLights, a4TrafficLights },
+ { IconSet_5Arrows, a5Arrows },
+ { IconSet_5ArrowsGray, a5Arrows },
+ { IconSet_5Quarters, a5Quarters }
+};
+
+static std::map< sal_Int32, BitmapEx > aIconSetBitmaps;
+
// Hilfsklasse, fuer die Farbzuordnung,
// um nicht mehrfach hintereinander denselben User aus der Liste zu suchen
@@ -778,6 +835,13 @@ static sal_Bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther,
if (pInfo1 && (*pInfo1 != *pInfo2))
return false;
+
+ // each cell with an icon set should be painted the same way
+ const ScIconSetInfo* pIconSet1 = rFirst.pCellInfo[nX+1].pIconSet;
+ const ScIconSetInfo* pIconSet2 = rOther.pCellInfo[nX+1].pIconSet;
+
+ if(pIconSet1 || pIconSet2)
+ return false;
}
return sal_True;
@@ -870,14 +934,50 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
}
}
+BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex )
+{
+ sal_Int32 nBitmap = -1;
+
+ for(size_t i = 0; i < SAL_N_ELEMENTS(aBitmapMap); ++i)
+ {
+ if(aBitmapMap[i].eType == eType)
+ {
+ nBitmap = *(aBitmapMap[i].nBitmaps + nIndex);
+ }
+ }
+
+ assert( nBitmap != -1 );
+
+ std::map<sal_Int32, BitmapEx>::iterator itr = aIconSetBitmaps.find( nBitmap );
+ if(itr != aIconSetBitmaps.end())
+ return itr->second;
+
+ BitmapEx aBitmap = BitmapEx(ScResId(nBitmap));
+ std::pair<sal_Int32, BitmapEx> aPair( nBitmap, aBitmap );
+ std::pair<std::map<sal_Int32, BitmapEx>::iterator, bool> itrNew = aIconSetBitmaps.insert(aPair);
+ assert(itrNew.second);
+
+ return itrNew.first->second;
+}
+
+void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, OutputDevice* pDev, const Rectangle& rRect )
+{
+ long nSize = 16;
+ ScIconSetType eType = pOldIconSetInfo->eIconSetType;
+ sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
+ BitmapEx& rIcon = getIcon( eType, nIndex );
+ pDev->DrawBitmapEx( Point( rRect.Left() +2, rRect.Top() + 2 ), Size( nSize, nSize ), rIcon );
+}
+
void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground,
- Rectangle& rRect, long nPosX, long nSignedOneX, OutputDevice* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo)
+ Rectangle& rRect, long nPosX, long nSignedOneX, OutputDevice* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo,
+ const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo)
{
// need to paint if old color scale has been used and now
// we have a different color or a style based background
// we can here fall back to pointer comparison
- if (pOldColor && (pBackground || pOldColor != pColor || pOldDataBarInfo || pDataBarInfo))
+ if (pOldColor && (pBackground || pOldColor != pColor || pOldDataBarInfo || pDataBarInfo || pIconSetInfo || pOldIconSetInfo))
{
rRect.Right() = nPosX-nSignedOneX;
if( !pOldColor->GetTransparency() )
@@ -887,10 +987,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
}
if( pOldDataBarInfo )
drawDataBars( pOldDataBarInfo, pDev, rRect );
+ if( pOldIconSetInfo )
+ drawIconSets( pOldIconSetInfo, pDev, rRect );
+
rRect.Left() = nPosX - nSignedOneX;
}
- if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || pDataBarInfo) )
+ if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || pDataBarInfo || pIconSetInfo || pOldIconSetInfo) )
{
rRect.Right() = nPosX-nSignedOneX;
if (pOldBackground) // ==0 if hidden
@@ -904,10 +1007,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
}
if( pOldDataBarInfo )
drawDataBars( pOldDataBarInfo, pDev, rRect );
+ if( pOldIconSetInfo )
+ drawIconSets( pOldIconSetInfo, pDev, rRect );
+
rRect.Left() = nPosX - nSignedOneX;
}
- if (!pOldBackground && !pOldColor && pDataBarInfo)
+ if (!pOldBackground && !pOldColor && (pDataBarInfo || pIconSetInfo))
{
rRect.Right() = nPosX -nSignedOneX;
rRect.Left() = nPosX - nSignedOneX;
@@ -931,6 +1037,11 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
pOldDataBarInfo = pDataBarInfo;
else
pOldDataBarInfo = NULL;
+
+ if(pIconSetInfo)
+ pOldIconSetInfo = pIconSetInfo;
+ else
+ pOldIconSetInfo = NULL;
}
}
@@ -992,6 +1103,7 @@ void ScOutputData::DrawBackground()
const Color* pOldColor = NULL;
const Color* pColor = NULL;
const ScDataBarInfo* pOldDataBarInfo = NULL;
+ const ScIconSetInfo* pOldIconSetInfo = NULL;
for (SCCOL nX=nX1; nX<=nX2; nX++)
{
CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
@@ -1032,11 +1144,12 @@ void ScOutputData::DrawBackground()
pColor = pInfo->pColorScale;
const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar;
- drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo );
+ const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet;
+ drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo );
nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
}
- drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo );
+ drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo );
nArrY += nSkip;
}