[Libreoffice-commits] .: 6 commits - icon-themes/classic icon-themes/galaxy sc/AllLangResTarget_sc.mk sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 29 17:05:33 PDT 2012


 icon-themes/classic/classic_images.tar.gz             |binary
 icon-themes/galaxy/sc/res/black_circle_1_4th.png      |binary
 icon-themes/galaxy/sc/res/black_circle_3_4th.png      |binary
 icon-themes/galaxy/sc/res/black_circle_empty.png      |binary
 icon-themes/galaxy/sc/res/black_circle_full.png       |binary
 icon-themes/galaxy/sc/res/black_circle_half.png       |binary
 icon-themes/galaxy/sc/res/cancel.png                  |binary
 icon-themes/galaxy/sc/res/exclamation_mark.png        |binary
 icon-themes/galaxy/sc/res/green_arrow_up.png          |binary
 icon-themes/galaxy/sc/res/green_circle.png            |binary
 icon-themes/galaxy/sc/res/minus_black.png             |binary
 icon-themes/galaxy/sc/res/red_arrow_down.png          |binary
 icon-themes/galaxy/sc/res/red_circle.png              |binary
 icon-themes/galaxy/sc/res/sign.png                    |binary
 icon-themes/galaxy/sc/res/triangle_down_red.png       |binary
 icon-themes/galaxy/sc/res/triangle_up_green.png       |binary
 icon-themes/galaxy/sc/res/yellow_arrow_down_right.png |binary
 icon-themes/galaxy/sc/res/yellow_arrow_right.png      |binary
 icon-themes/galaxy/sc/res/yellow_arrow_up_right.png   |binary
 icon-themes/galaxy/sc/res/yellow_circle.png           |binary
 sc/AllLangResTarget_sc.mk                             |    1 
 sc/inc/colorscale.hxx                                 |   75 ++++++
 sc/inc/conditio.hxx                                   |    8 
 sc/inc/fillinfo.hxx                                   |   12 -
 sc/inc/globstr.hrc                                    |   16 -
 sc/source/core/data/colorscale.cxx                    |  210 ++++++++++++++++++
 sc/source/core/data/conditio.cxx                      |    5 
 sc/source/core/data/fillinfo.cxx                      |   10 
 sc/source/filter/excel/xecontent.cxx                  |   59 +++++
 sc/source/filter/inc/condformatbuffer.hxx             |   19 +
 sc/source/filter/inc/condformatcontext.hxx            |   11 
 sc/source/filter/inc/xecontent.hxx                    |   14 +
 sc/source/filter/oox/condformatbuffer.cxx             |  134 +++++++----
 sc/source/filter/oox/condformatcontext.cxx            |   40 +++
 sc/source/ui/condformat/condformatdlg.cxx             |    2 
 sc/source/ui/condformat/condformathelper.cxx          |    5 
 sc/source/ui/inc/condformathelper.hxx                 |    1 
 sc/source/ui/inc/iconsets.hrc                         |   31 ++
 sc/source/ui/src/globstr.src                          |    4 
 sc/source/ui/src/iconsets.src                         |   90 +++++++
 sc/source/ui/view/output.cxx                          |  125 ++++++++++
 41 files changed, 807 insertions(+), 65 deletions(-)

New commits:
commit ce26903f7037c44a723716dfb38766ab9611c224
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Oct 30 00:57:57 2012 +0100

    export icon set data into OOXML
    
    missing are still the Excel2010 extLst entries
    
    Change-Id: Ic0c728613b1ee48482cbd9cef2aeccd0e0f25f72

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 685fde1..5907c6e 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -316,10 +316,6 @@ struct ScIconSetFormatData
 
 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);
@@ -340,15 +336,19 @@ public:
 
     static ScIconSetMap* getIconSetMap();
 
-#if DUMP_FORMAT_INFO
-    virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
-#endif
-private:
+    typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator;
+    typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator;
+
     iterator begin();
     const_iterator begin() const;
     iterator end();
     const_iterator end() const;
 
+#if DUMP_FORMAT_INFO
+    virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
+#endif
+private:
+
     double GetMinValue() const;
     double GetMaxValue() const;
     double CalcValue(double nMin, double nMax, ScIconSetFormat::const_iterator& itr) const;
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 219bbb8..91bd918 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -988,6 +988,8 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
                     maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), nIndex ) );
                 else if(pFormatEntry->GetType() == condformat::DATABAR)
                     maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), nIndex, xExtLst ) );
+                else if(pFormatEntry->GetType() == condformat::ICONSET)
+                    maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), static_cast<const ScIconSetFormat&>(*pFormatEntry), nIndex ) );
             }
         aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 );
     }
@@ -1173,6 +1175,63 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
 
 }
 
