[Libreoffice-commits] core.git: sc/inc sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat May 13 21:33:09 UTC 2017


 sc/inc/document.hxx                         |    1 +
 sc/source/core/data/document.cxx            |    9 +++++++++
 sc/source/filter/orcus/orcusfiltersimpl.cxx |    1 +
 3 files changed, 11 insertions(+)

New commits:
commit 3e6e2f8db74a699699767344236f043b87ae5dd7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat May 13 21:34:28 2017 +0200

    use empty document in orcus gnumeric import, tdf#107828
    
    Change-Id: Ia7ee2de6f9b14a132a29c01f8d863889477c0a8d
    Reviewed-on: https://gerrit.libreoffice.org/37579
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 29f8af4d849d..2c0f1318fc63 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -817,6 +817,7 @@ public:
                                             bool bNamesValid = false );
     SC_DLLPUBLIC bool           DeleteTabs( SCTAB nTab, SCTAB nSheets );
     SC_DLLPUBLIC bool           DeleteTab( SCTAB nTab );
+    SC_DLLPUBLIC void           ClearTabs();
     SC_DLLPUBLIC bool           RenameTab( SCTAB nTab, const OUString& rName,
                                            bool bExternalDocument = false );
     bool                        MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress = nullptr );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 4e6df253e358..79ee0a96fb63 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -773,6 +773,15 @@ bool ScDocument::DeleteTab( SCTAB nTab )
     return bValid;
 }
 
+void ScDocument::ClearTabs()
+{
+    for (auto& it: maTabs)
+    {
+        delete it;
+    }
+    maTabs.clear();
+}
+
 bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
 {
     bool bValid = false;
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index f96fb9f3373f..b7a68d40a711 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -102,6 +102,7 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) co
 
     try
     {
+        rDoc.ClearTabs();
         orcus::orcus_gnumeric filter(&aFactory);
         filter.read_stream(aBuffer.getStr(), aBuffer.getLength());
     }


More information about the Libreoffice-commits mailing list