summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-06-12 07:48:41 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-06-12 08:32:25 +0200
commit56de6cce83701f003416ad91b28c0dbca3a3d67e (patch)
treedbad79eccbb96774e66dd729c4d8b4640df93be1
parent16738213c400f9192abc2ff6c08d7f711dee8d34 (diff)
small improvements to data bar dialog
Change-Id: I7eada5e24047d36c1625aa082ecc9e5d52f785ae
-rw-r--r--sc/inc/colorscale.hxx2
-rw-r--r--sc/source/core/data/colorscale.cxx9
-rw-r--r--sc/source/ui/condformat/colorformat.cxx54
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx36
-rw-r--r--sc/source/ui/inc/colorformat.hrc2
-rw-r--r--sc/source/ui/inc/colorformat.hxx3
-rw-r--r--sc/source/ui/src/colorformat.src6
7 files changed, 106 insertions, 6 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 8e9c3773b253..72349dc95b34 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -80,6 +80,8 @@ public:
void SetMax(bool bMax);
void SetPercent(bool bPercent);
void SetPercentile(bool bPercentile);
+
+ void SetHasValue();
};
namespace databar
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index e6a5c8ddefa5..c6773975060e 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -242,6 +242,15 @@ void ScColorScaleEntry::SetPercentile(bool bPercentile)
mbPercentile = bPercentile;
}
+void ScColorScaleEntry::SetHasValue()
+{
+ mbPercentile = false;
+ mbPercent = false;
+ mbMin = false;
+ mbMax = false;
+ mpCell.reset();
+}
+
namespace {
double getMinValue(const ScRange& rRange, ScDocument* pDoc)
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx
index de45815416b1..24833649882b 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -105,12 +105,12 @@ void GetType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry
pEntry->SetValue(nVal);
break;
case 4:
- //FIXME
- break;
- case 5:
nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ',');
+ pEntry->SetHasValue();
pEntry->SetValue(nVal);
break;
+ case 5:
+ break;
}
}
@@ -146,7 +146,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarForma
maLbTypeMax( this, ScResId( LB_TYPE ) ),
maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ),
maEdMin( this, ScResId( ED_MIN ) ),
- maEdMax( this, ScResId( ED_MAX ) )
+ maEdMax( this, ScResId( ED_MAX ) ),
+ maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) )
{
Init();
FreeResource();
@@ -171,6 +172,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarForma
::SetType(rData.mpUpperLimit.get(), maLbTypeMax);
SetValue(rData.mpLowerLimit.get(), maEdMin);
SetValue(rData.mpUpperLimit.get(), maEdMax);
+
+ TypeSelectHdl(NULL);
}
ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDataBarFormat* pFormat):
@@ -193,7 +196,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDataBarFormat* pFo
maLbTypeMax( this, ScResId( LB_TYPE ) ),
maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ),
maEdMin( this, ScResId( ED_MIN ) ),
- maEdMax( this, ScResId( ED_MAX ) )
+ maEdMax( this, ScResId( ED_MAX ) ),
+ maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) )
{
Init();
FreeResource();
@@ -265,6 +269,10 @@ void ScDataBarSettingsDlg::Init()
Point aPoint = maLbTypeMax.GetPosPixel();
aPoint.Y() += 50;
maLbTypeMax.SetPosPixel(aPoint);
+
+ maLbTypeMin.SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
+ maLbTypeMax.SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
+
}
namespace {
@@ -329,6 +337,8 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
if(bWarn)
{
//show warning message and don't close
+ WarningBox aWarn(this, WB_OK, maStrWarnSameValue );
+ aWarn.Execute();
}
else
{
@@ -337,4 +347,38 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
return 0;
}
+IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl )
+{
+ sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos();
+ if( nSelectMin == 0 || nSelectMin == 1)
+ maEdMin.Disable();
+ else
+ {
+ maEdMin.Enable();
+ if(!maEdMin.GetText().Len())
+ {
+ if(nSelectMin == 2 || nSelectMin == 3)
+ maEdMin.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(50)));
+ else
+ maEdMin.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(0)));
+ }
+ }
+
+ sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos();
+ if(nSelectMax == 0 || nSelectMax == 1)
+ maEdMax.Disable();
+ else
+ {
+ maEdMax.Enable();
+ if(!maEdMax.GetText().Len())
+ {
+ if(nSelectMax == 2 || nSelectMax == 3)
+ maEdMax.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(50)));
+ else
+ maEdMax.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(0)));
+ }
+ }
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 54d5ba14dcff..81a681bdd020 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -685,6 +685,7 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const
break;
case 3:
pEntry->SetValue(nVal);
+ pEntry->SetHasValue();
break;
case 4:
pEntry->SetPercent(true);
@@ -693,6 +694,8 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const
case 5:
pEntry->SetFormula(rValue.GetText(), pDoc, rPos);
break;
+ default:
+ break;
}
}
@@ -706,6 +709,36 @@ ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListB
return pEntry;
}
+void GetDataBarType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry )
+{
+ double nVal = 0;
+ switch(rLstBox.GetSelectEntryPos())
+ {
+ case 0:
+ pEntry->SetMin(true);
+ break;
+ case 1:
+ pEntry->SetMax(true);
+ break;
+ case 2:
+ pEntry->SetPercentile(true);
+ nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ',');
+ pEntry->SetValue(nVal);
+ break;
+ case 3:
+ nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ',');
+ pEntry->SetPercent(true);
+ pEntry->SetValue(nVal);
+ break;
+ case 4:
+ nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ',');
+ pEntry->SetValue(nVal);
+ break;
+ case 5:
+ break;
+ }
+}
+
}
ScFormatEntry* ScCondFrmtEntry::createColorscaleEntry() const
@@ -720,6 +753,8 @@ ScFormatEntry* ScCondFrmtEntry::createColorscaleEntry() const
ScFormatEntry* ScCondFrmtEntry::createDatabarEntry() const
{
+ SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos);
+ SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos);
ScDataBarFormat* pDataBar = new ScDataBarFormat(mpDoc);
pDataBar->SetDataBarData(new ScDataBarFormatData(*mpDataBarData.get()));
return pDataBar;
@@ -862,6 +897,7 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, OptionBtnHdl )
mpDataBarData.reset(pDlg->GetData());
SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin);
SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax);
+ DataBarTypeSelectHdl(NULL);
}
return 0;
}
diff --git a/sc/source/ui/inc/colorformat.hrc b/sc/source/ui/inc/colorformat.hrc
index fc27609cc678..140cd1604a66 100644
--- a/sc/source/ui/inc/colorformat.hrc
+++ b/sc/source/ui/inc/colorformat.hrc
@@ -50,4 +50,6 @@
#define ED_MIN 24
#define ED_MAX 25
+#define STR_WARN_SAME_VALUE 26
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx
index 4fe44f9ba470..c85eec580e9e 100644
--- a/sc/source/ui/inc/colorformat.hxx
+++ b/sc/source/ui/inc/colorformat.hxx
@@ -62,7 +62,10 @@ private:
Edit maEdMin;
Edit maEdMax;
+ rtl::OUString maStrWarnSameValue;
+
DECL_LINK(OkBtnHdl, void*);
+ DECL_LINK(TypeSelectHdl, void*);
void Init();
diff --git a/sc/source/ui/src/colorformat.src b/sc/source/ui/src/colorformat.src
index 18cd823a7df0..66ae20eb5d2d 100644
--- a/sc/source/ui/src/colorformat.src
+++ b/sc/source/ui/src/colorformat.src
@@ -136,8 +136,8 @@ ModalDialog RID_SCDLG_DATABAR
{
"Minimum";
"Maximum";
- "Percent";
"Percentile";
+ "Percent";
"Value";
"Formula";
};
@@ -169,6 +169,10 @@ ModalDialog RID_SCDLG_DATABAR
TabStop = TRUE;
Border = TRUE;
};
+ String STR_WARN_SAME_VALUE
+ {
+ Text [ en-US ] = "Min value must be smaller than max value!";
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */