diff options
author | Eike Rathke <erack@redhat.com> | 2015-09-08 20:43:01 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-09-08 23:33:30 +0200 |
commit | 8721b1c02fbbc36ca0848ca36a5094d7fbcebc96 (patch) | |
tree | 17b965ef6383367a00d41ffa5466a1bfe469d91e /sc | |
parent | 985bf0e7ae0d046cae28f89db0c6ac059d397fd4 (diff) |
TableRef: for header-less ScDBData generate table column names already
... during insertion as NamedDB, as they don't need to access header
cells and thus don't have to add a (fake) dirty range.
Change-Id: Iab3f1406e53ca39ad0820a86def70323a41ce241
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/dbdata.cxx | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index c5b14a01ecad..19c460b216fa 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -771,7 +771,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc ) ::std::vector<OUString> aNewNames; aNewNames.resize( nEndCol - nStartCol + 1); bool bHaveEmpty = false; - if (!HasHeader()) + if (!HasHeader() || !pDoc) bHaveEmpty = true; // Assume we have empty ones and fill below. else { @@ -1065,10 +1065,17 @@ ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r) p->StartTableColumnNamesListener(); // needs the container be set already if (p->AreTableColumnNamesDirty()) { - // Refresh table column names in next round. - ScRange aHeader( p->GetHeaderArea()); - if (aHeader.IsValid()) - maDirtyTableColumnNames.Join( aHeader); + if (p->HasHeader()) + { + // Refresh table column names in next round. + maDirtyTableColumnNames.Join( p->GetHeaderArea()); + } + else + { + // Header-less table can generate its column names + // already without accessing the document. + p->RefreshTableColumnNames( nullptr); + } } } } @@ -1135,10 +1142,17 @@ bool ScDBCollection::NamedDBs::insert(ScDBData* p) p->StartTableColumnNamesListener(); // needs the container be set already if (p->AreTableColumnNamesDirty()) { - // Refresh table column names in next round. - ScRange aHeader( p->GetHeaderArea()); - if (aHeader.IsValid()) - maDirtyTableColumnNames.Join( aHeader); + if (p->HasHeader()) + { + // Refresh table column names in next round. + maDirtyTableColumnNames.Join( p->GetHeaderArea()); + } + else + { + // Header-less table can generate its column names + // already without accessing the document. + p->RefreshTableColumnNames( nullptr); + } } } |