[Libreoffice-commits] core.git: include/LibreOfficeKit include/vcl sc/source sd/source sw/source vcl/source

2020-12-10 Thread gokaysatir (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h |2 +-
 include/vcl/unohelp2.hxx |3 ++-
 sc/source/ui/view/editsh.cxx |8 +---
 sd/source/ui/view/drviews2.cxx   |   12 +---
 sw/source/uibase/shells/textsh1.cxx  |8 +---
 vcl/source/app/unohelp2.cxx  |6 +++---
 6 files changed, 9 insertions(+), 30 deletions(-)

New commits:
commit 56f708b3449230c328f3640709217f9aa802e4c1
Author: gokaysatir 
AuthorDate: Wed Oct 7 12:57:13 2020 +0300
Commit: Jan Holesovsky 
CommitDate: Thu Dec 10 09:27:22 2020 +0100

Online: "Copy hyperlink location" feature improvement.

Lambda functions are replaced with class pointers.

Change-Id: I48628d3105533aad2463bd8ade1f65cf5b154b0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104058
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 9a0eb01ca840..ae8eacd9151f 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -646,7 +646,7 @@ typedef enum
  *
  * Payload is optional. When payload is empty, Online gets string from 
selected text.
  * Payload format is JSON.
- * Example: { "mimeType": "string", "content": "some content" }
+ * Example: { "mimeType": "text/plain", "content": "some content" }
  */
 LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
 
diff --git a/include/vcl/unohelp2.hxx b/include/vcl/unohelp2.hxx
index 91c4ce6ce0e2..a0e03a04e2a1 100644
--- a/include/vcl/unohelp2.hxx
+++ b/include/vcl/unohelp2.hxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star::datatransfer::clipboard {
 class XClipboard;
@@ -60,7 +61,7 @@ namespace vcl::unohelper {
 static  voidCopyStringTo(
 const OUString& rContent,
 const css::uno::Reference< 
css::datatransfer::clipboard::XClipboard >& rxClipboard,
-std::function *callback = nullptr
+const vcl::ILibreOfficeKitNotifier* pNotifier = nullptr
 );
 };
 
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index e12c5460c09d..619001a27d8c 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -642,13 +642,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
 {
 uno::Reference 
xClipboard = GetSystemClipboard();
 
-if (comphelper::LibreOfficeKit::isActive())
-{
-std::function callback = [&] 
(int callbackType, const char* text) { 
rViewData.GetViewShell()->libreOfficeKitViewCallback(callbackType, text); } ;
-
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
);
-}
-else
-
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
nullptr);
+
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
SfxViewShell::Current());
 }
 }
 break;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 11f42901b9fd..33203efef9b9 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2251,17 +2251,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 uno::Reference 
xClipboard
 = pOutView->GetWindow()->GetClipboard();
 
-if (comphelper::LibreOfficeKit::isActive())
-{
-std::function callback = [&] 
(int callbackType, const char* text)
-{
-SfxViewFrame* pFrame = GetViewFrame();
-
pFrame->GetViewShell()->libreOfficeKitViewCallback(callbackType, text);
-};
-
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
);
-}
-else
-
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
+
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
SfxViewShell::Current());
 }
 }
 
diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 7ac52d334ce1..1344ecacf894 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1346,13 +1346,7 @@ void SwTextShell::Execute(SfxRequest )
 OUString hyperlinkLocation = rINetFormat.GetValue();
 ::uno::Reference< datatransfer::clipboard::XClipboard > 
xClipboard = GetView().GetEditWin().GetClipboard();
 
-if (comphelper::LibreOfficeKit::isActive())
-

[Libreoffice-commits] core.git: include/LibreOfficeKit include/vcl sc/source sd/source sw/source vcl/source

2020-10-06 Thread gokaysatir (via logerrit)
 include/LibreOfficeKit/LibreOfficeKitEnums.h |7 +++
 include/vcl/unohelp2.hxx |6 +-
 sc/source/ui/view/editsh.cxx |9 -
 sd/source/ui/view/drviews2.cxx   |   13 -
 sw/source/uibase/shells/textsh1.cxx  |   13 ++---
 vcl/source/app/unohelp2.cxx  |   13 -
 6 files changed, 50 insertions(+), 11 deletions(-)

New commits:
commit 19a0fbf456129e011cb9ab9ab6ab730cba274bbd
Author: gokaysatir 
AuthorDate: Tue Sep 22 13:00:44 2020 +0300
Commit: Gökay ŞATIR 
CommitDate: Tue Oct 6 18:47:39 2020 +0200

Online: Copy hyperlink location. / Core side.

Payload format is added to LOK_CALLBACK_CLIPBOARD_CHANGED.
Clipboard changed event is not fired when "copy hyperlink location" command 
is issued.
So i added a call to LOK_CALLBACK_CLIPBOARD_CHANGED inside 
TextDataObject::CopyStringTo function.

Change-Id: I8157572288da88b5522662e13abe151ef8548b34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103164
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103872
Tested-by: Jenkins

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 750e64f529f9..9a0eb01ca840 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -644,10 +644,9 @@ typedef enum
  * 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.
+ * Payload is optional. When payload is empty, Online gets string from 
selected text.
+ * Payload format is JSON.
+ * Example: { "mimeType": "string", "content": "some content" }
  */
 LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
 
diff --git a/include/vcl/unohelp2.hxx b/include/vcl/unohelp2.hxx
index a95474417cf6..91c4ce6ce0e2 100644
--- a/include/vcl/unohelp2.hxx
+++ b/include/vcl/unohelp2.hxx
@@ -25,6 +25,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 namespace com::sun::star::datatransfer::clipboard {
 class XClipboard;
@@ -56,7 +59,8 @@ namespace vcl::unohelper {
 /// copies a given string to a given clipboard
 static  voidCopyStringTo(
 const OUString& rContent,
-const css::uno::Reference< 
css::datatransfer::clipboard::XClipboard >& rxClipboard
+const css::uno::Reference< 
css::datatransfer::clipboard::XClipboard >& rxClipboard,
+std::function *callback = nullptr
 );
 };
 
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 9e8768fe27d6..83e4adaf815f 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -641,7 +641,14 @@ void ScEditShell::Execute( SfxRequest& rReq )
 {
 uno::Reference 
xClipboard
 = pEditView->GetWindow()->GetClipboard();
-
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+std::function callback = [&] 
(int callbackType, const char* text) { 
rViewData.GetViewShell()->libreOfficeKitViewCallback(callbackType, text); } ;
+
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
);
+}
+else
+
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
nullptr);
 }
 }
 break;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 8f511aab3922..f32acb5d3182 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2250,7 +2250,18 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 {
 uno::Reference 
xClipboard
 = pOutView->GetWindow()->GetClipboard();
-
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard);
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+std::function callback = [&] 
(int callbackType, const char* text)
+{
+SfxViewFrame* pFrame = GetViewFrame();
+
pFrame->GetViewShell()->libreOfficeKitViewCallback(callbackType, text);
+};
+
vcl::unohelper::TextDataObject::CopyStringTo(pURLField->GetURL(), xClipboard, 
);
+}
+else
+