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

Pranav Kant pranavk at collabora.co.uk
Thu Mar 16 11:11:17 UTC 2017


 sc/qa/unit/tiledrendering/tiledrendering.cxx |    4 ++++
 sc/sdi/scalc.sdi                             |    2 +-
 sc/source/ui/view/cellsh1.cxx                |   20 +++++++++++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit fab4640bd3979352d6fde06decea1834f178f348
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Mar 16 12:30:45 2017 +0530

    sc lok: Delete cell note by Id
    
    Change-Id: I97224afb4eb7af36abefd0c3b59ee07de7eaa601
    Reviewed-on: https://gerrit.libreoffice.org/35247
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index a4c355be5bb2..c25dc6681170 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1103,8 +1103,12 @@ void ScTiledRenderingTest::testCommentCallback()
     CPPUNIT_ASSERT_EQUAL(std::string("0, 255, 1274, 254"), aView2.m_aCommentCallbackResult.get<std::string>("cellPos"));
 
     // Delete the comment
+    ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+    if (pTabViewShell)
+        pTabViewShell->SetCursor(4, 43);
     aArgs = comphelper::InitPropertySequence(
     {
+        {"Id", uno::makeAny(OUString("Sheet1.A2"))}
     });
     comphelper::dispatchCommand(".uno:DeleteNote", aArgs);
     Scheduler::ProcessEventsToIdle();
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 2ca2a7b2b74d..10300522474d 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3727,7 +3727,7 @@ SfxBoolItem HideNote FID_HIDE_NOTE
 
 
 SfxVoidItem DeleteNote SID_DELETE_NOTE
-()
+(SvxPostItIdItem Id SID_ATTR_POSTIT_ID)
 [
     AutoUpdate = FALSE,
     FastCall = TRUE,
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index a6810dbd125d..a836749b3fbe 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2310,9 +2310,27 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             break;
 
         case SID_DELETE_NOTE:
+        {
+            const SfxPoolItem* pId;
+            // If Id is mentioned, select the appropriate cell first
+            if ( pReqArgs && pReqArgs->HasItem( SID_ATTR_POSTIT_ID, &pId) )
+            {
+                const SvxPostItIdItem* pIdItem = static_cast<const SvxPostItIdItem*>(pId);
+                ScAddress aPos;
+                ScRefFlags nRes = aPos.Parse(pIdItem->GetValue(),
+                                             GetViewData()->GetDocument(),
+                                             ScAddress::Details(formula::FormulaGrammar::AddressConvention::CONV_ODF));
+                if (nRes & ScRefFlags::VALID)
+                {
+                    pTabViewShell->SetTabNo(aPos.Tab());
+                    pTabViewShell->SetCursor(aPos.Col(), aPos.Row());
+                }
+            }
+
             pTabViewShell->DeleteContents( InsertDeleteFlags::NOTE );      // delete all notes in selection
             rReq.Done();
-            break;
+        }
+        break;
 
         case SID_CHARMAP:
             if( pReqArgs != nullptr )


More information about the Libreoffice-commits mailing list