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 <[email protected]>
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 <[email protected]>
    Tested-by: Andras Timar <[email protected]>

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
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to