diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2024-10-17 06:23:21 +0400 |
---|---|---|
committer | Pranam Lashkari <lpranam@collabora.com> | 2024-10-27 00:07:24 +0200 |
commit | 3fd308fef39e6a5551e427dc1a41deccd3476841 (patch) | |
tree | 9f2d7be9530aa3ab549ed0a4bd06d5d003a5003b /sc/source/ui | |
parent | 0c6e26890a822c5891056f83690a477622b85c8a (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 598e93b1b11f4cdff96f6117c2a7d35f3698fd23)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175207
Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/condformat/condformateasydlg.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
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(); } |