sc/inc/strings.hrc                            |   14 ++++
 sc/source/ui/condformat/condformateasydlg.cxx |   75 ++++++++++++++++++++------
 sc/source/ui/inc/condformateasydlg.hxx        |    1 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |   28 ++++-----
 4 files changed, 87 insertions(+), 31 deletions(-)

New commits:
commit a82073a8d280f4500230cca6cc4cb1741b9732af
Author:     codewithvk <vivek.jav...@collabora.com>
AuthorDate: Mon Mar 25 22:42:25 2024 +0530
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Apr 2 11:55:15 2024 +0200

    Conditional Formatting: Adding More Specified Dialogues
    
    We have added additional single conditional dialogues to enhance the 
conditional formatting options for conditions such as duplicates, N elements, 
etc.
    
    Signed-off-by: codewithvk <vivek.jav...@collabora.com>
    Change-Id: I46d069f259d47739ad1bc859b19513f19d414eb7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165290
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    (cherry picked from commit abcb07e2baf2d59904b50e9c20f8a108ab9f17de)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165626
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 070f117a001e..e5725ef312fd 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -406,9 +406,21 @@
 #define STR_CONDITION_NOT_EQUAL                     
NC_("STR_CONDITION_NOT_EQUAL", "not equal to")
 
 #define STR_CONDITION_BETWEEN                       
NC_("STR_CONDITION_BETWEEN", "between")
-
+#define STR_CONDITION_NOT_BETWEEN                   
NC_("STR_CONDITION_NOT_BETWEEN", "not between")
+#define STR_CONDITION_DUPLICATE                     
NC_("STR_CONDITION_DUPLICATE", "duplicate")
+#define STR_CONDITION_NOT_DUPLICATE                 
NC_("STR_CONDITION_NOT_DUPLICATE", "not duplicate")
+#define STR_CONDITION_TOP_N_ELEMENTS                
NC_("STR_CONDITION_TOP_N_ELEMENTS", "in top N elements")
+#define STR_CONDITION_BOTTOM_N_ELEMENTS             
NC_("STR_CONDITION_BOTTOM_N_ELEMENTS", "in bottom N elements")
+#define STR_CONDITION_TOP_N_PERCENT                 
NC_("STR_CONDITION_TOP_N_PERCENT", "in top N percent")
+#define STR_CONDITION_BOTTOM_N_PERCENT              
NC_("STR_CONDITION_BOTTOM_N_PERCENT", "in bottom N percent")
+#define STR_CONDITION_ABOVE_AVERAGE                 
NC_("STR_CONDITION_ABOVE_AVERAGE", "above average")
+#define STR_CONDITION_BELOW_AVERAGE                 
NC_("STR_CONDITION_BELOW_AVERAGE", "below average")
+#define STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE        
NC_("STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE", "above or equal average")
+#define STR_CONDITION_BELOW_OR_EQUAL_AVERAGE        
NC_("STR_CONDITION_BELOW_OR_EQUAL_AVERAGE", "below or equal average")
 #define STR_CONDITION_ERROR                         NC_("STR_CONDITION_ERROR", 
"with error ")
 #define STR_CONDITION_NOERROR                       
NC_("STR_CONDITION_NOERROR", "without error ")
+#define STR_CONDITION_BEGINS_WITH                   
NC_("STR_CONDITION_BEGINS_WITH", "begins with")
+#define STR_CONDITION_ENDS_WITH                     
NC_("STR_CONDITION_ENDS_WITH", "ends with")
 #define STR_CONDITION_CONTAINS_TEXT                 
NC_("STR_CONDITION_CONTAINS_TEXT", "containing text")
 #define STR_CONDITION_NOT_CONTAINS_TEXT             
NC_("STR_CONDITION_NOT_CONTAINS_TEXT", "not containing text")
 
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index ba28d1e687dd..89cfdeb79c3d 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -50,6 +50,7 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
     , mpDocument(&mpViewData->GetDocument())
     , mxNumberEntry(m_xBuilder->weld_entry("entryNumber"))
     , mxNumberEntry2(m_xBuilder->weld_entry("entryNumber2"))
+    , mxAllInputs(m_xBuilder->weld_container("allInputs"))
     , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry("entryRange")))
     , mxButtonRangeEdit(new 
formula::RefButton(m_xBuilder->weld_button("rbassign")))
     , mxStyles(m_xBuilder->weld_combo_box("themeCombo"))
@@ -96,26 +97,62 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
             SetDescription(ScResId(STR_CONDITION_BETWEEN));
             mxNumberEntry2->show();
             break;
