From 858e27233d13d2fcec4bd4c085f15aa2c6e84d97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Sun, 4 Dec 2011 19:15:36 +0100
Subject: [PATCH] fdo42286 extend down even if last row empty but a column added next

---
 sc/source/core/tool/dbdata.cxx |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 3d60554..8d7d7ec 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -543,11 +543,11 @@ void ScDBData::UpdateReference(ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
 
 void ScDBData::ExtendDataArea(ScDocument* pDoc)
 {
-    // Extend the DB area to include data rows immediately below.
+    // Extend the DB area to include data rows immediately below but extend
+    // also if all the row is empty but a new column is added next to the selection
     SCCOL nCol1a = nStartCol, nCol2a = nEndCol;
-    SCROW nRow1a = nStartRow, nRow2a = nEndRow;
-    pDoc->GetDataArea(nTable, nCol1a, nRow1a, nCol2a, nRow2a, true, true);
-    nEndRow = nRow2a;
+    SCROW nRow1a = nStartRow;
+    pDoc->GetDataArea(nTable, nCol1a, nRow1a, nCol2a, nEndRow, true, false);
 }
 
 namespace {
-- 
1.7.3.4

