sc/source/ui/dbgui/scuiasciiopt.cxx |   19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

New commits:
commit 72f2474e085924f852b9cf64ae805dfaa28e7f08
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Jun 4 17:40:30 2025 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jun 9 11:15:11 2025 +0200

    Related: tdf#166208 Drop bBeforeDetection
    
    It was intended to detect the first use of the text import dialog
    after introduction of the automatic encoding detection feature.
    But since the schema for SeparatorType property, which was used
    for the detection, defined it as non-nillable, the property has
    a value always, so the detection is impossible. It means that the
    detection code may be removed.
    
    The detection, if it worked, would prevent tdf#166208; it would
    select automatic encoding detection, and prevent the shift of the
    old selection by one.
    
    Change-Id: I1ba661476531987633e0ed0a100bf798aa01a9f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186239
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 58dc72c6f29a3ad4cbea09803d6c568b96f80c08)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186245
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 05d3f6ac9c33..01ed46b0d90b 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -75,7 +75,6 @@ enum SeparatorType
 constexpr OUString CSVIO_MergeDelimiters = u"MergeDelimiters"_ustr;
 constexpr OUString CSVIO_Separators = u"Separators"_ustr;
 constexpr OUString CSVIO_TextSeparators = u"TextSeparators"_ustr;
-constexpr OUString CSVIO_FixedWidth = u"FixedWidth"_ustr;
 constexpr OUString CSVIO_RemoveSpace = u"RemoveSpace"_ustr;
 constexpr OUString CSVIO_EvaluateFormulas = u"EvaluateFormulas"_ustr;
 constexpr OUString CSVIO_SeparatorType = u"SeparatorType"_ustr;
@@ -161,14 +160,12 @@ static void lcl_LoadSeparators(ScImportAsciiCall eCall, 
OUString& rFieldSeparato
                              bool& rMergeDelimiters, bool& rQuotedAsText, 
bool& rDetectSpecialNum, bool& rDetectScientificNum,
                              SeparatorType& rSepType, sal_Int32& rFromRow, 
sal_Int32& rCharSet,
                              sal_Int32& rLanguage, bool& rSkipEmptyCells, 
bool& rRemoveSpace,
-                             bool& rEvaluateFormulas, bool& rBeforeDetection)
+                             bool& rEvaluateFormulas)
 {
     ScLinkConfigItem aItem(lcl_GetConfigPath(eCall));
     const Sequence<OUString> aNames = aItem.GetNodeNames({});
     const Sequence<Any> aValues = aItem.GetProperties(aNames);
 
-    rBeforeDetection = true;
-
     for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
     {
         const OUString& name = aNames[i];
@@ -184,15 +181,7 @@ static void lcl_LoadSeparators(ScImportAsciiCall eCall, 
OUString& rFieldSeparato
         else if (name == CSVIO_TextSeparators)
             value >>= rTextSeparators;
         else if (name == CSVIO_SeparatorType)
-        {
-            rBeforeDetection = false;
             rSepType = 
static_cast<SeparatorType>(ScUnoHelpFunctions::GetInt16FromAny(value));
-        }
-        else if (name == CSVIO_FixedWidth)
-        {
-            if (rBeforeDetection && ScUnoHelpFunctions::GetBoolFromAny(value))
-                rSepType = SeparatorType::FIXED;
-        }
         else if (name == CSVIO_EvaluateFormulas)
             rEvaluateFormulas = ScUnoHelpFunctions::GetBoolFromAny(value);
         else if (name == CSVIO_FromRow)
@@ -325,15 +314,13 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
std::u16string_view aD
     bool bEvaluateFormulas = (meCall != SC_IMPORTFILE);
     bool bSkipEmptyCells = true;
     bool bRemoveSpace = false;
-    bool bBeforeDetection = false;
     sal_Int32 nFromRow = 1;
     sal_Int32 nCharSet = -1;
     sal_Int32 nLanguage = 0;
 
     lcl_LoadSeparators ( meCall, sFieldSeparators, sTextSeparators, 
bMergeDelimiters,
                          bQuotedFieldAsText, bDetectSpecialNum, 
bDetectScientificNum, eSepType, nFromRow,
-                         nCharSet, nLanguage, bSkipEmptyCells, bRemoveSpace, 
bEvaluateFormulas,
-                         bBeforeDetection);
+                         nCharSet, nLanguage, bSkipEmptyCells, bRemoveSpace, 
bEvaluateFormulas);
 
     maFieldSeparators = sFieldSeparators;
 
@@ -434,7 +421,7 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
std::u16string_view aD
 
     if (ePreselectUnicode != RTL_TEXTENCODING_DONTKNOW)
         mxLbCharSet->SelectTextEncoding( ePreselectUnicode );
-    else if (nCharSet >= 0 && !bBeforeDetection)
+    else if (nCharSet >= 0)
         mxLbCharSet->set_active(nCharSet);
     else
         mxLbCharSet->SelectTextEncoding(RTL_TEXTENCODING_USER_DETECTED);

Reply via email to