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

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Nov 2 08:58:36 PDT 2011


 sc/inc/document.hxx               |    3 +++
 sc/source/core/data/document.cxx  |   11 +++++++++++
 sc/source/filter/xml/xmlimprt.cxx |    3 +--
 sc/source/filter/xml/xmlsubti.cxx |   18 ++----------------
 4 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit dbfa9d4f87b660251ccfe9b854e614abafcb684b
Author: Laurent Godard <oooconv at free.fr>
Date:   Mon Oct 31 17:24:49 2011 +0100

    calc big file : refactor loading to avoid unecessary tests
    
    create ScDocument::AppendTabOnLoad
    do not test if named ranges exist on file load

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a7ae1c3..582901c 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -575,6 +575,9 @@ public:
     SC_DLLPUBLIC void           CreateValidTabName(String& rName) const;
     SC_DLLPUBLIC void           CreateValidTabName(rtl::OUString& rName) const;
     SC_DLLPUBLIC void           CreateValidTabNames(std::vector<rtl::OUString>& aNames, SCTAB nCount) const;
+
+    void AppendTabOnLoad(const rtl::OUString& rName);
+
     SC_DLLPUBLIC sal_Bool           InsertTab( SCTAB nPos, const String& rName,
                                 sal_Bool bExternalDocument = false );
     SC_DLLPUBLIC bool           InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rNames,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index b9526d3..196bc17 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -401,6 +401,17 @@ void ScDocument::CreateValidTabNames(std::vector<rtl::OUString>& aNames, SCTAB n
     }
 }
 
+void ScDocument::AppendTabOnLoad(const rtl::OUString& rName)
+{
+    SCTAB nTabCount = static_cast<SCTAB>(maTabs.size());
+
+    if (ValidTab(nTabCount) && ValidNewTabName(rName))
+    {
+        maTabs.push_back( new ScTable(this, nTabCount, rName) );
+        maTabs[nTabCount]->SetCodeName( rName );
+    }
+}
+
 
 sal_Bool ScDocument::InsertTab( SCTAB nPos, const String& rName,
             sal_Bool bExternalDocument )
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 7e6d98a..3beef27 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2782,8 +2782,7 @@ public:
         if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER )      nNewType |= RT_COLHEADER;
         if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER )         nNewType |= RT_ROWHEADER;
 
-
-        if (mpDoc && !mrRangeName.findByName(r.sName))
+        if (mpDoc)
         {
             // Insert a new name.
             ScAddress aPos;
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 12d9cad..04f9a8e 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -192,22 +192,8 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
             {
                 if (nCurrentSheet > 0)
                 {
-                    try
-                    {
-                        xSheets->insertNewByName(sTableName, nCurrentSheet);
-                    }
-                    catch ( uno::RuntimeException& )
-                    {
-                        ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
-                        if (pDoc)
-                        {
-                            ScXMLImport::MutexGuard aGuard(rImport);
-                            String sTabName(String::CreateFromAscii("Table"));
-                            pDoc->CreateValidTabName(sTabName);
-                            rtl::OUString sOUTabName(sTabName);
-                            xSheets->insertNewByName(sOUTabName, nCurrentSheet);
-                        }
-                    }
+                    ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
+                    pDoc->AppendTabOnLoad(sTableName);
                 }
                 uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
                 if ( xIndex.is() )


More information about the Libreoffice-commits mailing list