sc/source/ui/dbgui/scuiasciiopt.cxx |   25 +++++++++++++++----------
 sc/source/ui/inc/scuiasciiopt.hxx   |    1 +
 2 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 983644d061e1415c7c5554dd6fd51fe1043e9b9a
Author:     Laurent Balland <laurent.ball...@mailo.fr>
AuthorDate: Sat Jun 3 14:52:45 2023 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Tue Jun 27 17:41:43 2023 +0200

    Import CSV: remove erroneous warning
    
    If Fixed width is selected, clicking on any option in Other section 
generates a
    warning about option not allowed, which is wrong. Only checkboxes in
    Seprator section are not allowed
    
    Change-Id: I3fc6fd6ac870e8c681aae8fd1d033b550d9bc20d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152573
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 61fa2d697251..601323a6586d 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -506,20 +506,21 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
std::u16string_view aD
     mcTextSep = lcl_CharFromCombo(*mxCbTextSep, SCSTR_TEXTSEP);
 
     Link<weld::Toggleable&,void> aSeparatorClickHdl =LINK( this, 
ScImportAsciiDlg, SeparatorClickHdl );
+    Link<weld::Toggleable&,void> aOtherOptionsClickHdl =LINK( this, 
ScImportAsciiDlg, OtherOptionsClickHdl );
     mxCbTextSep->connect_changed( LINK( this, ScImportAsciiDlg, 
SeparatorComboBoxHdl ) );
     mxCkbTab->connect_toggled( aSeparatorClickHdl );
     mxCkbSemicolon->connect_toggled( aSeparatorClickHdl );
     mxCkbComma->connect_toggled( aSeparatorClickHdl );
     mxCkbAsOnce->connect_toggled( aSeparatorClickHdl );
-    mxCkbQuotedAsText->connect_toggled( aSeparatorClickHdl );
-    mxCkbDetectNumber->connect_toggled( aSeparatorClickHdl );
-    mxCkbDetectScientificNumber->connect_toggled( aSeparatorClickHdl );
-    mxCkbEvaluateFormulas->connect_toggled( aSeparatorClickHdl );
-    mxCkbSkipEmptyCells->connect_toggled( aSeparatorClickHdl );
     mxCkbSpace->connect_toggled( aSeparatorClickHdl );
     mxCkbRemoveSpace->connect_toggled( aSeparatorClickHdl );
     mxCkbOther->connect_toggled( aSeparatorClickHdl );
     mxEdOther->connect_changed(LINK(this, ScImportAsciiDlg, SeparatorEditHdl));
+    mxCkbQuotedAsText->connect_toggled( aOtherOptionsClickHdl );
+    mxCkbDetectNumber->connect_toggled( aOtherOptionsClickHdl );
+    mxCkbDetectScientificNumber->connect_toggled( aOtherOptionsClickHdl );
+    mxCkbEvaluateFormulas->connect_toggled( aOtherOptionsClickHdl );
+    mxCkbSkipEmptyCells->connect_toggled( aOtherOptionsClickHdl );
 
     // *** text encoding ListBox ***
     // all encodings allowed, including Unicode, but subsets are excluded
@@ -837,12 +838,9 @@ IMPL_LINK( ScImportAsciiDlg, SeparatorEditHdl, 
weld::Entry&, rEdit, void )
     SeparatorHdl(&rEdit);
 }
 
-void ScImportAsciiDlg::SeparatorHdl(const weld::Widget* pCtrl)
+IMPL_LINK(ScImportAsciiDlg, OtherOptionsClickHdl, weld::Toggleable&, rCtrl, 
void)
 {
-    OSL_ENSURE( pCtrl, "ScImportAsciiDlg::SeparatorHdl - missing sender" );
-    OSL_ENSURE( !mxRbFixed->get_active(), "ScImportAsciiDlg::SeparatorHdl - 
not allowed in fixed width" );
-
-    if (pCtrl == mxCkbDetectNumber.get())
+    if (&rCtrl == mxCkbDetectNumber.get())
     {
         if (mxCkbDetectNumber->get_active())
         {
@@ -853,6 +851,13 @@ void ScImportAsciiDlg::SeparatorHdl(const weld::Widget* 
pCtrl)
             mxCkbDetectScientificNumber->set_sensitive(true);
         return;
     }
+}
+
+void ScImportAsciiDlg::SeparatorHdl(const weld::Widget* pCtrl)
+{
+    OSL_ENSURE( pCtrl, "ScImportAsciiDlg::SeparatorHdl - missing sender" );
+    OSL_ENSURE( !mxRbFixed->get_active(), "ScImportAsciiDlg::SeparatorHdl - 
not allowed in fixed width" );
+
     /*  #i41550# First update state of the controls. The GetSeparators()
         function needs final state of the check boxes. */
     if (pCtrl == mxCkbOther.get() && mxCkbOther->get_active())
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx 
b/sc/source/ui/inc/scuiasciiopt.hxx
index a96f2f591320..309192477ecf 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -111,6 +111,7 @@ private:
                                 DECL_LINK( RbSepFixHdl, weld::Toggleable&, 
void );
                                 DECL_LINK( SeparatorEditHdl, weld::Entry&, 
void );
                                 DECL_LINK( SeparatorClickHdl, 
weld::Toggleable&, void );
+                                DECL_LINK( OtherOptionsClickHdl, 
weld::Toggleable&, void );
                                 DECL_LINK( SeparatorComboBoxHdl, 
weld::ComboBox&, void );
                                 void SeparatorHdl(const weld::Widget*);
                                 DECL_LINK( LbColTypeHdl, weld::ComboBox&, void 
);

Reply via email to