diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-10 02:34:01 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-10 03:21:16 +0200 |
commit | 6b74e2c69fd8c19f0eec6bb141f19e21c91a2076 (patch) | |
tree | e1cdc5de02265c1e50845236fbe8461ca10e3b6e /sc | |
parent | da7edb8bd74eb3c42a4585254e5bb329905b56c8 (diff) |
make also the condition edit fields ref input fields
Change-Id: I1246d9ef7ef129901dbcdb92ae9b8fed171fb343
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 47 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlgentry.hxx | 9 |
4 files changed, 60 insertions, 10 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 332139e89495..21093fec53a4 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -198,15 +198,24 @@ IMPL_LINK(ScCondFormatList, ColFormatTypeHdl, ListBox*, pBox) { case 0: if(itr->GetType() != condformat::entry::COLORSCALE2) + { maEntries.replace( itr, new ScColorScale2FrmtEntry( this, mpDoc, maPos ) ); + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); + } break; case 1: if(itr->GetType() != condformat::entry::COLORSCALE3) + { maEntries.replace( itr, new ScColorScale3FrmtEntry( this, mpDoc, maPos ) ); + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); + } break; case 2: if(itr->GetType() != condformat::entry::DATABAR) + { maEntries.replace( itr, new ScDataBarFrmtEntry( this, mpDoc, maPos ) ); + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); + } break; default: break; @@ -232,14 +241,17 @@ IMPL_LINK(ScCondFormatList, TypeListHdl, ListBox*, pBox) { case 0: maEntries.replace( itr, new ScColorScale3FrmtEntry(this, mpDoc, maPos)); + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); itr->SetActive(); break; case 1: maEntries.replace( itr, new ScConditionFrmtEntry(this, mpDoc, maPos)); + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); itr->SetActive(); break; case 2: maEntries.replace( itr, new ScFormulaFrmtEntry(this, mpDoc, maPos)); + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); itr->SetActive(); break; } @@ -255,6 +267,7 @@ IMPL_LINK_NOARG( ScCondFormatList, AddBtnHdl ) { itr->SetInactive(); } + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); pNewEntry->SetActive(); RecalcAll(); return 0; @@ -270,6 +283,7 @@ IMPL_LINK_NOARG( ScCondFormatList, RemoveBtnHdl ) break; } } + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); RecalcAll(); return 0; } @@ -280,6 +294,7 @@ IMPL_LINK( ScCondFormatList, EntrySelectHdl, ScCondFrmtEntry*, pEntry ) { itr->SetInactive(); } + static_cast<ScCondFormatDlg*>(GetParent())->InvalidateRefData(); pEntry->SetActive(); RecalcAll(); return 0; @@ -309,6 +324,7 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, Window* p maPos(rPos), mpDoc(pDoc), mpFormat(pFormat), + mpLastEdit(NULL), meType(eType) { rtl::OUStringBuffer aTitle( GetText() ); @@ -323,6 +339,7 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, Window* p maBtnOk.SetClickHdl( LINK( this, ScCondFormatDlg, OkBtnHdl ) ); maBtnCancel.SetClickHdl( LINK( this, ScCondFormatDlg, CancelBtnHdl ) ); maEdRange.SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdRange.SetLoseFocusHdl( LINK( this, ScCondFormatDlg, RangeLoseFocusHdl ) ); FreeResource(); maEdRange.SetText(aRangeString); @@ -334,7 +351,11 @@ ScCondFormatDlg::~ScCondFormatDlg() void ScCondFormatDlg::SetActive() { - maEdRange.GrabFocus(); + if(mpLastEdit) + mpLastEdit->GrabFocus(); + else + maEdRange.GrabFocus(); + RefInputDone(); } @@ -355,14 +376,18 @@ sal_Bool ScCondFormatDlg::IsRefInputMode() const void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument*) { - if( maEdRange.IsEnabled() ) + formula::RefEdit* pEdit = mpLastEdit; + if(!mpLastEdit) + pEdit = &maEdRange; + + if( pEdit->IsEnabled() ) { if(rRef.aStart != rRef.aEnd) - RefInputStart(&maEdRange); + RefInputStart(pEdit); rtl::OUString aRefStr; rRef.Format( aRefStr, ABS_DREF, mpDoc, ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) ); - maEdRange.SetRefString( aRefStr ); + pEdit->SetRefString( aRefStr ); } } @@ -379,6 +404,11 @@ ScConditionalFormat* ScCondFormatDlg::GetConditionalFormat() const return pFormat; } +void ScCondFormatDlg::InvalidateRefData() +{ + mpLastEdit = NULL; +} + IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit ) { rtl::OUString aRangeStr = pEdit->GetText(); @@ -427,16 +457,21 @@ IMPL_LINK_NOARG( ScCondFormatDlg, OkBtnHdl ) IMPL_LINK_NOARG( ScCondFormatDlg, CancelBtnHdl ) { - Close(); return 0; } -IMPL_LINK_NOARG( ScCondFormatDlg, RangeGetFocusHdl ) +IMPL_LINK( ScCondFormatDlg, RangeGetFocusHdl, formula::RefEdit*, pEdit ) { + mpLastEdit = pEdit; return 0; } +IMPL_LINK_NOARG( ScCondFormatDlg, RangeLoseFocusHdl ) +{ + //mpLastEdit = NULL; + return 0; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 507a0edef29b..707462f3c879 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -224,6 +224,10 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, c void ScConditionFrmtEntry::Init() { maLbStyle.SetSeparatorPos(0); + maEdVal1.SetGetFocusHdl( LINK( GetParent()->GetParent(), ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdVal2.SetGetFocusHdl( LINK( GetParent()->GetParent(), ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdVal1.SetLoseFocusHdl( LINK( GetParent()->GetParent(), ScCondFormatDlg, RangeLoseFocusHdl ) ); + maEdVal2.SetLoseFocusHdl( LINK( GetParent()->GetParent(), ScCondFormatDlg, RangeLoseFocusHdl ) ); maEdVal1.SetStyle( maEdVal1.GetStyle() | WB_FORCECTRLBACKGROUND ); maEdVal2.SetStyle( maEdVal2.GetStyle() | WB_FORCECTRLBACKGROUND ); @@ -405,6 +409,8 @@ ScFormulaFrmtEntry::ScFormulaFrmtEntry( Window* pParent, ScDocument* pDoc, const void ScFormulaFrmtEntry::Init() { maLbStyle.SetSeparatorPos(0); + maEdFormula.SetGetFocusHdl( LINK( GetParent()->GetParent(), ScCondFormatDlg, RangeGetFocusHdl ) ); + maEdFormula.SetLoseFocusHdl( LINK( GetParent()->GetParent(), ScCondFormatDlg, RangeLoseFocusHdl ) ); SfxStyleSheetIterator aStyleIter( mpDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() ) diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index e91574bde89a..3b3cfb30aa56 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -114,12 +114,13 @@ private: const ScConditionalFormat* mpFormat; + formula::RefEdit* mpLastEdit; + condformat::dialog::ScCondFormatDialogType meType; DECL_LINK( EdRangeModifyHdl, Edit* ); DECL_LINK( OkBtnHdl, void* ); DECL_LINK( CancelBtnHdl, void* ); - DECL_LINK( RangeGetFocusHdl, void* ); virtual sal_Bool Close(); protected: @@ -138,6 +139,11 @@ public: virtual sal_Bool IsRefInputMode() const; virtual void SetActive(); virtual sal_Bool IsTableLocked() const { return sal_True; } + + void InvalidateRefData(); + + DECL_LINK( RangeGetFocusHdl, formula::RefEdit* ); + DECL_LINK( RangeLoseFocusHdl, void* ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index b0051ad10837..f28a82442e46 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -9,6 +9,7 @@ #include "colorscale.hxx" #include "conditio.hxx" +#include <formula/funcutl.hxx> namespace condformat { @@ -76,8 +77,8 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry //cond format ui elements ListBox maLbCondType; - Edit maEdVal1; - Edit maEdVal2; + formula::RefEdit maEdVal1; + formula::RefEdit maEdVal2; FixedText maFtStyle; ListBox maLbStyle; SvxFontPrevWindow maWdPreview; @@ -87,6 +88,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry void Init(); DECL_LINK( StyleSelectHdl, void* ); DECL_LINK( ConditionTypeSelectHdl, void* ); + public: ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); @@ -102,12 +104,13 @@ class ScFormulaFrmtEntry : public ScCondFrmtEntry FixedText maFtStyle; ListBox maLbStyle; SvxFontPrevWindow maWdPreview; - Edit maEdFormula; + formula::RefEdit maEdFormula; ScFormatEntry* createFormulaEntry() const; void Init(); DECL_LINK( StyleSelectHdl, void* ); + public: ScFormulaFrmtEntry( Window* pParent, ScDocument* PDoc, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry = NULL ); |