[Libreoffice-commits] core.git: officecfg/registry sc/source sc/uiconfig

Laurent BP laurent.balland-poirier at laposte.net
Thu Dec 21 22:16:45 UTC 2017


 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |   14 
 sc/source/ui/dbgui/scuiasciiopt.cxx                      |  235 ++++++++-------
 sc/source/ui/docshell/impex.cxx                          |   21 -
 sc/source/ui/inc/asciiopt.hxx                            |    3 
 sc/source/ui/inc/scuiasciiopt.hxx                        |    1 
 sc/uiconfig/scalc/ui/textimportcsv.ui                    |   18 +
 6 files changed, 185 insertions(+), 107 deletions(-)

New commits:
commit 3bd4957191f12457c17404645bab0794639c95f8
Author: Laurent BP <laurent.balland-poirier at laposte.net>
Date:   Sun Dec 17 17:14:55 2017 +0100

    tdf#113979 Add option to Skip empty cells
    
    During "Txt to column", empty cells should erase previous content
    (see tdf#69981)
    But during paste, user may want to keep previous content.
    This option makes all users happy.
    During import of CSV file, this option is hidden.
    
    In the same time, I've tried to remove some duplicate code.
    Update: properties offsets are now enum and replace define const
    
    Change-Id: I88be2d0432ff804033cff050422e666fa2882efd
    Reviewed-on: https://gerrit.libreoffice.org/46651
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 42d535a6a795..2d5e7a8696e0 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1177,6 +1177,13 @@
           </info>
           <value>true</value>
         </prop>
+        <prop oor:name="SkipEmptyCells" oor:type="xs:boolean" oor:nillable="false">
+          <info>
+            <desc>If true, Calc preserves previous content of cells when pasting empty ones. If false, Calc delete content of previous cells.</desc>
+            <label>SkipEmptyCells</label>
+          </info>
+          <value>true</value>
+        </prop>
         <prop oor:name="Language" oor:type="xs:int" oor:nillable="false">
           <info>
             <desc>Language to use for CSV import.  This determines how the numbers are parsed.</desc>
@@ -1245,6 +1252,13 @@
           </info>
           <value>	</value>
         </prop>
+        <prop oor:name="SkipEmptyCells" oor:type="xs:boolean" oor:nillable="false">
+          <info>
+            <desc>If true, Calc preserves previous content of cells when pasting empty ones. If false, Calc delete content of previous cells.</desc>
+            <label>SkipEmptyCells</label>
+          </info>
+          <value>false</value>
+        </prop>
         <prop oor:name="TextSeparators" oor:type="xs:string" oor:nillable="false">
           <info>
             <desc>Text Separators</desc>
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index ec3604fde5c7..69cfdc65324a 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -52,18 +52,37 @@ const SCSIZE ASCIIDLG_MAXROWS                = MAXROWCOUNT;
 using namespace com::sun::star::uno;
 
 // Defines - CSV Import Preserve Options
-#define FIXED_WIDTH         "FixedWidth"
-#define FROM_ROW            "FromRow"
-#define CHAR_SET            "CharSet"
-#define SEPARATORS          "Separators"
-#define TEXT_SEPARATORS     "TextSeparators"
-#define MERGE_DELIMITERS    "MergeDelimiters"
-#define QUOTED_AS_TEXT      "QuotedFieldAsText"
-#define DETECT_SPECIAL_NUM  "DetectSpecialNumbers"
-#define LANGUAGE            "Language"
-#define SEP_PATH            "Office.Calc/Dialogs/CSVImport"
-#define SEP_PATH_CLPBRD     "Office.Calc/Dialogs/ClipboardTextImport"
-#define SEP_PATH_TEXT2COL   "Office.Calc/Dialogs/TextToColumnsImport"
+enum CSVImportOptionsIndex
+{
+    CSVIO_MergeDelimiters = 0,
+    CSVIO_Separators,
+    CSVIO_TextSeparators,
+    CSVIO_FixedWidth,
+    CSVIO_FromRow,
+    CSVIO_Text2ColSkipEmptyCells = CSVIO_FromRow,
+    CSVIO_CharSet,
+    CSVIO_QuotedAsText,
+    CSVIO_DetectSpecialNum,
+    CSVIO_Language,
+    CSVIO_PasteSkipEmptyCells
+};
+
+const ::std::vector<OUString> CSVImportOptionNames =
+{
+    "MergeDelimiters",
+    "Separators",
+    "TextSeparators",
+    "FixedWidth",
+    "FromRow",
+    "CharSet",
+    "QuotedFieldAsText",
+    "DetectSpecialNumbers",
+    "Language",
+    "SkipEmptyCells"
+};
+const OUString aSep_Path =           "Office.Calc/Dialogs/CSVImport";
+const OUString aSep_Path_Clpbrd =    "Office.Calc/Dialogs/ClipboardTextImport";
+const OUString aSep_Path_Text2Col =  "Office.Calc/Dialogs/TextToColumnsImport";
 
 static void lcl_FillCombo( ComboBox& rCombo, const OUString& rList, sal_Unicode cSelect )
 {
@@ -110,129 +129,134 @@ static sal_Unicode lcl_CharFromCombo( const ComboBox& rCombo, const OUString& rL
     return c;
 }
 
-static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators,
-                             bool &bMergeDelimiters, bool& bQuotedAsText, bool& bDetectSpecialNum,
-                             bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet,
-                             sal_Int32& nLanguage, ScImportAsciiCall eCall )
+void lcl_CreatePropertiesNames ( OUString& rSepPath, Sequence<OUString>& rNames, ScImportAsciiCall eCall )
 {
-    Sequence<Any>aValues;
-    const Any *pProperties;
-    Sequence<OUString> aNames( eCall == SC_TEXTTOCOLUMNS ? 4 : 9 );
-    OUString* pNames = aNames.getArray();
-    OUString aSepPath;
+    sal_Int32 nProperties = 0;
+
     switch(eCall)
     {
         case SC_IMPORTFILE:
-            aSepPath = SEP_PATH;
+            rSepPath = aSep_Path;
+            nProperties = 9;
             break;
         case SC_PASTETEXT:
-            aSepPath = SEP_PATH_CLPBRD;
+            rSepPath = aSep_Path_Clpbrd;
+            nProperties = 10;
             break;
         case SC_TEXTTOCOLUMNS:
         default:
-            aSepPath = SEP_PATH_TEXT2COL;
+            rSepPath = aSep_Path_Text2Col;
+            nProperties = 5;
             break;
     }
-    ScLinkConfigItem aItem( aSepPath );
-
-    pNames[0] = MERGE_DELIMITERS;
-    pNames[1] = SEPARATORS;
-    pNames[2] = TEXT_SEPARATORS;
-    pNames[3] = FIXED_WIDTH;
+    rNames.realloc( nProperties );
+    OUString* pNames = rNames.getArray();
+    pNames[ CSVIO_MergeDelimiters ] =   CSVImportOptionNames[ CSVIO_MergeDelimiters ];
+    pNames[ CSVIO_Separators ] =        CSVImportOptionNames[ CSVIO_Separators ];
+    pNames[ CSVIO_TextSeparators ] =    CSVImportOptionNames[ CSVIO_TextSeparators ];
+    pNames[ CSVIO_FixedWidth ] =        CSVImportOptionNames[ CSVIO_FixedWidth ];
     if (eCall != SC_TEXTTOCOLUMNS)
     {
-        pNames[4] = FROM_ROW;
-        pNames[5] = CHAR_SET;
-        pNames[6] = QUOTED_AS_TEXT;
-        pNames[7] = DETECT_SPECIAL_NUM;
-        pNames[8] = LANGUAGE;
+        pNames[ CSVIO_FromRow ] =       CSVImportOptionNames[ CSVIO_FromRow ];
+        pNames[ CSVIO_CharSet ] =       CSVImportOptionNames[ CSVIO_CharSet ];
+        pNames[ CSVIO_QuotedAsText ] =  CSVImportOptionNames[ CSVIO_QuotedAsText ];
+        pNames[ CSVIO_DetectSpecialNum ] = CSVImportOptionNames[ CSVIO_DetectSpecialNum ];
+        pNames[ CSVIO_Language ] =      CSVImportOptionNames[ CSVIO_Language ];
+    }
+    if (eCall != SC_IMPORTFILE)
+    {
+        pNames[ eCall == SC_TEXTTOCOLUMNS ?
+                CSVIO_Text2ColSkipEmptyCells :
+                CSVIO_PasteSkipEmptyCells ] = CSVImportOptionNames[ CSVIO_PasteSkipEmptyCells ];
     }
+}
+
+static void lcl_LoadSeparators( OUString& rFieldSeparators, OUString& rTextSeparators,
+                             bool& rMergeDelimiters, bool& rQuotedAsText, bool& rDetectSpecialNum,
+                             bool& rFixedWidth, sal_Int32& rFromRow, sal_Int32& rCharSet,
+                             sal_Int32& rLanguage, bool& rSkipEmptyCells, ScImportAsciiCall eCall )
+{
+    Sequence<Any>aValues;
+    const Any *pProperties;
+    Sequence<OUString> aNames;
+    OUString aSepPath;
+    lcl_CreatePropertiesNames ( aSepPath, aNames, eCall);
+    ScLinkConfigItem aItem( aSepPath );
     aValues = aItem.GetProperties( aNames );
     pProperties = aValues.getConstArray();
 
-    if( pProperties[0].hasValue() )
-        bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] );
+    if( pProperties[ CSVIO_MergeDelimiters ].hasValue() )
+        rMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[ CSVIO_MergeDelimiters ] );
 
