From 808ca6d894630f3375ed6fda1f27f4c6cec9e67d Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 24 Nov 2011 02:06:06 -0500 Subject: We still need to set the name to the 1st sheet. This should fix the filters-test breakage. --- sc/inc/document.hxx | 1 + sc/source/core/data/document.cxx | 10 ++++++++++ sc/source/filter/xml/xmlsubti.cxx | 6 ++++-- 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 8157929b26a6..3db0dc6140a7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -578,6 +578,7 @@ public: SC_DLLPUBLIC void CreateValidTabNames(std::vector& aNames, SCTAB nCount) const; void AppendTabOnLoad(const rtl::OUString& rName); + void SetTabNameOnLoad(SCTAB nTab, const rtl::OUString& rName); SC_DLLPUBLIC bool InsertTab( SCTAB nPos, const rtl::OUString& rName, bool bExternalDocument = false ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 52dc4cee7ab7..8f277c63f8f2 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -408,6 +408,16 @@ void ScDocument::AppendTabOnLoad(const rtl::OUString& rName) maTabs.push_back( new ScTable(this, nTabCount, aName) ); } +void ScDocument::SetTabNameOnLoad(SCTAB nTab, const rtl::OUString& rName) +{ + if (!ValidTab(nTab) || static_cast(maTabs.size()) <= nTab) + return; + + if (!ValidTabName(rName)) + return; + + maTabs[nTab]->SetName(rName); +} bool ScDocument::InsertTab( SCTAB nPos, const rtl::OUString& rName, bool bExternalDocument ) diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 3ea979fe59c6..97aa9a5e0e0e 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -186,10 +186,12 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString& maProtectionData = rProtectData; ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel()); + // The document contains one sheet when created. So for the first + // sheet, we only need to set its name. if (nCurrentSheet > 0) - { pDoc->AppendTabOnLoad(sTableName); - } + else + pDoc->SetTabNameOnLoad(nCurrentSheet, sTableName); rImport.SetTableStyle(sStyleName); SetTableStyle(sStyleName); -- cgit