sc/source/ui/condformat/condformatdlgentry.cxx |  164 +++++++++++++++++++++++--
 sc/source/ui/condformat/condformateasydlg.cxx  |   51 +++----
 sc/source/ui/condformat/condformathelper.cxx   |  150 ----------------------
 sc/source/ui/inc/condformateasydlg.hxx         |    8 -
 sc/source/ui/inc/condformathelper.hxx          |    6 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui  |   43 ------
 6 files changed, 181 insertions(+), 241 deletions(-)

New commits:
commit bf3a95aaf56e688deb1129d1e5cd6142c3028235
Author:     Pranam Lashkari <[email protected]>
AuthorDate: Mon Nov 25 19:44:43 2024 +0530
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Nov 26 09:38:18 2024 +0100

    Revert "sc: preview style in easy format dialog"
    
    This reverts commit 2661be5f8fb28ada80b4f5336d59f54b520bf614.
    
    Change-Id: Ie3482641cbbb34baa866a679c782221d2d513df1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177287
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index c3219a130d96..b16970a0a31c 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -102,6 +102,26 @@ void ScCondFrmtEntry::Deselect()
     mbActive = false;
 }
 
+//condition
+
+namespace {
+
+void FillStyleListBox( const ScDocument* pDoc, weld::ComboBox& rLbStyle )
+{
+    std::set<OUString> aStyleNames;
+    SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), 
SfxStyleFamily::Para );
+    for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = 
aStyleIter.Next() )
+    {
+        aStyleNames.insert(pStyle->GetName());
+    }
+    for(const auto& rStyleName : aStyleNames)
+    {
+        rLbStyle.append_text(rStyleName);
+    }
+}
+
+}
+
 const ScConditionMode 
ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry::NUM_COND_ENTRIES]
     = { ScConditionMode::Equal,
         ScConditionMode::Less,
@@ -215,7 +235,7 @@ void ScConditionFrmtEntry::Init(ScCondFormatDlg* 
pDialogParent)
     mxEdVal1->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) );
     mxEdVal2->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) );
 
-    ScCondFormatHelper::FillStyleListBox(mpDoc, *mxLbStyle);
+    FillStyleListBox( mpDoc, *mxLbStyle );
     mxLbStyle->connect_changed( LINK( this, ScConditionFrmtEntry, 
StyleSelectHdl ) );
 
     mxLbCondType->connect_changed( LINK( this, ScConditionFrmtEntry, 
ConditionTypeSelectHdl ) );
@@ -411,19 +431,104 @@ void ScConditionFrmtEntry::SetInactive()
     Deselect();
 }
 
+namespace {
+
+void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument* pDoc)
+{
+    OUString aSelectedStyle = rLbStyle.get_active_text();
+    for (sal_Int32 i = rLbStyle.get_count(); i > 1; --i)
+        rLbStyle.remove(i - 1);
+    FillStyleListBox(pDoc, rLbStyle);
+    rLbStyle.set_active_text(aSelectedStyle);
+}
+
+}
+
 void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint)
 {
     if(rHint.GetId() == SfxHintId::StyleSheetModified)
     {
         if(!mbIsInStyleCreate)
-            ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mpDoc);
+            UpdateStyleList(*mxLbStyle, mpDoc);
     }
 }
 
+namespace {
+
+void StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, const 
ScDocument* pDoc, SvxFontPrevWindow& rWdPreview)
+{
+    if (rLbStyle.get_active() == 0)
+    {
+        // call new style dialog
+        SfxUInt16Item aFamilyItem( SID_STYLE_FAMILY, 
sal_uInt16(SfxStyleFamily::Para) );
+        SfxStringItem aRefItem( SID_STYLE_REFERENCE, 
ScResId(STR_STYLENAME_STANDARD) );
+        css::uno::Any aAny(pDialogParent->GetXWindow());
+        SfxUnoAnyItem aDialogParent( SID_DIALOG_PARENT, aAny );
+
+        // unlock the dispatcher so SID_STYLE_NEW can be executed
+        // (SetDispatcherLock would affect all Calc documents)
+        if (ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell())
+        {
+            if (SfxDispatcher* pDisp = pViewShell->GetDispatcher())
+            {
+                bool bLocked = pDisp->IsLocked();
+                if (bLocked)
+                    pDisp->Lock(false);
+
+                // Execute the "new style" slot, complete with undo and all 
necessary updates.
+                // The return value (SfxUInt16Item) is ignored, look for new 
styles instead.
+                pDisp->ExecuteList(SID_STYLE_NEW,
+                    SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
+                    { &aFamilyItem, &aRefItem }, { &aDialogParent });
+
+                if (bLocked)
+                    pDisp->Lock(true);
+
+                // Find the new style and add it into the style list boxes
+                SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), 
SfxStyleFamily::Para );
+                bool bFound = false;
+                for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle 
&& !bFound; pStyle = aStyleIter.Next() )
+                {
+                    const OUString& aName = pStyle->GetName();
+                    if (rLbStyle.find_text(aName) == -1)    // all lists 
contain the same entries
+                    {
+                        for( sal_Int32 i = 1, n = rLbStyle.get_count(); i <= n 
&& !bFound; ++i)
+                        {
+                            OUString aStyleName = 
ScGlobal::getCharClass().uppercase(rLbStyle.get_text(i));
+                            if( i == n )
+                            {
+                                rLbStyle.append_text(aName);
+                                rLbStyle.set_active_text(aName);
+                                bFound = true;
+                            }
+                            else if( aStyleName > 
ScGlobal::getCharClass().uppercase(aName) )
+                            {
+                                rLbStyle.insert_text(i, aName);
+                                rLbStyle.set_active_text(aName);
+                                bFound = true;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    OUString aStyleName = rLbStyle.get_active_text();
+    SfxStyleSheetBase* pStyleSheet = pDoc->GetStyleSheetPool()->Find( 
aStyleName, SfxStyleFamily::Para );
+    if(pStyleSheet)
+    {
+        const SfxItemSet& rSet = pStyleSheet->GetItemSet();
+        rWdPreview.SetFromItemSet(rSet, false);
+    }
+}
+
+}
+
 IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl, weld::ComboBox&, void)
 {
     mbIsInStyleCreate = true;
-    ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, 
mpDoc, maWdPreview);
+    StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview);
     mbIsInStyleCreate = false;
 }
 
@@ -465,13 +570,13 @@ void ScFormulaFrmtEntry::Init(ScCondFormatDlg* 
pDialogParent)
 {
     mxEdFormula->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, 
RangeGetFocusHdl ) );
 
-    ScCondFormatHelper::FillStyleListBox(mpDoc, *mxLbStyle);
+    FillStyleListBox( mpDoc, *mxLbStyle );
     mxLbStyle->connect_changed( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl 
) );
 }
 
 IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl, weld::ComboBox&, void)
 {
-    ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, 
mpDoc, maWdPreview);
+    StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview);
 }
 
 ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const
@@ -1181,7 +1286,7 @@ void ScDateFrmtEntry::Init()
     mxLbDateEntry->set_active(0);
     mxLbType->set_active(3);
 
-    ScCondFormatHelper::FillStyleListBox(mpDoc, *mxLbStyle);
+    FillStyleListBox( mpDoc, *mxLbStyle );
     mxLbStyle->connect_changed( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) 
);
     mxLbStyle->set_active(1);
 }
@@ -1211,7 +1316,7 @@ void ScDateFrmtEntry::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
     if(rHint.GetId() == SfxHintId::StyleSheetModified)
     {
         if(!mbIsInStyleCreate)
-            ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mpDoc);
+            UpdateStyleList(*mxLbStyle, mpDoc);
     }
 }
 
@@ -1233,7 +1338,7 @@ OUString ScDateFrmtEntry::GetExpressionString()
 IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl, weld::ComboBox&, void )
 {
     mbIsInStyleCreate = true;
-    ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, 
mpDoc, maWdPreview);
+    StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mpDoc, maWdPreview);
     mbIsInStyleCreate = false;
 }
 
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index c8f5ff9d2355..2c454bc0f887 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -6,10 +6,32 @@
 #include <scresid.hxx>
 #include <svl/style.hxx>
 #include <strings.hrc>
-#include <condformathelper.hxx>
 
 namespace
 {
+void FillStyleListBox(const ScDocument* pDocument, weld::ComboBox& rCombo)
+{
+    std::set<OUString> aStyleNames;
+    SfxStyleSheetIterator aStyleIter(pDocument->GetStyleSheetPool(), 
SfxStyleFamily::Para);
+    for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = 
aStyleIter.Next())
+    {
+        aStyleNames.insert(pStyle->GetName());
+    }
+    for (const auto& rStyleName : aStyleNames)
+    {
+        rCombo.append_text(rStyleName);
+    }
+}
+
+void UpdateStyleList(const ScDocument* pDocument, weld::ComboBox& rCombo)
+{
+    OUString sSelectedStyle = rCombo.get_active_text();
+    for (sal_Int32 i = rCombo.get_count(); i > 1; --i)
+        rCombo.remove(i - 1);
+    FillStyleListBox(pDocument, rCombo);
+    rCombo.set_active_text(sSelectedStyle);
+}
+
 condformat::ScCondFormatDateType GetScCondFormatDateType(ScConditionMode mode)
 {
     switch (mode)
@@ -59,7 +81,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
                                                          ScViewData* pViewData)
     : ScAnyRefDlgController(pBindings, pChildWindow, pParent,
                             "modules/scalc/ui/conditionaleasydialog.ui", 
"CondFormatEasyDlg")
-    , mpParent(pParent)
     , mpViewData(pViewData)
     , mpDocument(&mpViewData->GetDocument())
     , mbIsManaged(false)
@@ -69,8 +90,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
     , 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"))
-    , mxWdPreviewWin(m_xBuilder->weld_widget("previewwin"))
-    , mxWdPreview(new weld::CustomWeld(*m_xBuilder, "preview", maWdPreview))
     , mxDescription(m_xBuilder->weld_label("description"))
     , mxButtonOk(m_xBuilder->weld_button("ok"))
     , mxButtonCancel(m_xBuilder->weld_button("cancel"))
@@ -242,7 +261,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 
     mxButtonOk->connect_clicked(LINK(this, ConditionalFormatEasyDialog, 
ButtonPressed));
     mxButtonCancel->connect_clicked(LINK(this, ConditionalFormatEasyDialog, 
ButtonPressed));
-    mxStyles->connect_changed(LINK(this, ConditionalFormatEasyDialog, 
StyleSelectHdl));
 
     ScRangeList aRange;
     mpViewData->GetMarkData().FillRangeListWithMarks(&aRange, false);
@@ -258,10 +276,9 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
     mxRangeEntry->SetText(sRangeString);
 
     StartListening(*mpDocument->GetStyleSheetPool(), 
DuplicateHandling::Prevent);
-    ScCondFormatHelper::FillStyleListBox(mpDocument, *mxStyles);
+    FillStyleListBox(mpDocument, *mxStyles);
 
     mxStyles->set_active(1);
-    mxWdPreviewWin->show();
 }
 
 ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog()
@@ -276,7 +293,7 @@ ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog()
 void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint)
 {
     if (rHint.GetId() == SfxHintId::StyleSheetModified)
-        ScCondFormatHelper::UpdateStyleList(*mxStyles, mpDocument);
+        UpdateStyleList(mpDocument, *mxStyles);
 }
 
 void ConditionalFormatEasyDialog::SetReference(const ScRange& rRange, 
ScDocument&)
@@ -372,9 +389,4 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, 
weld::Button&, rButton, vo
         m_xDialog->response(RET_CANCEL);
 }
 
-IMPL_LINK_NOARG(ConditionalFormatEasyDialog, StyleSelectHdl, weld::ComboBox&, 
void)
-{
-    ScCondFormatHelper::StyleSelect(mpParent, *mxStyles, 
&(mpViewData->GetDocument()), maWdPreview);
-}
-
 } // namespace sc
diff --git a/sc/source/ui/condformat/condformathelper.cxx 
b/sc/source/ui/condformat/condformathelper.cxx
index 2584bb701cf2..6d1f1b1b3a27 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -15,14 +15,6 @@
 #include <globstr.hrc>
 #include <scresid.hxx>
 #include <conditio.hxx>
