diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-02 03:49:28 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-02 06:14:05 +0100 |
commit | 6efd796a303d631b263ad2177438248251c6d98e (patch) | |
tree | e320556f440445ba118cb2b0fba99f91a29f6a91 /sc | |
parent | 8c4719fd489ab70d5ae77e5f257254ef653a1f25 (diff) |
initial support for icon sets in the dialog
Change-Id: I5da2500b96ba3b03bf822cf428c001204010989e
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/colorscale.hxx | 2 | ||||
-rw-r--r-- | sc/inc/sc.hrc | 7 | ||||
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 129 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 91 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hrc | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlgentry.hxx | 38 | ||||
-rw-r--r-- | sc/source/ui/src/condformatdlg.src | 71 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 121 |
9 files changed, 351 insertions, 124 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 5907c6ee15e0..e7b611bcd7cb 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -44,6 +44,7 @@ class ScDocument; class ScFormulaCell; class ScTokenArray; struct ScDataBarInfo; +class BitmapEx; // don't change the order // they are also used in the dialog to determine the position @@ -335,6 +336,7 @@ public: virtual condformat::ScFormatEntryType GetType() const; static ScIconSetMap* getIconSetMap(); + static BitmapEx& getBitmap( ScIconSetType eType, sal_Int32 nIndex ); typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator; typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 1bb2b8c1b215..2a1113b583c8 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1094,11 +1094,12 @@ #define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155) #define RID_COND_ENTRY (SC_DIALOGS_START + 156) #define RID_SCDLG_FORMULA_CALCOPTIONS (SC_DIALOGS_START + 157) +#define RID_ICON_SET_ENTRY (SC_DIALOGS_START + 158) -#define RID_SCDLG_COND_FORMAT_MANAGER (SC_DIALOGS_START + 158) -#define RID_SCDLG_XML_SOURCE (SC_DIALOGS_START + 159) +#define RID_SCDLG_COND_FORMAT_MANAGER (SC_DIALOGS_START + 159) +#define RID_SCDLG_XML_SOURCE (SC_DIALOGS_START + 160) -#define SC_DIALOGS_END (SC_DIALOGS_START + 160) +#define SC_DIALOGS_END (SC_DIALOGS_START + 161) #ifndef STD_MASKCOLOR #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 897f1b84a0ef..2adf5071813a 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -30,6 +30,8 @@ #include "document.hxx" #include "cell.hxx" #include "fillinfo.hxx" +#include "iconsets.hrc" +#include "scresid.hxx" #if DUMP_FORMAT_INFO #include <iostream> #endif @@ -1047,4 +1049,131 @@ ScIconSetMap* ScIconSetFormat::getIconSetMap() return aIconSetMap; } +namespace { + +sal_Int32 a3TrafficLights1[] = { + BMP_ICON_SET_CIRCLES1_RED, BMP_ICON_SET_CIRCLES1_YELLOW, BMP_ICON_SET_CIRCLES1_GREEN +}; + +sal_Int32 a3TrafficLights2[] = { + BMP_ICON_SET_TRAFFICLIGHTS_RED, BMP_ICON_SET_TRAFFICLIGHTS_YELLOW, BMP_ICON_SET_TRAFFICLIGHTS_GREEN +}; + +sal_Int32 a3Arrows[] = { + BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SAME, BMP_ICON_SET_COLORARROWS_UP +}; + +sal_Int32 a3ArrowsGray[] = { + BMP_ICON_SET_GRAYARROWS_DOWN, BMP_ICON_SET_GRAYARROWS_SAME, BMP_ICON_SET_GRAYARROWS_UP +}; + +sal_Int32 a3Flags[] = { + BMP_ICON_SET_FLAGS_RED, BMP_ICON_SET_FLAGS_YELLOW, BMP_ICON_SET_FLAGS_GREEN +}; + +sal_Int32 a4Arrows[] = { + BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_UP, BMP_ICON_SET_COLORARROWS_UP +}; + +sal_Int32 a4ArrowsGray[] = { + BMP_ICON_SET_GRAYARROWS_DOWN, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_DOWN, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_UP, BMP_ICON_SET_GRAYARROWS_UP +}; + +sal_Int32 a5Arrows[] = { + BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_DOWN, + BMP_ICON_SET_COLORARROWS_SAME, BMP_ICON_SET_COLORARROWS_SLIGHTLY_UP, BMP_ICON_SET_COLORARROWS_UP +}; + +sal_Int32 a5ArrowsGray[] = { + BMP_ICON_SET_GRAYARROWS_DOWN, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_DOWN, + BMP_ICON_SET_GRAYARROWS_SAME, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_UP, BMP_ICON_SET_GRAYARROWS_UP +}; + +sal_Int32 a4TrafficLights[] = { + BMP_ICON_SET_CIRCLES1_GRAY, BMP_ICON_SET_CIRCLES1_RED, + BMP_ICON_SET_CIRCLES1_YELLOW, BMP_ICON_SET_CIRCLES1_GREEN +}; + +sal_Int32 a5Quarters[] = { + BMP_ICON_SET_PIES_EMPTY, BMP_ICON_SET_PIES_ONE_QUARTER, BMP_ICON_SET_PIES_HALF, + BMP_ICON_SET_PIES_THREE_QUARTER, BMP_ICON_SET_PIES_FULL, +}; + +sal_Int32 a3Symbols1[] = { + BMP_ICON_SET_SYMBOLS1_CHECK, BMP_ICON_SET_SYMBOLS1_EXCLAMATION_MARK, BMP_ICON_SET_SYMBOLS1_CROSS +}; + +sal_Int32 a3Signs[] = { + BMP_ICON_SET_SHAPES_DIAMOND, BMP_ICON_SET_SHAPES_TRIANGLE, BMP_ICON_SET_SHAPES_CIRCLE +}; + +sal_Int32 a4RedToBlack[] = { + BMP_ICON_SET_CIRCLES2_DARK_GRAY, BMP_ICON_SET_CIRCLES2_LIGHT_GRAY, + BMP_ICON_SET_CIRCLES2_LIGHT_RED, BMP_ICON_SET_CIRCLES2_DARK_RED +}; + +sal_Int32 a4Ratings[] = { + BMP_ICON_SET_BARS_ONE_QUARTER, BMP_ICON_SET_BARS_HALF, + BMP_ICON_SET_BARS_THREE_QUARTER, BMP_ICON_SET_BARS_FULL +}; + +sal_Int32 a5Ratings[] = { + BMP_ICON_SET_BARS_EMPTY, BMP_ICON_SET_BARS_ONE_QUARTER, BMP_ICON_SET_BARS_HALF, + BMP_ICON_SET_BARS_THREE_QUARTER, BMP_ICON_SET_BARS_FULL +}; + +struct ScIconSetBitmapMap { + ScIconSetType eType; + sal_Int32* nBitmaps; +}; + +static ScIconSetBitmapMap aBitmapMap[] = { + { IconSet_3Arrows, a3Arrows }, + { IconSet_3ArrowsGray, a3ArrowsGray }, + { IconSet_3Flags, a3Flags }, + { IconSet_3Signs, a3Signs }, + { IconSet_3Symbols, a3Symbols1 }, + { IconSet_3Symbols2, a3Symbols1 }, + { IconSet_3TrafficLights1, a3TrafficLights1 }, + { IconSet_3TrafficLights2, a3TrafficLights2 }, + { IconSet_4Arrows, a4Arrows }, + { IconSet_4ArrowsGray, a4ArrowsGray }, + { IconSet_4Rating, a4Ratings }, + { IconSet_4RedToBlack, a4RedToBlack }, + { IconSet_4TrafficLights, a4TrafficLights }, + { IconSet_5Arrows, a5Arrows }, + { IconSet_5ArrowsGray, a5ArrowsGray }, + { IconSet_5Quarters, a5Quarters }, + { IconSet_5Ratings, a5Ratings } +}; + +} + +BitmapEx& ScIconSetFormat::getBitmap( ScIconSetType eType, sal_Int32 nIndex ) +{ + static std::map< sal_Int32, BitmapEx > aIconSetBitmaps; + + 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; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 5212f6259ff4..8780647c9c6b 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -90,6 +90,7 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) ); break; case condformat::ICONSET: + maEntries.push_back(new ScIconSetFrmtEntry( this, mpDoc, maPos, static_cast<const ScIconSetFormat*>( pEntry ) ) ); break; case condformat::DATE: maEntries.push_back(new ScDateFrmtEntry( this, mpDoc, static_cast<const ScCondDateFormatEntry*>( pEntry ) ) ); @@ -224,6 +225,12 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox) maEntries.replace( itr, new ScDataBarFrmtEntry( this, mpDoc, maPos ) ); break; + case 3: + if(itr->GetType() == condformat::entry::ICONSET) + return 0; + + maEntries.replace( itr, new ScIconSetFrmtEntry( this, mpDoc, maPos ) ); + break; default: break; } @@ -257,6 +264,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox) case condformat::entry::COLORSCALE2: case condformat::entry::COLORSCALE3: case condformat::entry::DATABAR: + case condformat::entry::ICONSET: return 0; } maEntries.replace( itr, new ScColorScale3FrmtEntry(this, mpDoc, maPos)); @@ -287,6 +295,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox) static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); itr->SetActive(); break; + } RecalcAll(); return 0; diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 59cfb9243df6..b03949361bb2 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -1224,4 +1224,95 @@ IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl ) return 0; } +ScIconSetFrmtEntry::ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, sal_Int32 i ): + Control( pParent, ScResId( RID_ICON_SET_ENTRY ) ), + maImgIcon( this, ScResId( IMG_ICON ) ), + maFtEntry( this, ScResId( FT_ICON_SET_ENTRY_TEXT ) ), + maEdEntry( this, ScResId( ED_ICON_SET_ENTRY_VALUE ) ), + maLbEntryType( this, ScResId( LB_ICON_SET_ENTRY_TYPE ) ) +{ + maImgIcon.SetImage(ScIconSetFormat::getBitmap( eType, i )); + FreeResource(); +} + +ScIconSetFrmtEntry::ScIconSetFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat ): + ScCondFrmtEntry( pParent, pDoc, rPos ), + maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ), + maLbIconSetType( this, ScResId( LB_ICONSET_TYPE ) ) +{ + Init(); + FreeResource(); + + if(pFormat) + { + + } + + IconSetTypeHdl(NULL); +} + +void ScIconSetFrmtEntry::Init() +{ + maLbColorFormat.SelectEntryPos(3); + maLbType.SelectEntryPos(0); + maLbIconSetType.SelectEntryPos(0); + + maLbIconSetType.SetSelectHdl( LINK( this, ScIconSetFrmtEntry, IconSetTypeHdl ) ); +} + +IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl ) +{ + ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap(); + + sal_Int32 nPos = maLbIconSetType.GetSelectEntryPos(); + sal_uInt32 nElements = pMap[nPos].nElements; + maEntries.clear(); + + for(size_t i = 0; i < nElements; ++i) + { + maEntries.push_back( new ScIconSetFrmtDataEntry( this, static_cast<ScIconSetType>(nPos), i ) ); + Point aPos = maEntries[0].GetPosPixel(); + aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2; + maEntries[i].SetPosPixel( aPos ); + } + + return 0; +} + +OUString ScIconSetFrmtEntry::GetExpressionString() +{ + return OUString(""); +} + +void ScIconSetFrmtEntry::SetActive() +{ + maLbColorFormat.Show(); + maLbIconSetType.Show(); + for(ScIconSetFrmtDateEntriesType::iterator itr = maEntries.begin(), + itrEnd = maEntries.end(); itr != itrEnd; ++itr) + { + maEntries[0].Show(); + } + + Select(); +} + +void ScIconSetFrmtEntry::SetInactive() +{ + maLbColorFormat.Hide(); + maLbIconSetType.Hide(); + for(ScIconSetFrmtDateEntriesType::iterator itr = maEntries.begin(), + itrEnd = maEntries.end(); itr != itrEnd; ++itr) + { + maEntries[0].Hide(); + } + + Deselect(); +} + +ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const +{ + return NULL; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/condformatdlg.hrc b/sc/source/ui/inc/condformatdlg.hrc index b1ede3cdae66..607404e78d48 100644 --- a/sc/source/ui/inc/condformatdlg.hrc +++ b/sc/source/ui/inc/condformatdlg.hrc @@ -69,4 +69,11 @@ #define LB_TYPE_COL_SCALE_MAX 44 #define LB_DATE_TYPE 45 + +#define IMG_ICON 46 +#define LB_ICONSET_TYPE 47 +#define LB_ICON_SET_ENTRY_TYPE 48 +#define FT_ICON_SET_ENTRY_TEXT 49 +#define ED_ICON_SET_ENTRY_VALUE 50 + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index b842ed26df39..9ef6184a8d8f 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -22,6 +22,7 @@ enum ScCondFrmtEntryType COLORSCALE2, COLORSCALE3, DATABAR, + ICONSET, DATE }; @@ -239,4 +240,41 @@ private: SvxFontPrevWindow maWdPreview; }; +class ScIconSetFrmtEntry : public ScCondFrmtEntry +{ + //color format ui elements + ListBox maLbColorFormat; + + // icon set ui elements + ListBox maLbIconSetType; + + class ScIconSetFrmtDataEntry : public Control + { + private: + FixedImage maImgIcon; + FixedText maFtEntry; + Edit maEdEntry; + ListBox maLbEntryType; + + public: + ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, sal_Int32 i ); + }; + typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDateEntriesType; + ScIconSetFrmtDateEntriesType maEntries; + + ScFormatEntry* createIconSetEntry(); + virtual rtl::OUString GetExpressionString(); + + void Init(); + + DECL_LINK( IconSetTypeHdl, void* ); + +public: + ScIconSetFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat = NULL ); + virtual ScFormatEntry* GetEntry() const; + virtual void SetActive(); + virtual void SetInactive(); + virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::ICONSET; } +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src index ab988665a353..e0a5f25905ed 100644 --- a/sc/source/ui/src/condformatdlg.src +++ b/sc/source/ui/src/condformatdlg.src @@ -177,14 +177,16 @@ Control RID_COND_ENTRY ListBox LB_COLOR_FORMAT { Pos = MAP_APPFONT( 100, 15 ); - Size = MAP_APPFONT( 100, 60); + Size = MAP_APPFONT( 80, 60); Border = TRUE; DropDown = TRUE; + DDExtraWidth = TRUE; StringList [ en-US ] = { "Color Scale (2 Entries)"; "Color Scale (3 Entries)"; "Data Bar"; + "Icon Set"; }; }; FixedText FT_STYLE @@ -334,6 +336,73 @@ Control RID_COND_ENTRY "Next year"; }; }; + ListBox LB_ICONSET_TYPE + { + Pos = MAP_APPFONT( 200, 15 ); + Size = MAP_APPFONT( 80, 50 ); + Border = TRUE; + DropDown = TRUE; + DDExtraWidth = TRUE; + StringList [ en-US ] = + { + "3 Arrows"; + "3 Gray Arrows"; + "3 Flags"; + "3 Traffic Lights 1"; + "3 Traffic Lights 2"; + "3 Signs"; + "3 Symbols 1"; + "3 Symbols 2"; + "4 Arrows"; + "4 Gray Arrows"; + "4 Circles Red to Black"; + "4 Ratings"; + "4 Traffic Lights"; + "5 Arrows"; + "5 Gray Arrows"; + "5 Ratings"; + "5 Quarters"; + }; + }; +}; + +Control RID_ICON_SET_ENTRY +{ + Pos = MAP_APPFONT( 0, 35 ); + Size = MAP_APPFONT(300, 16); + // Picture of the Icon + FixedImage IMG_ICON + { + Pos = MAP_APPFONT( 5, 0 ); + Size = MAP_APPFONT( 16, 16 ); + }; + FixedText FT_ICON_SET_ENTRY_TEXT + { + Pos = MAP_APPFONT( 40, 0 ); + Size = MAP_APPFONT(40, 14); + Text [en-US] = " <= "; + }; + Edit ED_ICON_SET_ENTRY_VALUE + { + Pos = MAP_APPFONT( 90, 0 ); + Size = MAP_APPFONT( 40, 14 ); + Border = TRUE; + }; + ListBox LB_ICON_SET_ENTRY_TYPE + { + Pos = MAP_APPFONT( 140, 0 ); + Size = MAP_APPFONT( 60, 40 ); + Border = TRUE; + DropDown = TRUE; + DDExtraWidth = TRUE; + StringList [ en-US ] = + { + "Value"; + "Percent"; + "Percentile"; + "Formula"; + }; + }; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 16e253f56abb..fd897f13626f 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -72,7 +72,6 @@ #include "postit.hxx" #include "scresid.hxx" -#include "iconsets.hrc" #include "colorscale.hxx" #include <math.h> @@ -93,103 +92,6 @@ static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = { COL_GREEN, COL_RED, COL_BLUE, COL_BROWN, COL_MAGENTA, COL_CYAN }; -sal_Int32 a3TrafficLights1[] = { - BMP_ICON_SET_CIRCLES1_RED, BMP_ICON_SET_CIRCLES1_YELLOW, BMP_ICON_SET_CIRCLES1_GREEN -}; - -sal_Int32 a3TrafficLights2[] = { - BMP_ICON_SET_TRAFFICLIGHTS_RED, BMP_ICON_SET_TRAFFICLIGHTS_YELLOW, BMP_ICON_SET_TRAFFICLIGHTS_GREEN -}; - -sal_Int32 a3Arrows[] = { - BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SAME, BMP_ICON_SET_COLORARROWS_UP -}; - -sal_Int32 a3ArrowsGray[] = { - BMP_ICON_SET_GRAYARROWS_DOWN, BMP_ICON_SET_GRAYARROWS_SAME, BMP_ICON_SET_GRAYARROWS_UP -}; - -sal_Int32 a3Flags[] = { - BMP_ICON_SET_FLAGS_RED, BMP_ICON_SET_FLAGS_YELLOW, BMP_ICON_SET_FLAGS_GREEN -}; - -sal_Int32 a4Arrows[] = { - BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_UP, BMP_ICON_SET_COLORARROWS_UP -}; - -sal_Int32 a4ArrowsGray[] = { - BMP_ICON_SET_GRAYARROWS_DOWN, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_DOWN, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_UP, BMP_ICON_SET_GRAYARROWS_UP -}; - -sal_Int32 a5Arrows[] = { - BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_DOWN, - BMP_ICON_SET_COLORARROWS_SAME, BMP_ICON_SET_COLORARROWS_SLIGHTLY_UP, BMP_ICON_SET_COLORARROWS_UP -}; - -sal_Int32 a5ArrowsGray[] = { - BMP_ICON_SET_GRAYARROWS_DOWN, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_DOWN, - BMP_ICON_SET_GRAYARROWS_SAME, BMP_ICON_SET_GRAYARROWS_SLIGHTLY_UP, BMP_ICON_SET_GRAYARROWS_UP -}; - -sal_Int32 a4TrafficLights[] = { - BMP_ICON_SET_CIRCLES1_GRAY, BMP_ICON_SET_CIRCLES1_RED, - BMP_ICON_SET_CIRCLES1_YELLOW, BMP_ICON_SET_CIRCLES1_GREEN -}; - -sal_Int32 a5Quarters[] = { - BMP_ICON_SET_PIES_EMPTY, BMP_ICON_SET_PIES_ONE_QUARTER, BMP_ICON_SET_PIES_HALF, - BMP_ICON_SET_PIES_THREE_QUARTER, BMP_ICON_SET_PIES_FULL, -}; - -sal_Int32 a3Symbols1[] = { - BMP_ICON_SET_SYMBOLS1_CHECK, BMP_ICON_SET_SYMBOLS1_EXCLAMATION_MARK, BMP_ICON_SET_SYMBOLS1_CROSS -}; - -sal_Int32 a3Signs[] = { - BMP_ICON_SET_SHAPES_DIAMOND, BMP_ICON_SET_SHAPES_TRIANGLE, BMP_ICON_SET_SHAPES_CIRCLE -}; - -sal_Int32 a4RedToBlack[] = { - BMP_ICON_SET_CIRCLES2_DARK_GRAY, BMP_ICON_SET_CIRCLES2_LIGHT_GRAY, - BMP_ICON_SET_CIRCLES2_LIGHT_RED, BMP_ICON_SET_CIRCLES2_DARK_RED -}; - -sal_Int32 a4Ratings[] = { - BMP_ICON_SET_BARS_ONE_QUARTER, BMP_ICON_SET_BARS_HALF, - BMP_ICON_SET_BARS_THREE_QUARTER, BMP_ICON_SET_BARS_FULL -}; - -sal_Int32 a5Ratings[] = { - BMP_ICON_SET_BARS_EMPTY, BMP_ICON_SET_BARS_ONE_QUARTER, BMP_ICON_SET_BARS_HALF, - BMP_ICON_SET_BARS_THREE_QUARTER, BMP_ICON_SET_BARS_FULL -}; - -struct ScIconSetBitmapMap { - ScIconSetType eType; - sal_Int32* nBitmaps; -}; - -static ScIconSetBitmapMap aBitmapMap[] = { - { IconSet_3Arrows, a3Arrows }, - { IconSet_3ArrowsGray, a3ArrowsGray }, - { IconSet_3Flags, a3Flags }, - { IconSet_3Signs, a3Signs }, - { IconSet_3Symbols, a3Symbols1 }, - { IconSet_3Symbols2, a3Symbols1 }, - { IconSet_3TrafficLights1, a3TrafficLights1 }, - { IconSet_3TrafficLights2, a3TrafficLights2 }, - { IconSet_4Arrows, a4Arrows }, - { IconSet_4ArrowsGray, a4ArrowsGray }, - { IconSet_4Rating, a4Ratings }, - { IconSet_4RedToBlack, a4RedToBlack }, - { IconSet_4TrafficLights, a4TrafficLights }, - { IconSet_5Arrows, a5Arrows }, - { IconSet_5ArrowsGray, a5ArrowsGray }, - { IconSet_5Quarters, a5Quarters }, - { IconSet_5Ratings, a5Ratings } -}; - -static std::map< sal_Int32, BitmapEx > aIconSetBitmaps; // Hilfsklasse, fuer die Farbzuordnung, // um nicht mehrfach hintereinander denselben User aus der Liste zu suchen @@ -984,28 +886,7 @@ 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; + return ScIconSetFormat::getBitmap( eType, nIndex ); } void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, OutputDevice* pDev, const Rectangle& rRect ) |