[Libreoffice-commits] core.git: Branch 'private/mmeeks/copypaste' - desktop/qa sw/sdi sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue May 28 16:12:33 UTC 2019


 desktop/qa/desktop_lib/test_desktop_lib.cxx |    7 +++++++
 sw/sdi/_frmsh.sdi                           |    5 +++++
 sw/source/uibase/inc/frmsh.hxx              |    1 +
 sw/source/uibase/shells/frmsh.cxx           |   13 +++++++++++++
 4 files changed, 26 insertions(+)

New commits:
commit 43a7c258465b27c5b6a1cc754dbe628f9b3d7ed5
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue May 28 16:50:19 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue May 28 18:11:51 2019 +0200

    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 at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

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.


More information about the Libreoffice-commits mailing list