[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/qa sc/source

Caolán McNamara caolanm at redhat.com
Thu Jun 23 20:15:05 UTC 2016


 sc/qa/unit/ucalc.cxx             |    6 ++++++
 sc/source/core/data/column4.cxx  |    1 +
 sc/source/ui/unoobj/cellsuno.cxx |   10 ++++++++++
 3 files changed, 17 insertions(+)

New commits:
commit 28e3843433c3dfa04aae70c3c0516911ee80bf69
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 23 10:24:49 2016 +0100

    Resolves: tdf#100460 queryContentCells doesn't count annotations...
    
    since
    
    commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094
    Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Date:   Thu Feb 23 23:36:49 2012 +0100
    
        remove mpNote from ScBaseCell
    
    (cherry picked from commit 83f977c7f40d1a5fb975b8ce7c9958c992dba3f1)
    
    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
    
    (cherry picked from commit 84dc0157df9cb173ec74da2bd27507329efc3816)
    
    Change-Id: I281a207e26aec8886b1f46b9279e1135b61586da
    48e8c0748f520671e09f04b16961bf9729960317
    Reviewed-on: https://gerrit.libreoffice.org/26614
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 337a4ef..e8f0f0a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5259,6 +5259,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 6134eef..4c42a7d 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -700,6 +700,7 @@ void ScColumn::GetNotesInRange(SCROW nStartRow, SCROW nEndRow,
     std::pair<sc::CellNoteStoreType::const_iterator,size_t> aEndPos =
         maCellNotes.position(nEndRow);
     sc::CellNoteStoreType::const_iterator itEnd = aEndPos.first;
+    std::advance(itEnd, 1);
 
     std::for_each(it, itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, nEndRow));
 }
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 776a918..3bf6646 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3600,7 +3600,17 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
                 if (bAdd)
                     aMarkData.SetMultiMarkArea(aIter.GetPos());
             }
+        }
+
+        if (nContentFlags & sheet::CellFlags::ANNOTATION)
+        {
+            std::vector<sc::NoteEntry> aNotes;
+            rDoc.GetNotesInRange(aRanges, aNotes);
 
+            for (const auto& i : aNotes)
+            {
+                aMarkData.SetMultiMarkArea(i.maPos);
+            }
         }
 
         ScRangeList aNewRanges;


More information about the Libreoffice-commits mailing list