Discussion:
[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - loleaflet/dist loleaflet/src
Pranav Kant
2017-03-18 22:53:04 UTC
Permalink
loleaflet/dist/toolbar/toolbar.js | 3 ++-
loleaflet/src/control/Control.Menubar.js | 2 +-
loleaflet/src/map/Map.js | 8 ++++++++
3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 0886b30ea0ad403790bf6e6d784ae0ad7bd72d79
Author: Pranav Kant <***@collabora.co.uk>
Date: Fri Mar 17 13:59:38 2017 +0530

loleaflet: Tell WOPI host if document was ever modified by user

Change-Id: Ic99136168716d7a01d1388c4f5e1107ef9e64616
(cherry picked from commit f57e4124035f22d9182c7cda9910e8dc84df5f07)
Reviewed-on: https://gerrit.libreoffice.org/35323
Reviewed-by: Andras Timar <***@collabora.com>
Tested-by: Andras Timar <***@collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 705a6b74..5fb2df87 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -332,7 +332,7 @@ function onClick(id, item, subItem) {
resizeToolbar();
}
else if (id === 'close') {
- map.fire('postMessage', {msgId: 'UI_Close'});
+ map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}});
map.remove();
}
else if (id === 'specialcharacter') {
@@ -1063,6 +1063,7 @@ map.on('doclayerinit', function () {
resizeToolbar();
});

+
map.on('commandstatechanged', function (e) {
var toolbar = w2ui['toolbar-up'];
var toolbarUpMore = w2ui['toolbar-up-more'];
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 279bd6ac..1089f89e 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -471,7 +471,7 @@ L.Control.Menubar = L.Control.extend({
// our host to show revision history mode
map.fire('postMessage', {msgId: 'rev-history'});
} else if (id === 'closedocument') {
- map.fire('postMessage', {msgId: 'UI_Close'});
+ map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}});
map.remove();
}
else if (id === 'repair') {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index f3ef565f..6fa000c5 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -134,6 +134,14 @@ L.Map = L.Evented.extend({

// View color map
this._viewColors = {};
+
+ // This becomes true if document was ever modified by the user
+ this._everModified = false;
+
+ this.on('commandstatechanged', function(e) {
+ if (e.commandName === '.uno:ModifiedStatus')
+ this._everModified = this._everModified || (e.state === 'true');
+ }, this);
},

// public methods that modify map state
Pranav Kant
2017-03-20 08:54:11 UTC
Permalink
loleaflet/dist/loleaflet.css | 4 ++++
loleaflet/dist/partsPreviewControl.css | 2 ++
loleaflet/src/control/Control.PartsPreview.js | 4 ++--
loleaflet/src/layer/tile/ImpressTileLayer.js | 3 +++
4 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit f01eb9482a58e50e2e0af353998894dce03c6c73
Author: Pranav Kant <***@collabora.co.uk>
Date: Mon Mar 20 13:58:33 2017 +0530

loleaflet: Slide sorter for draw documents

(cherry picked from commit 064b2508a7bde1e2d3422824cd06bf0f7c915061)

Conflicts:
loleaflet/src/layer/tile/ImpressTileLayer.js

Change-Id: I4ad11236c0186561b5c7df1a3c634e54f8576c8c
Reviewed-on: https://gerrit.libreoffice.org/35454
Reviewed-by: Andras Timar <***@collabora.com>
Tested-by: Andras Timar <***@collabora.com>

diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index da8a073e..e3f70a16 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -45,6 +45,10 @@ body {
display: block;
}

+#presentation-controls-wrapper.drawing {
+ bottom: 34px; /* Hide the presentation toolbar (insert slide etc.) for doctype = drawing */
+}
+
#presentation-controls-wrapper.readonly {
top: 30px;
}
diff --git a/loleaflet/dist/partsPreviewControl.css b/loleaflet/dist/partsPreviewControl.css
index 4dc87f95..438b137d 100644
--- a/loleaflet/dist/partsPreviewControl.css
+++ b/loleaflet/dist/partsPreviewControl.css
@@ -19,6 +19,8 @@
}

.preview-img {
+ /* In draw docs, the width of previews are small, but we want a min of 180px to align it with document's left edge */
+ min-width: 180px;
vertical-align: middle;
max-width: 184px;
cursor: pointer;
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index c4409105..f466be8c 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -28,7 +28,7 @@ L.Control.PartsPreview = L.Control.extend({
return;
}

- if (docType === 'presentation') {
+ if (docType === 'presentation' || docType === 'drawing') {
if (!this._previewInitialized)
{
// make room for the preview
@@ -145,7 +145,7 @@ L.Control.PartsPreview = L.Control.extend({
},

_updatePreview: function (e) {
- if (this._map.getDocType() === 'presentation') {
+ if (this._map.getDocType() === 'presentation' || this._map.getDocType() === 'drawing') {
// the scrollbar has to be re-initialized here else it doesn't work
// probably a bug from the scrollbar
this._previewTiles[e.id].onload = function () {
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index da0166c6..c00a4561 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -126,6 +126,9 @@ L.ImpressTileLayer = L.TileLayer.extend({
this._docWidthTwips = command.width;
this._docHeightTwips = command.height;
this._docType = command.type;
+ if (this._docType === 'drawing') {
+ L.DomUtil.addClass(L.DomUtil.get('presentation-controls-wrapper'), 'drawing');
+ }
this._updateMaxBounds(true);
this._documentInfo = textMsg;
this._parts = command.parts;

Loading...