[Libreoffice-commits] core.git: sc/source
Andrzej Hunt
andrzej at ahunt.org
Tue Aug 25 06:32:40 PDT 2015
sc/source/ui/condformat/condformatdlg.cxx | 34 +++++++++++++++++++++++-------
sc/source/ui/inc/condformatdlg.hxx | 3 ++
2 files changed, 30 insertions(+), 7 deletions(-)
New commits:
commit 14323c74935337775c05975f907a78bd692e8d44
Author: Andrzej Hunt <andrzej at ahunt.org>
Date: Thu May 14 16:50:46 2015 +0100
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 at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index fec9373..059aaf9 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 1438510..531b8c1 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:
More information about the Libreoffice-commits
mailing list