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

New commits:
commit 58dc72c6f29a3ad4cbea09803d6c568b96f80c08
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Jun 4 17:40:30 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Jun 7 12:04:43 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>

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 4b99b39e9889..8370ee76fb12 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -77,7 +77,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;
@@ -163,14 +162,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];
@@ -186,15 +183,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)
@@ -335,15 +324,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;
 
@@ -440,7 +427,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