diff options
author | Laurent Godard <oooconv@free.fr> | 2011-10-31 17:24:49 +0100 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-02 11:58:53 -0400 |
commit | dbfa9d4f87b660251ccfe9b854e614abafcb684b (patch) | |
tree | d3aee31f5d98726cd66323f64ed52339ca599564 | |
parent | 208c9648ec31ccf27edddc2f5dbfd1387a445fdb (diff) |
calc big file : refactor loading to avoid unecessary tests
create ScDocument::AppendTabOnLoad
do not test if named ranges exist on file load
-rw-r--r-- | sc/inc/document.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 11 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlsubti.cxx | 18 |
4 files changed, 17 insertions, 18 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index a7ae1c3bb576..582901cc72e4 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 b9526d31f272..196bc17fae9b 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 7e6d98a97615..3beef270d01d 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 12d9cad96c88..04f9a8e5daac 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() ) |