diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-05-28 16:50:19 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-05-28 18:11:51 +0200 |
commit | 43a7c258465b27c5b6a1cc754dbe628f9b3d7ed5 (patch) | |
tree | 237afc51194acb1fc467d8f0b0c5d5b971f556be | |
parent | d2def7786b2a163208dc608b48c83333382e020b (diff) |
sw: implement select-all for the frame shell
There is no reason why Ctrl-A should be a NOP when you select an image.
Change-Id: If0013ee0e9ff9a6fb038a22de7b5d3c76e5c52b9
Reviewed-on: https://gerrit.libreoffice.org/73109
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 7 | ||||
-rw-r--r-- | sw/sdi/_frmsh.sdi | 5 | ||||
-rw-r--r-- | sw/source/uibase/inc/frmsh.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/shells/frmsh.cxx | 13 |
4 files changed, 26 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 78a219d5ca36..53d02da365f4 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -650,6 +650,13 @@ void DesktopLOKTest::testRichPaste() pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 't', 0); Scheduler::ProcessEventsToIdle(); + // Paste an image and make sure select-all still works. + OUString aFileURL; + createFileURL("paste.jpg", aFileURL); + std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr()); + std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>()); + CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "image/jpeg", aImageContents.data(), aImageContents.size())); + pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false); Scheduler::ProcessEventsToIdle(); diff --git a/sw/sdi/_frmsh.sdi b/sw/sdi/_frmsh.sdi index 734b50c5ebc1..b93d9e8bfe73 100644 --- a/sw/sdi/_frmsh.sdi +++ b/sw/sdi/_frmsh.sdi @@ -400,5 +400,10 @@ interface BaseTextFrame ExecMethod = Execute ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + SID_SELECTALL + [ + ExecMethod = ExecMove ; + StateMethod = NoState ; + ] } diff --git a/sw/source/uibase/inc/frmsh.hxx b/sw/source/uibase/inc/frmsh.hxx index f86e0d06501f..4b8a64c75823 100644 --- a/sw/source/uibase/inc/frmsh.hxx +++ b/sw/source/uibase/inc/frmsh.hxx @@ -35,6 +35,7 @@ public: virtual ~SwFrameShell() override; void Execute(SfxRequest &); + void ExecMove(SfxRequest& rReq); void GetState(SfxItemSet &); void ExecFrameStyle(SfxRequest const & rReq); void GetLineStyleState(SfxItemSet &rSet); diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 8a5ddeefffd6..6e8fae2cf1f8 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -114,6 +114,19 @@ void SwFrameShell::InitInterface_Impl() GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Frame_Toolbox); } +void SwFrameShell::ExecMove(SfxRequest& rReq) +{ + SwWrtShell& rSh = GetShell(); + sal_uInt16 nSlot = rReq.GetSlot(); + switch (nSlot) + { + case SID_SELECTALL: + rSh.SelAll(); + rReq.Done(); + break; + } +} + void SwFrameShell::Execute(SfxRequest &rReq) { //First those who do not need FrameMgr. |