Kaydet (Commit) 14323c74 authored tarafından Andrzej Hunt's avatar Andrzej Hunt Kaydeden (comit) Markus Mohrhard

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/15711Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 1979c48b
......@@ -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;
}
......
......@@ -116,6 +116,9 @@ private:
VclPtr<formula::RefEdit> mpLastEdit;
OUString msBaseTitle;
void updateTitle();
DECL_LINK( EdRangeModifyHdl, Edit* );
protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment