Blame SOURCES/0001-rhbz-1980800-allow-convert-to-csv-to-write-each-shee.patch

17f16b
From aec3e189e6e9aa1eb2fe91cbb1c46f308b074cd5 Mon Sep 17 00:00:00 2001
17f16b
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
17f16b
Date: Tue, 13 Jul 2021 12:38:07 +0100
17f16b
Subject: [PATCH] rhbz#1980800 allow --convert-to csv to write each sheet to a
17f16b
 separate file
17f16b
17f16b
Related: tdf#135762 except only currently implemented for command line use
17f16b
17f16b
sample usage:
17f16b
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,-1 sample.ods
17f16b
where the new (11th!) final token ("-1") enables writing each sheet to a
17f16b
new file based on the suggested target name so output in this example
17f16b
is files sample-Sheet1.csv and sample-Sheet2.csv
17f16b
17f16b
Only -1 for 'all sheets' vs 0 for existing 'current sheet only' (which
17f16b
is always sheet 0 from the command line) are currently options but the
17f16b
token could be expanded in the future to select specific sheets to
17f16b
export.
17f16b
17f16b
Change-Id: Ib99a120f1a2c8d1008a7a3c59a6b39f572fb346e
17f16b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118850
17f16b
Tested-by: Jenkins
17f16b
Reviewed-by: Eike Rathke <erack@redhat.com>
17f16b
(cherry picked from commit b8903bc106dad036acb3d117e5c4fc955697fe02)
17f16b
17f16b
Related: tdf#135762 Allow --convert-to csv to specify 1-based sheet number
17f16b
17f16b
Same multifile mechanism as for -1 all sheets is used, so
17f16b
17f16b
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,2 sample.ods
17f16b
17f16b
writes a file sample-Sheet2.csv
17f16b
17f16b
Change-Id: Ib9248c9561e4e340c88458ac5dfd159e443a4cfd
17f16b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118971
17f16b
Reviewed-by: Eike Rathke <erack@redhat.com>
17f16b
Tested-by: Jenkins
17f16b
(cherry picked from commit fda91f8be16ba760e360940ebafd6244c648cb8c)
17f16b
17f16b
Related: tdf#135762 Suppress cout if not command line
17f16b
17f16b
Change-Id: I9431221aadf97739bb197871f25fa151ef4c391c
17f16b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119294
17f16b
Reviewed-by: Eike Rathke <erack@redhat.com>
17f16b
Tested-by: Jenkins
17f16b
(cherry picked from commit 0cda081c9aa3b3dcb363f97bac60c845ce9a13e0)
17f16b
---
17f16b
 desktop/source/app/dispatchwatcher.cxx |  50 +++++++--
17f16b
 sc/source/ui/dbgui/imoptdlg.cxx        |  16 ++-
17f16b
 sc/source/ui/docshell/docsh.cxx        | 141 +++++++++++++++++++++----
17f16b
 sc/source/ui/inc/docsh.hxx             |   2 +-
17f16b
 sc/source/ui/inc/imoptdlg.hxx          |   6 +-
17f16b
 5 files changed, 179 insertions(+), 36 deletions(-)
17f16b
17f16b
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
17f16b
index 50b92ecb7834..3df4f34ccf83 100644
17f16b
--- a/desktop/source/app/dispatchwatcher.cxx
17f16b
+++ b/desktop/source/app/dispatchwatcher.cxx
17f16b
@@ -30,6 +30,7 @@
17f16b
 #include "officeipcthread.hxx"
17f16b
 #include <rtl/ustring.hxx>
17f16b
 #include <comphelper/processfactory.hxx>
17f16b
+#include <comphelper/string.hxx>
17f16b
 #include <comphelper/synchronousdispatch.hxx>
17f16b
 #include <com/sun/star/io/IOException.hpp>
17f16b
 #include <com/sun/star/util/XCloseable.hpp>
17f16b
@@ -598,6 +599,8 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector
17f16b
                                 aFilter = impl_GuessFilter( aOutFile, aDocService );
17f16b
                             }
17f16b
 
17f16b
+                            bool bMultiFileTarget = false;
17f16b
+
17f16b
                             if (aFilter.isEmpty())
17f16b
                             {
17f16b
                                 std::cerr << "Error: no export filter" << std::endl;
17f16b
@@ -605,29 +608,54 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector
17f16b
                             else
17f16b
                             {
17f16b
                                 sal_Int32 nFilterOptionsIndex = aFilter.indexOf(':');
17f16b
-                                sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 3 : 2;
17f16b
+                                sal_Int32 nProps = ( 0 < nFilterOptionsIndex ) ? 4 : 3;
17f16b
 
17f16b
                                 if ( !aImgOut.isEmpty() )
17f16b
                                     nProps +=1;
17f16b
                                 Sequence<PropertyValue> conversionProperties( nProps );
17f16b
-                                conversionProperties[0].Name = "Overwrite";
17f16b
-                                conversionProperties[0].Value <<= true;
17f16b
+                                conversionProperties[0].Name = "ConversionRequestOrigin";
17f16b
+                                conversionProperties[0].Value <<= OUString("CommandLine");
17f16b
+                                conversionProperties[1].Name = "Overwrite";
17f16b
+                                conversionProperties[1].Value <<= true;
17f16b
 
17f16b
-                                conversionProperties[1].Name = "FilterName";
17f16b
+                                conversionProperties[2].Name = "FilterName";
17f16b
                                 if( 0 < nFilterOptionsIndex )
17f16b
                                 {
17f16b
-                                    conversionProperties[1].Value <<= aFilter.copy(0, nFilterOptionsIndex);
17f16b
+                                    OUString sFilterName = aFilter.copy(0, nFilterOptionsIndex);
17f16b
+                                    OUString sFilterOptions = aFilter.copy(nFilterOptionsIndex + 1);
17f16b
+
17f16b
+                                    if (sFilterName == "Text - txt - csv (StarCalc)")
17f16b
+                                    {
17f16b
+                                        sal_Int32 nIdx(0);
17f16b
+                                        // If the 11th token is '-1' then we export a file
17f16b
+                                        // per sheet where the file name is based on the suggested
17f16b
+                                        // output filename concatenated with the sheet name, so adjust
17f16b
+                                        // the output and overwrite messages
17f16b
+                                        // If the 11th token is not present or numeric 0 then the
17f16b
+                                        // default sheet is exported with the output filename. If it
17f16b
+                                        // is numeric >0 then that sheet (1-based) with the output
17f16b
+                                        // filename concatenated with the sheet name. So even if
17f16b
+                                        // that is a single file, the multi file target mechanism is
17f16b
+                                        // used.
17f16b
+                                        const OUString aTok(sFilterOptions.getToken(11, ',', nIdx));
17f16b
+                                        // Actual validity is checked in Calc, here just check for
17f16b
+                                        // presence of numeric value at start.
17f16b
+                                        bMultiFileTarget = (!aTok.isEmpty() && aTok.toInt32() != 0);
17f16b
+                                    }
17f16b
+
17f16b
+                                    conversionProperties[2].Value <<= sFilterName;
17f16b
 
17f16b
-                                    conversionProperties[2].Name = "FilterOptions";
17f16b
-                                    conversionProperties[2].Value <<= aFilter.copy(nFilterOptionsIndex + 1);
17f16b
+                                    conversionProperties[3].Name = "FilterOptions";
17f16b
+                                    conversionProperties[3].Value <<= sFilterOptions;
17f16b
                                 }
17f16b
                                 else
17f16b
                                 {
17f16b
-                                    conversionProperties[1].Value <<= aFilter;
17f16b
+                                    conversionProperties[2].Value <<= aFilter;
17f16b
                                 }
17f16b
 
17f16b
                                 if ( !aImgOut.isEmpty() )
17f16b
                                 {
17f16b
+                                    assert(conversionProperties[nProps-1].Name.isEmpty());
17f16b
                                     conversionProperties[nProps-1].Name = "ImageFilter";
17f16b
                                     conversionProperties[nProps-1].Value <<= aImgOut;
17f16b
                                 }
17f16b
@@ -639,9 +667,11 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector
17f16b
                                 OString aTargetURL8 = OUStringToOString(aTempName, osl_getThreadTextEncoding());
17f16b
                                 if (aDispatchRequest.aRequestType != REQUEST_CAT)
17f16b
                                 {
17f16b
-                                    std::cout << "convert " << aSource8 << " -> " << aTargetURL8;
17f16b
+                                    std::cout << "convert " << aSource8;
17f16b
+                                    if (!bMultiFileTarget)
17f16b
+                                        std::cout << " -> " << aTargetURL8;
17f16b
                                     std::cout << " using filter : " << OUStringToOString(aFilter, osl_getThreadTextEncoding()) << std::endl;
17f16b
-                                    if (FStatHelper::IsDocument(aOutFile))
17f16b
+                                    if (!bMultiFileTarget && FStatHelper::IsDocument(aOutFile))
17f16b
                                         std::cout << "Overwriting: " << OUStringToOString(aTempName, osl_getThreadTextEncoding()) << std::endl ;
17f16b
                                 }
17f16b
                                 try
17f16b
diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx
17f16b
index 071f1b0257bc..a362e4df0ee7 100644
17f16b
--- a/sc/source/ui/dbgui/imoptdlg.cxx
17f16b
+++ b/sc/source/ui/dbgui/imoptdlg.cxx
17f16b
@@ -20,6 +20,7 @@
17f16b
 #include <imoptdlg.hxx>
17f16b
 #include <asciiopt.hxx>
17f16b
 #include <comphelper/string.hxx>
17f16b
+#include <unotools/charclass.hxx>
17f16b
 #include <osl/thread.h>
17f16b
 #include <global.hxx>
17f16b
 
17f16b
@@ -43,6 +44,7 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
17f16b
     bSaveNumberAsSuch = true;
17f16b
     bSaveFormulas = false;
17f16b
     bRemoveSpace = false;
17f16b
+    nSheetToExport = 0;
17f16b
     sal_Int32 nTokenCount = comphelper::string::getTokenCount(rStr, ',');
17f16b
     if ( nTokenCount < 3 )
17f16b
         return;
17f16b
@@ -77,6 +79,16 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
17f16b
             bSaveFormulas = rStr.getToken(0, ',', nIdx) == "true";
17f16b
         if ( nTokenCount >= 11 )
17f16b
             bRemoveSpace = rStr.getToken(0, ',', nIdx) == "true";
17f16b
+        if ( nTokenCount >= 12 )
17f16b
+        {
17f16b
+            const OUString aTok(rStr.getToken(0, ',', nIdx));
17f16b
+            if (aTok == "-1")
17f16b
+                nSheetToExport = -1;    // all
17f16b
+            else if (aTok.isEmpty() || CharClass::isAsciiNumeric(aTok))
17f16b
+                nSheetToExport = aTok.toInt32();
17f16b
+            else
17f16b
+                nSheetToExport = -23;   // invalid, force error
17f16b
+        }
17f16b
     }
17f16b
 }
17f16b
 
17f16b
@@ -99,7 +111,9 @@ OUString ScImportOptions::BuildString() const
17f16b
             "," +
17f16b
             OUString::boolean( bSaveFormulas ) +  // "save formulas": not in ScAsciiOptions
17f16b
             "," +
17f16b
-            OUString::boolean( bRemoveSpace );    // same as "Remove space" in ScAsciiOptions
17f16b
+            OUString::boolean( bRemoveSpace ) +  // same as "Remove space" in ScAsciiOptions
17f16b
+            "," +
17f16b
+            OUString::number(nSheetToExport) ;  // Only available for command line --convert-to
17f16b
 
17f16b
     return aResult;
17f16b
 }
17f16b
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
17f16b
index 91020db0b2e0..5fdfddd0c89b 100644
17f16b
--- a/sc/source/ui/docshell/docsh.cxx
17f16b
+++ b/sc/source/ui/docshell/docsh.cxx
17f16b
@@ -44,6 +44,7 @@
17f16b
 #include <sfx2/objface.hxx>
17f16b
 #include <sfx2/viewfrm.hxx>
17f16b
 #include <svl/documentlockfile.hxx>
17f16b
+#include <svl/fstathelper.hxx>
17f16b
 #include <svl/sharecontrolfile.hxx>
17f16b
 #include <svl/urihelper.hxx>
17f16b
 #include <osl/file.hxx>
17f16b
@@ -119,6 +120,7 @@
17f16b
 #include <comphelper/processfactory.hxx>
17f16b
 #include <comphelper/string.hxx>
17f16b
 #include <unotools/configmgr.hxx>
17f16b
+#include <unotools/ucbstreamhelper.hxx>
17f16b
 #include <uiitems.hxx>
17f16b
 #include <dpobject.hxx>
17f16b
 #include <markdata.hxx>
17f16b
@@ -1925,7 +1927,7 @@ void escapeTextSep(sal_Int32 nPos, const StrT& rStrDelim, StrT& rStr)
17f16b
 
17f16b
 }
17f16b
 
17f16b
-void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt )
17f16b
+void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt, SCTAB nTab )
17f16b
 {
17f16b
     sal_Unicode cDelim    = rAsciiOpt.nFieldSepCode;
17f16b
     sal_Unicode cStrDelim = rAsciiOpt.nTextSepCode;
17f16b
@@ -1971,7 +1973,6 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
17f16b
 
17f16b
     SCCOL nStartCol = 0;
17f16b
     SCROW nStartRow = 0;
17f16b
-    SCTAB nTab = GetSaveTab();
17f16b
     SCCOL nEndCol;
17f16b
     SCROW nEndRow;
17f16b
     m_aDocument.GetCellArea( nTab, nEndCol, nEndRow );
17f16b
@@ -2389,35 +2390,129 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
17f16b
     }
17f16b
     else if (aFltName == pFilterAscii)
17f16b
     {
17f16b
-        SvStream* pStream = rMed.GetOutStream();
17f16b
-        if (pStream)
17f16b
+        OUString sItStr;
17f16b
+        SfxItemSet*  pSet = rMed.GetItemSet();
17f16b
+        const SfxPoolItem* pItem;
17f16b
+        if ( pSet && SfxItemState::SET ==
17f16b
+             pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
17f16b
         {
17f16b
-            OUString sItStr;
17f16b
-            SfxItemSet*  pSet = rMed.GetItemSet();
17f16b
-            const SfxPoolItem* pItem;
17f16b
-            if ( pSet && SfxItemState::SET ==
17f16b
-                 pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
17f16b
+            sItStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
17f16b
+        }
17f16b
+
17f16b
+        if ( sItStr.isEmpty() )
17f16b
+        {
17f16b
+            //  default for ascii export (from API without options):
17f16b
+            //  ISO8859-1/MS_1252 encoding, comma, double quotes
17f16b
+
17f16b
+            ScImportOptions aDefOptions( ',', '"', RTL_TEXTENCODING_MS_1252 );
17f16b
+            sItStr = aDefOptions.BuildString();
17f16b
+        }
17f16b
+
17f16b
+        weld::WaitObject aWait( GetActiveDialogParent() );
17f16b
+        ScImportOptions aOptions( sItStr );
17f16b
+
17f16b
+        if (aOptions.nSheetToExport)
17f16b
+        {
17f16b
+            // Only from command line --convert-to
17f16b
+            bRet = true;
17f16b
+
17f16b
+            // Verbose only from command line, not UI (in case we actually
17f16b
+            // implement that) nor macro filter options.
17f16b
+            bool bVerbose = false;
17f16b
+            const css::uno::Sequence<css::beans::PropertyValue> & rArgs = rMed.GetArgs();
17f16b
+            const auto pProp = std::find_if( rArgs.begin(), rArgs.end(),
17f16b
+                    [](const css::beans::PropertyValue& rProp) { return rProp.Name == "ConversionRequestOrigin"; });
17f16b
+            if (pProp != rArgs.end())
17f16b
             {
17f16b
-                sItStr = static_cast<const SfxStringItem*>(pItem)->GetValue();
17f16b
+                OUString aOrigin;
17f16b
+                pProp->Value >>= aOrigin;
17f16b
+                bVerbose = (aOrigin == "CommandLine");
17f16b
             }
17f16b
 
17f16b
-            if ( sItStr.isEmpty() )
17f16b
+            SCTAB nStartTab;
17f16b
+            SCTAB nCount = m_aDocument.GetTableCount();
17f16b
+            if (aOptions.nSheetToExport == -1)
17f16b
             {
17f16b
-                //  default for ascii export (from API without options):
17f16b
-                //  ISO8859-1/MS_1252 encoding, comma, double quotes
17f16b
-
17f16b
-                ScImportOptions aDefOptions( ',', '"', RTL_TEXTENCODING_MS_1252 );
17f16b
-                sItStr = aDefOptions.BuildString();
17f16b
+                // All sheets.
17f16b
+                nStartTab = 0;
17f16b
+            }
17f16b
+            else if (0 < aOptions.nSheetToExport && aOptions.nSheetToExport <= nCount)
17f16b
+            {
17f16b
+                // One sheet, 1-based.
17f16b
+                nCount = aOptions.nSheetToExport;
17f16b
+                nStartTab = nCount - 1;
17f16b
+            }
17f16b
+            else
17f16b
+            {
17f16b
+                // Usage error, no export but log.
17f16b
+                if (bVerbose)
17f16b
+                {
17f16b
+                    if (aOptions.nSheetToExport < 0)
17f16b
+                        std::cout << "Bad sheet number string given." << std::endl;
17f16b
+                    else
17f16b
+                        std::cout << "No sheet number " << aOptions.nSheetToExport
17f16b
+                            << ", number of sheets is " << nCount << std::endl;
17f16b
+                }
17f16b
+                nStartTab = 0;
17f16b
+                nCount = 0;
17f16b
+                SetError(SCERR_EXPORT_DATA);
17f16b
+                bRet = false;
17f16b
             }
17f16b
 
17f16b
-            weld::WaitObject aWait( GetActiveDialogParent() );
17f16b
-            ScImportOptions aOptions( sItStr );
17f16b
-            AsciiSave( *pStream, aOptions );
17f16b
-            bRet = true;
17f16b
+            INetURLObject aURLObject(rMed.GetURLObject());
17f16b
+            OUString sExt = aURLObject.CutExtension();
17f16b
+            OUString sBaseName = aURLObject.GetLastName();
17f16b
+            aURLObject.CutLastName();
17f16b
 
17f16b
-            if (m_aDocument.GetTableCount() > 1)
17f16b
-                if (!rMed.GetError())
17f16b
-                    rMed.SetError(SCWARN_EXPORT_ASCII);
17f16b
+            for (SCTAB i = nStartTab; i < nCount; ++i)
17f16b
+            {
17f16b
+                OUString sTabName;
17f16b
+                if (!m_aDocument.GetName(i, sTabName))
17f16b
+                    sTabName = OUString::number(i);
17f16b
+                INetURLObject aSheetURLObject(aURLObject);
17f16b
+                OUString sFileName = sBaseName + "-" + sTabName;
17f16b
+                if (!sExt.isEmpty())
17f16b
+                    sFileName = sFileName + "." + sExt;
17f16b
+                aSheetURLObject.Append(sFileName);
17f16b
+
17f16b
+                // log similar to DispatchWatcher::executeDispatchRequests
17f16b
+                OUString aOutFile = aSheetURLObject.GetMainURL(INetURLObject::DecodeMechanism::NONE);
17f16b
+                if (bVerbose)
17f16b
+                {
17f16b
+                    OUString aDisplayedName;
17f16b
+                    if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(aOutFile, aDisplayedName))
17f16b
+                        aDisplayedName = aOutFile;
17f16b
+                    std::cout << "Writing sheet " << OUStringToOString(sTabName, osl_getThreadTextEncoding()) << " -> "
17f16b
+                                                  << OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
17f16b
+                                                  << std::endl;
17f16b
+
17f16b
+                    if (FStatHelper::IsDocument(aOutFile))
17f16b
+                        std::cout << "Overwriting: " << OUStringToOString(aDisplayedName, osl_getThreadTextEncoding())
17f16b
+                                                     << std::endl ;
17f16b
+                }
17f16b
+
17f16b
+                std::unique_ptr<SvStream> xStm = ::utl::UcbStreamHelper::CreateStream(aOutFile, StreamMode::TRUNC | StreamMode::WRITE);
17f16b
+                if (!xStm)
17f16b
+                {
17f16b
+                    SetError(ERRCODE_IO_CANTCREATE);
17f16b
+                    bRet = false;
17f16b
+                    break;
17f16b
+                }
17f16b
+                AsciiSave(*xStm, aOptions, i);
17f16b
+            }
17f16b
+        }
17f16b
+        else
17f16b
+        {
17f16b
+            SvStream* pStream = rMed.GetOutStream();
17f16b
+            if (pStream)
17f16b
+            {
17f16b
+                AsciiSave(*pStream, aOptions, GetSaveTab());
17f16b
+                bRet = true;
17f16b
+
17f16b
+                if (m_aDocument.GetTableCount() > 1)
17f16b
+                    if (!rMed.GetError())
17f16b
+                        rMed.SetError(SCWARN_EXPORT_ASCII);
17f16b
+            }
17f16b
         }
17f16b
     }
17f16b
     else if (aFltName == pFilterDBase)
17f16b
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
17f16b
index 41c0b30a42a8..3aa5f6caf311 100644
17f16b
--- a/sc/source/ui/inc/docsh.hxx
17f16b
+++ b/sc/source/ui/inc/docsh.hxx
17f16b
@@ -227,7 +227,7 @@ public:
17f16b
 
17f16b
     ScDrawLayer*    MakeDrawLayer();
17f16b
 
17f16b
-    void            AsciiSave( SvStream& rStream, const ScImportOptions& rOpt );
17f16b
+    void            AsciiSave( SvStream& rStream, const ScImportOptions& rOpt, SCTAB nTab );
17f16b
 
17f16b
     void            Execute( SfxRequest& rReq );
17f16b
     void            GetState( SfxItemSet &rSet );
17f16b
diff --git a/sc/source/ui/inc/imoptdlg.hxx b/sc/source/ui/inc/imoptdlg.hxx
17f16b
index bac941c2a377..382067d67813 100644
17f16b
--- a/sc/source/ui/inc/imoptdlg.hxx
17f16b
+++ b/sc/source/ui/inc/imoptdlg.hxx
17f16b
@@ -32,7 +32,8 @@ public:
17f16b
         ScImportOptions( sal_Unicode nFieldSep, sal_Unicode nTextSep, rtl_TextEncoding nEnc )
17f16b
             : nFieldSepCode(nFieldSep), nTextSepCode(nTextSep),
17f16b
             bFixedWidth(false), bSaveAsShown(false), bQuoteAllText(false),
17f16b
-            bSaveNumberAsSuch(true), bSaveFormulas(false), bRemoveSpace(false)
17f16b
+            bSaveNumberAsSuch(true), bSaveFormulas(false), bRemoveSpace(false),
17f16b
+            nSheetToExport(0)
17f16b
         { SetTextEncoding( nEnc ); }
17f16b
 
17f16b
     ScImportOptions& operator=( const ScImportOptions& rCpy ) = default;
17f16b
@@ -51,6 +52,9 @@ public:
17f16b
     bool        bSaveNumberAsSuch;
17f16b
     bool        bSaveFormulas;
17f16b
     bool        bRemoveSpace;
17f16b
+    // "0" for 'current sheet', "-1" for all sheets (each to a separate file),
17f16b
+    // or 1-based specific sheet number (to a separate file).
17f16b
+    sal_Int32   nSheetToExport;
17f16b
 };
17f16b
 
17f16b
 #endif // INCLUDED_SC_SOURCE_UI_INC_IMOPTDLG_HXX
17f16b
-- 
17f16b
2.31.1
17f16b