[Libreoffice-commits] .: sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Nov 23 23:14:06 PST 2011
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(-)
New commits:
commit 808ca6d894630f3375ed6fda1f27f4c6cec9e67d
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Nov 24 02:06:06 2011 -0500
We still need to set the name to the 1st sheet.
This should fix the filters-test breakage.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 8157929..3db0dc6 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 52dc4ce..8f277c6 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 3ea979f..97aa9a5 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);
More information about the Libreoffice-commits
mailing list