diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-02-25 14:14:40 -0500 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2018-03-17 01:17:13 +0100 |
commit | de774e261a59625336fe4d744d8c8e2966b570d2 (patch) | |
tree | 63baff5e531a1cd44344d6c3d62f3da8bac388de | |
parent | df4253787e9f6ba4951ee2f416ec65937b2c8ddf (diff) |
lok: notify clients of clipboard changes
Change-Id: I93d8eacc0defb1176ec5d767f49356812cf90ff6
Reviewed-on: https://gerrit.libreoffice.org/50327
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 11 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 16 |
2 files changed, 22 insertions, 5 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index b90aa6279c41..020bbff90f20 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -568,6 +568,17 @@ typedef enum * - "close" - window is closed */ LOK_CALLBACK_WINDOW = 36, + + /** + * Notification that the clipboard contents have changed. + * Typically fired in response to copying to clipboard. + * + * The payload currently is empty and it's up to the + * client to get the contents, if necessary. However, + * in the future the contents might be included for + * convenience. + */ + LOK_CALLBACK_CLIPBOARD_CHANGED = 37, } LibreOfficeKitCallbackType; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 41ac335237ad..3b742b0a56d6 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -156,12 +156,18 @@ SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView, con void SfxClipboardChangeListener::ChangedContents() { const SolarMutexGuard aGuard; - if( m_pViewShell ) + if (m_pViewShell) { SfxBindings& rBind = m_pViewShell->GetViewFrame()->GetBindings(); - rBind.Invalidate( SID_PASTE ); - rBind.Invalidate( SID_PASTE_SPECIAL ); - rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); + rBind.Invalidate(SID_PASTE); + rBind.Invalidate(SID_PASTE_SPECIAL); + rBind.Invalidate(SID_CLIPBOARD_FORMAT_ITEMS); + + if (comphelper::LibreOfficeKit::isActive()) + { + // In the future we might send the payload as well. + SfxLokHelper::notifyAllViews(LOK_CALLBACK_CLIPBOARD_CHANGED, ""); + } } } @@ -823,7 +829,7 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const if ( !pClients ) return nullptr; - bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); + const bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); for (SfxInPlaceClient* pIPClient : *pClients) { |