summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/dbdata.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-09-08 23:30:27 +0200
committerEike Rathke <erack@redhat.com>2015-09-08 23:33:31 +0200
commit470848093a2687a6d8056629da6b43773ff4cb0c (patch)
treead0635b5d947f216aa0743dd4d4b05d2b0575cd4 /sc/source/core/tool/dbdata.cxx
parent70a1e658c0d1f111c8c0991fb87561e3be5683f0 (diff)
factor out duplicated code into NamedDBs::initInserted()
Change-Id: Idc95d4b8acae9dcd4ed0092c43986e6687f06c11
Diffstat (limited to 'sc/source/core/tool/dbdata.cxx')
-rw-r--r--sc/source/core/tool/dbdata.cxx65
1 files changed, 25 insertions, 40 deletions
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 19c460b216fa..9edd5d05b91a 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -1058,27 +1058,7 @@ ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r)
ScDBData* p = new ScDBData(*it);
std::unique_ptr<ScDBData> pData(p);
if (m_DBs.insert( std::move(pData)).second)
- {
- p->SetContainer( this);
- if (!mrDoc.IsClipOrUndo())
- {
- p->StartTableColumnNamesListener(); // needs the container be set already
- if (p->AreTableColumnNamesDirty())
- {
- 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);
- }
- }
- }
- }
+ initInserted(p);
}
}
@@ -1086,6 +1066,29 @@ ScDBCollection::NamedDBs::~NamedDBs()
{
}
+void ScDBCollection::NamedDBs::initInserted( ScDBData* p )
+{
+ p->SetContainer( this);
+ if (!mrDoc.IsClipOrUndo())
+ {
+ p->StartTableColumnNamesListener(); // needs the container be set already
+ if (p->AreTableColumnNamesDirty())
+ {
+ 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);
+ }
+ }
+ }
+}
+
ScDBCollection::NamedDBs::iterator ScDBCollection::NamedDBs::begin()
{
return m_DBs.begin();
@@ -1136,25 +1139,7 @@ bool ScDBCollection::NamedDBs::insert(ScDBData* p)
if (r.second)
{
- p->SetContainer( this);
- if (!mrDoc.IsClipOrUndo())
- {
- p->StartTableColumnNamesListener(); // needs the container be set already
- if (p->AreTableColumnNamesDirty())
- {
- 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);
- }
- }
- }
+ initInserted(p);
/* TODO: shouldn't the import refresh not be setup for
* clipboard/undo documents? It was already like this before.. */