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>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 7bd5215..fe72649 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -666,7 +666,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>
@@ -677,7 +677,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>
@@ -697,6 +697,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 0fee5ea..6ecf98e 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 3346fa9..70bd311 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>