diff options
author | mert <mert.tumer@collabora.com> | 2020-06-03 21:16:31 +0300 |
---|---|---|
committer | Mert Tumer <mert.tumer@collabora.com> | 2020-09-28 11:53:23 +0200 |
commit | 2e28b9bb655ac7ebc5b580fabb5636b629dd7f85 (patch) | |
tree | 8e2a71b9aa0ce219c8f0616363fdc21208ef8a01 /loleaflet | |
parent | 4ad8773821f73fa0df665f4d2d4682237a7af677 (diff) |
Change Show/Hide Ruler & Statusbar by default on first load
Change-Id: If0bcf08f005b8461ed559d197b49dc11448344d3
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96489
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'loleaflet')
-rw-r--r-- | loleaflet/src/control/Control.Menubar.js | 13 | ||||
-rw-r--r-- | loleaflet/src/control/Control.StatusBar.js | 12 | ||||
-rw-r--r-- | loleaflet/src/control/Control.UIManager.js | 39 | ||||
-rw-r--r-- | loleaflet/src/control/Ruler.js | 9 |
4 files changed, 69 insertions, 4 deletions
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index e53958f14..d3e3988a7 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -64,6 +64,7 @@ L.Control.Menubar = L.Control.extend({ {name: _UNO('.uno:ZoomMinus', 'text'), id: 'zoomout', type: 'action',}, {name: _('Reset zoom'), id: 'zoomreset', type: 'action'}, {name: _('Show Ruler'), id: 'showruler', type: 'action'}, + {name: _('Show Status Bar'), id: 'showstatusbar', type: 'action'}, {type: 'separator'}, ]).concat([ {uno: '.uno:ControlCodes'}, @@ -294,7 +295,8 @@ L.Control.Menubar = L.Control.extend({ {uno: '.uno:CustomAnimation', drawing: false}, {uno: '.uno:MasterSlidesPanel', drawing: false}, {type: 'separator', drawing: false}, - {uno: '.uno:Sidebar', drawing: false}] + {uno: '.uno:Sidebar', drawing: false}, + {name: _('Show Status Bar'), id: 'showstatusbar', type: 'action'}] }, {name: _UNO('.uno:InsertMenu', 'presentation'), id: 'insert', type: 'menu', menu: [ {name: _('Local Image...'), id: 'insertgraphic', type: 'action'}, @@ -1082,6 +1084,13 @@ L.Control.Menubar = L.Control.extend({ $(aItem).removeClass(constChecked); } + } else if (id === 'showstatusbar') { + if (self._map.uiManager.isStatusBarVisible()) { + $(aItem).addClass(constChecked); + } else { + $(aItem).removeClass(constChecked); + } + } else if (self._map.getDocType() === 'presentation' && (id === 'deletepage' || id === 'insertpage' || id === 'duplicatepage')) { if (id === 'deletepage') { itemState = self._map['stateChangeHandler'].getItemValue('.uno:DeletePage'); @@ -1215,6 +1224,8 @@ L.Control.Menubar = L.Control.extend({ L.toggleFullScreen(); } else if (id === 'showruler') { this._map.uiManager.toggleRuler(); + } else if (id === 'showstatusbar') { + this._map.uiManager.toggleStatusBar(); } else if (id === 'fullscreen-presentation' && this._map.getDocType() === 'presentation') { this._map.fire('fullscreen'); } else if (id === 'presentation-currentslide' && this._map.getDocType() === 'presentation') { diff --git a/loleaflet/src/control/Control.StatusBar.js b/loleaflet/src/control/Control.StatusBar.js index 29a844e9f..62f368403 100644 --- a/loleaflet/src/control/Control.StatusBar.js +++ b/loleaflet/src/control/Control.StatusBar.js @@ -240,7 +240,6 @@ L.Control.StatusBar = L.Control.extend({ }); if (window.mode.isDesktop()) toolbar.tooltip(); - toolbar.show(); } toolbar.bind('touchstart', function() { @@ -397,6 +396,17 @@ L.Control.StatusBar = L.Control.extend({ if (statusbar) statusbar.refresh(); + + var showStatusbar = true; + if (window.uiDefaults) { + if (window.uiDefaults[docType]) { + showStatusbar = window.uiDefaults[docType].ShowStatusbar !== false; + } + } + if (showStatusbar) + $('#toolbar-down').show(); + else + this.map.uiManager.hideStatusBar(true); }, _cancelSearch: function() { diff --git a/loleaflet/src/control/Control.UIManager.js b/loleaflet/src/control/Control.UIManager.js index 8f603eadd..edc0472e6 100644 --- a/loleaflet/src/control/Control.UIManager.js +++ b/loleaflet/src/control/Control.UIManager.js @@ -114,8 +114,14 @@ L.Control.UIManager = L.Control.extend({ L.DomUtil.remove(L.DomUtil.get('presentation-controls-wrapper')); if ((window.mode.isTablet() || window.mode.isDesktop())) { + var showRuler = true; + if (window.uiDefaults) { + if (window.uiDefaults[docType]) { + showRuler = window.uiDefaults[docType].ShowRuler || false; + } + } var interactiveRuler = this.map.isPermissionEdit(); - L.control.ruler({position:'topleft', interactive:interactiveRuler}).addTo(this.map); + L.control.ruler({position:'topleft', interactive:interactiveRuler, showruler: showRuler}).addTo(this.map); } } @@ -260,6 +266,37 @@ L.Control.UIManager = L.Control.extend({ return $('#document-container').hasClass('tabs-collapsed'); }, + // UI Defaults functions + + showStatusBar: function() { + $('#document-container').css('bottom', this.documentBottom); + $('#presentation-controls-wrapper').css('bottom', this.presentationControlBottom); + $('#toolbar-down').show(); + this.map.invalidateSize(); + }, + + hideStatusBar: function(firstStart) { + if (!firstStart && !this.isStatusBarVisible()) + return; + + this.documentBottom = $('#document-container').css('bottom'); + this.presentationControlBottom = $('#presentation-controls-wrapper').css('bottom'); + $('#document-container').css('bottom', '0px'); + $('#presentation-controls-wrapper').css('bottom','33px'); + $('#toolbar-down').hide(); + }, + + toggleStatusBar: function() { + if (this.isStatusBarVisible()) + this.hideStatusBar(); + else + this.showStatusBar(); + }, + + isStatusBarVisible: function() { + return $('#toolbar-down').is(':visible'); + }, + // Event handlers onUpdatePermission: function(e) { diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js index f9b4a913e..7df9def3d 100644 --- a/loleaflet/src/control/Ruler.js +++ b/loleaflet/src/control/Ruler.js @@ -19,7 +19,8 @@ L.Control.Ruler = L.Control.extend({ tabs: [], unit: null, DraggableConvertRatio: null, - timer: null + timer: null, + showruler: true }, onAdd: function(map) { @@ -149,6 +150,12 @@ L.Control.Ruler = L.Control.extend({ _initLayout: function() { this._rWrapper = L.DomUtil.create('div', 'loleaflet-ruler leaflet-bar leaflet-control leaflet-control-custom'); + // We start it hidden rather than not initialzing at all. + // It is due to rulerupdate command that comes from LOK. + // If we delay its initialization, we can't calculate its margins and have to wait for another rulerupdate message to arrive. + if (!this.options.showruler) { + L.DomUtil.setStyle(this._rWrapper, 'display', 'none'); + } this._rFace = L.DomUtil.create('div', 'loleaflet-ruler-face', this._rWrapper); this._rMarginWrapper = L.DomUtil.create('div', 'loleaflet-ruler-marginwrapper', this._rFace); // BP => Break Points |