Kaydet (Commit) 6efd796a authored tarafından Markus Mohrhard's avatar Markus Mohrhard

initial support for icon sets in the dialog

Change-Id: I5da2500b96ba3b03bf822cf428c001204010989e
üst 8c4719fd
...@@ -44,6 +44,7 @@ class ScDocument; ...@@ -44,6 +44,7 @@ class ScDocument;
class ScFormulaCell; class ScFormulaCell;
class ScTokenArray; class ScTokenArray;
struct ScDataBarInfo; struct ScDataBarInfo;
class BitmapEx;
// don't change the order // don't change the order
// they are also used in the dialog to determine the position // they are also used in the dialog to determine the position
...@@ -335,6 +336,7 @@ public: ...@@ -335,6 +336,7 @@ public:
virtual condformat::ScFormatEntryType GetType() const; virtual condformat::ScFormatEntryType GetType() const;
static ScIconSetMap* getIconSetMap(); static ScIconSetMap* getIconSetMap();
static BitmapEx& getBitmap( ScIconSetType eType, sal_Int32 nIndex );
typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator; typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator;
typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator; typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator;
......
...@@ -1094,11 +1094,12 @@ ...@@ -1094,11 +1094,12 @@
#define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155) #define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155)
#define RID_COND_ENTRY (SC_DIALOGS_START + 156) #define RID_COND_ENTRY (SC_DIALOGS_START + 156)
#define RID_SCDLG_FORMULA_CALCOPTIONS (SC_DIALOGS_START + 157) #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_COND_FORMAT_MANAGER (SC_DIALOGS_START + 159)
#define RID_SCDLG_XML_SOURCE (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 #ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "document.hxx" #include "document.hxx"
#include "cell.hxx" #include "cell.hxx"
#include "fillinfo.hxx" #include "fillinfo.hxx"
#include "iconsets.hrc"
#include "scresid.hxx"
#if DUMP_FORMAT_INFO #if DUMP_FORMAT_INFO
#include <iostream> #include <iostream>
#endif #endif
...@@ -1047,4 +1049,131 @@ ScIconSetMap* ScIconSetFormat::getIconSetMap() ...@@ -1047,4 +1049,131 @@ ScIconSetMap* ScIconSetFormat::getIconSetMap()
return aIconSetMap; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -90,6 +90,7 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum ...@@ -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 ) ) ); maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) );
break; break;
case condformat::ICONSET: case condformat::ICONSET:
maEntries.push_back(new ScIconSetFrmtEntry( this, mpDoc, maPos, static_cast<const ScIconSetFormat*>( pEntry ) ) );
break; break;
case condformat::DATE: case condformat::DATE:
maEntries.push_back(new ScDateFrmtEntry( this, mpDoc, static_cast<const ScCondDateFormatEntry*>( pEntry ) ) ); maEntries.push_back(new ScDateFrmtEntry( this, mpDoc, static_cast<const ScCondDateFormatEntry*>( pEntry ) ) );
...@@ -224,6 +225,12 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox) ...@@ -224,6 +225,12 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox)
maEntries.replace( itr, new ScDataBarFrmtEntry( this, mpDoc, maPos ) ); maEntries.replace( itr, new ScDataBarFrmtEntry( this, mpDoc, maPos ) );
break; break;
case 3:
if(itr->GetType() == condformat::entry::ICONSET)
return 0;
maEntries.replace( itr, new ScIconSetFrmtEntry( this, mpDoc, maPos ) );
break;
default: default:
break; break;
} }
...@@ -257,6 +264,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox) ...@@ -257,6 +264,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox)
case condformat::entry::COLORSCALE2: case condformat::entry::COLORSCALE2:
case condformat::entry::COLORSCALE3: case condformat::entry::COLORSCALE3:
case condformat::entry::DATABAR: case condformat::entry::DATABAR:
case condformat::entry::ICONSET:
return 0; return 0;
} }
maEntries.replace( itr, new ScColorScale3FrmtEntry(this, mpDoc, maPos)); maEntries.replace( itr, new ScColorScale3FrmtEntry(this, mpDoc, maPos));
...@@ -287,6 +295,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox) ...@@ -287,6 +295,7 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox)
static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData();
itr->SetActive(); itr->SetActive();
break; break;
} }
RecalcAll(); RecalcAll();
return 0; return 0;
......
...@@ -1224,4 +1224,95 @@ IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl ) ...@@ -1224,4 +1224,95 @@ IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl )
return 0; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -69,4 +69,11 @@ ...@@ -69,4 +69,11 @@
#define LB_TYPE_COL_SCALE_MAX 44 #define LB_TYPE_COL_SCALE_MAX 44
#define LB_DATE_TYPE 45 #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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -22,6 +22,7 @@ enum ScCondFrmtEntryType ...@@ -22,6 +22,7 @@ enum ScCondFrmtEntryType
COLORSCALE2, COLORSCALE2,
COLORSCALE3, COLORSCALE3,
DATABAR, DATABAR,
ICONSET,
DATE DATE
}; };
...@@ -239,4 +240,41 @@ private: ...@@ -239,4 +240,41 @@ private:
SvxFontPrevWindow maWdPreview; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -177,14 +177,16 @@ Control RID_COND_ENTRY ...@@ -177,14 +177,16 @@ Control RID_COND_ENTRY
ListBox LB_COLOR_FORMAT ListBox LB_COLOR_FORMAT
{ {
Pos = MAP_APPFONT( 100, 15 ); Pos = MAP_APPFONT( 100, 15 );
Size = MAP_APPFONT( 100, 60); Size = MAP_APPFONT( 80, 60);
Border = TRUE; Border = TRUE;
DropDown = TRUE; DropDown = TRUE;
DDExtraWidth = TRUE;
StringList [ en-US ] = StringList [ en-US ] =
{ {
"Color Scale (2 Entries)"; "Color Scale (2 Entries)";
"Color Scale (3 Entries)"; "Color Scale (3 Entries)";
"Data Bar"; "Data Bar";
"Icon Set";
}; };
}; };
FixedText FT_STYLE FixedText FT_STYLE
...@@ -334,6 +336,73 @@ Control RID_COND_ENTRY ...@@ -334,6 +336,73 @@ Control RID_COND_ENTRY
"Next year"; "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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
#include "postit.hxx" #include "postit.hxx"
#include "scresid.hxx" #include "scresid.hxx"
#include "iconsets.hrc"
#include "colorscale.hxx" #include "colorscale.hxx"
#include <math.h> #include <math.h>
...@@ -93,103 +92,6 @@ static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = { ...@@ -93,103 +92,6 @@ static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = {
COL_GREEN, COL_RED, COL_BLUE, COL_GREEN, COL_RED, COL_BLUE,
COL_BROWN, COL_MAGENTA, COL_CYAN }; 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, // Hilfsklasse, fuer die Farbzuordnung,
// um nicht mehrfach hintereinander denselben User aus der Liste zu suchen // um nicht mehrfach hintereinander denselben User aus der Liste zu suchen
...@@ -984,28 +886,7 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con ...@@ -984,28 +886,7 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex ) BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex )
{ {
sal_Int32 nBitmap = -1; return ScIconSetFormat::getBitmap( eType, nIndex );
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 ) void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, OutputDevice* pDev, const Rectangle& rRect )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment