Kaydet (Commit) dbfa9d4f authored tarafından Laurent Godard's avatar Laurent Godard Kaydeden (comit) Kohei Yoshida

calc big file : refactor loading to avoid unecessary tests

create ScDocument::AppendTabOnLoad
do not test if named ranges exist on file load
üst 208c9648
...@@ -575,6 +575,9 @@ public: ...@@ -575,6 +575,9 @@ public:
SC_DLLPUBLIC void CreateValidTabName(String& rName) const; SC_DLLPUBLIC void CreateValidTabName(String& rName) const;
SC_DLLPUBLIC void CreateValidTabName(rtl::OUString& rName) const; SC_DLLPUBLIC void CreateValidTabName(rtl::OUString& rName) const;
SC_DLLPUBLIC void CreateValidTabNames(std::vector<rtl::OUString>& aNames, SCTAB nCount) 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, SC_DLLPUBLIC sal_Bool InsertTab( SCTAB nPos, const String& rName,
sal_Bool bExternalDocument = false ); sal_Bool bExternalDocument = false );
SC_DLLPUBLIC bool InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rNames, SC_DLLPUBLIC bool InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rNames,
......
...@@ -401,6 +401,17 @@ void ScDocument::CreateValidTabNames(std::vector<rtl::OUString>& aNames, SCTAB n ...@@ -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 ScDocument::InsertTab( SCTAB nPos, const String& rName,
sal_Bool bExternalDocument ) sal_Bool bExternalDocument )
......
...@@ -2782,8 +2782,7 @@ public: ...@@ -2782,8 +2782,7 @@ public:
if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER; if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER; if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
if (mpDoc)
if (mpDoc && !mrRangeName.findByName(r.sName))
{ {
// Insert a new name. // Insert a new name.
ScAddress aPos; ScAddress aPos;
......
...@@ -192,22 +192,8 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString& ...@@ -192,22 +192,8 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
{ {
if (nCurrentSheet > 0) if (nCurrentSheet > 0)
{ {
try ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
{ pDoc->AppendTabOnLoad(sTableName);
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);
}
}
} }
uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
if ( xIndex.is() ) if ( xIndex.is() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment