diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-03 04:58:01 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-11 08:01:23 +0200 |
commit | da7ab9599a4d628faf33c3d151dfc7770e58b4dc (patch) | |
tree | d3b8c77b2849bf1e926bd34bf1a279cbdf015895 /sc | |
parent | 6030a11ce58761a9b3399c1152da76779d1e88b4 (diff) |
add constructors to init dialog with model data
Change-Id: I9c710bdb9ad110a6a81155cf63c46b49af05b3fe
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 134 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/src/condformatdlg.src | 2 |
3 files changed, 129 insertions, 12 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index f7bbbfb0b98a..6db2584363ad 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -40,6 +40,7 @@ #include "conditio.hxx" #include "stlpool.hxx" #include "tabvwsh.hxx" +#include "conditio.hxx" #include "globstr.hrc" @@ -70,31 +71,120 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc): mpDoc(pDoc) { SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor()); + FreeResource(); + + maLbType.SelectEntryPos(1); + maLbCondType.SelectEntryPos(0); + maEdVal2.Hide(); + + maLbStyle.SetSeparatorPos(0); + maLbStyle.SelectEntryPos(1); + + //disable entries for color formats + maLbColorFormat.SelectEntryPos(0); + maLbEntryTypeMin.SelectEntryPos(0); + maLbEntryTypeMiddle.SelectEntryPos(2); + maLbEntryTypeMax.SelectEntryPos(1); + + Init(); + maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl ); SwitchToType(COLLAPSED); SetHeight(); + SetCondType(); +} + +ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc, const ScCondFormatEntry* pFormatEntry): + Control(pParent, ScResId( RID_COND_ENTRY ) ), + mbActive(false), + meType(CONDITION), + maLbType( this, ScResId( LB_TYPE ) ), + maFtCondNr( this, ScResId( FT_COND_NR ) ), + maFtCondition( this, ScResId( FT_CONDITION ) ), + maLbCondType( this, ScResId( LB_CELLIS_TYPE ) ), + maEdVal1( this, ScResId( ED_VAL1 ) ), + 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 ) ), + maLbEntryTypeMin( this, ScResId( LB_TYPE_COL_SCALE ) ), + maLbEntryTypeMiddle( this, ScResId( LB_TYPE_COL_SCALE ) ), + maLbEntryTypeMax( this, ScResId( LB_TYPE_COL_SCALE ) ), + maEdMin( this, ScResId( ED_COL_SCALE ) ), + maEdMiddle( this, ScResId( ED_COL_SCALE ) ), + maEdMax( this, ScResId( ED_COL_SCALE ) ), + mpDoc(pDoc) +{ + SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor()); FreeResource(); + if(pFormatEntry) + { + rtl::OUString aStyleName = pFormatEntry->GetStyle(); + maLbStyle.SelectEntry(aStyleName); + ScConditionMode eMode = pFormatEntry->GetOperation(); + maLbType.SelectEntryPos(1); + switch(eMode) + { + case SC_COND_EQUAL: + maLbCondType.SelectEntryPos(0); + break; + case SC_COND_LESS: + maLbCondType.SelectEntryPos(1); + break; + case SC_COND_GREATER: + maLbCondType.SelectEntryPos(2); + break; + case SC_COND_EQLESS: + maLbCondType.SelectEntryPos(3); + break; + case SC_COND_EQGREATER: + maLbCondType.SelectEntryPos(4); + break; + case SC_COND_NOTEQUAL: + maLbCondType.SelectEntryPos(5); + break; + case SC_COND_BETWEEN: + maLbCondType.SelectEntryPos(6); + break; + case SC_COND_NOTBETWEEN: + maLbCondType.SelectEntryPos(7); + break; + case SC_COND_DUPLICATE: + maLbCondType.SelectEntryPos(8); + break; + case SC_COND_NOTDUPLICATE: + maLbCondType.SelectEntryPos(9); + break; + case SC_COND_DIRECT: + maLbType.SelectEntryPos(2); + break; + case SC_COND_NONE: + break; + } + } + + Init(); maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl ); + SwitchToType(COLLAPSED); + SetHeight(); + SetCondType(); +} - maLbType.SelectEntryPos(1); +void ScCondFrmtEntry::Init() +{ maLbType.SetSelectHdl( LINK( this, ScCondFrmtEntry, TypeListHdl ) ); maLbColorFormat.SetSelectHdl( LINK( this, ScCondFrmtEntry, ColFormatTypeHdl ) ); - maLbCondType.SelectEntryPos(0); - maEdVal2.Hide(); - SfxStyleSheetIterator aStyleIter( mpDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() ) { rtl::OUString aName = pStyle->GetName(); maLbStyle.InsertEntry( aName ); } - maLbStyle.SetSeparatorPos(0); - maLbStyle.SelectEntryPos(1); maLbStyle.SetSelectHdl( LINK( this, ScCondFrmtEntry, StyleSelectHdl ) ); - //disable entries for color formats - maLbColorFormat.SelectEntryPos(0); - maLbEntryTypeMin.SelectEntryPos(0); Point aPointLb = maLbEntryTypeMiddle.GetPosPixel(); Point aPointEd = maEdMiddle.GetPosPixel(); const long nMovePos = 150; @@ -102,13 +192,10 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc): aPointEd.X() += nMovePos; maLbEntryTypeMiddle.SetPosPixel(aPointLb); maEdMiddle.SetPosPixel(aPointEd); - maLbEntryTypeMiddle.SelectEntryPos(2); aPointLb.X() += nMovePos; aPointEd.X() += nMovePos; - maLbEntryTypeMax.SelectEntryPos(1); maLbEntryTypeMax.SetPosPixel(aPointLb); maEdMax.SetPosPixel(aPointEd); - SetCondType(); } namespace { @@ -416,6 +503,29 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum FreeResource(); } +ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocument* pDoc, ScConditionalFormat* pFormat): + Control(pParent, rResId), + mbHasScrollBar(false), + mpScrollBar(new ScrollBar(this, WB_VERT )), + mnTopIndex(0), + mpDoc(pDoc) +{ + mpScrollBar->SetScrollHdl( LINK( this, ScCondFormatList, ScrollHdl ) ); + mpScrollBar->EnableDrag(); + + if(pFormat) + { + sal_Int32 nCount = pFormat->Count(); + for (sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex) + { + maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, pFormat->GetEntry(nIndex))); + } + } + + RecalcAll(); + FreeResource(); +} + void ScCondFormatList::RecalcAll() { sal_Int32 nTotalHeight = 0; diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 4a804e4e4b9c..54149bc931d6 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -41,6 +41,8 @@ class ScDocument; class ScConditionalFormat; +class ScCondFormatEntry; +class ScConditionalFormat; enum ScCondFormatEntryType { @@ -97,6 +99,7 @@ private: void HideDataBarElements(); void SetHeight(); + void Init(); ScDocument* mpDoc; @@ -106,6 +109,7 @@ private: public: ScCondFrmtEntry( Window* pParent, ScDocument* pDoc ); + ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCondFormatEntry* pFormatEntry ); virtual long Notify( NotifyEvent& rNEvt ); @@ -131,6 +135,7 @@ private: void DoScroll(long nDiff); public: ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc ); + ScCondFormatList( Window* pParent, const ResId& rResId, ScDocument* pDoc, ScConditionalFormat* pFormat); DECL_LINK( AddBtnHdl, void* ); DECL_LINK( RemoveBtnHdl, void* ); diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src index ed09b307b432..ab2a0c55168a 100644 --- a/sc/source/ui/src/condformatdlg.src +++ b/sc/source/ui/src/condformatdlg.src @@ -118,6 +118,8 @@ Control RID_COND_ENTRY "not equal to"; "between"; "not between"; + "duplicate"; + "not duplicate"; }; }; FixedText FT_STYLE |