+XclExpIconSet::XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority ):
+    XclExpRecord(),
+    XclExpRoot( rRoot ),
+    mrFormat( rFormat ),
+    mnPriority( nPriority )
+{
+    const ScRange* pRange = rFormat.GetRange().front();
+    ScAddress aAddr = pRange->aStart;
+    for(ScIconSetFormat::const_iterator itr = rFormat.begin();
+            itr != rFormat.end(); ++itr)
+    {
+        // exact position is not important, we allow only absolute refs
+
+        XclExpCfvoList::RecordRefType xCfvo( new XclExpCfvo( GetRoot(), *itr, aAddr ) );
+        maCfvoList.AppendRecord( xCfvo );
+    }
+}
+
+namespace {
+
+const char* getIconSetName( ScIconSetType eType )
+{
+    ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap();
+    for(; pMap->pName; ++pMap)
+    {
+        if(pMap->eType == eType)
+            return pMap->pName;
+    }
+
+    return "";
+}
+
+}
+
+void XclExpIconSet::SaveXml( XclExpXmlStream& rStrm )
+{
+    sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+
+    rWorksheet->startElement( XML_cfRule,
+            XML_type, "iconSet",
+            XML_priority, OString::valueOf( mnPriority + 1 ).getStr(),
+            FSEND );
+
+    const char* pIconSetName = getIconSetName(mrFormat.GetIconSetData()->eIconSetType);
+    rWorksheet->startElement( XML_iconSet,
+            XML_iconSet, pIconSetName,
+            FSEND );
+
+    maCfvoList.SaveXml( rStrm );
+
+    rWorksheet->endElement( XML_iconSet );
+    rWorksheet->endElement( XML_cfRule );
+
+    // OOXTODO: XML_extLst
+
+}
+
 // ----------------------------------------------------------------------------
 
 XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot, XclExtLstRef xExtLst ) :
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index 9417ab2..b245336 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -277,6 +277,20 @@ private:
     rtl::OString maGuid;
 };
 
+class XclExpIconSet : public XclExpRecord, protected XclExpRoot
+{
+public:
+    explicit XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority );
+
+    virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+    typedef XclExpRecordList< XclExpCfvo > XclExpCfvoList;
+
+    XclExpCfvoList maCfvoList;
+    const ScIconSetFormat& mrFormat;
+    sal_Int32 mnPriority;
+};
+
 // ----------------------------------------------------------------------------
 
 /** Contains all conditional formats of a specific sheet. */
commit 29c5324696d863f0804405267f6787a4688122b8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Oct 30 00:03:21 2012 +0100

    fix warning
    
    Change-Id: Ib9fe916eae980949978b0a5a78dfabea6581a43b

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index fcf7dfc..8ef887c 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -89,6 +89,8 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum
                 case condformat::DATABAR:
                     maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) );
                     break;
+                case condformat::ICONSET:
+                    break;
             }
         }
     }
commit 57bdc45e57cfa01330d21e3a37df133276239387
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Oct 29 23:32:21 2012 +0100

    add icon sets to manage conditional formats dlg
    
    Change-Id: I309ca58d708f0df87365a21fdcf9acb829f08a9e

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 42d8c1e..9887d8e 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -594,15 +594,15 @@
 #define STR_COND_CONDITION          469
 #define STR_COND_COLORSCALE         470
 #define STR_COND_DATABAR            471
-#define STR_COND_FORMULA            472
-#define STR_COND_BETWEEN            473
-#define STR_COND_NOTBETWEEN         474
-#define STR_COND_UNIQUE             475
-#define STR_COND_DUPLICATE          476
+#define STR_COND_ICONSET            472
+#define STR_COND_FORMULA            473
+#define STR_COND_BETWEEN            474
+#define STR_COND_NOTBETWEEN         475
+#define STR_COND_UNIQUE             476
+#define STR_COND_DUPLICATE          477
 
-#define STR_ERR_CONDFORMAT_PROTECTED 477
-
-#define STR_COUNT                   478
+#define STR_ERR_CONDFORMAT_PROTECTED 478
 
+#define STR_COUNT                   479
 
 #endif
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
index 1f658e3..2180d51 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -25,6 +25,8 @@ rtl::OUString getTextForType(ScCondFormatEntryType eType)
             return ScGlobal::GetRscString(STR_COND_DATABAR);
         case FORMULA:
             return ScGlobal::GetRscString(STR_COND_FORMULA);
+        case ICONSET:
+            return ScGlobal::GetRscString(STR_COND_ICONSET);
         default:
             break;
     }
@@ -105,6 +107,9 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm
             case condformat::COLORSCALE:
                 aBuffer.append(getTextForType(COLORSCALE));
                 break;
+            case condformat::ICONSET:
+                aBuffer.append(getTextForType(ICONSET));
+                break;
         }
     }
     return aBuffer.makeStringAndClear();
diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx
index 297d032..c674df4 100644
--- a/sc/source/ui/inc/condformathelper.hxx
+++ b/sc/source/ui/inc/condformathelper.hxx
@@ -18,6 +18,7 @@ enum ScCondFormatEntryType
     COLORSCALE,
     DATABAR,
     FORMULA,
+    ICONSET,
     COLLAPSED
 };
 
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index a58f5b6..5091477 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1875,6 +1875,10 @@ Resource RID_GLOBSTR
     {
         Text [ en-US ] = "DataBar";
     };
+    String STR_COND_ICONSET
+    {
+        Text [ en-US ] = "IconSet";
+    };
     String STR_COND_BETWEEN
     {
         Text [ en-US ] = "between";
commit ef4edac451093e0d281bcbc2dd43b262330ea43d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Oct 29 22:58:42 2012 +0100

    fix crash with overlapping conditional formats
    
    Change-Id: Ib2d3b9434038b25f2dc175809e211d7651998583

diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 15868ba..f665bea 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -535,6 +535,9 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
                                             itr != rCondFormats.end() && !bFound; ++itr)
                                     {
                                         ScConditionalFormat* pCondForm = pCondFormList->GetFormat(*itr);
+                                        if(!pCondForm)
+                                            continue;
+
                                         ScCondFormatData aData = pCondForm->GetData( pInfo->pCell,
                                                 ScAddress( nX, nCurRow, nTab ) );
                                         if (!aData.aStyleName.isEmpty())
commit 7f5aab85e3ce0320e449b17782f7cc284b48344e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Oct 29 02:13:28 2012 +0100

    implement basic support for icon sets
    
    already supports ooxml import
    
    Change-Id: I3e54aa1632a78f853bb13a3a4f76e9d66ea0b9ac

diff --git a/icon-themes/classic/classic_images.tar.gz b/icon-themes/classic/classic_images.tar.gz
index e9578d9..f013ecb 100644
Binary files a/icon-themes/classic/classic_images.tar.gz and b/icon-themes/classic/classic_images.tar.gz 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 0000000..f5390af
Binary files /dev/null and b/icon-themes/galaxy/sc/res/black_circle_1_4th.png 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 0000000..7fb7202
Binary files /dev/null and b/icon-themes/galaxy/sc/res/black_circle_3_4th.png 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 0000000..0b037e8
Binary files /dev/null and b/icon-themes/galaxy/sc/res/black_circle_empty.png 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 0000000..8bfc1fe
Binary files /dev/null and b/icon-themes/galaxy/sc/res/black_circle_full.png 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 0000000..1b1328c
Binary files /dev/null and b/icon-themes/galaxy/sc/res/black_circle_half.png differ
diff --git a/icon-themes/galaxy/sc/res/cancel.png b/icon-themes/galaxy/sc/res/cancel.png
new file mode 100644
index 0000000..ae3f7a6
Binary files /dev/null and b/icon-themes/galaxy/sc/res/cancel.png 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 0000000..1c0ba39
Binary files /dev/null and b/icon-themes/galaxy/sc/res/exclamation_mark.png 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 0000000..c407a3c
Binary files /dev/null and b/icon-themes/galaxy/sc/res/green_arrow_up.png 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 0000000..82f9b22
Binary files /dev/null and b/icon-themes/galaxy/sc/res/green_circle.png 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 0000000..3f02a7d
Binary files /dev/null and b/icon-themes/galaxy/sc/res/minus_black.png 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 0000000..7989707
Binary files /dev/null and b/icon-themes/galaxy/sc/res/red_arrow_down.png 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 0000000..8da3f79
Binary files /dev/null and b/icon-themes/galaxy/sc/res/red_circle.png differ
diff --git a/icon-themes/galaxy/sc/res/sign.png b/icon-themes/galaxy/sc/res/sign.png
new file mode 100644
index 0000000..58e4f2f
Binary files /dev/null and b/icon-themes/galaxy/sc/res/sign.png 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 0000000..569e1c6
Binary files /dev/null and b/icon-themes/galaxy/sc/res/triangle_down_red.png 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 0000000..216530a
Binary files /dev/null and b/icon-themes/galaxy/sc/res/triangle_up_green.png 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 0000000..2935587
Binary files /dev/null and b/icon-themes/galaxy/sc/res/yellow_arrow_down_right.png 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 0000000..f38d0d9
Binary files /dev/null and b/icon-themes/galaxy/sc/res/yellow_arrow_right.png 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 0000000..ea78f27
Binary files /dev/null and b/icon-themes/galaxy/sc/res/yellow_arrow_up_right.png 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 0000000..d39cc66
Binary files /dev/null and b/icon-themes/galaxy/sc/res/yellow_circle.png differ
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 2d3c64c..978f2fa 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 92f88f3..685fde1 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 b9b24c4..a18235b 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 838255e..bbed41f 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 1f6779f..4089bf9 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 773d60a..324bcf9 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 a7c681e..15868ba 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 91521c6..9dfe34e 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 f5ebd8c..1078dce 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 f469390..aa93f42 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 85f4da5..cef08e1 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 0000000..2173fd2
--- /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 0000000..4a7df5b
--- /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 24b4fca..81af7ba 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;
             }
commit 2b2c67c557d427d37a18a66f8acad6fdca726c6f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Oct 27 02:15:01 2012 +0200

    extract same code into shared method
    
    Change-Id: Ib8c141309227aa711944bed202258d131ed1367d

diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 75fc18a..f469390 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -141,50 +141,58 @@ void lclAppendProperty( ::std::vector< PropertyValue >& orProps, const OUString&
     orProps.back().Value <<= rValue;
 }
 
-} // namespace
+//------------------------------------------------------------------------------
 
-ColorScaleRule::ColorScaleRule( const CondFormat& rFormat ):
-    WorksheetHelper( rFormat ),
-    mnCfvo(0),
-    mnCol(0)
-{
-}
-
-void ColorScaleRule::importCfvo( const AttributeList& rAttribs )
+void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const AttributeList& rAttribs )
 {
-    if(mnCfvo >= maColorScaleRuleEntries.size())
-        maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry());
-
     rtl::OUString aType = rAttribs.getString( XML_type, rtl::OUString() );
 
     double nVal = rAttribs.getDouble( XML_val, 0.0 );
-    maColorScaleRuleEntries[mnCfvo].mnVal = nVal;
+    pEntry->mnVal = nVal;
     if (aType == "num")
     {
         // nothing to do
     }
     else if( aType == "min" )
     {
-        maColorScaleRuleEntries[mnCfvo].mbMin = true;
+        pEntry->mbMin = true;
     }
     else if( aType == "max" )
     {
-        maColorScaleRuleEntries[mnCfvo].mbMax = true;
+        pEntry->mbMax = true;
     }
     else if( aType == "percent" )
     {
-        maColorScaleRuleEntries[mnCfvo].mbPercent = true;
+        pEntry->mbPercent = true;
     }
     else if( aType == "percentile" )
     {
-        maColorScaleRuleEntries[mnCfvo].mbPercentile = true;
+        pEntry->mbPercentile = true;
     }
     else if( aType == "formula" )
     {
         rtl::OUString aFormula = rAttribs.getString( XML_val, rtl::OUString() );
-        maColorScaleRuleEntries[mnCfvo].maFormula = aFormula;
+        pEntry->maFormula = aFormula;
     }
 
+}
+
+}
+
+ColorScaleRule::ColorScaleRule( const CondFormat& rFormat ):
+    WorksheetHelper( rFormat ),
+    mnCfvo(0),
+    mnCol(0)
+{
+}
+
+void ColorScaleRule::importCfvo( const AttributeList& rAttribs )
+{
+    if(mnCfvo >= maColorScaleRuleEntries.size())
+        maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry());
+
+    SetCfvoData( &maColorScaleRuleEntries[mnCfvo], rAttribs );
+
     ++mnCfvo;
 }
 
@@ -260,7 +268,7 @@ void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* pDoc,
 }
 
 // ============================================================================
-//
+
 DataBarRule::DataBarRule( const CondFormat& rFormat ):
     WorksheetHelper( rFormat ),
     mpFormat(new ScDataBarFormatData)
@@ -297,35 +305,8 @@ void DataBarRule::importCfvo( const AttributeList& rAttribs )
         mpUpperLimit.reset(new ColorScaleRuleModelEntry);
         pEntry = mpUpperLimit.get();
     }
-    rtl::OUString aType = rAttribs.getString( XML_type, rtl::OUString() );
 
-    double nVal = rAttribs.getDouble( XML_val, 0.0 );
-    pEntry->mnVal = nVal;
-    if (aType == "num")
-    {
-        // nothing to do
-    }
-    else if( aType == "min" )
-    {
-        pEntry->mbMin = true;
-    }
-    else if( aType == "max" )
-    {
-        pEntry->mbMax = true;
-    }
-    else if( aType == "percent" )
-    {
-        pEntry->mbPercent = true;
-    }
-    else if( aType == "percentile" )
-    {
-        pEntry->mbPercentile = true;
-    }
-    else if( aType == "formula" )
-    {
-        rtl::OUString aFormula = rAttribs.getString( XML_val, rtl::OUString() );
-        pEntry->maFormula = aFormula;
-    }
+    SetCfvoData( pEntry, rAttribs );
 }
 
 void DataBarRule::importAttribs( const AttributeList& rAttribs )


More information about the Libreoffice-commits mailing list