-#include <stlpool.hxx>
-#include <svl/lstner.hxx>
-#include <svl/stritem.hxx>
-#include <svl/intitem.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/frame.hxx>
-#include <tabvwsh.hxx>
-#include <svx/fntctrl.hxx>
 
 namespace {
 
@@ -230,98 +222,4 @@ OUString ScCondFormatHelper::GetExpression( 
ScCondFormatEntryType eType, sal_Int
     return aBuffer.makeStringAndClear();
 }
 
-void ScCondFormatHelper::StyleSelect(weld::Window* pDialogParent, 
weld::ComboBox& rLbStyle,
-                                     const ScDocument* pDoc, 
SvxFontPrevWindow& rWdPreview)
-{
-    if (rLbStyle.get_active() == 0)
-    {
-        // call new style dialog
-        SfxUInt16Item aFamilyItem(SID_STYLE_FAMILY, 
sal_uInt16(SfxStyleFamily::Para));
-        SfxStringItem aRefItem(SID_STYLE_REFERENCE, 
ScResId(STR_STYLENAME_STANDARD));
-        css::uno::Any aAny(pDialogParent->GetXWindow());
-        SfxUnoAnyItem aDialogParent(SID_DIALOG_PARENT, aAny);
-
-        // unlock the dispatcher so SID_STYLE_NEW can be executed
-        // (SetDispatcherLock would affect all Calc documents)
-        if (ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell())
-        {
-            if (SfxDispatcher* pDisp = pViewShell->GetDispatcher())
-            {
-                bool bLocked = pDisp->IsLocked();
-                if (bLocked)
-                    pDisp->Lock(false);
-
-                // Execute the "new style" slot, complete with undo and all 
necessary updates.
-                // The return value (SfxUInt16Item) is ignored, look for new 
styles instead.
-                pDisp->ExecuteList(SID_STYLE_NEW, SfxCallMode::SYNCHRON | 
SfxCallMode::RECORD,
-                                   { &aFamilyItem, &aRefItem }, { 
&aDialogParent });
-
-                if (bLocked)
-                    pDisp->Lock(true);
-
-                // Find the new style and add it into the style list boxes
-                SfxStyleSheetIterator aStyleIter(pDoc->GetStyleSheetPool(), 
SfxStyleFamily::Para);
-                bool bFound = false;
-                for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && 
!bFound;
-                     pStyle = aStyleIter.Next())
-                {
-                    const OUString& aName = pStyle->GetName();
-                    if (rLbStyle.find_text(aName) == -1) // all lists contain 
the same entries
-                    {
-                        for (sal_Int32 i = 1, n = rLbStyle.get_count(); i <= n 
&& !bFound; ++i)
-                        {
-                            OUString aStyleName
-                                = 
ScGlobal::getCharClass().uppercase(rLbStyle.get_text(i));
-                            if (i == n)
-                            {
-                                rLbStyle.append_text(aName);
-                                rLbStyle.set_active_text(aName);
-                                bFound = true;
-                            }
-                            else if (aStyleName > 
ScGlobal::getCharClass().uppercase(aName))
-                            {
-                                rLbStyle.insert_text(i, aName);
-                                rLbStyle.set_active_text(aName);
-                                bFound = true;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    OUString aStyleName = rLbStyle.get_active_text();
-    SfxStyleSheetBase* pStyleSheet
-        = pDoc->GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para);
-    if (pStyleSheet)
-    {
-        const SfxItemSet& rSet = pStyleSheet->GetItemSet();
-        rWdPreview.SetFromItemSet(rSet, false);
-    }
-}
-
-void ScCondFormatHelper::FillStyleListBox(const ScDocument* pDocument, 
weld::ComboBox& rCombo)
-{
-    std::set<OUString> aStyleNames;
-    SfxStyleSheetIterator aStyleIter(pDocument->GetStyleSheetPool(), 
SfxStyleFamily::Para);
-    for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = 
aStyleIter.Next())
-    {
-        aStyleNames.insert(pStyle->GetName());
-    }
-    for (const auto& rStyleName : aStyleNames)
-    {
-        rCombo.append_text(rStyleName);
-    }
-}
-
-void ScCondFormatHelper::UpdateStyleList(weld::ComboBox& rLbStyle, const 
ScDocument* pDoc)
-{
-    OUString aSelectedStyle = rLbStyle.get_active_text();
-    for (sal_Int32 i = rLbStyle.get_count(); i > 1; --i)
-        rLbStyle.remove(i - 1);
-    ScCondFormatHelper::FillStyleListBox(pDoc, rLbStyle);
-    rLbStyle.set_active_text(aSelectedStyle);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index baa6208dc061..e9d2f24a80a9 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -12,7 +12,6 @@
 #include "anyrefdg.hxx"
 #include <svl/lstner.hxx>
 #include <conditio.hxx>
-#include <svx/fntctrl.hxx>
 
 class ScViewData;
 class ScConditionalFormat;
@@ -33,12 +32,10 @@ public:
     virtual void Notify(SfxBroadcaster&, const SfxHint&) override;
 
     DECL_LINK(ButtonPressed, weld::Button&, void);
-    DECL_LINK(StyleSelectHdl, weld::ComboBox&, void);
 
 private:
     void SetDescription(std::u16string_view rCondition);
 
-    weld::Window* mpParent;
     ScViewData* mpViewData;
     ScDocument* mpDocument;
     ScConditionMode meMode;
@@ -46,15 +43,12 @@ private:
     OUString msFormula;
     ScAddress maPosition;
 
-    SvxFontPrevWindow maWdPreview;
     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;
-    std::unique_ptr<weld::Widget> mxWdPreviewWin;
-    std::unique_ptr<weld::CustomWeld> mxWdPreview;
     std::unique_ptr<weld::Label> mxDescription;
     std::unique_ptr<weld::Button> mxButtonOk;
     std::unique_ptr<weld::Button> mxButtonCancel;
diff --git a/sc/source/ui/inc/condformathelper.hxx 
b/sc/source/ui/inc/condformathelper.hxx
index 35e3b5c9e9be..9e4a0768dbb4 100644
--- a/sc/source/ui/inc/condformathelper.hxx
+++ b/sc/source/ui/inc/condformathelper.hxx
@@ -11,7 +11,6 @@
 
 #include <rtl/ustring.hxx>
 #include <address.hxx>
-#include <svx/fntctrl.hxx>
 
 class ScConditionalFormat;
 
@@ -32,10 +31,6 @@ public:
 
     static SC_DLLPUBLIC OUString GetExpression( ScCondFormatEntryType eType, 
sal_Int32 nIndex,
             std::u16string_view aStr1 = std::u16string_view(), 
std::u16string_view aStr2 = std::u16string_view() );
-    static SC_DLLPUBLIC void StyleSelect(weld::Window* pDialogParent, 
weld::ComboBox& rLbStyle,
-                                         const ScDocument* pDoc, 
SvxFontPrevWindow& rWdPreview);
-    static SC_DLLPUBLIC void FillStyleListBox(const ScDocument* pDocument, 
weld::ComboBox& rCombo);
-    static SC_DLLPUBLIC void UpdateStyleList(weld::ComboBox& rLbStyle, const 
ScDocument* pDoc);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index ea7833ef6227..1392d6583d57 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -148,9 +148,6 @@
                           <object class="GtkComboBoxText" id="themeCombo">
                             <property name="visible">True</property>
                             <property name="can-focus">False</property>
-                            <items>
-                              <item translatable="yes" 
context="conditionalentry|style">New Style...</item>
-                            </items>
                             <accessibility>
                               <relation type="labelled-by" target="with"/>
                             </accessibility>
@@ -254,33 +251,6 @@
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkScrolledWindow" id="previewwin">
-                <property name="can-focus">True</property>
-                <property name="no-show-all">True</property>
-                <property name="hscrollbar-policy">never</property>
-                <property name="vscrollbar-policy">never</property>
-                <property name="shadow-type">in</property>
-                <child>
-                  <object class="GtkViewport">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <child>
-                      <object class="GtkDrawingArea" id="preview">
-                        <property name="visible">True</property>
-                        <property name="can-focus">False</property>
-                        <property name="tooltip-text" translatable="yes" 
context="conditionaleasydialog|preview|tooltip_text">Example</property>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
commit cdd9fb14e534d1c7f32a24d71024e34ad558533f
Author:     Pranam Lashkari <[email protected]>
AuthorDate: Mon Nov 25 19:44:34 2024 +0530
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Nov 26 09:38:09 2024 +0100

    Revert "sc: give warning about condition input in easy condition dialog"
    
    This reverts commit 2a6dc9dfd84b278352608f475a600e866846af2e.
    
    Change-Id: I061f8ebfbf0115dd55d357c325a3905c5a774a57
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177286
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index 9212dcfe1bdd..c3219a130d96 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -242,7 +242,48 @@ ScFormatEntry* 
ScConditionFrmtEntry::createConditionEntry() const
 IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, formula::RefEdit&, rRefEdit, void)
 {
     weld::Entry& rEdit = *rRefEdit.GetWidget();
-    ScCondFormatHelper::ValidateInputField(rEdit, *mxFtVal, mpDoc, maPos);
+    OUString aFormula = rEdit.get_text();
+
+    if( aFormula.isEmpty() )
+    {
+        mxFtVal->set_label(ScResId(STR_ENTER_VALUE));
+        return;
+    }
+
+    ScCompiler aComp( *mpDoc, maPos, mpDoc->GetGrammar() );
+    aComp.SetExtendedErrorDetection( 
ScCompiler::ExtendedErrorDetection::EXTENDED_ERROR_DETECTION_NAME_BREAK);
+    std::unique_ptr<ScTokenArray> ta(aComp.CompileString(aFormula));
+
+    // Error, warn the user if it is not an unknown name.
+    if (ta->GetCodeError() != FormulaError::NoName && (ta->GetCodeError() != 
FormulaError::NONE || ta->GetLen() == 0))
+    {
+        rEdit.set_message_type(weld::EntryMessageType::Error);
+        mxFtVal->set_label(ScResId(STR_VALID_DEFERROR));
+        return;
+    }
+
+    // Unrecognized name, warn the user; i.e. happens when starting to type and
+    // will go away once a valid name is completed.
+    if (ta->GetCodeError() == FormulaError::NoName)
+    {
+        rEdit.set_message_type(weld::EntryMessageType::Warning);
+        mxFtVal->set_label(ScResId(STR_UNQUOTED_STRING));
+        return;
+    }
+
+    // Generate RPN to detect further errors.
+    if (ta->GetLen() > 0)
+        aComp.CompileTokenArray();
+    // Error, warn the user.
+    if (ta->GetCodeError() != FormulaError::NONE || (ta->GetCodeLen() == 0))
+    {
+        rEdit.set_message_type(weld::EntryMessageType::Error);
+        mxFtVal->set_label(ScResId(STR_VALID_DEFERROR));
+        return;
+    }
+
+    rEdit.set_message_type(weld::EntryMessageType::Normal);
+    mxFtVal->set_label("");
 }
 
 void ScConditionFrmtEntry::Select()
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 48b712cf1fe2..c8f5ff9d2355 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -66,7 +66,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
     , mxNumberEntry(m_xBuilder->weld_entry("entryNumber"))
     , mxNumberEntry2(m_xBuilder->weld_entry("entryNumber2"))
     , mxAllInputs(m_xBuilder->weld_container("allInputs"))
-    , mxWarningLabel(m_xBuilder->weld_label("warning"))
     , 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"))
@@ -244,8 +243,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
     mxButtonOk->connect_clicked(LINK(this, ConditionalFormatEasyDialog, 
ButtonPressed));
     mxButtonCancel->connect_clicked(LINK(this, ConditionalFormatEasyDialog, 
ButtonPressed));
     mxStyles->connect_changed(LINK(this, ConditionalFormatEasyDialog, 
StyleSelectHdl));
-    mxNumberEntry->connect_changed(LINK(this, ConditionalFormatEasyDialog, 
OnEdChanged));
-    mxNumberEntry2->connect_changed(LINK(this, ConditionalFormatEasyDialog, 
OnEdChanged));
 
     ScRangeList aRange;
     mpViewData->GetMarkData().FillRangeListWithMarks(&aRange, false);
@@ -380,14 +377,4 @@ IMPL_LINK_NOARG(ConditionalFormatEasyDialog, 
StyleSelectHdl, weld::ComboBox&, vo
     ScCondFormatHelper::StyleSelect(mpParent, *mxStyles, 
&(mpViewData->GetDocument()), maWdPreview);
 }
 
-IMPL_LINK(ConditionalFormatEasyDialog, OnEdChanged, weld::Entry&, rEntry, void)
-{
-    ScCondFormatHelper::ValidateInputField(rEntry, *mxWarningLabel, 
mpDocument, maPosition);
-
-    if (!mxWarningLabel->get_label().isEmpty())
-        mxWarningLabel->show();
-    else
-        mxWarningLabel->hide();
-}
-
 } // namespace sc
diff --git a/sc/source/ui/condformat/condformathelper.cxx 
b/sc/source/ui/condformat/condformathelper.cxx
index 24537dec69b3..2584bb701cf2 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -23,8 +23,6 @@
 #include <sfx2/frame.hxx>
 #include <tabvwsh.hxx>
 #include <svx/fntctrl.hxx>
-#include <compiler.hxx>
-#include <globstr.hrc>
 
 namespace {
 
@@ -326,50 +324,4 @@ void ScCondFormatHelper::UpdateStyleList(weld::ComboBox& 
rLbStyle, const ScDocum
     rLbStyle.set_active_text(aSelectedStyle);
 }
 
-void ScCondFormatHelper::ValidateInputField(weld::Entry& rEntry, weld::Label& 
rLabel, ScDocument* pDoc, ScAddress& rPos)
-{
-    OUString aFormula = rEntry.get_text();
-
-    if( aFormula.isEmpty() )
-    {
-        rLabel.set_label(ScResId(STR_ENTER_VALUE));
-        return;
-    }
-
-    ScCompiler aComp( *pDoc, rPos, pDoc->GetGrammar() );
-    aComp.SetExtendedErrorDetection( 
ScCompiler::ExtendedErrorDetection::EXTENDED_ERROR_DETECTION_NAME_BREAK);
-    std::unique_ptr<ScTokenArray> ta(aComp.CompileString(aFormula));
-
-    // Error, warn the user if it is not an unknown name.
-    if (ta->GetCodeError() != FormulaError::NoName && (ta->GetCodeError() != 
FormulaError::NONE || ta->GetLen() == 0))
-    {
-        rEntry.set_message_type(weld::EntryMessageType::Error);
-        rLabel.set_label(ScResId(STR_VALID_DEFERROR));
-        return;
-    }
-
-    // Unrecognized name, warn the user; i.e. happens when starting to type and
-    // will go away once a valid name is completed.
-    if (ta->GetCodeError() == FormulaError::NoName)
-    {
-        rEntry.set_message_type(weld::EntryMessageType::Warning);
-        rLabel.set_label(ScResId(STR_UNQUOTED_STRING));
-        return;
-    }
-
-    // Generate RPN to detect further errors.
-    if (ta->GetLen() > 0)
-        aComp.CompileTokenArray();
-    // Error, warn the user.
-    if (ta->GetCodeError() != FormulaError::NONE || (ta->GetCodeLen() == 0))
-    {
-        rEntry.set_message_type(weld::EntryMessageType::Error);
-        rLabel.set_label(ScResId(STR_VALID_DEFERROR));
-        return;
-    }
-
-    rEntry.set_message_type(weld::EntryMessageType::Normal);
-    rLabel.set_label("");
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index efb2f03aafde..baa6208dc061 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -34,7 +34,6 @@ public:
 
     DECL_LINK(ButtonPressed, weld::Button&, void);
     DECL_LINK(StyleSelectHdl, weld::ComboBox&, void);
-    DECL_LINK(OnEdChanged, weld::Entry&, void);
 
 private:
     void SetDescription(std::u16string_view rCondition);
@@ -51,7 +50,6 @@ private:
     std::unique_ptr<weld::Entry> mxNumberEntry;
     std::unique_ptr<weld::Entry> mxNumberEntry2;
     std::unique_ptr<weld::Container> mxAllInputs;
-    std::unique_ptr<weld::Label> mxWarningLabel;
     std::unique_ptr<formula::RefEdit> mxRangeEntry;
     std::unique_ptr<formula::RefButton> mxButtonRangeEdit;
     std::unique_ptr<weld::ComboBox> mxStyles;
diff --git a/sc/source/ui/inc/condformathelper.hxx 
b/sc/source/ui/inc/condformathelper.hxx
index 34c619db364a..35e3b5c9e9be 100644
--- a/sc/source/ui/inc/condformathelper.hxx
+++ b/sc/source/ui/inc/condformathelper.hxx
@@ -36,7 +36,6 @@ public:
                                          const ScDocument* pDoc, 
SvxFontPrevWindow& rWdPreview);
     static SC_DLLPUBLIC void FillStyleListBox(const ScDocument* pDocument, 
weld::ComboBox& rCombo);
     static SC_DLLPUBLIC void UpdateStyleList(weld::ComboBox& rLbStyle, const 
ScDocument* pDoc);
-    static SC_DLLPUBLIC void ValidateInputField(weld::Entry& rEntry, 
weld::Label& label, ScDocument* pDoc, ScAddress& rPos);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index f680229e58c1..ea7833ef6227 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -188,17 +188,6 @@
                 <property name="position">0</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkLabel" id="warning">
-                <property name="visible">False</property>
-                <property name="can-focus">False</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkFrame">
                 <property name="visible">True</property>
@@ -262,7 +251,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -289,7 +278,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">3</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>

Reply via email to