[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/src wsd/DocumentBroker.cpp wsd/Storage.cpp wsd/Storage.hpp

Marco Cecchetti marco.cecchetti at collabora.com
Wed Apr 25 09:17:34 UTC 2018


 loleaflet/src/control/Control.Menubar.js |    5 ++++-
 loleaflet/src/map/handler/Map.WOPI.js    |    2 ++
 wsd/DocumentBroker.cpp                   |    1 +
 wsd/Storage.cpp                          |    4 +++-
 wsd/Storage.hpp                          |    4 ++++
 5 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 0224328470cef3e629dd0352a6a324e937457eb3
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Apr 23 16:25:00 2018 +0200

    wopi flag for hiding the change tracking controls from UI
    
    Change-Id: I1b9aa4f8111d77ae12093022205fad1cbee850ac
    Reviewed-on: https://gerrit.libreoffice.org/53336
    Tested-by: Aron Budea <aron.budea at collabora.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 936dfc383..808fe0e18 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -38,7 +38,7 @@ L.Control.Menubar = L.Control.extend({
 				{type: 'separator'},
 				{uno: '.uno:SearchDialog'},
 				{type: 'separator'},
-				{name: _UNO('.uno:ChangesMenu', 'text'), type: 'menu', menu: [
+				{name: _UNO('.uno:ChangesMenu', 'text'), id: 'changesmenu', type: 'menu', menu: [
 					{uno: '.uno:TrackChanges'},
 					{uno: '.uno:ShowTrackedChanges'},
 					{type: 'separator'},
@@ -805,6 +805,9 @@ L.Control.Menubar = L.Control.extend({
 			if (menu[i].id && menu[i].id.startsWith('fullscreen-presentation') && this._map['wopi'].HideExportOption)
 				continue;
 
+			if (menu[i].id === 'changesmenu' && this._map['wopi'].HideChangeTrackingControls)
+				continue;
+
 			// Keep track of all 'downloadas-' options and register them as
 			// export formats with docLayer which can then be publicly accessed unlike
 			// this Menubar control for which there doesn't seem to be any easy way
diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js
index b95dd1ed9..9a55fd577 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -13,6 +13,7 @@ L.Map.WOPI = L.Handler.extend({
 	HidePrintOption: false,
 	HideSaveOption: false,
 	HideExportOption: false,
+	HideChangeTrackingControls: false,
 	DisablePrint: false,
 	DisableExport: false,
 	DisableCopy: false,
@@ -67,6 +68,7 @@ L.Map.WOPI = L.Handler.extend({
 		this.HidePrintOption = !!wopiInfo['HidePrintOption'];
 		this.HideSaveOption = !!wopiInfo['HideSaveOption'];
 		this.HideExportOption = !!wopiInfo['HideExportOption'];
+		this.HideChangeTrackingControls = !!wopiInfo['HideChangeTrackingControls'];
 		this.DisablePrint = !!wopiInfo['DisablePrint'];
 		this.DisableExport = !!wopiInfo['DisableExport'];
 		this.DisableCopy = !!wopiInfo['DisableCopy'];
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index dca3ddfc6..72c618831 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -502,6 +502,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
         wopiInfo->set("HidePrintOption", wopifileinfo->_hidePrintOption);
         wopiInfo->set("HideSaveOption", wopifileinfo->_hideSaveOption);
         wopiInfo->set("HideExportOption", wopifileinfo->_hideExportOption);
+        wopiInfo->set("HideChangeTrackingControls", wopifileinfo->_hideChangeTrackingControls);
         wopiInfo->set("DisablePrint", wopifileinfo->_disablePrint);
         wopiInfo->set("DisableExport", wopifileinfo->_disableExport);
         wopiInfo->set("DisableCopy", wopifileinfo->_disableCopy);
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 0d4aacb61..ccf92234c 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -544,6 +544,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
     bool hidePrintOption = false;
     bool hideSaveOption = false;
     bool hideExportOption = false;
+    bool hideChangeTrackingControls = false;
     bool disablePrint = false;
     bool disableExport = false;
     bool disableCopy = false;
@@ -567,6 +568,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
         getWOPIValue(object, "HidePrintOption", hidePrintOption);
         getWOPIValue(object, "HideSaveOption", hideSaveOption);
         getWOPIValue(object, "HideExportOption", hideExportOption);
+        getWOPIValue(object, "hideChangeTrackingControls", hideChangeTrackingControls);
         getWOPIValue(object, "EnableOwnerTermination", enableOwnerTermination);
         getWOPIValue(object, "DisablePrint", disablePrint);
         getWOPIValue(object, "DisableExport", disableExport);
@@ -584,7 +586,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
     const Poco::Timestamp modifiedTime = iso8601ToTimestamp(lastModifiedTime);
     _fileInfo = FileInfo({filename, ownerId, modifiedTime, size});
 
-    return std::unique_ptr<WopiStorage::WOPIFileInfo>(new WOPIFileInfo({userId, userName, userExtraInfo, watermarkText, canWrite, postMessageOrigin, hidePrintOption, hideSaveOption, hideExportOption, enableOwnerTermination, disablePrint, disableExport, disableCopy, disableInactiveMessages, userCanNotWriteRelative, callDuration}));
+    return std::unique_ptr<WopiStorage::WOPIFileInfo>(new WOPIFileInfo({userId, userName, userExtraInfo, watermarkText, canWrite, postMessageOrigin, hidePrintOption, hideSaveOption, hideExportOption, hideChangeTrackingControls, enableOwnerTermination, disablePrint, disableExport, disableCopy, disableInactiveMessages, userCanNotWriteRelative, callDuration}));
 }
 
 /// uri format: http://server/<...>/wopi*/files/<id>/content
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index e55e3047f..1d96afd36 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -268,6 +268,7 @@ public:
                      const bool hidePrintOption,
                      const bool hideSaveOption,
                      const bool hideExportOption,
+                     const bool hideChangeTrackingControls,
                      const bool enableOwnerTermination,
                      const bool disablePrint,
                      const bool disableExport,
@@ -283,6 +284,7 @@ public:
               _hidePrintOption(hidePrintOption),
               _hideSaveOption(hideSaveOption),
               _hideExportOption(hideExportOption),
+              _hideChangeTrackingControls(hideChangeTrackingControls),
               _enableOwnerTermination(enableOwnerTermination),
               _disablePrint(disablePrint),
               _disableExport(disableExport),
@@ -312,6 +314,8 @@ public:
         bool _hideSaveOption;
         /// Hide 'Download as' button/menubar item from UI
         bool _hideExportOption;
+        /// Hide change tacking menu from UI
+        bool _hideChangeTrackingControls;
         /// If WOPI host has enabled owner termination feature on
         bool _enableOwnerTermination;
         /// If WOPI host has allowed the user to print the document


More information about the Libreoffice-commits mailing list