-    if( pProperties[1].hasValue() )
-        pProperties[1] >>= sFieldSeparators;
+    if( pProperties[ CSVIO_Separators ].hasValue() )
+        pProperties[ CSVIO_Separators ] >>= rFieldSeparators;
 
-    if( pProperties[2].hasValue() )
-        pProperties[2] >>= sTextSeparators;
+    if( pProperties[ CSVIO_TextSeparators ].hasValue() )
+        pProperties[ CSVIO_TextSeparators ] >>= rTextSeparators;
 
-    if( pProperties[3].hasValue() )
-        bFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[3] );
+    if( pProperties[ CSVIO_FixedWidth ].hasValue() )
+        rFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[ CSVIO_FixedWidth ] );
 
     if (eCall != SC_TEXTTOCOLUMNS)
     {
-        if( pProperties[4].hasValue() )
-            pProperties[4] >>= nFromRow;
+        if( pProperties[ CSVIO_FromRow ].hasValue() )
+            pProperties[ CSVIO_FromRow ] >>= rFromRow;
 
-        if( pProperties[5].hasValue() )
-            pProperties[5] >>= nCharSet;
+        if( pProperties[ CSVIO_CharSet ].hasValue() )
+            pProperties[ CSVIO_CharSet ] >>= rCharSet;
 
-        if ( pProperties[6].hasValue() )
-            pProperties[6] >>= bQuotedAsText;
+        if ( pProperties[ CSVIO_QuotedAsText ].hasValue() )
+            pProperties[ CSVIO_QuotedAsText ] >>= rQuotedAsText;
 
-        if ( pProperties[7].hasValue() )
-            pProperties[7] >>= bDetectSpecialNum;
+        if ( pProperties[ CSVIO_DetectSpecialNum ].hasValue() )
+            pProperties[ CSVIO_DetectSpecialNum ] >>= rDetectSpecialNum;
 
-        if ( pProperties[8].hasValue() )
-            pProperties[8] >>= nLanguage;
+        if ( pProperties[ CSVIO_Language ].hasValue() )
+            pProperties[ CSVIO_Language ] >>= rLanguage;
+    }
+    if (eCall != SC_IMPORTFILE)
+    {
+        sal_Int32 nSkipEmptyCells = eCall == SC_TEXTTOCOLUMNS ?
+                                    CSVIO_Text2ColSkipEmptyCells :
+                                    CSVIO_PasteSkipEmptyCells;
+        if( pProperties[nSkipEmptyCells].hasValue() )
+            rSkipEmptyCells = ScUnoHelpFunctions::GetBoolFromAny( pProperties[nSkipEmptyCells] );
     }
 }
 
-static void save_Separators(
-    const OUString& maSeparators, const OUString& maTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
+static void lcl_SaveSeparators(
+    const OUString& rSeparators, const OUString& rTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
     bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow,
-    sal_Int32 nCharSet, sal_Int32 nLanguage, ScImportAsciiCall eCall )
+    sal_Int32 nCharSet, sal_Int32 nLanguage, bool bSkipEmptyCells, ScImportAsciiCall eCall )
 {
-    OUString sFieldSeparators = maSeparators;
-    OUString sTextSeparators = maTxtSep;
+    OUString sFieldSeparators = rSeparators;
+    OUString sTextSeparators = rTxtSep;
     Sequence<Any> aValues;
     Any *pProperties;
-    Sequence<OUString> aNames( eCall == SC_TEXTTOCOLUMNS ? 4 : 9 );
-    OUString* pNames = aNames.getArray();
+    Sequence<OUString> aNames;
     OUString aSepPath;
-    switch(eCall)
-    {
-        case SC_IMPORTFILE:
-            aSepPath = SEP_PATH;
-            break;
-        case SC_PASTETEXT:
-            aSepPath = SEP_PATH_CLPBRD;
-            break;
-        case SC_TEXTTOCOLUMNS:
-        default:
-            aSepPath = SEP_PATH_TEXT2COL;
-            break;
-    }
+    lcl_CreatePropertiesNames ( aSepPath, aNames, eCall );
     ScLinkConfigItem aItem( aSepPath );
+    aValues = aItem.GetProperties( aNames );
+    pProperties = aValues.getArray();
 
-    pNames[0] = MERGE_DELIMITERS;
-    pNames[1] = SEPARATORS;
-    pNames[2] = TEXT_SEPARATORS;
-    pNames[3] = FIXED_WIDTH;
+    pProperties[ CSVIO_MergeDelimiters ] <<= bMergeDelimiters;
+    pProperties[ CSVIO_Separators ] <<= sFieldSeparators;
+    pProperties[ CSVIO_TextSeparators ] <<= sTextSeparators;
+    pProperties[ CSVIO_FixedWidth ] <<= bFixedWidth;
     if (eCall != SC_TEXTTOCOLUMNS)
     {
-        pNames[4] = FROM_ROW;
-        pNames[5] = CHAR_SET;
-        pNames[6] = QUOTED_AS_TEXT;
-        pNames[7] = DETECT_SPECIAL_NUM;
-        pNames[8] = LANGUAGE;
+        pProperties[ CSVIO_FromRow ] <<= nFromRow;
+        pProperties[ CSVIO_CharSet ] <<= nCharSet;
+        pProperties[ CSVIO_QuotedAsText ] <<= bQuotedAsText;
+        pProperties[ CSVIO_DetectSpecialNum ] <<= bDetectSpecialNum;
+        pProperties[ CSVIO_Language ] <<= nLanguage;
     }
-    aValues = aItem.GetProperties( aNames );
-    pProperties = aValues.getArray();
-    pProperties[0] <<= bMergeDelimiters;
-    pProperties[1] <<= sFieldSeparators;
-    pProperties[2] <<= sTextSeparators;
-    pProperties[3] <<= bFixedWidth;
-    if (eCall != SC_TEXTTOCOLUMNS)
+    if (eCall != SC_IMPORTFILE)
     {
-        pProperties[4] <<= nFromRow;
-        pProperties[5] <<= nCharSet;
-        pProperties[6] <<= bQuotedAsText;
-        pProperties[7] <<= bDetectSpecialNum;
-        pProperties[8] <<= nLanguage;
+        pProperties[ eCall == SC_TEXTTOCOLUMNS ?
+                                CSVIO_Text2ColSkipEmptyCells :
+                                CSVIO_PasteSkipEmptyCells ] <<= bSkipEmptyCells;
     }
 
     aItem.PutProperties(aNames, aValues);
@@ -275,6 +299,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
     get(pCbTextSep, "textdelimiter");
     get(pCkbQuotedAsText, "quotedfieldastext");
     get(pCkbDetectNumber, "detectspecialnumbers");
+    get(pCkbSkipEmptyCells, "skipemptycells");
     get(pFtType, "textcolumntype");
     get(pLbType, "columntype");
     get(mpTableBox, "scrolledwindowcolumntype");
@@ -303,11 +328,13 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
     bool bFixedWidth = false;
     bool bQuotedFieldAsText = false;
     bool bDetectSpecialNum = true;
+    bool bSkipEmptyCells = true;
     sal_Int32 nFromRow = 1;
     sal_Int32 nCharSet = -1;
     sal_Int32 nLanguage = 0;
-    load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters,
-                         bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage, meCall);
+    lcl_LoadSeparators (sFieldSeparators, sTextSeparators, bMergeDelimiters,
+                         bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow,
+                         nCharSet, nLanguage, bSkipEmptyCells, meCall);
     // load from saved settings
     maFieldSeparators = sFieldSeparators;
 
@@ -317,6 +344,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
         pCkbQuotedAsText->Check();
     if (bDetectSpecialNum)
         pCkbDetectNumber->Check();
+    if (bSkipEmptyCells)
+        pCkbSkipEmptyCells->Check();
     if( bFixedWidth && !bIsTSV )
         pRbFixed->Check();
     if( nFromRow != 1 )
@@ -390,6 +419,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
     pCkbAsOnce->SetClickHdl( aSeparatorClickHdl );
     pCkbQuotedAsText->SetClickHdl( aSeparatorClickHdl );
     pCkbDetectNumber->SetClickHdl( aSeparatorClickHdl );
+    pCkbSkipEmptyCells->SetClickHdl( aSeparatorClickHdl );
     pCkbSpace->SetClickHdl( aSeparatorClickHdl );
     pCkbOther->SetClickHdl( aSeparatorClickHdl );
     pEdOther->SetModifyHdl( aSeparatorHdl );
@@ -468,6 +498,12 @@ ScImportAsciiDlg::ScImportAsciiDlg( vcl::Window* pParent, const OUString& aDatNa
         pCkbDetectNumber->Check();
         pCkbDetectNumber->Disable();
     }
+    if (meCall == SC_IMPORTFILE)
+    {
+        //Empty cells in imported file are empty
+        pCkbSkipEmptyCells->Check(false);
+        pCkbSkipEmptyCells->Hide();
+    }
 }
 
 ScImportAsciiDlg::~ScImportAsciiDlg()
@@ -497,6 +533,7 @@ void ScImportAsciiDlg::dispose()
     pCbTextSep.clear();
     pCkbQuotedAsText.clear();
     pCkbDetectNumber.clear();
+    pCkbSkipEmptyCells.clear();
     pFtType.clear();
     pLbType.clear();
     mpTableBox.clear();
@@ -584,16 +621,18 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
 
     rOpt.SetQuotedAsText(pCkbQuotedAsText->IsChecked());
     rOpt.SetDetectSpecialNumber(pCkbDetectNumber->IsChecked());
+    rOpt.SetSkipEmptyCells(pCkbSkipEmptyCells->IsChecked());
 }
 
 void ScImportAsciiDlg::SaveParameters()
 {
-    save_Separators( maFieldSeparators, pCbTextSep->GetText(), pCkbAsOnce->IsChecked(),
+    lcl_SaveSeparators( maFieldSeparators, pCbTextSep->GetText(), pCkbAsOnce->IsChecked(),
                      pCkbQuotedAsText->IsChecked(), pCkbDetectNumber->IsChecked(),
                      pRbFixed->IsChecked(),
                      static_cast<sal_Int32>(pNfRow->GetValue()),
                      pLbCharSet->GetSelectedEntryPos(),
-                     static_cast<sal_uInt16>(pLbCustomLang->GetSelectLanguage()), meCall );
+                     static_cast<sal_uInt16>(pLbCustomLang->GetSelectLanguage()),
+                     pCkbSkipEmptyCells->IsChecked(), meCall );
 }
 
 void ScImportAsciiDlg::SetSeparators()
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index e11fb4eec704..175f3a6b3a07 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -932,7 +932,7 @@ bool ScImportExport::Text2Doc( SvStream& rStrm )
 static bool lcl_PutString(
     ScDocumentImport& rDocImport, bool bUseDocImport,
     SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rStr, sal_uInt8 nColFormat,
-    SvNumberFormatter* pFormatter, bool bDetectNumFormat,
+    SvNumberFormatter* pFormatter, bool bDetectNumFormat, bool bSkipEmptyCells,
     const ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar,
     const ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar )
 {
@@ -940,11 +940,15 @@ static bool lcl_PutString(
     bool bMultiLine = false;
     if ( nColFormat == SC_COL_SKIP || !ValidCol(nCol) || !ValidRow(nRow) )
         return bMultiLine;
-    if ( rStr.isEmpty() ) {
-        if ( bUseDocImport )
-            rDocImport.setAutoInput(ScAddress(nCol, nRow, nTab), rStr );
-        else
-            pDoc->SetString( nCol, nRow, nTab, rStr );
+    if ( rStr.isEmpty() )
+    {
+        if ( !bSkipEmptyCells )
+        {   // delete destination cell
+            if ( bUseDocImport )
+                rDocImport.setAutoInput(ScAddress(nCol, nRow, nTab), rStr );
+            else
+                pDoc->SetString( nCol, nRow, nTab, rStr );
+        }
         return false;
     }
 
@@ -1292,6 +1296,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
     LanguageType eDocLang = pExtOptions->GetLanguage();
     SvNumberFormatter aNumFormatter( comphelper::getProcessComponentContext(), eDocLang);
     bool bDetectNumFormat = pExtOptions->IsDetectSpecialNumber();
+    bool bSkipEmptyCells = pExtOptions->IsSkipEmptyCells();
 
     // For date recognition
     ::utl::TransliterationWrapper aTransliteration(
@@ -1381,7 +1386,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
 
                             bMultiLine |= lcl_PutString(
                                 aDocImport, !mbOverwriting, nCol, nRow, nTab, aCell, nFmt,
-                                &aNumFormatter, bDetectNumFormat, aTransliteration, aCalendar,
+                                &aNumFormatter, bDetectNumFormat, bSkipEmptyCells, aTransliteration, aCalendar,
                                 pEnglishTransliteration.get(), pEnglishCalendar.get());
                         }
                         ++nCol;
@@ -1424,7 +1429,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
 
                             bMultiLine |= lcl_PutString(
                                 aDocImport, !mbOverwriting, nCol, nRow, nTab, aCell, nFmt,
-                                &aNumFormatter, bDetectNumFormat, aTransliteration,
+                                &aNumFormatter, bDetectNumFormat, bSkipEmptyCells, aTransliteration,
                                 aCalendar, pEnglishTransliteration.get(), pEnglishCalendar.get());
                         }
                         ++nCol;
diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx
index 5f1bfda2f4ff..cfb2a20660ed 100644
--- a/sc/source/ui/inc/asciiopt.hxx
+++ b/sc/source/ui/inc/asciiopt.hxx
@@ -33,6 +33,7 @@ private:
     bool        bMergeFieldSeps;
     bool        bQuotedFieldAsText;
     bool        bDetectSpecialNumber;
+    bool        bSkipEmptyCells;
     sal_Unicode cTextSep;
     rtl_TextEncoding eCharSet;
     LanguageType eLang;
@@ -57,6 +58,7 @@ public:
     bool                IsMergeSeps() const     { return bMergeFieldSeps; }
     bool                IsQuotedAsText() const  { return bQuotedFieldAsText; }
     bool                IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
+    bool                IsSkipEmptyCells() const      { return bSkipEmptyCells; }
     sal_Unicode         GetTextSep() const      { return cTextSep; }
     bool                IsFixedLen() const      { return bFixedLen; }
     sal_uInt16          GetInfoCount() const    { return mvColStart.size(); }
@@ -72,6 +74,7 @@ public:
     void    SetMergeSeps( bool bSet )           { bMergeFieldSeps = bSet; }
     void    SetQuotedAsText(bool bSet)          { bQuotedFieldAsText = bSet; }
     void    SetDetectSpecialNumber(bool bSet)   { bDetectSpecialNumber = bSet; }
+    void    SetSkipEmptyCells(bool bSet)        { bSkipEmptyCells = bSet; }
     void    SetTextSep( sal_Unicode c )         { cTextSep = c; }
     void    SetStartRow( long nRow)             { nStartRow= nRow; }
     void    SetLanguage(LanguageType e)         { eLang = e; }
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx
index e25904e51569..67f87d523eb0 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -73,6 +73,7 @@ class ScImportAsciiDlg : public ModalDialog
 
     VclPtr<CheckBox>                   pCkbQuotedAsText;
     VclPtr<CheckBox>                   pCkbDetectNumber;
+    VclPtr<CheckBox>                   pCkbSkipEmptyCells;
 
     VclPtr<FixedText>                  pFtType;
     VclPtr<ListBox>                    pLbType;
diff --git a/sc/uiconfig/scalc/ui/textimportcsv.ui b/sc/uiconfig/scalc/ui/textimportcsv.ui
index 91b6a962938c..6605b1974471 100644
--- a/sc/uiconfig/scalc/ui/textimportcsv.ui
+++ b/sc/uiconfig/scalc/ui/textimportcsv.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.18.3 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.0"/>
   <requires lib="LibreOffice" version="1.0"/>
@@ -540,6 +540,22 @@
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="skipemptycells">
+                            <property name="label" translatable="yes" context="textimportcsv|skipemtycells">S_kip empty cells</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </object>
                     </child>
                   </object>


More information about the Libreoffice-commits mailing list