diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-24 02:06:06 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-11-24 02:06:06 -0500 |
commit | 808ca6d894630f3375ed6fda1f27f4c6cec9e67d (patch) | |
tree | bc9c2d3921f197c436010b286b6e07609a3ca0b8 /sc | |
parent | 5992e15796131f9814d9fb22cf807a2ee530d264 (diff) |
We still need to set the name to the 1st sheet.
This should fix the filters-test breakage.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlsubti.cxx | 6 |
3 files changed, 15 insertions, 2 deletions
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<rtl::OUString>& 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<SCTAB>(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); |