diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/viewdata.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index e4e5ddd9d384..4f7b03ac0d1a 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -236,6 +236,7 @@ private: SC_DLLPRIVATE void CreateTabData( SCTAB nNewTab ); SC_DLLPRIVATE void CreateTabData( std::vector< SCTAB >& rvTabs ); SC_DLLPRIVATE void CreateSelectedTabData(); + SC_DLLPRIVATE void EnsureTabDataSize(size_t nSize); public: ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 00b9874e60c3..f1fa41b6ca34 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1450,6 +1450,15 @@ void ScViewData::CreateSelectedTabData() CreateTabData( i ); } +void ScViewData::EnsureTabDataSize(size_t nSize) +{ + if (nSize >= maTabData.size()) + { + size_t n = nSize - maTabData.size() + 1; + maTabData.insert(maTabData.end(), n, NULL); + } +} + void ScViewData::SetTabNo( SCTAB nNewTab ) { if (!ValidTab(nNewTab)) @@ -2758,7 +2767,10 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue> uno::Sequence<beans::PropertyValue> aTabSettings; if (aAny >>= aTabSettings) { - maTabData[nTab] = new ScViewDataTable; + EnsureTabDataSize(nTab + 1); + if (!maTabData[nTab]) + maTabData[nTab] = new ScViewDataTable; + bool bHasZoom = false; maTabData[nTab]->ReadUserDataSequence(aTabSettings, *this, nTab, bHasZoom); aHasZoomVect[nTab] = bHasZoom; |