diff options
author | offtkp <parisoplop@gmail.com> | 2023-10-30 14:28:12 +0200 |
---|---|---|
committer | Paris Oplopoios <parisoplop@gmail.com> | 2023-10-31 14:23:05 +0100 |
commit | c8da023efe26efcb166c3525ca73fe62f26e154c (patch) | |
tree | 1cd6dc80cbfd9ed13c0cd763e9841bb6565ff558 /sc | |
parent | d590f094ccd28ca449eff91692c2178058d5c621 (diff) |
tdf#157930 Add Contains Text rule to easy conditional format dialog
Contains Text is another commonly used conditional formatting rule
that could be of use here
Change-Id: I67a3f711c57f9917be26fa21badd2f5a0d133747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158657
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformateasydlg.cxx | 24 | ||||
-rw-r--r-- | sc/uiconfig/scalc/popupmenu/conditional_easy.xml | 1 |
2 files changed, 22 insertions, 3 deletions
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 0fee5ea15b36..6ecf98e87e21 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -208,9 +208,27 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo if (&rButton == mxButtonOk.get()) { std::unique_ptr<ScConditionalFormat> pFormat(new ScConditionalFormat(0, mpDocument)); + + OUString sExpression1 = mxNumberEntry->get_text(); + OUString sExpression2 = mxNumberEntry2->get_text(); + + switch (meMode) + { + case ScConditionMode::ContainsText: + case ScConditionMode::NotContainsText: + case ScConditionMode::BeginsWith: + case ScConditionMode::EndsWith: + sExpression1 = "\"" + sExpression1 + "\""; + sExpression2 = "\"" + sExpression2 + "\""; + break; + default: + break; + } + ScFormatEntry* pEntry - = new ScCondFormatEntry(meMode, mxNumberEntry->get_text(), mxNumberEntry2->get_text(), - *mpDocument, maPosition, mxStyles->get_active_text()); + = new ScCondFormatEntry(meMode, sExpression1, sExpression2, *mpDocument, maPosition, + mxStyles->get_active_text()); + ScRangeList aRange; ScRefFlags nFlags = aRange.Parse(mxRangeEntry->GetText(), mpViewData->GetDocument(), @@ -229,4 +247,4 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo m_xDialog->response(RET_CANCEL); } -} // namespace sc
\ No newline at end of file +} // namespace sc diff --git a/sc/uiconfig/scalc/popupmenu/conditional_easy.xml b/sc/uiconfig/scalc/popupmenu/conditional_easy.xml index 3346fa9441bb..70bd311d4480 100644 --- a/sc/uiconfig/scalc/popupmenu/conditional_easy.xml +++ b/sc/uiconfig/scalc/popupmenu/conditional_easy.xml @@ -12,6 +12,7 @@ <menu:menuitem menu:id=".uno:ConditionalFormatEasy?FormatRule:short=1"/> <menu:menuitem menu:id=".uno:ConditionalFormatEasy?FormatRule:short=0"/> <menu:menuitem menu:id=".uno:ConditionalFormatEasy?FormatRule:short=6"/> + <menu:menuitem menu:id=".uno:ConditionalFormatEasy?FormatRule:short=23"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:ConditionalFormatDialog"/> </menu:menupopup> |