summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-06-03 04:07:14 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-06-11 08:01:23 +0200
commitebed24b181f31f37c4dd782fdd6bd1c2adc0885a (patch)
treea7a7cf52458b68b539c3cfffddcb05de2d44e2c1 /sc
parent81f85209212e18b589bce5551cbae645c2cb59c6 (diff)
solve more dependencies between ui elements in cond format dialog
Change-Id: Iedeb1c25bf5c7cd0376310afa576760af9f1c668
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx66
-rw-r--r--sc/source/ui/inc/condformatdlg.hrc1
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx4
-rw-r--r--sc/source/ui/src/condformatdlg.src10
4 files changed, 65 insertions, 16 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 41b8d3e2c7cf..648debbaa2ca 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -51,6 +51,7 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc):
maEdVal2( this, ScResId( ED_VAL2 ) ),
maFtStyle( this, ScResId( FT_STYLE ) ),
maLbStyle( this, ScResId( LB_STYLE ) ),
+ maWdPreview( this, ScResId( WD_PREVIEW ) ),
maLbColorFormat( this, ScResId( LB_COLOR_FORMAT ) ),
maLbColScale2( this, ScResId( LB_COL_SCALE2 ) ),
maLbColScale3( this, ScResId( LB_COL_SCALE3 ) ),
@@ -62,11 +63,9 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc):
maEdMax( this, ScResId( ED_COL_SCALE ) ),
mpDoc(pDoc)
{
- Size aSize = GetSizePixel();
- aSize.Height() = 40;
- SetSizePixel(aSize);
SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
SwitchToType(COLLAPSED);
+ SetHeight();
FreeResource();
maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl );
@@ -96,7 +95,7 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc):
aPointEd.X() += nMovePos;
maLbEntryTypeMiddle.SetPosPixel(aPointLb);
maEdMiddle.SetPosPixel(aPointEd);
- maLbEntryTypeMiddle.SelectEntryPos(3);
+ maLbEntryTypeMiddle.SelectEntryPos(2);
aPointLb.X() += nMovePos;
aPointEd.X() += nMovePos;
maLbEntryTypeMax.SelectEntryPos(1);
@@ -165,16 +164,13 @@ void ScCondFrmtEntry::SwitchToType( ScCondFormatEntryType eType )
maCondText.append(getExpression(maLbCondType.GetSelectEntryPos()));
maFtCondition.SetText(maCondText.makeStringAndClear());
maFtCondition.Show();
- maEdVal2.Hide();
- maEdVal1.Hide();
}
break;
default:
+ meType = eType;
maLbType.Show();
maFtCondition.SetText(rtl::OUString(""));
maFtCondition.Hide();
- maEdVal1.Show();
- maEdVal2.Show();
break;
}
}
@@ -186,6 +182,7 @@ void ScCondFrmtEntry::HideCondElements()
maLbStyle.Hide();
maFtStyle.Hide();
maLbCondType.Hide();
+ maWdPreview.Hide();
}
void ScCondFrmtEntry::SetCondType()
@@ -195,8 +192,10 @@ void ScCondFrmtEntry::SetCondType()
maLbStyle.Show();
maLbCondType.Show();
maFtStyle.Show();
+ maWdPreview.Show();
HideColorScaleElements();
HideDataBarElements();
+ SwitchToType(CONDITION);
}
void ScCondFrmtEntry::HideColorScaleElements()
@@ -212,6 +211,39 @@ void ScCondFrmtEntry::HideColorScaleElements()
maEdMax.Hide();
}
+void ScCondFrmtEntry::SetHeight()
+{
+ if(mbActive)
+ {
+ Size aSize = GetSizePixel();
+ switch (meType)
+ {
+ case CONDITION:
+ std::cout << "CONDITION: set height 120" << std::endl;
+ aSize.Height() = 120;
+ break;
+ case COLORSCALE:
+ std::cout << "set height 200" << std::endl;
+ aSize.Height() = 200;
+ break;
+ case DATABAR:
+ std::cout << "DATABAR: set height 120" << std::endl;
+ aSize.Height() = 120;
+ break;
+ default:
+ break;
+ }
+ SetSizePixel(aSize);
+ }
+ else
+ {
+ std::cout << "set height 40" << std::endl;
+ Size aSize = GetSizePixel();
+ aSize.Height() = 40;
+ SetSizePixel(aSize);
+ }
+}
+
void ScCondFrmtEntry::SetColorScaleType()
{
HideCondElements();
@@ -234,8 +266,8 @@ void ScCondFrmtEntry::SetColorScaleType()
maLbEntryTypeMin.Show();
maLbEntryTypeMax.Show();
maEdMin.Show();
- maEdMiddle.Show();
maEdMax.Show();
+ SwitchToType(COLORSCALE);
}
void ScCondFrmtEntry::HideDataBarElements()
@@ -245,6 +277,7 @@ void ScCondFrmtEntry::HideDataBarElements()
void ScCondFrmtEntry::SetDataBarType()
{
+ SwitchToType(DATABAR);
HideCondElements();
HideColorScaleElements();
maLbColorFormat.Show();
@@ -252,22 +285,18 @@ void ScCondFrmtEntry::SetDataBarType()
void ScCondFrmtEntry::Select()
{
- Size aSize = GetSizePixel();
- aSize.Height() = 130;
- SetSizePixel(aSize);
SetControlForeground(Color(COL_RED));
SwitchToType(meType);
mbActive = true;
+ SetHeight();
}
void ScCondFrmtEntry::Deselect()
{
- Size aSize = GetSizePixel();
- aSize.Height() = 40;
- SetSizePixel(aSize);
SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
SwitchToType(COLLAPSED);
mbActive = false;
+ SetHeight();
}
bool ScCondFrmtEntry::IsSelected() const
@@ -295,15 +324,22 @@ IMPL_LINK_NOARG(ScCondFrmtEntry, TypeListHdl)
default:
break;
}
+ SetHeight();
return 0;
}
IMPL_LINK_NOARG(ScCondFrmtEntry, ColFormatTypeHdl)
{
if(maLbColorFormat.GetSelectEntryPos() < 2)
+ {
SetColorScaleType();
+ }
else
+ {
SetDataBarType();
+ }
+
+ SetHeight();
return 0;
}
diff --git a/sc/source/ui/inc/condformatdlg.hrc b/sc/source/ui/inc/condformatdlg.hrc
index 2e0d925a1d25..d4f16b72a587 100644
--- a/sc/source/ui/inc/condformatdlg.hrc
+++ b/sc/source/ui/inc/condformatdlg.hrc
@@ -50,5 +50,6 @@
#define LB_COL_SCALE3 24
#define LB_TYPE_COL_SCALE 25
#define ED_COL_SCALE 28
+#define WD_PREVIEW 26
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index adf80f752514..b9c113239a94 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -32,6 +32,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/fixed.hxx>
#include <vcl/edit.hxx>
+#include <svx/fntctrl.hxx>
#include "rangelst.hxx"
@@ -68,6 +69,7 @@ private:
Edit maEdVal2;
FixedText maFtStyle;
ListBox maLbStyle;
+ SvxFontPrevWindow maWdPreview;
//color format ui elements
ListBox maLbColorFormat;
@@ -94,6 +96,8 @@ private:
void HideColorScaleElements();
void HideDataBarElements();
+ void SetHeight();
+
ScDocument* mpDoc;
DECL_LINK( TypeListHdl, void*);
diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src
index ab8a31aa8ced..ed09b307b432 100644
--- a/sc/source/ui/src/condformatdlg.src
+++ b/sc/source/ui/src/condformatdlg.src
@@ -194,8 +194,16 @@ Control RID_COND_ENTRY
};
Edit ED_COL_SCALE
{
- Pos = MAP_APPFONT( 5, 50 );
+ Pos = MAP_APPFONT( 5, 48 );
Size = MAP_APPFONT( 40, 12 );
+ Border = TRUE;
+ };
+ Window WD_PREVIEW
+ {
+ Pos = MAP_APPFONT( 90, 32 );
+ Size = MAP_APPFONT( 40, 14 );
+ Text [ en-US ] = "Example";
+ Border = TRUE;
};
};