diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-03-16 12:30:45 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-03-16 11:10:55 +0000 |
commit | fab4640bd3979352d6fde06decea1834f178f348 (patch) | |
tree | 77d343a42f976b0148e536d5e576e1723a52cc1c | |
parent | 9dd836e4f6bd4be378b56bd581d27e2b02077f0b (diff) |
sc lok: Delete cell note by Id
Change-Id: I97224afb4eb7af36abefd0c3b59ee07de7eaa601
Reviewed-on: https://gerrit.libreoffice.org/35247
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 4 | ||||
-rw-r--r-- | sc/sdi/scalc.sdi | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 20 |
3 files changed, 24 insertions, 2 deletions
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 ) |