[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2019-11-13 Thread Szymon Kłos (via logerrit)
 loleaflet/src/control/Control.JSDialogBuilder.js |   39 +++
 1 file changed, 39 insertions(+)

New commits:
commit 6584e3b8c0673e810bc645617a441ce8fa3bcfd1
Author: Szymon Kłos 
AuthorDate: Wed Nov 13 15:12:04 2019 +0100
Commit: Szymon Kłos 
CommitDate: Wed Nov 13 16:03:51 2019 +0100

jsdialogs: apply shadow transparency updates

Change-Id: I7e615590f8c3ba5f455cfbec55c3fef8919ab1a1

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 58d349a97..47e3df487 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -497,6 +497,13 @@ L.Control.JSDialogBuilder = L.Control.extend({
return state.replace(',', '.');
}
break;
+
+   case 'FIELD_TRANSPARENCY':
+   state = 
items.getItemValue('.uno:FillShadowTransparency');
+   if (state) {
+   return state.replace(',', '.');
+   }
+   break;
}
 
return null;
commit c447c8fb4345916f0e9f8b67018391a8377daf88
Author: Szymon Kłos 
AuthorDate: Wed Nov 13 12:41:35 2019 +0100
Commit: Szymon Kłos 
CommitDate: Wed Nov 13 16:03:51 2019 +0100

jsdialogs: apply fill transparency updates

Change-Id: I630347002474609736e9d41169e65f8e1608ad04

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 7e53c7b53..58d349a97 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -490,6 +490,13 @@ L.Control.JSDialogBuilder = L.Control.extend({
return state.replace(',', '.');
}
break;
+
+   case 'settransparency':
+   state = items.getItemValue('.uno:FillTransparence');
+   if (state) {
+   return state.replace(',', '.');
+   }
+   break;
}
 
return null;
commit 0937a21f9fe344b7cddf2a44d87084b52198b725
Author: Szymon Kłos 
AuthorDate: Wed Nov 13 12:28:00 2019 +0100
Commit: Szymon Kłos 
CommitDate: Wed Nov 13 16:03:51 2019 +0100

jsdialogs: apply line transparency updates

Change-Id: Id222cbdf093fe73655bfda82fd8f41d13b192397

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 74ea811c6..7e53c7b53 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -483,6 +483,13 @@ L.Control.JSDialogBuilder = L.Control.extend({
return state[3];
}
break;
+
+   case 'linetransparency':
+   state = items.getItemValue('.uno:LineTransparence');
+   if (state) {
+   return state.replace(',', '.');
+   }
+   break;
}
 
return null;
commit df0bab8ab033ea6f6d09723ed3f1a16739958652
Author: Szymon Kłos 
AuthorDate: Wed Nov 13 11:01:39 2019 +0100
Commit: Szymon Kłos 
CommitDate: Wed Nov 13 16:03:51 2019 +0100

jsdialogs: apply .uno:NumberFormat updates

Change-Id: I141b1c35bbcfce404c1b042ffe9255db31ec180e

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 6e6a29ad7..74ea811c6 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -465,6 +465,24 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (state)
return state.replace(',', '.');
break;
+
+   case 'decimalplaces':
+   state = items.getItemValue('.uno:NumberFormat');
+   if (state) {
+   state = state.split(',');
+   if (state.length > 2)
+   return state[2];
+   }
+   break;
+
+   case 'leadingzeros':
+   state = items.getItemValue('.uno:NumberFormat');
+   if (state) {
+   state = state.split(',');
+   if (state.length > 3)
+   return state[3];
+   }
+   break;
}
 
return null;
___
Libreoffice-commits mailing list

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2019-10-31 Thread Henry Castro (via logerrit)
 loleaflet/src/control/Control.MobileWizard.js |   11 ---
 loleaflet/src/control/Control.PartsPreview.js |5 -
 loleaflet/src/layer/tile/ImpressTileLayer.js  |   13 -
 3 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 253d72e09a0bb4e5b01d5012c46af02174cfc616
Author: Henry Castro 
AuthorDate: Wed Oct 30 13:27:16 2019 -0400
Commit: Henry Castro 
CommitDate: Thu Oct 31 17:12:07 2019 +0100

loleaflet: mobile: slide preview remains on top of wizard container

Create a new instance of the class "L.Control.PartsPreview" and append
the contents as a header on the mobile wizard container.

Change-Id: Ieb7bfd920087ebc06e4127f26cfc59cf1b2c70b2
Reviewed-on: https://gerrit.libreoffice.org/81795
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index ba2a2e87b..3c7bb2659 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -37,6 +37,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
},
 
beforeAdd: function (map) {
+   map.addControl(L.control.partsPreview());
map.on('zoomend', this._onAnnotationZoom, this);
map.on('updateparts', this.onUpdateParts, this);
map.on('updatepermission', this.onUpdatePermission, this);
@@ -48,6 +49,12 @@ L.ImpressTileLayer = L.TileLayer.extend({
map.on('resize', this.onResize, this);
if (window.mode.isMobile()) {
map.on('doclayerinit', this.onMobileInit, this);
+   L.Control.MobileWizard.mergeOptions({maxHeight: '55%'});
+   var mobileWizard = L.DomUtil.get('mobile-wizard');
+   var container = L.DomUtil.createWithId('div', 
'mobile-wizard-header', mobileWizard);
+   var preview = L.DomUtil.createWithId('div', 
'mobile-slide-sorter', container);
+   L.DomUtil.toBack(container);
+   map.addControl(L.control.partsPreview(container, 
preview, {fetchThumbnail: false}));
}
},
 
@@ -275,7 +282,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
},
 
onAdd: function (map) {
-   map.addControl(L.control.partsPreview());
L.TileLayer.prototype.onAdd.call(this, map);
this._annotations = {};
this._topAnnotation = [];
@@ -359,6 +365,11 @@ L.ImpressTileLayer = L.TileLayer.extend({
this.onAnnotationCancel();
},
 
+   _openMobileWizard: function(data) {
+   L.TileLayer.prototype._openMobileWizard.call(this, data);
+   $('mobile-slide-sorter').mCustomScrollbar('update');
+   },
+
onReplyClick: function (e) {
var comment = {
Id: {
commit bbf31520fadae9eff191155ee91007c8f1f732a9
Author: Henry Castro 
AuthorDate: Thu Oct 31 11:42:10 2019 -0400
Commit: Henry Castro 
CommitDate: Thu Oct 31 17:11:52 2019 +0100

loleaflet: mobile: avoid fetches thumbnail preview when second instance

is created

This is a small optimization, the first instance will fetch the
thumbnail preview, then the second instance, will be a listener only
when it is created.

Change-Id: I883d4260a5ab3dc6dc7d0388969623b9af762fb8
Reviewed-on: https://gerrit.libreoffice.org/81857
Reviewed-by: Henry Castro 
Tested-by: Henry Castro 

diff --git a/loleaflet/src/control/Control.PartsPreview.js 
b/loleaflet/src/control/Control.PartsPreview.js
index fa476ef3b..237a16931 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -6,6 +6,7 @@
 /* global $ */
 L.Control.PartsPreview = L.Control.extend({
options: {
+   fetchThumbnail: true,
autoUpdate: true,
maxWidth: window.mode.isMobile() ? 60 : 180,
maxHeight: window.mode.isMobile() ? 60 : 180
@@ -190,7 +191,9 @@ L.Control.PartsPreview = L.Control.extend({
var imgSize;
if (i === 0 || (previewFrameTop >= topBound && previewFrameTop 
<= bottomBound)
|| (previewFrameBottom >= topBound && 
previewFrameBottom <= bottomBound)) {
-   imgSize = this._map.getPreview(i, i, 
this.options.maxWidth, this.options.maxHeight, {autoUpdate: 
this.options.autoUpdate});
+   imgSize = this.options.fetchThumbnail ?
+   this._map.getPreview(i, i, 
this.options.maxWidth, this.options.maxHeight, {autoUpdate: 
this.options.autoUpdate}) :
+   { width: this.options.maxWidth, height: 
this.options.maxHeight };
img.fetched = true;
 
if (this._direction === 'x') {

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2019-10-04 Thread Henry Castro (via logerrit)
 loleaflet/src/control/Control.LokDialog.js |   29 +++--
 loleaflet/src/map/Map.js   |1 -
 2 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit c90a2ad13ff226655166eb897ca53ab373a6e9f4
Author: Henry Castro 
AuthorDate: Wed Aug 21 11:17:26 2019 -0400
Commit: Michael Meeks 
CommitDate: Fri Oct 4 14:31:10 2019 +0100

loleaflet: mobile: do not add extra space for the scrollbar

Change-Id: I1b58611ed724e6cd7a0c6c0a93c02e283d0d1672

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 36c9bf708..0eef1dbf1 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -890,7 +890,7 @@ L.Control.LokDialog = L.Control.extend({
 
_resizeSidebar: function(strId, width) {
this._currentDeck.width = width;
-   if (width > 1) {
+   if (width > 1 && !window.mode.isMobile()) {
// Add extra space for scrollbar only when visible
width = width + 15;
}
commit 4c303f41dd86bbe6bd8484ee7520f740753370c8
Author: Tamás Zolnai 
AuthorDate: Wed Aug 14 16:32:48 2019 +0200
Commit: Michael Meeks 
CommitDate: Fri Oct 4 14:31:10 2019 +0100

Sidebar: controls without cursor should not pop-up keyboard...

when selected on mobile

In case of the sidebar we need to be careful about
grabbing the focus from the main window, because the
sidebar and the main document window are on the same
screen and so the user can interact with both at the
same time.
However on mobile the sidebar takes the whole screen
so we can grab the focus when the sidebar is visible
and give back the focus to the main window when the
sidebar becomes hidden again.

Change-Id: I6a8975b66d77399f99b803c9931fb668c1fd59a7

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 6cc4934e1..36c9bf708 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -397,11 +397,22 @@ L.Control.LokDialog = L.Control.extend({
L.DomUtil.addClass(cursor, 'blinking-cursor');
},
 
-   focus: function(dlgId, force) {
-   if (!force && (!this._isOpen(dlgId) || 
!this._dialogs[dlgId].cursorVisible))
-   return;
+   focus: function(dlgId) {
+   // In case of the sidebar we should be carefull about
+   // grabbing the focus from the main window.
+   if (this._dialogs[dlgId].isSidebar) {
+   // On mobile, grab the focus if the sidebar is visible.
+   if (window.mode.isMobile()) {
+   if (!this.mobileSidebarVisible)
+   return;
+   // On desktop, grab the focus only when there is a 
visible cursor on the sidebar.
+   } else if (!this._isOpen(dlgId) || 
!this._dialogs[dlgId].cursorVisible) {
+   return;
+   }
+   }
+
this._map.setWinId(dlgId);
-   if (this._isOpen(dlgId) && this._dialogs[dlgId].cursorVisible) {
+   if (this._dialogs[dlgId].cursorVisible) {
this._map.getClipboardContainer().focus();
}
else {
@@ -838,7 +849,7 @@ L.Control.LokDialog = L.Control.extend({
var container = L.DomUtil.get(strId);
if (container)
$(container).parent().show();
-   that.focus(parentId, !isSidebar);
+   that.focus(parentId);
};
img.src = imgData;
},
commit 4e8a9a450e7faa19c066b28fdd561cf3a48fdfad
Author: Tamás Zolnai 
AuthorDate: Tue Aug 13 14:46:58 2019 +0200
Commit: Michael Meeks 
CommitDate: Fri Oct 4 14:31:10 2019 +0100

Dialogs: controls without cursor should not pop-up keyboard

when selected on mobile

Change-Id: Iee34ad4a878bacea1e11e754b41bf86734796b27

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index b00ff806d..6cc4934e1 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -400,7 +400,13 @@ L.Control.LokDialog = L.Control.extend({
focus: function(dlgId, force) {
if (!force && (!this._isOpen(dlgId) || 
!this._dialogs[dlgId].cursorVisible))
return;
-   this._dialogs[dlgId].input.focus();
+   this._map.setWinId(dlgId);
+   if (this._isOpen(dlgId) && this._dialogs[dlgId].cursorVisible) {
+   this._map.getClipboardContainer().focus();
+   }
+ 

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2019-08-20 Thread Henry Castro (via logerrit)
 loleaflet/src/layer/vector/Path.Transform.js  |   40 +++
 loleaflet/src/layer/vector/SVGGroup.js|   69 ++
 loleaflet/src/map/handler/Map.TouchGesture.js |   24 +++--
 3 files changed, 77 insertions(+), 56 deletions(-)

New commits:
commit fe6a955d7dd1fd369b4d4b887ffeea4b8aaff235
Author: Henry Castro 
AuthorDate: Fri Jun 28 11:50:37 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Aug 20 10:09:21 2019 -0400

loleaflet: mobile: enable the option to scale and rotate graphics

Change-Id: I66e082ae7bf7551de90002164a87d2a267ea1523

diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js 
b/loleaflet/src/map/handler/Map.TouchGesture.js
index ff5d61d61..db4f433aa 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -12,7 +12,8 @@ L.Map.TouchGesture = L.Handler.extend({
statics: {
MAP: 1,
CURSOR: 2,
-   GRAPHIC: 4
+   GRAPHIC: 4,
+   MARKER: 8
},
 
initialize: function (map) {
@@ -125,7 +126,13 @@ L.Map.TouchGesture = L.Handler.extend({
layerPoint = 
this._map.containerPointToLayerPoint(containerPoint),
latlng = this._map.layerPointToLatLng(layerPoint);
 
-   if (this._map._docLayer._graphicMarker && 
this._map._docLayer._graphicMarker.getBounds().contains(latlng)) {
+   if (this._map._docLayer._graphicMarker) {
+   this._marker = 
this._map._docLayer._graphicMarker.transform.getMarker(layerPoint);
+   }
+
+   if (this._marker) {
+   this._state = L.Map.TouchGesture.MARKER;
+   } else if (this._map._docLayer._graphicMarker && 
this._map._docLayer._graphicMarker.getBounds().contains(latlng)) {
this._state = L.Map.TouchGesture.GRAPHIC;
} else if (this._map._docLayer._cellCursor && 
this._map._docLayer._cellCursor.contains(latlng)) {
this._state = L.Map.TouchGesture.CURSOR;
@@ -136,6 +143,7 @@ L.Map.TouchGesture = L.Handler.extend({
 
if (e.isLast && this._state !== L.Map.TouchGesture.MAP) {
this._state = L.Map.TouchGesture.hitTest.MAP;
+   this._marker = undefined;
}
 
if ($(e.srcEvent.target).has(this._map._mapPane)) {
@@ -258,7 +266,9 @@ L.Map.TouchGesture = L.Handler.extend({
}
}
 
-   if (this._state === L.Map.TouchGesture.GRAPHIC) {
+   if (this._state === L.Map.TouchGesture.MARKER) {
+   this._map._fireDOMEvent(this._marker, e.srcEvent, 
'mousedown');
+   } else if (this._state === L.Map.TouchGesture.GRAPHIC) {

this._map._docLayer._graphicMarker._onDragStart(e.srcEvent);
} else if (this._state === L.Map.TouchGesture.CURSOR) {
this._map._docLayer._postMouseEvent('buttondown', 
mousePos.x, mousePos.y, 1, 1, 0);
@@ -274,7 +284,9 @@ L.Map.TouchGesture = L.Handler.extend({
latlng = this._map.layerPointToLatLng(layerPoint),
mousePos = this._map._docLayer._latLngToTwips(latlng);
 
-   if (this._state === L.Map.TouchGesture.GRAPHIC) {
+   if (this._state === L.Map.TouchGesture.MARKER) {
+   this._map._fireDOMEvent(this._map, e.srcEvent, 
'mousemove');
+   } else if (this._state === L.Map.TouchGesture.GRAPHIC) {
this._map._docLayer._graphicMarker._onDrag(e.srcEvent);
} else if (this._state === L.Map.TouchGesture.CURSOR) {
this._map._docLayer._postMouseEvent('move', mousePos.x, 
mousePos.y, 1, 1, 0);
@@ -290,7 +302,9 @@ L.Map.TouchGesture = L.Handler.extend({
latlng = this._map.layerPointToLatLng(layerPoint),
mousePos = this._map._docLayer._latLngToTwips(latlng);
 
-   if (this._state === L.Map.TouchGesture.GRAPHIC) {
+   if (this._state === L.Map.TouchGesture.MARKER) {
+   this._map._fireDOMEvent(this._map, e.srcEvent, 
'mouseup');
+   } else if (this._state === L.Map.TouchGesture.GRAPHIC) {

this._map._docLayer._graphicMarker._onDragEnd(e.srcEvent);
} else if (this._state === L.Map.TouchGesture.CURSOR) {
this._map._docLayer._postMouseEvent('buttonup', 
mousePos.x, mousePos.y, 1, 1, 0);
commit bd9da52e63ba13608341c2dd30ce670835a87843
Author: Henry Castro 
AuthorDate: Fri Jun 28 11:49:50 2019 -0400
Commit: Henry Castro 
CommitDate: Tue Aug 20 10:09:21 2019 -0400

loleaflet: mobile: prepare manual dragging for scale and rotate of 

[Libreoffice-commits] online.git: 4 commits - loleaflet/src wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/reference.md wsd/Storage.cpp wsd/Storage.hpp

2018-12-20 Thread Libreoffice Gerrit user
 loleaflet/src/map/handler/Map.WOPI.js |5 +
 wsd/DocumentBroker.cpp|4 
 wsd/LOOLWSD.cpp   |8 
 wsd/Storage.cpp   |7 ++-
 wsd/Storage.hpp   |6 ++
 wsd/reference.md  |   23 +++
 6 files changed, 48 insertions(+), 5 deletions(-)

New commits:
commit 2cf0907bffbeee58606b29988d37db198e7c46f3
Author: Jan Holesovsky 
AuthorDate: Thu Dec 20 12:40:24 2018 +0100
Commit: Jan Holesovsky 
CommitDate: Thu Dec 20 12:40:35 2018 +0100

Document /hosting/capabilities.

Change-Id: Ib18d2cc44f0e6b36d9628039457dc09f1d1b4f62

diff --git a/wsd/reference.md b/wsd/reference.md
index 70eeb9609..78165b836 100644
--- a/wsd/reference.md
+++ b/wsd/reference.md
@@ -170,3 +170,21 @@ Hosts should not save the file to storage in such cases 
and respond with HTTP 40
 When the user chooses "overwrite" when asked how to resolve the conflict, 
LibreOffice will attempt one more save operation, but this time it will lack 
the X-LOOL-WOPI-Timestamp header, which means "save regardless of state of the
 file".
 
+/hosting/capabilities
+-
+
+With new features, it is important for the integrations to know if the Online 
they are using is supporting them.  For this reason, we have introduced a 
/hosting/capabilities endpoint that returns a JSON with information about the 
availability of various features.
+
+Currently the following are present:
+
+* convert-to: {available: true/false }
+
+  The property *available* is *true* when the convert-to functionality is 
present and correctly accessible from the WOPI host.
+
+* hasTemplateSaveAs: true/false
+
+  is *true* when the Online supports the TemplateSaveAs CheckFileInfo property.
+
+* hasMobileSupport: true/false
+
+  is *true* when the Online has a good support for the mobile devices and 
responsive design.
commit 21e9749d90877230b9417a579deadaaa9860f07b
Author: Jan Holesovsky 
AuthorDate: Wed Dec 19 14:56:01 2018 +0100
Commit: Jan Holesovsky 
CommitDate: Thu Dec 20 12:40:35 2018 +0100

capabilities: Encourage use on mobile devices.

Change-Id: Ia090503220d659b5a5daf422eaa7580630bde444

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 541b77ed8..f43aca9c5 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2767,7 +2767,7 @@ private:
 return ostrXML.str();
 }
 
-/// Process the capabilities.json file and return as string.
+/// Create the /hosting/capabilities JSON and return as string.
 std::string getCapabilitiesJson(const Poco::Net::HTTPRequest& request)
 {
 std::shared_ptr socket = _socket.lock();
@@ -2783,8 +2783,8 @@ private:
 // Supports the TemplateSaveAs in CheckFileInfo?
 capabilities->set("hasTemplateSaveAs", true);
 
-// Version
-capabilities->set("version", LOOLWSD_VERSION);
+// Hint to encourage use on mobile devices
+capabilities->set("hasMobileSupport", true);
 
 std::ostringstream ostrJSON;
 capabilities->stringify(ostrJSON);
commit a877885d9c34192430828a4dd8c9910748007bb5
Author: Jan Holesovsky 
AuthorDate: Tue Dec 18 13:14:38 2018 +0100
Commit: Jan Holesovsky 
CommitDate: Thu Dec 20 12:40:35 2018 +0100

TemplateSaveAs: Don't forward to the client if not specified.

So that we don't attempt saving as the first thing after opening.

Change-Id: I30864ccdc766ec8843a60b40e991461f1be9cf8f

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 449ef0353..4199ece0c 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -542,7 +542,10 @@ bool DocumentBroker::load(const 
std::shared_ptr& session, const s
 wopifileinfo->setHideExportOption(true);
 
 wopiInfo->set("BaseFileName", 
wopiStorage->getFileInfo().getFilename());
-wopiInfo->set("TemplateSaveAs", wopifileinfo->getTemplateSaveAs());
+
+if (!wopifileinfo->getTemplateSaveAs().empty())
+wopiInfo->set("TemplateSaveAs", wopifileinfo->getTemplateSaveAs());
+
 wopiInfo->set("HidePrintOption", wopifileinfo->getHidePrintOption());
 wopiInfo->set("HideSaveOption", wopifileinfo->getHideSaveOption());
 wopiInfo->set("HideExportOption", wopifileinfo->getHideExportOption());
commit f2fcf49b3b4a2f74ff6a18c037b61387208ce7bc
Author: Jan Holesovsky 
AuthorDate: Wed Nov 14 20:16:26 2018 +0100
Commit: Jan Holesovsky 
CommitDate: Thu Dec 20 12:40:35 2018 +0100

checkfileinfo: TemplateSaveAs to trigger PutRelativeFile...

...as the first thing after load.

Change-Id: I8c372ebe0228682d4f1d7cb89fe80ea59455c5bb

diff --git a/loleaflet/src/map/handler/Map.WOPI.js 
b/loleaflet/src/map/handler/Map.WOPI.js
index b0d5a7750..cf0bf7013 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -92,6 +92,11 @@ L.Map.WOPI = L.Handler.extend({
  

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2018-12-18 Thread Libreoffice Gerrit user
 loleaflet/src/control/Signing.js |   36 +
 loleaflet/src/vcl.js |   48 ++-
 2 files changed, 64 insertions(+), 20 deletions(-)

New commits:
commit be9346ddf6c015e59c8829efd0ec8d29b817dd5f
Author: Tomaž Vajngerl 
AuthorDate: Tue Dec 18 17:36:47 2018 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 18 17:39:21 2018 +0100

on auth. event check session and list of idents., log known events

Change-Id: Ie668defffa6f3450571df708db27f163789aa848

diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index 53c0cf770..0f0a8036f 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -413,10 +413,26 @@ L.Map.include({
onEvent: function(event) {
switch (event.type) {
case 'ActionConfirmedAndExecuted':
-   
console.log('ActionConfirmedAndExecuted');
+   console.log('event 
ActionConfirmedAndExecuted');
break;
case 'Authenticated':
-   vereignRestoreIdentity();
+   console.log('event 
Authenticated');
+   
library.hasSession().then(function(result) {
+   if (isSuccess(result)) {
+   
library.listIdentities().then(function(result) {
+   if 
(isSuccess(result)) {
+   
vereignRestoreIdentity();
+   }
+   });
+   }
+   });
+   break;
+   case 'Logout':
+   console.log('event Logout');
+   _map.signingLogout();
+   break;
+   case 'QRCodeUpdated':
+   console.log('event 
QRCodeUpdated');
break;
default:
console.log('UNKNOWN EVENT: ' + 
event.type);
commit 0c28b32069e1bdae508d80d8706cbe1eb965a3a0
Author: Tomaž Vajngerl 
AuthorDate: Tue Dec 18 17:34:40 2018 +0100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 18 17:39:21 2018 +0100

additional WOPI endpoint parameter for vereign client library

Change-Id: Iddae25824ca00dcfca8e602c02a72cc60d03431a

diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index 53c0ec894..53c0cf770 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -425,7 +425,8 @@ L.Map.include({
}
},
vereignURL + '/vcl/js/iframe',
-   vereignURL + '/api/'
+   vereignURL + '/api/',
+   vereignURL + '/wopi/'
).then(function(lib) {
library = lib;
adjustUIState();
diff --git a/loleaflet/src/vcl.js b/loleaflet/src/vcl.js
index fd413846c..f3a492073 100644
--- a/loleaflet/src/vcl.js
+++ b/loleaflet/src/vcl.js
@@ -8,14 +8,20 @@
  * @param methods - list of methods to be used in iframe
  * @param iframeUrl - iframe URL to connect
  * @param apiUrl -  API URL used to access API endpoints
+ * @param wopiUrl -  WOPI URL used to acces WopiAPI
  * @returns {*}
  */
-function setupViamAPI(divId, methods, iframeUrl, apiUrl) {
+function setupViamAPI(divId, methods, iframeUrl, apiUrl, wopiUrl) {
   if (!apiUrl) {
 apiUrl = `${window.location.origin}/api/`;
 console.warn(`API host URL not specified. Fall back to ${apiUrl}`); // 
eslint-disable-line no-console
   }
 
+  if (!wopiUrl) {
+wopiUrl = `${window.location.origin}/wopi/`;
+console.warn(`WOPI host URL not specified. Fall back to ${wopiUrl}`); // 
eslint-disable-line no-console
+  }
+
   if (!iframeUrl) {
 iframeUrl = `${window.location.origin}/vcl/js/iframe`;
 console.warn(`Iframe URL not specified. Fall back to ${iframeUrl}`); // 
eslint-disable-line no-console
@@ -31,9 +37,10 @@ function setupViamAPI(divId, methods, iframeUrl, apiUrl) {
   });
 
   return connection.promise
-.then((child) => 

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2017-02-22 Thread Pranav Kant
 loleaflet/src/layer/AnnotationManager.js |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit f4d9d587b0a7ac2c8c38c5e4d706e3ef6d1b9f15
Author: Pranav Kant 
Date:   Wed Feb 22 15:47:53 2017 +0530

loleaflet: Listen to remove callbacks and remove comment when asked to

Change-Id: I4101cfa1e848f63e6ed14c131a35a14146427721

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index 54e371a..a76e9f0 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -205,7 +205,7 @@ L.AnnotationManager = L.Class.extend({
 
} else if (obj.comment.action === 'Remove') {
if (this.getItem(obj.comment.id)) {
-   // something wrong here
+   this.remove(obj.comment.id);
}
} else if (obj.comment.action === 'Modify') {
obj.comment.anchorPos = 
L.LOUtil.stringToPoint(obj.comment.anchorPos);
commit 5078d31aa08cd695c318b4c9d162ebc2dbe8d1e0
Author: Pranav Kant 
Date:   Wed Feb 22 15:43:13 2017 +0530

loleaflet: Do not check for anchorPos on remove callbacks

Otherwise our js errors out.

Change-Id: If70468ee12f70990f7d4e5c7cd8e01262437e769

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index 3d3a12e..54e371a 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -188,9 +188,9 @@ L.AnnotationManager = L.Class.extend({
 
onACKComment: function (textMsg) {
var obj = JSON.parse(textMsg.substring('comment:'.length + 1));
-   obj.comment.anchorPos = 
L.LOUtil.stringToPoint(obj.comment.anchorPos);
 
if (obj.comment.action === 'Add') {
+   obj.comment.anchorPos = 
L.LOUtil.stringToPoint(obj.comment.anchorPos);
var added = this.getItem('new');
if (added) {
delete obj.comment.action;
@@ -208,6 +208,7 @@ L.AnnotationManager = L.Class.extend({
// something wrong here
}
} else if (obj.comment.action === 'Modify') {
+   obj.comment.anchorPos = 
L.LOUtil.stringToPoint(obj.comment.anchorPos);
var modified = this.getItem(obj.comment.id);
if (modified) {
modified._data = obj.comment;
commit f93c3e566021b9a61d0a07c61152f438f7486c25
Author: Pranav Kant 
Date:   Wed Feb 22 15:41:17 2017 +0530

loleaflet: Other things can change too

Modify callback is emitted even when the content changes, it doesn't
just signify a change in anchor position

Change-Id: I287efc6cd5f170a68ed73b303c50d55e6bfd45e8

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index fb01ddf..3d3a12e 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -209,8 +209,9 @@ L.AnnotationManager = L.Class.extend({
}
} else if (obj.comment.action === 'Modify') {
var modified = this.getItem(obj.comment.id);
-   if (modified && 
!modified._data.anchorPos.equals(obj.comment.anchorPos)) {
-   modified._data.anchorPos = 
obj.comment.anchorPos;
+   if (modified) {
+   modified._data = obj.comment;
+   modified._updateContent();
this.update();
}
}
commit 5a3ac377986a3776d45a4973e48f4454f2522eca
Author: Pranav Kant 
Date:   Wed Feb 22 15:40:50 2017 +0530

loleaflet comments: Id is string type, not integer

Change-Id: I03f8881e70c0043cd14e5b2d7cf3ce5dd27870b4

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index e5dfbdd..fb01ddf 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -236,7 +236,7 @@ L.AnnotationManager = L.Class.extend({
_onAnnotationRemove: function (id) {
var comment = {
Id: {
-   type: 'long',
+   type: 'string',
value: id
}
};
@@ -261,7 +261,7 @@ L.AnnotationManager = L.Class.extend({
} else {
var comment = {
Id: {
-   type: 'long',
+   type: 'string',
 

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2016-06-18 Thread Pranav Kant
 loleaflet/src/control/Control.Menubar.js |8 
 loleaflet/src/control/Control.Scroll.js  |   10 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 76178f22e568c2603419bdebfe081bc8e4bbb076
Author: Pranav Kant 
Date:   Sun Jun 19 01:04:55 2016 +0530

loleaflet: bccu#1887: Enable keyevents on menubar

Make it focusable. This also enables ESC key to reset the opened
menu.

Change-Id: Ia7be49af45b25ae7d29a5ba95b83591af0d82dca

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index f45664e..9bdfba6 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -178,6 +178,7 @@ L.Control.Menubar = L.Control.extend({
subIndicatorsPos: 'append',
subIndicatorsText: ''
});
+   $('#main-menu').attr('tabindex', 0);
this._initialized = true;
 
$('#main-menu').bind('select.smapi', {self: this}, 
this._onItemSelected);
commit 3de264c3fdb6bced35eaaa2971f075d118ff0cb1
Author: Pranav Kant 
Date:   Sun Jun 19 01:04:47 2016 +0530

loleaflet: Hide its submenu when clicked over highlighted menu

Change-Id: Id1249e5d4a0d2013e1dd2a5f8833b3b787b1a137

diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index a81452b..f45664e 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -182,6 +182,13 @@ L.Control.Menubar = L.Control.extend({
 
$('#main-menu').bind('select.smapi', {self: this}, 
this._onItemSelected);
$('#main-menu').bind('beforeshow.smapi', {self: this}, 
this._beforeShow);
+   $('#main-menu').bind('click.smapi', {self: this}, 
this._onClicked);
+   },
+
+   _onClicked: function(e, menu) {
+   if ($(menu).hasClass('highlighted')) {
+   $('#main-menu').smartmenus('menuHideAll');
+   }
},
 
_beforeShow: function(e, menu) {
commit 50a237dd294cd83633ab4965fdb04c1469b2f9b2
Author: Pranav Kant 
Date:   Fri Jun 17 10:00:12 2016 +0530

loleaflet: bccu#1867: Do not scroll first time after doc resizes

This was removed in c7588f0e8c194539e65fb8858fae02522237170a in
an effort to fix calc row/col offset where it must not be ignored to
have aligned row/col offset without any side-effects that one can
have in single-part documents like writer.

Earlier approach using a timer of 200 ms for 'scroll ignore' also
doesn't seem very effective, so change it to: ignoring the first
'whileScrolling' invocation.

Change-Id: Ic3a6868a279fc200b8f9fee74bb40aebad5d9646

diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 1ce203f..b5e6b1b 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -36,6 +36,7 @@ L.Control.Scroll = L.Control.extend({
 
_onScroll: function (e) {
if (this._ignoreScroll) {
+   this._ignoreScroll = null;
return;
}
if (this._prevScrollY === undefined) {
@@ -113,10 +114,14 @@ L.Control.Scroll = L.Control.extend({
},
 
_onUpdateSize: function (e) {
-   this._ignoreScroll = true;
+   // for writer documents, ignore scroll while document size is 
being reduced
+   var prevDocY = parseFloat(L.DomUtil.getStyle(this._mockDoc, 
'height'));
+   if (this._map.getDocType() === 'text' && e.y < prevDocY) {
+   this._ignoreScroll = true;
+   }
+
L.DomUtil.setStyle(this._mockDoc, 'width', e.x + 'px');
L.DomUtil.setStyle(this._mockDoc, 'height', e.y + 'px');
-   this._ignoreScroll = null;
},
 
_onUpdateScrollOffset: function (e) {
commit be6acfcd4e0dd5830530e73b5261e03b4c9e9bf5
Author: Pranav Kant 
Date:   Fri Jun 17 09:18:26 2016 +0530

loleaflet: Remove superfluous call

Option 'updateOnContentResize' is true by default, which means
this method is called automatically when scroll container is
resized, so no need to manually call it again.

Change-Id: Ie80e90239752acb119e3a92c09a1f77dd61b2ad4

diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 8cc7dcb..1ce203f 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -116,7 +116,6 @@ L.Control.Scroll = L.Control.extend({
this._ignoreScroll = true;
L.DomUtil.setStyle(this._mockDoc, 'width', e.x + 'px');
L.DomUtil.setStyle(this._mockDoc, 'height', e.y + 'px');
-

[Libreoffice-commits] online.git: 4 commits - loleaflet/src loolwsd/Admin.cpp loolwsd/Admin.hpp loolwsd/AdminModel.cpp loolwsd/AdminModel.hpp loolwsd/DocumentBroker.cpp loolwsd/DocumentBroker.hpp lool

2016-04-15 Thread Pranav Kant
 loleaflet/src/admin/AdminSocketOverview.js |  119 +++--
 loolwsd/Admin.cpp  |   42 --
 loolwsd/Admin.hpp  |   10 +-
 loolwsd/AdminModel.cpp |   98 ++-
 loolwsd/AdminModel.hpp |   46 ---
 loolwsd/DocumentBroker.cpp |2 
 loolwsd/DocumentBroker.hpp |1 
 loolwsd/LOOLWSD.cpp|   47 +--
 8 files changed, 175 insertions(+), 190 deletions(-)

New commits:
commit 61914208bce83fcb5f7c306a9959e4cab93344b8
Author: Pranav Kant 
Date:   Fri Apr 15 02:20:05 2016 +0530

loleaflet: Adapt to new changes in admin console

Change-Id: I0761bd6c5b3650795a318a077eb50d0a8bd161da

diff --git a/loleaflet/src/admin/AdminSocketOverview.js 
b/loleaflet/src/admin/AdminSocketOverview.js
index 5bcb54e..a930415 100644
--- a/loleaflet/src/admin/AdminSocketOverview.js
+++ b/loleaflet/src/admin/AdminSocketOverview.js
@@ -20,7 +20,7 @@ var AdminSocketOverview = AdminSocketBase.extend({
 
onSocketOpen: function() {
this.socket.send('documents');
-   this.socket.send('subscribe document addview rmview rmdoc');
+   this.socket.send('subscribe adddoc rmdoc');
 
this._getBasicStats();
var socketOverview = this;
@@ -78,9 +78,9 @@ var AdminSocketOverview = AdminSocketBase.extend({
 
var tableContainer = document.getElementById('doclist');
var rowContainer;
-   var pidEle, urlEle, viewsEle, memEle, sDocTimeEle, docEle;
+   var pidEle, nameEle, viewsEle, memEle, sDocTimeEle, docEle, 
aEle;
var nViews, nTotalViews;
-   var docProps, sPid, sUrl, sViews, sMem, sDocTime;
+   var docProps, sPid, sName, sViews, sMem, sDocTime;
if (textMsg.startsWith('documents')) {
var documents = textMsg.substring('documents'.length);
documents = documents.trim().split('\n');
@@ -90,11 +90,11 @@ var AdminSocketOverview = AdminSocketBase.extend({
}
docProps = documents[i].trim().split(' ');
sPid = docProps[0];
-   sUrl = docProps[1];
+   sName = docProps[1];
sViews = docProps[2];
sMem = docProps[3];
sDocTime = docProps[4];
-   if (sUrl === '0') {
+   if (sName === '0') {
continue;
}
rowContainer = document.createElement('tr');
@@ -105,9 +105,9 @@ var AdminSocketOverview = AdminSocketBase.extend({
pidEle.innerHTML = sPid;
rowContainer.appendChild(pidEle);
 
-   urlEle = document.createElement('td');
-   urlEle.innerHTML = sUrl;
-   rowContainer.appendChild(urlEle);
+   nameEle = document.createElement('td');
+   nameEle.innerHTML = sName;
+   rowContainer.appendChild(nameEle);
 
viewsEle = document.createElement('td');
viewsEle.id = 'docview' + sPid;
@@ -125,64 +125,60 @@ var AdminSocketOverview = AdminSocketBase.extend({
rowContainer.appendChild(sDocTimeEle);
}
}
-   else if (textMsg.startsWith('addview')) {
-   sPid = 
textMsg.substring('addview'.length).trim().split(' ')[0];
-   nViews = parseInt(document.getElementById('docview' + 
sPid).innerHTML);
-   document.getElementById('docview' + sPid).innerHTML = 
nViews + 1;
-   nTotalViews = 
parseInt(document.getElementById('active_users_count').innerHTML);
-   document.getElementById('active_users_count').innerHTML 
= nTotalViews + 1;
-   }
-   else if (textMsg.startsWith('rmview')) {
-   sPid = 
textMsg.substring('addview'.length).trim().split(' ')[0];
-   nViews = parseInt(document.getElementById('docview' + 
sPid).innerHTML);
-   document.getElementById('docview' + sPid).innerHTML = 
nViews - 1;
-   nTotalViews = 
parseInt(document.getElementById('active_users_count').innerHTML);
-   document.getElementById('active_users_count').innerHTML 
= nTotalViews - 1;
-   }
-   else if (textMsg.startsWith('document')) {
-

[Libreoffice-commits] online.git: 4 commits - loleaflet/src

2016-01-07 Thread Jan Holesovsky
 loleaflet/src/control/Control.Zoom.js |   11 +++
 loleaflet/src/layer/tile/TileLayer.js |   20 +---
 loleaflet/src/map/Map.js  |   10 +-
 loleaflet/src/map/handler/Map.FileInserter.js |3 +--
 4 files changed, 26 insertions(+), 18 deletions(-)

New commits:
commit 4c3896c32ea1e92b2306c4c759aeccb809a35d68
Author: Jan Holesovsky 
Date:   Thu Jan 7 21:52:19 2016 +0100

loleaflet: No need to use the last zoom in fitWithZoom().

This makes it a stable algorithm.

This reverts commit 749d707c2f2be64424c0f3f9e105f90e22592a41.

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 5e2ded1..bc05cac 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -934,20 +934,19 @@ L.TileLayer = L.GridLayer.extend({
 
_fitWidthZoom: function (e, maxZoom) {
var size = e ? e.newSize : this._map.getSize();
+   var widthTwips = size.x * this._map.options.tileWidthTwips / 
this._tileSize;
maxZoom = maxZoom ? maxZoom : this._map.options.zoom;
if (this._docType !== 'spreadsheet' || !e) {
// If it's not a spreadsheet or the method has been 
invoked manually
var crsScale = this._map.options.crs.scale(1);
-   if (size.x / this._docPixelSize.x > crsScale) {
-   // we could zoom in
-   var ratio = size.x / this._docPixelSize.x;
-   var zoomDelta = Math.ceil(Math.log(ratio) / 
Math.log(crsScale));
-   this._map.setZoom(Math.min(maxZoom, 
this._map.getZoom() + zoomDelta), {animate: false});
-   }
-   if (this._docPixelSize.x > size.x) {
-   ratio = this._docPixelSize.x / size.x;
-   zoomDelta = Math.ceil(Math.log(ratio) / 
Math.log(crsScale));
-   this._map.setZoom(Math.max(1, 
this._map.getZoom() - zoomDelta), {animate: false});
+   if (this._docWidthTwips > 0)
+   {
+   var ratio = widthTwips / this._docWidthTwips;
+   var zoom = this._map.options.zoom + 
Math.floor(Math.log(ratio) / Math.log(crsScale));
+
+   zoom = Math.max(1, zoom);
+   zoom = Math.min(maxZoom, zoom);
+   this._map.setZoom(zoom, {animate: false});
}
}
},
commit f3778421b1d5c4695f8ad42d648aa97c310ae3cb
Author: Ozcan Esen 
Date:   Wed Jan 6 12:33:51 2016 +0200

loleaflet: fix fitWidthZoom inconsistency

Change-Id: I52d05de2b2734d7d2b2f905a3ba797dcca5f

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index b22a0df..5e2ded1 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -938,16 +938,16 @@ L.TileLayer = L.GridLayer.extend({
if (this._docType !== 'spreadsheet' || !e) {
// If it's not a spreadsheet or the method has been 
invoked manually
var crsScale = this._map.options.crs.scale(1);
-   if (this._docPixelSize.x > size.x) {
-   var ratio = this._docPixelSize.x / size.x;
+   if (size.x / this._docPixelSize.x > crsScale) {
+   // we could zoom in
+   var ratio = size.x / this._docPixelSize.x;
var zoomDelta = Math.ceil(Math.log(ratio) / 
Math.log(crsScale));
-   this._map.setZoom(Math.max(1, 
this._map.getZoom() - zoomDelta), {animate: false});
+   this._map.setZoom(Math.min(maxZoom, 
this._map.getZoom() + zoomDelta), {animate: false});
}
-   else if (size.x / this._docPixelSize.x > crsScale) {
-   // we could zoom in
-   ratio = size.x / this._docPixelSize.x;
+   if (this._docPixelSize.x > size.x) {
+   ratio = this._docPixelSize.x / size.x;
zoomDelta = Math.ceil(Math.log(ratio) / 
Math.log(crsScale));
-   this._map.setZoom(Math.min(maxZoom, 
this._map.getZoom() + zoomDelta), {animate: false});
+   this._map.setZoom(Math.max(1, 
this._map.getZoom() - zoomDelta), {animate: false});
}
}
},
commit 07a3b6994e5143c0a6c5a3df946c6ec456114109
Author: Jan Holesovsky 
Date:   Thu Jan 7 17:49:52 

[Libreoffice-commits] online.git: 4 commits - loleaflet/src loolwsd/bundled loolwsd/LOKitClient.cpp loolwsd/LOOLSession.cpp

2015-11-11 Thread Andrzej Hunt
 loleaflet/src/layer/tile/TileLayer.js|   12 +--
 loleaflet/src/map/handler/Map.Mouse.js   |8 +++
 loolwsd/LOKitClient.cpp  |1 
 loolwsd/LOOLSession.cpp  |3 ++
 loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +++-
 5 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 72c407e0ed5c3a9ffd2ae518f9f5d4407e1f5d61
Author: Andrzej Hunt 
Date:   Tue Nov 10 11:44:50 2015 +0100

loleaflet: support mouse cursor calback

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 8f446ea..eddb2bb 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -241,6 +241,9 @@ L.TileLayer = L.GridLayer.extend({
msg += 'height=' + this._docHeightTwips;
this._onInvalidateTilesMsg(msg);
}
+   else if (textMsg.startsWith('mousepointer:')) {
+   this._onMousePointerMsg(textMsg);
+   }
else if (textMsg.startsWith('partpagerectangles:')) {
this._onPartPageRectanglesMsg(textMsg);
}
@@ -376,6 +379,11 @@ L.TileLayer = L.GridLayer.extend({
this._onUpdateCellCursor();
},
 
+   _onMousePointerMsg: function (textMsg) {
+   textMsg = textMsg.substring(14); // "mousepointer: "
+   this._map._container.style.cursor = textMsg;
+   },
+
_onHyperlinkClickedMsg: function (textMsg) {
var link = textMsg.substring(18);
window.open(link, '_blank');
diff --git a/loleaflet/src/map/handler/Map.Mouse.js 
b/loleaflet/src/map/handler/Map.Mouse.js
index 6477be4..82c8c83 100644
--- a/loleaflet/src/map/handler/Map.Mouse.js
+++ b/loleaflet/src/map/handler/Map.Mouse.js
@@ -157,6 +157,14 @@ L.Map.Mouse = L.Handler.extend({
this._map.fire('handleautoscroll', { pos: 
e.containerPoint, map: this._map });
}
}
+   else if (e.type === 'mousemove' && !this._mouseDown) {
+   clearTimeout(this._mouseOverTimeout);
+   mousePos = docLayer._latLngToTwips(e.latlng);
+   this._mouseOverTimeout = setTimeout(L.bind(function() {
+   docLayer._postMouseEvent('move', mousePos.x, 
mousePos.y, 1, 0, modifier);
+ }, this),
+ 100);
+   }
else if (e.type === 'dblclick' || e.type === 'trplclick' || 
e.type === 'qdrplclick') {
mousePos = docLayer._latLngToTwips(e.latlng);
var clicks = {
commit 74edae8703d1e3533260009f931709f64f997574
Author: Andrzej Hunt 
Date:   Tue Nov 10 11:42:56 2015 +0100

loolwsd: support LOK_CALLBACK_MOUSE_POINTER

diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp
index 481c3be..f72f8e6 100644
--- a/loolwsd/LOKitClient.cpp
+++ b/loolwsd/LOKitClient.cpp
@@ -53,6 +53,7 @@ extern "C"
 CASE(GRAPHIC_SELECTION);
 CASE(CELL_CURSOR);
 CASE(HYPERLINK_CLICKED);
+CASE(MOUSE_POINTER);
 CASE(STATE_CHANGED);
 CASE(STATUS_INDICATOR_START);
 CASE(STATUS_INDICATOR_SET_VALUE);
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 7565470..1edd3fa 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -891,6 +891,9 @@ extern "C"
 case LOK_CALLBACK_CELL_CURSOR:
 srv->sendTextFrame("cellcursor: " + std::string(pPayload));
 break;
+case LOK_CALLBACK_MOUSE_POINTER:
+srv->sendTextFrame("mousepointer: " + std::string(pPayload));
+break;
 case LOK_CALLBACK_HYPERLINK_CLICKED:
 srv->sendTextFrame("hyperlinkclicked: " + std::string(pPayload));
 break;
commit 69325ce576cd04d4c1c950d42310fec4860d8317
Author: Andrzej Hunt 
Date:   Tue Nov 10 11:42:38 2015 +0100

loolwsd: update bundled headers to contain LOK_CALLBACK_MOUSE_POINTER

diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index bf62675..37837ea 100644
--- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -202,7 +202,14 @@ typedef enum
  *
  * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
  */
-LOK_CALLBACK_CELL_CURSOR
+LOK_CALLBACK_CELL_CURSOR,
+
+/**
+ * The current mouse pointer style.
+ *
+ * Payload is a css mouse pointer style.
+ */
+LOK_CALLBACK_MOUSE_POINTER
 }
 LibreOfficeKitCallbackType;
 

[Libreoffice-commits] online.git: 4 commits - loleaflet/src loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/tsqueue.h

2015-07-21 Thread Mihai Varga
 loleaflet/src/layer/tile/TileLayer.js |   34 --
 loleaflet/src/map/Map.js  |   10 --
 loolwsd/LOOLSession.cpp   |6 --
 loolwsd/LOOLWSD.cpp   |2 +-
 loolwsd/tsqueue.h |9 +
 5 files changed, 46 insertions(+), 15 deletions(-)

New commits:
commit 8f48dabf28076fc448ff76ec5da1cdd59990c5b1
Author: Mihai Varga mihai.va...@collabora.com
Date:   Tue Jul 21 11:08:08 2015 +0300

loolwsd: discard requests that are in the queue already

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 0670876..4bccf72 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -243,7 +243,7 @@ public:
 // Also forward the canceltiles to the child 
process, if any
 session-handleInput(buffer, n);
 }
-else
+else if (!queue.alreadyInQueue(firstLine))
 {
 queue.put(firstLine);
 }
diff --git a/loolwsd/tsqueue.h b/loolwsd/tsqueue.h
index 9511efb..25c2ac2 100644
--- a/loolwsd/tsqueue.h
+++ b/loolwsd/tsqueue.h
@@ -54,6 +54,15 @@ public:
  _queue.end());
 }
 
+bool alreadyInQueue(std::string cmd) {
+for (auto it = _queue.cbegin(); it != _queue.cend(); ++it) {
+if (cmd == *it) {
+return true;
+}
+}
+return false;
+}
+
 private:
 std::mutex _mutex;
 std::condition_variable _cv;
commit 47790d9d5dc5b5131a0934080086f94845ef51a9
Author: Mihai Varga mihai.va...@collabora.com
Date:   Mon Jul 20 20:10:13 2015 +0300

loolwsd: use the new invalidate x y widht height command

diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 69dccc7..cddf845 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -682,7 +682,6 @@ extern C
 {
 int curPart = 
srv-_loKitDocument-pClass-getPart(srv-_loKitDocument);
 srv-sendTextFrame(curpart: part= + std::to_string(curPart));
-srv-sendTextFrame(invalidatetiles:  + 
std::string(pPayload));
 StringTokenizer tokens(std::string(pPayload),  , 
StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
 if (tokens.count() == 4)
 {
@@ -690,13 +689,16 @@ extern C
 int y(std::stoi(tokens[1]));
 int width(std::stoi(tokens[2]));
 int height(std::stoi(tokens[3]));
-srv-sendTextFrame(invalidate:
+srv-sendTextFrame(invalidatetiles:
 part= + std::to_string(curPart) +
 x= + std::to_string(x) +
 y= + std::to_string(y) +
 width= + std::to_string(width) +
 height= + std::to_string(height));
 }
+else {
+srv-sendTextFrame(invalidatetiles:  + 
std::string(pPayload));
+}
 }
 break;
 case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
commit 596ee77d5a267ebcc39da09d9f603713c5bdbefb
Author: Mihai Varga mihai.va...@collabora.com
Date:   Mon Jul 20 20:09:37 2015 +0300

loleaflet: use the new invalidate x y widht height command

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index ba76534..b4d8024 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -249,18 +249,26 @@ L.TileLayer = L.GridLayer.extend({
this._onUpdateGraphicSelection();
}
else if (textMsg.startsWith('invalidatetiles:')  
!textMsg.match('EMPTY')) {
-   strTwips = textMsg.match(/\d+/g);
-   topLeftTwips = new L.Point(parseInt(strTwips[0]), 
parseInt(strTwips[1]));
-   offset = new L.Point(parseInt(strTwips[2]), 
parseInt(strTwips[3]));
+   command = this._parseServerCmd(textMsg);
+   if (command.x === undefined || command.y === undefined 
|| command.part === undefined) {
+   strTwips = textMsg.match(/\d+/g);
+   command.x = parseInt(strTwips[0]);
+   command.y = parseInt(strTwips[1]);
+   command.width = parseInt(strTwips[2]);
+   command.height = parseInt(strTwips[3]);
+   command.part = this._currentPart;
+   }
+   topLeftTwips = new L.Point(command.x, command.y);
+   offset = new L.Point(command.width,