summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-03 14:39:51 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-03 14:45:09 -0500
commit99a262dc954c19ebd8d07fa8b0f9c9f9a45305a8 (patch)
treeceabb3bd0a9b10cf8b69081daac671ad5262bf96 /sc/source
parent6da6186fb2d34e26d1dca649eda80cbec374cb37 (diff)
Finally found a way to get this test to fail.
Change-Id: I67cf68ee7e51794de374581016ffb13ebdff59d3
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/document.cxx6
-rw-r--r--sc/source/core/data/table2.cxx21
2 files changed, 17 insertions, 10 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bbd3ce2bf538..b2126b232418 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3210,13 +3210,13 @@ void ScDocument::SetEditText( const ScAddress& rPos, const OUString& rStr )
maTabs[rPos.Tab()]->SetEditText(rPos.Col(), rPos.Row(), rEngine.CreateTextObject());
}
-bool ScDocument::HasEditText( const ScRange& rRange ) const
+SCROW ScDocument::GetFirstEditTextRow( const ScRange& rRange ) const
{
const ScTable* pTab = FetchTable(rRange.aStart.Tab());
if (!pTab)
- return false;
+ return -1;
- return pTab->HasEditText(rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row());
+ return pTab->GetFirstEditTextRow(rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row());
}
void ScDocument::SetTextCell( const ScAddress& rPos, const OUString& rStr )
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index af4587d0faa9..dc35b163a917 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1347,23 +1347,30 @@ void ScTable::SetEditText( SCCOL nCol, SCROW nRow, const EditTextObject& rEditTe
aCol[nCol].SetEditText(nRow, rEditText, pEditPool);
}
-bool ScTable::HasEditText( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const
+SCROW ScTable::GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const
{
if (!ValidCol(nCol1) || !ValidCol(nCol2) || nCol2 < nCol1)
- return false;
+ return -1;
if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow2 < nRow1)
- return false;
+ return -1;
- SCROW nFirst = -1;
+ SCROW nFirst = MAXROW+1;
for (SCCOL i = nCol1; i <= nCol2; ++i)
{
const ScColumn& rCol = aCol[i];
- if (const_cast<ScColumn&>(rCol).HasEditCells(nRow1, nRow2, nFirst))
- return true;
+ SCROW nThisFirst = -1;
+ if (const_cast<ScColumn&>(rCol).HasEditCells(nRow1, nRow2, nThisFirst))
+ {
+ if (nThisFirst == nRow1)
+ return nRow1;
+
+ if (nThisFirst < nFirst)
+ nFirst = nThisFirst;
+ }
}
- return false;
+ return nFirst == (MAXROW+1) ? -1 : nFirst;
}
void ScTable::SetEmptyCell( SCCOL nCol, SCROW nRow )