summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-12-02 05:57:33 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-12-02 06:14:05 +0100
commit704fdf2b23d0e0480f29e0e56f631c2835eed02b (patch)
tree4619a18f8172c4af9431b9117c47b2cc13e7ebbf /sc
parentf7cd8c619ef3db4b3a41b25eb9c4e5e798f2c155 (diff)
create icon sets in UI
Change-Id: I6c55cc1d1a1dbd4839b823df08f8c42a7b880132
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/condformat/condformatdlgentry.cxx49
-rw-r--r--sc/source/ui/inc/condformatdlgentry.hxx2
2 files changed, 49 insertions, 2 deletions
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 3d419710b203..86dec0d04cf7 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1259,6 +1259,40 @@ ScIconSetFrmtEntry::ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( Window* pPar
FreeResource();
}
+ScColorScaleEntry* ScIconSetFrmtEntry::ScIconSetFrmtDataEntry::CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const
+{
+ sal_Int32 nPos = maLbEntryType.GetSelectEntryPos();
+ rtl::OUString aText = maEdEntry.GetText();
+ ScColorScaleEntry* pEntry = new ScColorScaleEntry();
+
+ sal_uInt32 nIndex = 0;
+ double nVal = 0;
+ SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
+ pNumberFormatter->IsNumberFormat(aText, nIndex, nVal);
+ pEntry->SetValue(nVal);
+
+ switch(nPos)
+ {
+ case 0:
+ pEntry->SetType(COLORSCALE_VALUE);
+ break;
+ case 1:
+ pEntry->SetType(COLORSCALE_PERCENT);
+ break;
+ case 2:
+ pEntry->SetType(COLORSCALE_PERCENTILE);
+ break;
+ case 3:
+ pEntry->SetType(COLORSCALE_FORMULA);
+ pEntry->SetFormula(aText, pDoc, rPos, pDoc->GetGrammar());
+ break;
+ default:
+ assert(false);
+ }
+
+ return pEntry;
+}
+
ScIconSetFrmtEntry::ScIconSetFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScIconSetFormat* pFormat ):
ScCondFrmtEntry( pParent, pDoc, rPos ),
maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ),
@@ -1317,7 +1351,7 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl )
OUString ScIconSetFrmtEntry::GetExpressionString()
{
- return OUString("");
+ return ScCondFormatHelper::GetExpression(ICONSET, 0);
}
void ScIconSetFrmtEntry::SetActive()
@@ -1348,7 +1382,18 @@ void ScIconSetFrmtEntry::SetInactive()
ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const
{
- return NULL;
+ ScIconSetFormat* pFormat = new ScIconSetFormat(mpDoc);
+
+ ScIconSetFormatData* pData = new ScIconSetFormatData;
+ pData->eIconSetType = static_cast<ScIconSetType>(maLbIconSetType.GetSelectEntryPos());
+ for(ScIconSetFrmtDateEntriesType::const_iterator itr = maEntries.begin(),
+ itrEnd = maEntries.end(); itr != itrEnd; ++itr)
+ {
+ pData->maEntries.push_back(itr->CreateEntry(mpDoc, maPos));
+ }
+ pFormat->SetIconSetData(pData);
+
+ return pFormat;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx
index 7017cd9bf926..99d602c57e35 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -258,6 +258,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry
public:
ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, sal_Int32 i, const ScColorScaleEntry* pEntry = NULL );
+
+ ScColorScaleEntry* CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const;
};
typedef boost::ptr_vector<ScIconSetFrmtDataEntry> ScIconSetFrmtDateEntriesType;
ScIconSetFrmtDateEntriesType maEntries;