diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-05-14 16:50:46 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-25 13:32:19 +0000 |
commit | 14323c74935337775c05975f907a78bd692e8d44 (patch) | |
tree | 77cdca965194f6e35bce28f90526e31afb979cca /sc | |
parent | 1979c48bf96bc1fd8f3558b6c9970935ddd79723 (diff) |
Update title of Conditional Format dialog when range modified
Previously the title was set during construction as e.g.
"Conditional Format: A2:B245"
However the selected range can be modified while the dialog is open,
hence we update it whenever the selected range is modified.
Change-Id: I63790108553102cedb51ca32d672a62477493660
Reviewed-on: https://gerrit.libreoffice.org/15711
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 34 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 3 |
2 files changed, 30 insertions, 7 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index fec9373c4f6c..059aaf9df2b4 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -450,13 +450,6 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, get(mpCondFormList, "list"); mpCondFormList->init(mpViewData->GetDocument(), this, pFormat, rRange, rPos, eType); - OUStringBuffer aTitle( GetText() ); - aTitle.append(" "); - OUString aRangeString; - rRange.Format(aRangeString, SCA_VALID, pViewData->GetDocument(), - pViewData->GetDocument()->GetAddressConvention()); - aTitle.append(aRangeString); - SetText(aTitle.makeStringAndClear()); mpBtnOk->SetClickHdl(LINK(this, ScCondFormatDlg, BtnPressedHdl ) ); mpBtnAdd->SetClickHdl( LINK( mpCondFormList, ScCondFormatList, AddBtnHdl ) ); mpBtnRemove->SetClickHdl( LINK( mpCondFormList, ScCondFormatList, RemoveBtnHdl ) ); @@ -464,7 +457,20 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, mpEdRange->SetModifyHdl( LINK( this, ScCondFormatDlg, EdRangeModifyHdl ) ); mpEdRange->SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) ); + OUString aRangeString; + rRange.Format(aRangeString, SCA_VALID, pViewData->GetDocument(), + pViewData->GetDocument()->GetAddressConvention()); mpEdRange->SetText(aRangeString); + + msBaseTitle = GetText(); + updateTitle(); +} + +void ScCondFormatDlg::updateTitle() +{ + OUString aTitle = msBaseTitle + " " + mpEdRange->GetText(); + + SetText(aTitle); } ScCondFormatDlg::~ScCondFormatDlg() @@ -500,6 +506,17 @@ void ScCondFormatDlg::SetActive() void ScCondFormatDlg::RefInputDone( bool bForced ) { ScAnyRefDlg::RefInputDone(bForced); + + // ScAnyRefModalDlg::RefInputDone resets the title back + // to it's original state. + // I.e. if we open the dialog normally, and then click into the sheet + // to modify the selection, the title is updated such that the range + // is only a single cell (e.g. $A$1), after which the dialog switches + // into the RefInput mode. During the RefInput mode the title is updated + // as expected, however at the end RefInputDone overwrites the title + // with the initial (now incorrect) single cell range. Hence we correct + // it here. + updateTitle(); } bool ScCondFormatDlg::IsTableLocked() const @@ -541,6 +558,7 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument*) OUString aRefStr(rRef.Format(n, mpViewData->GetDocument(), ScAddress::Details(mpViewData->GetDocument()->GetAddressConvention(), 0, 0))); pEdit->SetRefString( aRefStr ); + updateTitle(); } } @@ -766,6 +784,8 @@ IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit ) pEdit->SetControlBackground(GetSettings().GetStyleSettings().GetWindowColor()); else pEdit->SetControlBackground(COL_LIGHTRED); + + updateTitle(); return 0; } diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 1438510b8fcb..531b8c19a3ba 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -116,6 +116,9 @@ private: VclPtr<formula::RefEdit> mpLastEdit; + OUString msBaseTitle; + void updateTitle(); + DECL_LINK( EdRangeModifyHdl, Edit* ); protected: |