Kaydet (Commit) 8721b1c0 authored tarafından Eike Rathke's avatar Eike Rathke

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
üst 985bf0e7
...@@ -771,7 +771,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc ) ...@@ -771,7 +771,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc )
::std::vector<OUString> aNewNames; ::std::vector<OUString> aNewNames;
aNewNames.resize( nEndCol - nStartCol + 1); aNewNames.resize( nEndCol - nStartCol + 1);
bool bHaveEmpty = false; bool bHaveEmpty = false;
if (!HasHeader()) if (!HasHeader() || !pDoc)
bHaveEmpty = true; // Assume we have empty ones and fill below. bHaveEmpty = true; // Assume we have empty ones and fill below.
else else
{ {
...@@ -1065,10 +1065,17 @@ ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r) ...@@ -1065,10 +1065,17 @@ ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r)
p->StartTableColumnNamesListener(); // needs the container be set already p->StartTableColumnNamesListener(); // needs the container be set already
if (p->AreTableColumnNamesDirty()) if (p->AreTableColumnNamesDirty())
{ {
// Refresh table column names in next round. if (p->HasHeader())
ScRange aHeader( p->GetHeaderArea()); {
if (aHeader.IsValid()) // Refresh table column names in next round.
maDirtyTableColumnNames.Join( aHeader); 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) ...@@ -1135,10 +1142,17 @@ bool ScDBCollection::NamedDBs::insert(ScDBData* p)
p->StartTableColumnNamesListener(); // needs the container be set already p->StartTableColumnNamesListener(); // needs the container be set already
if (p->AreTableColumnNamesDirty()) if (p->AreTableColumnNamesDirty())
{ {
// Refresh table column names in next round. if (p->HasHeader())
ScRange aHeader( p->GetHeaderArea()); {
if (aHeader.IsValid()) // Refresh table column names in next round.
maDirtyTableColumnNames.Join( aHeader); maDirtyTableColumnNames.Join( p->GetHeaderArea());
}
else
{
// Header-less table can generate its column names
// already without accessing the document.
p->RefreshTableColumnNames( nullptr);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment