officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 15 +++++- sc/source/ui/condformat/condformateasydlg.cxx | 24 ++++++++-- sc/uiconfig/scalc/popupmenu/conditional_easy.xml | 1 3 files changed, 35 insertions(+), 5 deletions(-)
New commits: commit 894db9a211bee1a7777a68128eb3e2cc7b4b074f Author: offtkp <parisop...@gmail.com> AuthorDate: Mon Oct 30 14:28:12 2023 +0200 Commit: Paris Oplopoios <parisop...@gmail.com> CommitDate: Wed Nov 1 16:42:13 2023 +0100 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 <parisop...@gmail.com> (cherry picked from commit 4017a12c4b62dc0a97886bacfee11e5f28dde6cc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158692 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index 815151845c14..044e1359ebe2 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -660,7 +660,7 @@ </node> <node oor:name=".uno:ConditionalFormatEasy?FormatRule:short=1" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Conditional Formatting: Condition Less Than</value> + <value xml:lang="en-US">Conditional Formatting: Less Than</value> </prop> <prop oor:name="ContextLabel" oor:type="xs:string"> <value xml:lang="en-US">Less than...</value> @@ -671,7 +671,7 @@ </node> <node oor:name=".uno:ConditionalFormatEasy?FormatRule:short=0" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Conditional Formatting: Condition Equals</value> + <value xml:lang="en-US">Conditional Formatting: Equals</value> </prop> <prop oor:name="ContextLabel" oor:type="xs:string"> <value xml:lang="en-US">Equals...</value> @@ -691,6 +691,17 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:ConditionalFormatEasy?FormatRule:short=23" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Conditional Formatting: Contains Text</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Containing text...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:ConditionalFormatDialog" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Conditional Formatting: More Rules</value> diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index d707b7c9f88d..1fed832b9811 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>