[Libreoffice-commits] online.git: kit/ChildSession.cpp loleaflet/src

2020-09-30 Thread gokaysatir (via logerrit)
 kit/ChildSession.cpp  |9 +
 loleaflet/src/layer/tile/TileLayer.js |9 +
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 805ff2f2a8c1672b9ca0fef2b7364f9e9f38761b
Author: gokaysatir 
AuthorDate: Tue Sep 22 14:39:09 2020 +0300
Commit: Jan Holesovsky 
CommitDate: Wed Sep 30 15:10:19 2020 +0200

Online: Copy hyperlink location. / Online side.

Unused selection variable has been removed. "clipboardchanged" event is 
activated.
LOK_CALLBACK_CLIPBOARD_CHANGED is handled according to existence of payload.

Change-Id: I6e37cb2ca4d4c59e5ba3397cb00dbb7eafa2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103165
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 54d900da6..314ff12da 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1529,7 +1529,7 @@ bool ChildSession::unoCommand(const char* /*buffer*/, int 
/*length*/, const Stri
 }
 else
 {
-if (tokens[1] == ".uno:Copy")
+if (tokens[1] == ".uno:Copy" || tokens[1] == 
".uno:CopyHyperlinkLocation")
 _copyToClipboard = true;
 
 getLOKitDocument()->postUnoCommand(tokens[1].c_str(), nullptr, 
bNotify);
@@ -2599,14 +2599,15 @@ void ChildSession::loKitCallback(const int type, const 
std::string& payload)
 break;
 case LOK_CALLBACK_CLIPBOARD_CHANGED:
 {
-std::string selection;
 if (_copyToClipboard)
 {
 _copyToClipboard = false;
-selection = getTextSelectionInternal("");
+if (payload.empty())
+getTextSelectionInternal("");
+else
+sendTextFrame("clipboardchanged: " + payload);
 }
 
-sendTextFrame("clipboardchanged: " + selection);
 break;
 }
 case LOK_CALLBACK_CONTEXT_CHANGED:
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 6f4445084..41ff45a07 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -643,6 +643,15 @@ L.TileLayer = L.GridLayer.extend({
// hack for ios and android to get selected 
text into hyperlink insertion dialog
this._selectedTextContent = textMsg.substr(22);
}
+   else if (textMsg.startsWith('clipboardchanged')) {
+   var jMessage = textMsg.substr(17);
+   jMessage = JSON.parse(jMessage);
+
+   if (jMessage.mimeType === 'text/plain') {
+   
this._map._clip.setTextSelectionHTML(jMessage.content);
+   this._map._clip._execCopyCutPaste('copy');
+   }
+   }
else if (textMsg.startsWith('textselectionend:')) {
this._onTextSelectionEndMsg(textMsg);
}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: kit/ChildSession.cpp loleaflet/src

2020-09-02 Thread Pranam Lashkari (via logerrit)
 kit/ChildSession.cpp  |2 +-
 loleaflet/src/control/Control.PartsPreview.js |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 0a54b23251eaae201e198366190c8525bf23d038
Author: Pranam Lashkari 
AuthorDate: Wed Aug 26 22:53:37 2020 +0530
Commit: Andras Timar 
CommitDate: Wed Sep 2 10:41:33 2020 +0200

leaflet: wsd: select the page before opening the slide wizard

problem:
In the mobile view taping on the selected slide preview would open the 
wizard
but when some object is selected on the slide
wizard would open for that object
this patch helps us to set the Page as selection and as result
mobile wizard opens for the slide even when some object on slide is selected

Change-Id: Ia4f0d5fe6a4d82d101ee26b75f557a44e0627704
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101422
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 7eba3aa19..bae3cce4f 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -2146,7 +2146,7 @@ bool ChildSession::setClientPart(const char* /*buffer*/, 
int /*length*/, const S
 
 getLOKitDocument()->setView(_viewId);
 
-if (getLOKitDocument()->getDocumentType() != LOK_DOCTYPE_TEXT && part != 
getLOKitDocument()->getPart())
+if (getLOKitDocument()->getDocumentType() != LOK_DOCTYPE_TEXT)
 {
 getLOKitDocument()->setPart(part);
 }
diff --git a/loleaflet/src/control/Control.PartsPreview.js 
b/loleaflet/src/control/Control.PartsPreview.js
index e529fad22..58408b48f 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -225,7 +225,8 @@ L.Control.PartsPreview = L.Control.extend({
var partId = parseInt(part) - 1; // The first 
part is just a drop-site for reordering.
if (!window.mode.isDesktop() && partId === 
this._map._docLayer._selectedPart) {
// if mobile or tab then second tap will open 
the mobile wizard
-   if (this._map._permission === 'edit') {
+   if (this._map.isPermissionEdit()) {
+   this._setPart(e);
setTimeout(function () {

w2ui['actionbar'].click('mobile_wizard');
}, 0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: kit/ChildSession.cpp loleaflet/src

2020-08-05 Thread Michael Meeks (via logerrit)
 kit/ChildSession.cpp|   32 
 loleaflet/src/layer/marker/TextInput.js |4 +---
 2 files changed, 25 insertions(+), 11 deletions(-)

New commits:
commit 9142828282c1147244a4df700ee52d28cf27a37d
Author: Michael Meeks 
AuthorDate: Wed Aug 5 17:16:08 2020 +0100
Commit: Michael Meeks 
CommitDate: Wed Aug 5 18:44:10 2020 +0200

textinput: use a single input message per key on the wire.

Change-Id: Ibd0f7afb98c8ed278751c4b5b46d7ce2467cd71f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100184
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index dc0e9ec3d..281360654 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1242,15 +1242,25 @@ bool ChildSession::insertFile(const char* /*buffer*/, 
int /*length*/, const Stri
 bool ChildSession::extTextInputEvent(const char* /*buffer*/, int /*length*/,
  const StringVector& tokens)
 {
-int id, type;
+int id, type = -1;
 std::string text;
-if (tokens.size() < 4 ||
-!getTokenInteger(tokens[1], "id", id) || id < 0 ||
-!getTokenKeyword(tokens[2], "type",
-{{"input", LOK_EXT_TEXTINPUT}, {"end", 
LOK_EXT_TEXTINPUT_END}},
- type) ||
-!getTokenString(tokens[3], "text", text))
+bool error = false;
+
+if (tokens.size() < 3)
+error = true;
+else if (!getTokenInteger(tokens[1], "id", id) || id < 0)
+error = true;
+else {
+// back-compat 'type'
+if (getTokenKeyword(tokens[2], "type",
+{{"input", LOK_EXT_TEXTINPUT}, {"end", 
LOK_EXT_TEXTINPUT_END}},
+type))
+error = !getTokenString(tokens[3], "text", text);
+else // normal path:
+error = !getTokenString(tokens[2], "text", text);
+}
 
+if (error)
 {
 sendTextFrameAndLogError("error: cmd=" + std::string(tokens[0]) + " 
kind=syntax");
 return false;
@@ -1260,7 +1270,13 @@ bool ChildSession::extTextInputEvent(const char* 
/*buffer*/, int /*length*/,
 URI::decode(text, decodedText);
 
 getLOKitDocument()->setView(_viewId);
-getLOKitDocument()->postWindowExtTextInputEvent(id, type, 
decodedText.c_str());
+if (type >= 0)
+getLOKitDocument()->postWindowExtTextInputEvent(id, type, 
decodedText.c_str());
+else
+{
+getLOKitDocument()->postWindowExtTextInputEvent(id, LOK_EXT_TEXTINPUT, 
decodedText.c_str());
+getLOKitDocument()->postWindowExtTextInputEvent(id, 
LOK_EXT_TEXTINPUT_END, decodedText.c_str());
+}
 
 return true;
 }
diff --git a/loleaflet/src/layer/marker/TextInput.js 
b/loleaflet/src/layer/marker/TextInput.js
index 8e7196e96..1910d93d0 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -706,9 +706,7 @@ L.TextInput = L.Layer.extend({
var encodedText = encodeURIComponent(text);
var winId = this._map.getWinId();
this._map._socket.sendMessage(
-   'textinput id=' + winId + ' type=input text=' + 
encodedText);
-   this._map._socket.sendMessage(
-   'textinput id=' + winId + ' type=end text=' + 
encodedText);
+   'textinput id=' + winId + ' text=' + 
encodedText);
}
},
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: kit/ChildSession.cpp loleaflet/src

2019-08-22 Thread Tor Lillqvist (via logerrit)
 kit/ChildSession.cpp |   10 ++
 loleaflet/src/control/Control.Menubar.js |6 ++
 loleaflet/src/control/Toolbar.js |3 ++-
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 634be102c71305f0f35fe86e980ccabb381ae766
Author: Tor Lillqvist 
AuthorDate: Thu Aug 22 15:47:12 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Thu Aug 22 16:25:14 2019 +0200

tdf#126968: Implement "Save as PDF" in the iOS app

For now, add an entry "Save as PDF" to the File menu in the iOS app.
Handle in an iOS-specific way in ChildSession::downloadAs(). The PDF
is saved in the app's document directory on the device. The name of
the PDF is the basename of the document being edited with the "pdf"
extension.

Change-Id: Ib0059a86b03b978996eb4cadf230ba7f0abcba62
Reviewed-on: https://gerrit.libreoffice.org/77961
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index fadbca1ea..6d7751fdc 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -879,6 +879,15 @@ bool ChildSession::downloadAs(const char* /*buffer*/, int 
/*length*/, const std:
 filterOptions += std::string(",Watermark=") + getWatermarkText() + 
std::string("WATERMARKEND");
 }
 
+#ifdef IOS
+NSArray *pathComponents = [[NSURL URLWithString:[NSString 
stringWithUTF8String:getDocURL().c_str()]] pathComponents];
+NSString *baseName = [[pathComponents lastObject] 
stringByDeletingPathExtension];
+NSURL *documentDirectory = [NSFileManager.defaultManager 
URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask][0];
+NSURL *pdfURL = [documentDirectory URLByAppendingPathComponent:[baseName 
stringByAppendingString:@".pdf"]];
+getLOKitDocument()->saveAs([[pdfURL absoluteString] UTF8String],
+   format.empty() ? nullptr : format.c_str(),
+   filterOptions.empty() ? nullptr : 
filterOptions.c_str());
+#else
 // The file is removed upon downloading.
 const std::string tmpDir = FileUtil::createRandomDir(JAILED_DOCUMENT_ROOT);
 // Prevent user inputting anything funny here.
@@ -898,6 +907,7 @@ bool ChildSession::downloadAs(const char* /*buffer*/, int 
/*length*/, const std:
 
 sendTextFrame("downloadas: jail=" + _jailId + " dir=" + tmpDir + " name=" 
+ name +
   " port=" + std::to_string(ClientPortNumber) + " id=" + id);
+#endif
 return true;
 }
 
diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index 41120cfc2..c71fee473 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -27,6 +27,7 @@ L.Control.Menubar = L.Control.extend({
{name: _('Word 2003 Document (.doc)'), 
id: 'downloadas-doc', type: 'action'},
{name: _('Word Document (.docx)'), id: 
'downloadas-docx', type: 'action'},
{name: _('Rich Text (.rtf)'), id: 
'downloadas-rtf', type: 'action'}]},
+   {name: _('Save as PDF'), id: 'downloadas-pdf', 
mobileapp: true, type: 'action'},
{name: _('Sign document'), id: 'signdocument', 
type: 'action'},
{type: 'separator'},
{name: _('Close document'), id: 
'closedocument', type: 'action'}
@@ -250,6 +251,7 @@ L.Control.Menubar = L.Control.extend({
{name: _('ODF presentation (.odp)'), 
id: 'downloadas-odp', type: 'action'},
{name: _('PowerPoint 2003 Presentation 
(.ppt)'), id: 'downloadas-ppt', type: 'action'},
{name: _('PowerPoint Presentation 
(.pptx)'), id: 'downloadas-pptx', type: 'action'}]},
+   {name: _('Save as PDF'), id: 'downloadas-pdf', 
mobileapp: true, type: 'action'},
{type: 'separator'},
{name: _('Close document'), id: 
'closedocument', type: 'action'}
]},
@@ -338,6 +340,7 @@ L.Control.Menubar = L.Control.extend({
{name: _('ODF spreadsheet (.ods)'), id: 
'downloadas-ods', type: 'action'},
{name: _('Excel 2003 Spreadsheet 
(.xls)'), id: 'downloadas-xls', type: 'action'},
{name: _('Excel Spreadsheet (.xlsx)'), 
id: 'downloadas-xlsx', type: 'action'}]},
+   {name: _('Save as PDF'), id: 'downloadas-pdf', 
mobileapp: true, type: 'action'},
{type: 'separator'},
{name: _('Close document'), id: 
'closedocument', type: 'action'}
]},
@@ -996,6 +999,9 @@ L.Control.Menubar = 

[Libreoffice-commits] online.git: kit/ChildSession.cpp loleaflet/src

2018-02-21 Thread Pranav Kant
 kit/ChildSession.cpp  |5 -
 loleaflet/src/layer/tile/TileLayer.js |2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit fc4d6aeeb9a14b6ff8c2b09cab8c2d358cd0e42d
Author: Pranav Kant 
Date:   Wed Feb 21 21:29:50 2018 +0530

ime: Don't eat space

Encode/decode so that ' ' as payload of compositionupdate event doesn't
get lost.

Change-Id: Ia31abe85f1cf19f8f286c9069097bdc72297e664

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index ef9bfd3d..4b9199f8 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -785,9 +785,12 @@ bool ChildSession::extTextInputEvent(const char* 
/*buffer*/, int /*length*/,
 return false;
 }
 
+std::string decodedText;
+URI::decode(text, decodedText);
+
 std::unique_lock lock(_docManager.getDocumentMutex());
 getLOKitDocument()->setView(_viewId);
-getLOKitDocument()->postExtTextInputEvent(id, type, text.c_str());
+getLOKitDocument()->postExtTextInputEvent(id, type, decodedText.c_str());
 
 return true;
 }
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 8cafab6b..72318ae1 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1470,7 +1470,7 @@ L.TileLayer = L.GridLayer.extend({
 
// if winId=0, then event is posted on the document
_postCompositionEvent: function(winId, type, text) {
-   this._map._socket.sendMessage('textinput id=' + winId + ' 
type=' + type + ' text=' + text);
+   this._map._socket.sendMessage('textinput id=' + winId + ' 
type=' + type + ' text=' + encodeURIComponent(text));
},
 
_postSelectGraphicEvent: function(type, x, y) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: kit/ChildSession.cpp loleaflet/src

2017-11-29 Thread Pranav Kant
 kit/ChildSession.cpp   |   21 --
 loleaflet/src/control/Control.LokDialog.js |   59 ++---
 loleaflet/src/layer/tile/TileLayer.js  |4 -
 3 files changed, 42 insertions(+), 42 deletions(-)

New commits:
commit a91f022e426ff34fba032142659fb43fbde65ee9
Author: Pranav Kant 
Date:   Wed Nov 29 00:59:33 2017 +0530

lokdialog: Remove getDialogInfo call; ncorrect dialog size handling

Change-Id: Ieff59baa984982bd8126102dafc5a97f673a4150

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 3c1083c7..b540febe 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -947,7 +947,6 @@ bool ChildSession::renderDialog(const char* /*buffer*/, int 
/*length*/, const st
 size_t pixmapDataSize = 4 * bufferWidth * bufferHeight;
 std::vector pixmap(pixmapDataSize);
 int width = bufferWidth, height = bufferHeight;
-char* pDialogTitle = nullptr;
 std::string response;
 if (isChild)
 {
@@ -966,30 +965,14 @@ bool ChildSession::renderDialog(const char* /*buffer*/, 
int /*length*/, const st
 Timestamp timestamp;
 getLOKitDocument()->paintDialog(dialogId, pixmap.data(), startX, 
startY, width, height);
 
-int dialogWidth = 0;
-int dialogHeight = 0;
-getLOKitDocument()->getDialogInfo(dialogId, , 
dialogWidth, dialogHeight);
-
-std::string encodedDialogTitle;
-if (pDialogTitle)
-{
-std::string aDialogTitle(pDialogTitle);
-URI::encode(aDialogTitle, "", encodedDialogTitle);
-free(pDialogTitle);
-}
-
-// rendered width, height cannot be less than the dialog width, height
-width = std::min(width, dialogWidth);
-height = std::min(height, dialogHeight);
 const double area = width * height;
-
 LOG_TRC("paintDialog for " << dialogId << " returned " << width << "X" 
<< height
 << "@(" << startX << "," << startY << ")"
 << "and rendered in " << (timestamp.elapsed()/1000.)
 << "ms (" << area / (timestamp.elapsed()) << " MP/s).");
 
-response = "dialogpaint: id=" + tokens[1] + " title=" + 
encodedDialogTitle +
-" dialogwidth=" + std::to_string(dialogWidth) + " dialogheight=" + 
std::to_string(dialogHeight);
+response = "dialogpaint: id=" + tokens[1] +
+" width=" + std::to_string(width) + " height=" + 
std::to_string(height);
 
 if (!paintRectangle.empty())
 response += " rectangle=" + paintRectangle;
diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 853972a8..c6a67444 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -63,17 +63,25 @@ L.Control.LokDialog = L.Control.extend({
this._map._socket.sendMessage(dialogCmd + ' ' + dialogId + 
(rectangle ? ' rectangle=' + rectangle : ''));
},
 
+   _isRectangleValid: function(rect) {
+   rect = rect.split(',');
+   if (parseInt(rect[0]) < 0 || parseInt(rect[1]) < 0 || 
parseInt(rect[2]) < 0 || parseInt(rect[3]) < 0)
+   return false;
+   return true;
+   },
+
_onDialogMsg: function(e) {
e.dialogId = this.dialogIdPrefix + e.dialogId;
if (e.action === 'created') {
this._width = parseInt(e.size.split(',')[0]);
this._height = parseInt(e.size.split(',')[1]);
-
this._launchDialog(e.dialogId);
this._sendDialogCommand(e.dialogId, 
this._createRectStr());
} else if (e.action === 'invalidate') {
-   // ignore any invalidate callbacks when we have closed 
the dialog
if (this._isOpen(e.dialogId)) {
+   if (!this._isRectangleValid(e.rectangle))
+   return;
+
if (!e.rectangle)
e.rectangle = '0,0,' + this._width + 
',' + this._height;
this._sendDialogCommand(e.dialogId, 
e.rectangle);
@@ -82,6 +90,11 @@ L.Control.LokDialog = L.Control.extend({
this._width = parseInt(e.size.split(',')[0]);
this._height = parseInt(e.size.split(',')[1]);
 
+   // FIXME: we don't really have to destroy and launch 
the dialog again but do it for
+   // now because the size sent to us previously in 
'created' cb is not correct
+   $('#' + e.dialogId).remove();
+   this._launchDialog(e.dialogId);
+   $('#' + e.dialogId).dialog('option', 'title', 
this._title);
this._sendDialogCommand(e.dialogId, 
this._createRectStr());