[Libreoffice-commits] core.git: sc/qa sc/source

Caolán McNamara caolanm at redhat.com
Thu Jun 23 14:24:34 UTC 2016


 sc/qa/unit/ucalc.cxx            |    6 ++++++
 sc/source/core/data/column4.cxx |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 84dc0157df9cb173ec74da2bd27507329efc3816
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 23 14:40:15 2016 +0100

    Related: tdf#100460 GetNotesInRange doesn't count last cell in range
    
    e.g. open document from tdf#100460 and select select A20:A21 and right click
    and there is a hide comment entry. Shrink the selection to just A20 (which has
    the comment in it) and the right click menu has no hide comment entry in it.
    
    std::for_each(it, itEnd
    
    means it < itEnd but here we want the rows indicated by
    
    nStartRow <= nEndRow
    
    so we need to increment itEnd by one to get the right range
    
    Change-Id: I48e8c0748f520671e09f04b16961bf9729960317

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9cecacc..5a38c92 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4980,6 +4980,12 @@ void Test::testNoteCopyPaste()
     CPPUNIT_ASSERT(pNote);
     CPPUNIT_ASSERT_EQUAL(OUString("Note2"), pNote->GetText());
 
+    // Test that GetNotesInRange includes the end of its range
+    // and so can find the note
+    std::vector<sc::NoteEntry> aNotes;
+    m_pDoc->GetNotesInRange(ScRange(1,7,0), aNotes);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aNotes.size());
+
     m_pDoc->DeleteTab(0);
 }
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index e145e75..6e8e4da 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -701,7 +701,7 @@ void ScColumn::GetNotesInRange(SCROW nStartRow, SCROW nEndRow,
         maCellNotes.position(nEndRow);
     sc::CellNoteStoreType::const_iterator itEnd = aEndPos.first;
 
-    std::for_each(it, itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, nEndRow));
+    std::for_each(it, ++itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, nEndRow));
 }
 
 namespace {


More information about the Libreoffice-commits mailing list