-        // NotBetween
-        // Duplicate
-        // NotDuplicate
-        // Direct
-        // Top10
-        // Bottom10
-        // TopPercent
-        // BottomPercent
-        // AboveAverage
-        // BelowAverage
-        // AboveEqualAverage
-        // BelowEqualAverage
+        case ScConditionMode::NotBetween:
+            SetDescription(ScResId(STR_CONDITION_NOT_BETWEEN));
+            mxNumberEntry2->show();
+            break;
+        case ScConditionMode::Duplicate:
+            SetDescription(ScResId(STR_CONDITION_DUPLICATE));
+            mxAllInputs->hide();
+            break;
+        case ScConditionMode::NotDuplicate:
+            SetDescription(ScResId(STR_CONDITION_NOT_DUPLICATE));
+            mxAllInputs->hide();
+            break;
+        // TODO: Direct
+        case ScConditionMode::Top10:
+            SetDescription(ScResId(STR_CONDITION_TOP_N_ELEMENTS));
+            break;
+        case ScConditionMode::Bottom10:
+            SetDescription(ScResId(STR_CONDITION_BOTTOM_N_ELEMENTS));
+            break;
+
+        case ScConditionMode::TopPercent:
+            SetDescription(ScResId(STR_CONDITION_TOP_N_PERCENT));
+            break;
+        case ScConditionMode::BottomPercent:
+            SetDescription(ScResId(STR_CONDITION_BOTTOM_N_PERCENT));
+            break;
+
+        case ScConditionMode::AboveAverage:
+            SetDescription(ScResId(STR_CONDITION_ABOVE_AVERAGE));
+            mxAllInputs->hide();
+            break;
+        case ScConditionMode::BelowAverage:
+            SetDescription(ScResId(STR_CONDITION_BELOW_AVERAGE));
+            mxAllInputs->hide();
+            break;
+
+        case ScConditionMode::AboveEqualAverage:
+            SetDescription(ScResId(STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE));
+            mxAllInputs->hide();
+            break;
+        case ScConditionMode::BelowEqualAverage:
+            SetDescription(ScResId(STR_CONDITION_BELOW_OR_EQUAL_AVERAGE));
+            mxAllInputs->hide();
+            break;
         case ScConditionMode::Error:
             SetDescription(ScResId(STR_CONDITION_ERROR));
             break;
         case ScConditionMode::NoError:
             SetDescription(ScResId(STR_CONDITION_NOERROR));
             break;
-        // BeginsWith
-        // EndsWith
+        case ScConditionMode::BeginsWith:
+            SetDescription(ScResId(STR_CONDITION_BEGINS_WITH));
+            break;
+        case ScConditionMode::EndsWith:
+            SetDescription(ScResId(STR_CONDITION_ENDS_WITH));
+            break;
         case ScConditionMode::ContainsText:
             SetDescription(ScResId(STR_CONDITION_CONTAINS_TEXT));
             break;
@@ -190,8 +227,14 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, 
weld::Button&, rButton, vo
     {
         std::unique_ptr<ScConditionalFormat> pFormat(new 
ScConditionalFormat(0, mpDocument));
 
-        OUString sExpression1 = mxNumberEntry->get_text();
-        OUString sExpression2 = mxNumberEntry2->get_text();
+        OUString sExpression1
+            = (mxNumberEntry->get_visible() == true && 
mxAllInputs->get_visible() == true
+                   ? mxNumberEntry->get_text()
+                   : "");
+        OUString sExpression2
+            = (mxNumberEntry2->get_visible() == true && 
mxAllInputs->get_visible() == true
+                   ? mxNumberEntry2->get_text()
+                   : "");
 
         switch (meMode)
         {
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 4ecf720decfc..ad7501c1bd3b 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -43,6 +43,7 @@ private:
 
     std::unique_ptr<weld::Entry> mxNumberEntry;
     std::unique_ptr<weld::Entry> mxNumberEntry2;
+    std::unique_ptr<weld::Container> mxAllInputs;
     std::unique_ptr<formula::RefEdit> mxRangeEntry;
     std::unique_ptr<formula::RefButton> mxButtonRangeEdit;
     std::unique_ptr<weld::ComboBox> mxStyles;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 5cc325781dfc..98066c86ef44 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -85,7 +85,7 @@
                     <property name="margin-bottom">6</property>
                     <property name="spacing">12</property>
                     <child>
-                      <object class="GtkBox">
+                      <object class="GtkBox" id="allInputs">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
                         <property name="spacing">12</property>
@@ -119,18 +119,6 @@
                             <property name="position">1</property>
                           </packing>
                         </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkBox">
-                        <property name="visible">True</property>
-                        <property name="can-focus">False</property>
-                        <property name="spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="with">
                             <property name="visible">True</property>
@@ -143,9 +131,21 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">0</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="can-focus">False</property>
+                        <property name="spacing">12</property>
                         <child>
                           <object class="GtkComboBoxText" id="themeCombo">
                             <property name="visible">True</property>

Reply via email to