sc/source/ui/condformat/condformateasydlg.cxx | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
New commits: commit 3fd308fef39e6a5551e427dc1a41deccd3476841 Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Thu Oct 17 06:23:21 2024 +0400 Commit: Pranam Lashkari <lpra...@collabora.com> CommitDate: Sun Oct 27 00:07:24 2024 +0200 sc: prefill easy condition dialog with editing condition data Change-Id: I207bcbf15bedf3dd51980f04899b2c751b64295d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175036 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 598e93b1b11f4cdff96f6117c2a7d35f3698fd23) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175207 Reviewed-by: Pranam Lashkari <lpra...@collabora.com> Tested-by: Jenkins diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index ee8f8318cf37..21c0953cbab0 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -283,10 +283,35 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, aRange.Format(sRangeString, ScRefFlags::VALID, *mpDocument, mpDocument->GetAddressConvention()); mxRangeEntry->SetText(sRangeString); + ScConditionalFormat* format = mpViewData->GetDocument().GetCondFormat( + maPosition.Col(), maPosition.Row(), maPosition.Tab()); + OUString sStyleName; + if (format) + { + const ScFormatEntry* entry = format->GetEntry(mnEntryIndex); + ScFormatEntry::Type type = entry->GetType(); + if (type == ScFormatEntry::Type::Condition) + { + const ScCondFormatEntry* condEntry = static_cast<const ScCondFormatEntry*>(entry); + sStyleName = condEntry->GetStyle(); + if (mxNumberEntry->get_visible()) + mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 0)); + if (mxNumberEntry2->get_visible()) + mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 1)); + } + else if (type == ScFormatEntry::Type::Date) + { + const ScCondDateFormatEntry* dateEntry + = static_cast<const ScCondDateFormatEntry*>(entry); + sStyleName = dateEntry->GetStyleName(); + } + } + StartListening(*mpDocument->GetStyleSheetPool(), DuplicateHandling::Prevent); ScCondFormatHelper::FillStyleListBox(mpDocument, *mxStyles); - mxStyles->set_active(1); + mxStyles->set_active_text(sStyleName); + StyleSelectHdl(*mxStyles); mxWdPreviewWin->show(); }